@import url('fonts.css');

:root {
  --primary-wool: #e76f51;
  --accent-gold: #ffd166;
  --accent-orange: #f4a261;
  --bg-dark: #1e132b;
  
  --font-heading: 'Outfit', 'Noto Sans SC', 'Noto Sans Devanagari', 'Vazirmatn', 'Noto Sans Arabic', sans-serif;
  --font-body: 'Fredoka', 'Noto Sans SC', 'Noto Sans Devanagari', 'Vazirmatn', 'Noto Sans Arabic', cursive, sans-serif;
  --font-retro-scumm: 'VT323', 'Noto Sans SC', 'Noto Sans Devanagari', 'Vazirmatn', 'Noto Sans Arabic', monospace, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-body);
  color: #ffffff;
  position: relative;
  touch-action: none;
}

/* --------------------------------------------------------------------------
   Cinema Stage & Fullscreen Video
   -------------------------------------------------------------------------- */
#app-stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
}

.video-cinema-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.cinema-video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
  transform: translateZ(0);
  will-change: opacity;
}

.cinema-video-layer.active {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Cinema Stage & Fullscreen Video Layer Styles
   -------------------------------------------------------------------------- */

/* Chapter Menu Bar - 90s SCUMM Action Verb / Inventory Style */
.chapter-nav-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(14, 10, 24, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 10px;
  border-radius: 8px;
  border: 1.5px solid #55ffff;
  box-shadow: 0 0 14px rgba(85, 255, 255, 0.25), inset 0 0 8px rgba(0, 0, 0, 0.6);
  max-width: 70vw;
  overflow-x: auto;
  scrollbar-width: none;
}

.chapter-nav-bar::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  padding: 3px 8px;
  border-radius: 4px;
  color: #ffffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  flex-shrink: 0;
  text-shadow: 1px 1px 0 #000;
}

.nav-item:hover {
  background: rgba(255, 224, 64, 0.15);
  border-color: #ffe040;
  color: #ffe040;
  text-shadow: 0 0 8px #ffe040, 1px 1px 0 #000;
}

.nav-item.active {
  background: #ffe040;
  color: #1a0f2b;
  border-color: #ffe040;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(255, 224, 64, 0.6);
  text-shadow: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  background: rgba(14, 10, 24, 0.85);
  border: 1.5px solid #55ffff;
  color: #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 0 0 10px rgba(85, 255, 255, 0.2);
}

.header-btn:hover {
  background: rgba(255, 224, 64, 0.15);
  border-color: #ffe040;
  color: #ffe040;
  box-shadow: 0 0 12px rgba(255, 224, 64, 0.5);
}

.header-btn.playing {
  background: #ffe040;
  color: #1a0f2b;
  border-color: #ffe040;
  text-shadow: none;
}

.lang-toggle-btn {
  padding: 3px 8px;
  gap: 4px;
  background: rgba(14, 10, 24, 0.85);
  border: 1.5px solid #55ffff;
  border-radius: 6px;
}

.lang-pill {
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  transition: all 0.2s ease;
}

.lang-pill.active {
  background: #ffe040;
  color: #1a0f2b;
  font-weight: 800;
  box-shadow: 0 0 8px rgba(255, 224, 64, 0.6);
}

.lang-divider {
  font-size: 16px;
  color: #55ffff;
  user-select: none;
}

/* --------------------------------------------------------------------------
   Dynamic Clean Story Card HUD (Smart Non-Obtrusive Placement)
   -------------------------------------------------------------------------- */
.hud-container {
  position: absolute;
  z-index: 5;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

/* Positions avoiding Einstein */
.hud-container.pos-left-middle {
  top: 48%;
  left: 60px;
  transform: translateY(-50%);
  max-width: 480px;
}

.hud-container.pos-top-left,
.hud-container.pos-top-left-floating {
  top: 70px;
  left: 60px;
  transform: none;
  max-width: 440px;
}

.hud-container.pos-right-middle {
  top: 48%;
  right: 60px;
  transform: translateY(-50%);
  max-width: 450px;
}

.hud-container.pos-center-top {
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 540px;
  text-align: center;
}

.hud-container.pos-top-center-diploma {
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 660px;
  text-align: center;
}

/* Pure Zero-Box Narrative Story Card (No background, no border, pure retro floating text) */
.story-card {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: #fff;
}

/* --------------------------------------------------------------------------
   Hero Start Intro (Zero-Box Retro Adventure Narrative UI)
   -------------------------------------------------------------------------- */
.hud-container.pos-center-top.hero-intro-mode {
  top: 55px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 860px;
  width: 90vw;
}

.story-card.hero-intro-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  padding: 0 !important;
  text-align: center;
}

.hero-intro-card .card-tag {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 22px;
  font-weight: 700;
  color: #55ffff; /* SCUMM Cyan */
  letter-spacing: 2px;
  margin-bottom: 4px;
  text-transform: uppercase;
  text-shadow: 
    -1.5px -1.5px 0 #000,
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0px 2px 4px rgba(0, 0, 0, 0.9);
}

.hero-intro-card .card-title {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 38px;
  font-weight: 700;
  color: #ffe040; /* Iconic SCUMM Gold */
  line-height: 1.15;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-shadow: 
    -2px -2px 0 #000,  
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0px 4px 8px rgba(0, 0, 0, 0.95);
}

.hero-intro-card .card-text {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 26px;
  line-height: 1.25;
  color: #ffffff;
  max-width: 780px;
  margin: calc(50vh - 125px) auto 0 auto;
  text-shadow: 
    -1.5px -1.5px 0 #000,  
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0px 3px 6px rgba(0, 0, 0, 0.95);
}

.adventure-hero-logo {
  position: fixed;
  top: calc(50% - 100px);
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 94vw;
  max-width: 1240px;
  text-align: center;
  pointer-events: none;
  z-index: 25;
  font-family: var(--font-retro-scumm), monospace;
  font-size: clamp(54px, 8.5vw, 102px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 3px;
  color: #ffdf78;
  background: linear-gradient(180deg, #fff7b0 0%, #ffd000 35%, #ff9500 75%, #d45000 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: 
    drop-shadow(2px 0 0 #000000)
    drop-shadow(-2px 0 0 #000000)
    drop-shadow(0 2px 0 #000000)
    drop-shadow(0 -2px 0 #000000)
    drop-shadow(2px 2px 0 #000000)
    drop-shadow(-2px -2px 0 #000000)
    drop-shadow(2px -2px 0 #000000)
    drop-shadow(-2px 2px 0 #000000)
    drop-shadow(3px 4px 0 #000000)
    drop-shadow(5px 6px 0 #000000);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease-out, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease-out;
}

.adventure-hero-logo.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.story-card.animate-in {
  animation: smoothFade 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes smoothFade {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-tag {
  display: inline-block;
  font-family: var(--font-retro-scumm), monospace;
  color: #55ffff; /* SCUMM Cyan */
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}

.card-title {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 34px;
  font-weight: 700;
  color: #ffe040; /* Iconic SCUMM Gold */
  line-height: 1.18;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
  text-shadow: 
    -1.5px -1.5px 0 #000,  
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0px 3px 6px rgba(0, 0, 0, 0.8);
}

.card-text {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 1px;
  color: #ffffff;
  font-weight: 500;
  text-shadow: 
    -1px -1px 0 #000,  
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

/* Formula Box (Retro SCUMM Glow - Pure Glass Blur) */
.clean-formula-box {
  display: inline-block;
  background: rgba(0, 0, 0, 0.02);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid #55ffff;
  color: #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 36px;
  font-weight: 800;
  padding: 8px 24px;
  border-radius: 999px;
  margin-top: 14px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(85, 255, 255, 0.8), 1.5px 1.5px 0 #000;
  box-shadow: 0 0 18px rgba(85, 255, 255, 0.35);
}

/* --------------------------------------------------------------------------
   90s LucasArts / SCUMM Adventure Dialogue Typography (Monkey Island / Zak McKracken)
   -------------------------------------------------------------------------- */
.speech-bubble {
  position: absolute;
  z-index: 6;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
  pointer-events: none;
  max-width: 520px;
  text-align: center;
}

.speech-bubble.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bubble-content {
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
  max-width: none;
}

.bubble-content p {
  font-family: var(--font-retro-scumm), 'Press Start 2P', monospace;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: 1.5px;
  color: #ffe040; /* Iconic SCUMM dialogue bright golden-yellow */
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px #000000;
  paint-order: stroke fill;
  text-shadow: 
    -2px -2px 0 #000,  
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0px  3px 0 #000,
     3px  0px 0 #000,
    -3px  0px 0 #000,
     0px -3px 0 #000,
     0px  4px 10px rgba(0, 0, 0, 0.85);
  margin: 0;
  word-spacing: 3px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
}

.speech-bubble.pos-bubble-right-high {
  top: 18%;
  right: clamp(32px, 6vw, 80px);
  max-width: 460px;
}

.speech-bubble.pos-bubble-right-low {
  bottom: clamp(190px, 34vh, 320px);
  right: clamp(32px, 6vw, 80px);
  max-width: 460px;
}

.speech-bubble.pos-bubble-left-high {
  top: 18%;
  left: clamp(32px, 6vw, 80px);
  max-width: 460px;
}

.speech-bubble.pos-bubble-left-low {
  bottom: 24%;
  left: clamp(32px, 6vw, 80px);
  max-width: 460px;
}

.speech-bubble.pos-bubble-left-bottom {
  bottom: clamp(70px, 12vh, 110px);
  left: clamp(32px, 4vw, 60px);
  max-width: 480px;
}

.speech-bubble.pos-bubble-center-top {
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 520px;
}

.speech-bubble.pos-bubble-center-top.visible {
  transform: translateX(-50%);
}

.bubble-tail {
  display: none;
}

/* Hide all background HUD & speech bubbles when Quiz is active to prevent any text collisions */
body.quiz-active .hud-container,
body.quiz-active .speech-bubble,
body.quiz-active #interactive-layer {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transition: opacity 0.25s ease, visibility 0.25s ease !important;
}

/* --------------------------------------------------------------------------
   Interactive Action Layer
   -------------------------------------------------------------------------- */
#interactive-layer {
  margin-top: 14px;
}

.interactive-action-btn {
  background: linear-gradient(135deg, #e76f51, #f4a261);
  color: #fff;
  border: none;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(231, 111, 81, 0.4);
  transition: all 0.2s ease;
}

.interactive-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(231, 111, 81, 0.6);
}

/* Diploma Generator */
.diploma-wrap {
  margin-top: 10px;
  width: 100%;
  max-width: 660px;
}

.hud-container:has(.diploma-wrap) {
  top: 28px;
  transform: none;
  max-width: min(640px, 94vw) !important;
}

.diploma-input-row {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  max-width: 100%;
  margin: 0;
}

#diploma-name-input {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid rgba(85, 255, 255, 0.4);
  background: rgba(18, 12, 32, 0.95);
  color: #ffe040;
  border-radius: 10px;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 18px;
  letter-spacing: 1px;
  outline: none;
  box-shadow: 0 0 10px rgba(85, 255, 255, 0.2);
  transition: all 0.2s ease;
  user-select: text !important;
  -webkit-user-select: text !important;
  pointer-events: auto !important;
}

#diploma-name-input:focus {
  border-color: #ffe040;
  box-shadow: 0 0 16px rgba(255, 224, 64, 0.5);
}

.diploma-btn {
  background: linear-gradient(135deg, #ffd000 0%, #ff9500 100%);
  color: #1a0f2b;
  border: 2px solid #ffffff;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: var(--font-retro-scumm), monospace;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(255, 224, 64, 0.45);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.diploma-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 24px rgba(255, 224, 64, 0.8);
}

#diploma-canvas-wrap {
  margin-top: 10px;
}

#diploma-canvas {
  width: 100%;
  max-width: 440px;
  height: auto;
  border-radius: 10px;
  border: 2px solid rgba(255, 224, 64, 0.6);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 16px rgba(255, 224, 64, 0.25);
  display: block;
}

.diploma-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.diploma-download-btn {
  display: inline-block;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  text-decoration: none;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1.5px solid #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.45);
  transition: all 0.2s ease;
}

.diploma-download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.7);
  border-color: #ffe040;
}

/* --------------------------------------------------------------------------
   Retro Adventure Chapter Journal Modal (90s SCUMM Style)
   -------------------------------------------------------------------------- */
.chapter-journal-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.chapter-journal-modal.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.journal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 4, 16, 0.75);
}

.journal-book-card {
  position: relative;
  background: rgba(18, 12, 30, 0.94);
  border: 2px solid #ffe040;
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(255, 224, 64, 0.3);
  max-width: 860px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 24px 28px;
  color: #fff;
  transform: scale(0.94) translateY(14px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.chapter-journal-modal.active .journal-book-card {
  transform: scale(1) translateY(0);
}

.journal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1.5px solid rgba(85, 255, 255, 0.3);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.journal-badge {
  display: inline-block;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 18px;
  letter-spacing: 1.5px;
  color: #55ffff;
  margin-bottom: 4px;
  text-shadow: 1px 1px 0 #000;
}

.journal-title {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 32px;
  line-height: 1.15;
  color: #ffe040;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 0 4px;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000;
}

.journal-subtext {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  color: #b8d8ff;
  letter-spacing: 1px;
  margin: 0;
  text-shadow: 1px 1px 0 #000;
}

.journal-close-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid #ff7070;
  color: #ff9e80;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.journal-close-btn:hover {
  border-color: #ffe040;
  color: #ffe040;
  box-shadow: 0 0 10px rgba(255, 224, 64, 0.5);
  transform: scale(1.1);
}

.journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #ffe040 rgba(0, 0, 0, 0.4);
}

.journal-item {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.journal-item:hover {
  border-color: #ffe040;
  background: rgba(255, 224, 64, 0.15);
  transform: translateX(4px);
}

.journal-item.active {
  border-color: #55ffff;
  background: rgba(85, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(85, 255, 255, 0.35);
}

.journal-item.locked {
  opacity: 0.45;
  border-color: rgba(255, 112, 112, 0.3);
  cursor: not-allowed;
}

.journal-item.locked:hover {
  transform: none;
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 112, 112, 0.3);
}

.journal-item-num {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 24px;
  font-weight: 800;
  color: #ffe040;
  min-width: 28px;
}

.journal-item-icon {
  font-size: 20px;
}

.journal-item-title {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  letter-spacing: 0.5px;
  line-height: 1.15;
  color: #ffffff;
  flex: 1;
}

.journal-item-status {
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Mobile Adaptations
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .top-header {
    padding: 0 16px;
  }
  .nav-item .nav-label {
    display: none;
  }
  .hud-container.pos-left-middle,
  .hud-container.pos-right-middle,
  .hud-container.pos-top-left,
  .hud-container.pos-top-left-floating,
  .hud-container.pos-center-top,
  .hud-container.pos-top-center-diploma {
    top: auto;
    bottom: 80px;
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
  }
  .story-card {
    padding: 16px 20px;
  }
  .card-tag {
    font-size: 16px;
  }
  .card-title {
    font-size: 26px;
  }
  .card-text {
    font-size: 20px;
  }
  .clean-formula-box {
    font-size: 26px;
    padding: 6px 16px;
  }
  .speech-bubble {
    top: 14% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    width: 90%;
    max-width: 360px;
  }
  .bubble-content p {
    font-size: 24px;
    -webkit-text-stroke: 1px #000000;
  }
}

/* --------------------------------------------------------------------------
   Round Chapter Badge with Book (Covering Gemini Watermark in bottom-right) - 90s SCUMM Style
   -------------------------------------------------------------------------- */
.chapter-watermark-badge {
  position: fixed;
  right: calc(clamp(24px, 9.1vw, 185px) - 40px);
  bottom: clamp(52px, 15.2vh, 185px);
  width: 102px;
  height: 102px;
  border-radius: 50%;
  background: rgba(14, 10, 24, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid #ffe040;
  box-shadow: 0 0 18px rgba(255, 224, 64, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60; /* Always on top, interactive even during quiz */
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.chapter-watermark-badge:hover {
  border-color: #55ffff;
  box-shadow: 0 0 24px rgba(85, 255, 255, 0.6), inset 0 0 12px rgba(0, 0, 0, 0.85);
  transform: scale(1.06);
}

.badge-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
}

.badge-sub {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #55ffff; /* SCUMM Cyan */
  text-transform: uppercase;
  margin-bottom: 0px;
  text-shadow: 1px 1px 0 #000;
}

.badge-num {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 42px;
  font-weight: 900;
  color: #ffe040; /* SCUMM Gold */
  letter-spacing: 1px;
  line-height: 0.95;
  text-shadow: 
    -1.5px -1.5px 0 #000,  
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0 0 10px rgba(255, 224, 64, 0.6);
}

.badge-total {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a0c4ff;
  margin-top: 1px;
  text-shadow: 1px 1px 0 #000;
}

.chapter-watermark-badge.pop-anim {
  animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgePop {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@media (max-width: 768px) {
  .chapter-watermark-badge {
    width: 80px;
    height: 80px;
    right: 12px;
    bottom: 74px;
  }
  .badge-sub { font-size: 12px; }
  .badge-num { font-size: 32px; }
  .badge-total { font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Lock / Free Mode Button - 90s SCUMM Style
   -------------------------------------------------------------------------- */
.lock-toggle-btn {
  background: rgba(14, 10, 24, 0.85);
  border: 1.5px solid #ff7070;
  color: #ff9e80;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 10px rgba(255, 112, 112, 0.25);
  transition: all 0.25s ease;
}

.lock-toggle-btn.unlocked {
  background: rgba(14, 10, 24, 0.85);
  border-color: #55ffff;
  color: #55ffff;
  box-shadow: 0 0 12px rgba(85, 255, 255, 0.35);
}

.lock-toggle-btn:hover {
  border-color: #ffe040;
  color: #ffe040;
  box-shadow: 0 0 12px rgba(255, 224, 64, 0.5);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Interactive Chapter Quiz (Zero-Box Floating LucasArts Adventure Dialog Style)
   -------------------------------------------------------------------------- */
.quiz-modal-container {
  position: fixed;
  inset: 0;
  background: transparent;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px 36px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  visibility: hidden;
}

.quiz-modal-container.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.quiz-card {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-width: 680px;
  width: 100%;
  padding: 0;
  margin: 0;
  color: #fff;
  transform: translateY(12px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  pointer-events: auto;
}

.quiz-modal-container.active .quiz-card {
  transform: scale(1) translateY(0);
}

.quiz-question {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 36px;
  line-height: 1.15;
  color: #ffe040; /* Iconic SCUMM Gold */
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-shadow: 
    -2px -2px 0 #000,  
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0px 4px 8px rgba(0, 0, 0, 0.95);
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  text-align: left;
}

.quiz-option-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 16px;
  color: #ffffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  text-shadow: 
    -1.5px -1.5px 0 #000,  
     1.5px -1.5px 0 #000,
    -1.5px  1.5px 0 #000,
     1.5px  1.5px 0 #000,
     0px 3px 6px rgba(0, 0, 0, 0.9);
}

.quiz-option-btn:hover {
  background: rgba(0, 0, 0, 0.45);
  border-color: #ffe040;
  color: #ffe040;
  text-shadow: 0 0 10px rgba(255, 224, 64, 0.8), -1.5px -1.5px 0 #000, 1.5px 1.5px 0 #000;
  transform: translateX(8px);
}

.quiz-option-btn.correct {
  background: rgba(0, 0, 0, 0.5) !important;
  border-color: #55ffff !important;
  color: #55ffff !important;
  box-shadow: 0 0 20px rgba(85, 255, 255, 0.4) !important;
  text-shadow: 0 0 14px #55ffff, -1.5px -1.5px 0 #000, 1.5px 1.5px 0 #000 !important;
  transform: scale(1.02);
  pointer-events: none;
}

.quiz-option-btn.wrong {
  background: rgba(0, 0, 0, 0.5) !important;
  border-color: #e76f51 !important;
  color: #ff9e80 !important;
  text-shadow: 0 0 10px #e76f51, -1.5px -1.5px 0 #000, 1.5px 1.5px 0 #000 !important;
  animation: optionShake 0.4s ease-in-out;
}

@keyframes optionShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

.quiz-feedback-box {
  min-height: 28px;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-top: 4px;
  transition: all 0.2s ease;
}

.quiz-feedback-box.correct-text {
  color: #55ffff;
  text-shadow: 0 0 10px rgba(85, 255, 255, 0.8), 1px 1px 0 #000;
}

.quiz-feedback-box.wrong-text {
  color: #ff9e80;
  text-shadow: 0 0 8px rgba(255, 158, 128, 0.8), 1px 1px 0 #000;
}

.quiz-skip-btn {
  background: transparent;
  border: none;
  color: #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 10px;
  transition: color 0.2s ease;
}

.quiz-skip-btn:hover {
  color: #ffe040;
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */
.toast-notification {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(36, 18, 52, 0.95);
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 209, 102, 0.35);
  backdrop-filter: blur(16px);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 999px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .quiz-card {
    padding: 20px 18px;
    border-radius: 18px;
  }
  .quiz-badge {
    font-size: 16px;
  }
  .quiz-question {
    font-size: 24px;
  }
  .quiz-subtext {
    font-size: 18px;
  }
  .quiz-option-btn {
    font-size: 20px;
    padding: 8px 12px;
  }
  .quiz-feedback-box {
    font-size: 18px;
  }
  .toast-notification {
    white-space: normal;
    text-align: center;
    width: 90%;
    max-width: 360px;
  }
}

/* ==========================================================================
   Discreet Corner Action Buttons (Gear Settings & Fullscreen)
   ========================================================================== */
.corner-actions-group {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.corner-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(14, 10, 24, 0.78);
  border: 1.5px solid rgba(85, 255, 255, 0.5);
  color: #55ffff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.corner-btn:hover {
  background: rgba(24, 14, 40, 0.95);
  border-color: #ffe040;
  color: #ffe040;
  transform: scale(1.08);
  box-shadow: 0 0 16px rgba(255, 224, 64, 0.5);
}

.corner-btn:active {
  transform: scale(0.95);
}

/* Hide Fullscreen Button in Fullscreen Mode (no redundant exit button) */
:fullscreen .corner-fullscreen-btn,
:-webkit-full-screen .corner-fullscreen-btn,
:-moz-full-screen .corner-fullscreen-btn,
:fullscreen #btn-fullscreen,
:-webkit-full-screen #btn-fullscreen,
body.fullscreen-active .corner-fullscreen-btn,
body.fullscreen-active #btn-fullscreen {
  display: none !important;
}

/* ==========================================================================
   Retro Adventure Settings Modal (LucasArts SCUMM Options Style)
   ========================================================================== */
.retro-settings-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.retro-settings-modal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.retro-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 6, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.retro-settings-card {
  position: relative;
  background: rgba(18, 12, 32, 0.96);
  border: 2.5px solid #ffe040;
  border-radius: 18px;
  padding: 20px 26px;
  max-width: 880px;
  width: min(880px, 94vw);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  box-shadow: 0 0 35px rgba(255, 224, 64, 0.35), 0 20px 50px rgba(0, 0, 0, 0.85);
  font-family: var(--font-retro-scumm), monospace;
  color: #fff;
  animation: modalPopIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.retro-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid rgba(85, 255, 255, 0.3);
  padding-bottom: 10px;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.retro-settings-badge {
  font-size: 14px;
  color: #55ffff;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.retro-settings-title {
  font-size: 26px;
  color: #ffe040;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 2px 0 0 0;
  text-shadow: -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000;
}

.retro-settings-close-btn {
  background: transparent;
  border: 1.5px solid #55ffff;
  color: #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  font-weight: bold;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.retro-settings-close-btn:hover {
  border-color: #ff7070;
  color: #ff7070;
  box-shadow: 0 0 10px rgba(255, 112, 112, 0.5);
}

.retro-settings-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  overflow: visible;
  flex: none;
  padding-right: 0;
}

@media (max-width: 680px) {
  .retro-settings-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
    max-height: 65vh;
  }
}

.setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(85, 255, 255, 0.25);
  padding: 10px 14px;
  border-radius: 10px;
  gap: 12px;
  min-height: 48px;
}

.setting-item.setting-item-audio {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.setting-meta {
  display: flex;
  flex-direction: column;
}

.setting-title {
  font-size: 20px;
  color: #ffe040;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

.setting-sub {
  font-size: 14px;
  color: #a0c4ff;
  letter-spacing: 0.5px;
}

.setting-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.setting-vol-val {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 16px;
  color: #55ffff;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 0 #000;
}

.setting-audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.audio-mute-btn {
  min-width: 105px;
  justify-content: center;
}

.slider-track-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 90px;
}

.retro-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border: 1.5px solid rgba(85, 255, 255, 0.4);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.retro-slider:hover,
.retro-slider:focus {
  border-color: #ffe040;
  box-shadow: 0 0 8px rgba(255, 224, 64, 0.4);
}

.retro-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffe040;
  border: 2px solid #1a0f2b;
  box-shadow: 0 0 8px rgba(255, 224, 64, 0.9);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.retro-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: #55ffff;
  box-shadow: 0 0 12px rgba(85, 255, 255, 0.9);
}

.retro-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffe040;
  border: 2px solid #1a0f2b;
  box-shadow: 0 0 8px rgba(255, 224, 64, 0.9);
  cursor: pointer;
}

.retro-menu-toggle {
  background: rgba(14, 10, 24, 0.9);
  border: 1.5px solid #55ffff;
  color: #55ffff;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 18px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000;
}

.retro-menu-toggle:hover {
  border-color: #ffe040;
  color: #ffe040;
  box-shadow: 0 0 10px rgba(255, 224, 64, 0.4);
}

.retro-menu-action {
  background: rgba(14, 10, 24, 0.9);
  border: 1.5px solid #ffe040;
  color: #ffe040;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 18px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-shadow: 1px 1px 0 #000;
}

.retro-menu-action:hover {
  background: #ffe040;
  color: #1a0f2b;
  font-weight: bold;
  text-shadow: none;
  box-shadow: 0 0 12px rgba(255, 224, 64, 0.6);
}

.retro-lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.retro-lang-pill {
  background: rgba(14, 10, 24, 0.9);
  border: 1.5px solid rgba(85, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-retro-scumm), monospace;
  font-size: 15px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.retro-lang-pill:hover {
  border-color: #ffe040;
  color: #ffe040;
  box-shadow: 0 0 8px rgba(255, 224, 64, 0.4);
}

.retro-lang-pill.active {
  background: #ffe040;
  border-color: #ffffff;
  color: #1a0f2b;
  box-shadow: 0 0 12px rgba(255, 224, 64, 0.7);
  font-weight: 900;
}

.retro-settings-footer {
  flex-shrink: 0;
}

.retro-done-action-btn {
  width: 100%;
  background: linear-gradient(135deg, #ffd000 0%, #ff9500 100%);
  color: #1a0f2b;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 10px 16px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(255, 224, 64, 0.5);
  transition: all 0.2s ease;
}

.retro-done-action-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 24px rgba(255, 224, 64, 0.8);
}

/* ==========================================================================
   Mobile Mode Infoboxes Size Reduction (Compact Zero-Box HUD)
   ========================================================================== */
@media screen and (max-width: 1024px), screen and (max-height: 560px) {
  /* Mobile Story Card: Dedicated Left-side Zone (Zero overlap with speech bubble on the right) */
  .hud-container,
  .hud-container.pos-left-middle,
  .hud-container.pos-right-middle,
  .hud-container.pos-top-left,
  .hud-container.pos-top-left-floating,
  .hud-container.pos-center-top {
    top: 12px !important;
    left: 14px !important;
    right: auto !important;
    bottom: auto !important;
    max-width: min(350px, 45vw) !important;
    width: auto !important;
    transform: none !important;
    text-align: left !important;
    z-index: 10 !important;
  }

  /* Exemption for Hero Intro Card (Centered on Start Page when no speech bubble is present) */
  .hud-container.pos-center-top.hero-intro-mode {
    top: 8px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    max-width: 86vw !important;
    text-align: center !important;
  }

  /* Exemption for Diploma in Chapter 18 */
  .hud-container:has(.diploma-wrap),
  .hud-container.pos-top-center-diploma {
    top: 8px !important;
    left: 14px !important;
    right: auto !important;
    max-width: min(440px, 52vw) !important;
  }

  .card-tag {
    font-size: 16px !important;
    letter-spacing: 1.3px !important;
    margin-bottom: 3px !important;
  }
  .card-title {
    font-size: 26px !important;
    line-height: 1.18 !important;
    letter-spacing: 1.2px !important;
    margin-bottom: 4px !important;
  }
  .card-text {
    font-size: 20px !important;
    line-height: 1.38 !important;
    letter-spacing: 0.4px !important;
    font-weight: 600 !important;
  }
  .hero-intro-card .card-title {
    font-size: 28px !important;
  }
  .hero-intro-card .card-text {
    font-size: 21px !important;
    line-height: 1.38 !important;
    margin-top: 3px !important;
  }
  .adventure-hero-logo {
    top: 58% !important;
    transform: translate(-50%, -50%) scale(0.62) !important;
  }
  .clean-formula-box {
    font-size: 26px !important;
    padding: 5px 18px !important;
    margin-top: 6px !important;
  }

  /* Mobile Einstein Speech Bubble: Dedicated Right-side Zone (Zero overlap with Story Card) */
  .speech-bubble,
  .speech-bubble.pos-bubble-right-high,
  .speech-bubble.pos-bubble-right-low,
  .speech-bubble.pos-bubble-left-high,
  .speech-bubble.pos-bubble-left-low,
  .speech-bubble.pos-bubble-left-bottom,
  .speech-bubble.pos-bubble-center-top {
    top: 12px !important;
    right: 114px !important;
    bottom: auto !important;
    left: auto !important;
    max-width: min(320px, 40vw) !important;
    width: auto !important;
    transform: none !important;
    text-align: right !important;
    z-index: 15 !important;
  }

  .bubble-content {
    text-align: right !important;
  }

  .bubble-content p {
    font-size: 22px !important;
    line-height: 1.25 !important;
    text-align: right !important;
    -webkit-text-stroke: 1px #000000 !important;
  }

  /* RTL Support on Mobile Landscape */
  html[dir="rtl"] .hud-container,
  html[dir="rtl"] .hud-container.pos-left-middle,
  html[dir="rtl"] .hud-container.pos-right-middle,
  html[dir="rtl"] .hud-container.pos-top-left,
  html[dir="rtl"] .hud-container.pos-top-left-floating,
  html[dir="rtl"] .hud-container.pos-center-top {
    right: 14px !important;
    left: auto !important;
    text-align: right !important;
  }
  html[dir="rtl"] .hud-container.pos-center-top.hero-intro-mode {
    right: auto !important;
    left: 50% !important;
    transform: translateX(50%) !important;
  }
  html[dir="rtl"] .speech-bubble,
  html[dir="rtl"] .speech-bubble.pos-bubble-right-high,
  html[dir="rtl"] .speech-bubble.pos-bubble-right-low,
  html[dir="rtl"] .speech-bubble.pos-bubble-left-high,
  html[dir="rtl"] .speech-bubble.pos-bubble-left-low,
  html[dir="rtl"] .speech-bubble.pos-bubble-left-bottom,
  html[dir="rtl"] .speech-bubble.pos-bubble-center-top {
    left: 114px !important;
    right: auto !important;
    max-width: min(320px, 40vw) !important;
    text-align: left !important;
  }
  html[dir="rtl"] .bubble-content,
  html[dir="rtl"] .bubble-content p {
    text-align: left !important;
  }

  /* ==========================================================================
     Responsive Quiz Modal for Mobile / Landscape (100% on-screen, no cut-offs)
     ========================================================================== */
  .quiz-modal-container {
    padding: 10px 16px !important;
    justify-content: center !important;
    overflow-y: auto !important;
    max-height: 100vh !important;
  }

  .quiz-card {
    max-width: min(640px, 92vw) !important;
    width: 100% !important;
    padding: 0 !important;
    margin: auto !important;
  }

  .quiz-question {
    font-size: clamp(19px, 4.5vw, 25px) !important;
    line-height: 1.2 !important;
    margin: 0 0 10px 0 !important;
    letter-spacing: 1.2px !important;
  }

  .quiz-options-list {
    gap: 8px !important;
    margin-bottom: 8px !important;
  }

  .quiz-option-btn {
    font-size: clamp(16px, 3.6vw, 20px) !important;
    padding: 7px 16px !important;
    line-height: 1.2 !important;
    letter-spacing: 1.2px !important;
    gap: 10px !important;
  }

  .quiz-feedback-box {
    font-size: clamp(15px, 3.4vw, 18px) !important;
    min-height: 24px !important;
    margin-top: 4px !important;
  }

  .quiz-skip-btn {
    font-size: 15px !important;
    margin-top: 6px !important;
  }

  /* Compact Settings Menu for Landscape Mobile */
  .retro-settings-modal {
    padding: 8px 12px !important;
    align-items: center !important;
  }

  .retro-settings-card {
    max-width: 760px !important;
    width: 96% !important;
    max-height: 96vh !important;
    padding: 8px 12px !important;
    border-radius: 12px !important;
    border-width: 2px !important;
    overflow-y: auto !important;
  }

  .retro-settings-header {
    padding-bottom: 4px !important;
    margin-bottom: 4px !important;
  }

  .retro-settings-badge {
    font-size: 12px !important;
    letter-spacing: 1px !important;
  }

  .retro-settings-title {
    font-size: 19px !important;
    letter-spacing: 1px !important;
    margin: 0 !important;
  }

  .retro-settings-close-btn {
    width: 26px !important;
    height: 26px !important;
    font-size: 15px !important;
    border-radius: 4px !important;
  }

  .retro-settings-body {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 4px 8px !important;
    margin-bottom: 6px !important;
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  .setting-item {
    padding: 5px 8px !important;
    border-radius: 6px !important;
    gap: 4px !important;
    margin: 0 !important;
    min-height: auto !important;
  }

  .setting-title {
    font-size: 17px !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
  }

  .setting-sub {
    display: none !important;
  }

  .setting-item.setting-item-audio {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .setting-title-row {
    justify-content: space-between !important;
  }

  .setting-vol-val {
    font-size: 15px !important;
  }

  .setting-audio-controls {
    min-width: 0 !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 2px !important;
  }

  .audio-mute-btn {
    min-width: auto !important;
    padding: 3px 7px !important;
    font-size: 14px !important;
  }

  .retro-slider {
    height: 6px !important;
  }

  .retro-slider::-webkit-slider-thumb {
    width: 14px !important;
    height: 14px !important;
  }

  .retro-slider::-moz-range-thumb {
    width: 14px !important;
    height: 14px !important;
  }

  .retro-menu-toggle,
  .retro-menu-action {
    font-size: 16px !important;
    padding: 6px 10px !important;
    border-radius: 4px !important;
    gap: 4px !important;
  }

  .retro-done-action-btn {
    font-size: 18px !important;
    padding: 8px 14px !important;
    border-width: 1.5px !important;
    letter-spacing: 1px !important;
  }
}

/* ==========================================================================
   Portrait Mobile Non-Overlapping Layout (Speech Bubble Top, Story Card Bottom)
   ========================================================================== */
@media screen and (max-width: 768px) and (orientation: portrait) {
  .speech-bubble,
  .speech-bubble.pos-bubble-right-high,
  .speech-bubble.pos-bubble-right-low,
  .speech-bubble.pos-bubble-left-high,
  .speech-bubble.pos-bubble-left-low,
  .speech-bubble.pos-bubble-left-bottom,
  .speech-bubble.pos-bubble-center-top {
    top: 60px !important;
    left: 16px !important;
    right: 16px !important;
    bottom: auto !important;
    max-width: none !important;
    width: auto !important;
    text-align: center !important;
    transform: none !important;
  }

  .bubble-content,
  .bubble-content p {
    text-align: center !important;
  }

  .hud-container,
  .hud-container.pos-left-middle,
  .hud-container.pos-right-middle,
  .hud-container.pos-top-left,
  .hud-container.pos-top-left-floating,
  .hud-container.pos-center-top {
    top: auto !important;
    bottom: 74px !important;
    left: 16px !important;
    right: 16px !important;
    max-width: none !important;
    width: auto !important;
    text-align: center !important;
    transform: none !important;
  }

  .hud-container.pos-center-top.hero-intro-mode {
    top: auto !important;
    bottom: 74px !important;
    left: 16px !important;
    right: 16px !important;
    max-width: none !important;
    width: auto !important;
    transform: none !important;
  }
}

/* ==========================================================================
   Global Retro Adventure Asset Preloader (SCUMM Style)
   ========================================================================== */
.game-preloader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(22, 12, 38, 0.98) 0%, rgba(6, 3, 12, 0.99) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 1;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.65s ease;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--font-retro-scumm), monospace;
}

.game-preloader.fade-out {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.preloader-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 26, 0) 50%, rgba(0, 0, 0, 0.45) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  opacity: 0.6;
}

.preloader-card {
  position: relative;
  z-index: 2;
  background: rgba(14, 10, 24, 0.94);
  border: 2.5px solid #ffe040;
  border-radius: 18px;
  padding: clamp(20px, 4vw, 36px) clamp(16px, 4vw, 36px);
  max-width: 580px;
  width: 92vw;
  box-shadow: 
    0 0 36px rgba(255, 224, 64, 0.35),
    0 24px 60px rgba(0, 0, 0, 0.9),
    inset 0 0 20px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: preloaderCardPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes preloaderCardPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.preloader-badge {
  color: #55ffff;
  font-size: clamp(12px, 2.2vw, 15px);
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(85, 255, 255, 0.7), 1px 1px 0 #000;
}

.preloader-title {
  color: #ffe040;
  font-size: clamp(20px, 4.2vw, 28px);
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0 0 8px 0;
  text-shadow: 
    -2px -2px 0 #000,
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0 4px 10px rgba(0, 0, 0, 0.95);
}

.preloader-desc {
  color: #ffffff;
  font-size: clamp(14px, 2.6vw, 17px);
  line-height: 1.35;
  margin: 0 0 20px 0;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 0.5px;
}

.preloader-progress-wrap {
  width: 100%;
  margin-bottom: 12px;
}

.preloader-progress-track {
  position: relative;
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid rgba(85, 255, 255, 0.6);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 
    inset 0 2px 6px rgba(0, 0, 0, 0.95),
    0 0 14px rgba(85, 255, 255, 0.3);
}

.preloader-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00b4d8 0%, #55ffff 50%, #ffe040 100%);
  border-radius: 999px;
  position: relative;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 16px rgba(255, 224, 64, 0.8);
}

.preloader-bar-glow {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: #ffffff;
  border-radius: 50%;
  filter: blur(3px);
  opacity: 0.9;
}

.preloader-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: clamp(12px, 2.2vw, 15px);
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.preloader-detail {
  color: #55ffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 78%;
  text-align: left;
  text-shadow: 1px 1px 0 #000;
}

.preloader-percent {
  color: #ffe040;
  font-weight: 800;
  font-size: clamp(15px, 2.8vw, 19px);
  text-shadow: 0 0 8px rgba(255, 224, 64, 0.6), 1px 1px 0 #000;
}

.preloader-start-btn {
  background: linear-gradient(135deg, #ffd000 0%, #ff9500 100%);
  color: #1a0f2b;
  font-family: var(--font-retro-scumm), monospace;
  font-size: clamp(16px, 3.2vw, 20px);
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 24px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 224, 64, 0.7);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 10px;
  animation: pulseStartBtn 1.2s infinite ease-in-out;
  align-items: center;
  justify-content: center;
}

.preloader-start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 32px rgba(255, 224, 64, 0.95);
}

@keyframes pulseStartBtn {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 224, 64, 0.6); }
  50% { transform: scale(1.04); box-shadow: 0 0 30px rgba(255, 224, 64, 0.9); }
}

/* ==========================================================================
   Mobile Orientation & Fullscreen Gate Modal
   ========================================================================== */
.orientation-gate-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  background: radial-gradient(circle at center, rgba(28, 14, 48, 0.98) 0%, rgba(8, 4, 16, 0.99) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--font-retro-scumm), monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.orientation-gate-modal.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.orientation-card {
  background: rgba(14, 10, 24, 0.94);
  border: 3px solid #ffe040;
  border-radius: 20px;
  padding: 24px 16px;
  max-width: 350px;
  width: calc(100vw - 32px);
  box-sizing: border-box;
  box-shadow: 0 0 30px rgba(255, 224, 64, 0.4), 0 20px 50px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: auto;
  animation: modalPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rotate-phone-animation {
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phone-device {
  width: 32px;
  height: 54px;
  border: 2.5px solid #55ffff;
  border-radius: 8px;
  background: #1a0f2b;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rotatePhone 2.4s infinite ease-in-out;
  box-shadow: 0 0 16px rgba(85, 255, 255, 0.6);
}

.phone-screen {
  font-size: 16px;
}

.rotate-arrow {
  position: absolute;
  bottom: -2px;
  right: 2px;
  font-size: 20px;
  color: #ffe040;
  animation: pulseArrow 1.2s infinite ease-in-out;
  text-shadow: 0 0 8px #ffe040;
}

@keyframes rotatePhone {
  0%, 20% { transform: rotate(0deg); }
  50%, 80% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}

@keyframes pulseArrow {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
}

.orientation-tag {
  color: #55ffff;
  font-size: clamp(14px, 3.8vw, 18px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
  text-shadow: 1.5px 1.5px 0 #000;
}

.orientation-title {
  color: #ffe040;
  font-size: clamp(20px, 5.2vw, 26px);
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0 0 10px 0;
  max-width: 100%;
  text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 0 4px 8px #000;
}

.orientation-desc {
  color: #ffffff;
  font-size: clamp(15px, 3.8vw, 18px);
  line-height: 1.35;
  letter-spacing: 0.5px;
  margin: 0 0 20px 0;
  max-width: 100%;
  text-shadow: 1px 1px 0 #000;
}

.orientation-start-btn {
  background: linear-gradient(135deg, #ffd000 0%, #ff9500 100%);
  color: #1a0f2b;
  font-family: var(--font-retro-scumm), monospace;
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: bold;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 10px 22px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 224, 64, 0.6);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.orientation-start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 224, 64, 0.9);
}

/* ==========================================================================
   RTL (Right-to-Left) Styles for Farsi / Persian
   ========================================================================== */
html[dir="rtl"] {
  direction: rtl;
}

html[dir="rtl"] .hud-container.pos-left-middle,
html[dir="rtl"] .hud-container.pos-top-left {
  left: auto;
  right: 60px;
  text-align: right;
}

html[dir="rtl"] .hud-container.pos-right-middle {
  right: auto;
  left: 60px;
  text-align: left;
}

html[dir="rtl"] .speech-bubble {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .quiz-card {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .quiz-option-btn {
  text-align: right;
}

html[dir="rtl"] .journal-header {
  flex-direction: row-reverse;
}

html[dir="rtl"] .journal-title-wrap {
  text-align: right;
}

html[dir="rtl"] .journal-item {
  text-align: right;
  flex-direction: row-reverse;
}

html[dir="rtl"] .retro-settings-header {
  flex-direction: row-reverse;
}

html[dir="rtl"] .header-badge-wrap {
  text-align: right;
}

html[dir="rtl"] .setting-item {
  direction: rtl;
}

html[dir="rtl"] .setting-meta {
  text-align: right;
}

html[dir="rtl"] .diploma-input-row {
  flex-direction: row-reverse;
}

/* --------------------------------------------------------------------------
   AI Transparency Notice (EU AI Act Art. 50 Disclosure) - Start Page Bottom Center
   -------------------------------------------------------------------------- */
.ai-transparency-notice {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: calc(100vw - 380px);
  max-width: 820px;
  text-align: center;
  font-family: var(--font-body), sans-serif;
  font-size: clamp(10px, 0.95vw, 11.5px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

.ai-transparency-notice.visible {
  opacity: 1;
  visibility: visible;
}

@media screen and (max-width: 1024px), screen and (max-height: 560px) {
  .ai-transparency-notice {
    width: 94vw;
    max-width: none;
    bottom: 28px;
    font-size: 13.5px !important;
    line-height: 1.4 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 2px 8px rgba(0, 0, 0, 1) !important;
  }
}

/* --------------------------------------------------------------------------
   Discreet Legal Footer Links (Bottom Right) - Impressum & Datenschutz (Start Page Only)
   -------------------------------------------------------------------------- */
.legal-footer-bar {
  position: fixed;
  bottom: 12px;
  right: 18px;
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: none !important;
  font-family: var(--font-body), sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

.legal-footer-bar.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.legal-footer-bar:hover {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.legal-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.9);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.legal-link:hover,
.legal-link:focus-visible {
  color: #ffe040;
  text-shadow: 0 0 8px rgba(255, 224, 64, 0.8), 0 1px 4px rgba(0, 0, 0, 0.9);
  outline: none;
}

.legal-separator {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* RTL orientation adjustment */
html[dir="rtl"] .legal-footer-bar {
  right: auto;
  left: 18px;
}

@media screen and (max-width: 1024px), screen and (max-height: 560px) {
  .legal-footer-bar {
    bottom: 8px;
    right: 10px;
    font-size: 13px !important;
    font-weight: 600 !important;
    gap: 8px;
  }
  .legal-separator {
    font-size: 12px !important;
  }
  html[dir="rtl"] .legal-footer-bar {
    right: auto;
    left: 10px;
  }
}

/* --------------------------------------------------------------------------
   Retro Settings Modal Permanent Legal Links
   -------------------------------------------------------------------------- */
.retro-settings-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  font-family: var(--font-body), sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  user-select: none;
}

.settings-legal-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.settings-legal-link:hover,
.settings-legal-link:focus-visible {
  color: #ffe040;
  text-shadow: 0 0 8px rgba(255, 224, 64, 0.6);
  outline: none;
}

.settings-legal-sep {
  color: rgba(85, 255, 255, 0.4);
  font-size: 11px;
}

@media screen and (max-width: 900px), screen and (max-height: 540px) {
  .retro-settings-legal {
    margin-top: 4px !important;
    font-size: 13px !important;
    gap: 10px !important;
  }
  .settings-legal-sep {
    font-size: 12px !important;
  }
}

/* ==========================================================================
   Mobile Animated 3D Mouse Wheel Controller (Bottom Right)
   ========================================================================== */
.mobile-wheel-container {
  display: none; /* Hidden on standard desktop by default */
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 55;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Display on mobile viewports, touch devices, and landscape mobile */
@media screen and (max-width: 1024px), screen and (max-height: 560px), (hover: none) and (pointer: coarse) {
  .mobile-wheel-container {
    display: flex;
  }

  /* Position watermark badge neatly alongside the mouse wheel with larger text */
  .chapter-watermark-badge {
    right: 78px !important;
    bottom: 14px !important;
    width: 76px !important;
    height: 76px !important;
  }
  .chapter-watermark-badge .badge-sub { font-size: 12px !important; }
  .chapter-watermark-badge .badge-num { font-size: 30px !important; }
  .chapter-watermark-badge .badge-total { font-size: 12px !important; }

  /* Keep start page legal footer neatly beside the controls */
  .legal-footer-bar {
    right: 160px !important;
    bottom: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
  }

  .wheel-label-hint {
    font-size: 12.5px !important;
  }
}

/* RTL layout adjustment */
html[dir="rtl"] .mobile-wheel-container {
  right: auto;
  left: 14px;
}
html[dir="rtl"] .chapter-watermark-badge {
  right: auto !important;
  left: 78px !important;
}
html[dir="rtl"] .legal-footer-bar {
  right: auto !important;
  left: 160px !important;
}

.mouse-wheel-housing {
  position: relative;
  width: 48px;
  height: 138px;
  background: radial-gradient(circle at 50% 20%, rgba(35, 20, 55, 0.94) 0%, rgba(12, 6, 20, 0.97) 100%);
  border: none;
  border-radius: 26px;
  box-shadow: 
    0 4px 18px rgba(0, 0, 0, 0.7),
    0 0 16px rgba(85, 255, 255, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.25),
    inset 0 -2px 6px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px 3px;
  box-sizing: border-box;
  cursor: grab;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.mouse-wheel-housing:active,
.mouse-wheel-housing.active {
  border: none;
  box-shadow: 
    0 4px 22px rgba(0, 0, 0, 0.85),
    0 0 24px rgba(255, 224, 64, 0.65),
    inset 0 0 8px rgba(255, 224, 64, 0.4);
  cursor: grabbing;
  transform: scale(0.97);
}

.wheel-notch-arrow {
  font-size: 11px;
  line-height: 1;
  color: rgba(85, 255, 255, 0.55);
  text-shadow: 0 0 6px rgba(85, 255, 255, 0.5);
  transition: color 0.12s ease, text-shadow 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}

.wheel-notch-arrow.glow {
  color: #ffe040;
  text-shadow: 0 0 12px #ffe040, 0 0 4px #ffffff;
  transform: scale(1.35);
}

.mouse-wheel-viewport {
  position: relative;
  width: 38px;
  height: 98px;
  border-radius: 19px;
  background: #080310;
  border: none;
  box-shadow: 
    inset 0 6px 12px rgba(0, 0, 0, 0.95),
    inset 0 -6px 12px rgba(0, 0, 0, 0.95),
    inset 2px 0 6px rgba(0, 0, 0, 0.8),
    inset -2px 0 6px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mouse-wheel-canvas {
  width: 38px;
  height: 98px;
  display: block;
  pointer-events: none;
}

.wheel-label-hint {
  font-family: var(--font-retro-scumm), monospace;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #ffe040;
  text-shadow: 
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
     0 0 8px rgba(255, 224, 64, 0.6);
  text-transform: uppercase;
  pointer-events: none;
}

/* ==========================================================
   GLOBAL ASSET PRELOADER (LUCASARTS / SCUMM RETRO STYLING)
   ========================================================== */

.game-preloader {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080310;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.65s ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.game-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-backdrop {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 30%, rgba(45, 20, 75, 0.8) 0%, rgba(8, 3, 16, 0.98) 75%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0px, rgba(0, 0, 0, 0.28) 2px, transparent 2px, transparent 4px);
  pointer-events: none;
}

.preloader-card {
  position: relative;
  z-index: 2;
  width: min(580px, 90vw);
  background: rgba(14, 8, 26, 0.94);
  border: 3px solid #ffe040;
  border-radius: 16px;
  box-shadow: 
    0 0 35px rgba(255, 224, 64, 0.3),
    0 16px 48px rgba(0, 0, 0, 0.85),
    inset 0 0 20px rgba(85, 255, 255, 0.12);
  padding: 28px 32px 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  animation: preloaderCardPop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes preloaderCardPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.preloader-badge {
  display: inline-block;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #55ffff;
  background: rgba(85, 255, 255, 0.12);
  border: 1.5px solid rgba(85, 255, 255, 0.6);
  border-radius: 999px;
  padding: 4px 16px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 0 8px rgba(85, 255, 255, 0.6);
}

.preloader-title {
  font-family: var(--font-retro-scumm), monospace;
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 900;
  color: #ffe040;
  letter-spacing: 2px;
  margin: 0 0 10px 0;
  text-transform: uppercase;
  text-shadow: 
    -2px -2px 0 #000,
     2px -2px 0 #000,
    -2px  2px 0 #000,
     2px  2px 0 #000,
     0 0 14px rgba(255, 224, 64, 0.6);
}

.preloader-desc {
  font-family: var(--font-adventure-kids), sans-serif;
  font-size: clamp(14px, 2.5vw, 17px);
  color: #ffffff;
  margin: 0 0 24px 0;
  opacity: 0.9;
  letter-spacing: 0.5px;
}

/* Progress bar wrap & track */
.preloader-progress-wrap {
  width: 100%;
  margin-bottom: 16px;
}

.preloader-progress-track {
  position: relative;
  width: 100%;
  height: 22px;
  background: #090412;
  border: 2px solid #55ffff;
  border-radius: 999px;
  box-shadow: 
    inset 0 2px 6px rgba(0, 0, 0, 0.9),
    0 0 12px rgba(85, 255, 255, 0.35);
  overflow: hidden;
  padding: 2px;
  box-sizing: border-box;
}

.preloader-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00b4d8 0%, #55ffff 55%, #ffe040 100%);
  border-radius: 999px;
  box-shadow: 0 0 12px #ffe040;
  position: relative;
  transition: width 0.1s linear;
  min-width: 4px;
}

.preloader-bar-glow {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 14px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px #ffffff, 0 0 20px #ffe040;
}

/* Status Meta Row */
.preloader-meta-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-retro-scumm), monospace;
  font-size: 14px;
  letter-spacing: 1px;
}

.preloader-detail {
  color: #55ffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
  text-align: left;
  text-shadow: 0 0 6px rgba(85, 255, 255, 0.4);
}

.preloader-percent {
  color: #ffe040;
  font-weight: bold;
  font-size: 16px;
  text-shadow: 0 0 8px rgba(255, 224, 64, 0.6);
}

/* Big Start Button */
.preloader-start-btn {
  margin-top: 20px;
  background: linear-gradient(135deg, #ffd000 0%, #ff9500 100%);
  border: 2.5px solid #ffffff;
  border-radius: 999px;
  color: #1a0f2b;
  font-family: var(--font-retro-scumm), monospace;
  font-size: clamp(16px, 3.5vw, 20px);
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 12px 32px;
  cursor: pointer;
  box-shadow: 
    0 0 24px rgba(255, 224, 64, 0.7),
    0 6px 20px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
  animation: preloaderBtnPulse 1.6s infinite alternate ease-in-out;
}

@keyframes preloaderBtnPulse {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(255, 224, 64, 0.6); }
  100% { transform: scale(1.05); box-shadow: 0 0 32px rgba(255, 224, 64, 0.95); }
}

.preloader-start-btn:hover,
.preloader-start-btn:active {
  transform: scale(1.08);
  background: linear-gradient(135deg, #ffe040 0%, #ffa500 100%);
  box-shadow: 0 0 38px rgba(255, 224, 64, 1);
}

/* Compact scaling for mobile landscape */
@media screen and (max-height: 560px), screen and (max-width: 820px) and (orientation: landscape) {
  .preloader-card {
    width: min(520px, 88vw);
    padding: 14px 20px 18px 20px;
  }
  .preloader-badge {
    font-size: 11px;
    letter-spacing: 2px;
    padding: 2px 10px;
    margin-bottom: 6px;
  }
  .preloader-title {
    font-size: 18px;
    margin-bottom: 4px;
  }
  .preloader-desc {
    font-size: 13px;
    margin-bottom: 12px;
  }
  .preloader-progress-wrap {
    margin-bottom: 10px;
  }
  .preloader-progress-track {
    height: 18px;
  }
  .preloader-meta-row {
    font-size: 12px;
  }
  .preloader-percent {
    font-size: 14px;
  }
  .preloader-start-btn {
    margin-top: 12px;
    padding: 8px 22px;
    font-size: 15px;
  }
}



