/* ==========================================================================
   MathScroll: Grade 5 Adventure
   Kid-Friendly Design System & Mobile-First 100dvh Vertical Eduscrolling
   ========================================================================== */

:root {
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-comic: 'Fredoka', 'Comic Sans MS', cursive, sans-serif;

  /* Vibrant Kid-Friendly Palette */
  --color-sunshine: #FFD166;
  --color-coral: #FF477E;
  --color-teal: #06D6A0;
  --color-sky: #4CC9F0;
  --color-violet: #7209B7;
  --color-electric: #3A86FF;
  --color-orange: #FB5607;
  --color-bg-dark: #0F172A;
  --color-card-bg: rgba(30, 41, 59, 0.85);
  --color-card-border: rgba(255, 255, 255, 0.15);
  --color-text-light: #F8FAFC;
  --color-text-muted: #94A3B8;

  /* Sizing & Radii */
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-3xl: 40px;
  --radius-full: 9999px;
  --hud-height: 64px;
  --rail-width: 68px;

  /* Shadows */
  --shadow-card: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
  --shadow-glow-yellow: 0 0 20px rgba(255, 209, 102, 0.4);
  --shadow-glow-pink: 0 0 20px rgba(255, 71, 126, 0.4);
  --shadow-glow-teal: 0 0 20px rgba(6, 214, 160, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-bg-dark);
  font-family: var(--font-main);
  color: var(--color-text-light);
}

/* Background animated subtle gradient blobs */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle at 20% 20%, rgba(114, 9, 183, 0.25) 0%, transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(6, 214, 160, 0.2) 0%, transparent 45%),
              radial-gradient(circle at 80% 20%, rgba(255, 71, 126, 0.2) 0%, transparent 40%),
              radial-gradient(circle at 20% 80%, rgba(255, 209, 102, 0.2) 0%, transparent 45%);
  z-index: 0;
  pointer-events: none;
  filter: blur(40px);
}

/* App Outer Shell - Center on desktop with mobile phone bezel */
.app-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0b1120;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  z-index: 1;
}

@media (min-width: 500px) {
  .app-container {
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    border-right: 2px solid rgba(255, 255, 255, 0.1);
  }
}

/* ==========================================================================
   TOP HUD
   ========================================================================== */
.top-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 10px 14px 6px;
  background: linear-gradient(180deg, rgba(11, 17, 32, 0.95) 60%, rgba(11, 17, 32, 0) 100%);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chapter-picker-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chapter-select {
  width: 100%;
  padding: 8px 32px 8px 14px;
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  appearance: none;
  cursor: pointer;
  outline: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}

.chapter-select:focus {
  border-color: var(--color-sunshine);
  background: rgba(255, 255, 255, 0.2);
}

.chapter-select option {
  background: #1e293b;
  color: #fff;
  font-size: 14px;
}

.chapter-select-icon {
  position: absolute;
  right: 12px;
  pointer-events: none;
  font-size: 12px;
  color: var(--color-sunshine);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid transparent;
}

.hud-badge:active {
  transform: scale(0.92);
}

.streak-badge {
  background: rgba(251, 86, 7, 0.18);
  color: #FF7A00;
  border-color: rgba(251, 86, 7, 0.4);
}

.streak-badge.completed-today {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
}

.streak-badge.at-risk {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.6);
  color: #f87171;
  animation: streakWarning 1.5s infinite;
}

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

.streak-flame {
  animation: flamePulse 1.2s infinite alternate;
  display: inline-block;
}

@keyframes flamePulse {
  0% { transform: scale(1) rotate(-3deg); }
  100% { transform: scale(1.25) rotate(5deg); }
}

.backpack-btn {
  background: rgba(114, 9, 183, 0.25);
  color: #E2B6FF;
  border-color: rgba(114, 9, 183, 0.5);
}

.sound-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
}

/* Progress bar */
.hud-progress-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.hud-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--color-sunshine), var(--color-coral), var(--color-teal));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.hud-progress-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
}

/* ==========================================================================
   VERTICAL SCROLL SNAP FEED
   ========================================================================== */
.feed-container {
  flex: 1;
  width: 100%;
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 10;
  overflow-anchor: none;
}

.feed-container::-webkit-scrollbar {
  display: none;
}

/* Feed Virtual Track Spacers */
.feed-spacer {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
  box-sizing: border-box;
}

/* Each Math Card represents 1 snap viewport */
.card-snap-view {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  flex-shrink: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--hud-height) + 12px) 14px 20px;
  position: relative;
  box-sizing: border-box;
}

/* Card Content Container */
.math-card {
  width: 100%;
  height: 100%;
  max-height: 840px;
  background: var(--color-card-bg);
  border: 2px solid var(--color-card-border);
  border-radius: var(--radius-3xl);
  backdrop-filter: blur(16px);
  padding: 22px 20px;
  padding-right: calc(var(--rail-width) + 4px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow-y: auto;
  scrollbar-width: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.math-card::-webkit-scrollbar {
  display: none;
}

/* Card Top Tag */
.card-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.card-type-tag {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-radius: var(--radius-full);
  background: rgba(255, 209, 102, 0.2);
  color: var(--color-sunshine);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

.card-num-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* Card Header: 24px-30px fonts */
.card-title {
  font-size: 26px;
  font-weight: 900;
  line-height: 1.25;
  color: #ffffff;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* Card Body: 18px-20px fonts */
.card-body {
  font-size: 18px;
  line-height: 1.55;
  color: #e2e8f0;
  font-weight: 500;
  margin-bottom: 14px;
  flex: 1;
}

.card-body strong {
  color: var(--color-sunshine);
  font-weight: 800;
}

.card-body em {
  color: var(--color-teal);
  font-style: normal;
  font-weight: 700;
}

.card-fact-box {
  background: rgba(76, 201, 240, 0.12);
  border-left: 4px solid var(--color-sky);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  color: #bae6fd;
  margin-top: 10px;
}

/* Concept Mini Cards inside concept body */
.concept-boxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.concept-mini-card {
  padding: 12px 14px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.concept-mini-card.green { border-color: rgba(6, 214, 160, 0.4); background: rgba(6, 214, 160, 0.1); }
.concept-mini-card.yellow { border-color: rgba(255, 209, 102, 0.4); background: rgba(255, 209, 102, 0.1); }
.concept-mini-card.purple { border-color: rgba(114, 9, 183, 0.4); background: rgba(114, 9, 183, 0.1); }

.concept-mini-card h4 {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}

.concept-mini-card p {
  font-size: 15px;
  color: #cbd5e1;
  line-height: 1.35;
}

/* Tags in footer */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-pill {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   QUIZ COMPONENT
   ========================================================================== */
.quiz-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.quiz-question {
  font-size: 19px;
  font-weight: 800;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 4px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-opt-btn {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  font-family: var(--font-main);
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-opt-btn:active {
  transform: scale(0.98);
}

.quiz-opt-btn.correct {
  background: rgba(6, 214, 160, 0.25);
  border-color: var(--color-teal);
  color: #fff;
  box-shadow: var(--shadow-glow-teal);
}

.quiz-opt-btn.wrong {
  background: rgba(255, 71, 126, 0.25);
  border-color: var(--color-coral);
  color: #fff;
  animation: shakeWrong 0.4s ease;
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.quiz-feedback {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-xl);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: none;
}

.quiz-feedback.show {
  display: block;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  0% { transform: scale(0.9); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   RIGHT ACTION RAIL (TIKTOK STYLE)
   ========================================================================== */
.action-rail {
  position: absolute;
  right: 12px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 20;
}

.rail-btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rail-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.rail-btn:active {
  transform: scale(0.85);
}

.rail-count {
  font-size: 11px;
  font-weight: 800;
  color: #e2e8f0;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* Heart Like Button */
.like-btn.liked {
  background: rgba(255, 71, 126, 0.3);
  border-color: var(--color-coral);
  color: var(--color-coral);
  animation: heartBump 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes heartBump {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Bookmark Star Button */
.bookmark-btn.bookmarked {
  background: rgba(255, 209, 102, 0.3);
  border-color: var(--color-sunshine);
  color: var(--color-sunshine);
}

/* Leitner Confidence Buttons */
.leitner-rail-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
}

.btn-leitner {
  width: 40px;
  height: 40px;
  font-size: 18px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-leitner:active {
  transform: scale(0.85);
}

.btn-leitner.easy.active {
  background: rgba(255, 209, 102, 0.35);
  border-color: var(--color-sunshine);
  box-shadow: var(--shadow-glow-yellow);
  transform: scale(1.1);
}

.btn-leitner.practicing.active {
  background: rgba(58, 134, 255, 0.35);
  border-color: var(--color-electric);
  transform: scale(1.1);
}

.btn-leitner.help.active {
  background: rgba(251, 86, 7, 0.35);
  border-color: var(--color-orange);
  transform: scale(1.1);
}

/* ==========================================================================
   SIMULATION: CLOCK FACE STYLES
   ========================================================================== */
.sim-clock-wrapper, .sim-fraction-wrapper, .sim-net-wrapper {
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  padding: 14px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sim-tag {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-sunshine);
  text-transform: uppercase;
}

.angle-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 800;
}

.angle-acute { background: rgba(6, 214, 160, 0.2); color: #06D6A0; border: 1px solid #06D6A0; }
.angle-right { background: rgba(255, 209, 102, 0.2); color: #FFD166; border: 1px solid #FFD166; }
.angle-obtuse { background: rgba(114, 9, 183, 0.25); color: #E2B6FF; border: 1px solid #7209B7; }
.angle-straight { background: rgba(255, 71, 126, 0.25); color: #FF477E; border: 1px solid #FF477E; }

.clock-svg-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.clock-svg {
  width: 190px;
  height: 190px;
  overflow: visible;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

.clock-dial {
  fill: #1e293b;
  stroke: var(--color-sunshine);
  stroke-width: 5;
}

.clock-dial-inner {
  fill: #0f172a;
}

.clock-number {
  fill: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  font-family: var(--font-main);
}

.tick-major {
  stroke: var(--color-sunshine);
  stroke-width: 2.5;
}

.tick-minor {
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1;
}

.angle-sector {
  fill: rgba(255, 209, 102, 0.3);
  stroke: var(--color-sunshine);
  stroke-width: 2;
}

.hand-hour {
  stroke: #FF477E;
  stroke-width: 6;
  stroke-linecap: round;
}

.hand-minute {
  stroke: #4CC9F0;
  stroke-width: 4;
  stroke-linecap: round;
}

.clock-center-cap {
  fill: var(--color-sunshine);
}

.clock-center-pin {
  fill: #0f172a;
}

.clock-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.time-readout {
  font-size: 20px;
  font-weight: 900;
  color: var(--color-sunshine);
  text-align: center;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  align-self: center;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-group label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.slider-group input[type="range"] {
  accent-color: var(--color-sunshine);
  width: 100%;
  cursor: pointer;
}

.quick-angle-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.btn-preset {
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-preset.active {
  background: rgba(255, 209, 102, 0.25);
  border-color: var(--color-sunshine);
  color: var(--color-sunshine);
}

/* ==========================================================================
   SIMULATION: FRACTION PIZZA & GRID
   ========================================================================== */
.mode-toggle {
  display: flex;
  gap: 4px;
}

.btn-mode {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
}

.btn-mode.active {
  background: var(--color-coral);
  border-color: var(--color-coral);
}

.fraction-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
}

.pizza-svg {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
}

.pizza-crust {
  fill: #d97706;
}

.pizza-slice path {
  cursor: pointer;
  stroke: #78350f;
  stroke-width: 2.5;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pizza-slice.shaded path {
  fill: #f59e0b;
}

.pizza-slice.eaten path {
  fill: #334155;
  opacity: 0.6;
}

.topping {
  fill: #ef4444;
  pointer-events: none;
}

.pizza-slice.eaten .topping {
  display: none;
}

.pizza-center {
  fill: #b45309;
}

/* Chocolate Grid Mode */
.chocolate-grid {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: 260px;
  padding: 10px;
  background: #2b1810;
  border: 3px solid #5c3826;
  border-radius: 16px;
}

.grid-cell {
  aspect-ratio: 1;
  background: #503020;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #e28743;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.15), 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.grid-cell.shaded {
  background: linear-gradient(135deg, #FFD166, #FB5607);
  color: #78350f;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
  transform: scale(0.96);
}

.fraction-stats-card {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px;
  border-radius: var(--radius-xl);
  text-align: center;
}

.stat-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.stat-fraction {
  font-size: 17px;
  font-weight: 900;
  color: var(--color-sunshine);
}

.stat-badge {
  font-size: 12px;
  font-weight: 800;
  color: var(--color-teal);
  background: rgba(6, 214, 160, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.stat-badge.alt {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.1);
}

.denom-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.denom-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.denom-btns {
  display: flex;
  gap: 4px;
}

.btn-denom {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.btn-denom.active {
  background: var(--color-sunshine);
  color: #0f172a;
  border-color: var(--color-sunshine);
}

.sim-instruction {
  font-size: 12px;
  text-align: center;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   SIMULATION: 2D/3D FOLDING NET (BOX & SKETCHES)
   ========================================================================== */
.scene-3d-wrap {
  perspective: 800px;
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}

.cube-scene {
  position: relative;
  width: 60px;
  height: 60px;
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

/* Base Face */
.cube-face {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(230, 57, 70, 0.9);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.3);
  transform-style: preserve-3d;
}

.cube-flap {
  position: absolute;
  width: 60px;
  height: 60px;
  background: rgba(230, 57, 70, 0.9);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.3);
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out;
}

/* Flap Positions relative to Base */
.flap-left {
  right: 100%;
  top: 0;
  transform-origin: right center;
  background: rgba(6, 214, 160, 0.9);
}

.flap-right {
  left: 100%;
  top: 0;
  transform-origin: left center;
  background: rgba(255, 209, 102, 0.9);
}

.flap-front {
  top: 100%;
  left: 0;
  transform-origin: center top;
  background: rgba(76, 201, 240, 0.9);
}

.flap-back {
  bottom: 100%;
  left: 0;
  transform-origin: center bottom;
  background: rgba(114, 9, 183, 0.9);
}

/* Top attaches to the Back flap */
.flap-top {
  bottom: 100%;
  left: 0;
  transform-origin: center bottom;
  background: rgba(251, 86, 7, 0.9);
}

.face-text {
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.face-text small {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
}

.net-action-btns {
  display: flex;
  gap: 8px;
}

.btn-net-toggle, .btn-net-rotate {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 800;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
}

.btn-net-toggle:hover {
  background: var(--color-coral);
}

/* ==========================================================================
   TROPHY BACKPACK MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-card {
  width: 100%;
  max-width: 400px;
  background: #1e293b;
  border: 2px solid var(--color-sunshine);
  border-radius: var(--radius-3xl);
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

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

.modal-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--color-sunshine);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  font-size: 18px;
  cursor: pointer;
}

.backpack-coin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid var(--color-sunshine);
  padding: 10px 16px;
  border-radius: var(--radius-xl);
  font-weight: 800;
}

.coin-amount {
  color: var(--color-sunshine);
  font-size: 18px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.badge-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}

.badge-item.unlocked {
  border-color: var(--color-sunshine);
  background: rgba(255, 209, 102, 0.1);
}

.badge-item.locked {
  opacity: 0.5;
  filter: grayscale(1);
}

.badge-icon {
  font-size: 28px;
}

.badge-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}

.badge-desc {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   STREAK MODAL & CELEBRATION STYLES
   ========================================================================== */
.streak-modal-card {
  border-color: #f59e0b !important;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%) !important;
}

.streak-hero-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  text-align: center;
}

.streak-big-flame {
  font-size: 56px;
  animation: flamePulse 1.2s infinite alternate;
  filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.6));
}

.streak-hero-count {
  font-family: var(--font-comic);
  font-size: 46px;
  font-weight: 700;
  color: #fbbf24;
  line-height: 1;
  margin-top: 4px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.streak-hero-label {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 4px;
}

.streak-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-xl);
  font-size: 14px;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.streak-status-bar.at-risk {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.streak-status-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.streak-milestones-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-2xl);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.streak-milestone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--color-sunshine);
}

.streak-best-record {
  color: var(--color-text-muted);
  font-size: 12px;
}

.milestones-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.milestone-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 4px;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  color: var(--color-text-muted);
  transition: all 0.2s ease;
}

.milestone-chip.achieved {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.milestone-chip small {
  font-size: 10px;
  opacity: 0.85;
  margin-top: 2px;
}

.btn-start-streak {
  width: 100%;
  padding: 14px;
  font-family: var(--font-comic);
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  border: 2px solid #fbbf24;
  border-bottom: 4px solid #92400e;
  border-radius: var(--radius-xl);
  color: #1e293b;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-start-streak:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.5);
}

.btn-start-streak:active {
  transform: translateY(2px);
  border-bottom-width: 2px;
}

/* Streak Toast Notification */
.streak-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-full);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 158, 11, 0.4);
  color: #fff;
  font-family: var(--font-comic);
  font-size: 15px;
  font-weight: 700;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.streak-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   NEW ARCHETYPES & MINI WIDGETS
   ========================================================================== */
.card-prompt-text {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.45;
  margin-bottom: 12px;
}

.widget-clock-box, .widget-shape-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 10px 0 14px;
  background: rgba(15, 23, 42, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-2xl);
  padding: 12px;
}

.mini-clock-svg {
  width: 140px;
  height: 140px;
}

.mini-clock-dial {
  fill: #1e293b;
  stroke: var(--color-sunshine);
  stroke-width: 4;
}

.mini-clock-dial-inner {
  fill: #0f172a;
}

.mini-clock-num {
  fill: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}

.mini-hand-hour {
  stroke: #ff477e;
  stroke-width: 5;
  stroke-linecap: round;
}

.mini-hand-minute {
  stroke: #4cc9f0;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.mini-clock-pin {
  fill: var(--color-sunshine);
}

.mini-clock-time {
  font-family: monospace;
  font-size: 17px;
  font-weight: 900;
  color: var(--color-sunshine);
  margin-top: 6px;
  background: rgba(0,0,0,0.4);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.mini-shape-svg {
  width: 140px;
  height: 140px;
}

.shape-line {
  stroke: #4cc9f0;
  stroke-width: 5;
  stroke-linecap: round;
}

.shape-right-square {
  fill: rgba(255, 209, 102, 0.25);
  stroke: var(--color-sunshine);
  stroke-width: 2.5;
}

.shape-arc {
  fill: none;
  stroke: var(--color-coral);
  stroke-width: 3;
}

.shape-vertex {
  fill: var(--color-sunshine);
}

.shape-text {
  fill: var(--color-sunshine);
  font-size: 16px;
  font-weight: 900;
}

/* Archetype: True / False */
.tf-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.btn-tf {
  padding: 18px 12px;
  font-size: 20px;
  font-weight: 900;
  border-radius: var(--radius-2xl);
  border: 3px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.tf-icon {
  font-size: 28px;
}

/* Archetype: Visual Sorter */
.sorter-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.sorter-items-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.sorter-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 800;
  color: #ffd166;
}

.sorter-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sorter-btn-row {
  display: grid;
  gap: 8px;
}

.btn-sorter {
  padding: 14px 6px;
  font-size: 15px;
  font-weight: 900;
  border-radius: var(--radius-xl);
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #fff;
}

.btn-sorter.btn-bucket-0, .btn-sorter.btn-acute {
  background: rgba(6, 214, 160, 0.15);
  border-color: rgba(6, 214, 160, 0.4);
}

.btn-sorter.btn-bucket-1, .btn-sorter.btn-right {
  background: rgba(255, 209, 102, 0.15);
  border-color: rgba(255, 209, 102, 0.4);
}

.btn-sorter.btn-bucket-2, .btn-sorter.btn-obtuse {
  background: rgba(114, 9, 183, 0.2);
  border-color: rgba(114, 9, 183, 0.5);
}

/* Archetype: Spot Error */
.monster-callout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(114, 9, 183, 0.25);
  border: 2px solid rgba(114, 9, 183, 0.5);
  border-radius: var(--radius-xl);
  padding: 8px 12px;
  margin-bottom: 10px;
}

.spot-error-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.step-line {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid #38bdf8;
  border-radius: 8px;
  font-size: 15px;
  color: #e2e8f0;
}

.step-line.has-error {
  border-left-color: #ff477e;
  background: rgba(255, 71, 126, 0.12);
}

.monster-avatar {
  font-size: 24px;
}

.monster-tag {
  font-size: 14px;
  font-weight: 800;
  color: #e2b6ff;
}

/* ==========================================================================
   FANCY INTERACTIVE QUIZ & MCQ ARCHETYPE STYLES (3D Gamified Arcade)
   ========================================================================== */
.archetype-box {
  width: 100%;
  margin-top: 14px;
}

.chip-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* 3D Tactile MCQ Option Button */
.btn-card-action.chip-opt {
  position: relative;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #1e293b 0%, #131c2e 100%);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-bottom: 5px solid #090e18;
  border-radius: 20px;
  color: #F8FAFC;
  font-family: var(--font-main);
  font-size: 16.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  text-align: left;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Subtle Shimmer Sheen */
.btn-card-action.chip-opt::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 18px 18px 0 0;
  pointer-events: none;
}

/* Hover & Focus */
.btn-card-action.chip-opt:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, #25334a 0%, #172237 100%);
  border-color: rgba(255, 209, 102, 0.6);
  border-bottom: 5px solid #b45309;
  box-shadow: 0 10px 24px rgba(255, 209, 102, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Mechanical Button Press */
.btn-card-action.chip-opt:active {
  transform: translateY(3px);
  border-bottom: 2px solid #090e18;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* 3D Option Letter Badge (A, B, C, D) */
.mcq-badge {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-comic);
  font-size: 17px;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mcq-badge.badge-a {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-bottom: 3.5px solid #0369a1;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(56, 189, 248, 0.35);
}

.mcq-badge.badge-b {
  background: linear-gradient(180deg, #c084fc 0%, #9333ea 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-bottom: 3.5px solid #7e22ce;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(192, 132, 252, 0.35);
}

.mcq-badge.badge-c {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-bottom: 3.5px solid #b45309;
  color: #1e293b;
  text-shadow: none;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(251, 191, 36, 0.35);
}

.mcq-badge.badge-d {
  background: linear-gradient(180deg, #34d399 0%, #059669 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-bottom: 3.5px solid #047857;
  color: #022c22;
  text-shadow: none;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(52, 211, 153, 0.35);
}

/* Option Text */
.mcq-text {
  flex: 1;
  min-width: 0;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.4;
  color: #F8FAFC;
  position: relative;
  z-index: 1;
  letter-spacing: 0.2px;
}

/* Status Icon (Checkmark / Cross Indicator) */
.mcq-status-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: transparent;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-card-action.chip-opt:hover .mcq-status-icon {
  border-color: rgba(255, 209, 102, 0.5);
  background: rgba(255, 209, 102, 0.1);
}

/* Correct Answer State */
.btn-card-action.chip-opt.correct {
  background: linear-gradient(180deg, #065f46 0%, #022c22 100%) !important;
  border: 2px solid #10b981 !important;
  border-bottom: 5px solid #047857 !important;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  animation: popCorrect 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-card-action.chip-opt.correct .mcq-badge {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%) !important;
  color: #ffffff !important;
  border-color: #fff !important;
  border-bottom: 3.5px solid #047857 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.8) !important;
}

.btn-card-action.chip-opt.correct .mcq-text {
  color: #ffffff !important;
  font-weight: 800;
}

.btn-card-action.chip-opt.correct .mcq-status-icon {
  border-color: #34d399 !important;
  background: #10b981 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.9) !important;
  transform: scale(1.08);
}

/* Wrong Answer State */
.btn-card-action.chip-opt.wrong {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%) !important;
  border: 2px solid #ef4444 !important;
  border-bottom: 5px solid #7f1d1d !important;
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  animation: shakeWrong 0.42s ease-in-out;
}

.btn-card-action.chip-opt.wrong .mcq-badge {
  background: linear-gradient(180deg, #f87171 0%, #ef4444 100%) !important;
  color: #ffffff !important;
  border-color: #fff !important;
  border-bottom: 3.5px solid #991b1b !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.8) !important;
}

.btn-card-action.chip-opt.wrong .mcq-text {
  color: #ffffff !important;
  font-weight: 800;
}

.btn-card-action.chip-opt.wrong .mcq-status-icon {
  border-color: #f87171 !important;
  background: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.9) !important;
  transform: scale(1.08);
}

/* True / False 3D Arcade Buttons */
.tf-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 10px;
}

.btn-tf {
  position: relative;
  min-height: 68px;
  padding: 14px 16px;
  font-family: var(--font-comic);
  font-size: 19px;
  font-weight: 700;
  border-radius: 22px;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-tf-true {
  background: linear-gradient(180deg, rgba(6, 214, 160, 0.2) 0%, rgba(5, 150, 105, 0.35) 100%);
  border: 2px solid #06d6a0;
  border-bottom: 5px solid #047857;
}

.btn-tf-true:hover {
  background: linear-gradient(180deg, rgba(6, 214, 160, 0.3) 0%, rgba(5, 150, 105, 0.5) 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(6, 214, 160, 0.35);
}

.btn-tf-false {
  background: linear-gradient(180deg, rgba(255, 71, 126, 0.2) 0%, rgba(225, 29, 72, 0.35) 100%);
  border: 2px solid #ff477e;
  border-bottom: 5px solid #9f1239;
}

.btn-tf-false:hover {
  background: linear-gradient(180deg, rgba(255, 71, 126, 0.3) 0%, rgba(225, 29, 72, 0.5) 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(255, 71, 126, 0.35);
}

.btn-tf:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-tf.correct {
  background: linear-gradient(180deg, #065f46 0%, #022c22 100%) !important;
  border: 2px solid #10b981 !important;
  border-bottom: 5px solid #047857 !important;
  box-shadow: 0 0 28px rgba(16, 185, 129, 0.6) !important;
  animation: popCorrect 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-tf.wrong {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%) !important;
  border: 2px solid #ef4444 !important;
  border-bottom: 5px solid #7f1d1d !important;
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.6) !important;
  animation: shakeWrong 0.42s ease-in-out;
}

.tf-status-icon {
  font-size: 19px;
  font-weight: 900;
  margin-left: 2px;
}

/* Sorter Bucket 3D Buttons */
.sorter-bucket-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
}

.btn-sorter {
  min-height: 58px;
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 15.5px;
  font-weight: 800;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-bottom: 5px solid #090e18;
  background: linear-gradient(180deg, #1e293b 0%, #131c2e 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.2s ease,
              border-color 0.2s ease;
}

.btn-sorter:hover {
  transform: translateY(-2px);
  border-color: var(--color-sunshine);
  border-bottom: 5px solid #b45309;
  box-shadow: 0 10px 22px rgba(255, 209, 102, 0.22);
}

.btn-sorter:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.btn-sorter.correct {
  background: linear-gradient(180deg, #065f46 0%, #022c22 100%) !important;
  border-color: #10b981 !important;
  border-bottom: 5px solid #047857 !important;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.55) !important;
  animation: popCorrect 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-sorter.wrong {
  background: linear-gradient(180deg, #991b1b 0%, #450a0a 100%) !important;
  border-color: #ef4444 !important;
  border-bottom: 5px solid #7f1d1d !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.55) !important;
  animation: shakeWrong 0.42s ease-in-out;
}

.quiz-feedback {
  display: none;
  margin-top: 14px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid rgba(255, 209, 102, 0.5);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  color: #F1F5F9;
  font-size: 15px;
  line-height: 1.55;
  animation: feedbackSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-feedback.show {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feedback-bulb {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px #FFD166);
}

.feedback-body {
  flex: 1;
  text-align: left;
}

@keyframes popCorrect {
  0% { transform: scale(0.96); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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


/* ==========================================================================
   GLOBAL UTILITIES & VIEW TOGGLING
   ========================================================================== */
.hidden {
  display: none !important;
}

/* Base Player View Container */
.player-view {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b1120;
}

/* Top HUD Home Button */
.hud-btn-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}

.hud-btn-home:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

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

/* ==========================================================================
   HOME HUB / FRONT PAGE
   ========================================================================== */
.home-hub-view {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0b1120;
  z-index: 10;
}

/* Hub Header */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(11, 17, 32, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  z-index: 30;
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  animation: floatRocket 3s ease-in-out infinite;
  object-fit: cover;
  flex-shrink: 0;
}

.hub-logo-icon {
  font-size: 26px;
  animation: floatRocket 3s ease-in-out infinite;
}

@keyframes floatRocket {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(4deg); }
}

.hub-brand-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hub-brand-title {
  font-family: var(--font-comic);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.hub-badge-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(67, 97, 238, 0.25);
  color: #4CC9F0;
  border: 1px solid rgba(76, 201, 240, 0.4);
}

.hub-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PWA Install Button */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #06D6A0, #05B284);
  color: #032b1e;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(6, 214, 160, 0.45);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: pulseInstall 2.5s infinite;
}

@keyframes pulseInstall {
  0%, 100% { box-shadow: 0 0 12px rgba(6, 214, 160, 0.4); }
  50% { box-shadow: 0 0 22px rgba(6, 214, 160, 0.85); }
}

.pwa-install-btn:hover {
  transform: translateY(-1px) scale(1.03);
}

.pwa-install-btn:active {
  transform: scale(0.96);
}

/* Hub Scroll Body */
.hub-scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

/* Hero Section */
.hub-hero {
  position: relative;
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-2xl);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.5);
}

.hero-top-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-sunshine);
  background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.35);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.pulse-sparkle {
  display: inline-block;
  animation: sparkleRotate 2s ease-in-out infinite;
}

@keyframes sparkleRotate {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(15deg); }
}

.hub-hero-title {
  font-family: var(--font-comic);
  font-size: 27px;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.gradient-text {
  background: linear-gradient(135deg, #FFD166 0%, #FF477E 50%, #4CC9F0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hub-hero-sub {
  font-size: 14px;
  line-height: 1.55;
  color: #94A3B8;
  max-width: 440px;
}

/* Primary Hero CTA Button */
.hero-cta-wrap {
  width: 100%;
  margin-top: 4px;
}

.btn-hero-cta {
  width: 100%;
  background: linear-gradient(135deg, #4361EE 0%, #7209B7 60%, #F72585 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-xl);
  padding: 12px 18px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(67, 97, 238, 0.45);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(67, 97, 238, 0.6);
}

.btn-hero-cta:active {
  transform: scale(0.97);
}

.cta-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #FFD166;
  flex-shrink: 0;
}

.cta-text-group {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1;
  margin-left: 12px;
}

.cta-sub {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.8);
}

.cta-main {
  font-family: var(--font-comic);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta-arrow {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-sunshine);
}

/* Overall Stats Row */
.hero-stats-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.stat-number {
  font-family: var(--font-comic);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-sunshine);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   INSTRUCTIONS SECTION
   ========================================================================== */
.section-title-wrap {
  margin-bottom: 12px;
  text-align: left;
}

.title-with-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-heading {
  font-family: var(--font-comic);
  font-size: 19px;
  font-weight: 700;
  color: #fff;
}

.section-subtext {
  font-size: 12px;
  color: #94A3B8;
  margin-top: 2px;
}

.instructions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instruction-card {
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-xl);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.instruction-card:hover {
  transform: translateX(3px);
  border-color: rgba(255, 255, 255, 0.18);
}

.instruction-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.instruction-icon-box.step-1 {
  background: rgba(67, 97, 238, 0.2);
  border: 1px solid rgba(67, 97, 238, 0.4);
}

.instruction-icon-box.step-2 {
  background: rgba(255, 71, 126, 0.2);
  border: 1px solid rgba(255, 71, 126, 0.4);
}

.instruction-icon-box.step-3 {
  background: rgba(255, 209, 102, 0.2);
  border: 1px solid rgba(255, 209, 102, 0.4);
}

.instruction-icon-box.step-4 {
  background: rgba(6, 214, 160, 0.2);
  border: 1px solid rgba(6, 214, 160, 0.4);
}

.instruction-content {
  flex: 1;
  text-align: left;
}

.instruction-step-num {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-sunshine);
}

.instruction-title {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  margin: 1px 0 2px;
}

.instruction-desc {
  font-size: 12px;
  color: #94A3B8;
  line-height: 1.4;
}

/* ==========================================================================
   14 CHAPTERS SECTION
   ========================================================================== */
.chapters-pill-count {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: #E2E8F0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.chapters-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hub-chapter-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.hub-chapter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--ch-accent, var(--color-sunshine));
}

.hub-chapter-card:hover {
  transform: translateY(-2px) scale(1.01);
  border-color: var(--ch-accent, var(--color-sunshine));
  box-shadow: 0 10px 24px -5px rgba(0, 0, 0, 0.4);
}

.hub-chapter-card:active {
  transform: scale(0.98);
}

.hub-ch-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.hub-ch-details {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.hub-ch-num-tag {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ch-accent, #4CC9F0);
}

.hub-ch-title {
  font-family: var(--font-comic);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 1px 0 3px;
}

.hub-ch-tagline {
  font-size: 11px;
  color: #94A3B8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.hub-ch-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-ch-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.hub-ch-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--ch-accent, var(--color-teal));
  transition: width 0.3s ease;
}

.hub-ch-progress-text {
  font-size: 10px;
  font-weight: 800;
  color: #CBD5E1;
}

.hub-ch-play-arrow {
  font-size: 16px;
  color: var(--ch-accent, var(--color-sunshine));
  padding-left: 4px;
}

/* ==========================================================================
   HUB FOOTER
   ========================================================================== */
.hub-footer {
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.footer-pill {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.footer-text {
  font-size: 11px;
  color: #64748B;
  line-height: 1.6;
}

.footer-link {
  color: var(--color-sky);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   MODAL EXTENSIONS: RESET PROGRESS
   ========================================================================== */
.modal-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--color-sunshine);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 14px 0 8px;
  text-align: left;
}

.backpack-progress-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 12px;
}

.backpack-ch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
}

.backpack-footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.btn-reset-progress {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #F87171;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-progress:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #EF4444;
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE-FIRST TO TABLET/DESKTOP)
   ========================================================================== */
@media (min-width: 600px) {
  .app-container {
    max-width: 580px;
  }

  .instructions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .hub-hero-title {
    font-size: 32px;
  }
}

