:root {
  --bg: #15171d;
  --panel: #1e212a;
  --panel-2: #262a35;
  --text: #ebe7df;
  --muted: #a8a49b;
  --accent: #ffcf4a;  
  --good: #5ad48a;
  --bad: #f07a6e;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", "Menlo", "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 780px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.topbar-title { margin-left: auto; letter-spacing: 0.04em; }

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.screen { animation: fade-in 180ms ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h1, h2 { line-height: 1.2; margin: 0.5rem 0 0.75rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
.kicker { color: var(--accent); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; }
p { margin: 0 0 0.9rem; }
.muted { color: var(--muted); }

.art {
  font-family: var(--mono);
  font-size: clamp(7px, 2.7vw, 16px);
  line-height: 1.25;
  white-space: pre;
  overflow-x: auto;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 0 0 1rem;
  color: #d9f2e3;
}

@media (max-width: 480px) {
  main { padding: 0 0.6rem 3rem; }
  .art { padding: 0.6rem; }
}

.hot { cursor: pointer; }

.story { font-style: italic; }
.question { font-weight: 600; }

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin: 1rem 0;
}
@media (min-width: 640px) { .choices { grid-template-columns: 1fr 1fr; } }

button {
  font: inherit;
  color: inherit;
}

.choice, .primary, .chapter-btn {
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: border-color 120ms, background 120ms, transform 80ms;
}
.choice:hover:not(:disabled), .chapter-btn:hover { border-color: var(--accent); }
.choice:active:not(:disabled), .primary:active { transform: scale(0.99); }
.choice .letter { font-family: var(--mono); color: var(--accent); margin-right: 0.5rem; }
.choice.wrong { border-color: var(--bad); opacity: 0.6; cursor: default; }
.choice.right { border-color: var(--good); background: rgba(90, 212, 138, 0.12); }
.choice:disabled { cursor: default; }

.feedback {
  border-left: 4px solid var(--muted);
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 0.9rem;
  margin: 0 0 1rem;
}
.feedback.good { border-color: var(--good); }
.feedback.bad { border-color: var(--bad); }
.feedback strong { display: block; margin-bottom: 0.15rem; }

.primary {
  text-align: center;
  background: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  width: auto;
  padding: 0.7rem 1.4rem;
}
.primary:hover { filter: brightness(1.05); }

.chapter-list { display: grid; gap: 0.6rem; margin: 1rem 0; }
.chapter-btn .num { font-family: var(--mono); color: var(--accent); margin-right: 0.6rem; }
.chapter-btn .obj { color: var(--muted); font-size: 0.85rem; display: block; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}
.link-btn:hover { color: var(--accent); }

.player .art { margin-bottom: 0.5rem; }
.frame-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.frame-btn {
  background: var(--panel-2);
  border: 1px solid #3a3f4c;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.frame-btn:hover:not(:disabled) { border-color: var(--accent); }
.frame-btn:disabled { opacity: 0.35; cursor: default; }
.frame-label { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); min-width: 8.5em; text-align: center; }

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

button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

#bolt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 50;
}
#bolt.firing { display: block; }
#bolt::before {                
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  opacity: 0;
  animation: flash 250ms ease-out;
}
#bolt svg {
  position: absolute;
  top: 45%;
  left: 0;
  width: 45vw;
  height: 60px;
  overflow: visible;
  filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 14px var(--accent));
  animation: zap 250ms linear;
}
#bolt polyline {
  fill: none;
  stroke: #fff6c9;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
@keyframes zap {
  from { transform: translateX(-50vw); }
  to   { transform: translateX(110vw); }
}
@keyframes flash {
  0%   { opacity: 0; }
  30%  { opacity: 0.12; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  #bolt svg { animation: none; left: 27vw; opacity: 0.8; }
}
