:root{--bg:#10181d;--panel:#18242b;--line:#26363f;--text:#e6eef2;--muted:#8ea3ae;--accent:#2fb4ff;--good:#3ddc84;--warn:#ffb020;--bad:#ff5a5a;color:var(--text);background:var(--bg);font-family:system-ui,Segoe UI,Roboto,sans-serif}*{box-sizing:border-box}html,body{background:var(--bg);overscroll-behavior:none;min-height:100%;margin:0}#app{max-width:560px;padding:12px 10px calc(16px + env(safe-area-inset-bottom));-webkit-user-select:none;user-select:none;flex-direction:column;gap:10px;margin:0 auto;display:flex}.hud{grid-template-columns:.8fr 1.3fr 1.2fr 2fr auto;gap:6px;display:grid}.hud-pause{flex:none;align-self:stretch;padding:0 14px;font-size:18px}.stat{background:var(--panel);border:1px solid var(--line);border-radius:10px;flex-direction:column;min-width:0;padding:6px 8px;display:flex}.stat span{color:var(--muted);text-transform:uppercase;letter-spacing:.04em;font-size:11px}.stat b{font-variant-numeric:tabular-nums;white-space:nowrap;text-overflow:ellipsis;font-size:17px;overflow:hidden}.play{grid-template-columns:1.25fr 9fr;align-items:end;gap:8px;display:grid;position:relative}.board-svg,.queue-svg{touch-action:manipulation;width:100%;height:auto;display:block}.board-svg{cursor:pointer;background:#0b1114;border-radius:10px}.cell{fill:var(--panel);stroke:var(--line);stroke-width:2px}.cell.next{stroke:var(--accent);stroke-width:5px}.pipe-shell,.pipe-bore,.water{fill:none;stroke-linecap:butt}.pipe-shell{stroke:#070b0d;stroke-width:44px}.pipe-bore{stroke:#5d7380;stroke-width:30px}.water{stroke:var(--accent);stroke-width:30px}.cap{stroke:#070b0d;stroke-width:7px}.cap-source{fill:var(--good)}.cap-drain{fill:var(--warn)}.cap-core{fill:#070b0d}.cap-core-source{fill:var(--accent)}.cursor{fill:none;stroke:#fff;stroke-width:5px;stroke-dasharray:16 10;pointer-events:none}.cursor.blocked{stroke:var(--muted)}.cursor.locked{stroke:var(--bad);stroke-dasharray:none}.overlay{background:#080c0fb8;border-radius:10px;place-items:center;display:grid;position:absolute;inset:0}.overlay[hidden]{display:none}.panel{background:var(--panel);border:1px solid var(--line);text-align:center;border-radius:14px;width:min(86%,340px);padding:18px 20px}.panel h2{margin:0 0 6px;font-size:24px}.panel p{color:var(--muted);margin:0 0 10px}.panel .end-score{color:var(--text);font-size:18px}.buttons,.controls{gap:8px;display:flex}button{font:inherit;color:var(--text);background:var(--panel);border:1px solid var(--line);cursor:pointer;touch-action:manipulation;border-radius:12px;flex:1;padding:14px 10px;font-weight:600}button.primary{background:var(--accent);border-color:var(--accent);color:#04202f}button:disabled{opacity:.45;cursor:default}button[hidden]{display:none}kbd{font:inherit;opacity:.7;border:1px solid;border-radius:5px;margin-left:4px;padding:0 5px;font-size:12px}.hint{color:var(--muted);margin:0;font-size:13px;line-height:1.45}@media (hover:none){kbd{display:none}}.tutor{border:1px solid var(--accent);background:#10293a;border-radius:12px;padding:10px 12px}.tutor[hidden],.hint[hidden],.end-score[hidden]{display:none}.tutor p{min-height:7.3em;margin:0 0 8px;font-size:15px;line-height:1.45}.tutor-foot{color:var(--muted);justify-content:space-between;align-items:center;gap:8px;font-size:13px;display:flex}.tutor-foot button{background:0 0;flex:none;padding:8px 12px;font-size:13px;font-weight:500}button.small{flex:none;width:52px}.hint-cell{fill:#2fb4ff38;stroke:var(--accent);stroke-width:6px;pointer-events:none;animation:.9s ease-in-out infinite blink}button.pulse{animation:.9s ease-in-out infinite blink}@keyframes blink{50%{opacity:.35}}.game{flex-direction:column;gap:10px;display:flex}.game[hidden],.levels[hidden],.goals[hidden],.stars[hidden]{display:none}.goals{flex-wrap:wrap;gap:6px;display:flex}.goal{text-align:center;border:1px solid var(--line);color:var(--muted);white-space:nowrap;border-radius:8px;flex:1;padding:5px 4px;font-size:13px}.goal.reached{color:#201500;background:var(--warn);border-color:var(--warn);font-weight:600}.goal.lost{opacity:.45;text-decoration:line-through}.stars{color:var(--warn);letter-spacing:.08em}.stars.big{margin-bottom:4px;font-size:34px;line-height:1.2}.buttons.wrap{flex-wrap:wrap}.buttons.wrap button{flex:40%;padding:12px 8px}.levels{flex-direction:column;gap:12px;display:flex}.levels h1{margin:8px 0 0;font-size:30px}.levels-sub{color:var(--muted);margin:0;line-height:1.45}.level-grid{grid-template-columns:repeat(5,1fr);gap:8px;display:grid}.level-btn{flex-direction:column;align-items:center;gap:2px;padding:10px 2px;display:flex}.level-btn b{font-size:19px}.level-btn .stars{letter-spacing:0;font-size:12px}.level-btn.current{border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}.side{flex-direction:column;justify-content:flex-end;gap:8px;display:flex}.hold-svg{cursor:pointer}.hold-cell{stroke-dasharray:6 6}.hold-label{fill:var(--muted,#8a9aa3);font-size:22px;font-weight:600}.water.dirty{stroke:#a9753a}.cap-core-source.dirty{fill:#a9753a}.filter-box{fill:#1f6f4a;stroke:#070b0d;stroke-width:5px}.filter-mesh{stroke:#8ff0b8;stroke-width:4px;stroke-linecap:round;opacity:.8}.note{color:var(--text);background:#1b2e25;border:1px solid #2d5a42;border-radius:10px;margin:0;padding:8px 12px;font-size:.85rem}.note[hidden]{display:none}.chapter{margin:14px 0 6px;font-size:1.05rem}.tank-body{fill:#1c4a73;stroke:#070b0d;stroke-width:6px}.tank-wave{fill:none;stroke:#7cc4ff;stroke-width:4px;stroke-linecap:round;opacity:.85}.hold-svg .hold-cell{stroke:#4a6270;stroke-width:3px;stroke-dasharray:none}.hold-tag{fill:var(--muted);font-size:18px;font-weight:700}.hold-svg.glow .hold-cell{stroke:var(--warn);stroke-width:6px;animation:1s ease-in-out infinite glow}@keyframes glow{50%{stroke-opacity:.3}}button.pulse-soft{border-color:var(--warn);animation:1s ease-in-out infinite glow}.hint-msg{color:var(--text);background:#2d2a17;border:1px solid #6b5a1f;border-radius:10px;margin:0;padding:8px 12px;font-size:.9rem}.hint-msg[hidden]{display:none}.flower{pointer-events:none;opacity:.8}.flower-bed{fill:#14281c;stroke:#4f9a4a;stroke-width:3px}.flower-petal{fill:#c9a0b4}.flower-core{fill:#c9b46a}.flower.watered{opacity:1}.flower.watered .flower-bed{stroke:#6ee08a}.flower.watered .flower-petal{fill:#ff7aa8}.flower.watered .flower-core{fill:#ffd86b}.district{margin:0 0 10px}.district-svg{border:1px solid var(--line);border-radius:10px;width:100%;display:block}.district-caption{color:var(--muted);margin:6px 0 0;font-size:.85rem}.level-btn .flower-mark{font-size:.7rem}.ghost{pointer-events:none;opacity:.6}.ghost-ring{fill:none;stroke:var(--good);stroke-width:4px;stroke-dasharray:10 6}.ghost-ring.overwrite{stroke:var(--warn)}.board-svg{touch-action:none}.setting{color:var(--muted);flex-direction:column;gap:6px;margin:8px 0;font-size:.85rem;display:flex}.tutor .tutor-touch{color:var(--muted);min-height:0;font-size:.8rem}.menu{text-align:center;flex-direction:column;align-items:center;gap:10px;padding-top:7vh;display:flex}.menu[hidden]{display:none}.menu-logo{border-radius:22px;box-shadow:0 6px 24px #2fb4ff40}.menu h1{margin:8px 0 0;font-size:34px}.menu-sub{color:var(--muted);margin:0 0 14px}.menu-buttons{flex-direction:column;gap:10px;width:min(100%,320px);display:flex}.menu-buttons button{flex:none;padding:16px 12px;font-size:1.05rem}.menu-buttons .primary{flex-direction:column;gap:2px;padding:18px 12px;font-size:1.25rem;display:flex}.menu-buttons small{opacity:.8;font-size:.8rem;font-weight:500}.menu-stats{color:var(--muted);margin:10px 0 0}.levels-head{align-items:center;gap:10px;display:flex}.levels-head h1{margin:0}.levels-head button{flex:none;width:46px;padding:10px 0}.tabs{gap:8px;display:flex}.tab{padding:10px 8px}.tab.active{background:var(--accent);border-color:var(--accent);color:#04202f}#pane-main,#pane-village{flex-direction:column;gap:12px;display:flex}#pane-main[hidden],#pane-village[hidden]{display:none}.overlay.fixed{z-index:20;border-radius:0;position:fixed}.panel .setting{margin:10px 0}.panel .buttons{margin-top:12px}.buttons.wrap .full{flex-basis:100%}@media (width<=480px){:root{--qcell:46px}#app{padding:8px 8px calc(10px + env(safe-area-inset-bottom));gap:8px}.game{gap:8px}.play{grid-template-columns:1fr;align-items:start}.board{order:1}.side{flex-direction:row;order:2;justify-content:center;align-items:center;gap:8px}.side .hold{width:var(--qcell)}.side .queue{width:calc(var(--qcell) * 5)}.hud{grid-template-columns:.7fr 1.1fr 1fr 2.2fr auto;gap:4px}.stat{padding:5px 6px}.stat b{font-size:16px}.hud-pause{padding:0 12px}.goal{padding:4px 2px;font-size:12px}.tutor p{font-size:14px}.note{padding:6px 10px;font-size:.78rem;line-height:1.35}.controls button{padding:11px 6px}}.board.shake{animation:.28s ease-in-out shake}@keyframes shake{20%{transform:translate(-5px)}40%{transform:translate(5px)}60%{transform:translate(-3px)}80%{transform:translate(3px)}}.fx{pointer-events:none}.splash-drop{fill:var(--accent);animation:.75s ease-out forwards splash-drop}@keyframes splash-drop{to{transform:translate(var(--dx), var(--dy));opacity:0}}.splash-ring{fill:none;stroke:var(--accent);stroke-width:6px;transform-box:fill-box;transform-origin:50%;animation:.6s ease-out forwards splash-ring}@keyframes splash-ring{to{opacity:0;transform:scale(3.2)}}.overlay.late:not([hidden]){animation:.3s .7s backwards overlay-in}@keyframes overlay-in{0%{opacity:0}}.confetti-layer{pointer-events:none;border-radius:10px;position:absolute;inset:0;overflow:hidden}.confetti{opacity:0;border-radius:2px;width:8px;height:12px;animation:2s ease-in forwards confetti-fall;position:absolute;top:-12px}@keyframes confetti-fall{0%{opacity:1;transform:translate(0)rotate(0)}to{opacity:.9;transform:translate(var(--drift), 420px) rotate(var(--spin))}}@media (prefers-reduced-motion:reduce){.board.shake,.splash-drop,.splash-ring,.overlay.late:not([hidden]),.confetti{animation:none}.confetti-layer{display:none}}.shuffle-btn{flex:none;width:100%;height:36px;padding:0;font-size:20px;line-height:1}.menu-buttons .with-sub{flex-direction:column;gap:2px;display:flex}.ad-overlay{z-index:30}.ad-box{border:2px dashed var(--line);height:120px;color:var(--muted);letter-spacing:.2em;border-radius:10px;place-items:center;margin:4px 0 6px;font-size:28px;font-weight:700;display:grid}@media (width<=480px){.side .shuffle-btn{width:var(--qcell);height:var(--qcell)}}@media (height<=700px){.menu{gap:6px;padding-top:2vh}.menu-logo{width:64px;height:64px}.menu h1{margin-top:2px;font-size:28px}.menu-sub{margin-bottom:6px}.menu-buttons{gap:8px}.menu-buttons button{padding:12px 10px}.menu-buttons .primary{padding:14px 10px}}.settings-link{margin:8px 0 0;font-size:.85rem}.settings-link a{color:var(--accent)}
