:root{color-scheme:light;--ink:#233f48;--muted:#71857d;--cream:#fffaf0;--line:#d9dac5;--teal:#5e8573;--gold:#a37e38;--coral:#b86d64;font-family:"Microsoft YaHei UI","Microsoft YaHei",system-ui,sans-serif;font-synthesis:none}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#388f94}button,a{-webkit-tap-highlight-color:transparent}button{font:inherit;cursor:pointer;border:1px solid var(--line);color:var(--ink);background:var(--cream);border-radius:10px;min-height:44px;transition:background .15s,box-shadow .15s}button:hover:enabled{background:#edf1df}button:disabled{opacity:.42;cursor:default}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #cfad62;outline-offset:2px}[hidden]{display:none!important}a{color:inherit;text-decoration:none}
.game-shell,.battle-wrap{position:fixed;inset:0;width:100%;height:100dvh;overflow:hidden}.battle-wrap{isolation:isolate;background:#419398}canvas{display:block;position:absolute;inset:0;width:100%;height:100%;touch-action:none;cursor:crosshair;outline:none}
.top-ui{position:absolute;left:max(12px,env(safe-area-inset-left));right:max(12px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));z-index:8;display:grid;grid-template-columns:175px minmax(0,1fr) auto;gap:16px;align-items:center;min-height:70px;padding:9px 13px;border:1px solid #e5ddbd;background:#fffaf0f2;box-shadow:0 5px 24px #143d492b;border-radius:16px;max-width:1400px;margin:auto}
.chapter{display:flex;align-items:center;gap:7px;min-width:0}.chapter img{width:42px;height:42px;object-fit:contain}.chapter b{display:block;font-size:14px;white-space:nowrap;letter-spacing:.5px}.chapter small{display:block;font-size:10px;color:#879078;margin-top:5px}.hud{display:grid;grid-template-columns:repeat(3,minmax(55px,1fr)) minmax(110px,1.5fr);gap:8px;align-items:center;min-width:0}.hud>div{padding:1px 10px;border-left:1px solid #e3e1cc}.hud small{display:block;font-size:10px;color:#859079;margin-bottom:4px}.hud strong{font-size:21px;font-weight:700;font-variant-numeric:tabular-nums}.hud em{font-size:11px;color:#929c85;font-style:normal;font-weight:400}.coral{color:var(--coral)}.gold{color:var(--gold)}.energy-stat small{display:flex;justify-content:space-between;gap:5px}.energy-track{height:7px;border-radius:8px;background:#e2dfeb;overflow:hidden;margin-top:9px}.energy-track i{display:block;width:70%;height:100%;background:linear-gradient(90deg,#a093bc,#b6a1d2);border-radius:8px;transition:width .15s}.view-tools{display:flex;align-items:center;gap:4px}.view-tools button{width:36px;min-height:40px;border:0;background:transparent;font-size:18px;color:#6a8076}.view-tools a{font-size:11px;margin-right:6px;color:#698676;white-space:nowrap}
.intel-toggle{position:absolute;right:16px;top:94px;z-index:6;padding:0 14px;min-height:37px;font-size:11px;color:#56776c;background:#fffaeaeF;border-color:#d8d7b6;box-shadow:0 3px 12px #163d491a}.sidebar{position:absolute;inset:0;z-index:10;pointer-events:none}.panel{pointer-events:auto;position:absolute;background:#fffaf0f7;border:1px solid #ded3ad;border-radius:16px;box-shadow:0 12px 38px #153e4940;padding:13px;color:var(--ink);scrollbar-width:thin;scrollbar-color:#b1b99b transparent}.dispatch-panel{width:292px;right:16px;top:140px;max-height:calc(100% - 245px);overflow:auto;overscroll-behavior:contain}.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px}.panel-heading button{width:32px;min-height:32px;border:0;background:transparent;color:#8e967e;font-size:22px}.pill{font-size:10px;color:#7c8d76;border:1px solid #e0dfc8;padding:5px 8px;border-radius:20px}.panel h2{font-family:Georgia,"STSong","SimSun",serif;font-size:20px;margin:5px 0 7px;letter-spacing:.5px}.description{font-size:11px;line-height:1.7;color:#71856f;margin:0 0 10px}.inspector-tabs{display:flex;gap:5px;border-radius:10px;padding:3px;background:#eeeede;margin-bottom:10px}.inspector-tabs button{flex:1;border:0;min-height:34px;background:transparent;font-size:12px;color:#7e8d75}.inspector-tabs button[aria-pressed=true]{background:#fffdf2;box-shadow:0 2px 6px #687b4820;color:#456956;font-weight:700}.tower-roster{display:grid;grid-template-columns:1fr 1fr;gap:8px}.tower-card{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:101px;border-radius:12px;background:#f0f2e5;padding:8px 6px}.tower-card img{width:49px;height:49px;object-fit:contain;filter:drop-shadow(0 3px 2px #163c4a15)}.tower-card strong{font-size:12px;margin:4px 0}.tower-card small{font-size:10px;color:#819174}.cost{color:var(--gold);font-size:12px}.tower-card .cost{position:absolute;right:6px;top:6px;background:#fff8dfcf;border-radius:7px;padding:2px 4px;font-size:10px}.tower-card .key{position:absolute;left:7px;top:7px;font-size:9px;color:#a0a68b}.tower-card.selected{border-color:#84a078;box-shadow:0 0 0 2px #a2bc7d44}.selected-hero{display:flex;gap:10px;align-items:center;background:#f0f2e5;border-radius:10px;padding:6px 9px}.selected-hero img{width:44px;height:44px;object-fit:contain}.selected-hero strong{display:block;font-size:12px}.selected-hero small{display:block;font-size:10px;line-height:1.7;color:#829076}.tower-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin:8px 0}.tower-stats div{border:1px solid #e5e4ce;background:#f7f6e8;padding:6px 8px;border-radius:8px}.tower-stats small{font-size:10px;display:block;color:#87937a}.tower-stats b{font-size:13px;line-height:1.9}.upgrade-button{display:block;width:100%;text-align:left;padding:10px;border-radius:10px;margin-top:7px;background:#edf2df;border-color:#d5dfbf}.upgrade-button b{font-size:12px;display:block}.upgrade-button small{font-size:10px;line-height:1.65;color:#73836c;display:block;margin-top:4px}.upgrade-button .cost{float:right;font-size:11px}.skill-button{width:100%;text-align:left;background:#eee8f6;border-color:#d4c9e3;padding:11px;color:#796294;border-radius:10px;margin:8px 0}.skill-button b{display:block;font-size:12px}.skill-button small{font-size:11px;line-height:1.7;display:block;margin-top:4px}.tower-actions{display:flex;gap:6px;margin-top:7px}.tower-actions button,.tower-actions select{min-width:0;flex:1;font:inherit;font-size:11px;min-height:42px;border-radius:9px;border:1px solid #d8ddc5;background:#fffdf0;color:#73826c;padding:5px}.sell{width:100%;margin-top:7px;font-size:11px;color:#a37f65;min-height:38px;background:transparent;border-color:#e9dfc8}.max-label{font-size:12px;padding:14px 6px;text-align:center;color:#83956d}.rally-help{font-size:11px;line-height:1.8;color:#567797;background:#e5eef4;border-radius:9px;padding:9px;margin-top:9px}.rally-help button{min-height:35px;padding:0 8px;margin-left:8px;font-size:10px}.wave-panel,.system-menu{right:16px;top:140px;width:270px;max-height:calc(100% - 250px);overflow:auto}.enemy-preview{display:flex;gap:7px;margin:12px 0;flex-wrap:wrap}.enemy-chip{flex:1;min-width:52px;text-align:center;background:#f1f0e0;border-radius:10px;padding:7px 4px}.enemy-chip img{width:43px;height:43px;object-fit:contain}.enemy-chip span{display:block;font-size:10px;margin-top:5px;color:#78856c}.wave-panel>p{font-size:11px;line-height:1.8;color:#7e8c72;margin:5px 0}.system-menu>button,.system-menu>a{display:block;width:100%;padding:10px 12px;margin:7px 0;text-align:left;font-size:12px;min-height:44px;border:1px solid #e1e0c7;border-radius:9px;background:#f3f3e5}.system-menu p{font-size:10px;line-height:1.7;color:#8b957e;margin:12px 0 3px}
.game-dock{position:absolute;bottom:max(12px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);width:min(920px,calc(100% - 32px));display:grid;grid-template-columns:minmax(0,1fr) minmax(260px,.9fr);gap:8px 17px;z-index:8;border:1px solid #e1d7b4;border-radius:16px;padding:8px 12px 6px;background:#fffaf0f2;box-shadow:0 6px 28px #143d4940}.quick-roster{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}.quick-card{display:flex;align-items:center;gap:3px;min-height:54px;position:relative;padding:4px;border-radius:10px;background:#f0f1e3;border-color:#dedfc4;text-align:left}.quick-card img{width:34px;height:42px;object-fit:contain;flex:none}.quick-card strong{display:block;font-size:10px;white-space:nowrap}.quick-card small{display:block;font-size:10px;color:#ab8744;margin-top:4px}.quick-card.selected{background:#e1ead4;border-color:#8ea87d;box-shadow:0 0 0 2px #9eb68633}.battle-controls{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;gap:7px;align-items:center}.square{font-size:17px;color:#6b7c65;min-height:48px}.primary{background:#608674;color:#fffcec;border-color:#608674;font-size:13px;font-weight:700;padding:10px 13px;min-height:48px;box-shadow:0 3px 0 #4a6b59}.primary:hover:enabled{background:#527a66}.primary span{opacity:.75;margin-left:6px}.battle-foot{grid-column:1/-1;display:flex;justify-content:space-between;gap:12px;color:#819079;font-size:9px;line-height:1.5;min-height:13px}.battle-foot span:last-child{white-space:nowrap}.zoom-tools{position:absolute;left:16px;bottom:118px;display:flex;gap:5px;z-index:6}.zoom-tools button{width:38px;min-height:38px;border-radius:10px;background:#fff9e7ef;border-color:#d7cca6;font-size:21px;color:#718261;box-shadow:0 3px 12px #21443822}.map-hint{position:absolute;bottom:121px;left:50%;transform:translateX(-50%);max-width:calc(100% - 240px);padding:8px 15px;border-radius:30px;background:#163f4bd9;border:1px solid #c6e1cf55;color:#f6f8e9;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;z-index:5}.boss-hud{position:absolute;top:96px;left:50%;transform:translateX(-50%);width:min(420px,50%);background:#fff7e8f0;border:1px solid #dcc59a;border-radius:10px;padding:8px 12px;pointer-events:none;z-index:6}.boss-hud>div:first-child{display:flex;justify-content:space-between;font-size:11px;margin-bottom:6px;color:#8c714a}.boss-hud>div:last-child{height:6px;background:#e6d9c2;border-radius:6px;overflow:hidden}.boss-hud i{display:block;height:100%;background:linear-gradient(90deg,#b08bce,#d5b167)}
.toast{position:absolute;top:48%;left:50%;transform:translate(-50%,-10px);max-width:80%;padding:11px 18px;background:#fffaeaf2;border:1px solid #e0d0a6;box-shadow:0 8px 25px #153d492a;border-radius:12px;color:#766a48;font-size:12px;pointer-events:none;opacity:0;transition:opacity .18s,transform .18s;z-index:15}.toast.visible{opacity:1;transform:translate(-50%,0)}.pause-overlay{position:absolute;left:16px;top:96px;padding:9px 12px;border-radius:12px;background:#fff9e9eb;border:1px solid #d7cca7;box-shadow:0 3px 16px #163d4920;pointer-events:none;z-index:5}.pause-overlay h2{font-size:11px;font-weight:400;margin:0 0 6px;color:#76866a}.pause-overlay button{pointer-events:auto;min-height:34px;box-shadow:none;font-size:11px;padding:6px 12px}.result-overlay{position:absolute;inset:0;background:#163c4ac9;backdrop-filter:blur(5px);display:flex;flex-direction:column;align-items:center;justify-content:center;color:#fffbea;text-align:center;padding:24px;z-index:20}.eyebrow{font-size:10px;letter-spacing:2px;color:#afbea2}.result-overlay h2{font-family:Georgia,"STSong",serif;font-size:35px;margin:10px 0}.result-overlay>p{font-size:12px;line-height:1.9}.result-overlay #result-stats{display:flex;gap:30px;margin:12px 0 20px;font-size:11px}.result-overlay #result-stats b{display:block;font-size:26px;color:#e7ce8e;margin-top:8px}.result-overlay button{min-width:180px}.keys{font-size:11px;color:#819075;line-height:1.8}dialog{border:1px solid #d9d5b7;border-radius:20px;max-width:520px;width:calc(100% - 28px);max-height:calc(100dvh - 28px);overflow:auto;background:#fffaf0;padding:27px;color:var(--ink);box-shadow:0 25px 90px #16313e77}dialog::backdrop{background:#173d4888;backdrop-filter:blur(4px)}dialog h2{font-size:25px;font-family:Georgia,"STSong",serif}dialog ol{padding-left:19px;font-size:12px;line-height:1.9;color:#74846c}dialog li{margin:11px 0}.dialog-close{position:absolute;right:12px;top:12px;width:36px;min-height:36px;border:0;background:transparent;font-size:24px}dialog .primary{width:100%;margin-top:8px}
@media(max-width:900px){.top-ui{grid-template-columns:1fr auto;gap:7px;padding:8px 11px;min-height:0}.chapter img{width:32px;height:32px}.chapter b{font-size:13px}.chapter small{display:inline;font-size:9px}.hud{grid-row:2;grid-column:1/-1;grid-template-columns:repeat(3,1fr) 1.4fr}.hud>div{padding:2px 8px}.hud>div:first-child{border-left:0}.hud small{font-size:9px;margin-bottom:3px}.hud strong{font-size:18px}.energy-track{margin-top:6px}.view-tools button{width:34px;min-height:34px}.view-tools a{font-size:10px}.intel-toggle{top:127px}.wave-panel,.system-menu{top:172px}.pause-overlay,.boss-hud{top:127px}.game-dock{grid-template-columns:minmax(0,1fr) minmax(220px,.9fr);gap:6px 9px;padding:7px 8px 5px}.quick-card{gap:1px}.quick-card img{width:29px;height:37px}.quick-card strong{font-size:9px}.quick-card small{font-size:9px}.map-hint{font-size:10px}.dispatch-panel{max-height:calc(100% - 275px)}}
@media(max-width:560px){.top-ui{left:7px;right:7px;top:max(7px,env(safe-area-inset-top));border-radius:13px;padding:5px 8px;gap:3px}.chapter img{width:30px;height:30px}.chapter b{font-size:12px}.chapter small{font-size:9px}.view-tools{gap:0}.view-tools button{width:34px;min-height:40px;font-size:19px}.view-tools a{font-size:10px;margin-right:4px}.hud{gap:2px}.hud>div{padding:4px 6px}.hud small{font-size:9px}.hud strong{font-size:18px}.hud em{font-size:10px}.energy-stat small{display:flex;font-size:9px}.energy-track{height:6px}.game-dock{bottom:max(7px,env(safe-area-inset-bottom));width:calc(100% - 14px);padding:6px 7px 4px;grid-template-columns:1fr;gap:5px;border-radius:13px}.quick-roster{gap:5px}.quick-card{min-height:52px;justify-content:center;gap:1px}.quick-card img{width:31px;height:38px}.quick-card strong{font-size:10px}.quick-card small{font-size:10px;margin-top:3px}.battle-controls{grid-template-columns:44px minmax(0,1fr) 44px;gap:6px}.primary,.square{min-height:44px;font-size:12px}.battle-foot{font-size:8px;gap:5px}.battle-foot span:first-child{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.zoom-tools{left:9px;bottom:156px}.zoom-tools button{width:40px;min-height:40px}.map-hint{bottom:162px;left:99px;right:9px;max-width:none;transform:none;font-size:9px;padding:6px 10px}.intel-toggle{right:9px;top:121px;min-height:36px;font-size:10px;padding:0 11px}.dispatch-panel{width:calc(100% - 18px);left:9px!important;right:9px!important;top:auto!important;bottom:153px;max-height:min(390px,calc(100% - 280px));padding:10px 12px;border-radius:14px}.panel h2{font-size:18px;margin:0 0 5px}.panel .description{font-size:10px;line-height:1.6;margin-bottom:7px}.panel-heading{min-height:32px}.panel-heading button{min-height:34px;width:34px}.tower-roster{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}.tower-card{min-height:90px;padding:5px 2px}.tower-card img{width:42px;height:42px}.tower-card strong{font-size:10px}.tower-card small{font-size:8px}.tower-card .cost{font-size:9px;top:4px;right:3px}.tower-card .key{display:none}.selected-hero{padding:4px 8px}.selected-hero img{width:36px;height:36px}.selected-hero small{font-size:9px}.tower-stats{margin:6px 0}.tower-stats div{padding:4px 7px}.tower-stats small{font-size:9px}.tower-stats b{font-size:12px}.inspector-tabs{margin-bottom:6px}.inspector-tabs button{min-height:33px}.upgrade-button{padding:8px;margin-top:5px;min-height:46px}.upgrade-button small{font-size:10px;line-height:1.5;margin-top:3px}.skill-button{margin:5px 0;padding:9px}.tower-actions button,.tower-actions select,.sell{min-height:40px}.wave-panel,.system-menu{right:9px;top:164px;max-height:calc(100% - 330px);width:min(285px,calc(100% - 18px));padding:12px}.pause-overlay{left:9px;top:122px;padding:7px 9px}.pause-overlay h2{font-size:9px;max-width:135px}.pause-overlay button{font-size:10px;min-height:33px;padding:4px 10px}.boss-hud{top:166px;width:calc(100% - 24px);font-size:10px}.boss-hud>div:first-child{font-size:10px}.toast{font-size:11px;top:38%;max-width:88%;padding:9px 13px}.result-overlay h2{font-size:27px}.result-overlay>p{font-size:11px}.result-overlay #result-stats{gap:22px}.dialog-close{min-height:44px;width:44px}}
@media(max-height:480px) and (min-width:561px){.top-ui{top:6px;left:7px;right:7px;grid-template-columns:135px 1fr auto;gap:7px;padding:4px 8px;height:54px}.hud{grid-row:auto;grid-column:auto}.chapter img{width:28px;height:28px}.chapter b{font-size:12px}.chapter small{font-size:8px}.hud strong{font-size:17px}.hud small{font-size:8px}.view-tools button{width:30px;min-height:36px}.view-tools a{font-size:9px}.intel-toggle{top:67px;min-height:30px}.game-dock{bottom:6px;max-width:850px;padding:4px 8px;gap:3px 10px}.quick-card{min-height:42px}.quick-card img{height:30px;width:25px}.primary,.square{min-height:39px}.battle-foot{font-size:8px}.zoom-tools{bottom:92px}.map-hint{bottom:96px}.dispatch-panel{max-height:calc(100% - 140px);width:270px}.wave-panel,.system-menu{top:103px;max-height:calc(100% - 190px)}.pause-overlay,.boss-hud{top:68px}.panel{padding:9px 11px}.panel h2{font-size:17px}.description{font-size:10px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important}}
.map-hint.rally-active{pointer-events:auto;cursor:pointer;border-color:#c8dfef}.view-tools .has-save{position:relative}.view-tools .has-save::after{content:"";position:absolute;top:6px;right:4px;width:6px;height:6px;border-radius:50%;background:#c6a05d}

/* Stone-anchored menus: the battlefield remains visible between the choices. */
.dispatch-panel{left:var(--menu-left,8px)!important;top:var(--menu-top,140px)!important;right:auto!important;bottom:auto!important;width:var(--menu-width,280px)!important;max-height:var(--menu-max-height,340px)!important}
.dispatch-panel.is-orbit{height:var(--menu-height,252px);max-height:none!important;padding:0;border:0;background:transparent;box-shadow:none;overflow:visible;pointer-events:none;border-radius:0}
.dispatch-panel.is-orbit .panel-heading{position:absolute;left:50%;top:var(--footer-y,224px);transform:translate(-50%,-50%);width:max-content;min-height:34px;gap:4px;pointer-events:none;z-index:2}
.dispatch-panel.is-orbit .pill{background:#183f4bd9;border:1px solid #f3efd573;color:#fff9e8;font-size:11px;padding:6px 10px;box-shadow:0 2px 9px #173d4933}
.dispatch-panel.is-orbit #panel-close{pointer-events:auto;min-height:36px;width:36px;background:#fff9e8cf;border:1px solid #fff9e8b0;border-radius:50%;box-shadow:0 2px 9px #173d492b;color:#466758;font-size:23px}
.dispatch-panel.is-orbit>h2,.dispatch-panel.is-orbit>.description{display:none}
.dispatch-panel.is-orbit .tower-roster{position:absolute;inset:0;display:block;pointer-events:none}
.dispatch-panel.is-orbit .tower-card{position:absolute;pointer-events:auto;width:var(--card-width,80px);height:var(--card-height,88px);min-height:0;padding:7px 3px 5px;gap:0;border-radius:15px;border:1px solid #fff9d9b8;background:#fff9e9b8;backdrop-filter:blur(3px);box-shadow:0 5px 15px #21483138,inset 0 1px 0 #ffffffba;transition:background .15s,box-shadow .15s;touch-action:manipulation}
.dispatch-panel.is-orbit .tower-card:hover:enabled{background:#fffcebe8;box-shadow:0 6px 19px #2148314d,inset 0 1px 0 #fff}
.dispatch-panel.is-orbit .tower-card:focus-visible{outline:3px solid #fff1a1;outline-offset:3px}
.dispatch-panel.is-orbit .tower-card:disabled{opacity:.55;background:#e7e7d9b8}
.dispatch-panel.is-orbit .tower-card img{width:43px;height:43px;margin-top:4px;filter:drop-shadow(0 2px 2px #183d4a35)}
.dispatch-panel.is-orbit .tower-card strong{font-size:11px;margin:1px 0 2px;text-shadow:0 1px 0 #fff9}
.dispatch-panel.is-orbit .tower-card small{font-size:9px;color:#526e5b;line-height:1.2}
.dispatch-panel.is-orbit .tower-card .cost{font-size:10px;right:4px;top:4px;padding:1px 4px;background:#fff8dcdf;color:#90672b;border-radius:6px}
.dispatch-panel.is-orbit .tower-card .key{display:block;left:5px;top:5px;font-size:9px;color:#426854}
.dispatch-panel.is-orbit.compact-orbit .tower-card{padding-top:3px}
.dispatch-panel.is-orbit.compact-orbit .tower-card img{width:33px;height:33px;margin-top:3px}
.dispatch-panel.is-orbit.compact-orbit .tower-card strong{font-size:10px}
.dispatch-panel.is-orbit.compact-orbit .tower-card small{display:none}
@media(max-width:560px){.dispatch-panel.is-orbit #panel-close{min-height:44px;width:44px}.dispatch-panel.is-built .panel-heading button{width:40px;min-height:40px}}
@media(prefers-reduced-transparency:reduce){.dispatch-panel.is-orbit .tower-card,.dispatch-panel.is-built{background:#fff9ebf5;backdrop-filter:none}}
.audio-panel{right:max(16px,env(safe-area-inset-right));top:94px;width:min(282px,calc(100% - 24px));max-height:calc(100% - 210px);overflow:auto;background:#fffaf0f5;z-index:15}
.audio-panel label{display:block;font-size:13px;margin:16px 0}.audio-panel .sound-switch{display:flex;align-items:center;gap:8px;min-height:28px}.sound-switch input{width:20px;height:20px;accent-color:#5e8573}.sound-slider span{display:flex;justify-content:space-between}.sound-slider output{font-variant-numeric:tabular-nums;color:#7b886e}.sound-slider input{display:block;width:100%;height:30px;margin-top:5px;accent-color:#5e8573;cursor:pointer}.audio-panel #audio-preview{width:100%;font-size:12px;background:#e8efdc}.audio-panel p{font-size:11px;color:#5e8573;margin:12px 0 6px}.audio-panel>small{font-size:10px;color:#899079;line-height:1.6}
@media(max-width:560px){.audio-panel{top:122px;right:9px;max-height:calc(100% - 300px)}}
@media(max-height:480px) and (min-width:561px){.audio-panel{top:67px;max-height:calc(100% - 165px);padding:9px 12px}.audio-panel label{margin:7px 0}.audio-panel .sound-slider input{height:25px;margin:0}.audio-panel>small{display:none}}

/* Deployment and built-tower actions use the same stone-anchored orbit. */
.dispatch-panel.is-orbit #selected-details{position:absolute;inset:0;pointer-events:none}
.dispatch-panel.is-orbit .action-card .action-icon{font-size:29px;line-height:33px;color:#567b6d;margin:3px 0 4px}
.dispatch-panel.is-orbit .action-card small{min-height:12px;color:#906d38}
.dispatch-panel.is-orbit #sell{color:#a2745c;background:#fff1e2c7}
.dispatch-panel.is-orbit #skill{background:#f0eafbc7}
.dispatch-panel.is-orbit #inspector-tabs{display:none}
.map-hint:not(.rally-active),.battle-foot,.pause-overlay h2,#result-kicker,.wave-panel>p{display:none!important}
.pause-overlay{left:50%!important;top:50%!important;transform:translate(-50%,-50%);border:0;background:transparent;padding:0;box-shadow:none}
.pause-overlay button{width:64px;height:64px;min-height:64px!important;padding:0;border-radius:50%;font-size:25px!important;background:#fff8e4e8;color:#52786b;border:1px solid #fff9de}
.toast{top:auto!important;bottom:150px;max-width:260px;padding:7px 14px;font-size:11px;box-shadow:none;border-radius:22px}
@media(max-width:560px){.toast{bottom:185px}.dispatch-panel.is-orbit .action-card .action-icon{font-size:27px}}

/* Painted HUD assets; live values stay as readable text over the game chrome. */
.top-ui{background:linear-gradient(180deg,#214e55f5,#173f48ed);border-color:#bca57499;box-shadow:0 4px 16px #173e493b;grid-template-columns:155px minmax(0,1fr) auto;gap:12px;min-height:70px;padding:7px 12px}
.chapter b{color:#fff3d5}.chapter small{color:#d3d9c7}.chapter img{width:35px;height:35px}
.hud{grid-template-columns:repeat(3,minmax(72px,1fr)) minmax(150px,1.5fr);gap:8px}
.hud>div{border:0;padding:0;min-width:0}.resource-stat,.energy-stat{display:flex;align-items:center;gap:5px;min-width:0}
.hud .stat-icon{object-fit:contain;width:48px;height:44px;flex:none;filter:drop-shadow(0 2px 2px #071e2660)}
.hud strong{font-size:23px;color:#fff4d7;text-shadow:0 2px 1px #13343e;font-variant-numeric:tabular-nums;white-space:nowrap}.hud strong.gold{color:#ffe2a0}.hud em{color:#d2d9cf;font-size:10px}
.energy-stat .stat-icon{width:35px;height:47px}.energy-readout{min-width:0;max-width:160px;width:100%;text-align:center;line-height:1}
.energy-readout>span{font-size:10px;color:#f1e7ff;font-variant-numeric:tabular-nums;display:block;margin-bottom:-4px;position:relative;z-index:1;text-shadow:0 1px 2px #173346}
.hud .energy-track{position:relative;width:100%;height:40px;margin:0;background:none;border-radius:0;overflow:visible}
.energy-track>img{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.energy-channel{position:absolute;left:14%;right:14%;top:40%;height:28%;overflow:hidden;border-radius:8px;z-index:1}
.energy-channel #compute-bar{height:100%;background:url('/games/tower-defense/assets/ui/energy-fill.webp') center/100% 100% no-repeat;border-radius:7px;transition:width .15s}
.view-tools button,.view-tools a{color:#efe7cc}.view-tools button:hover:enabled{background:#fff3d520}
@media(max-width:1000px){.top-ui{grid-template-columns:1fr auto;gap:3px 10px}.hud{grid-column:1/-1;grid-row:2;grid-template-columns:repeat(3,minmax(65px,1fr)) minmax(120px,1.4fr);gap:6px}.hud .stat-icon{width:45px;height:37px}.hud strong{font-size:21px}.energy-stat .stat-icon{width:28px;height:40px}.hud .energy-track{height:34px}.chapter small{font-size:9px}.view-tools button{min-height:36px}}
@media(max-width:560px){.top-ui{padding:5px 7px;gap:2px 5px}.hud{grid-template-columns:.9fr .95fr 1.1fr 1.45fr;gap:3px}.hud .stat-icon{width:33px;height:32px}.hud strong{font-size:18px}.hud em{font-size:8px}.resource-stat,.energy-stat{gap:2px}.energy-stat .stat-icon{width:23px;height:34px}.energy-readout>span{font-size:9px;margin-bottom:-3px}.hud .energy-track{height:29px}.chapter img{width:28px;height:28px}.chapter b{font-size:12px}}
@media(max-height:480px) and (min-width:700px){.top-ui{grid-template-columns:120px minmax(0,1fr) auto;gap:5px;min-height:52px;height:52px}.hud{grid-column:auto;grid-row:auto;grid-template-columns:repeat(3,minmax(60px,1fr)) minmax(100px,1.4fr)}.hud .stat-icon{width:31px;height:32px}.hud strong{font-size:18px}.energy-stat .stat-icon{width:25px}.hud .energy-track{height:30px}}

.chapter-panel{position:absolute;inset:0;z-index:30;background:linear-gradient(160deg,#163d49f5,#285b60eb);backdrop-filter:blur(5px);color:#fff1d2;overflow:auto;overscroll-behavior:contain;padding:clamp(20px,5vw,64px);display:flex;flex-direction:column;justify-content:center;gap:26px}
.chapter-header,.chapter-levels,.chapter-footer{width:100%;max-width:1100px;margin:0 auto}.chapter-header{display:flex;align-items:center;justify-content:space-between;gap:14px}.chapter-header small{font-size:12px;letter-spacing:2px;color:#c4d3bc}.chapter-header h1{font-size:clamp(21px,3vw,31px);margin:7px 0 0;letter-spacing:1px}.chapter-summary{display:flex;align-items:center;gap:16px;color:#f2d189;font-variant-numeric:tabular-nums}.chapter-summary button{width:44px;min-height:44px;border-radius:50%;color:#fff2d1;background:#fff6d70d;border-color:#e8d69c66;font-size:25px}
.chapter-levels{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.level-card{position:relative;overflow:hidden;padding:0;border-radius:19px;border:1px solid #ddce9b94;background:#fff9e8;color:#284b50;text-align:left;box-shadow:0 9px 24px #082c3655;min-width:0;transition:transform .16s,box-shadow .16s}.level-card:hover:enabled{background:#fff9e8;transform:translateY(-4px);box-shadow:0 13px 30px #082c3677}.level-card>img{display:block;width:100%;height:auto;aspect-ratio:1.65;object-fit:cover}.level-order{position:absolute;left:13px;top:13px;width:36px;height:36px;display:grid;place-items:center;border-radius:50%;background:#183f4bdc;color:#fff2cb;font-size:13px;border:1px solid #fff3c680}.level-info{display:grid;grid-template-columns:1fr auto;gap:7px 10px;padding:16px}.level-info>strong{font-size:18px;grid-column:1/-1}.level-info>small{font-size:11px;color:#708276;grid-column:1/-1}.level-stars{color:#b98d3d;font-size:24px;letter-spacing:3px;white-space:nowrap}.level-stars>span{color:#babfa9}.level-info>b{justify-self:end;align-self:center;font-size:12px;border:1px solid #b5c3a4;border-radius:20px;padding:6px 14px;color:#4a735e}.level-card.locked{opacity:.66;cursor:default}.level-card.locked>img{filter:saturate(.45)}.level-card.locked .level-info>b{border-color:transparent;color:#7e8877}
.chapter-footer{display:flex;justify-content:space-between;align-items:center;gap:14px;min-height:48px}.chapter-footer>a{font-size:12px;color:#d3dfcc}.chapter-footer .primary{padding:10px 22px}.chapter-footer .primary[hidden]+a{margin-left:auto}
#result-stars{font-size:36px;letter-spacing:8px;color:#efd491;line-height:1.5;margin:8px 0}#result-overlay>button{margin:5px 0}#chapter-return{background:transparent;color:#f4ebd4;border-color:#ecdfbe77;font-size:12px;min-height:42px}
@media(max-width:660px){.chapter-panel{padding:20px 16px;justify-content:flex-start;gap:18px}.chapter-header{position:sticky;top:-20px;z-index:2;background:#1b454dee;padding:12px 0;border-radius:0 0 12px 12px}.chapter-header h1{font-size:21px}.chapter-summary{gap:8px;font-size:12px}.chapter-levels{grid-template-columns:1fr}.level-card{display:grid;grid-template-columns:42% 1fr;border-radius:15px}.level-card>img{height:100%;aspect-ratio:auto;min-height:146px}.level-order{left:9px;top:9px;width:29px;height:29px;font-size:11px}.level-info{padding:14px 12px;gap:6px}.level-info>strong{font-size:17px}.level-stars{font-size:21px}.level-info>b{font-size:11px;padding:5px 11px}.chapter-footer{padding-bottom:10px;flex-wrap:wrap}.chapter-footer .primary{min-width:100%}.chapter-footer>a{margin-left:auto}}
@media(prefers-reduced-motion:reduce){.level-card:hover:enabled{transform:none}}
#legacy-continue{background:transparent;color:#e6dfc8;border-color:#e4d8ad55;font-size:11px;padding:8px 15px;min-height:42px}
.difficulty-select{max-width:1100px;width:100%;margin:-10px auto 0;display:flex;gap:5px;align-items:center}.difficulty-select button{min-width:76px;min-height:40px;border-radius:22px;font-size:12px;background:#fff5d80b;color:#d5dfce;border-color:#c9d9c455;padding:6px 19px}.difficulty-select button[aria-pressed=true]{background:#f2e4b8;color:#36594e;border-color:#f1d78a;font-weight:700;box-shadow:0 2px 10px #0d303522}.difficulty-select button:hover:enabled{background:#eee3c237;color:#fff5d6}.difficulty-select button[aria-pressed=true]:hover{background:#fff0c7;color:#36594e}.level-grade{position:absolute;right:10px;top:14px;border-radius:20px;background:#183f4bdc;color:#f9e7ba;border:1px solid #fff2d077;padding:5px 11px;font-size:10px}
@media(max-width:660px){.difficulty-select{margin:-4px auto 0}.difficulty-select button{flex:1;min-height:42px}.level-grade{top:auto;bottom:12px;right:auto;left:9px;font-size:9px;background:#173e4ac7}}

/* Painted ability art occupies the original icon slot; orbit/card dimensions stay unchanged. */
.dispatch-panel.is-orbit .action-card .action-icon{position:relative;display:block;width:44px;height:33px;flex-shrink:0}
.ability-art{position:absolute;display:block;width:44px;height:44px;left:0;top:-6px;background-repeat:no-repeat;pointer-events:none}
.dispatch-panel.is-orbit.compact-orbit .ability-art{width:36px;height:36px;left:4px;top:-2px}

canvas.is-selecting{cursor:crosshair}.squad-bar{position:absolute;left:50%;bottom:max(12px,env(safe-area-inset-bottom));transform:translateX(-50%);display:flex;gap:5px;z-index:9;padding:5px;border-radius:12px;background:#173f48ba;max-width:calc(100% - 20px);flex-wrap:wrap;justify-content:center}.squad-bar button{position:relative;min-width:38px;min-height:38px;padding:4px 11px;background:#fff8e8e8;border:1px solid #b7c5a1;color:#36594e}.squad-bar b{font-size:16px}.squad-bar small{font-size:9px;margin-left:5px;color:#7a8369}.squad-bar button.selected{box-shadow:0 0 0 2px #e2c579;background:#f5e9bc}body[data-build-layout="bottom"] .squad-bar{bottom:calc(var(--deployment-bottom,8px) + 6px)}

.production-card-shell{position:absolute;pointer-events:auto;width:var(--card-width,80px);height:var(--card-height,88px)}.production-card-shell .action-card{inset:0!important}.auto-production{position:absolute;right:2px;top:2px;z-index:1;width:27px;min-height:27px;height:27px;padding:0;border-radius:50%;font-size:21px;line-height:24px;color:#557b69;background:#fff9e9;border:1px solid #c9d3b3}.auto-production[aria-pressed=true]{background:#5e8573;color:#fff7d6;border-color:#f0d791;box-shadow:0 0 0 2px #e3d09766}

/* Two chapters share persistent global stage IDs and independent difficulty stars. */
.chapter-panel{justify-content:flex-start}.chapter-levels{display:flex;flex-direction:column;gap:28px}.chapter-group-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 12px}.chapter-group-heading h2{font-size:19px;margin:0;color:#fff0cd}.chapter-group-heading>span{color:#ccd7c7;font-size:12px}.chapter-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.chapter-grid .level-info{padding:12px}.chapter-grid .level-info>strong{font-size:16px}.chapter-grid .level-info>small{font-size:11px}.chapter-grid .level-stars{font-size:20px}.chapter-grid .level-info>b{padding:5px 9px}@media(max-width:900px){.chapter-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:660px){.chapter-grid{grid-template-columns:1fr;gap:12px}.chapter-group-heading h2{font-size:17px}.chapter-grid .level-card>img{min-height:116px}}

#storyline-select{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:6px}#storyline-select button{flex:1;min-width:160px}#storyline-description{margin:0 0 14px;color:var(--text-muted,#697561);font-size:13px}

#storyline-select button{font-size:16px;font-weight:700;min-height:46px;color:#354c42;background:#fffdf5;border:1px solid #d8d6c0}#storyline-select button[aria-pressed="true"]{background:#fff0c8;color:#354c42;border-color:#d9bb70}
