/* ============================================================
   AI/ML Quest — Design System
   "The Linear Look" + Spatial Depth
   Inspired by Linear, Vercel, Raycast, Stripe
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* ---- Design Tokens ---- */
:root {
  /* Base */
  --void: #0a0a0f;
  --card-bg: #141422;
  --card-bg-hover: #1a1a30;
  --surface: #111120;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Chapter Accents */
  --rag: #3b82f6;
  --slm: #8b5cf6;
  --monitoring: #10b981;
  --finetuning: #f59e0b;
  --multimodal: #ef4444;
  --capstone: #ec4899;
  --accent: #3b82f6; /* default, overridden per chapter */

  /* Text */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Semantic */
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Spacing */
  --gap: 1.25rem;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Typography */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

/* Chapter-specific accent overrides */
[data-chapter="1"] {
  --accent: var(--rag);
}
[data-chapter="2"] {
  --accent: var(--slm);
}
[data-chapter="3"] {
  --accent: var(--monitoring);
}
[data-chapter="4"] {
  --accent: var(--finetuning);
}
[data-chapter="5"] {
  --accent: var(--multimodal);
}
[data-chapter="6"] {
  --accent: var(--capstone);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--void);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  /* Dot grid pattern */
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px
  );
  background-size: 24px 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ---- Typography ---- */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}
h1 {
  font-size: 2rem;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.5rem;
  letter-spacing: -0.015em;
}
h3 {
  font-size: 1.125rem;
}
h4 {
  font-size: 1rem;
}

.mono,
code,
pre {
  font-family: var(--font-mono);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-muted {
  color: var(--text-muted);
}
.text-accent {
  color: var(--accent);
}

/* ---- Layout ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---- Particle Canvas ---- */
#particle-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ---- HUD / Top Bar ---- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.hud-logo {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.hud-logo span {
  color: var(--accent);
}
.hud-level {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.hud-xp-wrap {
  flex: 1;
  max-width: 220px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hud-xp-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.hud-xp-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--accent);
}
.hud-xp-text {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}
.hud-streak,
.hud-combo {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.hud-combo.active {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
  animation: pulse-glow 1.5s ease infinite;
}
.hud-sound {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.2rem;
}

/* Spacer for fixed HUD */
.page-content {
  padding-top: 3.5rem;
}

/* ---- Bento Grid (Hub) ---- */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
  padding: 2rem 0;
}

.chapter-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
  overflow: hidden;
}
.chapter-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    transparent 40%,
    rgba(var(--accent-rgb, 59, 130, 246), 0.04)
  );
  pointer-events: none;
}
.chapter-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    transparent 40%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 60%
  );
  transform: rotate(-45deg) translateY(-100%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.chapter-card:hover::after {
  transform: rotate(-45deg) translateY(0);
}
.chapter-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--border-hover);
}
.chapter-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.chapter-card.locked:hover {
  transform: none;
}

.card-chapter-num {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.card-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.card-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  margin-top: 1rem;
  overflow: hidden;
}
.card-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.card-lock-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.1rem;
  opacity: 0.5;
}

/* Per-chapter card accent colors */
.chapter-card[data-ch="1"] .card-progress-fill {
  background: var(--rag);
}
.chapter-card[data-ch="2"] .card-progress-fill {
  background: var(--slm);
}
.chapter-card[data-ch="3"] .card-progress-fill {
  background: var(--monitoring);
}
.chapter-card[data-ch="4"] .card-progress-fill {
  background: var(--finetuning);
}
.chapter-card[data-ch="5"] .card-progress-fill {
  background: var(--multimodal);
}
.chapter-card[data-ch="6"] .card-progress-fill {
  background: var(--capstone);
}
.chapter-card[data-ch="1"]:hover {
  border-color: rgba(59, 130, 246, 0.25);
}
.chapter-card[data-ch="2"]:hover {
  border-color: rgba(139, 92, 246, 0.25);
}
.chapter-card[data-ch="3"]:hover {
  border-color: rgba(16, 185, 129, 0.25);
}
.chapter-card[data-ch="4"]:hover {
  border-color: rgba(245, 158, 11, 0.25);
}
.chapter-card[data-ch="5"]:hover {
  border-color: rgba(239, 68, 68, 0.25);
}
.chapter-card[data-ch="6"]:hover {
  border-color: rgba(236, 72, 153, 0.25);
}

/* ---- Game Panel (Frosted Glass) ---- */
.game-panel {
  max-width: 900px;
  margin: 2rem auto;
  background: rgba(20, 20, 34, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  animation: fade-in-up 0.4s ease;
}

/* ---- Level Header ---- */
.level-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.level-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.level-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0.25rem 0 0.4rem;
}
.level-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---- Typewriter ---- */
.typewriter-container {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
  margin-bottom: 1.5rem;
  min-height: 3rem;
}
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

/* ---- Game: Architecture Battle / Option Cards ---- */
.scenario-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}
.option-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}
.option-card:hover {
  border-color: var(--border-hover);
  background: var(--card-bg-hover);
}
.option-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
}
.option-card.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.08);
}
.option-card.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.08);
  animation: shake 0.4s ease;
}
.option-card .option-label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.option-card .option-desc {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ---- Game: Speed Quiz ---- */
.quiz-question {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.quiz-option {
  padding: 0.85rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  text-align: left;
}
.quiz-option:hover {
  background: var(--card-bg-hover);
  border-color: var(--border-hover);
}
.quiz-option.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}
.quiz-option.wrong {
  border-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
  animation: shake 0.4s ease;
}
.quiz-option .opt-key {
  display: inline-block;
  width: 1.4rem;
  height: 1.4rem;
  line-height: 1.4rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  margin-right: 0.5rem;
  font-family: var(--font-mono);
}

/* Timer bar */
.timer-bar-wrap {
  height: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.timer-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.1s linear;
}
.timer-bar.urgent {
  background: var(--error);
}

/* ---- Game: Concept Matcher ---- */
.matcher-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.matcher-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.matcher-item {
  padding: 0.75rem 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}
.matcher-item:hover {
  border-color: var(--border-hover);
}
.matcher-item.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}
.matcher-item.matched {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.06);
  opacity: 0.7;
  cursor: default;
}
.matcher-item.wrong {
  animation: shake 0.4s ease;
}

/* ---- Game: Parameter Tuner ---- */
.tuner-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.tuner-slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.tuner-slider-group label span {
  font-family: var(--font-mono);
  color: var(--accent);
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent);
}
.gauges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}
.gauge-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}
.gauge-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}
.gauge-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}
.gauge-card.good .gauge-value {
  color: var(--success);
}
.gauge-card.bad .gauge-value {
  color: var(--error);
}

/* ---- Game: Code Debugger ---- */
.code-block {
  background: #0d0d1a;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
}
.code-line {
  display: flex;
  padding: 0 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.code-line:hover {
  background: rgba(255, 255, 255, 0.03);
}
.code-line.selected {
  background: rgba(239, 68, 68, 0.1);
  border-left: 2px solid var(--error);
}
.code-line.found-bug {
  background: rgba(34, 197, 94, 0.1);
  border-left: 2px solid var(--success);
}
.code-line-num {
  width: 3rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 1rem;
  user-select: none;
  flex-shrink: 0;
}
.code-line-content {
  flex: 1;
}
/* Syntax-like coloring */
.syn-kw {
  color: #c678dd;
}
.syn-str {
  color: #98c379;
}
.syn-num {
  color: #d19a66;
}
.syn-fn {
  color: #61afef;
}
.syn-cm {
  color: #5c6370;
  font-style: italic;
}
.syn-op {
  color: #56b6c2;
}

/* ---- Game: Pipeline Builder ---- */
.pipeline-available {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.pipeline-chip {
  padding: 0.5rem 0.9rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pipeline-chip:hover {
  border-color: var(--accent);
}
.pipeline-chip.used {
  opacity: 0.3;
  pointer-events: none;
}
.pipeline-slots {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pipeline-slot {
  min-width: 100px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pipeline-slot.filled {
  border-style: solid;
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(59, 130, 246, 0.06);
}
.pipeline-slot.correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.06);
}
.pipeline-slot.wrong {
  border-color: var(--error);
  animation: shake 0.4s ease;
}
.pipeline-arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* ---- Game: Diagnosis Lab ---- */
.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}
.metric-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
}
.metric-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric-card.alert .metric-value {
  color: var(--error);
}
.metric-card.warn .metric-value {
  color: var(--warning);
}
.metric-card.ok .metric-value {
  color: var(--success);
}

/* ---- Game: Cost Optimizer ---- */
.cost-display {
  text-align: center;
  margin: 1rem 0;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.cost-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
}
.cost-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cost-budget {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.cost-value.over-budget {
  color: var(--error);
}
.cost-value.under-budget {
  color: var(--success);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
}
.btn-ghost:hover {
  color: var(--text-primary);
}

/* ---- Explanation / Result Panel ---- */
.explanation-panel {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  animation: fade-in-up 0.3s ease;
}
.explanation-panel h4 {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.explanation-panel p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- Result Summary ---- */
.result-summary {
  text-align: center;
  padding: 2rem;
  animation: fade-in-up 0.4s ease;
}
.result-score {
  font-family: var(--font-mono);
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
}
.result-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}
.result-xp {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--success);
  margin-bottom: 1.5rem;
}

/* ---- Achievement Toast ---- */
.toast-container {
  position: fixed;
  top: 4rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: rgba(20, 20, 34, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slide-in 0.3s ease;
  min-width: 240px;
}
.toast-icon {
  font-size: 1.3rem;
}
.toast-text .toast-title {
  font-weight: 600;
  font-size: 0.85rem;
}
.toast-text .toast-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* ---- Chapter Navigation (sidebar for chapter pages) ---- */
.chapter-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 2rem 0;
}
.level-nav {
  position: sticky;
  top: 4rem;
  height: fit-content;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}
.level-nav-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.level-nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.level-nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.level-nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}
.level-nav-item.completed {
  color: var(--success);
}
.level-nav-item.locked {
  opacity: 0.35;
  cursor: not-allowed;
}
.level-nav-item .nav-icon {
  width: 1rem;
  text-align: center;
  font-size: 0.7rem;
}

/* ---- Key Insight Box ---- */
.key-insight {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(var(--accent-rgb, 59, 130, 246), 0.06);
  border: 1px solid rgba(var(--accent-rgb, 59, 130, 246), 0.15);
  border-radius: var(--radius-sm);
}
.key-insight strong {
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.key-insight p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
}

/* ---- Utility ---- */
.hidden {
  display: none !important;
}
.glass {
  background: rgba(20, 20, 34, 0.6);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
}
.glow {
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.15);
}
.fade-in {
  animation: fade-in-up 0.4s ease;
}

/* ---- Animations ---- */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.15);
  }
  50% {
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.3);
  }
}
@keyframes timer-deplete {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}
@keyframes counter-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
  }
  .chapter-layout {
    grid-template-columns: 1fr;
  }
  .level-nav {
    position: static;
    display: flex;
    overflow-x: auto;
    gap: 0.25rem;
    padding-bottom: 0.5rem;
  }
  .level-nav-item {
    white-space: nowrap;
  }
  .quiz-options {
    grid-template-columns: 1fr;
  }
  .options-grid {
    grid-template-columns: 1fr;
  }
  .matcher-columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hud {
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }
  .hud-xp-wrap {
    max-width: 120px;
  }
  .game-panel {
    padding: 1.25rem;
    margin: 1rem 0.5rem;
  }
  h1 {
    font-size: 1.5rem;
  }
}
@media (max-width: 480px) {
  .pipeline-slots {
    flex-direction: column;
  }
  .pipeline-arrow {
    transform: rotate(90deg);
  }
  .gauges-grid {
    grid-template-columns: 1fr 1fr;
  }
}
