:root {
  --bg: #0b1020;
  --text: #eef2ff;
  --muted: #94a3b8;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #a78bfa;
  --blue: #60a5fa;
  --green: #34d399;
  --amber: #fbbf24;
  --pink: #f472b6;
  --red: #f87171;
  --cyan: #22d3ee;
}

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

body {
  font-family: "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(1100px 560px at 8% -12%, rgba(167, 139, 250, 0.18), transparent 50%),
    radial-gradient(900px 480px at 92% 0%, rgba(96, 165, 250, 0.14), transparent 45%),
    radial-gradient(700px 360px at 50% 100%, rgba(52, 211, 153, 0.1), transparent 40%),
    radial-gradient(600px 400px at 70% 60%, rgba(244, 114, 182, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(167,139,250,0.5), transparent),
    radial-gradient(1.2px 1.2px at 40% 80%, rgba(96,165,250,0.4), transparent),
    radial-gradient(1px 1px at 85% 20%, rgba(52,211,153,0.35), transparent),
    radial-gradient(1px 1px at 10% 70%, rgba(251,191,36,0.3), transparent);
  background-size: 100% 100%;
  opacity: 0.55;
  animation: star-drift 40s linear infinite;
}

@keyframes star-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-40px); }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-block;
  margin-bottom: 10px;
}
.back:hover { color: var(--accent); }

.badge {
  display: inline-flex;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 12px;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 span {
  background: linear-gradient(135deg, #fbbf24, #f472b6 40%, #60a5fa 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle { color: var(--muted); margin-top: 8px; font-size: 1rem; }

/* Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 20px;
  padding: 6px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 16px;
  position: sticky;
  top: 10px;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.tab {
  flex: 1 1 auto;
  min-width: 96px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.86rem;
  border: none;
  border-radius: 12px;
  padding: 11px 10px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all 0.2s ease;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.tab.active {
  background: linear-gradient(135deg, rgba(167,139,250,0.25), rgba(96,165,250,0.18));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(167,139,250,0.4);
}
.tab .num {
  display: inline-block;
  width: 20px; height: 20px;
  line-height: 20px;
  border-radius: 50%;
  font-size: 11px;
  margin-right: 4px;
  background: rgba(255,255,255,0.08);
  text-align: center;
}
.tab.active .num { background: var(--accent); color: #0b1020; }

.section { display: none; animation: fadeIn 0.3s ease; }
.section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card h2 .icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: rgba(167, 139, 250, 0.15);
  flex-shrink: 0;
}

.card h3 {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 10px;
  color: #e2e8f0;
}

.card p, .card li { color: #cbd5e1; font-size: 0.98rem; }
.card p + p { margin-top: 10px; }
.card ul, .card ol { padding-left: 1.3em; margin: 8px 0; }
.card li { margin: 6px 0; }

.hl {
  color: var(--amber);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}
.ok { color: var(--green); font-weight: 700; }
.blue { color: var(--blue); font-weight: 700; }

.callout {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
}
.callout .t {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.callout.green { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.08); }
.callout.green .t { color: var(--green); }
.callout.purple { border-color: rgba(167,139,250,0.3); background: rgba(167,139,250,0.08); }
.callout.purple .t { color: var(--accent); }
.callout.amber { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.08); }
.callout.amber .t { color: var(--amber); }
.callout.blue { border-color: rgba(96,165,250,0.3); background: rgba(96,165,250,0.08); }
.callout.blue .t { color: var(--blue); }

.formula {
  font-family: "JetBrains Mono", monospace;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.95rem;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre-wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

.mini {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.mini h4 { font-size: 0.92rem; margin-bottom: 8px; color: var(--blue); }

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.btn {
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-sm { padding: 8px 14px; font-size: 0.88rem; border-radius: 10px; }

/* ═══════════ Cinematic Board Animation ═══════════ */
.anim-panel { padding: 4px 0 0; }

.anim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.speed {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
}
.speed input { accent-color: var(--accent); width: 80px; }

.btn-primary {
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.25) 50%, transparent 60%);
  transform: translateX(-120%);
  transition: none;
}
.btn-primary:hover::after {
  animation: btn-shine 0.7s ease;
}
@keyframes btn-shine {
  to { transform: translateX(120%); }
}

/* Progress */
.progress {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
.progress > i, .progress .prog {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #60a5fa, #34d399, #fbbf24);
  background-size: 200% 100%;
  border-radius: inherit;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  animation: prog-flow 2.5s linear infinite;
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.6);
}
@keyframes prog-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* Stage */
.board {
  min-height: 340px;
  border-radius: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(167, 139, 250, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 80% 100%, rgba(52, 211, 153, 0.1), transparent 50%),
    radial-gradient(ellipse 40% 50% at 10% 80%, rgba(96, 165, 250, 0.12), transparent 50%),
    linear-gradient(180deg, #121a33 0%, #0a0f1e 100%);
  border: 1px solid rgba(167, 139, 250, 0.25);
  padding: 24px 22px 28px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 80px rgba(99, 102, 241, 0.08);
}

.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 31px,
      rgba(255,255,255,0.025) 31px,
      rgba(255,255,255,0.025) 32px
    );
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 90%);
}

.board-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.board-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.45;
  animation: orb-float 8s ease-in-out infinite;
}
.board-orb.o1 {
  width: 160px; height: 160px;
  background: #8b5cf6;
  top: -40px; left: -30px;
}
.board-orb.o2 {
  width: 120px; height: 120px;
  background: #06b6d4;
  bottom: -30px; right: 10%;
  animation-delay: -3s;
}
.board-orb.o3 {
  width: 100px; height: 100px;
  background: #f472b6;
  top: 40%; right: -20px;
  animation-delay: -5s;
}
@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, 15px) scale(1.12); }
}

.board-content {
  position: relative;
  z-index: 2;
  min-height: 280px;
}

.board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 14px;
  color: var(--muted);
  text-align: center;
}
.board-empty .pulse-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139,92,246,0.3), rgba(96,165,250,0.25));
  border: 2px solid rgba(167,139,250,0.5);
  display: grid;
  place-items: center;
  font-size: 28px;
  animation: pulse-ring 2s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.35);
}
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(139,92,246,0.3); }
  50% { transform: scale(1.08); box-shadow: 0 0 40px rgba(139,92,246,0.55); }
}
.board-empty p {
  font-size: 0.95rem;
  max-width: 280px;
  line-height: 1.5;
}
.board-empty kbd {
  font-family: inherit;
  background: rgba(167,139,250,0.2);
  border: 1px solid rgba(167,139,250,0.4);
  border-radius: 8px;
  padding: 2px 10px;
  color: #c4b5fd;
  font-weight: 700;
}

/* Formula / text lines */
.board-line {
  font-family: "JetBrains Mono", monospace;
  font-size: 1.08rem;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  filter: blur(4px);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1),
    filter 0.4s ease,
    box-shadow 0.4s ease;
  color: #e2e8f0;
  margin: 8px 0;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
  display: block;
}
.board-line.show {
  opacity: 1;
  transform: none;
  filter: none;
}
.board-line.hl-line {
  color: #fde68a;
  font-weight: 700;
  background: linear-gradient(90deg, rgba(251,191,36,0.15), rgba(251,191,36,0.04));
  border-color: rgba(251,191,36,0.35);
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.15), inset 0 0 20px rgba(251,191,36,0.05);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}
.board-line.ok-line {
  color: #6ee7b7;
  font-weight: 700;
  background: linear-gradient(90deg, rgba(52,211,153,0.18), rgba(52,211,153,0.05));
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 28px rgba(52, 211, 153, 0.25);
  text-shadow: 0 0 18px rgba(52, 211, 153, 0.5);
  animation: ok-pop 0.55s cubic-bezier(0.34, 1.5, 0.64, 1);
}
@keyframes ok-pop {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.board-line.title-line {
  color: #ddd6fe;
  font-weight: 800;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 1.12rem;
  margin-bottom: 10px;
  background: linear-gradient(90deg, rgba(167,139,250,0.2), transparent);
  border-left: 3px solid #a78bfa;
  border-radius: 4px 12px 12px 4px;
  letter-spacing: 0.02em;
}

/* Bars — glass / neon */
.visual-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  justify-content: center;
  margin: 18px 0 8px;
  min-height: 140px;
  padding: 12px 8px 0;
  border-bottom: 2px solid rgba(255,255,255,0.08);
  position: relative;
}
.visual-row::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,0.5), transparent);
}

.bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px) scale(0.5);
}
.bar-wrap.show,
.bar-wrap.pop-in {
  opacity: 1;
  transform: none;
  animation: pop-in 0.45s cubic-bezier(0.34, 1.5, 0.64, 1) both;
}
.bar {
  width: 56px;
  border-radius: 12px 12px 6px 6px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 800;
  color: white;
  padding-bottom: 10px;
  position: relative;
  overflow: hidden;
  transform-origin: bottom;
  box-shadow:
    0 8px 24px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.35);
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.bar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent);
  border-radius: inherit;
}
.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: bar-shine 2.2s ease-in-out infinite;
}
@keyframes bar-shine {
  0%, 60% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.bar-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.bar-wrap.hl .bar {
  box-shadow: 0 0 28px rgba(251, 191, 36, 0.55), 0 8px 24px rgba(0,0,0,0.35);
}
.bar-wrap.hl .bar-label { color: var(--amber); }

/* Track — cinematic road */
.track-stage {
  margin: 16px 0 8px;
  padding: 8px 4px 4px;
}
.track {
  position: relative;
  height: 110px;
  margin: 10px 4px 0;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(15,23,42,0.2), rgba(15,23,42,0.6)),
    repeating-linear-gradient(
      90deg,
      #1e293b 0px,
      #1e293b 24px,
      #334155 24px,
      #334155 48px
    );
  border: 1px solid rgba(255,255,255,0.1);
  overflow: hidden;
  box-shadow: inset 0 -8px 20px rgba(0,0,0,0.3);
}
.track-road {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 28px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #475569, #94a3b8, #475569);
  box-shadow: 0 0 12px rgba(148, 163, 184, 0.3);
}
.track-road::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(
    90deg,
    #fbbf24 0 12px,
    transparent 12px 22px
  );
  opacity: 0.85;
  animation: dash-move 1s linear infinite;
}
@keyframes dash-move {
  to { background-position: 22px 0; }
}

.dot-person {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  position: absolute;
  bottom: 36px;
  margin-left: -24px;
  z-index: 3;
  transition: left 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.15),
    0 8px 20px rgba(0,0,0,0.4),
    0 0 24px currentColor;
  animation: person-bob 0.6s ease-in-out infinite alternate;
}
.dot-person.a {
  color: #60a5fa;
  background: linear-gradient(145deg, #93c5fd, #3b82f6);
}
.dot-person.b {
  color: #fbbf24;
  background: linear-gradient(145deg, #fde68a, #f59e0b);
}
@keyframes person-bob {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

.meet-badge {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%) scale(0);
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #042f2e;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 0 30px rgba(52, 211, 153, 0.55);
  z-index: 4;
  animation: meet-in 0.5s cubic-bezier(0.34, 1.5, 0.64, 1) forwards;
}
@keyframes meet-in {
  to { transform: translateX(-50%) scale(1); }
}

/* Confetti */
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}
.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  top: 40%;
  left: 50%;
  border-radius: 2px;
  opacity: 0;
  animation: confetti-fly 1.1s cubic-bezier(0.15, 0.7, 0.3, 1) forwards;
}
@keyframes confetti-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); }
}

/* Flash overlay for step change */
.board-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 40%, rgba(167,139,250,0.25), transparent 60%);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.35s ease;
}
.board-flash.on { opacity: 1; }

/* Step list polish */
.step-list li {
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.step-list li.active {
  transform: translateX(4px);
  box-shadow: 0 0 20px rgba(167, 139, 250, 0.15);
}

/* Card hover lift */
.card {
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}
.card:hover {
  border-color: rgba(167, 139, 250, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

a.card-link {
  position: relative;
  overflow: hidden;
}
a.card-link::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(167,139,250,0.12), transparent 50%, rgba(96,165,250,0.08));
  opacity: 0;
  transition: opacity 0.3s ease;
}
a.card-link:hover::before { opacity: 1; }
a.card-link h3 {
  position: relative;
  background: linear-gradient(90deg, #eef2ff, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
}
a.card-link:hover h3 {
  color: transparent;
}

/* Hero index extras */
.hero-glow {
  position: relative;
}
.hero-glow::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 50%;
  height: 60px;
  background: radial-gradient(ellipse, rgba(167,139,250,0.25), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

.narration {
  margin-top: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(167,139,250,0.12), rgba(96,165,250,0.08));
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 12px;
  font-size: 0.95rem;
  min-height: 64px;
}
.narration .tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

.step-list {
  list-style: none;
  margin-top: 12px;
}
.step-list li {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px solid transparent;
  margin: 4px 0;
}
.step-list li .n {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.step-list li.active {
  background: rgba(167,139,250,0.12);
  border-color: rgba(167,139,250,0.35);
  color: var(--text);
}
.step-list li.active .n { background: var(--accent); color: #0b1020; }
.step-list li.done { color: #cbd5e1; }
.step-list li.done .n { background: rgba(52,211,153,0.2); color: var(--green); }

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.sum-card {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.sum-card .k {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 6px;
}
.sum-card p { font-size: 0.9rem; color: #cbd5e1; line-height: 1.5; }

table.cheat {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.92rem;
}
table.cheat th, table.cheat td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}
table.cheat th {
  background: rgba(167,139,250,0.1);
  color: var(--accent);
  font-weight: 700;
}
table.cheat td { color: #cbd5e1; }
table.cheat code {
  font-family: "JetBrains Mono", monospace;
  color: var(--amber);
}

/* Quiz */
.score-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: rgba(167,139,250,0.1);
  border: 1px solid rgba(167,139,250,0.25);
  border-radius: 14px;
  margin-bottom: 16px;
}
.score-bar strong {
  font-family: "JetBrains Mono", monospace;
  color: var(--accent);
  font-size: 1.2rem;
}
.hint-inline { font-size: 0.88rem; color: var(--muted); margin-top: 4px; }

.quiz {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
  background: rgba(0,0,0,0.18);
}
.quiz .q-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.quiz .q-no {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: rgba(167,139,250,0.2);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}
.quiz .q-text { font-size: 1rem; color: var(--text); font-weight: 500; flex: 1; }
.quiz .q-diff {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.q-diff.easy { background: rgba(52,211,153,0.15); color: var(--green); }
.q-diff.mid { background: rgba(251,191,36,0.15); color: var(--amber); }
.q-diff.hard { background: rgba(248,113,113,0.15); color: var(--red); }

.quiz-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.quiz input[type="text"],
.quiz input[type="number"] {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  width: 140px;
  outline: none;
}
.quiz input:focus { border-color: rgba(167,139,250,0.5); }

.quiz .feedback {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  display: none;
  line-height: 1.55;
}
.quiz .feedback.show { display: block; }
.quiz .feedback.correct {
  background: rgba(52,211,153,0.12);
  border: 1px solid rgba(52,211,153,0.35);
  color: #a7f3d0;
}
.quiz .feedback.wrong {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  color: #fecaca;
}
.quiz .feedback .ans {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--amber);
}
.quiz .sol {
  display: none;
  margin-top: 8px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  color: #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.55;
}
.quiz .sol.show { display: block; }

footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
footer a { color: var(--accent); text-decoration: none; }

/* Index page */
.cat-block { margin-bottom: 32px; }
.cat-block h2 {
  font-size: 1.15rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cat-block h2 .cat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: rgba(167,139,250,0.15);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
a.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
a.card-link:hover {
  transform: translateY(-3px);
  border-color: rgba(167,139,250,0.5);
  box-shadow: 0 12px 40px rgba(99,102,241,0.18);
}
.card-link .no {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 8px;
}
.card-link h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card-link p { font-size: 0.88rem; color: var(--muted); line-height: 1.45; }
.card-link .tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(52,211,153,0.15);
  color: #34d399;
}
.card-link .tag.premium {
  background: rgba(251,191,36,0.15);
  color: var(--amber);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0 28px;
}
.stat-pill {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--muted);
}
.stat-pill strong {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  margin-right: 4px;
}

.search-box {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.3);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 8px;
}
.search-box:focus { border-color: rgba(167,139,250,0.5); }

/* ═══════════ Graphic Scenes (not just text!) ═══════════ */
.scene-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 300px;
}
.scene-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
.scene { width: 100%; }

.scene-caption {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cap-line {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88rem;
  color: #94a3b8;
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.35s ease;
  padding: 4px 8px;
  border-radius: 8px;
}
.cap-line.show { opacity: 1; transform: none; }
.cap-line.cap-title { color: #c4b5fd; font-weight: 700; font-family: "Noto Sans SC", sans-serif; }
.cap-line.cap-hl { color: #fde68a; background: rgba(251,191,36,0.1); }
.cap-line.cap-ok { color: #6ee7b7; background: rgba(52,211,153,0.12); font-weight: 700; }

.pop-in {
  animation: pop-in 0.45s cubic-bezier(0.34, 1.5, 0.64, 1) both;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.3) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Hero */
.scene-hero {
  text-align: center;
  padding: 20px;
}
.hero-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #c4b5fd;
  border: 1px solid rgba(167,139,250,0.4);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.hero-icon { font-size: 56px; line-height: 1; margin-bottom: 10px; filter: drop-shadow(0 8px 24px rgba(167,139,250,0.4)); }
.hero-title {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, #fbbf24, #f472b6, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { color: #94a3b8; margin-top: 8px; font-size: 0.95rem; }

/* Animals */
.scene-animals { padding: 8px; }
.critter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-height: 120px;
  align-items: flex-end;
}
.critter {
  width: 56px;
  opacity: 0;
  transform: scale(0.2);
}
.critter.pop-in { opacity: 1; transform: none; }
.critter.dim { opacity: 0.35; filter: grayscale(0.5); }
.critter.hl {
  filter: drop-shadow(0 0 12px currentColor);
  transform: translateY(-6px) scale(1.08);
}
.critter-svg { width: 56px; height: 64px; display: block; }
.critter.chicken .body, .critter.chicken .head { fill: #fbbf24; }
.critter.chicken .comb { fill: #ef4444; stroke: #ef4444; stroke-width: 3; fill: none; }
.critter.chicken .beak { fill: #f97316; }
.critter.chicken .eye { fill: #0f172a; }
.critter.chicken .leg { stroke: #d97706; stroke-width: 2; }
.critter.chicken .ft { fill: #fbbf24; font-size: 10px; font-weight: 700; font-family: monospace; }
.critter.rabbit .body, .critter.rabbit .head { fill: #60a5fa; }
.critter.rabbit .ear { fill: #93c5fd; }
.critter.rabbit .eye { fill: #0f172a; }
.critter.rabbit .nose { fill: #f472b6; }
.critter.rabbit .ft { fill: #60a5fa; font-size: 10px; font-weight: 700; font-family: monospace; }
.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.3);
}
.pill.chicken { color: #fbbf24; border-color: rgba(251,191,36,0.4); }
.pill.rabbit { color: #60a5fa; border-color: rgba(96,165,250,0.4); }
.pill.feet { color: #34d399; border-color: rgba(52,211,153,0.4); }
.pill.feet.warn { color: #f87171; border-color: rgba(248,113,113,0.5); animation: pulse-warn 0.8s ease infinite alternate; }
@keyframes pulse-warn {
  from { box-shadow: 0 0 0 rgba(248,113,113,0); }
  to { box-shadow: 0 0 16px rgba(248,113,113,0.4); }
}

/* Segments */
.scene-segments { padding: 16px 8px; max-width: 480px; margin: 0 auto; }
.seg-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.seg-label {
  width: 28px;
  font-weight: 800;
  color: #c4b5fd;
  font-size: 0.9rem;
}
.seg-track {
  flex: 1;
  height: 36px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  position: relative;
  overflow: visible;
  border: 1px solid rgba(255,255,255,0.08);
}
.seg-fill {
  height: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 800;
  font-size: 0.9rem;
  color: white;
  width: 0 !important;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.seg-fill.grow { width: var(--w, 50%) !important; }
.seg-fill.a { background: linear-gradient(90deg, #818cf8, #6366f1); --w: inherit; }
.seg-fill.b { background: linear-gradient(90deg, #34d399, #059669); }
/* width set inline - need fix: use style width with grow class */
.seg-fill.grow { width: revert-layer; }
.seg-fill {
  max-width: 100%;
}
.seg-fill.grow {
  /* inline style width will apply when we remove width:0 override */
}
.scene-segments .seg-fill {
  width: 0;
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.scene-segments .seg-fill.grow {
  /* JS sets data-w; CSS uses attr not for width easily - use animation from style */
}
.seg-diff {
  position: absolute;
  top: -22px;
  height: 18px;
  background: rgba(251,191,36,0.25);
  border: 1px dashed #fbbf24;
  border-radius: 4px;
  font-size: 11px;
  color: #fde68a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  white-space: nowrap;
  padding: 0 4px;
}
.seg-sum {
  text-align: center;
  margin-top: 8px;
  font-family: "JetBrains Mono", monospace;
  color: #a78bfa;
  font-weight: 700;
}

/* Track scene */
.scene-track { width: 100%; }
.road-wrap { padding: 8px; }
.road-sky {
  height: 40px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(180deg, #1e1b4b, #0f172a);
}
.road {
  position: relative;
  height: 100px;
  background: linear-gradient(180deg, #334155, #1e293b);
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}
.lane {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 50%;
  height: 4px;
  background: repeating-linear-gradient(90deg, #fbbf24 0 16px, transparent 16px 28px);
  transform: translateY(-50%);
  opacity: 0.85;
  animation: dash-move 0.8s linear infinite;
}
.runner {
  position: absolute;
  bottom: 18px;
  margin-left: -28px;
  text-align: center;
  transition: left 1s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}
.runner-body {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: rgba(255,255,255,0.1);
  box-shadow: 0 0 20px rgba(96,165,250,0.4);
  animation: person-bob 0.5s ease-in-out infinite alternate;
}
.runner.b .runner-body { box-shadow: 0 0 20px rgba(251,191,36,0.4); }
.runner-tag {
  font-size: 11px;
  font-weight: 700;
  color: #e2e8f0;
  margin-top: 2px;
}
.meet-burst {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  font-weight: 900;
  font-size: 1.1rem;
  color: #6ee7b7;
  text-shadow: 0 0 20px rgba(52,211,153,0.8);
  animation: meet-in 0.5s cubic-bezier(0.34,1.5,0.64,1);
  z-index: 5;
}
.road-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #94a3b8;
  font-family: "JetBrains Mono", monospace;
}

/* Trees */
.tree-line {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 16px 8px;
}
.tree-slot {
  text-align: center;
  opacity: 0;
  transform: scale(0.2) translateY(20px);
  width: 44px;
}
.tree-slot.pop-in { opacity: 1; transform: none; }
.tree-slot .tree { font-size: 32px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(52,211,153,0.3)); }
.tree-slot.empty .tree { display: none; }
.tree-num { font-size: 10px; color: #64748b; font-family: monospace; margin-top: 2px; }
.tree-seg {
  width: 28px;
  height: 4px;
  background: linear-gradient(90deg, #475569, #94a3b8);
  margin-bottom: 18px;
  border-radius: 2px;
  position: relative;
}
.tree-seg span {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #64748b;
  white-space: nowrap;
}
.stump { color: #64748b; font-size: 20px; padding-bottom: 8px; }
.tree-caption { text-align: center; color: #94a3b8; font-size: 0.9rem; margin-top: 8px; }

/* Grid */
.grid-box {
  display: grid;
  grid-template-columns: repeat(var(--n), 22px);
  gap: 4px;
  justify-content: center;
  padding: 12px;
}
.gcell {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  opacity: 0;
}
.gcell.on {
  background: linear-gradient(145deg, #818cf8, #6366f1);
  border-color: rgba(167,139,250,0.5);
  box-shadow: 0 0 8px rgba(99,102,241,0.35);
}
.gcell.edge {
  background: linear-gradient(145deg, #34d399, #059669);
  box-shadow: 0 0 8px rgba(52,211,153,0.4);
}
.gcell.pop-in { opacity: 1; animation: pop-in 0.35s cubic-bezier(0.34,1.5,0.64,1) both; }
.grid-caption { text-align: center; margin-top: 10px; color: #94a3b8; font-family: monospace; }

/* Rects */
.scene-rects { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rect-stage {
  position: relative;
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
}
.rblock {
  position: absolute;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  color: white;
  opacity: 0;
  border: 2px solid rgba(255,255,255,0.3);
}
.rblock.pop-in { opacity: 1; animation: pop-in 0.4s cubic-bezier(0.34,1.5,0.64,1) both; }
.rblock.whole, .rblock.rem { background: linear-gradient(145deg, rgba(251,191,36,0.7), rgba(245,158,11,0.5)); }
.rblock.sq { background: linear-gradient(145deg, rgba(96,165,250,0.8), rgba(59,130,246,0.55)); }
.rblock.gcd {
  background: linear-gradient(145deg, rgba(52,211,153,0.9), rgba(16,185,129,0.65));
  box-shadow: 0 0 30px rgba(52,211,153,0.5);
}
.rect-caption { color: #94a3b8; font-size: 0.9rem; }

/* Venn */
.venn-wrap {
  position: relative;
  width: 280px;
  height: 180px;
  margin: 0 auto;
}
.venn-circle {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  top: 15px;
  display: flex;
  align-items: center;
  border: 2px solid rgba(255,255,255,0.3);
}
.venn-circle.A {
  left: 10px;
  background: rgba(96,165,250,0.35);
  justify-content: flex-start;
  padding-left: 28px;
}
.venn-circle.B {
  right: 10px;
  background: rgba(244,114,182,0.35);
  justify-content: flex-end;
  padding-right: 28px;
}
.vc-only { font-family: monospace; font-weight: 800; font-size: 1.2rem; color: white; }
.vc-label {
  position: absolute;
  top: 8px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(255,255,255,0.7);
}
.venn-circle.A .vc-label { left: 16px; }
.venn-circle.B .vc-label { right: 16px; }
.venn-both {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -40%);
  font-family: monospace;
  font-weight: 900;
  font-size: 1.3rem;
  color: #fde68a;
  text-shadow: 0 0 12px rgba(251,191,36,0.5);
  z-index: 2;
}
.venn-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 8px;
  font-family: monospace;
  font-size: 0.9rem;
  color: #94a3b8;
}
.venn-stats .hl { color: #a78bfa; font-weight: 700; }

/* Clock */
.clock-face {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  margin: 0 auto;
  background: radial-gradient(circle at 40% 35%, #1e293b, #0f172a);
  border: 4px solid rgba(167,139,250,0.4);
  box-shadow: 0 0 40px rgba(99,102,241,0.3), inset 0 0 30px rgba(0,0,0,0.5);
  position: relative;
}
.tick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--a)) translateY(-78px);
}
.tick i {
  display: block;
  transform: rotate(calc(-1 * var(--a))) translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  font-style: normal;
  width: 16px;
  text-align: center;
}
.hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: bottom center;
  border-radius: 4px;
  transform: translateX(-50%) rotate(var(--rot));
  transition: transform 0.8s cubic-bezier(0.22,1,0.36,1);
}
.hand.hour {
  width: 5px;
  height: 48px;
  background: linear-gradient(180deg, #e2e8f0, #64748b);
}
.hand.minute {
  width: 3px;
  height: 68px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  box-shadow: 0 0 8px rgba(251,191,36,0.5);
}
.clock-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  margin: -6px;
  border-radius: 50%;
  background: #f472b6;
  box-shadow: 0 0 10px rgba(244,114,182,0.6);
  z-index: 3;
}
.clock-caption {
  text-align: center;
  margin-top: 12px;
  font-family: monospace;
  color: #e2e8f0;
  font-weight: 700;
}

/* Tank */
.scene-tank { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.tank {
  width: 120px;
  height: 160px;
  border: 3px solid rgba(96,165,250,0.5);
  border-radius: 12px 12px 8px 8px;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.3);
  box-shadow: 0 0 30px rgba(96,165,250,0.2);
}
.tank-water {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(56,189,248,0.7), rgba(37,99,235,0.85));
  transition: height 1s cubic-bezier(0.22,1,0.36,1);
}
.wave {
  position: absolute;
  top: -6px; left: -20%;
  width: 140%;
  height: 12px;
  background: rgba(255,255,255,0.25);
  border-radius: 50%;
  animation: wave 1.5s ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}
.tank-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: monospace;
  font-weight: 900;
  font-size: 1.4rem;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  z-index: 2;
}
.tank-pipes { display: flex; gap: 16px; font-size: 0.85rem; color: #94a3b8; }
.pipe.in { color: #60a5fa; font-weight: 700; }
.tank-caption { color: #94a3b8; font-size: 0.9rem; }

/* Tokens / drawers */
.drawer-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.drawer {
  width: 90px;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(10px);
}
.drawer.pop-in { opacity: 1; transform: none; transition: all 0.4s ease; }
.drawer.hl {
  border-color: #fbbf24;
  box-shadow: 0 0 20px rgba(251,191,36,0.35);
}
.drawer-top {
  background: rgba(167,139,250,0.2);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  padding: 6px;
  color: #c4b5fd;
}
.drawer-body {
  min-height: 70px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  justify-content: center;
  align-content: center;
}
.token {
  color: #60a5fa;
  font-size: 14px;
  opacity: 0;
}
.token.pop-in { opacity: 1; }
.empty-d { color: #475569; }
.token-caption { text-align: center; margin-top: 10px; color: #94a3b8; font-size: 0.9rem; }

/* Ages */
.age-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
.age-card {
  text-align: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 14px 18px;
  min-width: 90px;
  opacity: 0;
  transform: scale(0.5);
}
.age-card.pop-in { opacity: 1; transform: none; }
.age-emoji { font-size: 32px; }
.age-name { font-size: 0.85rem; color: #94a3b8; margin: 4px 0; }
.age-num {
  font-size: 2rem;
  font-weight: 900;
  font-family: "JetBrains Mono", monospace;
  background: linear-gradient(135deg, #fbbf24, #f472b6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.age-unit { font-size: 12px; color: #64748b; }
.age-diff {
  font-family: monospace;
  font-weight: 800;
  color: #fbbf24;
  padding: 8px 12px;
  border: 1px dashed rgba(251,191,36,0.5);
  border-radius: 10px;
}
.age-caption { text-align: center; margin-top: 12px; color: #94a3b8; }

/* Pie */
.pie {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto;
  display: grid;
  place-items: center;
  box-shadow: 0 0 40px rgba(167,139,250,0.3);
}
.pie-hole {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #0f172a;
  display: grid;
  place-items: center;
  font-family: monospace;
  font-weight: 900;
  font-size: 1.1rem;
  color: #e2e8f0;
}
.pie-caption { text-align: center; margin-top: 12px; color: #94a3b8; }

/* Numberline */
.nline {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 16px 8px;
}
.nbox {
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(145deg, #6366f1, #4f46e5);
  display: grid;
  place-items: center;
  font-family: monospace;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
  opacity: 0;
  transform: scale(0.3);
}
.nbox.pop-in { opacity: 1; transform: none; }
.nbox.hl {
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  box-shadow: 0 0 20px rgba(251,191,36,0.5);
}
.nbox.pair {
  background: linear-gradient(145deg, #34d399, #059669);
}
.narrow { color: #475569; padding: 0 2px; }
.nline-caption { text-align: center; color: #94a3b8; margin-top: 8px; }

/* Result */
.scene-result { text-align: center; padding: 24px; }
.result-glow {
  font-size: 3.5rem;
  font-weight: 900;
  font-family: "JetBrains Mono", monospace;
  background: linear-gradient(135deg, #34d399, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(52,211,153,0.4));
  animation: ok-pop 0.6s cubic-bezier(0.34,1.5,0.64,1);
}
.result-label { color: #94a3b8; margin-top: 8px; font-weight: 700; letter-spacing: 0.1em; }

/* Fix segment width animation via JS class */
.seg-fill[data-grown="1"] {
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
