:root {
  --bg: #0f0f13; --panel: #18181e; --line: #2b2b35; --text: #eceaf3; --muted: #9b99aa;
  --accent: #ff7a45; --accent-ink: #1a0d06; --cool: #8b7cff; --good: #3ecf8e; --bad: #ff5d73;
  --radius: 14px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, "Iowan Old Style", Georgia, serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #faf8f4; --panel: #ffffff; --line: #e7e2da; --text: #1c1b21; --muted: #6d6a76;
    --accent: #e85d24; --accent-ink: #fff; --cool: #5b4ae0; color-scheme: light;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; }
h1 { font: 600 clamp(2.2rem, 7vw, 3.4rem)/1.05 var(--serif); letter-spacing: -.02em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; padding: 14px 16px; }
.top nav { display: flex; gap: 4px; }
.top nav button, .brand { background: none; border: 0; padding: 8px 10px; border-radius: 8px; }
.top nav button.on { background: var(--panel); }
.brand { font: 700 1.4rem var(--serif); padding-left: 0; }
.brand span { color: var(--accent); }

main { max-width: 760px; margin: 0 auto; padding: 8px 16px 80px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.drill-card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.drill-card:hover { border-color: var(--accent); }
.drill-card b { display: block; margin-bottom: 2px; }
.drill-card small { color: var(--muted); }

.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; }
.btn.primary, .big { background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 650; }
.big { display: block; width: 100%; padding: 18px; border-radius: var(--radius); font-size: 1.15rem; margin: 14px 0; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.hot { background: color-mix(in srgb, var(--accent) 18%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.cold { background: color-mix(in srgb, var(--cool) 14%, var(--panel)); border-color: color-mix(in srgb, var(--cool) 40%, var(--line)); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.quick button { padding: 14px; border-radius: var(--radius); border: 1px solid; text-align: left; }

.primer { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.primer span { font: 1.1rem var(--serif); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.stats b { display: block; font: 600 1.6rem var(--serif); }
.stats small { color: var(--muted); }

/* drill */
.drill .how { color: var(--muted); }
.tag { display: inline-block; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.timer { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0 18px; }
.timer div { height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.prompt { font: 600 clamp(1.6rem, 6vw, 2.6rem)/1.15 var(--serif); min-height: 2.4em; margin-bottom: 14px; letter-spacing: -.01em; }
.prompt .arrow { color: var(--accent); }
.prompt .target { color: var(--cool); }
.prompt.small { font-size: clamp(1.2rem, 4.5vw, 1.7rem); }
.drill .entry { font-size: 1.3rem; padding: 14px 16px; resize: none; overflow: hidden; line-height: 1.35; display: block; }
.drill .eg { font: italic 1rem var(--serif); color: var(--muted); border-left: 2px solid var(--accent); padding-left: 10px; }
.hint { font-size: .85rem; color: var(--accent); margin-top: 6px; }
.meta { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; color: var(--muted); min-height: 2.2em; }
.meta .count { font: 600 1.4rem var(--serif); color: var(--text); }
.nudge { color: var(--accent); font-weight: 600; opacity: 0; transition: opacity .2s; }
.nudge.show { opacity: 1; }
.stream { display: flex; flex-wrap: wrap; gap: 6px; }
.stream span { padding: 4px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); animation: pop .25s ease-out; }
.stream.lines { flex-direction: column; flex-wrap: nowrap; }
.stream.lines span { border-radius: 10px; }
.landed { border-color: var(--good) !important; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.flash { animation: flash .5s; }
@keyframes flash { 30% { background: color-mix(in srgb, var(--good) 35%, var(--panel)); } }
.shake { animation: shake .25s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.result { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; text-align: center; margin: 10px 0; }
.result div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.result b { display: block; font: 600 1.5rem var(--serif); }
.result small { color: var(--muted); }

/* forms */
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.field output { color: var(--accent); font-weight: 700; }
input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { cursor: pointer; position: relative; }
.chips input { position: absolute; opacity: 0; width: 1px; }
.chips span { display: inline-block; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: .92rem; }
.chips input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chips input:focus-visible + span { outline: 2px solid var(--accent); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* review */
.keeper { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.keeper:last-child { border-bottom: 0; }
.star { background: none; border: 0; font-size: 1.3rem; line-height: 1; padding: 2px; color: var(--muted); }
.star.on { color: var(--accent); }
.keeper small { display: block; color: var(--muted); }

/* insights */
table { width: 100%; border-collapse: collapse; }
td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.recipe { font: 1.15rem/1.6 var(--serif); }
.entry-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-weight: 600; z-index: 10; }
@media (max-width: 520px) { .two, .quick { grid-template-columns: 1fr; } .stats b { font-size: 1.3rem; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.pend { height: 3px; margin-top: 4px; }
.pend div { height: 100%; width: 0; background: var(--good); border-radius: 99px; }
.pend div.run { animation: pend 2s linear forwards; }
@keyframes pend { from { width: 0; } to { width: 100%; } }
.prompt .prev { font: italic 1.05rem/1.4 var(--serif); color: var(--muted); margin-top: 8px; }
