:root { --cell: 72px; --gap: 2px; --bg: #0e1620; --panel: #16212e; --ink: #e8eef5; --muted: #8fa3b8; --accent: #4f9cf9; --bad: #e05a5a; --given: #9bbcff; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, sans-serif; overflow: hidden; }
#app { display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--panel); flex-wrap: wrap; }
.title { font-weight: 700; font-size: 16px; } .title small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.spacer { flex: 1; }
#tiers { display: flex; gap: 4px; }
.btn.tier { padding: 4px 8px; font-size: 12px; }
.hud { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.hud b { color: var(--ink); margin: 0 2px; }
#board { flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px; min-height: 0; }
#grid { display: grid; grid-template-columns: repeat(var(--cols,4), var(--cell)); grid-template-rows: repeat(var(--rows,4), var(--cell)); gap: var(--gap); }
.cell { position: relative; width: var(--cell); height: var(--cell); background: #1c2a3a; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cell)*0.4); font-weight: 600; cursor: pointer; user-select: none; border-radius: 4px; }
.cell.given { color: var(--given); cursor: default; }
.cell.empty { color: var(--ink); }
.cell.selected { outline: 2px solid var(--accent); }
.cell.bad { background: #3a1f22; color: var(--bad); }
.cage-clue { position: absolute; top: 2px; left: 4px; font-size: calc(var(--cell)*0.18); color: var(--muted); font-weight: 700; pointer-events: none; }
.cb-top { border-top: 3px solid #4f9cf9; }
.cb-bottom { border-bottom: 3px solid #4f9cf9; }
.cb-left { border-left: 3px solid #4f9cf9; }
.cb-right { border-right: 3px solid #4f9cf9; }
#pad { display: flex; gap: 6px; padding: 8px 12px; justify-content: center; background: var(--panel); }
#pad .btn { min-width: 44px; min-height: 44px; font-size: 18px; }
#statusbar { padding: 8px 12px; background: var(--panel); }
#status { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.btn { background: #243447; color: var(--ink); border: 1px solid #3a4f66; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
#win { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; }
#win.hidden { display: none; }
.win-card { background: var(--panel); padding: 24px; border-radius: 12px; text-align: center; max-width: 90%; }
.win-label { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.win-body { color: var(--muted); margin-bottom: 16px; }
