:root {
  --bg: #fbfaf7; --fg: #1d1f1c; --muted: #6b6f68; --line: #e4e1d8; --card: #fff;
  --accent: #1f6f43; --accent-fg: #fff; --hit: #fff4cf; --err: #a33;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141513; --fg: #ecebe6; --muted: #9a9d95; --line: #2c2e2a; --card: #1c1d1b; --accent: #3fae73; --accent-fg: #0b1a11; --hit: #3a3313; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); line-height: 1.5; }
main { max-width: 760px; margin: 0 auto; padding: 0 16px 64px; }
.top { display: flex; justify-content: space-between; align-items: baseline; max-width: 760px; margin: 0 auto; padding: 16px; flex-wrap: wrap; gap: 4px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; }
.tag, .muted { color: var(--muted); }
.small { font-size: 0.85em; }
h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; margin: 24px 0 8px; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 52ch; }
form#search { margin-top: 24px; display: grid; gap: 16px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } }
label { display: grid; gap: 4px; font-weight: 600; font-size: 0.9rem; }
input:not([type=checkbox]) { font: inherit; font-weight: 400; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 0.9rem; margin-bottom: 8px; }
legend .muted { font-weight: 400; }
.picks { display: flex; flex-wrap: wrap; gap: 4px; }
.pick { display: inline-flex; font-weight: 500; }
.pick input { position: absolute; opacity: 0; }
.pick span { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 0.8rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.pick input:checked + span { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { font: inherit; cursor: pointer; border-radius: 8px; }
.primary { background: var(--accent); color: var(--accent-fg); border: 0; padding: 14px 20px; font-weight: 700; font-size: 1rem; }
.primary:disabled { opacity: 0.6; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--fg); padding: 2px 8px; font-size: 0.85rem; }
.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
a { color: var(--accent); }
#results { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.big { font-size: clamp(1.8rem, 5vw, 2.4rem); font-weight: 750; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.big span { display: block; font-size: 1rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.big.zero { font-size: 1.6rem; }
.match { display: flex; justify-content: space-between; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 12px 0; }
.match h3 { margin: 0; font-size: 1.05rem; }
.match p { margin: 2px 0; }
.amt { display: grid; justify-items: end; align-content: start; gap: 6px; text-align: right; white-space: nowrap; }
.amt strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-fg); text-decoration: none; padding: 6px 12px; font-weight: 600; font-size: 0.9rem; }
@media (max-width: 520px) { .match { flex-direction: column; } .amt { justify-items: start; text-align: left; } }
h2 { margin-top: 36px; font-size: 1.25rem; }
.links { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.links li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.links li.lived { border-color: var(--accent); }
.badge { display: inline-block; font-size: 0.72rem; padding: 0 6px; border-radius: 4px; background: var(--line); margin-left: 4px; }
.badge.hit { background: var(--hit); }
.note { font-size: 0.9rem; }
.err { color: var(--err); }
.fine { margin-top: 48px; font-size: 0.9rem; border-top: 1px solid var(--line); padding-top: 16px; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); max-width: 420px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; }
dialog menu button:not(.primary) { border: 1px solid var(--line); background: none; color: var(--fg); padding: 10px 14px; }
