/* ═══════════════════════════════════════════════════════════
   СУПЕРГЛАЗКА — Новая глава
   ═══════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ─── */
:root {
  --bg-primary: #1a0b2e;
  --bg-secondary: #2e1065;
  --bg-glass: rgba(255, 255, 255, 0.06);
  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.6);
  --neon-purple: #c084fc;
  --neon-cyan: #e879f9;
  --neon-amber: #f472b6;
  --neon-pink: #ec4899;
  --gradient-primary: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
  --gradient-hero: linear-gradient(135deg, #9333ea, #e879f9, #f472b6);
  --shadow-neon-purple: 0 0 30px rgba(192, 132, 252, 0.4);
  --shadow-neon-cyan: 0 0 30px rgba(232, 121, 249, 0.4);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME — warm pink-violet (reference: Superglazka)
   ═══════════════════════════════════════════════════════════ */
.theme-light {
  --bg-primary: #f3e8ff;
  --bg-secondary: #ffe4f0;
  --bg-glass: rgba(255, 255, 255, 0.7);
  --text-primary: #3d1a5c;
  --text-secondary: rgba(61, 26, 92, 0.6);
  --neon-purple: #e056c8;
  --neon-cyan: #ff5a5a;
  --neon-amber: #ff8f5a;
  --gradient-primary: linear-gradient(135deg, #e056c8, #ff5a5a);
  --gradient-hero: linear-gradient(135deg, #d946ef, #ff5a5a, #ff8f5a);
  --shadow-neon-purple: 0 0 30px rgba(224, 86, 200, 0.3);
  --shadow-neon-cyan: 0 0 30px rgba(255, 90, 90, 0.3);
}

/* Menu & landing backgrounds */
.theme-light #main-menu {
  background: linear-gradient(180deg, #f3e8ff 0%, #ffe4f0 100%);
}

/* UI panels — light bg, dark text */
.theme-light .frame-top-bar {
  background: linear-gradient(180deg, rgba(26,11,46,0.85) 0%, rgba(26,11,46,0.4) 60%, rgba(26,11,46,0) 100%);
}
.theme-light .bottom-sheet {
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 -10px 40px rgba(0,0,0,0.08);
}
.theme-light .audio-dropdown {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.theme-light .settings-section,
.theme-light .bs-audio-panel {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}
.theme-light .settings-section-title {
  color: rgba(61, 26, 92, 0.5);
  border-bottom-color: rgba(0,0,0,0.06);
}

/* Text inside UI panels — dark */
.theme-light .settings-row-name,
.theme-light .bs-track-name,
.theme-light .bs-narrator-full,
.theme-light .bs-subtitle,
.theme-light .bs-game-island-title,
.theme-light .bs-nav-btn {
  color: #3d1a5c;
}
.theme-light .bs-game-island-sub {
  color: rgba(61, 26, 92, 0.6);
}
.theme-light .bs-section-title {
  color: rgba(61, 26, 92, 0.5);
}

/* Toggles & buttons in light UI */
.theme-light .bs-toggle {
  background: rgba(0,0,0,0.12);
}
.theme-light .bs-toggle.active {
  background: linear-gradient(135deg, #e056c8, #ff5a5a);
}
.theme-light .font-size-btn {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
  color: rgba(61, 26, 92, 0.7);
}
.theme-light .font-size-btn.active {
  background: linear-gradient(135deg, #e056c8, #ff5a5a);
  color: #fff;
}
.theme-light .bs-volume-slider {
  background: rgba(0,0,0,0.1);
}
.theme-light .bs-narrator-fade {
  background: linear-gradient(to bottom, transparent, rgba(243,232,255,0.95));
}
.theme-light .bs-narrator-toggle {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.18);
  color: #3d1a5c;
}
.theme-light .bs-narrator-toggle:hover {
  background: rgba(0,0,0,0.1);
  border-color: rgba(0,0,0,0.28);
}

/* Top bar buttons on light bg */
.theme-light .back-btn,
.theme-light .cinema-toggle-btn,
.theme-light .audio-menu-btn,
.theme-light .frame-top-bar .profile-btn {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
  color: #fff;
}

/* Progress dots — keep light for dark video bg */
.theme-light .progress-dot {
  background: rgba(255,255,255,0.25);
}
.theme-light .progress-dot.seen {
  background: rgba(255,255,255,0.6);
}

/* Chapter cards on light menu */
.theme-light .chapter-card {
  background: rgba(255,255,255,0.6);
  border-color: rgba(0,0,0,0.06);
}
.theme-light .chapter-card:hover {
  border-color: rgba(224, 86, 200, 0.3);
  box-shadow: 0 8px 32px rgba(224, 86, 200, 0.15);
}
.theme-light .chapter-num,
.theme-light .chapter-name,
.theme-light .chapter-desc,
.theme-light .menu-sub {
  color: #3d1a5c;
}
.theme-light .chapter-desc {
  opacity: 0.75;
}
.theme-light .chapter-btn {
  background: linear-gradient(135deg, #e056c8, #ff5a5a);
}

/* Nav arrows on light menu */
.theme-light .nav-arrow {
  background: rgba(255,255,255,0.7);
  border-color: rgba(0,0,0,0.08);
  color: #3d1a5c;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: #fff;
  overflow: hidden;
  line-height: 1.5;
}

/* ─── MAIN MENU ─── */
#main-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(147, 51, 234, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(232, 121, 249, 0.3) 0%, transparent 50%),
    var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  padding: 32px 24px 48px;
  transition: opacity .6s var(--ease-smooth);
  overflow-y: auto;
  overflow-x: hidden;
}
#main-menu.hidden { opacity: 0; pointer-events: none; }

.menu-title {
  font-family: 'Comfortaa', cursive;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 700;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(192, 132, 252, 0.5));
  letter-spacing: 3px;
  text-align: center;
}

.menu-sub {
  font-size: clamp(12px, 2vw, 16px);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 6px;
}
.continue-block {
  text-align: center;
  margin: 16px 0 8px;
  animation: fadeIn 0.4s ease;
}
.continue-label {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
  font-family: 'Nunito', sans-serif;
}
.continue-btn {
  background: linear-gradient(135deg, #c084fc, #e879f9) !important;
  box-shadow: 0 4px 16px rgba(192,132,252,0.3);
}
.theme-light .continue-label {
  color: rgba(0,0,0,0.45);
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 960px;
}

.chapter-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all .3s var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.chapter-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: rgba(192, 132, 252, 0.4);
  box-shadow: var(--shadow-neon-purple);
}

.chapter-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.chapter-card.locked:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.chapter-cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.chapter-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chapter-num {
  font-size: 11px;
  color: var(--neon-amber);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 800;
}

.chapter-name {
  font-family: 'Comfortaa', cursive;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.chapter-desc {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  margin-bottom: 4px;
}

.chapter-btn {
  display: inline-block;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 10px 24px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
  transition: all 0.2s var(--ease-spring);
}

.chapter-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(232, 121, 249, 0.5);
}

.chapter-lock {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
}

.chapter-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* ─── APP MAIN MENU v2 ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 300;
  width: 100%;
  background: rgba(26, 11, 46, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  gap: 16px;
}

.app-logo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-pretitle {
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.logo-title {
  font-family: 'Comfortaa', cursive;
  font-size: clamp(14px, 5vw, 20px);
  font-weight: 700;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-nav a,
.app-nav button {
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s;
}

.app-nav a:hover,
.app-nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.app-nav-mobile {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(10, 6, 24, 0.96);
  backdrop-filter: blur(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.app-nav-mobile.open {
  opacity: 1;
  pointer-events: auto;
}

.app-nav-mobile-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 28px;
  cursor: pointer;
}

.app-nav-mobile a,
.app-nav-mobile button {
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 16px;
}

.app-menu-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.menu-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.continue-card,
.countdown-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-title {
  font-family: 'Comfortaa', cursive;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.card-info {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

.countdown-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.countdown-group {
  text-align: center;
  min-width: 60px;
}

.countdown-value {
  font-family: 'Nunito', monospace;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.countdown-sep {
  font-size: 32px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  line-height: 1;
  padding-top: 4px;
}

.countdown-unit {
  font-size: 11px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 1px;
  margin-top: 4px;
}

.countdown-label {
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.books-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.books-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.book-tab {
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s;
}

.book-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.book-tab.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: rgba(192, 132, 252, 0.3);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.book-grid.hidden {
  display: none;
}

.episode-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.2s var(--ease-spring);
  min-width: 0;
}

.episode-mini:hover {
  transform: translateY(-2px);
  border-color: rgba(192, 132, 252, 0.3);
  box-shadow: 0 4px 16px rgba(192, 132, 252, 0.15);
}

.episode-mini.locked {
  opacity: 0.35;
  cursor: not-allowed;
}

.episode-mini.locked:hover {
  transform: none;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: none;
}

.episode-mini-num {
  font-size: 12px;
  color: var(--neon-amber);
  font-weight: 800;
  letter-spacing: 1px;
}

.episode-mini-title {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.episode-mini-status {
  font-size: 14px;
}

.continue-preview {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 4px;
  border: 1px solid rgba(255,255,255,0.08);
}

.episode-mini-cover {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}

.episode-mini.locked .episode-mini-cover {
  filter: grayscale(0.8);
  opacity: 0.5;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 0.4s var(--ease-smooth);
}

.overall-progress {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}

.overall-progress-text {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
}

.overall-track {
  height: 8px;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .app-nav {
    display: none;
  }
  .app-nav-mobile-toggle {
    display: block;
  }
  .menu-top-row {
    grid-template-columns: 1fr;
  }
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .countdown-value {
    font-size: 28px;
  }
  .countdown-sep {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  #main-menu {
    padding: 16px;
  }
  .app-header {
    padding: 10px 12px;
    gap: 8px;
  }
  .app-menu-container {
    padding: 16px;
    gap: 16px;
  }
  .continue-card,
  .countdown-card,
  .books-panel {
    padding: 16px;
  }
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
  }
  .countdown-group {
    min-width: 48px;
  }
}

/* ─── EPISODE VIEWER ─── */
#episode-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

#episode-viewer.active { display: flex; z-index: 300; }

/* Profile button inside episode viewer */
.viewer-profile-btn {
  position: absolute;
  top: 72px;
  left: 20px;
  right: auto;
  z-index: 20;
  background: rgba(26, 11, 46, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  width: fit-content;
  transition: all .2s;
}
.viewer-profile-btn:hover {
  transform: scale(1.05);
  border-color: var(--neon-purple);
  box-shadow: var(--shadow-neon-purple);
}
.viewer-profile-btn .profile-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

/* Dialogue audio button */
.dialogue-audio-btn {
  position: absolute;
  top: 76px;
  right: 20px;
  z-index: 25;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  transition: all .2s var(--ease-spring);
}
.dialogue-audio-btn:hover {
  transform: scale(1.05);
  border-color: var(--neon-amber);
  box-shadow: 0 0 20px rgba(244, 114, 182, 0.4);
}
.dialogue-audio-btn:active { transform: scale(0.95); }

/* Frame preview image */
.frame-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: opacity .6s var(--ease-smooth);
}
.frame-preview.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Frame preview info overlay */
.frame-preview-info {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 72px;
  gap: 8px;
  transition: opacity .6s var(--ease-smooth);
}
.frame-preview-info.hidden {
  opacity: 0;
  pointer-events: none;
}
.frame-preview-num {
  font-family: 'Comfortaa', cursive;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}
.frame-preview-title {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
  text-align: center;
  max-width: 70%;
}

/* Video play button (centered over preview) */
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 40px rgba(147, 51, 234, 0.5);
  transition: all .2s var(--ease-spring);
  padding-left: 6px;
}
.video-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 60px rgba(232, 121, 249, 0.6);
}
.video-play-btn:active { transform: translate(-50%, -50%) scale(0.95); }

/* Video layer */
.video-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

/* Video element inside layer */
.video-layer video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: pointer;
  opacity: 0;
  z-index: 3;
  transition: opacity .6s var(--ease-smooth);
  pointer-events: none;
}
.video-layer video.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Frame container */
#frame-container { position: absolute; inset: 0; overflow: hidden; }

.frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform .6s var(--ease-smooth);
  will-change: transform;
}

.frame.active { transform: translateY(0); z-index: 10; }
.frame.above { transform: translateY(-100%); }
.frame.below { transform: translateY(100%); }

/* Background image with blur */
.frame-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  transition: filter 1.2s var(--ease-smooth), transform 1.2s var(--ease-smooth);
}

.frame-bg.blurred {
  filter: blur(8px) brightness(0.6) saturate(0.8);
  transform: scale(1.05);
}

.frame-bg.clear {
  filter: blur(0px) brightness(1) saturate(1);
  transform: scale(1);
}

/* Dark overlay for text contrast */
.frame-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(26, 11, 46, 0.5) 0%,
    rgba(26, 11, 46, 0.2) 30%,
    rgba(26, 11, 46, 0.5) 70%,
    rgba(26, 11, 46, 0.95) 100%
  );
  z-index: 1;
  transition: opacity 1s var(--ease-smooth);
}

.frame-overlay.light {
  opacity: 0.3;
}

/* ─── NARRATION PHASE ─── */
.narration-box {
  position: relative;
  z-index: 10;
  max-width: 720px;
  width: 90%;
  background: rgba(26, 11, 46, 0.75);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity .8s var(--ease-smooth), transform .8s var(--ease-smooth);
}

.narration-box.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.narration-label {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--neon-amber);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.narration-text {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.7;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

/* Audio placeholder button */
.audio-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
  width: 48px;
  height: 48px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s var(--ease-spring);
  font-size: 20px;
}

.audio-btn:hover {
  transform: scale(1.1);
  border-color: var(--neon-purple);
  box-shadow: var(--shadow-neon-purple);
}

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

.audio-btn .audio-wave {
  display: none;
  gap: 3px;
  align-items: center;
  height: 20px;
}

.audio-btn.playing .audio-icon { display: none; }
.audio-btn.playing .audio-wave { display: flex; }

.audio-wave span {
  width: 3px;
  background: var(--neon-amber);
  border-radius: 2px;
  animation: wave 1s ease-in-out infinite;
}
.audio-wave span:nth-child(1) { height: 8px; animation-delay: 0s; }
.audio-wave span:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.audio-wave span:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.audio-wave span:nth-child(4) { height: 16px; animation-delay: 0.15s; }

@keyframes wave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1.2); }
}

/* ─── VIDEO PHASE ─── */
.video-container {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-container.active { display: flex; }

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(160deg, #1a0f2e, #0f0a1e);
  color: rgba(255, 255, 255, 0.5);
}

.video-placeholder .ph-icon {
  font-size: 64px;
  opacity: 0.3;
}

.video-placeholder .ph-text {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.video-placeholder .ph-note {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  max-width: 300px;
  text-align: center;
  line-height: 1.5;
}

.video-error {
  background: linear-gradient(160deg, #1a0f2e, #2d1b69) !important;
}

.video-error .video-placeholder .ph-text {
  color: #ef4444;
  font-weight: 700;
}

/* ─── PLAY BUTTON (top right) ─── */
.play-clip-btn {
  position: absolute;
  top: 20px;
  right: 80px;
  z-index: 20;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 12px 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 25px rgba(147, 51, 234, 0.5);
  display: none;
  align-items: center;
  gap: 8px;
  transition: all .2s var(--ease-spring);
  animation: btnAppear .5s var(--ease-spring) both;
}

@keyframes btnAppear {
  from { opacity: 0; transform: translateY(-10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.play-clip-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 35px rgba(232, 121, 249, 0.6);
}

.play-clip-btn:active { transform: scale(0.98); }

.play-clip-btn.visible { display: flex; }

/* ─── NEXT FRAME PANEL ─── */
.next-frame-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(26, 11, 46, 0.85);
  backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 24px 32px;
  display: none;
  align-items: center;
  justify-content: space-between;
  transform: translateY(100%);
  transition: transform .6s var(--ease-spring);
}

.next-frame-panel.visible {
  display: flex;
  transform: translateY(0);
}

.next-frame-text {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.next-frame-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 14px 32px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 25px rgba(147, 51, 234, 0.5);
  transition: all .2s var(--ease-spring);
}

.next-frame-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 35px rgba(232, 121, 249, 0.6);
}

/* ─── PROGRESS BAR ─── */
.progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  box-shadow: 0 0 15px rgba(192, 132, 252, 0.6);
  transition: width .6s var(--ease-smooth);
}

.frame-counter {
  position: absolute;
  top: 20px;
  left: 76px;
  z-index: 20;
  font-family: 'Comfortaa', cursive;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(26, 11, 46, 0.5);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── BACK BUTTON ─── */
.back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 20;
  background: rgba(26, 11, 46, 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  transition: all .2s var(--ease-spring);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

/* ─── TRANSITION OVERLAY ─── */
#transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg-primary);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  transition: opacity .5s var(--ease-smooth);
}

#transition-overlay.visible {
  display: flex;
  opacity: 1;
}

.transition-text {
  font-family: 'Comfortaa', cursive;
  font-size: 24px;
  color: #fff;
  text-align: center;
  max-width: 400px;
  line-height: 1.5;
}

/* ─── GAME TRANSITION OVERLAY ─── */
#game-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: linear-gradient(160deg, #1a0f2e, #2d1b69);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  transition: opacity .4s var(--ease-smooth);
}

#game-transition-overlay.visible {
  display: flex;
  opacity: 1;
}

.gt-title { font-family: 'Comfortaa', cursive; font-size: 28px; color: #fff; text-shadow: 0 2px 12px rgba(147, 51, 234, 0.8); }
.gt-sub { font-size: 14px; color: rgba(255, 255, 255, 0.7); font-weight: 600; text-align: center; max-width: 300px; line-height: 1.5; }

/* ─── LEGACY GAME OVERLAY STYLES ─── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 350;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 16px;
}

.overlay.visible { display: flex; }

.tr-badge {
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, #f472b6, #ef4444);
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(244, 114, 182, 0.4);
  animation: trP .5s cubic-bezier(.34, 1.56, .64, 1) .1s both;
}

@keyframes trP { from { transform: scale(0); } to { transform: scale(1); } }

.tr-title { font-family: 'Comfortaa', cursive; font-size: 28px; color: #fff; text-shadow: 0 2px 12px rgba(147, 51, 234, 0.8); }
.tr-sub { font-size: 14px; color: rgba(255, 255, 255, 0.7); font-weight: 600; text-align: center; max-width: 300px; line-height: 1.5; }
.tr-btn, .win-btn {
  background: linear-gradient(135deg, #9333ea, #e879f9);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  padding: 14px 38px;
  font-family: 'Nunito', sans-serif;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.5);
  transition: transform .15s;
}

.tr-btn:active, .win-btn:active { transform: scale(0.95); }

/* Runner game */
#game-overlay-runner {
  background: linear-gradient(180deg, #1a0f2e 0%, #0f0a1e 100%);
  padding: 18px;
  justify-content: flex-start;
  overflow-y: auto;
}

.game-header { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 500px; margin-bottom: 6px; }
.score-pill { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 50px; padding: 6px 16px; display: flex; gap: 10px; align-items: center; }
.score-lbl { font-size: 10px; color: rgba(255, 255, 255, 0.4); font-weight: 800; }
.score-val { font-family: 'Comfortaa', cursive; font-size: 20px; color: #f472b6; }
.lives-val { font-size: 16px; }

#runner-canvas { width: 100%; max-width: 400px; height: auto; border-radius: 16px; border: 2px solid rgba(255, 255, 255, 0.15); background: linear-gradient(180deg, #2d1b4a 0%, #1a0f2e 50%, #0f0a1e 100%); touch-action: none; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); }
.runner-controls { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.runner-hint { font-size: 13px; color: rgba(255, 255, 255, 0.6); font-weight: 700; text-align: center; padding: 8px 16px; background: rgba(255, 255, 255, 0.08); border-radius: 20px; }
.runner-stats { display: flex; gap: 20px; margin-top: 5px; }
.runner-stat { text-align: center; }
.runner-stat-val { font-size: 18px; font-weight: 900; color: #f472b6; }
.runner-stat-lbl { font-size: 10px; color: rgba(255, 255, 255, 0.4); }

/* Win overlay */
#win-overlay { background: linear-gradient(160deg, #0f2027, #203a43, #2c5364); animation: fadeIn .4s; }
.win-stars { display: flex; gap: 8px; font-size: 48px; }
.win-star { animation: starPop .4s cubic-bezier(.34, 1.56, .64, 1) both; }
.win-star:nth-child(1) { animation-delay: .1s; }
.win-star:nth-child(2) { animation-delay: .25s; }
.win-star:nth-child(3) { animation-delay: .4s; }
@keyframes starPop { from { opacity: 0; transform: scale(0) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
.win-title { font-family: 'Comfortaa', cursive; font-size: 30px; color: #fff; text-shadow: 0 2px 15px rgba(232, 121, 249, 0.6); }
.win-sub { font-size: 14px; color: rgba(255, 255, 255, 0.65); font-weight: 600; text-align: center; max-width: 280px; line-height: 1.5; }

/* Stats overlays */
.stats-title { font-family: 'Comfortaa', cursive; font-size: 24px; color: #fff; margin-bottom: 10px; }
.stats-card { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 20px; width: 100%; max-width: 460px; backdrop-filter: blur(10px); }
.stats-section { margin-bottom: 16px; }
.stats-section h3 { font-size: 13px; color: rgba(255, 255, 255, 0.7); margin-bottom: 8px; }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; color: rgba(255, 255, 255, 0.6); margin-bottom: 4px; }
.stat-value { font-weight: 900; color: #fff; }
.total-score { font-size: 18px; font-weight: 900; color: #f472b6; text-align: center; margin-top: 12px; }
.stats-time { font-size: 14px; color: rgba(255, 255, 255, 0.7); margin-bottom: 16px; text-align: center; }

/* Registration overlays */
.reg-title { font-family: 'Comfortaa', cursive; font-size: 24px; color: #fff; text-align: center; }
.reg-card { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 24px; width: 100%; max-width: 400px; backdrop-filter: blur(10px); }
.reg-description { font-size: 14px; color: rgba(255, 255, 255, 0.7); line-height: 1.6; margin-bottom: 20px; }
.reg-form { display: flex; flex-direction: column; gap: 12px; }
.reg-input { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 12px; padding: 12px 16px; color: #fff; font-family: 'Nunito', sans-serif; font-size: 14px; outline: none; transition: border-color .2s; }
.reg-input:focus { border-color: var(--neon-purple); }
.reg-input::placeholder { color: rgba(255, 255, 255, 0.4); }
.reg-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.7); cursor: pointer; }
.reg-checkbox input { width: 16px; height: 16px; accent-color: var(--neon-purple); }
.reg-skip { background: none; border: none; color: rgba(255, 255, 255, 0.4); font-family: 'Nunito', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 16px; transition: color .2s; }
.reg-skip:hover { color: rgba(255, 255, 255, 0.7); }

/* Gym game */
#game-overlay-gym { background: linear-gradient(180deg, #1a0f2e 0%, #0f0a1e 100%); padding: 18px; justify-content: flex-start; overflow-y: auto; }
.boss-bg-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.boss-overlay-darken { position: absolute; inset: 0; background: rgba(26, 11, 46, 0.5); z-index: 1; }
.gym-header-new { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 460px; margin-bottom: 12px; gap: 12px; }
.boss-hp-display { flex: 1; }
.boss-label { font-size: 12px; font-weight: 900; color: #f472b6; letter-spacing: 1px; }
.boss-hp-bar-large { height: 10px; background: rgba(255, 255, 255, 0.15); border-radius: 5px; margin-top: 4px; overflow: hidden; }
.boss-hp-fill-large { height: 100%; background: linear-gradient(90deg, #ef4444, #f472b6); transition: width .4s ease; }
.rays-counter-new { text-align: right; }
.rays-label { font-size: 10px; color: rgba(255, 255, 255, 0.5); }
.rays-icons { font-size: 18px; }
.player-vanya { position: relative; z-index: 10; width: 80px; margin: 20px auto; }
.player-vanya img { width: 100%; }
.player-charge-indicator { position: absolute; bottom: -8px; left: 0; right: 0; height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; overflow: hidden; }
.player-charge-indicator.charging::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--charge, 0%); background: linear-gradient(90deg, #22c55e, #4ade80); transition: width .1s; }
.attack-effects { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.phase-controls { position: relative; z-index: 10; width: 100%; max-width: 460px; margin-top: auto; }
.skip-btn { position: absolute; bottom: 20px; right: 20px; z-index: 20; background: none; border: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.6); padding: 8px 16px; border-radius: 20px; font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 700; cursor: pointer; }

/* Fade in animation */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  .menu-title { font-size: 28px; }
  .chapters-grid { grid-template-columns: 1fr; max-width: 320px; }
  .narration-text { font-size: 15px; }
  .play-clip-btn { right: 20px; top: 70px; padding: 10px 18px; font-size: 12px; }
  .next-frame-panel { flex-direction: column; gap: 16px; text-align: center; }
  .tr-title { font-size: 22px; }
  .win-title { font-size: 24px; }
  .stats-title { font-size: 20px; }
}

/* Hide old narration & phase elements inside frames */
.frame .frame-bg,
.frame .frame-overlay,
.frame .narration-box,
.frame .play-clip-btn,
.frame .video-container,
.frame .next-frame-panel {
  display: none !important;
}

/* Touch sparkle effect */
.sparkle {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, #fff 0%, #fbbf24 40%, transparent 70%);
  border-radius: 50%;
  animation: sparkleAnim .7s ease-out forwards;
}
.sparkle.star {
  background: none;
  width: auto;
  height: auto;
  font-size: 14px;
  color: #fbbf24;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.8);
  animation: sparkleStarAnim .7s ease-out forwards;
}
@keyframes sparkleAnim {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0); opacity: 0; }
}
@keyframes sparkleStarAnim {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0) rotate(180deg); opacity: 0; }
}

/* Swipe hint */
.swipe-hint {
  position: absolute;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(26, 11, 46, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  opacity: 1;
  transition: opacity 1s var(--ease-smooth);
  white-space: nowrap;
}
.swipe-hint.hidden {
  opacity: 0;
}

/* Bottom navigation bar */
.frame-nav-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(26, 11, 46, 0.85);
  backdrop-filter: blur(30px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.nav-counter {
  font-family: 'Comfortaa', cursive;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  white-space: nowrap;
}

/* Game dock */
.game-dock {
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-chip {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(147, 51, 234, 0.4);
  transition: all .2s var(--ease-spring);
  animation: gameChipPulse 2s ease-in-out infinite;
}
.game-chip:hover {
  transform: scale(1.15);
  box-shadow: 0 0 30px rgba(232, 121, 249, 0.5);
}
.game-chip:active { transform: scale(0.9); }

@keyframes gameChipPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(147, 51, 234, 0.4); }
  50% { box-shadow: 0 0 35px rgba(232, 121, 249, 0.6); }
}

/* ─── NARRATOR BAR ─── */
.narrator-bar {
  position: absolute;
  bottom: 96px;
  left: 10%;
  right: 10%;
  z-index: 20;
  max-height: 15vh;
  background: rgba(26, 11, 46, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 18px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.55;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  scrollbar-width: thin;
  transition: transform .4s var(--ease-smooth), opacity .3s;
}

.narrator-bar::-webkit-scrollbar {
  width: 4px;
}

.narrator-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.narrator-content {
  white-space: pre-wrap;
}

.narrator-cursor {
  display: inline-block;
  color: var(--neon-cyan);
  font-weight: 700;
  animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Narrator toggle button */
.narrator-toggle {
  position: absolute;
  bottom: 64px;
  right: calc(10% + 6px);
  z-index: 22;
  background: var(--gradient-primary);
  border: none;
  border-radius: 50px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
  transition: all .2s var(--ease-spring);
  white-space: nowrap;
  width: fit-content;
}
.narrator-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 30px rgba(232, 121, 249, 0.5);
}
.narrator-toggle:active { transform: scale(0.95); }
.narrator-toggle .nt-icon { font-size: 14px; font-weight: 900; }
.narrator-toggle .nt-label { font-size: 11px; font-weight: 700; }

/* Collapsed narrator bar */
.narrator-bar.collapsed {
  transform: translateY(calc(100% + 20px));
  opacity: 0;
  pointer-events: none;
}

/* ─── TRANSITION POPUP ─── */
.transition-popup {
  position: absolute;
  bottom: 84px;
  left: 10%;
  right: 10%;
  z-index: 25;
  background: rgba(26, 11, 46, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-md);
  border: 1px solid rgba(192, 132, 252, 0.35);
  padding: 14px 20px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(192, 132, 252, 0.15);
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity .4s var(--ease-smooth), transform .4s var(--ease-spring);
}

.transition-popup.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.transition-popup-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
}

.transition-popup-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 10px 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
  transition: all .2s var(--ease-spring);
}

.transition-popup-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(232, 121, 249, 0.5);
}

.transition-popup-btn:active {
  transform: scale(0.95);
}

@media (max-width: 640px) {
  .frame-nav-bar {
    padding: 12px 16px;
  }
  .game-chip {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  .nav-counter {
    font-size: 11px;
  }
  .narrator-bar {
    font-size: 13px;
    padding: 8px 12px;
    bottom: 84px;
  }
  .swipe-hint {
    bottom: 54px;
    font-size: 11px;
    padding: 4px 12px;
  }
  .narrator-toggle {
    bottom: 54px;
    right: calc(5% + 6px);
    padding: 6px 12px;
  }
  .transition-popup {
    left: 5%;
    right: 5%;
    bottom: 76px;
    padding: 10px 14px;
  }
  .transition-popup-text {
    font-size: 13px;
  }
  .transition-popup-btn {
    padding: 8px 20px;
    font-size: 12px;
  }
}


/* ═══════════════════════════════════════════════════════════
   PROFILE
   ═══════════════════════════════════════════════════════════ */
.profile-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 210;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  transition: all .2s var(--ease-spring);
}

.profile-btn:hover {
  transform: scale(1.05);
  border-color: var(--neon-purple);
  box-shadow: var(--shadow-neon-purple);
}

.profile-coins-val {
  color: #f472b6;
  font-weight: 900;
}

#profile-modal {
  background: rgba(26, 11, 46, 0.92);
  z-index: 250;
}

#profile-modal .profile-card {
  background: rgba(20, 12, 40, 0.9);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 90%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  position: relative;
}

.profile-modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
  transition: color .2s;
}

.profile-modal-close:hover {
  color: #fff;
}

/* ─── ACHIEVEMENTS MODAL ─── */
#achievements-modal {
  background: rgba(26, 11, 46, 0.92);
  z-index: 400;
}

#achievements-modal .achievements-modal-content {
  background: rgba(20, 12, 40, 0.9);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.achievements-modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  cursor: pointer;
  transition: color .2s;
  z-index: 2;
}

.achievements-modal-close:hover {
  color: #fff;
}

.achievements-modal-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.achievements-modal-header h2 {
  font-family: 'Comfortaa', cursive;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.achievements-counter {
  font-size: 15px;
  font-weight: 700;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(192, 132, 252, 0.25);
}

@media (max-width: 768px) {
  #achievements-modal .achievements-modal-content {
    padding: 20px 16px;
    width: 95%;
    max-height: 95vh;
  }
  .achievements-modal-header {
    gap: 8px;
  }
  .achievements-modal-header h2 {
    font-size: 20px;
  }
}

.profile-avatar {
  font-size: 56px;
  line-height: 1;
}

.profile-nickname {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 10px 16px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  outline: none;
  width: 100%;
  max-width: 240px;
}

.profile-nickname:focus {
  border-color: var(--neon-purple);
}

.profile-coins-big {
  font-family: 'Comfortaa', cursive;
  font-size: 36px;
  color: #f472b6;
  text-shadow: 0 2px 12px rgba(244, 114, 182, 0.4);
}

.profile-section-title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--neon-amber);
  align-self: flex-start;
  margin-top: 8px;
}

.profile-episodes,
.profile-games {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 8px 12px;
}

/* ═══════════════════════════════════════════════════════════
   BLINK GAME
   ═══════════════════════════════════════════════════════════ */
#game-overlay-blink {
  background: linear-gradient(180deg, #1a0f2e 0%, #0f0a1e 100%);
  padding: 18px;
  justify-content: flex-start;
  overflow-y: auto;
}

#blink-canvas {
  width: 100%;
  max-width: 400px;
  height: auto;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(160deg, #1a0f2e, #0f0a1e);
  touch-action: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.blink-controls {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.blink-hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  text-align: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.blink-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.blink-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e879f9, #c084fc);
  transition: width .2s ease;
}

/* ═══════════════════════════════════════════════════════════
   TRACKER GAME
   ═══════════════════════════════════════════════════════════ */
#game-overlay-tracker {
  background: linear-gradient(180deg, #0f0a1e 0%, #1a0f2e 100%);
  padding: 18px;
  justify-content: flex-start;
  overflow-y: auto;
}

#tracker-canvas {
  width: 100%;
  max-width: 500px;
  height: auto;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
  touch-action: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.tracker-controls {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.tracker-hint {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  text-align: center;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.tracker-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.tracker-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c084fc, #e879f9);
  transition: width .3s ease;
}


/* ═══════════════════════════════════════════════════════════
   NEW: Stories Pro Layout — Bottom Sheet + Top Bar + Audio
   ═══════════════════════════════════════════════════════════ */

/* ─── TOP BAR ─── */
.frame-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 25% 0;
  background: linear-gradient(180deg, rgba(10,6,24,0.85) 0%, rgba(10,6,24,0.4) 60%, rgba(10,6,24,0) 100%);
  transition: opacity .4s var(--ease-smooth), transform .4s var(--ease-smooth);
  pointer-events: auto;
}

.frame-top-bar.hidden-ui {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.frame-top-bar .back-btn {
  position: static;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  transition: all .2s var(--ease-spring);
}

.frame-top-bar .back-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.1);
}

/* Progress dots */
.progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex: 1;
  margin: 0 20px;
  flex-wrap: wrap;
  overflow: hidden;
  min-width: 0;
}

.progress-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  transition: all .35s var(--ease-spring);
  position: relative;
}
.progress-dot.seen::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 45%;
  width: 2px;
  height: 3px;
  border: solid rgba(255,255,255,0.9);
  border-width: 0 1px 1px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

.progress-dot.active {
  width: 20px;
  border-radius: 3px;
  background: var(--gradient-primary);
  box-shadow: 0 0 10px rgba(168,85,247,0.5);
}

.progress-dot.seen {
  background: rgba(255,255,255,0.7);
}

/* Profile in top bar */
.frame-top-bar .profile-btn {
  position: static;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 50px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 800;
  transition: all .2s var(--ease-spring);
}

.frame-top-bar .profile-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cinema-toggle-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .3s, transform .3s;
}
.cinema-toggle-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.1);
}

.audio-menu-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .3s, transform .3s;
}
.audio-menu-btn:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.1);
}
.audio-menu-btn.active {
  background: var(--gradient-primary);
  box-shadow: 0 0 20px rgba(124,58,237,0.4);
}

.audio-dropdown {
  position: absolute;
  top: 64px;
  right: calc(25% + 8px);
  z-index: 35;
  width: 280px;
  background: rgba(26, 11, 46, 0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.audio-dropdown.visible {
  display: flex;
  animation: dropdownAppear .25s var(--ease-spring) both;
}

@keyframes dropdownAppear {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bs-backdrop {
  position: absolute;
  inset: 0;
  z-index: 24;
  background: rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.bs-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ─── BOTTOM SHEET ─── */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: linear-gradient(0deg, rgba(10,6,24,0.97) 0%, rgba(10,6,24,0.88) 50%, rgba(10,6,24,0.5) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 8px 25% max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 78vh;
  overflow: hidden;
  transform: translateY(0);
  will-change: transform;
  touch-action: none;
  transition: transform .35s cubic-bezier(0.32, 0.72, 0, 1);
}

.bottom-sheet.hidden-ui {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .4s, transform .4s;
}

/* Collapsed state marker */
.bottom-sheet.collapsed {
  max-height: 110px;
}
.bottom-sheet.collapsed .bs-expanded {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
}

/* Hidden state marker */
.bottom-sheet.hidden .bs-subtitle,
.bottom-sheet.hidden .bs-controls,
.bottom-sheet.hidden .bs-expanded {
  opacity: 0;
  pointer-events: none;
}

.bottom-sheet.collapsed .bs-subtitle {
  display: block;
  height: 1.5em;
  line-height: 1.5em;
  overflow: hidden;
  text-align: center;
  transition: opacity .3s ease, transform .3s ease;
}
.bottom-sheet.collapsed .bs-subtitle-icon {
  display: none;
}
.bottom-sheet.collapsed .bs-subtitle.switching {
  opacity: 0;
  transform: translateY(6px);
}
.bottom-sheet:not(.collapsed) .bs-subtitle {
  display: none;
}

/* Floating subtitle overlay */
.subtitle-overlay {
  position: absolute;
  bottom: 130px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: 90%;
  text-align: center;
  pointer-events: auto;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  transition: opacity .3s ease;
}
.sub-line {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  transition: opacity .3s ease, transform .3s ease;
}
.subtitle-overlay.switching .sub-line {
  opacity: 0;
  transform: translateY(6px);
}
.subtitle-overlay.hidden {
  opacity: 0;
}

/* Hide legacy bs-subtitle completely (replaced by overlay) */
.bs-subtitle {
  display: none !important;
}

/* Drag handle */
/* Drag handle */
.bs-drag-handle {
  align-self: center;
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.25);
  border-radius: 2px;
  margin-bottom: 4px;
  cursor: grab;
  flex-shrink: 0;
}
.bs-drag-handle:active {
  cursor: grabbing;
}

/* Subtitle row */
.bs-subtitle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  min-height: 20px;
  transition: all .3s;
}

.bs-subtitle-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.bs-subtitle-text {
  flex: 1;
  white-space: pre-wrap;
}

/* Controls row (collapsed) */
.bs-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
  flex-shrink: 0;
}

.bs-audio-toggle {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(124,58,237,0.4);
  transition: all .2s var(--ease-spring);
  flex-shrink: 0;
}

.bs-audio-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(6,182,212,0.5);
}

.bs-audio-toggle:active {
  transform: scale(0.95);
}

.bs-audio-toggle.playing {
  animation: audioPulse 1.5s ease-in-out infinite;
}

@keyframes audioPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,0.4); }
  50% { box-shadow: 0 0 35px rgba(6,182,212,0.7); }
}

/* ─── EXPANDED CONTENT ─── */
.bs-expanded {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
  overflow-y: auto;
  touch-action: pan-y;
  opacity: 1;
  transition: opacity .3s;
  flex: 1 1 auto;
  min-height: 0;
}

.bs-section-title {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--neon-amber);
  margin-bottom: -4px;
}

/* Full narrator text */
.bs-narrator-full {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  line-height: 1.6;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: pre-wrap;
  max-height: 22vh;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}

.bs-narrator-full::-webkit-scrollbar {
  width: 4px;
}
.bs-narrator-full::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
}

/* Audio panel */
.bs-audio-panel {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bs-track-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bs-track-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.bs-track-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all .3s;
}

.bs-track-icon.playing {
  background: var(--gradient-primary);
  box-shadow: 0 0 15px rgba(168,85,247,0.4);
  animation: trackPulse 1.2s ease-in-out infinite;
}

@keyframes trackPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.bs-track-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bs-track-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.bs-track-status {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

/* Toggle switch */
.bs-toggle {
  width: 46px;
  height: 26px;
  background: rgba(255,255,255,0.15);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background .3s;
  flex-shrink: 0;
}

.bs-toggle.active {
  background: linear-gradient(135deg, #c084fc, #e879f9);
}

.bs-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .3s var(--ease-spring);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.bs-toggle.active::after {
  transform: translateX(20px);
}

/* Volume slider */
.bs-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.bs-volume-row.compact {
  gap: 8px;
  margin-top: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.bs-volume-row .vol-icon {
  font-size: 14px;
  opacity: 0.7;
  flex-shrink: 0;
}

.vol-value {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.bs-volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  outline: none;
}

.bs-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(168,85,247,0.5);
}

.bs-volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--gradient-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px rgba(168,85,247,0.5);
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════ */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 70vh;
  overflow-y: auto;
}
.settings-section {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.settings-row.audio-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.settings-row.audio-row .settings-row-info {
  width: 100%;
}
.settings-row.audio-row .bs-volume-row.compact {
  width: 100%;
  justify-content: flex-start;
}
.settings-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}
.settings-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.settings-row-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.settings-row-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Font size buttons */
.font-size-group {
  display: flex;
  gap: 4px;
}
.font-size-btn {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.7);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.font-size-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.25);
}
.font-size-btn.active {
  background: linear-gradient(135deg, #c084fc, #e879f9);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 12px rgba(192,132,252,0.35);
}

/* Subtitle sizes */
body.subtitle-small .subtitle-overlay .sub-line {
  font-size: 14px;
}
body.subtitle-medium .subtitle-overlay .sub-line {
  font-size: 18px;
}
body.subtitle-large .subtitle-overlay .sub-line {
  font-size: 24px;
}

/* UI text sizes */
body.ui-small {
  font-size: 13px;
}
body.ui-large {
  font-size: 17px;
}
body.ui-large .bs-track-name,
body.ui-large .settings-row-name {
  font-size: 15px;
}
body.ui-large .bs-section-title,
body.ui-large .settings-section-title {
  font-size: 13px;
}

/* Subtitles hidden */
body.subtitles-off .subtitle-overlay {
  display: none !important;
}
body.subtitles-off #bsSubtitle {
  display: none !important;
}

/* High-contrast mode */
body.high-contrast {
  --bg-primary: #000000;
  --bg-secondary: #1a1a1a;
  --neon-purple: #ff00ff;
  --neon-cyan: #00ffff;
  --neon-amber: #ffff00;
}
body.high-contrast .frame-top-bar,
body.high-contrast .bottom-sheet,
body.high-contrast .audio-dropdown {
  background: rgba(0,0,0,0.98) !important;
  border-color: #fff !important;
}
body.high-contrast .progress-dot {
  background: rgba(255,255,255,0.3) !important;
}
body.high-contrast .progress-dot.active {
  background: #ffff00 !important;
  box-shadow: 0 0 12px #ffff00 !important;
}

/* Reduce motion */
body.reduce-motion * {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
body.reduce-motion .bottom-sheet {
  transition: none !important;
}

/* FAQ panel */
.faq-panel { padding: 0 !important; }
.faq-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-header h3 {
  margin: 0;
  font-family: 'Comfortaa', cursive;
  font-size: 16px;
  color: #fff;
}
.theme-light .faq-header h3 { color: #3d1a5c; }
.faq-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 6px;
  transition: background .2s;
}
.faq-close:hover { background: rgba(255,255,255,0.1); }
.theme-light .faq-close { color: #3d1a5c; }
.theme-light .faq-close:hover { background: rgba(0,0,0,0.06); }
.faq-list {
  padding: 8px 20px;
  max-height: 60vh;
  overflow-y: auto;
}
.faq-item {
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.theme-light .faq-item { border-color: rgba(0,0,0,0.06); }
.faq-item:last-child { border-bottom: none; }
.faq-item summary {
  padding: 14px 0;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #fff;
  user-select: none;
}
.theme-light .faq-item summary { color: #3d1a5c; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '▼';
  font-size: 10px;
  transition: transform .25s var(--ease-spring);
  color: rgba(255,255,255,0.5);
}
.theme-light .faq-item summary::after { color: rgba(0,0,0,0.4); }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p {
  padding: 0 0 14px;
  margin: 0;
  color: rgba(255,255,255,0.7);
  line-height: 1.65;
  font-size: 13px;
}
.theme-light .faq-item p { color: rgba(0,0,0,0.65); }

/* Scrollbar for settings panel */
.settings-panel::-webkit-scrollbar {
  width: 4px;
}
.settings-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

/* Game panel */
.bs-game-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bs-game-island {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(6,182,212,0.25));
  border: 1px solid rgba(168,85,247,0.35);
  border-radius: var(--radius-xl);
  padding: 14px 18px;
  margin: 4px 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: islandAppear .4s var(--ease-spring) both;
  cursor: pointer;
  transition: all .2s var(--ease-spring);
}
.bs-game-island:hover {
  transform: scale(1.02);
  border-color: rgba(168,85,247,0.6);
  box-shadow: 0 8px 30px rgba(124,58,237,0.25);
}
.bs-game-island-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.bs-game-island-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.bs-game-island-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}
.bs-game-island-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}
.bs-game-island-btn {
  background: var(--gradient-primary);
  border: none;
  border-radius: 50px;
  padding: 8px 20px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all .2s var(--ease-spring);
  flex-shrink: 0;
}
.bs-game-island-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
}

@keyframes islandAppear {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bs-game-chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  transition: all .2s var(--ease-spring);
}

.bs-game-chip:hover {
  background: rgba(168,85,247,0.2);
  border-color: rgba(168,85,247,0.4);
  transform: translateY(-2px);
}

.bs-game-chip-icon {
  font-size: 20px;
}

/* Bottom nav in expanded */
.bs-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.bs-nav-btn {
  background: none;
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bs-nav-btn:hover {
  background: rgba(255,255,255,0.08);
}

/* ═══════════════════════════════════════════════════════════
   NARRATOR TEXT — COLLAPSE/EXPAND
   ═══════════════════════════════════════════════════════════ */
.bs-narrator-wrapper {
  position: relative;
  transition: max-height .4s ease;
}
.bs-narrator-wrapper.collapsed {
  max-height: 32px;
  overflow: hidden;
}
.bs-narrator-wrapper.collapsed .bs-narrator-full {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bs-narrator-wrapper.collapsed .bs-narrator-full::-webkit-scrollbar {
  display: none;
}
.bs-narrator-wrapper.collapsed .bs-narrator-fade {
  display: none;
}
.bs-narrator-wrapper.expanded {
  max-height: none;
}
.bs-narrator-wrapper.expanded .bs-narrator-fade {
  display: none;
}
.bs-narrator-wrapper.expanded .bs-narrator-full {
  max-height: 40vh;
  overflow-y: auto;
  scrollbar-width: thin;
  -ms-overflow-style: auto;
}
.bs-narrator-wrapper.expanded .bs-narrator-full::-webkit-scrollbar {
  width: 4px;
}
.bs-narrator-wrapper.expanded .bs-narrator-full::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}
.bs-narrator-wrapper.expanded .bs-narrator-full::-webkit-scrollbar-track {
  background: transparent;
}

.bs-narrator-full {
  line-height: 1.65;
  font-size: 15px;
  color: rgba(255,255,255,0.9);
}
.theme-light .bs-narrator-full {
  color: #3d1a5c;
}

.bs-narrator-toggle {
  margin-top: 10px;
  padding: 8px 18px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 24px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s var(--ease-spring);
  align-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bs-narrator-toggle:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.35);
}
.bs-narrator-toggle:active {
  transform: scale(0.97);
}
.bs-narrator-toggle-icon {
  transition: transform .3s var(--ease-spring);
}
.bs-narrator-toggle[aria-expanded="true"] .bs-narrator-toggle-icon {
  transform: rotate(180deg);
}
.bs-narrator-toggle-text {
  display: none;
}

/* ─── UI HIDE MODE ─── */
#episode-viewer.ui-hidden .frame-top-bar,
#episode-viewer.ui-hidden .bottom-sheet,
#episode-viewer.ui-hidden .subtitle-overlay {
  opacity: 0;
  pointer-events: none;
}

#episode-viewer.ui-hidden .frame-top-bar {
  transform: translateY(-10px);
}

#episode-viewer.ui-hidden .bottom-sheet {
  transform: translateY(20px);
}

/* ─── NAV ARROWS ─── */
.nav-arrows {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.nav-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(10,6,24,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  transition: all .2s var(--ease-spring);
  opacity: 1;
}
.nav-arrow:hover {
  background: rgba(255,255,255,0.12);
  transform: scale(1.12);
}
.nav-arrow.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}
#episode-viewer.ui-hidden .nav-arrows {
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s;
}

@media (max-width: 640px) {
  .nav-arrows {
    right: 8px;
    gap: 8px;
  }
  .nav-arrow {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .frame-top-bar {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .bottom-sheet {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  .audio-dropdown {
    right: max(16px, env(safe-area-inset-right));
    width: min(320px, calc(100vw - 32px));
  }
}

@media (max-width: 640px) {
  .frame-top-bar {
    height: 48px;
    padding: env(safe-area-inset-top) 12px 0;
  }
  .frame-top-bar .back-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .progress-dots {
    gap: 4px;
    margin: 0 8px;
  }
  .progress-dot {
    width: 5px;
    height: 5px;
  }
  .progress-dot.active {
    width: 14px;
  }
  .top-bar-right {
    gap: 6px;
  }
  .cinema-toggle-btn,
  .audio-menu-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .frame-top-bar .profile-btn {
    padding: 4px 10px;
    font-size: 12px;
    gap: 4px;
  }
  .bottom-sheet {
    padding: 6px 12px max(12px, env(safe-area-inset-bottom));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .bottom-sheet.collapsed {
    max-height: 100px;
  }
  .bs-subtitle {
    font-size: 13px;
  }
  .subtitle-overlay {
    bottom: max(120px, env(safe-area-inset-bottom) + 100px);
    padding: 6px 12px;
  }
  .sub-line {
    font-size: 14px;
  }
  .bs-audio-toggle {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .bs-expanded {
    gap: 10px;
  }
  .bs-audio-panel,
  .settings-panel {
    padding: 12px;
  }
  .audio-dropdown {
    right: 12px;
    width: calc(100vw - 24px);
  }
  .nav-arrows {
    right: 8px;
    gap: 8px;
  }
  .nav-arrow {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .frame-top-bar .profile-btn .profile-coins-val,
  .frame-top-bar .profile-btn span:last-child {
    display: none;
  }
  .frame-top-bar .profile-btn {
    padding: 4px 8px;
    font-size: 16px;
  }
  .progress-dots {
    gap: 3px;
    margin: 0 6px;
  }
  .progress-dot {
    width: 4px;
    height: 4px;
  }
  .progress-dot.active {
    width: 12px;
  }
  .settings-panel {
    max-height: 60vh;
  }
  .bottom-sheet.collapsed {
    max-height: 90px;
  }
}


/* Fix: main-menu profile button should not be absolute positioned */
#main-menu .profile-btn {
  position: relative;
  top: auto;
  right: auto;
}

/* Fix: allow swipe to pass through top-bar and bottom-sheet */
.frame-top-bar,
.bottom-sheet {
  pointer-events: none;
}
.frame-top-bar *,
.bottom-sheet * {
  pointer-events: auto;
}

/* ─── AUTH MODAL ─── */
#auth-modal {
  background: rgba(10, 6, 24, 0.95);
  z-index: 500;
}

.auth-card {
  background: rgba(20, 12, 40, 0.95);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(192, 132, 252, 0.2);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 20px;
  cursor: pointer;
}

.auth-logo {
  font-family: 'Comfortaa', cursive;
  font-size: 22px;
  font-weight: 700;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 4px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: rgba(192, 132, 252, 0.3);
}

.auth-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.auth-panel.active {
  display: flex;
}

.auth-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
  text-align: center;
}

.auth-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.auth-input:focus {
  border-color: rgba(192, 132, 252, 0.5);
  box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.1);
}

.auth-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.auth-btn {
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
  transition: all 0.2s var(--ease-spring);
}

.auth-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 30px rgba(232, 121, 249, 0.5);
}

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.auth-switch a {
  color: var(--neon-purple);
  text-decoration: none;
  font-weight: 700;
}

/* ─── PROFILE SUBSCRIBE ─── */
.profile-subscribe {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.profile-sub-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
}

.profile-sub-input::placeholder {
  color: rgba(255,255,255,0.3);
}

.profile-sub-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 10px 20px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.profile-sub-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
}

.profile-account {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.profile-account-text {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
}

.theme-light .profile-account-text {
  color: rgba(0,0,0,0.6);
}

.profile-account-email {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  word-break: break-all;
}

.theme-light .profile-account-email {
  color: #3d1a5c;
}

.profile-account-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 10px 20px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.profile-account-btn:hover {
  background: var(--gradient-primary);
  border-color: transparent;
}

.theme-light .profile-account-btn {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.08);
  color: #3d1a5c;
}

.theme-light .profile-account-btn:hover {
  background: linear-gradient(135deg, #c084fc, #e879f9);
  color: #fff;
  border-color: transparent;
}

/* ═══════════════════════════════════════════════════════════
   DEVICE DETECTION CLASSES
   ═══════════════════════════════════════════════════════════ */
body.device-desktop .swipe-hint {
  display: none;
}

body.device-touch .font-size-btn {
  min-height: 44px;
  min-width: 44px;
}

body.device-mobile .bottom-sheet {
  border-radius: 20px 20px 0 0;
}

body.device-desktop .chapter-card:hover {
  transform: translateY(-4px) scale(1.02);
}
body.device-touch .chapter-card:hover {
  transform: none;
}

/* App menu responsive */
@media (max-width: 768px) {
  .chapters-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .chapter-cover {
    height: 140px;
  }
}

@media (max-width: 480px) {
  .chapters-grid {
    grid-template-columns: 1fr;
    max-width: 340px;
  }
  .chapter-cover {
    height: 160px;
  }
  .menu-title {
    letter-spacing: 2px;
  }
}


/* ─── TUTORIAL OVERLAY ─── */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
}
.tutorial-highlight {
  position: absolute;
  border: 3px solid var(--neon-purple);
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.75), 0 0 30px var(--neon-purple);
  pointer-events: none;
  z-index: 9999;
  transition: all 0.3s ease;
}
.tutorial-tooltip {
  position: absolute;
  z-index: 10000;
  background: rgba(15,8,35,0.95);
  border: 1px solid rgba(168,85,247,0.3);
  border-radius: 12px;
  padding: 16px 20px;
  max-width: 280px;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.tutorial-tooltip .tutorial-next {
  background: var(--gradient-primary);
  border: none;
  border-radius: 50px;
  padding: 8px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s;
}
.tutorial-tooltip .tutorial-next:hover {
  transform: scale(1.05);
}
.tutorial-tooltip .tutorial-skip {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}
.tutorial-tooltip .tutorial-skip:hover {
  color: var(--neon-purple);
}
