:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --ink: #18181b;
  --muted: #8b8b86;
  --line: #e6e6e1;
  --accent: #2e6b5a;
  --accent-soft: #e3eee9;
  --opp: #b4532a;
  --opp-soft: #f4e6de;
  --bad: #b42a3a;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #121212; --surface: #1a1a1a; --ink: #ececea; --muted: #85857f; --line: #2a2a28;
    --accent: #6fbfa5; --accent-soft: #1d2e28; --opp: #e08a63; --opp-soft: #33231b; --bad: #e0707e;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #121212; --surface: #1a1a1a; --ink: #ececea; --muted: #85857f; --line: #2a2a28;
  --accent: #6fbfa5; --accent-soft: #1d2e28; --opp: #e08a63; --opp-soft: #33231b; --bad: #e0707e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); transition: background-color .2s, color .2s; font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

.wrap { max-width: 720px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 22px 0; border-bottom: 1px solid var(--line); margin-bottom: 48px;
}
.brand { font-family: var(--mono); font-weight: 500; font-size: 18px; letter-spacing: -0.02em; text-decoration: none; }
.brand b { color: var(--accent); font-weight: 500; }
nav { display: flex; gap: 18px; align-items: center; font-size: 14px; color: var(--muted); flex-wrap: wrap; justify-content: flex-end; }
nav a { text-decoration: none; }
nav a:hover, nav a.on { color: var(--ink); }
.chip { font-family: var(--mono); color: var(--ink); }

h1 { font-size: 30px; font-weight: 500; letter-spacing: -0.025em; margin: 0 0 6px; }
h2 { font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 40px 0 14px; }
p.sub { color: var(--muted); margin: 0 0 36px; }

.modes { display: grid; margin-top: 40px; border-top: 1px solid var(--line); }
.mode {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 18px 2px; background: none; border: 0; border-bottom: 1px solid var(--line);
  cursor: pointer; text-align: left; width: 100%; font-family: var(--mono);
}
.mode .t { font-size: 20px; letter-spacing: -0.02em; transition: color .15s; }
.mode .t::after { content: '.'; color: transparent; transition: color .15s; }
.mode:hover .t, .mode:focus-visible .t { color: var(--accent); }
.mode:hover .t::after, .mode:focus-visible .t::after { color: var(--accent); }
.mode:focus-visible { outline: none; }
.mode .k { color: var(--muted); font-size: 14px; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  cursor: pointer; font-weight: 500; text-decoration: none;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.ghost.danger { color: #c4473a; }
.btn.ghost.danger:hover { border-color: #c4473a; }
.btn:disabled { opacity: .4; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=email], select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--ink); }
.err { color: var(--bad); font-size: 14px; min-height: 21px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.narrow { max-width: 380px; }
.tabs { display: flex; gap: 4px; margin-bottom: 22px; }
.tabs button { background: none; border: 0; padding: 6px 0; margin-right: 18px; color: var(--muted); cursor: pointer; border-bottom: 1px solid transparent; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }

/* config editor */
.cfg { display: grid; gap: 14px; }
.cfg .op { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: center; }
.cfg .op label.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cfg .rng { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.cfg .rng input { width: 64px; padding: 6px 8px; font-family: var(--mono); text-align: center; }
.cfg .note { font-size: 13px; color: var(--muted); }
@media (max-width: 520px) { .cfg .op { grid-template-columns: 1fr; gap: 6px; } }

/* game */
.game { padding-top: 8px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; font-family: var(--mono); }
.hud .side { display: grid; gap: 2px; min-width: 0; }
.hud .side.r { text-align: right; }
.hud .name { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud .score { font-size: 40px; line-height: 1; font-weight: 500; }
.hud .you .score { color: var(--accent); }
.hud .opp .score { color: var(--opp); }
.hud .clock { font-size: 15px; color: var(--muted); text-align: center; }
.race { position: relative; height: 4px; margin: 22px 0 0; background: var(--line); border-radius: 2px; overflow: hidden; }
.race .bar { position: absolute; top: 0; bottom: 0; transition: width .2s ease; }
.race .bar.y { left: 0; background: var(--accent); }
.race .bar.o { right: 0; background: var(--opp); }
.timeline { height: 1px; background: var(--line); margin-top: 6px; position: relative; }
.timeline i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--muted); }

.stage { min-height: 46vh; display: grid; place-items: center; }
.problem { display: flex; align-items: baseline; justify-content: center; gap: 18px; font-family: var(--game-font, var(--mono)); font-size: calc(clamp(34px, 9vw, 64px) * var(--psize, 1)); font-weight: 400; letter-spacing: -0.02em; flex-wrap: wrap; }
.problem .eq { color: var(--muted); }
.problem input {
  width: 4.2ch; font: inherit; text-align: left; background: transparent; border: 0; border-bottom: 2px solid var(--ink);
  padding: 0 2px; border-radius: 0; caret-color: var(--accent);
}
.problem input:focus { border-color: var(--accent); }
.countdown { font-family: var(--mono); font-size: 96px; color: var(--muted); }
.flash { animation: flash .25s ease; }
@keyframes flash { from { color: var(--accent); } to { color: inherit; } }
.hint { text-align: center; color: var(--muted); font-size: 13px; }

/* results */
.result { text-align: center; padding: 20px 0; }
.result .verdict { font-size: 44px; font-weight: 500; letter-spacing: -0.03em; }
.result .verdict.win { color: var(--accent); }
.result .verdict.loss { color: var(--opp); }
.result .line { font-family: var(--mono); font-size: 22px; margin: 18px 0 6px; }
.result .delta { font-family: var(--mono); color: var(--muted); }
.result .delta b.up { color: var(--accent); font-weight: 500; }
.result .delta b.down { color: var(--opp); font-weight: 500; }
.result .row { justify-content: center; margin-top: 30px; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 11px 6px; border-bottom: 1px solid var(--line); }
td.n, th.n { text-align: right; font-family: var(--mono); }
tr.me td { color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .v { font-family: var(--mono); font-size: 24px; }
.stat .l { font-size: 12px; color: var(--muted); }
.w { color: var(--accent); } .l2 { color: var(--opp); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s infinite; margin-right: 10px; }
@keyframes pulse { 50% { opacity: .2; } }
.code { font-family: var(--mono); font-size: 44px; letter-spacing: .12em; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 60px 0 30px; }

/* rooms, friends */
.room .code { margin-bottom: 6px; }
.slots { margin-top: 26px; border-top: 1px solid var(--line); }
.slot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 15px; min-height: 52px; }
.slot > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.slot a { text-decoration: none; }
.slot a:hover { color: var(--accent); }
.slot .row { gap: 8px; flex-wrap: nowrap; }
.btn.small { padding: 5px 11px; font-size: 13px; font-family: var(--sans); }
.small-t { font-size: 13px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--line); margin-right: 10px; vertical-align: middle; }
.dot.on { background: #34c759; box-shadow: 0 0 0 3px rgb(52 199 89 / .18); }
.dot.busy { background: var(--opp); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--bg); font-size: 11px; line-height: 18px; text-align: center; font-family: var(--mono); }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--ink); color: var(--bg); border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgb(0 0 0 / .18); }
.toast span { flex: 1; }
.toast.error { background: var(--bad); }
.toast .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); padding: 5px 12px; font-size: 13px; }
.toast .x { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }

/* named themes (Settings). Each also applies to its own swatch. */
:root[data-q-theme='light'], [data-q-theme='light'] { --bg: #f7f7f5; --surface: #ffffff; --ink: #18181b; --muted: #8b8b86; --line: #e6e6e1; --accent: #2e6b5a; --accent-soft: #e6e6e1; --opp: #b4532a; --opp-soft: #e6e6e1; --bad: #b42a3a; }
:root[data-q-theme='light'] { color-scheme: light; }
:root[data-q-theme='dark'], [data-q-theme='dark'] { --bg: #121212; --surface: #1a1a1a; --ink: #ececea; --muted: #85857f; --line: #2a2a28; --accent: #6fbfa5; --accent-soft: #2a2a28; --opp: #e08a63; --opp-soft: #2a2a28; --bad: #e0707e; }
:root[data-q-theme='dark'] { color-scheme: dark; }
:root[data-q-theme='paper'], [data-q-theme='paper'] { --bg: #f3efe6; --surface: #faf7f0; --ink: #2b2925; --muted: #8f887a; --line: #e2dccd; --accent: #8a5a2b; --accent-soft: #e2dccd; --opp: #3f6e8c; --opp-soft: #e2dccd; --bad: #a63d3d; }
:root[data-q-theme='paper'] { color-scheme: light; }
:root[data-q-theme='sage'], [data-q-theme='sage'] { --bg: #e8ede7; --surface: #f3f6f2; --ink: #1f2a22; --muted: #788a7c; --line: #d3dcd3; --accent: #3d7550; --accent-soft: #d3dcd3; --opp: #a85d3a; --opp-soft: #d3dcd3; --bad: #a83a3a; }
:root[data-q-theme='sage'] { color-scheme: light; }
:root[data-q-theme='slate'], [data-q-theme='slate'] { --bg: #1d2228; --surface: #242a31; --ink: #d8dee6; --muted: #7d8793; --line: #323a43; --accent: #7fb4e0; --accent-soft: #323a43; --opp: #e0a77f; --opp-soft: #323a43; --bad: #e07f8a; }
:root[data-q-theme='slate'] { color-scheme: dark; }
:root[data-q-theme='midnight'], [data-q-theme='midnight'] { --bg: #0d1120; --surface: #131a2c; --ink: #dfe4f2; --muted: #6d7694; --line: #212a40; --accent: #8ea7ff; --accent-soft: #212a40; --opp: #ff9e7a; --opp-soft: #212a40; --bad: #ff8095; }
:root[data-q-theme='midnight'] { color-scheme: dark; }
:root[data-q-theme='dusk'], [data-q-theme='dusk'] { --bg: #1e1923; --surface: #27202d; --ink: #eae2ef; --muted: #8c7f96; --line: #352c3c; --accent: #c6a0e8; --accent-soft: #352c3c; --opp: #f0b27a; --opp-soft: #352c3c; --bad: #f08a9a; }
:root[data-q-theme='dusk'] { color-scheme: dark; }
:root[data-q-theme='rose'], [data-q-theme='rose'] { --bg: #f7eded; --surface: #fdf6f6; --ink: #2e2224; --muted: #9a8487; --line: #ead8d9; --accent: #b0455a; --accent-soft: #ead8d9; --opp: #4f6f8f; --opp-soft: #ead8d9; --bad: #a3283c; }
:root[data-q-theme='rose'] { color-scheme: light; }
:root[data-q-theme='terminal'], [data-q-theme='terminal'] { --bg: #0b0f0b; --surface: #111711; --ink: #b8f5b0; --muted: #4f7a4a; --line: #1c291b; --accent: #5fff6a; --accent-soft: #1c291b; --opp: #ffb454; --opp-soft: #1c291b; --bad: #ff6b6b; }
:root[data-q-theme='terminal'] { color-scheme: dark; }
:root[data-q-theme='mono'], [data-q-theme='mono'] { --bg: #ffffff; --surface: #ffffff; --ink: #000000; --muted: #7a7a7a; --line: #e4e4e4; --accent: #000000; --accent-soft: #e4e4e4; --opp: #7a7a7a; --opp-soft: #e4e4e4; --bad: #000000; }
:root[data-q-theme='mono'] { color-scheme: light; }

/* brand mark */
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand .mark { width: 22px; height: 22px; flex: none; }
.mark .m-ink { fill: var(--ink); }
.mark .m-acc { fill: var(--accent); }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; width: fit-content; }
.seg button { background: none; border: 0; padding: 6px 14px; cursor: pointer; font-family: var(--mono); font-size: 14px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }

/* bot slider */
.slider { display: grid; gap: 10px; max-width: 460px; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.slider-read { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 15px; }
.slider-read b { font-weight: 500; color: var(--ink); }

/* theme swatches */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch { display: grid; gap: 8px; padding: 14px; border-radius: 10px; cursor: pointer; text-align: left;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); font-family: var(--mono); }
.swatch .sw-sample { font-size: 18px; }
.swatch .sw-sample i { font-style: normal; color: var(--accent); }
.swatch .sw-name { font-size: 12px; color: var(--muted); }
.swatch.on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 2v2 */
.team { margin-top: 22px; }
.team-h { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 13px; color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.stage.waiting .problem { opacity: .35; }
.stage.waiting .problem input { border-color: var(--line); }

/* friends status: label then dot on the right */
.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status .dot { margin: 0; }

.tabs.as-links { gap: 18px; margin: 4px 0 22px; }
.tabs.as-links a { text-decoration: none; color: var(--muted); padding: 6px 0; border-bottom: 1px solid transparent; }
.tabs.as-links a.on { color: var(--ink); border-color: var(--ink); }
canvas.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font: inherit; }

/* more themes */
:root[data-q-theme='chalkboard'], [data-q-theme='chalkboard'] { --bg: #2f3b35; --surface: #36443d; --ink: #e8eee6; --muted: #93a399; --line: #45544c; --accent: #f2e9a0; --accent-soft: #45544c; --opp: #f4a28c; --opp-soft: #45544c; --bad: #ff9b8f; }
:root[data-q-theme='chalkboard'] { color-scheme: dark; }
:root[data-q-theme='blueprint'], [data-q-theme='blueprint'] { --bg: #1f4e8c; --surface: #245597; --ink: #e6efff; --muted: #a3bbe0; --line: #3a68a6; --accent: #ffffff; --accent-soft: #3a68a6; --opp: #ffd27a; --opp-soft: #3a68a6; --bad: #ffb0a8; }
:root[data-q-theme='blueprint'] { color-scheme: dark; }
:root[data-q-theme='graph'], [data-q-theme='graph'] { --bg: #f4f7fb; --surface: #ffffff; --ink: #1f2b3a; --muted: #8190a3; --line: #d9e2ee; --accent: #2f6fd1; --accent-soft: #d9e2ee; --opp: #d1572f; --opp-soft: #d9e2ee; --bad: #c0392b; }
:root[data-q-theme='graph'] { color-scheme: light; }
:root[data-q-theme='abacus'], [data-q-theme='abacus'] { --bg: #ead9c2; --surface: #f3e7d6; --ink: #3a2a1c; --muted: #86715b; --line: #dcc7aa; --accent: #b8432f; --accent-soft: #dcc7aa; --opp: #2f6b6b; --opp-soft: #dcc7aa; --bad: #a3281c; }
:root[data-q-theme='abacus'] { color-scheme: light; }
:root[data-q-theme='ember'], [data-q-theme='ember'] { --bg: #1a1210; --surface: #221816; --ink: #f2e1d8; --muted: #8d7268; --line: #33241f; --accent: #ff7a45; --accent-soft: #33241f; --opp: #ffc861; --opp-soft: #33241f; --bad: #ff6b6b; }
:root[data-q-theme='ember'] { color-scheme: dark; }
:root[data-q-theme='glacier'], [data-q-theme='glacier'] { --bg: #e6f1f5; --surface: #f3f9fb; --ink: #19323d; --muted: #738f9a; --line: #cfe1e8; --accent: #1c8aa8; --accent-soft: #cfe1e8; --opp: #c25a7a; --opp-soft: #cfe1e8; --bad: #b8324a; }
:root[data-q-theme='glacier'] { color-scheme: light; }
:root[data-q-theme='lagoon'], [data-q-theme='lagoon'] { --bg: #0f3b3f; --surface: #13464a; --ink: #dff5f2; --muted: #84b3ae; --line: #1f5559; --accent: #6ff0d2; --accent-soft: #1f5559; --opp: #ffb38a; --opp-soft: #1f5559; --bad: #ff8f8f; }
:root[data-q-theme='lagoon'] { color-scheme: dark; }
:root[data-q-theme='citrus'], [data-q-theme='citrus'] { --bg: #fff7d6; --surface: #fffbe8; --ink: #2a2614; --muted: #8f855a; --line: #efe5b5; --accent: #d97200; --accent-soft: #efe5b5; --opp: #3c7d2a; --opp-soft: #efe5b5; --bad: #b3261e; }
:root[data-q-theme='citrus'] { color-scheme: light; }
:root[data-q-theme='plum'], [data-q-theme='plum'] { --bg: #3a1f3d; --surface: #452548; --ink: #f6e7f4; --muted: #b394b0; --line: #563359; --accent: #ffb3e6; --accent-soft: #563359; --opp: #ffd38a; --opp-soft: #563359; --bad: #ff8fa3; }
:root[data-q-theme='plum'] { color-scheme: dark; }
:root[data-q-theme='matcha'], [data-q-theme='matcha'] { --bg: #cfdcc0; --surface: #dbe6cf; --ink: #24301c; --muted: #64735a; --line: #bccaa9; --accent: #3f6a2a; --accent-soft: #bccaa9; --opp: #9c4a2e; --opp-soft: #bccaa9; --bad: #992f22; }
:root[data-q-theme='matcha'] { color-scheme: light; }
:root[data-q-theme='cobalt'], [data-q-theme='cobalt'] { --bg: #2c49d6; --surface: #3554e0; --ink: #ffffff; --muted: #bcc7f6; --line: #4a66e6; --accent: #ffe14d; --accent-soft: #4a66e6; --opp: #ffb0c0; --opp-soft: #4a66e6; --bad: #ffc2c2; }
:root[data-q-theme='cobalt'] { color-scheme: dark; }
:root[data-q-theme='tomato'], [data-q-theme='tomato'] { --bg: #d94e38; --surface: #e05c46; --ink: #fff6ef; --muted: #ffd6c9; --line: #e77561; --accent: #2b1b17; --accent-soft: #e77561; --opp: #fff0a8; --opp-soft: #e77561; --bad: #2b1b17; }
:root[data-q-theme='tomato'] { color-scheme: dark; }
:root[data-q-theme='lilac'], [data-q-theme='lilac'] { --bg: #dcd6f0; --surface: #e7e3f6; --ink: #2c2540; --muted: #746a96; --line: #c9c1e4; --accent: #6a4fc7; --accent-soft: #c9c1e4; --opp: #c2506f; --opp-soft: #c9c1e4; --bad: #a62b4a; }
:root[data-q-theme='lilac'] { color-scheme: light; }
:root[data-q-theme='espresso'], [data-q-theme='espresso'] { --bg: #3b2c22; --surface: #45352a; --ink: #f1e4d6; --muted: #a8917c; --line: #554234; --accent: #e0b07a; --accent-soft: #554234; --opp: #9cc7a4; --opp-soft: #554234; --bad: #f08f7f; }
:root[data-q-theme='espresso'] { color-scheme: dark; }
:root[data-q-theme='synth'], [data-q-theme='synth'] { --bg: #120b1f; --surface: #1a1030; --ink: #f0e6ff; --muted: #8a77ab; --line: #2a1d45; --accent: #ff4fd8; --accent-soft: #2a1d45; --opp: #3df2ff; --opp-soft: #2a1d45; --bad: #ff6b8b; }
:root[data-q-theme='synth'] { color-scheme: dark; }
:root[data-q-theme='seafoam'], [data-q-theme='seafoam'] { --bg: #c4eadf; --surface: #d3f1e8; --ink: #143a30; --muted: #56807a; --line: #addfd0; --accent: #0b7a5c; --accent-soft: #addfd0; --opp: #b8466c; --opp-soft: #addfd0; --bad: #a12a3a; }
:root[data-q-theme='seafoam'] { color-scheme: light; }
:root[data-q-theme='solar'], [data-q-theme='solar'] { --bg: #ffcf3f; --surface: #ffd95f; --ink: #2b2100; --muted: #6f5b10; --line: #f0bd20; --accent: #1c1c1c; --accent-soft: #f0bd20; --opp: #a8341a; --opp-soft: #f0bd20; --bad: #8f1f12; }
:root[data-q-theme='solar'] { color-scheme: light; }
:root[data-q-theme='bone'], [data-q-theme='bone'] { --bg: #e9e4d8; --surface: #f2eee4; --ink: #111111; --muted: #7d7868; --line: #d6cfbf; --accent: #c0392b; --accent-soft: #d6cfbf; --opp: #1f4f7a; --opp-soft: #d6cfbf; --bad: #9e2a1e; }
:root[data-q-theme='bone'] { color-scheme: light; }
:root[data-q-theme='orchard'], [data-q-theme='orchard'] { --bg: #f6efe6; --surface: #fbf6ef; --ink: #2e2a22; --muted: #877c6b; --line: #e8dfd0; --accent: #c44536; --accent-soft: #e8dfd0; --opp: #4a7c59; --opp-soft: #e8dfd0; --bad: #a3281c; }
:root[data-q-theme='orchard'] { color-scheme: light; }
:root[data-q-theme='void'], [data-q-theme='void'] { --bg: #000000; --surface: #0b0b0b; --ink: #f2f2f2; --muted: #6b6b6b; --line: #1d1d1d; --accent: #ffffff; --accent-soft: #1d1d1d; --opp: #8a8a8a; --opp-soft: #1d1d1d; --bad: #ff6b6b; }
:root[data-q-theme='void'] { color-scheme: dark; }

/* theme picker: one pill per theme, painted in its own colors */
.themes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.swatch { grid-auto-flow: column; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 10px; }
.swatch .sw-name { font-size: 14px; color: var(--accent); }
.swatch .sw-dots { display: inline-flex; gap: 4px; }
.swatch .sw-dots i { width: 8px; height: 8px; border-radius: 50%; display: block; }
footer .foot-mark { font-family: var(--mono); font-size: 13px; letter-spacing: -0.02em; color: var(--muted); }
footer .foot-mark b { color: var(--accent); font-weight: 500; }

/* game prefs */
.hud .score { font-family: var(--game-font, var(--mono)); }
.hud .pace { font-size: 12px; color: var(--muted); }
.font-preview { justify-content: flex-start; margin: 4px 0 22px; font-size: calc(36px * var(--psize, 1)); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 360px; margin: 0 auto; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.keypad button { padding: 16px 0; font: 500 22px var(--game-font, var(--mono)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.keypad button:active { background: var(--line); }
.keypad [data-key=clear], .keypad [data-key=del] { color: var(--muted); }
:root[data-q-motion='reduce'] *, :root[data-q-motion='reduce'] *::before, :root[data-q-motion='reduce'] *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.game.has-keypad .stage { min-height: 22vh; }
.game.has-keypad + * , .game.has-keypad #hint { margin-top: 10px; }

/* privacy policy and sign-up agreement */
.policy { max-width: 640px; }
.policy h2 { margin-top: 34px; }
.policy p, .policy li { line-height: 1.65; }
.policy ul { padding-left: 20px; margin: 0; display: grid; gap: 8px; }
.policy b { font-weight: 500; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 0 10px; cursor: pointer; }
.agree input { margin-top: 3px; accent-color: var(--accent); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--ink); }
