:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel-2: #182338;
  --text: #e8eefc;
  --muted: #9aa8c7;
  --accent: #5b9dff;
  --accent-2: #3dd6c6;
  --good: #3ecf8e;
  --warn: #f0c14b;
  --bad: #ff6b7a;
  --upper: #7ecbff;
  --lower: #ff9f6b;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 157, 255, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 159, 107, 0.08), transparent 50%),
    var(--bg);
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.header h1 {
  margin: 0.2rem 0 0.5rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
}

.banner {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 193, 75, 0.35);
  background: rgba(240, 193, 75, 0.08);
  color: var(--warn);
  font-size: 0.88rem;
  line-height: 1.4;
}

.disclaimer {
  color: var(--muted);
  line-height: 1.5;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

.disclaimer a { color: var(--accent); }

.primer {
  margin-top: 1.25rem;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem 1.25rem;
}

.primer-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.primer-head h2 { margin: 0; font-size: 1.15rem; }

.primer-toggle {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}

.primer.collapsed #primerBody { display: none; }

.primer-lead {
  margin: 0.75rem 0 1rem;
  line-height: 1.55;
  font-size: 0.98rem;
}

.primer-lead strong { color: var(--accent-2); }

.primer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .primer-grid { grid-template-columns: 1fr; }
}

.primer-card {
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
}

.primer-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.92rem;
  color: var(--accent);
}

.primer-card p, .primer-card li {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.primer-card ul { margin: 0; padding-left: 1.1rem; }
.primer-card li { margin-bottom: 0.25rem; }
.primer-card strong { color: var(--text); }

.primer-steps {
  margin: 0.5rem 0 0.75rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.primer-steps li { margin-bottom: 0.4rem; }
.primer-steps strong { color: var(--text); }

.primer-tip {
  margin: 0.75rem 0 0;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--accent-2);
  background: rgba(61, 214, 198, 0.07);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.primer-jump { margin: 0.75rem 0 0; }
.primer-jump a { color: var(--accent); font-weight: 600; text-decoration: none; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.25rem;
  scroll-margin-top: 1rem;
}

.tab {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.82rem;
}

.tab:hover { color: var(--text); }
.tab.active {
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.mode { display: none; margin-top: 1rem; }
.mode.active { display: block; }

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem 1.25rem;
}

.panel h2 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.panel .sub { margin: 0 0 0.9rem; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

.grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1.15fr;
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

label.ctrl {
  display: grid;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.7rem;
}

label.ctrl strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input[type="range"] { width: 100%; accent-color: var(--accent); }

button {
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0d1524;
  color: var(--text);
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-weight: 600;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), #3d7fe0);
  border: none;
  color: #fff;
}

button.ghost { background: transparent; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.presets button {
  font-size: 0.76rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

.presets button.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.stat {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
}

.stat .k {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .v {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.stat .v.good { color: var(--good); }
.stat .v.hot { color: var(--lower); }
.stat .v.cool { color: var(--upper); }

.viz {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0a101c;
  overflow: hidden;
  height: 280px;
}

.viz canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.viz-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warn);
  background: rgba(11, 18, 32, 0.88);
  border: 1px solid rgba(240, 193, 75, 0.4);
  border-radius: 6px;
  padding: 0.22rem 0.4rem;
}

.callout {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: rgba(91, 157, 255, 0.08);
  border: 1px solid rgba(91, 157, 255, 0.22);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--muted);
}

.callout strong { color: var(--text); }

.eq {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  margin: 0.5rem 0;
  color: var(--accent-2);
  overflow-x: auto;
}

.myth {
  border-left: 3px solid var(--bad);
  padding: 0.55rem 0.75rem;
  margin: 0.5rem 0;
  background: rgba(255, 107, 122, 0.07);
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

.myth strong { color: var(--bad); }

.truth {
  border-left: 3px solid var(--good);
  padding: 0.55rem 0.75rem;
  margin: 0.5rem 0;
  background: rgba(62, 207, 142, 0.07);
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

.truth strong { color: var(--good); }

.story-card {
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 0.85rem;
}

.story-card h3 { margin: 0 0 0.4rem; }
.story-card p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 0.92rem; }

.story-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}

.story-nav .step-ind {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
}

.choices { display: grid; gap: 0.4rem; }
.choices button {
  text-align: left;
  line-height: 1.35;
  font-weight: 500;
}
.choices button.correct {
  border-color: var(--good);
  background: rgba(62, 207, 142, 0.12);
}
.choices button.wrong {
  border-color: var(--bad);
  background: rgba(255, 107, 122, 0.1);
}

.explain {
  margin-top: 0.55rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}

.prompt { font-weight: 600; margin-bottom: 0.55rem; }

.about-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

footer.note {
  margin-top: 1.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

footer.note a { color: var(--accent); }
