/* Kittydoku — warm cream and orange; region fills are 11 soft pastels (g0..g10). */
:root { --bg: #fff4e6; --panel: #ffffff; --fg: #3a2a1f; --muted: #8a7566; --border: #e6d3bf; --accent: #ff8a3d; --line: #5a3d2b; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
body { display: flex; flex-direction: column; min-height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); min-height: 52px; }
.top .left, .top .right { display: flex; gap: 8px; align-items: center; }
.top .right { justify-content: flex-end; }
.top h1 { margin: 0; font-size: 20px; letter-spacing: .04em; font-weight: 800; }
.top h1 b { color: var(--accent); }
.icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--panel); font-weight: 700; display: grid; place-items: center; padding: 0; }
.chip { border: 1px solid var(--border); background: var(--panel); border-radius: 999px; padding: 6px 12px; font-size: 13px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.active, .chip.primary { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--panel)); color: var(--fg); }
main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 8px max(10px, env(safe-area-inset-bottom)); gap: 10px; min-height: 0; }
.toast { position: fixed; top: 150px; left: 50%; transform: translateX(-50%); background: var(--line); color: #fff8f0; font-weight: 700; padding: 10px 16px; border-radius: 8px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 5; }
.toast.show { opacity: 1; }
.dlg { background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; width: min(92vw, 420px); }
.dlg::backdrop { background: rgba(58,42,31,.55); }
.dlg h2 { margin: 0 0 10px; }
.dlg p, .dlg li { color: #5a4a3f; font-size: 15px; line-height: 1.45; }
.dlg .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.dlg .big { font-size: 40px; font-weight: 800; text-align: center; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 8px 0; }
.stats b { display: block; font-size: 24px; }
.stats span { color: var(--muted); font-size: 12px; }
.hud { display: flex; gap: 14px; justify-content: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.hud b { color: var(--fg); }
.hud .hearts { color: #e5484d; letter-spacing: 1px; }
.pad { display: grid; gap: 6px; width: min(100vw - 16px, 520px); user-select: none; }
.pad button { height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-weight: 700; font-size: 14px; touch-action: manipulation; }
.pad button:active, .pad button.on { background: color-mix(in srgb, var(--accent) 30%, var(--panel)); border-color: var(--accent); }
.tools { grid-template-columns: repeat(5, 1fr); }
.toggles { grid-template-columns: repeat(2, 1fr); }
.toggles button { height: 38px; font-size: 13px; color: var(--muted); }
.toggles button.on { color: var(--fg); }

.levels { display: flex; justify-content: center; gap: 6px; padding: 10px 6px 2px; flex-wrap: wrap; }
.lvl { color: var(--muted); }
.lvl.active { color: var(--fg); }
.board { --n: 7; --cell: min(calc((100vw - 24px) / var(--n)), 56px); display: grid; grid-template-columns: repeat(var(--n), var(--cell)); grid-template-rows: repeat(var(--n), var(--cell)); gap: 0; border: 3px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); touch-action: manipulation; }
.cell { position: relative; display: grid; place-items: center; font-size: calc(var(--cell) * 0.58); line-height: 1; user-select: none; cursor: pointer; border-right: 1px solid rgba(90,61,43,.18); border-bottom: 1px solid rgba(90,61,43,.18); }
.cell.eR { border-right: 3px solid var(--line); } .cell.eB { border-bottom: 3px solid var(--line); }
.cell.peer::after { content: ""; position: absolute; inset: 0; background: rgba(90,61,43,.07); pointer-events: none; }
.cell.sel::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--accent); pointer-events: none; }
.cell.bad, .cell.wrong { color: #e5484d; }
.cell.bad::before, .cell.wrong::before { content: ""; position: absolute; inset: 0; background: rgba(229,72,77,.22); pointer-events: none; }
.cell.hint { animation: flash .6s ease; }
.board.won .cell { animation: hop .5s ease; }
.g0 { background: #ffd6a5; } .g1 { background: #caffbf; } .g2 { background: #a0c4ff; } .g3 { background: #ffadad; } .g4 { background: #fdffb6; }
.g5 { background: #bdb2ff; } .g6 { background: #9bf6ff; } .g7 { background: #ffc6ff; } .g8 { background: #e2c290; } .g9 { background: #b5ead7; } .g10 { background: #f1e3ff; }
@keyframes flash { from { filter: brightness(1.4); } }
@keyframes hop { 30% { transform: translateY(-6px); } }
@media (min-width: 700px) { main { padding-top: 16px; } .board { --cell: min(calc((100vh - 300px) / var(--n)), 56px); } }
