/* ==========================================================================
   Axiom: Visual Math Riddles
   Gameefy example chrome
   ========================================================================== */

:root {
  /* Gameefy cream, ink, moss, and coin */
  --bg-page: #f3eee4;
  --bg-app: #fffaf3;
  --bg-card: #fffaf3;
  --bg-card-subtle: #f3eee4;
  --bg-stage: #fffaf3;

  --border-app: #ddd4c4;
  --border-card: #ddd4c4;
  --border-card-subtle: #e6dece;
  --border-gold: #e2a33a;
  --border-gold-soft: rgba(226, 163, 58, 0.35);
  --border-subtle: rgba(92, 83, 72, 0.16);
  --border-glass: rgba(255, 250, 243, 0.9);

  --ink-primary: #1c1915;
  --ink-secondary: #5c5348;
  --ink-muted: #5c5348;
  --ink-faint: #8a7d70;
  --ink-gold: #8a5a14;

  --color-blue: #1e6b8a;
  --color-blue-dark: #164e66;
  --color-emerald: #2f6b4f;
  --color-emerald-dark: #1e4634;
  --color-gold: #e2a33a;
  --color-gold-dark: #b58120;
  --color-amber: #e2a33a;
  --color-terracotta: #c4553a;
  --color-purple: #5c5348;

  --font-serif: "Be Vietnam Pro", sans-serif;
  --font-sans: "Be Vietnam Pro", sans-serif;
  --font-mono: "Be Vietnam Pro", ui-monospace, monospace;

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* Gentle Warm Ambient Shadows */
  --shadow-card: 0 12px 32px -4px rgba(70, 50, 30, 0.08), 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-token: 0 2px 0 #D5C9B8, 0 3px 8px rgba(60, 45, 30, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-sans);
}

html, body {
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 12% -10%, rgb(226 163 58 / 18%), transparent 32%),
    radial-gradient(circle at 90% 0%, rgb(47 107 79 / 12%), transparent 28%);
  color: var(--ink-primary);
  height: 100%;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
}

#fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 3000;
}

/* ==========================================================================
   The Scholar's Atelier Frame (Mobile Tablet / Book Spine)
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 430px;
  min-width: 0;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  z-index: 10;
  background: var(--bg-app);
  border: 1px solid var(--border-app);
  box-shadow: 0 20px 50px -10px rgba(70, 50, 30, 0.12), 0 2px 10px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  box-sizing: border-box;
}

@media (max-width: 460px) {
  .app-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
  }
}

@media (min-width: 461px) {
  .app-container {
    height: min(96vh, 890px);
    max-height: 96vh;
    border-radius: var(--radius-xl);
    margin: auto;
  }
}

/* ==========================================================================
   Top Navigation Bar (Frosted Ivory Parchment Strip)
   ========================================================================== */
.top-nav {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px 6px;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-card-subtle);
  box-shadow: 0 1px 4px rgba(70, 50, 30, 0.03);
  animation: navBarSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes navBarSlideDown {
  0% { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}

/* Deck Selector Button - Elegant Vellum Capsule */
.btn-pack-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  color: var(--ink-primary);
  padding: 4.5px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1.5px 0 #CCC0AE, 0 2px 6px rgba(0, 0, 0, 0.03);
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.05s ease, box-shadow 0.05s ease, border-color 0.15s ease;
}

.btn-pack-switch:hover {
  border-color: var(--border-gold);
}

.btn-pack-switch:active {
  transform: translateY(1.5px) scale(0.97);
  box-shadow: 0 0.5px 0 #CCC0AE;
}

.pack-switch-icon {
  font-size: 12px;
}

.chevron-arrow {
  font-size: 9px;
  color: var(--ink-muted);
}

/* Level Indicator Pill - Warm Linen Pill */
.btn-level-picker {
  background: #F3ECE1;
  border: 1px solid #DFD4C3;
  color: var(--ink-secondary);
  padding: 4.5px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1.5px 0 #CFC2AE;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-level-picker:active {
  transform: translateY(1.5px) scale(0.97);
  box-shadow: 0 0.5px 0 #CFC2AE;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Streak Flame Badge - Warm Ochre Pill */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: #FFF7ED;
  border: 1px solid #FDBA74;
  color: #9A3412;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 1.5px 0 #FED7AA;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: default;
}

.streak-flame {
  font-size: 12px;
  display: inline-block;
  animation: flameWiggle 1.4s ease-in-out infinite;
}

@keyframes flameWiggle {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50% { transform: scale(1.15) rotate(4deg); }
}

/* Star Coins Badge - Antique Brass Coin Pouch */
.coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  border: 1px solid #F59E0B;
  padding: 4px 8px 4px 7px;
  border-radius: var(--radius-pill);
  color: #78350F;
  font-weight: 800;
  font-size: 12px;
  box-shadow: 0 1.5px 0 #D97706, 0 2px 6px rgba(180, 130, 40, 0.1);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.coin-badge:active {
  transform: translateY(1.5px) scale(0.97);
  box-shadow: 0 0.5px 0 #D97706;
}

.coin-symbol {
  font-size: 12px;
  display: inline-block;
}

.coin-plus-icon {
  font-size: 10px;
  font-weight: 800;
  color: #92400E;
  margin-left: 1px;
}

/* Sound Buttons - Clean Warm Pebble Buttons */
.btn-sound-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: #FFFFFF;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  box-shadow: 0 1.5px 0 #CCC0AE, 0 2px 5px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-sound-toggle:hover {
  background: #FAF7F2;
  border-color: var(--border-gold);
}

.btn-sound-toggle:active {
  transform: translateY(1px) scale(0.94);
  box-shadow: 0 0.5px 0 #CCC0AE;
}

/* ==========================================================================
   Question Info Header Strip (Scholarly Topic Ribbon & Navigation)
   ========================================================================== */
.question-info {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 12px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-tags {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Topic Ribbon: Warm Oatmeal Banner with Antique Gold Accent */
.tag-topic {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 4px 10px;
  border-radius: 7px;
  background: #F4EFEB;
  color: #4A3E33;
  border: 1px solid var(--border-card);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(60, 45, 30, 0.04);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-topic::before {
  content: '✦';
  font-size: 9px;
  color: var(--color-gold);
}

.tag-topic.tag-entering {
  animation: tagEntrancePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes tagEntrancePop {
  0% { opacity: 0; transform: scale(0.92) translateY(2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.question-nav-btns {
  display: flex;
  gap: 6px;
}

.btn-q-nav {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border-card);
  background: #FFFFFF;
  color: var(--ink-secondary);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1.5px 0 #CCC0AE, 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: transform 0.06s ease, background 0.12s ease;
}

.btn-q-nav:hover:not(:disabled) {
  background: #F9F6F0;
  border-color: var(--border-gold);
}

.btn-q-nav:active:not(:disabled) {
  transform: translateY(1px) scale(0.95);
  box-shadow: 0 0.5px 0 #CCC0AE;
}

.btn-q-nav:disabled {
  opacity: 0.35;
  cursor: default;
  box-shadow: none;
}

/* ==========================================================================
   Hero Visual Stage (The Scholar's Mathematical Slate & Manuscript Card)
   ========================================================================== */
.visual-stage-wrapper {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: calc(100% - 16px);
  margin: clamp(4px, 0.8vh, 8px) 8px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 32px -4px rgba(70, 50, 30, 0.07), 0 2px 6px rgba(0, 0, 0, 0.02);
  position: relative;
  touch-action: pan-y;
  cursor: grab;
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}

.visual-stage-wrapper:active {
  cursor: grabbing;
}

/* Card Draw / Deal Animation */
.visual-stage-wrapper.stage-entering {
  animation: cardDealDraw 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardDealDraw {
  0% {
    opacity: 0.4;
    transform: translateY(12px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Card Artwork Window */
.visual-stage {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin: 0;
  background: var(--bg-stage);
  border: none;
  border-bottom: 1px solid var(--border-card-subtle);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px 12px;
  box-sizing: border-box;
}

.visual-stage.stage-entering .visual-svg {
  animation: cardArtFocus 0.4s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

@keyframes cardArtFocus {
  0% { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

.visual-svg {
  width: 100%;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 100%;
  display: block;
  transform-origin: center center;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(60, 45, 30, 0.04));
}

/* Warm Parchment Styling for Dark SVGs */
.visual-svg rect[fill="#1e293b"],
.visual-svg rect[fill="#0f172a"],
.visual-svg rect[fill="#090d16"],
.visual-svg rect[fill="#020617"],
.visual-svg rect[fill="#000000"] {
  fill: #fffaf3 !important;
  stroke: #ddd4c4 !important;
  stroke-width: 1.5px !important;
  rx: 8px !important;
}

/* Dignified, Scholarly Inks inside SVGs */
.visual-svg text {
  font-family: var(--font-sans) !important;
}

.visual-svg text[fill="#f8fafc"],
.visual-svg text[fill="#f1f5f9"],
.visual-svg text[fill="#ffffff"] {
  fill: #1c1915 !important;
  font-weight: 700 !important;
}

.visual-svg text[fill="#94a3b8"],
.visual-svg text[fill="#64748b"] {
  fill: #5c5348 !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
}

.visual-svg text[fill="#38bdf8"] {
  fill: #1E5A7D !important;
  font-weight: 700 !important;
}

.visual-svg text[fill="#00f0b5"] {
  fill: #1e4634 !important;
  font-weight: 700 !important;
}

.visual-svg [stroke="#00f0b5"],
.visual-svg [stroke="#10b981"] { stroke: #2f6b4f !important; }
.visual-svg [fill="#00f0b5"],
.visual-svg [fill="#10b981"] { fill: #2f6b4f !important; }
.visual-svg [stroke="#38bdf8"],
.visual-svg [stroke="#0ea5e9"] { stroke: #1e6b8a !important; }
.visual-svg [fill="#38bdf8"],
.visual-svg [fill="#0ea5e9"] { fill: #1e6b8a !important; }
.visual-svg [stroke="#fbbf24"],
.visual-svg [stroke="#f59e0b"] { stroke: #e2a33a !important; }
.visual-svg [fill="#fbbf24"],
.visual-svg [fill="#f59e0b"] { fill: #e2a33a !important; }
.visual-svg [stroke="#f43f5e"],
.visual-svg [stroke="#a855f7"] { stroke: #c4553a !important; }
.visual-svg [fill="#f43f5e"],
.visual-svg [fill="#a855f7"] { fill: #c4553a !important; }
.visual-svg circle[fill="#0f172a"],
.visual-svg circle[fill="#090d16"],
.visual-svg path[fill="#0f172a"],
.visual-svg path[fill="#090d16"],
.visual-svg polygon[fill="#0f172a"],
.visual-svg polygon[fill="#090d16"],
.visual-svg ellipse[fill="#0f172a"] {
  fill: #fffaf3 !important;
  stroke: #ddd4c4 !important;
}

.visual-svg text[fill="#fbbf24"],
.visual-svg text[fill="#f59e0b"] {
  fill: #92580C !important;
  font-weight: 700 !important;
}

/* Solved Stamp: Dignified Antique Gold Seal */
.solved-stamp {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #FFFDF9;
  border: 1px solid #C29338;
  color: #8C5E1E;
  font-family: var(--font-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(180, 130, 40, 0.12);
}

.solved-stamp.victory-stamp-slam {
  animation: stampSlam 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes stampSlam {
  0% { opacity: 0; transform: scale(2) rotate(-12deg); }
  70% { opacity: 1; transform: scale(0.96) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* Card Rule & Proposition Box (Bottom Card Plate) */
.question-prompt-bar {
  flex-shrink: 0;
  width: 100%;
  background: #FFFFFF;
  padding: 12px 16px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.prompt-target-glyph {
  font-size: 14px;
  line-height: 1.6;
  flex-shrink: 0;
  color: var(--color-amber);
}

.question-prompt {
  font-family: var(--font-serif);
  font-size: clamp(14.5px, 2vh, 16px);
  line-height: 1.58;
  color: var(--ink-primary);
  font-weight: 600;
  letter-spacing: -0.1px;
  flex: 1 1 0%;
  min-width: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

/* ==========================================================================
   Answer Slot & Scholarly Clue Token
   ========================================================================== */
.answer-bar {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 10px 3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Inscription Slot: Warm Alabaster Tablet */
/* Inscription Slot: Warm Alabaster Tablet */
.input-display {
  flex: 1;
  min-width: 0;
  height: clamp(44px, 5.6vh, 48px);
  background: #FFFFFF;
  border: 1px solid #DDD1BF;
  border-radius: 14px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  box-sizing: border-box;
  box-shadow: inset 0 1px 3px rgba(60, 45, 30, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.input-display.focused {
  border-color: #B88628;
  box-shadow: inset 0 1px 2px rgba(60, 45, 30, 0.03), 0 0 0 3px rgba(184, 134, 40, 0.15);
}

.input-display.gentle-retry,
.input-display.shake {
  animation: gentleRethinkPulse 0.65s cubic-bezier(0.25, 1, 0.5, 1) both;
}

@keyframes gentleRethinkPulse {
  0% { transform: scale(1); border-color: var(--border-card); }
  25% { transform: scale(1.02); border-color: #D97706; background: #FFFBEB; }
  65% { transform: scale(0.99); border-color: #B45309; }
  100% { transform: scale(1); border-color: var(--border-card); background: #FFFFFF; }
}

.input-label {
  font-size: 10.5px;
  font-weight: 700;
  color: #8C7B6D;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.input-text {
  flex: 1;
  font-size: 26px;
  font-weight: 600;
  color: var(--ink-primary);
  letter-spacing: 1.5px;
  font-family: var(--font-serif);
}

.input-cursor {
  display: inline-block;
  width: 2px;
  height: 22px;
  background: #B88628;
  border-radius: 1px;
  animation: cursorBlink 1s infinite;
}

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

/* Clue Token: Warm Antique Brass Seal */
.btn-hint {
  height: clamp(44px, 5.6vh, 48px);
  background: #FAF6EE;
  border: 1px solid #DDD0BC;
  border-radius: 14px;
  padding: 0 16px;
  color: #8A5F23;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 0 #D5C5AC, 0 2px 6px rgba(140, 94, 30, 0.04);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-hint:active {
  transform: translateY(1.5px) scale(0.97);
  box-shadow: 0 0.5px 0 #D5C5AC;
}

.hint-icon {
  font-size: 14px;
  display: inline-block;
}

/* ==========================================================================
   Contemplation Whisper Bar (Gentle Encouragement)
   ========================================================================== */
.guidance-whisper-bar {
  flex-shrink: 0;
  height: clamp(18px, 2.4vh, 22px);
  min-height: clamp(18px, 2.4vh, 22px);
  max-height: clamp(18px, 2.4vh, 22px);
  margin: 1px 12px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
}

.whisper-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(11.5px, 1.6vh, 12.5px);
  font-weight: 500;
  color: var(--ink-gold);
  opacity: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
}

.whisper-text.whisper-active {
  opacity: 1;
  animation: whisperFadeSequence 3.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes whisperFadeSequence {
  0% { opacity: 0; transform: translateY(5px); }
  14% { opacity: 1; transform: translateY(0); }
  82% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-3px); }
}

/* ==========================================================================
   Tactile Ivory & Sandstone Keypad (Minimal Acoustic Keys)
   ========================================================================== */
.keypad-wrapper {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 3px 8px calc(7px + env(safe-area-inset-bottom, 0px));
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
}

.key-btn {
  width: 100%;
  min-width: 0;
  height: clamp(42px, 5.6vh, 48px);
  border-radius: 13px;
  font-size: clamp(19px, 2.7vh, 23px);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: var(--font-serif);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.key-btn:active {
  transform: translateY(1.5px) !important;
}

/* Number Keys: Crisp Warm Porcelain Tiles */
.key-num {
  background: #FFFFFF;
  color: var(--ink-primary);
  border: 1px solid #DFD5C5;
  box-shadow: 0 2px 0 #D2C4B1, 0 3px 6px rgba(60, 45, 30, 0.03);
}

.key-num:active {
  box-shadow: 0 0.5px 0 #D2C4B1 !important;
}

/* Backspace: Warm Sandstone Token */
.key-action[data-key="backspace"],
.key-backspace {
  background: #F4EFEB;
  color: #5C4E43;
  border: 1px solid #DCD0BF;
  box-shadow: 0 2px 0 #C9BDAA, 0 3px 6px rgba(0, 0, 0, 0.02);
  font-family: var(--font-sans);
  font-size: 18px;
}

.key-action[data-key="backspace"]:active,
.key-backspace:active {
  box-shadow: 0 0.5px 0 #C9BDAA !important;
}

/* Clear: Muted Soft Terracotta / Rosewood */
.key-action[data-key="clear"],
.key-clear {
  background: #F4EFEB;
  color: #7D4C3E;
  border: 1px solid #DCD0BF;
  box-shadow: 0 2px 0 #C9BDAA, 0 3px 6px rgba(0, 0, 0, 0.02);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
}

.key-action[data-key="clear"]:active,
.key-clear:active {
  box-shadow: 0 0.5px 0 #C9BDAA !important;
}

/* Symbols: Warm Pebble Stone */
.key-symbol {
  background: #F4EFEB;
  color: #5C4E43;
  border: 1px solid #DCD0BF;
  box-shadow: 0 2px 0 #C9BDAA, 0 3px 6px rgba(0, 0, 0, 0.02);
  font-size: 21px;
  font-family: var(--font-serif);
}

.key-symbol:active {
  box-shadow: 0 0.5px 0 #C9BDAA !important;
}

/* Submit Button: Oxford Pine Green Scholar Button */
.key-submit {
  grid-column: span 2;
  background: linear-gradient(180deg, #2D5844 0%, #1F4230 100%);
  color: #F8F5EC;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  gap: 6px;
  border: 1px solid #3B6B53;
  box-shadow: 0 2.5px 0 #152E22, 0 4px 12px rgba(32, 67, 50, 0.22);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.key-submit:active {
  box-shadow: 0 1px 0 #152E22 !important;
}

.enter-glyph {
  font-size: 12px;
  color: #FEEAA2;
}

/* ==========================================================================
   Modals & Pop-up Dialogs (Collectible Card Grids)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(36, 28, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.academic-card {
  width: 100%;
  max-width: 420px;
  background: #FFFDF9;
  border: 1px solid var(--border-app);
  border-radius: var(--radius-xl);
  padding: 22px 18px;
  box-shadow: 0 24px 64px rgba(45, 35, 25, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.8);
  color: var(--ink-primary);
  max-height: 86vh;
  overflow-y: auto;
  transform: scale(0.92) translateY(16px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.visible .academic-card {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-icon-title {
  font-size: 26px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-primary);
  line-height: 1.25;
}

.modal-tag-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
  font-weight: 600;
}

.modal-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: #FFFFFF;
  color: var(--ink-secondary);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1.5px 0 #D5C9B8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.05s ease, background 0.15s ease;
}

.modal-close-btn:hover {
  background: #FEF2F2;
  color: #DC2626;
  border-color: #FECACA;
}

.modal-close-btn:active {
  transform: translateY(1px) scale(0.95);
}

.modal-subtitle {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.45;
}

/* ==========================================================================
   Deck Collection List (Deck Boxes)
   ========================================================================== */
.pack-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.academic-pack-card {
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(70, 50, 30, 0.04);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.academic-pack-card.active-pack {
  border-color: var(--border-gold);
  background: #FFFDF7;
  box-shadow: 0 0 0 2px var(--border-gold-soft), 0 4px 12px rgba(180, 130, 40, 0.08);
}

.pack-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pack-grade-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
}

.pack-status-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #15803D;
}

.pack-lock-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #B45309;
}

.pack-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pack-symbol-box {
  font-size: 26px;
  width: 48px;
  height: 48px;
  background: #FCFAF6;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  flex-shrink: 0;
}

.pack-info {
  flex: 1;
  min-width: 0;
}

.pack-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 2px;
}

.pack-sub {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.35;
}

.pack-progress-bar-academic {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 4px;
}

.pack-progress-fill-academic {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.pack-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: #64748b;
  font-weight: 700;
}

.pack-action {
  display: flex;
  justify-content: flex-end;
}

.academic-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 800;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-open-volume {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 2.5px 0 #0369a1;
}

.btn-open-volume:active {
  transform: translateY(2px);
  box-shadow: 0 0.5px 0 #0369a1;
}

.btn-active-volume {
  background: linear-gradient(180deg, #fde047 0%, #eab308 100%);
  color: #713f12;
  border-color: #ca8a04;
  box-shadow: 0 2.5px 0 #a16207;
}

.btn-unlock-volume.can-afford {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 2.5px 0 #15803d;
}

.btn-unlock-volume.can-afford:active {
  transform: translateY(2px);
  box-shadow: 0 0.5px 0 #15803d;
}

.btn-unlock-volume.cannot-afford {
  background: #e2e8f0;
  color: #94a3b8;
  border-color: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
}

/* ==========================================================================
   Card Level Grid (Mini Playing Cards)
   ========================================================================== */
.level-meta-banner {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #0369a1;
  font-weight: 700;
}

.level-unlocked-info strong {
  color: #0284c7;
  font-weight: 800;
}

.level-grid-academic {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.level-btn-academic {
  height: 46px;
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  color: var(--ink-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1.5px 0 #D5C9B8;
  position: relative;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.level-btn-academic:active {
  transform: translateY(1.5px) scale(0.96) !important;
  box-shadow: 0 0.5px 0 #D5C9B8;
}

.level-btn-academic.solved {
  background: #F0FDF4;
  border-color: #86EFAC;
  color: #166534;
  box-shadow: 0 1.5px 0 #BBF7D0;
}

.level-btn-academic.current {
  background: #FEF9C3;
  border-color: #EAB308;
  color: #854D0E;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.35);
  animation: currentLevelPulse 2.4s ease-in-out infinite;
}

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

.level-btn-academic.level-locked {
  background: #F4EFEB;
  border-color: #E2D9CC;
  color: #A89B8C;
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.level-idx {
  font-size: 14px;
  font-weight: 700;
}

.level-laurel {
  font-size: 11px;
  color: #16A34A;
  font-weight: 700;
}

.level-lock-glyph {
  font-size: 10px;
  color: #A89B8C;
}

/* ==========================================================================
   Hint Modal (Clue Scrolls)
   ========================================================================== */
.hint-tiers-academic {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hint-box-academic {
  background: #FFFFFF;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  box-shadow: 0 1px 4px rgba(70, 50, 30, 0.03);
}

.hint-box-academic.revealed {
  border-color: var(--border-gold);
  background: #FFFDF7;
  box-shadow: 0 2px 8px rgba(194, 147, 56, 0.12);
}

.hint-box-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.hint-tag-academic {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-gold);
}

.hint-cost-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: #B45309;
}

.hint-status-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #15803D;
}

.hint-text-academic {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-primary);
  font-weight: 500;
}

.proof-body {
  color: #1E5A7D;
  font-weight: 600;
}

.hint-unlock-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.btn-unlock-hint {
  flex: 1;
  padding: 8px;
  background: linear-gradient(180deg, #FEF08A 0%, #FDE047 100%);
  border: 1px solid #CA8A04;
  color: #713F12;
  font-weight: 700;
  box-shadow: 0 2px 0 #CA8A04;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-unlock-hint:active {
  transform: translateY(1.5px);
  box-shadow: 0 0.5px 0 #CA8A04;
}

.btn-ad-hint {
  flex: 1;
  padding: 8px;
  background: linear-gradient(180deg, #F0FDF4 0%, #DCFCE7 100%);
  border: 1px solid #86EFAC;
  color: #166534;
  font-weight: 700;
  box-shadow: 0 2px 0 #86EFAC;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-ad-hint:active {
  transform: translateY(1.5px);
  box-shadow: 0 0.5px 0 #86EFAC;
}

/* ==========================================================================
   Win / Eureka Modal (Card Cleared Celebration)
   ========================================================================== */
.win-academic-card {
  text-align: center;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}

.victory-laurel-badge {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.sunburst-aura {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.45) 0%, rgba(245, 158, 11, 0.2) 45%, transparent 70%);
  animation: rotateSunburst 10s linear infinite;
  pointer-events: none;
}

@keyframes rotateSunburst {
  0% { transform: rotate(0deg) scale(0.92); opacity: 0.8; }
  50% { transform: rotate(180deg) scale(1.15); opacity: 1; }
  100% { transform: rotate(360deg) scale(0.92); opacity: 0.8; }
}

.win-academic-card .laurel-wreath {
  position: relative;
  z-index: 1;
  font-size: 52px;
  display: inline-block;
  animation: wreathCelebration 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes wreathCelebration {
  0% { opacity: 0; transform: scale(0) rotate(-45deg); }
  65% { opacity: 1; transform: scale(1.28) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.laurel-stars {
  position: relative;
  z-index: 1;
  font-size: 16px;
  letter-spacing: 6px;
  animation: sparklePulse 1.8s ease-in-out infinite;
}

@keyframes sparklePulse {
  0%, 100% { transform: scale(0.92); }
  50% { transform: scale(1.18); }
}

.win-academic-title {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 900;
  color: #16a34a;
  margin-bottom: 4px;
}

.win-academic-sub {
  font-size: 13.5px;
  color: #475569;
  font-weight: 700;
  margin-bottom: 14px;
}

.academic-award-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #FEF9EE 0%, #FEF08A 100%);
  border: 1px solid #CA8A04;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
  box-shadow: 0 2px 0 #CA8A04, 0 4px 10px rgba(180, 130, 40, 0.15);
  animation: awardBannerPunch 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes awardBannerPunch {
  0% { opacity: 0; transform: scale(0.8) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.award-amount {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #713F12;
}

.award-bonus-note {
  font-size: 11px;
  color: #15803D;
  font-weight: 700;
}

.streak-academic-tag {
  font-size: 11.5px;
  font-weight: 700;
  color: #9A3412;
  background: #FFF7ED;
  border: 1px solid #FDBA74;
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}

.proof-card {
  text-align: left;
  background: #FDFBF7;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(70, 50, 30, 0.03);
}

.proof-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.proof-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
}

.qed-symbol {
  font-size: 11.5px;
  color: #15803D;
  font-weight: 700;
}

.proof-text {
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-primary);
  font-weight: 500;
}

/* Next Card Button */
.btn-next-problem {
  width: 100%;
  height: 48px;
  background: linear-gradient(180deg, #244C39 0%, #1A3C2D 100%);
  color: #FDF9EE;
  font-size: 15px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid #36654E;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 3px 0 #122B20, 0 4px 12px rgba(26, 60, 45, 0.22);
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-next-problem:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 1px 0 #122B20;
}

/* ==========================================================================
   Star Shop & Treasury
   ========================================================================== */
.treasury-modal-card {
  max-width: 440px;
  max-height: 88vh;
  overflow-y: auto;
}

.treasury-balance-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.1);
}

.treasury-balance-meta {
  font-size: 12px;
  color: #92400e;
  font-weight: 700;
}

.treasury-coin-total {
  font-size: 20px;
  font-weight: 900;
  color: #b45309;
}

.treasury-sections-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.treasury-section-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-glyph {
  font-size: 20px;
}

.section-heading {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.section-subheading {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.35;
}

.rewarded-ad-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.ad-card-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ad-badge-free {
  align-self: flex-start;
  font-size: 9.5px;
  font-weight: 800;
  color: #15803d;
  background: #dcfce7;
  border: 1px solid #16a34a;
  padding: 2px 6px;
  border-radius: 4px;
}

.ad-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.ad-card-desc {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
}

.btn-watch-rewarded-ad {
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid #16a34a;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  box-shadow: 0 2.5px 0 #15803d;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-watch-rewarded-ad:active {
  transform: translateY(2px);
  box-shadow: 0 0.5px 0 #15803d;
}

.iap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.iap-item-card {
  position: relative;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.iap-item-card.featured {
  background: #fefce8;
  border-color: #ca8a04;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.2);
}

.iap-item-card.pass-card {
  grid-column: span 2;
  flex-direction: row;
  justify-content: space-between;
  padding: 12px 14px;
  text-align: left;
  background: #faf5ff;
  border-color: #c084fc;
}

.iap-ribbon {
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 9px;
  font-weight: 800;
  background: #f59e0b;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
}

.pass-ribbon {
  background: #9333ea;
}

.iap-icon {
  font-size: 26px;
}

.iap-title {
  font-size: 12.5px;
  font-weight: 800;
  color: #0f172a;
}

.iap-reward {
  font-size: 11.5px;
  font-weight: 800;
  color: #0284c7;
}

.iap-buy-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: transform 0.05s ease, background 0.15s ease;
}

.iap-buy-btn:active {
  transform: translateY(1.5px);
}

.btn-highlight {
  background: linear-gradient(180deg, #fde047 0%, #facc15 100%);
  border-color: #ca8a04;
  color: #713f12;
}

.btn-pass {
  background: linear-gradient(180deg, #c084fc 0%, #9333ea 100%);
  border-color: #7e22ce;
  color: #ffffff;
}

/* ==========================================================================
   Rewarded Ad Simulation Sheet
   ========================================================================== */
.rewarded-ad-player-sheet {
  width: 100%;
  max-width: 400px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-xl);
  padding: 20px;
  color: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ad-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ad-channel-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ad-brand-glyph {
  font-size: 20px;
}

.ad-brand-title {
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
}

.ad-countdown-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  color: #facc15;
}

.ad-player-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ad-visual-showcase {
  background: #1e293b;
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.ad-geometric-loader {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.geo-orbit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.orbit-1 {
  border-top-color: #38bdf8;
  animation: orbitSpin 1.8s linear infinite;
}

.orbit-2 {
  border-right-color: #facc15;
  animation: orbitSpin 2.4s linear infinite reverse;
}

.orbit-3 {
  border-bottom-color: #4ade80;
  animation: orbitSpin 3s linear infinite;
}

@keyframes orbitSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ad-center-glyph {
  font-size: 20px;
}

.ad-quote {
  font-size: 13px;
  line-height: 1.5;
  color: #cbd5e1;
  font-style: italic;
}

.ad-quote cite {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  color: #94a3b8;
  font-style: normal;
  font-weight: 700;
}

.ad-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.ad-progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #4ade80 100%);
  border-radius: var(--radius-pill);
}

.ad-player-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ad-wait-notice {
  font-size: 11.5px;
  color: #94a3b8;
  text-align: center;
}

.btn-claim-ad-reward {
  width: 100%;
  height: 46px;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: 1px solid #16a34a;
  box-shadow: 0 2.5px 0 #15803d;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-claim-ad-reward:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-claim-ad-reward.ready-pulse {
  animation: claimPulse 1.2s ease-in-out infinite alternate;
}

@keyframes claimPulse {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(74, 222, 128, 0.3); }
  100% { transform: scale(1.02); box-shadow: 0 0 20px rgba(74, 222, 128, 0.6); }
}

/* ==========================================================================
   IAP Checkout Sheet Sandbox
   ========================================================================== */
.iap-checkout-sheet {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-xl);
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  color: #0f172a;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.iap-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.iap-sheet-app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-icon-glyph {
  font-size: 24px;
}

.app-name {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.in-app-text {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.btn-sheet-cancel {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.iap-purchase-summary {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.iap-product-lead {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-icon-large {
  font-size: 32px;
}

.product-name-large {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.product-badge-lead {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 8px;
  border-radius: 4px;
}

.product-detail-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.iap-price-hero {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
}

.price-currency-tag {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}

.price-amount-large {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
}

.btn-confirm-purchase {
  width: 100%;
  height: 48px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  border-radius: var(--radius-md);
  border: 1.5px solid #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 0 #0369a1;
  cursor: pointer;
}

.btn-confirm-purchase:active {
  transform: translateY(2px);
  box-shadow: 0 0.5px 0 #0369a1;
}

/* ==========================================================================
   Compact Viewport & Mobile Responsiveness
   ========================================================================== */
@media (max-height: 680px) {
  .top-nav {
    padding: 5px 8px 4px;
  }
  .btn-pack-switch {
    padding: 4px 8px;
    font-size: 11px;
  }
  .btn-level-picker {
    padding: 4px 8px;
    font-size: 11px;
  }
  .coin-badge {
    padding: 3px 8px;
    font-size: 12px;
  }
  .tag-topic {
    font-size: 11px;
    padding: 3px 10px;
  }
  .btn-q-nav {
    width: 26px;
    height: 26px;
    font-size: 14px;
  }
  .visual-stage-wrapper {
    margin: 2px 8px 3px;
  }
  .visual-stage {
    max-height: 50%;
  }
  .question-prompt-bar {
    padding: 6px 12px 8px;
    min-height: 56px;
  }
  .question-prompt {
    font-size: 14px;
    line-height: 1.38;
  }
  .answer-bar {
    padding: 2px 8px;
  }
  .input-display {
    height: 38px;
  }
  .input-text {
    font-size: 20px;
  }
  .btn-hint {
    height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }
  .guidance-whisper-bar {
    height: 16px;
    min-height: 16px;
    max-height: 16px;
    margin: 0 8px 1px;
  }
  .whisper-text {
    font-size: 11px;
  }
  .keypad-wrapper {
    padding: 2px 8px 6px;
  }
  .key-btn {
    height: 36px;
    font-size: 17px;
  }
}

@media (max-width: 390px) {
  .top-nav {
    padding: 5px 6px 4px;
    gap: 3px;
  }
  .btn-pack-switch {
    padding: 4px 6px;
    font-size: 11px;
    gap: 3px;
  }
  .btn-level-picker {
    padding: 4px 6px;
    font-size: 11px;
  }
  .coin-badge {
    padding: 3px 6px;
    font-size: 11px;
    gap: 2px;
  }
  .btn-sound-toggle {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
}
