:root{--bg:#14122b;--panel:#1f1c40;--line:#34306a;--text:#f2f0ff;--muted:#a7a2d6;--accent:#ffcc4d;color:var(--text);background:var(--bg);-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif}*{box-sizing:border-box}html,body{overscroll-behavior:none;height:100%;margin:0}#app{max-width:520px;height:100dvh;padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom);flex-direction:column;margin:0 auto;display:flex}header{justify-content:space-around;padding:16px 12px 4px;display:flex}.stat{font-variant-numeric:tabular-nums;flex-direction:column;align-items:center;font-size:22px;font-weight:800;display:flex}.stat-btn{color:inherit;font:inherit;cursor:pointer;touch-action:manipulation;background:0 0;border:0;border-radius:12px;padding:0 10px;font-size:22px;font-weight:800}.stat-btn[aria-expanded=true]{background:var(--line)}.wave-drop{left:50%;top:calc(80px + env(safe-area-inset-top));z-index:20;background:var(--panel);border:1px solid var(--line);border-radius:14px;width:min(320px,100% - 32px);padding:10px 14px;position:absolute;transform:translate(-50%);box-shadow:0 10px 30px #00000073}.wave-drop[hidden]{display:none}.wave-drop h3{margin:2px 0 6px;font-size:15px}.wave-drop section+section{border-top:1px solid var(--line);margin-top:8px;padding-top:8px}.drop-row{color:var(--muted);justify-content:space-between;gap:12px;padding:5px 0;font-size:14px;display:flex}.drop-row strong{color:var(--text);font-variant-numeric:tabular-nums}.label{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-size:12px;font-weight:600}.gold{color:var(--accent)}.status{text-align:center;color:var(--muted);min-height:20px;padding-bottom:6px;font-size:14px}.stage{flex:1 1 0;min-height:0;display:flex;position:relative}main{flex:1 1 0;justify-content:center;min-height:0;padding:0 8px 8px;display:flex;position:relative}.board{aspect-ratio:100/170;border-radius:14px;max-width:100%;height:100%;display:block}#map{touch-action:none}#map.shake{animation:.2s ease-out shake}@keyframes shake{25%{transform:translate(-3px)}75%{transform:translate(3px)}}.road{fill:none;stroke:#8a6a45;stroke-width:5px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:.8;pointer-events:none}.lane{fill:none;stroke:#b8956a;stroke-width:.6px;stroke-dasharray:2 2}.road.locked{stroke:#4d7f3b}.lane.locked{stroke:#6a9a55}.road,.lane{transition:d .3s}.entry{fill:#ff5d73;stroke:#14122b;stroke-width:.3px}.entry.locked{fill:#3a345f}.wall{pointer-events:none}.wall.ghost{opacity:.45}.enemy .bar-bg{fill:#14122b}.enemy .bar{fill:#5fe39a}.float{text-anchor:middle;pointer-events:none;font-size:4px;font-weight:800;animation:.8s ease-out forwards rise}.float.gold{fill:var(--accent)}.cell{fill:none;stroke:none}#cells.show .cell:not(.taken){stroke:#2f5a26;stroke-width:.4px;stroke-dasharray:1.2 1}#cells.show.affordable .cell:not(.taken){stroke:var(--accent);animation:1.4s ease-in-out infinite glow}@keyframes glow{50%{stroke-opacity:.35}}.cursor{fill:none;stroke:#fff;stroke-width:.6px;pointer-events:none}.cursor[hidden]{display:none}.tower{pointer-events:none}.tower.ghost{opacity:.45}.move-line{stroke:#fff;stroke-opacity:.5;stroke-width:.4px;stroke-dasharray:1 1;pointer-events:none}.lvl{text-anchor:middle;pointer-events:none;fill:#fff;paint-order:stroke;stroke:#14122b;stroke-width:.6px;font-size:3px;font-weight:800;transform:translate(3px,2.6px)}.range{fill:#8fd3ff14;stroke:#8fd3ff80;stroke-width:.4px;pointer-events:none}.shot{stroke:#8fd3ff;stroke-width:.7px;stroke-linecap:round;pointer-events:none}@keyframes rise{to{opacity:0;transform:translateY(-5px)}}.hint{color:var(--muted);text-align:center;margin:14px 0;font-size:14px}.group{color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:12px 0 4px;font-size:12px;font-weight:700}.panel{min-height:72px}.row{justify-content:space-between;align-items:center;gap:10px;padding:8px;display:flex}h2{margin:0;font-size:18px}ul{margin:0;padding:0;list-style:none}li{border-top:1px solid var(--line);justify-content:space-between;align-items:center;gap:10px;padding:12px 8px;display:flex}li[hidden]{display:none}.meta{font-size:15px;line-height:1.4}.owned{color:var(--accent);font-weight:700}.info{color:var(--muted);font-size:13px}.buy{background:var(--accent);min-width:96px;color:var(--bg);touch-action:manipulation;border:0;border-radius:12px;padding:12px 10px;font-size:15px;font-weight:800}.buy:disabled{background:var(--line);color:var(--muted)}.link{color:var(--muted);background:0 0;border:0;font-size:12px;text-decoration:underline}.toast{left:50%;top:calc(16px + env(safe-area-inset-top));background:var(--accent);color:var(--bg);border-radius:12px;padding:10px 16px;font-weight:700;position:fixed;transform:translate(-50%)}#range[hidden]{display:none}.btns{gap:8px;display:flex}.buy.alt{background:var(--line);min-width:64px;color:var(--text,#fff)}#base{cursor:pointer}#map.surging .shot{stroke:#ffe27a;stroke-width:1px}.bolt{fill:none;stroke:#c9b6ff;stroke-width:1px;stroke-linejoin:round;pointer-events:none;filter:drop-shadow(0 0 1px #fff)}.float.dmg{fill:#c9b6ff}.spells{pointer-events:none;justify-content:center;gap:10px;display:flex;position:absolute;bottom:20px;left:0;right:0}.spells .spell{pointer-events:auto;box-shadow:0 4px 12px #00000073}.spell{color:#fff;touch-action:manipulation;background:#6d5bd0;border:0;border-radius:12px;min-width:96px;padding:10px 14px;font-size:15px;font-weight:800;position:relative;overflow:hidden}.spell[hidden]{display:none}.spell:disabled{background:var(--line);color:var(--muted)}.spell.active{color:var(--bg);background:#ffcc4d}.spell .cd{transform-origin:0;transform:scaleX(var(--cd,0));background:#00000059;position:absolute;inset:0}.spell .name{position:relative}.spells:not(:has(.spell:not([hidden]))){display:none}.buy{white-space:nowrap;flex-shrink:0;width:auto}.toolbar{justify-content:center;gap:6px;padding:0 8px 8px;display:flex}.toolbar button{color:var(--muted);border:1px solid var(--line);background:0 0;border-radius:999px;padding:6px 12px;font-size:13px;font-weight:700}.toolbar button.open{background:var(--line);color:var(--text)}.toolbar button.active{border-color:var(--accent);color:var(--accent)}.stepper{justify-content:center;align-items:center;gap:6px;padding:4px 8px 8px;display:flex}.stepper span{text-align:center;min-width:90px;font-size:18px;font-weight:800}.stepper button,.toggle{color:var(--text);border:1px solid var(--line);background:0 0;border-radius:10px;padding:8px 10px;font-weight:700}.toggle.on{color:#5fe39a;border-color:#5fe39a}.chunks{grid-template-columns:repeat(4,1fr);gap:6px;padding:0 8px 8px;display:grid}.chunks .buy{min-width:0}.sim{z-index:10;background:#0a0919eb;justify-content:center;align-items:center;padding:16px;display:flex;position:fixed;inset:0}.sim[hidden]{display:none}.sim-card{background:var(--panel);text-align:center;border-radius:18px;width:min(420px,100%);padding:20px}.sim-card h2{margin-bottom:14px}.sim-card p{color:var(--muted);font-size:14px;line-height:1.6}.simbar{background:var(--line);border-radius:5px;height:10px;overflow:hidden}.simbar>div{background:var(--accent);width:0;height:100%}main[hidden]{display:none}.sprite-defs{width:0;height:0;position:absolute;overflow:hidden}#home{touch-action:manipulation}.plot{cursor:pointer}.plot-bg{fill:#3a5c3f;stroke:#4f7a55;stroke-width:.5px;stroke-dasharray:1.5 1.2}.plot.has .plot-bg{fill:#6b5a4c;stroke:#8a7563;stroke-dasharray:none}.plot.selected .plot-bg{stroke:#fff;stroke-width:.9px}.bld-name{text-anchor:middle;fill:#fff;paint-order:stroke;stroke:#14122b;stroke-width:.6px;pointer-events:none;font-size:2.2px;font-weight:800}.spells.off{display:none}.screens{background:var(--panel);border-top:1px solid var(--line);gap:6px;padding:8px 12px;display:flex}.screens button{color:var(--muted);touch-action:manipulation;background:0 0;border:0;border-radius:12px;flex:1;padding:10px 6px;font-size:15px;font-weight:800}.screens button.active{background:var(--line);color:var(--text)}.sheet{z-index:5;background:var(--panel);border:1px solid var(--line);border-radius:16px;max-height:62%;padding:10px 8px 6px;position:absolute;bottom:16px;left:12px;right:12px;overflow-y:auto;box-shadow:0 8px 28px #0000008c}.sheet.top{top:8px;bottom:auto}.sheet[hidden]{display:none}.sheet .panel{min-height:0;padding-right:28px}.sheet-close{width:32px;height:32px;color:var(--muted);z-index:1;background:0 0;border:0;border-radius:10px;font-size:16px;font-weight:800;position:absolute;top:6px;right:6px}.settings{flex-direction:column;justify-content:flex-start;padding:4px 12px 12px;overflow-y:auto}.settings h2{padding:8px}.buy.danger{color:#fff;background:#e0566b}.build{color:var(--muted);text-align:center;margin:18px 0 8px;font-size:12px}.shards{color:#7fe3ff}.float.shard{fill:#7fe3ff}.trap{pointer-events:none}.trap.ghost{opacity:.45}.trapfx{fill:none;stroke-width:.8px;pointer-events:none;animation:.3s ease-out forwards pop}.trapfx.freeze{stroke:#9ff0ff}.trapfx.spike{stroke:#e8d9b0}@keyframes pop{0%{transform-box:fill-box;transform-origin:50%;transform:scale(.4)}to{transform-box:fill-box;transform-origin:50%;opacity:0;transform:scale(1.3)}}.enemy.slowed use{filter:hue-rotate(160deg)saturate(.7)brightness(1.2)}.enemy.boss .bar{fill:#ffcc4d}.enemy.juggernaut .bar{fill:#b8b0c8}.plot.unbuilt>use{opacity:.35}.plot.unbuilt .plot-bg{fill:#3a5c3f;stroke:#8a7563;stroke-dasharray:1.5 1.2}.wave-drop .row.hex{padding:4px 0}.wave-drop .meta{font-size:14px}.wave-drop .stepper{padding:0}.wave-drop .stepper span{min-width:44px;font-size:15px}.wave-drop .stepper button{min-width:36px}.wave-drop .stepper button:disabled{opacity:.35}.wave-drop section:empty{display:none}.raids{flex-direction:column;align-items:stretch}.raid-board{flex:1 1 0;justify-content:center;min-height:0;display:flex}#raidMap{touch-action:manipulation}.raid-panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;flex:none;max-height:46%;margin-top:8px;padding:6px 4px;overflow-y:auto}.raid-panel .hint{margin:8px 0}.raid-panel .row{padding:6px 8px}.raid-pick{padding:2px 8px 0}.raid-pick span{flex:1;min-width:0;font-size:16px}.raid-reward{text-align:center;margin:0 0 4px}.army-row{justify-content:space-between;align-items:center;gap:10px;padding:2px 8px;font-size:15px;display:flex}.army-row.locked{color:var(--muted);padding:8px}.army-row .stepper{padding:0}.army-row .stepper span{min-width:36px;font-size:16px}.army-row .stepper button{min-width:38px}.stepper button:disabled{opacity:.35}.raid-entry{cursor:pointer}.raid-entry path{fill:#3a345f;stroke:#14122b;stroke-width:.3px}.raid-entry.chosen path{fill:#5fe39a}.raid-entry.locked{pointer-events:none}.raid-road{stroke:#5a4a30}.castle-bar{fill:#e0566b;transition:width .2s}.enemy-shot{stroke:#ff9f6b}.unit .bar{fill:#8fd3ff}.castle-track{fill:#34306a}.chain{fill:none;stroke:#bff0ff;stroke-width:.8px;stroke-linejoin:round;pointer-events:none;filter:drop-shadow(0 0 1px #7fd4ff)}#map.surging .chain{stroke:#ffe27a}.range.amp{fill:#ffcc4d1a;stroke:#ffcc4d99}.bmenu{z-index:6;background:var(--panel);border:1px solid var(--line);border-radius:16px;flex-direction:column;display:flex;position:absolute;inset:0 8px 8px;overflow:hidden}.bmenu[hidden]{display:none}.bmenu-bar{justify-content:space-between;padding:8px 8px 0;display:flex}.bmenu-btn{color:var(--text);border:1px solid var(--line);background:0 0;border-radius:10px;padding:8px 12px;font-size:14px;font-weight:700}.bmenu-title{border-bottom:1px solid var(--line);align-items:center;gap:12px;padding:10px 16px 12px;display:flex}.bmenu-icon{background:#6b5a4c;border-radius:12px;flex-shrink:0;width:56px;height:56px}.bmenu-title h2{margin:0 0 2px;font-size:20px}.bmenu-title .info{margin:0}.bmenu-body{flex:auto;padding:6px 8px 12px;overflow-y:auto}#homeView.moving .plot{cursor:copy}#homeView.moving .plot-bg{stroke:var(--accent);stroke-dasharray:none}#homeView.moving .plot.selected .plot-bg{stroke:#fff;stroke-width:1.2px}.grid-lines{opacity:0;pointer-events:none;transition:opacity .15s}.grid-lines.show{opacity:1}#homeView:not(.moving) .plot:not(.has) .plot-bg{opacity:0}.join{pointer-events:none}.removing{opacity:.4}.buy.alt.remove{color:#ff8a9a}.speed{z-index:2;flex-direction:column;align-items:flex-start;gap:8px;display:flex;position:absolute;bottom:20px;left:16px}.speed-btn{width:48px;height:48px;color:var(--text);touch-action:manipulation;background:#1f1c40e6;border:0;border-radius:12px;font-size:16px;font-weight:800;box-shadow:0 4px 12px #00000073}.speed-btn.on{background:var(--accent);color:var(--bg)}.speed-btn.restart{color:#fff;white-space:nowrap;background:#6d5bd0;width:auto;height:40px;padding:0 12px;font-size:14px}.speed-btn[hidden]{display:none}
