:root {
  --bg: #0f1530;
  --panel: #19224a;
  --ink: #eef1ff;
  --muted: #a9b2d8;
  --accent: #ff7a59;
  --accent-ink: #1b0b05;
  --good: #5be0a5;
  --bad: #ff6b81;
  --line: #2c3868;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1ff;
    --panel: #ffffff;
    --ink: #141a3a;
    --muted: #4b567f;
    --accent: #e8552f;
    --accent-ink: #ffffff;
    --good: #0b8a55;
    --bad: #c4233f;
    --line: #c8cfee;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
#app { max-width: 420px; margin: 0 auto; padding: 12px 16px 32px; }
.top { text-align: center; }
h1 { margin: 8px 0 0; font-size: 2rem; letter-spacing: 0.02em; }
h2 { margin: 12px 0; }
.status { min-height: 1.2em; margin: 2px 0 8px; font-size: 0.8rem; color: var(--muted); }
.screen { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.screen[hidden], [hidden] { display: none !important; }
.banner { margin: 0 0 6px; font-weight: 700; color: var(--accent); text-align: center; }
.banner:empty, .motd:empty { display: none; }
.motd { margin: 0 0 6px; text-align: center; color: var(--muted); }
.lead { text-align: center; }
.small { font-size: 0.85rem; color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; margin: 4px 0; font-size: 0.9rem; }
.best { color: var(--good); font-weight: 700; min-height: 1.2em; }
.score-line { font-size: 1.6rem; margin: 4px 0; }
label { display: block; margin: 10px 0 4px; font-size: 0.9rem; color: var(--muted); }
input, textarea { width: 100%; padding: 10px; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
button { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; min-height: 44px; touch-action: manipulation; }
button:hover { border-color: var(--accent); }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
button.big { width: 100%; font-size: 1.3rem; padding: 14px; margin: 8px 0; }
button.danger { border-color: var(--bad); color: var(--bad); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.row > button { flex: 1 1 120px; }
.hud { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
.field { position: relative; width: 100%; max-width: 360px; aspect-ratio: 360 / 520; margin: 0 auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.bubble { position: absolute; left: 0; top: 0; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #fff8, var(--accent) 60%); border: 2px solid #fff6; will-change: transform; cursor: pointer; }
.bubble.pop { pointer-events: none; opacity: 0; transition: opacity 120ms; }
.tabs { display: flex; gap: 8px; }
.tab { flex: 1; }
.tab.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.board { list-style: none; padding: 0; margin: 12px 0; }
.board li { display: flex; justify-content: space-between; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.board li.me { color: var(--good); font-weight: 700; }
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal .card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; max-width: 380px; width: 100%; }
a { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .bubble.pop { transition: none; } }
