/* ==========================================================
   THE ONENOTE ODYSSEY: Visual Novel & Boss Fight Styles
   Aesthetic: Simmo's Ice Creamery Parody x Retro Anime RPG
   ========================================================== */

:root {
  --cream: #fff5df;
  --cream-dark: #f3e5c8;
  --cream-light: #fffaf0;
  --green: #164b35;
  --green-light: #205c42;
  --green-dark: #0f3525;
  --red: #eb4935;
  --red-hover: #d43825;
  --yellow: #ffd454;
  --yellow-hover: #f0c33d;
  --cyber-blue: #00f0ff;
  --cyber-green: #39ff14;
  --muted: #60765d;
  --border: 3px solid var(--green);
  --border-thick: 4px solid var(--green);

  --font-heading: 'Lilita One', cursive, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-chunky: 4px 4px 0px var(--green);
  --shadow-chunky-lg: 6px 6px 0px var(--green);
  --shadow-chunky-red: 4px 4px 0px var(--red);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #0b0914;
  color: var(--green);
  font-family: var(--font-body);
  font-weight: 700;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* ============ TOP STATUS BAR ============ */
.top-bar {
  height: 48px;
  background-color: var(--cream);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 50;
}

.nav-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--green);
  text-decoration: none;
  background: var(--cream-dark);
  padding: 4px 12px;
  border-radius: 9999px;
  border: 2px solid var(--green);
  transition: all 0.15s ease;
}

.nav-back-btn:hover {
  background: var(--yellow);
  transform: translateY(-1px);
}

.top-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chapter-pill {
  background: var(--green);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.time-pill {
  background: #0d2b45;
  color: var(--cyber-blue);
  border: 2px solid var(--cyber-blue);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 9999px;
  animation: pulseCyan 2s infinite ease-in-out;
}

@keyframes pulseCyan {
  0%, 100% { box-shadow: 0 0 5px rgba(0, 240, 255, 0.4); }
  50% { box-shadow: 0 0 15px rgba(0, 240, 255, 0.8); }
}

.top-controls {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: var(--cream);
  border: 2px solid var(--green);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease;
}

.icon-btn:hover {
  background: var(--yellow);
  transform: scale(1.05);
}

/* ============ GAME SCREEN WRAPPER ============ */
.game-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: radial-gradient(circle at center, #1a162b 0%, #080611 100%);
}

.game-screen {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: 680px;
  background-color: #000;
  border: var(--border-thick);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 4px var(--yellow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============ BACKGROUND & OVERLAYS ============ */
.scene-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: background-image 0.5s ease;
  z-index: 1;
}

.bg-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.08) 0px,
    rgba(0, 0, 0, 0.08) 1px,
    transparent 1px,
    transparent 3px
  );
  z-index: 2;
}

.bg-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
  z-index: 3;
}

/* ============ TITLE OVERLAY ============ */
.title-overlay {
  position: absolute;
  inset: 0;
  background: rgba(11, 9, 20, 0.92);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.4s ease;
}

.title-card {
  max-width: 680px;
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 24px;
  box-shadow: var(--shadow-chunky-lg);
  padding: 36px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.title-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--green);
  color: var(--yellow);
  padding: 4px 14px;
  border-radius: 9999px;
  letter-spacing: 0.1em;
}

.game-main-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  line-height: 1;
  color: var(--green);
  text-shadow: 3px 3px 0 var(--cream-dark);
}

.highlight-yellow {
  color: var(--red);
  background: var(--yellow);
  padding: 0 8px;
  border-radius: 8px;
  border: 2px solid var(--green);
}

.game-sub-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--red);
  letter-spacing: 0.05em;
}

.title-roast-box {
  background: var(--cream-light);
  border: 2px solid var(--green);
  border-radius: 14px;
  padding: 16px;
  text-align: left;
  line-height: 1.5;
  font-size: 1rem;
}

.title-roast-box strong {
  color: var(--red);
}

.title-roast-box .small-text {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.title-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.btn-hero {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--cream);
  background: var(--red);
  border: var(--border);
  border-radius: 9999px;
  padding: 14px 40px;
  cursor: pointer;
  box-shadow: var(--shadow-chunky);
  transition: all 0.15s ease;
}

.btn-hero:hover {
  background: var(--red-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-chunky-lg);
}

.btn-hero:active {
  transform: translateY(2px);
  box-shadow: 2px 2px 0 var(--green);
}

.audio-tip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ============ CHARACTER STAGE ============ */
.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 65%;
  z-index: 5;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 40px;
}

.actor {
  height: 100%;
  max-height: 420px;
  display: flex;
  align-items: flex-end;
  transition: all 0.3s ease;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.4));
}

.actor img {
  max-height: 100%;
  max-width: 340px;
  object-fit: contain;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.actor-left {
  transform: translateX(0);
}

.actor-right {
  transform: translateX(0);
}

.actor.hidden {
  opacity: 0;
  transform: translateY(40px);
}

.actor.speaking img {
  animation: gentleBounce 0.4s ease-in-out;
  filter: drop-shadow(0 0 12px rgba(255, 212, 84, 0.8));
}

.actor.shocked img {
  animation: headShake 0.4s ease-in-out;
}

@keyframes gentleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes headShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px) rotate(-3deg); }
  40%, 80% { transform: translateX(8px) rotate(3deg); }
}

/* ============ HALLUCINATION POPUP ============ */
.hallucination-popup {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 6px 6px 0 var(--red);
  padding: 18px;
  display: none;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  pointer-events: auto;
  animation: stampDown 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stampDown {
  from { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.hallucination-header {
  margin-bottom: 10px;
}

.warning-flasher {
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 900;
  padding: 4px 12px;
  border-radius: 9999px;
  border: 2px solid var(--green);
  animation: blinkRed 1s infinite;
}

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

.hallucination-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.hallucination-body img {
  max-height: 230px;
  max-width: 320px;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--green);
  background: #39ff14;
}

.hallucination-caption {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hallucination-caption strong {
  font-family: var(--font-heading);
  color: var(--red);
  font-size: 1.1rem;
}

.hallucination-caption span {
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 300px;
}

/* ============ DIALOGUE BOX ============ */
.dialogue-box-container {
  position: absolute;
  bottom: 12px;
  left: 16px;
  right: 16px;
  z-index: 30;
}

.dialogue-box {
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 20px;
  box-shadow: var(--shadow-chunky-lg);
  padding: 24px 28px 18px 28px;
  position: relative;
  min-height: 160px;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.nameplate {
  position: absolute;
  top: -18px;
  left: 28px;
  background: var(--green);
  color: var(--cream);
  border: 3px solid var(--green-dark);
  border-radius: 12px;
  padding: 4px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.nameplate-text {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  color: var(--yellow);
}

.speaker-role {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--cream);
  opacity: 0.85;
}

.dialogue-content {
  margin-top: 4px;
  flex: 1;
}

.dialogue-text {
  font-size: 1.25rem;
  line-height: 1.45;
  color: var(--green);
  font-weight: 700;
  min-height: 3.2em;
}

.dialogue-text em {
  color: var(--red);
  font-style: italic;
}

.dialogue-text strong {
  color: var(--green-dark);
  font-weight: 900;
}

.advance-indicator {
  align-self: flex-end;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.pulse-icon {
  color: var(--red);
  animation: pulseDown 1s infinite ease-in-out;
}

@keyframes pulseDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ============ CHOICES CONTAINER ============ */
.choices-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.choice-btn {
  background: var(--cream-light);
  border: var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--green);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-chunky);
  transition: all 0.15s ease;
}

.choice-btn:hover {
  background: var(--yellow);
  transform: translateX(4px);
  color: var(--green-dark);
}

.choice-btn .choice-arrow {
  color: var(--red);
  font-weight: 900;
}

/* ============ MINIGAME CONTAINERS ============ */
.minigame-container {
  position: absolute;
  inset: 0;
  background: rgba(11, 9, 20, 0.94);
  backdrop-filter: blur(6px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 16px 24px;
}

/* --- MINIGAME 1: SCOOP DEFLECTOR --- */
.minigame-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--cream);
  border: var(--border);
  border-radius: 12px;
  padding: 8px 18px;
  margin-bottom: 12px;
}

.minigame-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--green);
}

.minigame-stats {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  display: flex;
  gap: 18px;
}

.minigame-stats strong {
  color: var(--red);
}

.deflector-canvas-wrapper {
  flex: 1;
  background: #112a1f;
  border: var(--border-thick);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

#scoop-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.deflector-hint {
  position: absolute;
  bottom: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px 14px;
  border-radius: 9999px;
  pointer-events: none;
}

/* --- MINIGAME 2: MATH HACKER TERMINAL --- */
.hacker-terminal {
  flex: 1;
  background: #090e17;
  border: 3px solid var(--cyber-blue);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.3);
}

.terminal-top {
  background: #04080e;
  border-bottom: 2px solid var(--cyber-blue);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.term-dot.red { background: #ff5f56; }
.term-dot.yellow { background: #ffbd2e; }
.term-dot.green { background: #27c93f; }

.term-title {
  font-family: var(--font-mono);
  color: var(--cyber-blue);
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 8px;
  flex: 1;
}

.term-timer {
  font-family: var(--font-mono);
  color: #ff3366;
  font-size: 1.3rem;
  font-weight: 900;
  background: rgba(255, 51, 102, 0.15);
  border: 1px solid #ff3366;
  padding: 2px 10px;
  border-radius: 6px;
  animation: pulseRed 1s infinite;
}

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

.terminal-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.term-log {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--cyber-green);
  line-height: 1.6;
}

.math-challenge-box {
  background: rgba(0, 240, 255, 0.05);
  border: 2px dashed var(--cyber-blue);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.math-question {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: #fff;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
}

.math-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.math-btn {
  background: #0e1e30;
  border: 2px solid var(--cyber-blue);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.math-btn:hover {
  background: var(--cyber-blue);
  color: #04080e;
  transform: translateY(-2px);
  box-shadow: 0 0 12px var(--cyber-blue);
}

.math-progress-bar {
  height: 12px;
  background: #111a28;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid var(--cyber-blue);
}

.math-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyber-blue), var(--cyber-green));
  transition: width 0.3s ease;
}

/* --- MINIGAME 3: FINAL BOSS ARENA (UNDERTALE DODGE) --- */
.boss-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 14px;
  padding: 8px 18px;
  margin-bottom: 8px;
}

.boss-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.boss-hud-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: #ffd454;
  object-fit: cover;
}

.boss-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.boss-name {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-omarchy {
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.boss-bar-wrap {
  width: 240px;
  height: 12px;
  background: #ddd;
  border: 2px solid var(--green);
  border-radius: 9999px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #eb4935, #ff8a65);
  transition: width 0.4s ease;
}

.player-hud {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-name {
  font-family: var(--font-heading);
  color: var(--green);
  font-size: 1.05rem;
}

.player-hearts {
  font-size: 1.25rem;
  letter-spacing: 2px;
}

.boss-arena-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  gap: 10px;
}

.boss-sprite-anchor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#boss-live-sprite {
  max-height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px rgba(235, 73, 53, 0.6));
  animation: bossFloat 2s infinite ease-in-out;
}

@keyframes bossFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.boss-speech-bubble {
  position: absolute;
  top: 10px;
  left: 170px;
  background: #fff;
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--green);
  max-width: 220px;
  box-shadow: 2px 2px 0 var(--green);
  white-space: normal;
}

.dodge-box {
  width: 440px;
  height: 180px;
  background: #000;
  border: 4px solid #fff;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

#dodge-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dodge-prompt {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  opacity: 0.8;
  pointer-events: none;
}

.boss-actions-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 14px;
  padding: 10px;
}

.boss-act-btn {
  background: var(--cream-light);
  border: var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--green);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--green);
  transition: all 0.15s ease;
}

.boss-act-btn:hover:not(:disabled) {
  background: var(--yellow);
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--green);
}

.boss-act-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============ ENDING MODAL ============ */
.ending-modal {
  position: absolute;
  inset: 0;
  background: rgba(11, 9, 20, 0.95);
  backdrop-filter: blur(8px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ending-card {
  max-width: 640px;
  background: var(--cream);
  border: var(--border-thick);
  border-radius: 24px;
  box-shadow: var(--shadow-chunky-lg);
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: popIn 0.35s ease;
}

.ending-badge {
  background: var(--green);
  color: var(--yellow);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 9999px;
  letter-spacing: 0.08em;
}

.ending-relic img {
  max-height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 0 20px rgba(255, 212, 84, 0.8));
  animation: relicFloat 2.5s infinite ease-in-out;
}

@keyframes relicFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

.ending-title {
  font-family: var(--font-heading);
  font-size: 2.3rem;
  color: var(--red);
  line-height: 1.1;
}

.ending-narrative {
  background: var(--cream-light);
  border: 2px solid var(--green);
  border-radius: 12px;
  padding: 16px;
  font-size: 1.05rem;
  line-height: 1.5;
  text-align: left;
  color: var(--green);
  max-height: 160px;
  overflow-y: auto;
}

.ending-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.ending-stats-summary div {
  background: var(--cream);
  border: 2px solid var(--green);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.ending-stats-summary span {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

.ending-stats-summary strong {
  font-family: var(--font-heading);
  color: var(--green);
  font-size: 1.1rem;
}

.ending-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.btn-primary {
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  border: var(--border);
  border-radius: 9999px;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: var(--shadow-chunky);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: var(--red-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--cream-dark);
  color: var(--green);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  border: var(--border);
  border-radius: 9999px;
  padding: 10px 24px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-chunky);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.btn-secondary:hover {
  background: var(--yellow);
  transform: translateY(-2px);
}

/* ============ RESPONSIVE MEDIA QUERIES ============ */
@media (max-width: 768px) {
  .game-screen {
    border-radius: 0;
    max-height: 100%;
  }

  .game-wrapper {
    padding: 0;
  }

  .stage {
    padding: 0 10px;
  }

  .actor img {
    max-height: 280px;
  }

  .dialogue-text {
    font-size: 1.05rem;
  }

  .dodge-box {
    width: 320px;
    height: 160px;
  }

  .boss-actions-bar {
    flex-wrap: wrap;
  }

  .math-options-grid {
    grid-template-columns: 1fr;
  }

  .game-main-title {
    font-size: 2.2rem;
  }
}

/* ============ V2 ADDITIONS ============ */
.chapter-card {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: #0b0914;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.chapter-card.show { display: flex; }
.chapter-card.visible { opacity: 1; }
.cc-num { font-family: var(--font-mono); color: var(--yellow); letter-spacing: 0.3em; font-size: 0.95rem; }
.cc-title { font-family: var(--font-heading); color: var(--cream); font-size: clamp(1.8rem, 5vw, 3.4rem); text-shadow: 4px 4px 0 var(--red); padding: 0 20px; }
.cc-sub { font-family: var(--font-body); color: var(--cream-dark); font-size: 1.05rem; max-width: 560px; padding: 0 20px; }

#scoop-canvas { width: auto; height: auto; max-width: 100%; max-height: 100%; touch-action: none; cursor: none; }
.deflector-canvas-wrapper { min-height: 0; }
#dodge-canvas { touch-action: none; }

.dodge-box { width: min(560px, 92%); height: auto; aspect-ratio: 560 / 240; }
#boss-live-sprite { max-height: 120px; }
.boss-speech-bubble { position: static; max-width: 460px; text-align: center; margin-top: 4px; }

.math-form { display: flex; gap: 10px; justify-content: center; }
.math-input {
  background: #0e1e30; border: 2px solid var(--cyber-blue); color: #fff;
  font-family: var(--font-mono); font-size: 1.5rem; font-weight: 800;
  padding: 10px 14px; border-radius: 10px; width: 260px; text-align: center; outline: none;
}
.math-input:focus { box-shadow: 0 0 14px var(--cyber-blue); }
.math-input.bad { border-color: #ff3366; animation: headShake 0.3s; }
.math-streak { font-family: var(--font-mono); color: var(--cyber-green); font-size: 0.9rem; }
.term-log { max-height: 110px; overflow: hidden; }

.mini-overlay {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(11, 9, 20, 0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 24px;
}
.mini-overlay h3 { font-family: var(--font-heading); font-size: 2rem; color: var(--yellow); }
.mini-overlay p { color: var(--cream); font-size: 1.05rem; max-width: 460px; }
.mini-overlay .btn-primary { font-size: 1.1rem; }

.boss-act-btn.used { opacity: 0.45; }
.boss-act-btn small { display: block; font-family: var(--font-mono); font-size: 0.65rem; opacity: 0.7; }

@media (max-width: 768px) {
  .boss-speech-bubble { font-size: 0.75rem; }
}
