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

:root {
  --paper: #f6f3ec;
  --ink: #1d1b18;
  --muted: #6b665e;
  --rule: #d9d3c7;
  --soft: #ece7dc;
  --good: #2f6b3f;
  --good-bg: #e3ecdf;
  --bad: #9b3125;
  --bad-bg: #f3e1dc;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.page { max-width: 720px; margin: 0 auto; padding: 3rem 1.5rem 4rem; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: #b8b0a2; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: .4rem .8rem; z-index: 99; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- header & tabs ---------- */
header.top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.name { font-weight: 600; font-size: 1.1rem; text-decoration: none; }
.site-nav a { margin-left: 1.2rem; }
.site-nav a[aria-current] { font-weight: 600; text-decoration-color: var(--ink); }

.tabs-wrap { border-bottom: 1px solid var(--rule); margin: .75rem 0 2rem; padding-bottom: .75rem; }
.tabs { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; }
.tabs a { text-decoration: none; color: var(--muted); }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--ink); }
.badge { font-size: .75rem; color: var(--bad); font-weight: 600; }
.badge::before { content: "("; }
.badge::after { content: ")"; }

main { outline: none; min-height: 50vh; }

/* ---------- type ---------- */
.page-head { margin-bottom: 1.75rem; }
h1 { font-size: 1.6rem; font-weight: 600; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: .6rem; }
h2 small { font-weight: 400; color: var(--muted); font-size: .9rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 1.2rem 0 .4rem; }
.eyebrow { font-size: .9rem; color: var(--muted); }
.lede { margin-top: .4rem; color: var(--muted); }
.lede b { color: var(--ink); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mt { margin-top: 1.5rem; }
.ok-txt { color: var(--good); }
.bad-txt { color: var(--bad); }

/* ---------- sections (no boxes, just rules) ---------- */
.card { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.page-head + .card, .page-head + .grid-2 > .card:first-child, .page-head + .modes + .card { border-top: none; padding-top: 0; }
.grid-2 { display: block; }
.card.center { }
.row { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; }
.row.wrap { flex-wrap: wrap; }
.big { font-size: 2.5rem; font-weight: 600; line-height: 1; }

.banner {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  background: var(--soft); padding: .6rem .9rem; margin-bottom: 1.5rem; border-radius: 3px;
}
p.warn { background: var(--bad-bg); padding: .6rem .9rem; margin-bottom: 1rem; border-radius: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: .4rem .9rem;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 3px;
  font: inherit; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.btn:hover:not(:disabled) { background: #3a3631; }
.btn.ghost { background: transparent; color: var(--ink); border-color: #b8b0a2; }
.btn.ghost:hover:not(:disabled) { border-color: var(--ink); background: transparent; }
.btn.small { padding: .3rem .75rem; font-size: .875rem; }
.btn.tiny { padding: .1rem .5rem; font-size: .8rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .4; cursor: default; }
.btn small { color: inherit; opacity: .7; }
.btn.file { position: relative; overflow: hidden; }
.btn.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- today ---------- */
.steps { list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: .9rem; padding: .7rem 0; border-bottom: 1px dashed var(--rule); }
.steps li:last-child { border-bottom: none; }
.steps li::before { content: counter(s) "."; color: var(--muted); width: 1.2rem; flex: none; }
.steps li.done::before { content: "✓"; color: var(--good); }
.steps li.done b { text-decoration: line-through; text-decoration-color: var(--muted); }
.steps li > div { flex: 1; display: flex; flex-direction: column; }
.steps li span { color: var(--muted); font-size: .875rem; }
.steps b { font-weight: 500; }

.ready p { margin-bottom: .4rem; }
.ready-num { font-size: 1.6rem; font-weight: 600; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .4rem 0; }
.chip { font: inherit; font-size: .9rem; background: none; border: none; padding: 0; color: var(--ink); }
button.chip { cursor: pointer; text-decoration: underline; text-decoration-color: #b8b0a2; text-underline-offset: 3px; }
button.chip:hover { text-decoration-color: var(--ink); }
.chip.warn { color: var(--bad); }
.chip.ok { color: var(--good); }

/* ---------- plan ---------- */
.domain-weights { display: flex; flex-direction: column; gap: .1rem; margin-bottom: 1.5rem; font-size: .9rem; color: var(--muted); }
.domain-weights b, .domain-weights em { font-style: normal; font-weight: 400; color: var(--ink); }
details.block { padding: 0; }
details.block summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: .8rem; padding: .9rem 0; }
details.block summary::-webkit-details-marker { display: none; }
.block-num { font-weight: 600; width: 1.2rem; }
.block-num::after { content: "."; }
.block-title { flex: 1; display: flex; flex-direction: column; }
.block-title b { font-weight: 600; }
.block-title small { color: var(--muted); font-size: .875rem; }
.block-meta { font-size: .85rem; color: var(--muted); text-align: right; }
.block-body { padding: 0 0 1.25rem 2rem; }
.facts { padding-left: 1.1rem; display: flex; flex-direction: column; gap: .35rem; }
.tasks { list-style: none; display: flex; flex-direction: column; gap: .3rem; }
.tasks input { margin-right: .45rem; accent-color: var(--ink); }
.tag { font-style: normal; font-size: .8rem; color: var(--muted); }
.tag::before { content: "["; }
.tag::after { content: "]"; }
.tag.ok { color: var(--good); }
.tag.due { color: var(--bad); }
details.block.current .block-title b::after { content: "  ← now"; font-weight: 400; color: var(--muted); }

/* ---------- practice ---------- */
.modes { display: flex; flex-direction: column; margin-bottom: 1rem; }
.mode {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  background: none; border: none; border-bottom: 1px dashed var(--rule);
  padding: .65rem 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.mode b { font-weight: 500; text-decoration: underline; text-decoration-color: #b8b0a2; text-underline-offset: 3px; }
.mode:hover:not(:disabled) b { text-decoration-color: var(--ink); }
.mode span { color: var(--muted); font-size: .9rem; text-align: right; }
.mode:disabled { cursor: default; opacity: .5; }
.mode:disabled b { text-decoration: none; }

/* ---------- question ---------- */
.session-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.progress-track { height: 2px; background: var(--rule); margin-bottom: 1.5rem; }
.progress-track span { display: block; height: 100%; background: var(--ink); }
.qcard { border-top: none; padding-top: 0; }
.qhead { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; font-size: .875rem; }
.qhead .qmeta { flex: 1; }
.dots { letter-spacing: .05em; }
.dots i { font-style: normal; color: var(--rule); }
.bm { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--ink); line-height: 1; }
.qstem { font-size: 1.1rem; margin-bottom: 1.1rem; }

.opts { display: flex; flex-direction: column; gap: .4rem; }
.opt {
  display: flex; gap: .75rem; align-items: baseline; width: 100%; text-align: left;
  padding: .6rem .75rem; background: transparent; border: 1px solid var(--rule); border-radius: 3px;
  font: inherit; color: var(--ink); cursor: pointer;
}
.opt kbd { font: inherit; color: var(--muted); width: 1rem; flex: none; }
.opt:hover:not(:disabled) { border-color: #b8b0a2; background: rgba(0,0,0,.02); }
.opt.sel { border-color: var(--ink); background: var(--soft); }
.opt.sel kbd { color: var(--ink); font-weight: 600; }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt:disabled { cursor: default; }

.order-list { list-style: none; counter-reset: o; display: flex; flex-direction: column; gap: .4rem; }
.order-list li {
  counter-increment: o; display: flex; align-items: center; gap: .7rem;
  padding: .5rem .75rem; border: 1px solid var(--rule); border-radius: 3px;
}
.order-list li::before { content: counter(o) "."; color: var(--muted); width: 1.2rem; }
.order-list li.right { border-color: var(--good); background: var(--good-bg); }
.order-list li.wrong { border-color: var(--bad); background: var(--bad-bg); }
.ord-txt { flex: 1; }
.ord-btns { display: flex; gap: .25rem; }

.feedback { margin-top: 1.25rem; padding: .9rem 1rem; border-left: 3px solid; outline: none; }
.feedback.good { border-color: var(--good); background: var(--good-bg); }
.feedback.bad { border-color: var(--bad); background: var(--bad-bg); }
.feedback .verdict { font-weight: 600; margin-bottom: .3rem; }
.feedback.good .verdict { color: var(--good); }
.feedback.bad .verdict { color: var(--bad); }
.feedback ol { padding-left: 1.3rem; margin-bottom: .5rem; }
.feedback p + p { margin-top: .4rem; }

textarea, input[type=date], input[type=number], select {
  width: 100%; background: #fffdf8; color: var(--ink); border: 1px solid var(--rule); border-radius: 3px;
  padding: .5rem .6rem; font: inherit; margin-top: .3rem; resize: vertical;
}
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--ink); }
.qcard > label { display: block; margin-top: 1rem; }

/* ---------- lists ---------- */
.qlist { list-style: none; }
.qlist li { display: flex; flex-direction: column; padding: .55rem 0; border-bottom: 1px dashed var(--rule); }
.qlist li:last-child { border-bottom: none; }
.qmeta { font-size: .85rem; color: var(--muted); }

details.saved { border-bottom: 1px dashed var(--rule); }
details.saved:last-of-type { border-bottom: none; }
details.saved summary { cursor: pointer; padding: .55rem 0; display: flex; flex-direction: column; list-style: none; }
details.saved summary::-webkit-details-marker { display: none; }
details.saved summary .qtext::before { content: "+ "; color: var(--muted); }
details.saved[open] summary .qtext::before { content: "− "; }
.saved-body { padding: 0 0 1rem 1rem; }
.saved-body ol { padding-left: 1.3rem; margin: .3rem 0; }
.saved-body .exp { color: var(--muted); margin: .4rem 0 .8rem; }
.notebook { min-height: 9rem; }

/* ---------- progress ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem 1.5rem; }
.stats dt { font-size: .85rem; color: var(--muted); }
.stats dd { font-size: 1.3rem; font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 40px; max-width: 320px; }
.spark span { flex: 1; background: var(--rule); }
.spark span.on { background: #8a8378; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 400; color: var(--muted); padding: .35rem .5rem .35rem 0; border-bottom: 1px solid var(--rule); }
.tbl td { padding: .45rem .5rem .45rem 0; border-bottom: 1px dashed var(--rule); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td small { color: var(--muted); margin-left: .4rem; }
.bar { display: inline-block; vertical-align: middle; width: 90px; height: 6px; background: var(--rule); }
.bar span { display: block; height: 100%; background: var(--ink); }
.bar.good span { background: var(--good); }
.bar.warn span { background: var(--bad); }
.bar.wide { display: block; width: 100%; max-width: 320px; }

/* ---------- settings ---------- */
.form > label, .form legend { display: block; font-weight: 600; margin-top: 1.2rem; }
.form > label:first-child { margin-top: 0; }
.form input[type=date], .form select { max-width: 240px; }
.form .row { margin-top: 0; }
.form .row select { max-width: 180px; }
.form .row input { max-width: 110px; }
.form .muted.small { margin-top: .25rem; }
fieldset { border: none; }
.radio { display: flex; gap: .6rem; align-items: baseline; margin-top: .45rem; cursor: pointer; }
.radio input { accent-color: var(--ink); }
.radio span { color: var(--muted); }
.radio b { color: var(--ink); font-weight: 500; margin-right: .25rem; }

/* ---------- misc ---------- */
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .5rem 1rem; border-radius: 3px;
  font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw;
}
.toast.show { opacity: 1; }

footer {
  margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: .85rem; color: var(--muted);
}

@media (max-width: 560px) {
  .page { padding: 2rem 1.1rem 3rem; }
  .block-body { padding-left: 0; }
  details.block summary { flex-wrap: wrap; }
  .block-meta { width: 100%; text-align: left; padding-left: 2rem; }
  .mode { flex-direction: column; gap: 0; }
  .mode span { text-align: left; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .bar { width: 50px; }
  .tbl { font-size: .82rem; }
}
