:root {
  --bg: #efeae1;
  --paper: #f7f4ee;
  --ink: #1c1916;
  --muted: #5c564e;
  --line: #ddd4c6;
  --accent: #1e4636;
  --accent-ink: #f6f3ec;
  --bad: #7c2d2d;
  --good: #1e4636;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

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

.shell {
  width: min(68rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
}

.brand {
  background: none;
  border: 0;
  padding: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0.4rem;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0.35rem;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 38rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 3rem;
  align-items: start;
}

.next {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 1.5rem 1.5rem 1.35rem;
}

.next h2 { font-size: 1.85rem; }

.next p { max-width: 36rem; }

.primary, .secondary, .choice, .text-button {
  border-radius: 2px;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.primary:hover { background: #17382b; }

.secondary, .choice {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  background: transparent;
}

.choice[aria-pressed="true"], .secondary[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.choice-list {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.choice { text-align: left; }

.text-button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-top: 1.25rem;
}

.map h2 {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}

.layer-name {
  margin: 1.1rem 0 0.35rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.map ul, .result-list, .steps { padding: 0; }

.map ul { list-style: none; margin: 0; }

.map li, .skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.38rem 0 0.38rem 0.7rem;
  border-left: 2px solid transparent;
}

.map li.is-current { border-left-color: var(--accent); }

.status { color: var(--muted); font-size: 0.92rem; }

.status.mastered, .mark.mastered { color: var(--good); }

.status.locked, .mark.weak, .mark.repair { color: var(--muted); }

.reason {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.skills {
  list-style: none;
  margin: 0.15rem 0 0.45rem;
  grid-column: 1 / -1;
}

.work { max-width: 40rem; }

.prompt {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.45rem;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.meta-line, .hint, .error, .quiet {
  color: var(--muted);
  font-size: 0.95rem;
}

.error { color: var(--bad); min-height: 1.3em; }

.figure {
  color: var(--ink);
  margin: 0.5rem 0 1rem;
}

.figure svg { width: min(100%, 22rem); height: auto; display: block; }

.answer-row {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  margin-top: 0.8rem;
}

.answer-row input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  padding: 0.4rem 0.1rem;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.45rem;
}

.verdict {
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.45rem;
  margin-bottom: 0.2rem;
}

.verdict.bad { color: var(--bad); }

.steps { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.steps li { margin: 0.25rem 0; }

.formula {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.65rem;
  line-height: 1.2;
  margin: 1rem 0;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  text-align: center;
  font-size: 0.92em;
  line-height: 1.15;
}

.frac .num { border-bottom: 1px solid var(--ink); padding: 0 0.45rem 0.08rem; }

.frac .den { padding: 0.08rem 0.45rem 0; }

.concept p, .worked p { max-width: 38rem; }

.worked {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.levels { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin: 0 0 1rem; }

.levels span { color: var(--muted); }

.levels .now { color: var(--ink); }

.result-list { list-style: none; margin: 1rem 0; }

.result-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.8rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
}

.miss { margin-top: 1.4rem; padding-top: 0.2rem; }

.foot {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.repeat { margin-bottom: 0.8rem; }

.gate label {
  display: block;
  margin: 1rem 0 0.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.gate input {
  display: block;
  width: min(100%, 22rem);
  min-height: 2.8rem;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 1.35rem;
}

.gate .primary { margin-top: 1.25rem; }

@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; gap: 2rem; }
  h1 { font-size: 1.75rem; }
  .prompt { font-size: 1.3rem; }
  .answer-row { flex-direction: column; }
  .answer-row .primary { width: 100%; }
}
