:root {
  --bg: #f6f3ee; --surface: #fffdf9; --ink: #2b2723; --muted: #6f6860; --line: #e4ded4;
  --accent: #3f7d6e; --accent-ink: #fff; --gold: #c9973b; --warn: #b5523b;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1b1a18; --surface: #252320; --ink: #eee9e1; --muted: #a59d92; --line: #3a3732; --accent: #6bb3a1; --accent-ink: #10201c; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main, .top { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 800; letter-spacing: -.02em; text-decoration: none; color: var(--ink); font-size: 1.15rem; }
.logo span { color: var(--accent); }
.streak { font-weight: 700; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 8px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .92rem; min-height: 2.8em; }
.kicker { text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--muted); margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.btn { appearance: none; border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 650; background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.pill { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.pill.over strong { color: var(--warn); }

/* home */
.cards { display: grid; gap: 12px; margin: 16px 0; }
.card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); border: 1px solid var(--line); }
.card-icon { font-size: 1.8rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); flex: none; }
.card-body { display: grid; flex: 1; }
.card-body span { color: var(--muted); font-size: .9rem; }
.card-state { font-weight: 700; color: var(--accent); white-space: nowrap; }
.card.done { opacity: .85; }
.week { display: flex; gap: 6px; list-style: none; padding: 0; margin: 8px 0; }
.week li { flex: 1; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; background: var(--line); color: var(--muted); }
.week .lvl1 { background: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--ink); }
.week .lvl2 { background: color-mix(in srgb, var(--accent) 65%, var(--line)); color: var(--accent-ink); }
.week .lvl3 { background: var(--accent); color: var(--accent-ink); }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 8px 0; }
.faq summary { font-weight: 650; cursor: pointer; }

/* game shell */
.banner { background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border: 1px solid var(--gold); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.gamebar { display: flex; justify-content: space-between; align-items: baseline; }
.clock { font-variant-numeric: tabular-nums; font-weight: 700; }
.stage { margin: 12px 0 24px; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; box-shadow: var(--shadow); text-align: center; }
.result .row, .result .next { justify-content: center; }
.big { font-size: 2.6rem; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.versus { font-weight: 650; }
.toast { min-height: 1.5em; color: var(--accent); font-weight: 600; }
.next { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.nick { display: grid; gap: 8px; text-align: left; margin: 12px 0; }
.nick input { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.board { text-align: left; }
.board ol { padding-left: 1.4em; }
.board li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.seo { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 8px; }
footer { max-width: 560px; margin: 32px auto; padding: 0 16px; color: var(--muted); font-size: .85rem; }

/* sumtrail */
.st-head { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.st-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-width: 360px; margin: 0 auto; }
.st-cell { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 1.35rem/1 system-ui, sans-serif; cursor: pointer; transition: background .15s, transform .1s; }
.st-cell.start { box-shadow: inset 0 0 0 3px var(--accent); }
.st-cell.end { box-shadow: inset 0 0 0 3px var(--gold); }
.st-cell.on { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.st-cell.tip { background: var(--accent); color: var(--accent-ink); transform: scale(1.04); }
.st-cell:disabled { cursor: default; }

/* even split */
.es-scale { display: grid; place-items: center; height: 100px; padding-top: 10px; }
.es-beam { display: flex; align-items: center; justify-content: space-between; width: 80%; max-width: 360px; height: 10px; background: var(--muted); border-radius: 6px; transition: transform .3s ease; position: relative; }
.es-beam.level { background: var(--accent); }
.es-beam span { position: relative; top: -22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.es-beam .es-pivot { top: 22px; font-size: 1.4rem; }
.es-pans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.es-pan { min-height: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; justify-content: center; }
.es-stone { width: var(--size); height: var(--size); min-width: 44px; min-height: 44px; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #d9d3c9, #9b9387); color: #2b2723; font-weight: 800; cursor: pointer; box-shadow: 0 2px 4px rgb(0 0 0 / .2); }

/* hue match */
.hm-swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hm-swatches figure { margin: 0; text-align: center; color: var(--muted); font-size: .85rem; }
.hm-sw { aspect-ratio: 1.3; border-radius: var(--radius); border: 1px solid var(--line); }
.hm-sliders { display: grid; gap: 10px; margin: 16px 0; }
.hm-sliders label { display: grid; font-size: .9rem; color: var(--muted); }
.hm-sliders input { width: 100%; accent-color: var(--accent); height: 32px; }
.hm-tries { list-style: none; padding: 0; display: grid; gap: 6px; }
.hm-tries li { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.hm-dot { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.hm-hint { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* archive */
.archive { list-style: none; padding: 0; }
.archive li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.archive li span { flex: 1; }
.archive a { text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); }
.archive a.done { background: color-mix(in srgb, var(--accent) 25%, var(--surface)); }

/* habit layer */
.progress p { margin: 6px 0 0; }
.meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: calc(var(--p) * 100%); min-width: 8px; background: var(--accent); border-radius: inherit; transition: width .4s; }
.callit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; text-align: center; box-shadow: var(--shadow); }
.callit h2 { margin: 4px 0 16px; }
.callit-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.callit-opts .btn { justify-content: center; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; font: inherit; margin-top: 12px; cursor: pointer; min-height: 44px; }
.callpill { display: inline-block; margin: 0 0 4px; padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 18%, var(--surface)); border: 1px solid var(--gold); font-size: .85rem; }
.called { font-weight: 600; color: var(--muted); }
.called.hit { color: var(--accent); font-size: 1.1rem; }
.mystery { margin: 16px 0; }
.locked { color: var(--muted); }
.crack { background: var(--gold); color: #2b2723; }
.shake { animation: shake .3s linear 3; }
@keyframes shake { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.reveal { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: left; animation: pop .5s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.teaser { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; margin: 20px 0; }
.teaser p { margin: 0; font-size: .92rem; }
.teaser-sw { flex: none; width: 64px; height: 64px; border-radius: 50%; filter: blur(9px); }
.jar { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.jar li { display: grid; justify-items: center; text-align: center; font-size: .75rem; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.jar li.empty { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
.r-rare, .jar li.r-rare { border-color: #6c8fd6; }
.r-legendary, .jar li.r-legendary { border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.week .frozen { background: #cfe3f2; color: #24425a; }
[hidden] { display: none !important; }
