:root {
  --bg: #f5f6f8; --surface: #ffffff; --ink: #16191f; --muted: #5a6170; --line: #dfe2e8;
  --accent: #1f5fd0; --accent-ink: #ffffff; --warn-bg: #fff4e5; --warn-ink: #7a3a00;
  --ok-bg: #e7f3ec; --ok-ink: #14532d; --err-bg: #fdecec; --err-ink: #8a1c1c;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #12151b; --surface: #1a1e26; --ink: #eef0f4; --muted: #a3abba; --line: #2e3440;
    --accent: #7fa8f5; --accent-ink: #0d1320; --warn-bg: #3a2a12; --warn-ink: #ffd7a1;
    --ok-bg: #16301f; --ok-ink: #b6e6c6; --err-bg: #3a1717; --err-ink: #ffc4c4;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 960px; margin: 0 auto; padding: 0.75rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand span { color: var(--accent); }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; }
.topbar nav a { text-decoration: none; padding: 0.6rem 0; }
.container { max-width: 960px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; }
.narrow { max-width: 440px; margin: 0 auto; padding: 3rem 1.5rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem 1.4rem; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; min-height: 44px; padding: 0.5rem 0.7rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { display: inline-block; min-height: 44px; padding: 0 1.1rem; font: inherit; font-weight: 600; line-height: 44px;
  color: var(--accent-ink); background: var(--accent); border: 0; border-radius: 8px; cursor: pointer; text-decoration: none; }
.btn-secondary { color: var(--ink); background: transparent; border: 1px solid var(--line); line-height: 42px; }
.btn-link { background: none; border: 0; padding: 0.6rem 0; font: inherit; color: var(--accent); cursor: pointer; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; min-height: 44px; }
.alert { border-radius: 8px; padding: 0.7rem 0.9rem; }
.alert-ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert-err { background: var(--err-bg); color: var(--err-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); }
.field-error { color: var(--err-ink); font-size: 0.9rem; margin-top: 0.25rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-top: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; border-top: 0; }
.pill { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 0.85rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.codes { columns: 2; padding-left: 1.1rem; }
.break { overflow-wrap: anywhere; }
.qr svg { background: #fff; padding: 10px; border-radius: 8px; max-width: 100%; height: auto; }
textarea { width: 100%; min-height: 6rem; padding: 0.5rem 0.7rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
input[type=number] { width: 100%; max-width: 10rem; min-height: 44px; padding: 0.5rem 0.7rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.25rem 0 0; }
.token { display: block; padding: 0.7rem 0.9rem; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; }
.tile-label { color: var(--muted); font-size: 0.9rem; }
.tile-num { font-size: 2rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.tile-num.accent { color: var(--accent); }
.tile-num.warn { color: var(--warn-ink); }
.board { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.25rem; }
.board-main { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.board-side { flex: 1 1 250px; min-width: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.panel-head { padding: 0.9rem 1.2rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.panel-head h2 { margin: 0; }
.panel-warn { border-color: var(--warn-ink); }
.panel-warn .panel-head { background: var(--warn-bg); color: var(--warn-ink); }
.panel-empty { padding: 0 1.2rem 1rem; color: var(--muted); margin: 0; }
.brow { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; padding: 0.9rem 1.2rem; border-top: 1px solid var(--line); }
.brow-main { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.brow-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.brow-key { font-weight: 700; letter-spacing: 0.02em; }
.brow-needed { font-weight: 600; overflow-wrap: anywhere; }
.brow-age { flex: 0 0 5.5rem; }
.brow-age small { display: block; color: var(--muted); }
.brow .btn { flex: 0 0 auto; }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.bar { height: 8px; border-radius: 4px; background: var(--bg); }
.bar span { display: block; height: 8px; border-radius: 4px; background: var(--muted); }
.bar .you { background: var(--accent); }
.bar .stalled { background: var(--warn-ink); }
.holder { display: flex; flex-direction: column; gap: 0.3rem; }
.holder-line { display: flex; justify-content: space-between; gap: 0.75rem; }
.prose { white-space: pre-line; overflow-wrap: anywhere; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
input[type=time], input[type=date] { width: 100%; max-width: 14rem; min-height: 44px; padding: 0.5rem 0.7rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
