:root {
  --bg: #0e1620;
  --panel: #15202b;
  --cell: 34px;
  --gap: 2px;
  --given: #e8eef5;
  --empty: #1f2a36;
  --sel: #2f6fa3;
  --bad: #a33;
  --zero: #7ec8e3;
  --one: #f0b060;
  --text: #e8eef5;
  --muted: #8aa0b8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, sans-serif; }
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); flex-wrap: wrap; }
.title { font-weight: 700; font-size: 16px; }
.title small { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 4px; }
#tiers { display: flex; gap: 4px; }
.btn { border: 1px solid #2a3a4a; background: #1c2a38; color: var(--text); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn.tier { padding: 4px 8px; }
.spacer { flex: 1; }
.hud { display: flex; gap: 8px; font-size: 13px; align-items: center; flex-wrap: wrap; }
.hud .opt { color: var(--muted); font-size: 11px; }
#board { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px; min-height: 0; overflow: hidden; }
#grid { display: grid; gap: var(--gap); background: #0a1018; }
.cell { width: var(--cell); height: var(--cell); display: flex; align-items: center; justify-content: center; font-size: calc(var(--cell) * 0.55); font-weight: 700; user-select: none; border: none; cursor: pointer; border-radius: 4px; background: var(--empty); color: var(--text); }
.cell.given { background: #2a3a4a; color: var(--given); cursor: default; }
.cell.zero { color: var(--zero); }
.cell.one { color: var(--one); }
.cell.bad { background: var(--bad); }
.cell.sel { outline: 2px solid var(--sel); }
#pad { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; background: var(--panel); justify-content: center; }
#pad .btn { min-width: 40px; }
.toolbar { display: flex; gap: 4px; padding: 8px 10px; background: var(--panel); flex-wrap: wrap; justify-content: center; }
.rules { padding: 10px 14px; background: var(--panel); font-size: 13px; display: none; }
.rules.open { display: block; }
.rules ul { margin: 6px 0; padding-left: 18px; }
.rules p { color: var(--muted); margin: 6px 0 0; }
@media (max-width: 600px) {
  :root { --cell: 26px; }
  .topbar { padding: 6px 8px; }
  .hud { font-size: 11px; }
}
