:root {
  --bg: #141210;
  --bg-2: #1c1916;
  --card: #241f1b;
  --line: #3a322a;
  --ink: #f4ecdf;
  --muted: #cbbba4;
  --faint: #8d7d68;
  --amber: #e0a24a;
  --amber-2: #f0d7a4;
  --math: #8eb8b0;
  --geo: #9bb0d1;
  --ok: #8fceb0;
  --bad: #e07a62;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-size: 17px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(224, 162, 74, 0.14), transparent 55%),
    #0e0c0a;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.shell {
  width: min(480px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.main { flex: 1; padding: 22px 18px 12px; }
.nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(20, 18, 16, 0.94);
  position: sticky;
  bottom: 0;
}
.nav button, .text-btn, .choice, .primary, .ghost {
  border: 0;
  background: transparent;
}
.nav button {
  padding: 10px 4px;
  border-radius: 12px;
  color: var(--faint);
  font-size: 13px;
}
.nav button.on { color: var(--amber-2); background: #2a241c; }

.kicker {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--amber);
}
h1, h2, .prompt {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-weight: 500;
}
h1 { font-size: 40px; line-height: 0.95; margin: 8px 0 6px; }
h2 { font-size: 28px; line-height: 1.1; margin: 0 0 8px; }
.sub { color: var(--muted); line-height: 1.45; margin: 0 0 16px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.meta { color: var(--faint); font-size: 13px; }

.primary, .ghost, .choice {
  width: 100%;
  text-align: left;
  border-radius: 16px;
}
.primary {
  background: var(--amber);
  color: #1a1208;
  padding: 16px 16px;
  font-weight: 650;
  box-shadow: var(--shadow);
}
.primary small { display: block; font-weight: 500; opacity: 0.75; margin-top: 3px; }
.ghost {
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
}
.stack { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 14px 12px;
}
.card p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.card.idil { border-color: #3c524c; }
.idil-row + .idil-row { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.idil-row strong { color: var(--ink); }
.card a, .why a, .note a { color: var(--math); }
.bars { display: grid; gap: 10px; margin: 16px 0; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.track { height: 8px; background: #322b24; border-radius: 99px; overflow: hidden; }
.fill { height: 100%; background: var(--amber); width: 0; }
.fill.math { background: var(--math); }
.fill.geo { background: var(--geo); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 99px;
  padding: 4px 9px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--amber-2);
}
.pill.math { color: var(--math); }
.pill.geo { color: var(--geo); }
.dots { display: flex; gap: 6px; margin: 14px 0; }
.dot { width: 8px; height: 8px; border-radius: 99px; background: #3a322a; }
.dot.on { background: var(--amber); }
.dot.done { background: var(--muted); }

.prompt { font-size: 22px; line-height: 1.35; margin: 8px 0 14px; white-space: pre-wrap; }
.choice {
  display: flex;
  gap: 12px;
  padding: 13px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  margin-bottom: 8px;
}
.choice .k {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--amber);
  width: 1.2em;
  flex: none;
}
.choice:disabled { cursor: default; }
.choice.right { border-color: var(--ok); background: #1a2822; }
.choice.wrong { border-color: var(--bad); background: #2a1c18; }
.choice.dim { opacity: 0.48; }
.why {
  border-left: 3px solid var(--amber);
  padding: 4px 0 4px 12px;
  color: var(--ink);
  line-height: 1.5;
  margin: 8px 0 12px;
}
.why.bad { border-color: var(--bad); }
details { color: var(--muted); margin-bottom: 12px; }
summary { cursor: pointer; color: var(--amber-2); }
.teach { white-space: pre-wrap; line-height: 1.45; margin-top: 8px; }

.path-item { width: 100%; text-align: left; }
.path-item strong, a.ghost strong { display: block; }
.path-item span, a.ghost span { color: var(--faint); font-size: 13px; }
a.ghost { display: block; text-decoration: none; color: inherit; }
.stack a.ghost { margin-top: 0; }
.sec { margin: 18px 0 8px; color: var(--faint); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.note {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}
a { color: var(--amber-2); }
.top-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.text-btn { color: var(--muted); padding: 6px 0; }
.mark { font-variant-numeric: tabular-nums; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.warn { color: var(--bad); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
