/* ===== HOW TO PLAY MODAL STYLES ===== */

/* Modal Container - Full viewport overlay */
.howtoplay-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.howtoplay-modal.active {
  display: flex;
  opacity: 1;
  visibility: visible;
  align-items: center;
  justify-content: center;
}

/* Overlay - Backdrop with blur effect */
.howtoplay-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Main Container - Centered card */
.howtoplay-modal-container {
  position: relative;
  z-index: 2001;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-dark-secondary) 100%);
  border-radius: 8px;
  max-width: 1000px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(184, 115, 51, 0.35);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.howtoplay-modal.active .howtoplay-modal-container {
  transform: scale(1);
}

/* Header Styles */
.howtoplay-modal-header {
  position: relative;
  padding: 32px 40px;
  background: linear-gradient(135deg, rgba(184, 115, 51, 0.25), rgba(139, 94, 60, 0.2));
  border-bottom: 1px solid rgba(184, 115, 51, 0.25);
}

.howtoplay-modal-header h2 {
  color: var(--text-light);
  font-size: 2rem;
  margin: 0 0 8px 0;
  font-weight: 700;
}

.howtoplay-subtitle {
  color: var(--text-light-muted);
  font-size: 1rem;
  margin: 0;
}

.howtoplay-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: white;
  font-size: 20px;
}

.howtoplay-close-btn:hover {
  background: rgba(184, 115, 51, 0.3);
  transform: rotate(90deg);
}

/* Tab Navigation */
.howtoplay-tabs {
  display: flex;
  gap: 0;
  background: rgba(45, 55, 72, 0.5);
  padding: 0;
}

.howtoplay-tab {
  flex: 1;
  padding: 16px 24px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.howtoplay-tab:hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(184, 115, 51, 0.18);
}

.howtoplay-tab.active {
  color: white;
  background: rgba(184, 115, 51, 0.2);
  border-bottom-color: var(--color-primary);
}

.howtoplay-tab-icon {
  font-size: 1.25rem;
}

/* Content Area */
.howtoplay-content {
  padding: 32px 40px 44px;
  max-height: calc(85vh - 200px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 115, 51, 0.55) rgba(45, 55, 72, 0.5);
}

.howtoplay-content::-webkit-scrollbar {
  width: 8px;
}

.howtoplay-content::-webkit-scrollbar-track {
  background: rgba(45, 55, 72, 0.5);
  border-radius: 4px;
}

.howtoplay-content::-webkit-scrollbar-thumb {
  background: rgba(184, 115, 51, 0.55);
  border-radius: 4px;
}

.howtoplay-content::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 115, 51, 0.75);
}

/* Tab Panels */
.howtoplay-panel {
  display: none;
  animation: fadeInUp 0.4s ease;
}

.howtoplay-panel.active {
  display: block;
}

.howtoplay-panel[data-panel='story'] {
  --htp-lantern-x: 50%;
  --htp-lantern-y: 26%;
  --htp-lantern-opacity: 0;
  --htp-story-content-light: 0;
  position: relative;
}

.howtoplay-panel[data-panel='story']::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(240px circle at var(--htp-lantern-x) var(--htp-lantern-y), rgba(248, 212, 153, calc(var(--htp-lantern-opacity) * 0.24)) 0%, rgba(184, 115, 51, calc(var(--htp-lantern-opacity) * 0.12)) 36%, transparent 78%);
  opacity: 1;
  z-index: 0;
}

.howtoplay-panel[data-panel='story'] > * {
  position: relative;
  z-index: 1;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Story Panel */
.howtoplay-story-images {
  --htp-story-image-light: 0;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 10px auto;
  max-width: 600px;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 400px;
  overflow: hidden;
  background:
    radial-gradient(170px circle at var(--htp-lantern-x) var(--htp-lantern-y), rgba(244, 206, 147, calc(var(--htp-story-image-light) * 0.24)) 0%, rgba(184, 115, 51, calc(var(--htp-story-image-light) * 0.16)) 30%, rgba(28, 30, 35, 0.32) 78%),
    rgba(21, 25, 32, 0.72);
  border-radius: 6px;
  border: 2px solid rgba(184, 115, 51, 0.25);
  transition: background 0.14s linear, border-color 0.14s linear;
}

.howtoplay-story-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 90%;
  height: 90%;
  max-width: 550px;
  max-height: 550px;
  object-fit: cover;
  filter: drop-shadow(0 4px calc(20px + var(--htp-story-image-light) * 16px) rgba(184, 115, 51, calc(0.22 + var(--htp-story-image-light) * 0.38)));
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.howtoplay-story-image.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  z-index: 1;
}

/* Story Image Carousel Controls */
.htp-image-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  align-items: center;
}

.htp-image-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(184, 115, 51, 0.34);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.htp-image-btn:hover {
  background: rgba(184, 115, 51, 0.55);
  transform: scale(1.15);
  box-shadow: 0 6px 16px rgba(184, 115, 51, 0.35);
}

.htp-image-btn:active {
  transform: scale(0.95);
}

.htp-image-indicators {
  display: flex;
  gap: 10px;
  align-items: center;
}

.htp-image-indicator {
  width: 10px;
  height: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.htp-image-indicator.active {
  background: #667eea;
  transform: scale(1.4);
  box-shadow: 0 0 12px rgba(102, 126, 234, 0.6);
}

.howtoplay-story-content {
  position: relative;
  margin-top: 22px;
  padding: 22px 24px 30px;
  border-radius: 10px;
  border: 1px solid rgba(154, 112, 72, 0.46);
  background: url('../js/hide.jpg') center center / cover no-repeat;
  box-shadow:
    inset 0 1px 0 rgba(236, 206, 161, 0.22),
    inset 0 -14px 22px rgba(20, 15, 11, 0.52),
    inset 0 0 0 999px rgba(14, 10, 8, 0.46),
    0 12px 30px rgba(8, 6, 5, 0.28);
  overflow: hidden;
  color: rgba(247, 238, 221, calc(0.24 + var(--htp-story-content-light) * 0.72));
  line-height: 1.8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: color 0.14s linear, background 0.16s linear, border-color 0.16s linear, box-shadow 0.16s linear, text-shadow 0.14s linear;
}

.howtoplay-story-content::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(220px circle at var(--htp-lantern-x) var(--htp-lantern-y), rgba(248, 213, 155, calc(var(--htp-story-content-light) * 0.2)) 0%, rgba(184, 115, 51, calc(var(--htp-story-content-light) * 0.12)) 34%, rgba(13, 10, 8, 0.26) 72%),
    linear-gradient(to right, rgba(52, 37, 25, 0.54), transparent 11%, transparent 89%, rgba(52, 37, 25, 0.5)),
    linear-gradient(to bottom, rgba(21, 15, 11, 0.4), transparent 16%, transparent 88%, rgba(20, 14, 10, 0.34));
  z-index: 0;
}

.howtoplay-story-content::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(98deg, rgba(163, 123, 85, 0.08) 0 2px, transparent 2px 8px),
    linear-gradient(to bottom, rgba(12, 9, 7, 0.16), rgba(12, 9, 7, 0.22));
  mix-blend-mode: soft-light;
  z-index: 0;
}

.howtoplay-story-paragraph {
  --htp-story-line-light: 0;
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
  font-size: 1rem;
  color: rgba(246, 236, 219, calc(0.24 + var(--htp-story-line-light) * 0.7));
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.66),
    0 0 calc(2px + var(--htp-story-line-light) * 14px) rgba(255, 214, 147, calc(var(--htp-story-line-light) * 0.24));
  transition: color 0.14s linear, text-shadow 0.14s linear;
}

.howtoplay-story-paragraph:last-child {
  margin-bottom: 6px;
}

.howtoplay-story-paragraph strong {
  color: rgba(222, 170, 110, calc(0.62 + var(--htp-story-line-light) * 0.34));
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: color 0.14s linear;
}

/* Tutorial Panel */
.howtoplay-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.howtoplay-feature-card {
  background: rgba(45, 55, 72, 0.5);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
}

.howtoplay-feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(102, 126, 234, 0.5);
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
}

.howtoplay-feature-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.howtoplay-feature-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.4));
}

.howtoplay-feature-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: white;
  margin: 0;
}

.howtoplay-feature-points {
  list-style: none;
  padding: 0;
  margin: 0;
}

.howtoplay-feature-point {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}

.howtoplay-feature-point::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: #667eea;
}

.howtoplay-feature-point:last-child {
  margin-bottom: 0;
}

.howtoplay-feature-point strong {
  color: #667eea;
  font-weight: 600;
}

.howtoplay-victory-note {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
  border: 1px solid rgba(102, 126, 234, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  color: white;
  font-size: 1rem;
}

.howtoplay-victory-note strong {
  color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
  .howtoplay-modal-container {
    width: 95%;
    max-height: 90vh;
  }

  .howtoplay-modal-header {
    padding: 24px 20px;
  }

  .howtoplay-modal-header h2 {
    font-size: 1.5rem;
  }

  .howtoplay-close-btn {
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
  }

  .howtoplay-content {
    padding: 24px 20px 34px;
    max-height: calc(90vh - 180px);
  }

  .howtoplay-tabs {
    flex-direction: column;
  }

  .howtoplay-tab {
    padding: 12px 16px;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  .howtoplay-tab.active {
    border-left-color: #667eea;
  }

  .howtoplay-features-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .howtoplay-story-images {
    max-width: 100%;
    min-height: 300px;
    margin: 24px auto;
  }

  .howtoplay-story-image {
    width: 95%;
    height: 95%;
  }

  .htp-image-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .htp-image-controls {
    gap: 12px;
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .howtoplay-modal-header h2 {
    font-size: 1.25rem;
  }

  .howtoplay-subtitle {
    font-size: 0.875rem;
  }

  .howtoplay-feature-card {
    padding: 16px;
  }

  .howtoplay-story-paragraph {
    font-size: 0.9375rem;
  }

  .howtoplay-story-content {
    padding: 18px 16px;
    margin-top: 18px;
    padding-bottom: 24px;
  }

  .howtoplay-story-images {
    max-width: 100%;
    min-height: 240px;
    margin: 20px auto;
    border-width: 1px;
  }

  .howtoplay-story-image {
    width: 80%;
    height: 75%;
  }
  
  .htp-image-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .htp-image-indicator {
    width: 8px;
    height: 8px;
  }
  
  .htp-image-controls {
    gap: 10px;
    margin-top: 16px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .howtoplay-modal,
  .howtoplay-modal-container,
  .howtoplay-tab,
  .howtoplay-feature-card {
    transition: none;
    animation: none;
  }

  .howtoplay-panel[data-panel='story'] {
    --htp-lantern-opacity: 1;
    --htp-story-content-light: 1;
  }

  .howtoplay-story-images {
    --htp-story-image-light: 1;
  }

  .howtoplay-story-paragraph {
    --htp-story-line-light: 1;
  }
}

/* Focus styles for keyboard navigation */
.howtoplay-tab:focus,
.howtoplay-close-btn:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}
