@font-face{font-family:EmberTitle;src:url('assets/DoHyeon-Regular.ttf') format('truetype');font-display:swap}
:root{color-scheme:dark;--ui-scale:1;--text:#ece7d7;--muted:#b8b6aa;--gold:#c5a46a;--bright:#f2d897;--bronze:#816744}
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none;background:#070b10;color:var(--text);font:16px/1.6 'Malgun Gothic','Apple SD Gothic Neo',sans-serif;user-select:none}
body:before{content:"";position:fixed;inset:-35px;background:#10171a url('assets/cover.webp') center/cover;filter:blur(24px) brightness(.35);pointer-events:none}
button,a,input{font:inherit}button{border:0;padding:0;color:inherit;background:none;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default;color:#8d8b80}button,a{outline:none}button:focus-visible,a:focus-visible,input:focus-visible,canvas:focus-visible{outline:2px solid #ffe3a6;outline-offset:3px}button:hover:not(:disabled){color:var(--bright)}button:active:not(:disabled){filter:brightness(.85)}a{color:inherit;text-decoration:none}i{display:inline-block;width:22px;height:22px;flex-shrink:0;font-style:normal}svg{width:100%;height:100%;display:block}small{font-size:13px;font-weight:400}em{font-style:normal;color:var(--muted);font-size:.56em;font-weight:400}strong{font-weight:700}h1,h2,h3,p{margin:0}h2,h3{font-family:EmberTitle,'Malgun Gothic',sans-serif;font-weight:400}kbd{display:inline-flex;align-items:center;justify-content:center;min-width:21px;height:20px;padding:0 5px;border:1px solid #99846780;border-bottom-width:2px;background:#14171bc9;color:#cfc8b4;font:11px/1.4 'Malgun Gothic',sans-serif}
[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#game-shell{position:absolute;left:50%;top:50%;width:1600px;height:900px;overflow:hidden;transform:translate(-50%,-50%) scale(var(--ui-scale));transform-origin:center;isolation:isolate;background:#141c1d}
.screen{position:absolute;inset:0;width:1600px;height:900px}
#title-screen{background:#101c1c url('assets/cover.webp') 61% center/cover no-repeat;isolation:isolate}
.title-vignette{position:absolute;inset:0;background:linear-gradient(90deg,#050d13db 0%,#0810167a 35%,#08101800 65%),linear-gradient(0deg,#070e16df,transparent 22%);z-index:-1}
#title-particles{position:absolute;inset:0;width:1600px;height:900px;pointer-events:none;z-index:-1}
.title-menu{position:absolute;left:96px;top:80px;width:520px;text-align:center}
.title-menu h1{height:318px}.title-menu h1 img{width:488px;height:318px;object-fit:contain;filter:drop-shadow(0 6px 14px #0009)}

.menu-actions{display:flex;flex-direction:column;align-items:center;gap:2px;margin-top:24px}
.menu-button{height:57px;width:450px;position:relative;font:25px/1.4 EmberTitle,'Malgun Gothic',sans-serif;letter-spacing:.04em;text-align:center;text-shadow:0 2px 5px #000c;transition:color .16s}
.menu-button:before{content:"";position:absolute;inset:5px 4px;background:linear-gradient(90deg,transparent,#b69a5c24,transparent);border-top:1px solid transparent;border-bottom:1px solid transparent;opacity:0;transition:opacity .16s}
.menu-button:hover:before,.menu-button:focus-visible:before{opacity:1;border-color:#a88d4350}.menu-button>i{position:absolute;left:104px;top:18px;color:var(--gold);width:21px;height:21px;opacity:0}.menu-button:hover>i,.menu-button:focus-visible>i{opacity:1}.menu-button:disabled{opacity:.38}
.menu-button small{display:block;font:12px/1.3 'Malgun Gothic',sans-serif;letter-spacing:0;color:#afa994;position:absolute;left:0;right:0;top:39px}.menu-button.primary:not(:disabled){color:var(--bright)}
.title-top{position:absolute;left:48px;right:48px;bottom:66px;display:flex;align-items:center;justify-content:space-between;font-size:13px;color:#b5b2a2}.back-link{padding:10px 0}

.save-label{display:inline-flex;align-items:center;gap:7px;color:#b6c1b0;font-size:12px;white-space:nowrap}.save-label:before{content:"";width:5px;height:5px;background:#b3c4a7;transform:rotate(45deg);box-shadow:0 0 6px #a5c38b55}.save-label.error{color:#e5ad96}.save-label.error:before{background:#de8f71}
#arena-wrap,#battlefield,#pad-hit-layer{position:absolute;inset:0;width:1600px;height:900px}#battlefield{display:block;touch-action:none}
#pad-hit-layer{pointer-events:none;z-index:1}.pad-hit{position:absolute;border:0;background:none;border-radius:50%;pointer-events:auto}.pad-hit:focus-visible{outline:2px solid #ffe7a5;outline-offset:5px;background:#f8d58d22}.pulse-armed .pad-hit{pointer-events:none}
.hud-shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(180deg,#070c14d9,transparent 18%,transparent 75%,#080d14c9)}
.hud-top{position:absolute;inset:0 0 auto;height:120px;pointer-events:none}.hud-top button{pointer-events:auto}
.resource-group{position:absolute;left:26px;top:22px;width:410px;height:78px;display:flex;align-items:center;padding:4px 16px 6px 98px;gap:24px;background:linear-gradient(100deg,#1d222c,#161d23e6 80%,#181e2300);border-top:1px solid #bb9e5c77;border-bottom:1px solid #89734d66;filter:drop-shadow(0 4px 5px #0006)}
.sanctuary-seal{position:absolute;left:-13px;top:-22px;width:111px;height:111px;border:2px solid #b59a64;border-radius:50%;background:radial-gradient(#5a423080,#111821 67%);box-shadow:0 0 0 4px #171e25,0 0 0 5px #846e4b,0 6px 10px #0008}
.sanctuary-seal img{position:absolute;left:9px;top:-15px;width:90px;height:115px;object-fit:contain;filter:drop-shadow(0 0 7px #ffa94055)}
.resource{position:relative;display:flex;align-items:center;gap:10px}.resource small{display:block;color:#b8b4a3;font-size:12px;letter-spacing:.04em}.resource strong{display:block;font:30px/1.1 EmberTitle,sans-serif;font-variant-numeric:tabular-nums}
.resource.hp{width:147px;padding-bottom:10px;transform:translateX(14px)}.resource.hp>div:first-child{display:block}.resource.hp small{width:auto;font-size:11px;line-height:1.5}.resource.hp strong{white-space:nowrap}
.hp-track{position:absolute;left:0;right:0;bottom:0;height:6px;background:#0c1116;border:1px solid #87725066}.hp-track b{display:block;width:100%;height:100%;background:#99a474}
.resource.gold{color:#e8ca88}.gold>i{width:25px;height:25px}.gold small{font-size:11px}.gold strong{font-size:31px}
.wave-counter{position:absolute;left:50%;top:14px;transform:translateX(-50%);width:294px;height:102px;display:flex;align-items:flex-start;justify-content:center;padding-top:12px;gap:15px;filter:drop-shadow(0 5px 5px #0008);background:linear-gradient(110deg,#6a513811,#191f28e6 14%,#1f252c 50%,#191f28e6 86%,#6a513811);clip-path:polygon(13px 0,calc(100% - 13px) 0,100% 13px,100% 77%,50% 100%,0 77%,0 13px);border-top:2px solid #c5a46a}
.wave-counter:after{content:"";position:absolute;left:17px;right:17px;top:5px;height:1px;background:linear-gradient(90deg,transparent,#e2c38e99,transparent)}
.wave-crest{width:39px;height:48px;color:#d6bb81;margin-top:9px}.wave-counter small{display:block;font-size:12px;color:#d1c2a1;letter-spacing:.08em}.wave-counter strong{display:block;font:35px/1.2 EmberTitle,sans-serif}.wave-counter strong em{font-size:15px;color:#a8aa9b}
#wave-name{position:absolute;left:10px;right:10px;bottom:11px;font-size:12px;color:#cbb891;line-height:1.3}
.utility-group{position:absolute;right:26px;top:28px;display:flex;align-items:center;gap:8px}.score-strip{position:relative;text-align:right;margin-right:16px;min-width:132px;text-shadow:0 2px 4px #000}.score-strip small{display:block;font-size:11px;color:#d1c7ab;line-height:1.1}.score-strip strong{font:29px/1.2 EmberTitle,sans-serif}.score-strip>span{display:block;font-size:11px;color:#b7baa9}
.icon-button{display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;border:1px solid #887451;background:linear-gradient(#30313b,#181e26);box-shadow:inset 0 0 0 3px #1a1e25,0 3px 5px #0005;color:#d2c29e;clip-path:polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px)}
.icon-button i{width:20px;height:20px}.icon-button:hover:not(:disabled){border-color:#ecd099;background:linear-gradient(#494135,#21262c)}
.field-left{position:absolute;left:32px;top:131px;width:300px;pointer-events:none;text-shadow:0 2px 4px #000,0 0 8px #000}
.arena-caption{display:flex;align-items:center;gap:10px}.arena-caption>span{width:28px;height:28px;color:#d5b885}.arena-caption strong{display:block;font:19px EmberTitle,sans-serif;color:#e6d8af}.arena-caption small{display:block;font-size:12px;color:#d1cdbc;max-width:270px;margin-top:5px}
.relic-strip{margin-top:22px;pointer-events:auto;width:270px}.section-label{display:flex;align-items:center;gap:12px;font-size:12px;color:#d1c1a2}.section-label small{margin-left:auto;font-size:11px;color:#c0bca8}
#owned-relics{display:flex;gap:5px;align-items:center;height:54px;margin-top:7px}.relic-token{width:45px;height:47px;position:relative;border-bottom:1px solid #c2a16680;background:radial-gradient(ellipse,#b6955733,transparent 75%)}.relic-token img{width:43px;height:43px;object-fit:contain;filter:drop-shadow(0 2px 2px #000a)}.relic-token:hover img{filter:drop-shadow(0 0 5px #e3c583aa)}.relic-empty{font-size:12px;color:#b7b6a5}
.field-right{position:absolute;right:32px;top:137px;width:240px;text-shadow:0 2px 4px #000,0 0 8px #000}.forecast{min-height:164px}.forecast .section-label{border-bottom:1px solid #b6a17866;padding-bottom:5px}.forecast .section-label b{font-weight:400;color:#f0d6a0}.forecast .section-label button{margin-left:auto;font-size:11px;color:#bcb89f;padding:2px 0 2px 8px}
.forecast h3{font:19px/1.4 EmberTitle,sans-serif;color:#e8dbb8;margin:9px 0 6px}#forecast-enemies{display:flex;flex-wrap:wrap;gap:7px;max-height:132px;overflow:hidden}
.enemy-chip{position:relative;display:block;width:48px;height:56px}.enemy-chip .enemy-art{width:48px;height:48px;margin:0}.enemy-chip .enemy-count{position:absolute;right:-2px;bottom:0;min-width:18px;height:18px;background:#171c26;border:1px solid #9c8358;text-align:center;font:12px/16px EmberTitle,sans-serif;color:#e5d4ac}.enemy-chip.boss .enemy-count{border-color:#be6c4e;color:#ffc098}
#forecast-advice{display:none}.arena-tools{margin-top:16px}.arena-tools button{display:flex;gap:9px;align-items:center;font-size:13px;color:#d6d1ba}.arena-tools i{width:17px;height:17px}.arena-tools kbd{margin-left:auto;font-size:10px}
.command-deck{position:absolute;left:0;right:0;bottom:0;height:198px;pointer-events:none}
.command-deck:before{content:"";position:absolute;inset:51px 0 0;background:linear-gradient(0deg,#101720f5,#151c25ed 78%,#20252bdd),url('assets/ui-material-v2.webp') center/512px 280px;border-top:1px solid #8c7755;box-shadow:0 -12px 25px #070a1060;clip-path:polygon(0 15px,25% 15px,27% 0,73% 0,75% 15px,100% 15px,100% 100%,0 100%)}
.command-deck>*{pointer-events:auto}.inspector{position:absolute;left:28px;bottom:26px;width:375px;height:141px;padding-left:103px}.inspector-art{position:absolute;left:0;top:4px;width:97px;height:102px;object-fit:contain;filter:drop-shadow(0 3px 5px #000b)}
.inspector h2{font:23px/1.2 EmberTitle,sans-serif;color:#e7d3a4;margin-top:5px}.inspector .level{position:absolute;left:0;bottom:21px;width:97px;color:#d3b578;text-align:center;font-size:12px;letter-spacing:.1em}.inspector .role{font-size:12px;color:#b9b9ab;white-space:nowrap;margin:4px 0 8px}
.stats-grid{display:flex;gap:20px}.stats-grid>div{min-width:53px}.stats-grid small{display:block;font-size:10px;color:#a7ac9f;line-height:1.3}.stats-grid strong{display:block;font:18px/1.3 EmberTitle,sans-serif;color:#e3dfca}
.inspector-actions{display:flex;gap:6px;position:absolute;left:104px;right:0;bottom:0;height:37px}
.upgrade-button,.subtle-button{border:1px solid #756443;background:linear-gradient(#3a3a31,#242a2c);box-shadow:inset 0 0 0 2px #242725;color:#e4cda0;font-size:12px;padding:5px 10px;white-space:nowrap}
.upgrade-button{min-width:126px;display:flex;justify-content:space-between;align-items:center;gap:7px;color:#f1d293;border-color:#aa9058;background:linear-gradient(#5e593e,#363b32)}.upgrade-button:disabled{border-color:#535547;background:#242a2c;color:#7c8173}.upgrade-button small{font-size:11px}.target-button,.sell-button{padding:4px 7px}.sell-button{color:#a9ad9e;border-color:#4f554b;background:#1b2428}
.inspector .build-instruction{position:absolute;left:104px;bottom:0;font-size:12px;color:#d7c397}.inspector .build-instruction b{font-weight:400;color:#eacb8a}.inspector.empty{padding:22px 0 0 105px}.inspector.empty .inspector-art{width:100px;height:123px;top:0}.inspector.empty h2{font-size:22px}.inspector.empty p{font-size:12px;color:#a8b0a4;line-height:1.8;margin-top:9px}.context-note{font-size:11px;color:#a9b1a2;margin-top:5px}
.build-dock{position:absolute;left:435px;bottom:22px;width:690px;height:142px}.dock-title{position:absolute;left:0;right:0;top:-23px;display:flex;justify-content:center;align-items:center;gap:15px;pointer-events:none}.dock-title strong{font-size:12px;color:#cbb894;letter-spacing:.06em;font-weight:400}.dock-title small{font-size:11px;color:#9ea79b}
#tower-cards{height:142px;display:flex;align-items:flex-end;gap:11px}
.tower-card{position:relative;width:104px;height:137px;flex:0 0 104px;background:linear-gradient(160deg,#394033cb,#1c242ad9 62%),url('assets/ui-material-v2.webp') center/cover;border:1px solid #89764f;color:#cfcbb5;box-shadow:inset 0 0 0 3px #182129,inset 0 -3px 12px #0009;clip-path:polygon(11px 0,calc(100% - 11px) 0,100% 11px,100% 100%,0 100%,0 11px)}
.tower-card:after{content:"";position:absolute;inset:3px;border:1px solid #9a875138;pointer-events:none}.tower-card kbd{position:absolute;left:8px;top:6px;z-index:2;min-width:17px;height:18px;font-size:10px;background:#d7caa5;color:#242922;border-color:#ab9466}
.tower-card img{position:absolute;left:3px;top:3px;width:98px;height:92px;object-fit:contain;filter:drop-shadow(0 4px 3px #0009);transition:filter .15s,transform .15s}.tower-name{position:absolute;left:0;right:0;bottom:24px;font:17px/1.3 EmberTitle,sans-serif;white-space:nowrap;text-shadow:0 1px 3px #000}.tower-cost{position:absolute;left:0;right:0;bottom:6px;display:flex;justify-content:center;align-items:center;gap:4px;font:14px/1 EmberTitle,sans-serif;color:#d4ba82}.tower-cost i{width:13px;height:13px}.tower-role{display:none}
.tower-card:hover:not(:disabled) img,.tower-card:focus-visible img{transform:translateY(-4px);filter:drop-shadow(0 0 9px #cfbf7977)}.tower-card:hover:not(:disabled){border-color:#d7bf89}.tower-card[aria-pressed=true]{border:2px solid #e9ce8e;background:radial-gradient(ellipse at 50% 40%,#ac96594a,transparent 80%),linear-gradient(#444539,#232e30);box-shadow:inset 0 0 0 3px #d5ba6444,inset 0 -8px 20px #ada4633a;color:#ffe4a4}.tower-card.unaffordable .tower-cost{color:#db9c85}.tower-card.unaffordable img{opacity:.57}.tower-card:disabled{opacity:.5}
.cancel-build{position:absolute;right:0;top:-25px;font-size:11px;color:#bab8a3;padding:0 2px 0 8px;background:#151c24;display:none}.cancel-build kbd{margin-left:5px;font-size:9px;min-width:21px;height:15px}body.has-selection .cancel-build{display:block}body.has-selection .dock-title{justify-content:flex-start}
.battle-orders{position:absolute;right:25px;bottom:29px;width:218px;height:147px}.speed-controls{position:absolute;top:0;right:0;left:0;display:flex;gap:4px;justify-content:center}.speed-controls button{font-size:12px;color:#b4b8a9;padding:4px 13px;height:30px;border-bottom:1px solid #716c53}.speed-controls button[aria-pressed=true]{color:#f1d292;border-color:#e5c782;background:linear-gradient(0deg,#c4a65e22,transparent)}
.start-wave{position:absolute;left:0;right:0;bottom:0;height:89px;display:flex;align-items:center;justify-content:center;gap:12px;text-align:left;border:1px solid #ccb075;border-top:2px solid #e4cc90;background:linear-gradient(110deg,#777047,#494d37 70%,#353c33);box-shadow:inset 0 0 0 4px #353e30,inset 0 0 0 5px #a48b5655;clip-path:polygon(14px 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%,0 14px)}
.start-wave>i{width:24px;height:24px;color:#f4dfa4}.start-wave strong{display:block;font:24px/1.4 EmberTitle,sans-serif;color:#f7e6bc}.start-wave small{font-size:12px;line-height:1.2;display:block;color:#d0ccad}.start-wave kbd{position:absolute;right:9px;bottom:6px;height:15px;font-size:9px;border:0;color:#dad1ac;background:none}.start-wave.combat{opacity:.85;filter:saturate(.5);background:linear-gradient(#38423c,#283331);border-color:#77795d}.start-wave:disabled strong{color:#bfc7b3}.start-wave:disabled:not(.combat){opacity:.55}
.pulse-button{position:absolute;right:256px;bottom:31px;width:169px;height:147px;text-align:center;color:#e9d3a2}.spell-art{position:absolute;width:82px;height:82px;left:44px;top:0;border:2px solid #c5a568;border-radius:50%;background:radial-gradient(#70503588,#17202a 68%);box-shadow:0 0 0 4px #172029,0 0 0 5px #806e49,inset 0 0 15px #0007}.spell-art img{position:absolute;left:9px;top:-13px;width:63px;height:91px;object-fit:contain;filter:drop-shadow(0 0 6px #ff9c4a80)}.pulse-button>span:nth-child(2){position:absolute;left:0;right:0;bottom:0;height:55px}.pulse-button strong{display:block;font:20px/1.4 EmberTitle,sans-serif}.pulse-button small{display:block;font-size:10px;line-height:1.4;color:#b5bba9;white-space:nowrap}.pulse-button kbd{position:absolute;right:27px;top:60px;min-width:22px;font-size:11px;color:#ddc18d}.pulse-button:disabled{filter:saturate(.3);opacity:.6}.pulse-button.armed .spell-art{border-color:#ffe0a0;box-shadow:0 0 0 4px #172029,0 0 0 5px #c9a459,0 0 30px #f7ad5360}
#save-status{position:absolute;left:30px;bottom:5px;font-size:10px;color:#94a597}
#battle-tooltip{position:absolute;left:525px;bottom:219px;width:440px;height:194px;padding:19px 24px;background:linear-gradient(#1d242cf5,#121b24f5),url('assets/ui-material-v2.webp');border:1px solid #b89b68;box-shadow:0 7px 24px #0009,inset 0 0 0 4px #20282d;pointer-events:none;z-index:12}
#battle-tooltip h3{font:23px/1.3 EmberTitle,sans-serif;color:#e9d5a5;margin-bottom:5px}#battle-tooltip p{font-size:14px;line-height:1.65;color:#c3c7b5}#battle-tooltip .tooltip-cost{float:right;color:#e3c17e;font-size:17px}#battle-tooltip small{display:block;color:#a5b4a2;font-size:12px;margin-top:7px}
#onboarding{position:absolute;left:50%;top:633px;transform:translateX(-50%);width:624px;height:85px;padding:12px 30px;background:linear-gradient(90deg,transparent,#17212cef 14%,#17212cef 86%,transparent);border-top:1px solid #b49b6266;text-align:center;text-shadow:0 2px 3px #000}
.onboarding strong{display:block;font:20px/1.4 EmberTitle,sans-serif;color:#efd7a0}.onboarding>span{display:flex;justify-content:center;gap:10px;align-items:center;font-size:12px;color:#bcc8b0;margin-top:5px}.onboarding b{display:inline-flex;align-items:center;justify-content:center;width:17px;height:17px;border:1px solid #9e966b;border-radius:50%;font-size:10px;font-weight:400;color:#e8d49e}.onboarding i{width:14px;height:14px;color:#9d9a76}.onboarding>button{position:absolute;right:38px;top:5px;font-size:18px;color:#b9b49c}
#wave-banner{position:absolute;left:50%;top:245px;transform:translate(-50%,-8px);width:730px;height:114px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:7px;background:linear-gradient(90deg,transparent,#0b1420c9 20%,#0b1420c9 80%,transparent);opacity:0;pointer-events:none;transition:opacity .28s,transform .28s;z-index:8;text-shadow:0 2px 3px #000}
#wave-banner.visible{opacity:1;transform:translate(-50%,0)}#wave-banner strong{font:32px/1.4 EmberTitle,sans-serif;color:#f1ddb0}#wave-banner small{color:#c9ccb8;font-size:14px}
#modal-backdrop{position:absolute;inset:0;z-index:30;background:#070c15b8;backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center}
#game-modal{position:relative;width:1080px;height:744px;padding:62px 43px 45px;display:grid;grid-template-rows:82px 54px minmax(0,1fr) 66px;background:url('assets/ui-frame-v2.webp') center/100% 100% no-repeat;filter:drop-shadow(0 17px 30px #000b)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:5px 12px 0}.modal-header small{display:block;font-size:13px;letter-spacing:.06em;color:#bda47a;margin-bottom:5px}.modal-header h2{font:34px/1.4 EmberTitle,sans-serif;color:#f0dfb6}.modal-header .icon-button{width:41px;height:41px}
#modal-tabs{height:54px;display:flex;align-items:center;gap:9px;padding:0 10px;border-bottom:1px solid #75644977}#modal-tabs[hidden]{display:flex!important;visibility:hidden;pointer-events:none}
#modal-tabs button{position:relative;height:43px;min-width:152px;padding:5px 22px;font:18px/1.3 EmberTitle,sans-serif;color:#aeb2a4;border:1px solid #4d5149;border-bottom:0;background:linear-gradient(#30363799,#1b242b99);clip-path:polygon(8px 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%,0 8px)}
#modal-tabs button[aria-selected=true]{color:#f4db9f;border-color:#bda06b;background:linear-gradient(#5a4c33aa,#35372c)}#modal-tabs button[aria-selected=true]:after{content:"";position:absolute;left:12px;right:12px;bottom:0;height:3px;background:#c1a268}
.modal-body{position:relative;min-height:0;overflow-y:auto;overflow-x:hidden;padding:19px 12px 10px;overscroll-behavior:contain;scrollbar-gutter:stable}
::-webkit-scrollbar{width:7px;height:7px}::-webkit-scrollbar-track{background:#0d141c;border-left:1px solid #51483766}::-webkit-scrollbar-thumb{background:#806e4b;border:1px solid #aa905e}
#modal-footer{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px 12px 0;border-top:1px solid #67573c77;font-size:12px;color:#aaa994}
.action-button{display:inline-flex;justify-content:center;align-items:center;min-width:166px;height:45px;padding:6px 24px;color:#f1dcaa;font:19px/1.4 EmberTitle,sans-serif;background:linear-gradient(#666044,#373f36);border:1px solid #ad9561;box-shadow:inset 0 0 0 3px #2b332b,0 3px 4px #0006;clip-path:polygon(8px 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%,0 8px);white-space:nowrap}
.action-button.secondary{background:linear-gradient(#343a3c,#202b30);border-color:#7d775a;color:#d8cfb3}.action-button.danger{background:linear-gradient(#4d3530,#30282b);border-color:#9b6a55;color:#e2b9a1}
.pause-actions{display:grid;gap:6px;width:410px}.pause-actions .action-button{width:100%;height:48px;justify-content:flex-start;padding-left:37px;font-size:20px}.pause-copy{position:absolute;right:25px;top:310px;width:390px;font-size:15px;line-height:1.8;color:#b8b9a7;text-align:center}#game-modal[data-kind=pause] .modal-body{background:url('assets/core.webp') 83% 48%/252px 252px no-repeat}
.settings-row{display:flex;align-items:center;justify-content:space-between;height:61px;padding:8px 15px;border-bottom:1px solid #55564655}.settings-row strong{display:block;font-size:16px;font-weight:400;color:#e0d7bd}.settings-row small{display:block;color:#949f98;font-size:12px}.toggle{width:89px;height:33px;border:1px solid #796c50;font-size:13px;color:#a7ad9f;background:#141d24;box-shadow:inset 0 2px 4px #0007}.toggle[aria-pressed=true]{color:#f0d394;background:linear-gradient(#615b3e,#3e4936);border-color:#b5a06b}input[type=range]{width:220px;height:24px;accent-color:#c1a169;cursor:pointer}
.key-grid{display:grid;grid-template-columns:1fr 1fr;gap:5px 30px;padding:0 15px;color:#afbbad;font-size:12px}.key-grid>span{display:flex;align-items:center;gap:12px}.key-grid kbd{min-width:52px;font-size:10px}.settings-keys{font:18px/1.4 EmberTitle,sans-serif;color:#c9bb98;margin:14px 15px 8px}
.confirm-box{height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;text-align:center;font-size:18px;line-height:1.9;color:#bfc8b5}.confirm-box>i{width:55px;height:55px;color:#c9ac72}.confirm-box strong{color:#ebd4a0;font-weight:400}.confirm-actions{display:flex;gap:15px;margin-top:15px}
.codex-layout{display:grid;grid-template-columns:220px minmax(0,1fr);height:100%;min-height:0;gap:24px}.codex-list{overflow-y:auto;min-height:0;padding-right:8px;display:flex;flex-direction:column;gap:6px}
.codex-list button{position:relative;min-height:61px;flex:0 0 61px;display:flex;align-items:center;gap:10px;padding:5px 8px;text-align:left;border-left:2px solid #515c5144;background:linear-gradient(90deg,#222e3255,transparent);font:17px/1.4 EmberTitle,sans-serif;color:#bac4b4}
.codex-list button img,.codex-list button .enemy-art{width:48px;height:48px;object-fit:contain;margin:0;flex-shrink:0}.codex-list button[aria-selected=true]{border-left-color:#ebcb88;color:#f2dca7;background:linear-gradient(90deg,#7e6b3a55,#323b3511)}
.codex-detail{position:relative;min-height:0;overflow-y:auto;padding:8px 14px 14px 0}.detail-hero{height:198px;display:flex;align-items:center;gap:30px;border-bottom:1px solid #69664755;margin-bottom:18px}.detail-art{width:195px;height:193px;object-fit:contain;filter:drop-shadow(0 5px 8px #0009)}.detail-hero .enemy-art{width:190px;height:190px;margin:0}.detail-hero h3{font-size:32px;color:#ead5a1;line-height:1.4;margin-bottom:8px}.detail-hero .tag{font-size:13px;color:#b8c2af}.detail-description{font-size:16px;line-height:1.9;color:#bdc8b6;margin-bottom:18px}.detail-stats{display:flex;gap:12px;flex-wrap:wrap}.detail-stats>div{padding-right:24px;border-right:1px solid #64664766;min-width:105px}.detail-stats small{display:block;font-size:12px;color:#8f9f95}.detail-stats strong{display:block;font:24px/1.4 EmberTitle,sans-serif;color:#d9ceb0}
.field-manual{display:grid;grid-template-columns:245px minmax(0,1fr);height:100%;gap:28px}.manual-art{height:100%;background:linear-gradient(0deg,#101a2399,#101a2300),url('assets/cover.webp') 72% center/cover;border:1px solid #78724a66;display:flex;align-items:flex-end;justify-content:center;padding:25px 15px;color:#ebd8a6;font:24px/1.6 EmberTitle,sans-serif;text-align:center}.manual-scroll{overflow-y:auto;min-height:0;padding-right:20px}.manual-scroll h3{font-size:23px;color:#d6bc86;margin-bottom:10px}.manual-scroll p{font-size:15px;line-height:1.9;color:#b4c0b1;margin-bottom:22px}
.codex-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.codex-entry{position:relative;padding:12px 16px 18px;border-bottom:1px solid #73654477;background:linear-gradient(#282e2c44,transparent)}.codex-entry h3{font-size:21px;color:#e6cd9a;margin:7px 0}.codex-entry p{font-size:14px;color:#acb9a9;line-height:1.8}.tag{font-size:12px;color:#bdab80}.mini-stats{margin-top:9px;font-size:12px;color:#9aa79b}.enemy-art{width:94px;height:94px;margin:0 auto;background-image:url('assets/enemies.webp');background-size:300% 300%;background-repeat:no-repeat;filter:drop-shadow(0 3px 4px #0008)}.codex-entry>.enemy-art{width:106px;height:106px}
.modal-copy{font-size:16px;color:#b4c1b2;line-height:1.9;margin-bottom:20px}.modal-copy h3{font-size:23px;color:#d4ba84;margin:14px 0 9px}.modal-copy p{margin-bottom:17px}
.relic-choice-grid{height:100%;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;padding:0 3px}
.relic-choice{position:relative;height:390px;text-align:center;padding:17px 21px;border:1px solid #a08b5f;background:radial-gradient(ellipse at 50% 20%,#a68a3e20,transparent 60%),linear-gradient(#252b2dda,#17212ae6),url('assets/ui-material-v2.webp') center/cover;box-shadow:inset 0 0 0 4px #1b232b,inset 0 0 0 5px #75633e66;clip-path:polygon(14px 0,calc(100% - 14px) 0,100% 14px,100% calc(100% - 18px),calc(100% - 18px) 100%,18px 100%,0 calc(100% - 18px),0 14px)}
.relic-choice:hover,.relic-choice:focus-visible{border-color:#eed39a;box-shadow:inset 0 0 0 4px #2b332c,inset 0 0 0 5px #b8a56b99}.relic-choice img{width:139px;height:139px;object-fit:contain;filter:drop-shadow(0 0 19px #d9ad5840);transition:transform .18s}.relic-choice:hover img{transform:translateY(-5px)}.relic-choice h3{font-size:24px;line-height:1.5;color:#edd7a3;margin:4px 0 9px}.relic-choice p{height:75px;font-size:15px;line-height:1.8;color:#b6c2b0;overflow:hidden}.relic-choice>strong{position:absolute;left:25px;right:25px;bottom:20px;height:39px;display:flex;align-items:center;justify-content:center;background:linear-gradient(#5b583d,#3b4535);border:1px solid #9d895c;font:19px EmberTitle,sans-serif;color:#f0d79f}.relic-choice kbd{position:absolute;top:14px;left:16px;background:#242c30;color:#cdb98b}
.result-hero{width:45%;height:150px;display:flex;align-items:center;justify-content:center;gap:20px;border-bottom:1px solid #6e614a66}.result-hero>i{width:65px;height:65px;color:#ceb173}.result-score{font:60px/1.2 EmberTitle,sans-serif;color:#edd39a;letter-spacing:.03em}.result-hero p{font-size:13px;color:#b5bea9;margin-top:7px}
.result-stats{position:absolute;left:20px;top:190px;width:41%;display:grid;grid-template-columns:1fr 1fr;gap:24px 45px}.result-stats small{display:block;font-size:12px;color:#9eae9e}.result-stats strong{font:31px/1.5 EmberTitle,sans-serif;color:#ded5b7}.damage-bars{position:absolute;right:25px;top:30px;width:45%;display:grid;gap:17px}.damage-bars label{font-size:13px;color:#b8c4b2}.damage-bars label>strong{float:right;font-weight:400;color:#b9a681}.damage-bars label>div{height:5px;background:#0b131c;border:1px solid #5f604444;margin-top:5px}.damage-bars b{display:block;height:100%}.result-save{position:absolute;bottom:10px;left:20px;right:20px;font-size:12px;color:#a8bba5;line-height:1.8;text-align:center}
.rank-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;font-size:13px;color:#a7b8a5}.rank-head .subtle-button{height:31px}.rank-mine{height:40px;display:flex;align-items:center;justify-content:center;color:#e5ce98;font-size:14px;background:linear-gradient(90deg,transparent,#b4955620,transparent);border-bottom:1px solid #90774566;margin-bottom:12px}
.ranking-table{width:100%;border-collapse:collapse;font-size:15px;text-align:left;font-variant-numeric:tabular-nums}.ranking-table th{position:sticky;top:-19px;background:#1c232a;color:#bca77d;font-weight:400;font-size:12px;height:37px;border-bottom:1px solid #786448}.ranking-table td{height:47px;border-bottom:1px solid #4d554b77;color:#bdc7b5}.ranking-table th:first-child,.ranking-table td:first-child{width:85px;padding-left:20px}.ranking-table td:first-child{font:25px EmberTitle,sans-serif;color:#c3ab7b}.ranking-table tr.mine{background:#9a844226}.ranking-table .rank-score{font:24px EmberTitle,sans-serif;color:#e2ce9f}.ranking-table td:nth-child(2){max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rank-empty{height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:18px;color:#aab9a6;font-size:16px;text-align:center}.rank-empty>i{width:75px;height:75px;color:#af9665}.rank-empty>strong{font:25px EmberTitle,sans-serif;color:#d7c6a1}.rank-empty p{font-size:13px}.rank-empty .rank-score{font:26px EmberTitle,sans-serif;color:#e3c98e}
#toast{position:absolute;z-index:80;left:50%;bottom:225px;transform:translate(-50%,7px);width:730px;height:64px;display:flex;align-items:center;justify-content:center;padding:8px 28px;background:linear-gradient(90deg,transparent,#151f2af2 10%,#151f2af2 90%,transparent);border-top:1px solid #b59a6288;border-bottom:1px solid #635e4255;color:#e1d7b9;font-size:16px;text-align:center;line-height:1.6;opacity:0;pointer-events:none;transition:opacity .15s,transform .15s}
#toast.visible{opacity:1;transform:translate(-50%,0)}#loading{position:absolute;inset:0;z-index:100;background:#0b121be6;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:28px;color:#d9c496;font:23px EmberTitle,sans-serif}.loading-sigil{width:65px;height:65px;color:#d5b576}
.large-text .detail-description,.large-text .manual-scroll p{font-size:18px}.large-text .settings-row small{font-size:14px}.large-text .relic-choice p{font-size:17px}.reduce-motion *{transition:none!important;animation:none!important}
#game-session-gate{background:#070f19c9!important;backdrop-filter:blur(10px);font-family:'Malgun Gothic',sans-serif!important}#game-session-gate section{width:560px!important;max-width:calc(100vw - 36px)!important;height:350px!important;padding:42px 45px!important;border:0!important;border-radius:0!important;background:url('assets/ui-frame-v2.webp') center/100% 100% no-repeat!important;display:flex!important;flex-direction:column!important;box-shadow:0 20px 70px #0009!important;color:#d8cfb4!important}#game-session-gate h1{font:31px/1.5 EmberTitle,sans-serif!important;color:#e7d0a0!important;margin:0 0 18px!important}#game-session-gate p{font-size:13px!important;line-height:1.8;color:#a9b9a7!important}#game-session-gate section>div{margin-top:auto!important}#game-session-gate button,#game-session-gate a:not([hidden]){height:42px!important;padding:7px 18px!important;border:1px solid #a18a58!important;border-radius:0!important;background:linear-gradient(#5b5b3d,#354336)!important;color:#efdb9c!important;font-size:13px!important;display:inline-flex;align-items:center;justify-content:center}

#game-modal[data-kind=codex] .modal-body{overflow:hidden}.forecast{min-height:120px}.field-right .arena-tools{margin-top:8px}.enemy-chip .enemy-art{display:block}.menu-button:focus-visible{outline:none;color:#f4dca5}


.field-left,.field-right{isolation:isolate}.field-left:before,.field-right:before{content:"";position:absolute;inset:-15px -12px -12px;z-index:-1;pointer-events:none;background:linear-gradient(90deg,#0c1520a0,transparent)}.field-right:before{background:linear-gradient(270deg,#0c1520b0,transparent)}.enemy-chip{background:radial-gradient(#121c22bb,transparent 75%);border-bottom:1px solid #ba9a6966}

/* Information that is not needed for an immediate command lives in the field guide. */
.field-left{top:111px;width:240px}.arena-caption{display:none}.relic-strip{margin-top:0;width:240px}.relic-strip .section-label,.relic-empty{display:none}#owned-relics{margin:0;height:47px}.field-right{top:111px;width:185px}.forecast{display:none}.field-right .arena-tools{margin:0}.field-left:before,.field-right:before{background:none}

.spell-art:before{content:"";position:absolute;inset:-8px;border-radius:50%;background:conic-gradient(#edc978 var(--charge,360deg),#665c4744 0);mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0);pointer-events:none}

/* Item name, explanation and action have reserved slots at every text size. */
.relic-choice img{position:absolute;left:50%;top:17px;transform:translateX(-50%)}.relic-choice:hover img{transform:translate(-50%,-5px)}.relic-choice h3{position:absolute;left:20px;right:20px;top:162px;height:38px;margin:0;display:flex;align-items:center;justify-content:center}.relic-choice p{position:absolute;left:22px;right:22px;top:206px;height:73px;margin:0;line-height:1.65;overflow-y:auto}.wave-counter #wave-name:after{content:" ›";color:#dcc48f}html,body{text-size-adjust:100%;-webkit-text-size-adjust:100%}

.hud-top,.command-deck{pointer-events:auto}


.ranking-table{table-layout:fixed}.ranking-table th{top:0}.ranking-table th:first-child{width:10%}.ranking-table th:nth-child(2){width:42%}.ranking-table th:nth-child(3){width:30%}.ranking-table th:nth-child(4){width:18%}

/* Reconstruction and expedition screens use the same fixed-height game window. */
html[data-game-viewport="ember-keep"] body{overflow:clip}
.title-menu{top:50px}.title-menu h1,.title-menu h1 img{height:285px}.menu-button{height:55px}
.expedition-ribbon{position:absolute;left:405px;right:435px;bottom:201px;height:34px;display:flex;align-items:center;justify-content:center;gap:20px;background:linear-gradient(90deg,transparent,#101b23dc 15%,#101b23dc 85%,transparent);font-size:12px;color:#dbcfad;text-shadow:0 2px 4px #000}
#bounty-order{height:29px;border-bottom:1px solid #a08359;color:#c0b99f;white-space:nowrap}#bounty-order b{font-weight:400;color:#919e8d;margin-left:5px}#bounty-order[aria-pressed=true]{color:#f3bf87;border-color:#e5a36c}#bounty-order[aria-pressed=true] b{color:#f3bf87}.field-rebuild{font-size:11px;color:#c5b27f;white-space:nowrap}.expedition-ribbon>span{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.inspector .move-button{position:absolute;left:-103px;bottom:-1px;width:96px;height:27px;font-size:11px;color:#cbb78d}.inspector:has(.move-button) .level{bottom:30px}.inspector:has(.move-button) .inspector-art{top:-4px;height:95px}
#game-modal[data-kind=progress] .modal-body,#game-modal[data-kind=expedition] .modal-body,#game-modal[data-kind=specialization] .modal-body{overflow:hidden}
.progress-layout{display:grid;grid-template-columns:300px minmax(0,1fr);height:100%;gap:23px}.forge-scene{position:relative;height:100%;background:linear-gradient(0deg,#0b141cf5 0%,#101a2422 75%),url('assets/forge-hall.webp') 25% center/cover;border:1px solid #84704a80}.forge-caption{position:absolute;left:23px;right:20px;bottom:23px}.forge-caption small{font-size:12px;color:#ddc695}.forge-caption h3{font:44px/1.5 EmberTitle,sans-serif;color:#f1d194}.forge-caption h3 em{font-size:20px;color:#d8ba7d}.forge-caption p{font-size:13px;line-height:1.8;color:#bdc1ad}
.progress-details{min-height:0;overflow-y:auto;padding-right:8px;overscroll-behavior:contain}.research-row{position:relative;height:93px;display:flex;align-items:center;gap:15px;border-bottom:1px solid #6a604344}.research-row>img{width:63px;height:70px;object-fit:contain;filter:drop-shadow(0 2px 6px #0008)}.research-row>div{flex:1;min-width:0}.research-row h3{font:21px/1.3 EmberTitle,sans-serif;color:#e6ce9a}.research-row h3 span{font:12px 'Malgun Gothic',sans-serif;color:#a8b5a2;margin-left:10px}.research-row p{font-size:12px;color:#aab9a6;line-height:1.6;margin:4px 0}.research-row p b{font-weight:400;color:#e8cea1}.research-pips{display:flex;gap:5px;height:6px}.research-pips i{width:28px;height:4px;border:1px solid #7d715550;background:#101a22}.research-pips i.lit{background:#cbb471;border-color:#f0d699;box-shadow:0 0 5px #eeb95c40}.research-buy{width:108px;flex-shrink:0;height:54px;border:1px solid #a28956;background:linear-gradient(#56513b,#303d33);box-shadow:inset 0 0 0 3px #19252a;color:#ecd49b}.research-buy strong{display:block;font:19px EmberTitle,sans-serif}.research-buy small{display:block;font-size:11px;margin-top:3px}.research-buy:disabled{opacity:.45;filter:saturate(.4);font-size:13px}
.mission-list{display:grid;gap:1px}.mission-row{height:83px;border-bottom:1px solid #5c5c4544;display:flex;align-items:center;gap:16px}.mission-row>i{width:32px;height:36px;color:#7d8879}.mission-row h3{font:20px EmberTitle,sans-serif;color:#d3ceb4}.mission-row p{font-size:12px;color:#98ad9a;margin-top:6px}.mission-row>strong{margin-left:auto;font-size:13px;font-weight:400;white-space:nowrap;color:#bdab79}.mission-row.complete>i,.mission-row.complete>strong{color:#dbbc78}.mission-row.complete h3{color:#e2cb9a}
.doctrine-choices{height:254px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:17px}.doctrine-choice{position:relative;padding:9px 19px 20px;background:radial-gradient(ellipse at 50% 20%,#95743b20,transparent 80%);border-bottom:2px solid #5b604b;border-top:1px solid #61634d40;text-align:center}.doctrine-choice>img{width:88px;height:95px;object-fit:contain;filter:drop-shadow(0 2px 10px #b88a4b33)}.doctrine-choice h3{font:25px EmberTitle,sans-serif;color:#e6d6af;margin-top:2px}.doctrine-choice p{font-size:13px;line-height:1.8;color:#a8b9a6;margin-top:7px;height:51px}.doctrine-choice>small{display:block;font-size:11px;color:#a49e80;margin-top:6px}.doctrine-choice[aria-pressed=true]{border-color:#d4b36f;background:radial-gradient(ellipse at 50% 20%,#a68c3e35,transparent 80%);box-shadow:inset 0 -12px 20px #dbb75c0c}.doctrine-choice:disabled{opacity:.4;filter:grayscale(.8)}
.invasion-select{height:92px;display:flex;align-items:center;justify-content:space-between;gap:20px;border-bottom:1px solid #615d4544}.invasion-select h3{font-size:22px;color:#d9c190}.invasion-select>div>small{font-size:11px;color:#94a58e}.invasion-steps{display:flex;gap:8px}.invasion-steps button{width:60px;height:48px;font:23px EmberTitle,sans-serif;border:1px solid #776c4c;color:#d3c49b;background:#1b272c}.invasion-steps button:first-child{width:95px;font-size:19px}.invasion-steps button[aria-pressed=true]{border-color:#e0c17c;color:#f3d39b;background:#62563166}.invasion-steps small{display:block;font:9px 'Malgun Gothic',sans-serif;color:#8b9685;margin-top:1px}.invasion-steps button:disabled{opacity:.35}.expedition-summary{font-size:12px;color:#b7b9a0;padding-top:12px;text-align:center}
.branch-choices{height:100%;display:grid;grid-template-columns:1fr 1fr;gap:22px;padding:20px 5px}.branch-choice{position:relative;height:325px;border:1px solid #82734d;text-align:center;background:radial-gradient(ellipse at 50% 25%,#8b744529,transparent 70%)}.branch-choice>img{position:absolute;top:12px;left:50%;transform:translateX(-50%);height:100px;width:100px;object-fit:contain;filter:drop-shadow(0 0 20px #cca45422)}.branch-choice h3{position:absolute;left:16px;right:16px;top:123px;height:35px;line-height:35px;font-size:28px;color:#eed39e;margin:0}.branch-choice p{position:absolute;left:20px;right:20px;top:167px;height:54px;margin:0;font-size:15px;line-height:1.7;color:#b9c6ae}.branch-choice small{position:absolute;left:12px;right:12px;top:232px;height:20px;line-height:20px;display:block;font-size:12px;color:#a7b497}.branch-select{position:absolute;left:50%;bottom:18px;transform:translateX(-50%);width:108px;height:34px;border:1px solid #aa925e;background:linear-gradient(#59523c,#303b31);box-shadow:inset 0 0 0 2px #202c2b;color:#ead2a1;font:18px EmberTitle,sans-serif}.branch-select:hover{border-color:#ecd39b;background:linear-gradient(#756244,#3e4b38)}
#game-modal[data-kind=result] .result-stats{top:160px;gap:13px 45px}#game-modal[data-kind=result] .result-hero{height:128px}#game-modal[data-kind=result] .damage-bars{top:15px;gap:12px}.result-embers{position:absolute;bottom:40px;left:20px;right:20px;height:73px;display:flex;align-items:center;gap:15px;padding:6px 17px;border-top:1px solid #b2975855;background:linear-gradient(90deg,#b78d3518,transparent)}.result-embers>img{width:49px;height:64px;object-fit:contain}.result-embers>div{flex:1}.result-embers strong{font:26px EmberTitle,sans-serif;color:#edc780}.result-embers p{font-size:12px;color:#acb99f;margin-top:2px}.result-embers .action-button{height:39px;font-size:17px;min-width:137px}
.large-text .research-row p,.large-text .mission-row p{font-size:13px}.large-text .doctrine-choice p{font-size:14px}.large-text .branch-choice p{font-size:16px}
.expedition-ribbon{left:auto;right:442px;width:232px;justify-content:flex-end;background:none;gap:22px}.inspector.selected .inspector-art{height:79px;top:1px}.inspector.selected .level{top:-15px;bottom:auto;font-size:11px;letter-spacing:0}.inspector .reforge-button{position:absolute;left:0;top:82px;width:96px;height:25px;font-size:11px;border:1px solid #967b4d;background:#26322a;color:#e3c488}.inspector:has(.reforge-button) .move-button{bottom:0}
.forge-choices{height:100%;display:grid;grid-template-columns:1fr 1fr;gap:25px;padding:12px 22px}.forge-choice{position:relative;height:357px;text-align:center;border:1px solid #6f7158;background:radial-gradient(ellipse at 50% 34%,#a68b3c20,transparent 75%)}.forge-choice>small{display:block;font-size:12px;color:#b2bba6;margin-bottom:10px}.forge-choice>img{width:126px;height:126px;object-fit:contain;filter:drop-shadow(0 0 15px #bea35e44)}.forge-choice h3{font-size:27px;color:#e8d09d;margin:9px 0 14px}.forge-choice p{font-size:16px;color:#b5c4aa}.forge-choice>strong{position:absolute;bottom:21px;left:40px;right:40px;padding-top:11px;border-top:1px solid #a88d5b;font:21px EmberTitle,sans-serif;color:#e8ce92}.forge-choice.quality-1{border-color:#8cb9c3;background-color:#7dbac30a}.forge-choice.quality-1 h3{color:#b7e7ed}.forge-choice.quality-2{border-color:#e0bd72;box-shadow:inset 0 0 38px #d6a23e18}.forge-choice.quality-2 h3{color:#ffdda1}.forge-choice:hover{background-color:#c0a05114}
.codex-paths{margin-top:23px;padding-top:14px;border-top:1px solid #665d4366}.codex-paths h3{font-size:21px;color:#d8bf86;margin:12px 0 8px}.codex-paths p{font-size:14px;line-height:1.9;color:#aebda6;margin:9px 0}.codex-paths b{color:#e0cb9b;font-weight:400}
.inspector .role{overflow:hidden;text-overflow:ellipsis}.forge-choice>small{position:absolute;left:0;right:0;top:16px;margin:0}.forge-choice>img{position:absolute;left:50%;top:48px;transform:translateX(-50%)}.forge-choice h3{position:absolute;left:20px;right:20px;top:195px;height:42px;margin:0;display:flex;align-items:center;justify-content:center}.forge-choice p{position:absolute;left:25px;right:25px;top:244px;height:34px;margin:0}.forge-choice>strong{height:40px;bottom:20px;padding:0;display:flex;align-items:center;justify-content:center}

/* Fixed-size, world-anchored tower command bubble. */
#inspector.tower-popover{position:absolute;z-index:21;width:404px;height:270px;bottom:auto;margin:0;padding:0;background:linear-gradient(145deg,#28312cf9,#111c24fa),url('assets/ui-material-v2.webp');border:1px solid #c3a269;box-shadow:0 9px 28px #000a,inset 0 0 0 4px #172128,inset 0 0 0 5px #8f7a4444;filter:drop-shadow(0 4px 3px #0006)}
#inspector.tower-popover:after{content:"";position:absolute;left:calc(var(--pointer-x) - 9px);bottom:-10px;width:18px;height:18px;transform:rotate(45deg);background:#172229;border-right:1px solid #c3a269;border-bottom:1px solid #c3a269;pointer-events:none}
#inspector.tower-popover[data-side=below]:after{top:-10px;bottom:auto;transform:rotate(225deg)}
#inspector.tower-popover[data-side=right]:after{left:-10px;top:calc(var(--pointer-y) - 9px);bottom:auto;transform:rotate(135deg)}
#inspector.tower-popover[data-side=left]:after{left:auto;right:-10px;top:calc(var(--pointer-y) - 9px);bottom:auto;transform:rotate(-45deg)}
#inspector.tower-popover .inspector-art{left:16px;top:25px;width:108px;height:123px;object-fit:contain}#inspector.tower-popover .level{left:140px;right:40px;top:9px;bottom:auto;width:auto;height:17px;text-align:left;letter-spacing:0;font-size:11px;color:#c7b581}
#inspector.tower-popover .level b{font-weight:800;color:#f5e0b1;font-size:13px}
#inspector.tower-popover .level .max-level{display:inline-block;margin-left:9px;padding-left:9px;border-left:1px solid #a38d5755;font:11px/17px 'Malgun Gothic',sans-serif;color:#ead2a0}
#inspector.tower-popover h2{position:absolute;left:140px;right:35px;top:29px;font-size:25px;line-height:1.2;margin:0}#inspector.tower-popover .role{position:absolute;left:140px;right:16px;top:65px;height:33px;font-size:12px;line-height:1.35;white-space:normal;margin:0;overflow:hidden}
#inspector.tower-popover .stats-grid{position:absolute;left:140px;right:15px;top:101px;display:grid;grid-template-columns:repeat(3,1fr);gap:6px}#inspector.tower-popover .stats-grid strong{font-size:22px}#inspector.tower-popover .stats-grid small{font-size:11px}
#inspector.tower-popover .upgrade-budget{position:absolute;left:16px;right:16px;top:149px;height:16px;display:flex;justify-content:space-between;align-items:center;font-size:11px;line-height:16px;color:#b9c2a8}#inspector.tower-popover .upgrade-budget button{font:11px/16px 'Malgun Gothic',sans-serif;color:#e5c886;padding:0 2px;border-bottom:1px solid #a0874855}
#inspector.tower-popover .inspector-actions{position:absolute;left:16px;right:16px;bottom:16px;height:86px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:40px 40px;gap:6px}
#inspector.tower-popover .inspector-actions button{position:static;width:auto;height:40px;margin:0;font-size:13px;padding:3px 5px;border:1px solid #7e7856;background:linear-gradient(#3e463a,#27342d);white-space:nowrap;min-width:0;color:#e2d3a7}
#inspector.tower-popover .upgrade-button{grid-row:1;grid-column:1/3;display:flex;align-items:center;justify-content:space-around}#inspector.tower-popover .upgrade-button span{font-size:17px}#inspector.tower-popover .upgrade-button small{font-size:12px}
#inspector.tower-popover .target-button{grid-row:1;grid-column:3}#inspector.tower-popover .move-button{grid-row:2;grid-column:1}#inspector.tower-popover .modify-button{grid-row:2;grid-column:2;line-height:1.2}#inspector.tower-popover .modify-button small{display:block;font-size:10px;color:#c7b47e}#inspector.tower-popover .sell-button{grid-row:2;grid-column:3}#inspector.tower-popover .inspector-actions button:disabled{opacity:.45}
.popover-close{position:absolute;right:9px;top:8px;width:28px;height:28px;font-size:24px;color:#beb79e;line-height:1}
.modification-summary{height:75px;display:flex;gap:18px;align-items:center;border-bottom:1px solid #7c714b66;padding-bottom:10px}.modification-summary>img{width:70px;height:70px;object-fit:contain}.modification-summary>div{flex:1}.modification-summary small{display:block;font-size:12px;color:#a7b49e}.modification-summary strong{font:23px EmberTitle,sans-serif;color:#e4cd97}.modification-summary>b{font-size:15px;color:#e2c57f;font-weight:400}
.modification-choices{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;height:291px;padding-top:18px}.modification-choices button{height:273px;text-align:center;border:1px solid #8a7b52;background:radial-gradient(ellipse at 50% 25%,#ac8c3f22,transparent 80%);position:relative}.modification-choices img{position:absolute;left:50%;top:22px;transform:translateX(-50%);width:90px;height:97px;object-fit:contain}.modification-choices h3{position:absolute;left:8px;right:8px;top:143px;height:32px;line-height:32px;font-size:23px;color:#ead1a0;margin:0}.modification-choices p{position:absolute;left:5px;right:5px;top:184px;height:24px;line-height:24px;font-size:14px;color:#b9c5ae;margin:0}.modification-choices strong{position:absolute;left:10px;right:10px;bottom:16px;height:35px;padding:7px 0;border-top:1px solid #b99c68;font:18px EmberTitle,sans-serif;color:#e7ca8e}.modification-choices button:disabled{opacity:.5}
#landmark-hit-layer{position:absolute;inset:0;pointer-events:none}.gate-hit{position:absolute;pointer-events:auto;border:0;background:none}.gate-hit:focus-visible{outline:2px solid #ead394;outline-offset:2px}.pulse-armed .gate-hit{pointer-events:none}
.tower-card .tower-cap{position:absolute;right:7px;top:7px;z-index:2;font:9px/15px 'Malgun Gothic',sans-serif;color:#e0c790;background:#122027e6;padding:0 4px;border:1px solid #8c784c66;pointer-events:none}
.build-level-cap{font-size:12px;line-height:18px;color:#ead09b;margin-top:5px}.build-upgrade-budget{font-size:12px;line-height:18px;color:#d4c08d;margin-top:4px}
#game-modal[data-kind=upgrade-plan] .modal-body{overflow:hidden}.upgrade-overview{height:52px;display:flex;align-items:center;gap:15px;margin-bottom:12px;border-bottom:1px solid #9a825055;padding-bottom:7px}.upgrade-overview>img{width:48px;height:52px;object-fit:contain}.upgrade-overview>div{flex:1}.upgrade-overview h3{font:23px/1.2 EmberTitle,sans-serif;color:#eed39f}.upgrade-overview p{font-size:12px;line-height:1.5;color:#b9c4aa;margin-top:4px}.upgrade-overview>span{font-size:10px;line-height:1.55;color:#d3bd89;text-align:right}
.upgrade-table-header,.upgrade-row{display:grid;grid-template-columns:90px 90px 95px 90px 75px minmax(0,1fr);gap:12px;align-items:center;padding:0 13px}.upgrade-table-header{height:25px;font-size:11px;color:#9ca992;border-bottom:1px solid #6a664955}.upgrade-row{height:44px;border-bottom:1px solid #64644644;font-size:14px;color:#bcc9b1}.upgrade-row strong{font:18px/1.2 EmberTitle,sans-serif;color:#ead4a4}.upgrade-row small{font-size:10px;color:#a2ae95}.upgrade-row .upgrade-level{font:17px/1.2 EmberTitle,sans-serif;color:#e3cf9a}.upgrade-level small,.upgrade-poison{display:block;line-height:1.3}.upgrade-row.current{background:linear-gradient(90deg,#ba974d2b,#ba974d08);box-shadow:inset 3px 0 #d0af6f}.upgrade-row.complete{opacity:.5}.upgrade-milestone{font-size:12px;color:#d4c69f}.upgrade-plan-note{font-size:11px;line-height:1.6;color:#a2b097;margin-top:10px}
.codex-upgrade-costs{margin-top:18px;padding-top:13px;border-top:1px solid #786a4544}.codex-upgrade-costs h3{font-size:21px;color:#e0c58c;margin-bottom:10px}.codex-upgrade-costs>div{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}.codex-upgrade-costs span{font-size:11px;color:#aebba1;border-bottom:1px solid #6a65494d;padding-bottom:6px}.codex-upgrade-costs b{display:block;font:17px/1.5 EmberTitle,sans-serif;color:#e1c68e}.codex-upgrade-costs p{font-size:11px;color:#a6b396;margin-top:8px}

/* End-of-expedition ledger: the window and tabs stay fixed; only the long list scrolls. */
#game-modal[data-kind=result] .modal-body{overflow:hidden}
.result-panel{position:relative;height:100%;min-height:0}
#game-modal[data-kind=result] .result-stats{top:145px;left:12px;gap:10px 35px}
#game-modal[data-kind=result] .result-hero{height:126px}
#game-modal[data-kind=result] .result-stats strong{font-size:29px}
#game-modal[data-kind=result] .result-embers{left:0;right:0;bottom:27px;height:69px}
#game-modal[data-kind=result] .result-save{left:0;right:0;bottom:0;font-size:11px}
.result-damage-summary{position:absolute;right:0;top:1px;width:51%;height:282px;padding-left:22px;border-left:1px solid #89734544}
.result-damage-summary>header{display:flex;align-items:center;justify-content:space-between;height:32px;border-bottom:1px solid #89734566;margin-bottom:5px}
.result-damage-summary h3{font:20px/1.2 EmberTitle,sans-serif;color:#e4cd9b}.result-damage-summary header>span{font-size:11px;color:#a3b09b}.result-damage-summary header b{font:17px EmberTitle,sans-serif;color:#e2c58c}
.summary-damage-row{display:flex;align-items:center;gap:8px;height:36px}.summary-damage-row>img{width:34px;height:34px;object-fit:contain;flex:none}.summary-damage-row>div{flex:1;min-width:0}.summary-damage-label{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:4px;font-size:12px;color:#c2c9b1}.summary-damage-label strong{font:17px EmberTitle,sans-serif;color:#e2d0a6}.summary-damage-label small{display:inline-block;min-width:43px;text-align:right;font:10px 'Malgun Gothic',sans-serif;color:#aab8a1}
.damage-track{height:12px;background:#09141bd9;border:1px solid #71644766;box-shadow:inset 0 2px 4px #0008;overflow:hidden}.damage-track b{display:block;height:100%;background:linear-gradient(0deg,#0004,transparent),var(--damage-color);box-shadow:inset 0 1px 0 #fff5,0 0 8px var(--damage-color);min-width:0}.summary-damage-row .damage-track{height:7px}.result-damage-summary>p{font-size:10px;line-height:1.5;color:#9cac95;text-align:right;margin-top:7px}
.result-damage-panel{display:grid;grid-template-rows:62px 40px minmax(0,1fr) 17px;gap:8px}
.damage-metrics{display:grid;grid-template-columns:1.2fr 1fr 1.15fr 1fr;gap:18px;border-bottom:1px solid #8b775044;padding-bottom:8px}.damage-metrics>div+div{border-left:1px solid #746c4844;padding-left:20px}.damage-metrics small{font-size:11px;color:#a6b59b;display:block;white-space:nowrap}.damage-metrics strong{font:30px/1.45 EmberTitle,sans-serif;color:#ead09b;white-space:nowrap}.damage-metrics em{font-size:16px;font-style:normal;color:#b7bea7}
.damage-toolbar{display:flex;justify-content:space-between;align-items:center;gap:15px}.damage-toolbar>div{display:flex;gap:5px}.damage-toolbar button{height:31px;min-width:111px;border:1px solid #6e6c4b;background:#19272d;font:15px EmberTitle,sans-serif;color:#a6b79e;box-shadow:inset 0 0 0 2px #111e23}.damage-toolbar button[aria-pressed=true]{border-color:#bda16a;background:linear-gradient(#5a5137,#303d32);color:#f0d7a5}.damage-toolbar>span{font-size:10px;color:#a6b09b}
.damage-ranking{display:grid;grid-template-rows:24px minmax(0,1fr);min-height:0}.damage-table-head,.damage-row{display:grid;grid-template-columns:28px 44px 190px minmax(0,1fr) 136px 56px;gap:10px;align-items:center;padding:0 10px}.damage-table-head{font-size:10px;color:#91a48f;border-bottom:1px solid #7d6c4655;padding-right:22px}.damage-table-head>span:nth-last-child(-n+2){text-align:right}.damage-scroll{list-style:none;margin:0;padding:0 6px 0 0;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.damage-row{height:59px;border-bottom:1px solid #66674744;background:linear-gradient(90deg,#3343330d,transparent);color:#bbc6ad}.damage-row.leading{background:linear-gradient(90deg,#ae893428,#59603b12,transparent);box-shadow:inset 2px 0 #d1b171}.damage-rank{font:21px EmberTitle,sans-serif;color:#9d9e7d;text-align:center}.leading .damage-rank{color:#edcb85}.damage-row>img{width:44px;height:49px;object-fit:contain;filter:drop-shadow(0 2px 3px #0009)}.damage-identity{min-width:0}.damage-identity>strong{display:block;font:18px/1.3 EmberTitle,sans-serif;color:#ddceaa;white-space:nowrap}.damage-identity em{font:10px 'Malgun Gothic',sans-serif;font-style:normal;color:#a5b39d;margin-left:5px}.damage-identity mark{background:#694d342b;border:1px solid #92734d88;padding:0 3px;font:9px 'Malgun Gothic',sans-serif;color:#cfb28b}.damage-identity>small{display:block;font-size:10px;line-height:1.45;margin-top:4px;color:#9cac94;white-space:nowrap}.damage-value{text-align:right}.damage-value>strong{display:block;font:22px/1.2 EmberTitle,sans-serif;color:#e7d1a3;white-space:nowrap}.damage-value>small{font-size:10px;color:#aaba9d}.damage-kills{text-align:right;font:18px EmberTitle,sans-serif;color:#b3c3a5}.damage-method{font-size:10px;line-height:17px;color:#95a58d;white-space:nowrap}.damage-empty{height:160px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:14px;font:23px EmberTitle,sans-serif;color:#d8c391}.damage-empty>small{font:12px 'Malgun Gothic',sans-serif;color:#9cab93}
.result-damage-panel[data-view=types] .damage-row{height:39px}.result-damage-panel[data-view=types] .damage-row>img{height:34px}.result-damage-panel[data-view=types] .damage-identity>strong{font-size:17px;line-height:20px}.result-damage-panel[data-view=types] .damage-identity>small{margin-top:0;line-height:13px}.result-damage-panel[data-view=types] .damage-value>strong{font-size:19px;line-height:21px}.result-damage-panel[data-view=types] .damage-value>small{display:block;line-height:12px}

/* Empty subtitle slots retain header and tab coordinates. */
.modal-header small{height:21px;line-height:21px}.modal-header small:empty{visibility:hidden}

/* Compact screens keep the battlefield and the command controls at separate scales. */
#game-shell.compact-screen { inset: 0; width: 100%; height: 100%; transform: none; }
.compact-screen .screen {
  inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  width: auto; height: auto;
}
.compact-screen #title-screen { display: flex; flex-direction: column; overflow-y: auto; background-position: 63% center; }
.compact-screen .title-vignette { position: fixed; background: linear-gradient(0deg,#081117ee,#08111782 65%,#081117bb); }
.compact-screen #title-particles { width: 100%; height: 100%; }
.compact-screen .title-top { position: relative; inset: auto; gap: 10px; padding: 0 14px; }
.compact-screen .back-link { min-height: 44px; display: inline-flex; align-items: center; }
.compact-screen .title-menu { position: relative; inset: auto; width: min(100%,700px); padding: 0 16px 16px; margin: auto; }
.compact-screen .title-menu h1 { height: auto; }
.compact-screen .title-menu h1 img { display: block; width: min(100%,350px); height: auto; margin: auto; }
.compact-screen .menu-actions { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 8px; }
.compact-screen .menu-button { width: 100%; min-height: 48px; height: auto; padding: 6px 4px; font-size: 18px; background: #101a24de; border: 1px solid #9a8154; }
.compact-screen .menu-button small { position: static; margin-top: 3px; font-size: 11px; }
.compact-screen .menu-button > i { display: none; }

.compact-screen #play-screen {
  display: grid; grid-template: auto auto minmax(0,1fr) auto auto / minmax(0,1fr) auto;
  background: #121c24;
}
.compact-screen #arena-wrap { position: relative; grid-area: 3 / 1 / 4 / -1; inset: auto; width: 100%; height: 100%; overflow: hidden; }
.compact-screen #battlefield, .compact-screen #pad-hit-layer { width: 100%; height: 100%; }
.compact-screen .hud-shade, .compact-screen .sanctuary-seal, .compact-screen .score-strip,
.compact-screen .wave-crest, .compact-screen #wave-name, .compact-screen #battle-tooltip,
.compact-screen #play-screen kbd { display: none; }
.compact-screen .hud-top {
  position: relative; inset: auto; grid-area: 1 / 1 / 2 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 5px;
  height: auto; padding: 5px 6px; background: #111922; border-bottom: 1px solid #88745188;
}
.compact-screen .resource-group, .compact-screen .wave-counter, .compact-screen .utility-group {
  position: static; inset: auto; width: auto; height: auto; padding: 0; transform: none; gap: 4px;
}
.compact-screen .resource-group { gap: 6px; padding-inline: 3px; border: 0; background: none; }
.compact-screen .resource { gap: 3px; }
.compact-screen .resource.hp { width: auto; padding-bottom: 6px; transform: none; }
.compact-screen .resource strong { font-size: 20px; }
.compact-screen .resource small { font-size: 10px; white-space: nowrap; }
.compact-screen .resource.gold > i { display: none; }
.compact-screen .hp-track { height: 4px; }
.compact-screen .wave-counter { min-width: 64px; min-height: 44px; align-items: center; clip-path: none; border: 1px solid #8e7850; }
.compact-screen .wave-counter::after { content: none; }
.compact-screen .wave-counter small { font-size: 10px; letter-spacing: 0; }
.compact-screen .wave-counter strong { font-size: 19px; }
.compact-screen .wave-counter strong em { font-size: 12px; }
.compact-screen .utility-group .icon-button { width: 40px; height: 44px; }

.compact-screen .field-left {
  position: relative; inset: auto; grid-area: 2 / 1 / 3 / -1; width: auto; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 8px;
}
.compact-screen .arena-caption { display: flex; }
.compact-screen .arena-caption > span, .compact-screen .arena-caption strong { display: none; }
.compact-screen .arena-caption small { max-width: none; margin: 0; font-size: 11px; }
.compact-screen .relic-strip { display: flex; flex-shrink: 0; align-items: center; gap: 5px; margin: 0; width: auto; }
.compact-screen .relic-strip .section-label { gap: 4px; white-space: nowrap; }
.compact-screen #owned-relics { height: auto; gap: 2px; margin: 0; }
.compact-screen #owned-relics:has(.relic-empty) { display: none; }
.compact-screen .relic-token { width: 32px; height: 34px; }
.compact-screen .relic-token img { width: 30px; height: 30px; }

.compact-screen .expedition-ribbon, .compact-screen .field-right {
  position: relative; inset: auto; width: auto; height: auto; background: none; padding: 0 6px;
}
.compact-screen .expedition-ribbon { grid-area: 4 / 1; justify-content: flex-start; gap: 8px; }
.compact-screen .field-right { grid-area: 4 / 2; }
.compact-screen .forecast { display: none; }
.compact-screen .field-right .arena-tools { margin: 0; }
.compact-screen #bounty-order, .compact-screen .field-rebuild, .compact-screen .arena-tools button {
  height: 36px; min-height: 36px; padding: 0 3px; font-size: 12px; white-space: nowrap;
}
.compact-screen .arena-tools button { gap: 4px; }
.compact-screen .arena-tools i { width: 14px; height: 14px; }

.compact-screen .command-deck {
  position: relative; inset: auto; grid-area: 5 / 1 / 6 / -1; height: auto;
  display: grid; grid-template-columns: auto minmax(0,1fr); align-items: stretch; gap: 6px;
  padding: 6px; background: #151f27; border-top: 1px solid #a58857;
}
.compact-screen .command-deck::before { display: none; }
.compact-screen .build-dock { position: relative; inset: auto; grid-column: 1 / -1; width: auto; height: auto; }
.compact-screen #tower-cards { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); height: auto; gap: 4px; }
.compact-screen .tower-card { width: 100%; height: 65px; }
.compact-screen .tower-cap { display: none; }
.compact-screen .tower-card img { left: 50%; transform: translateX(-50%); width: 33px; height: 33px; }
.compact-screen .tower-name { bottom: 15px; font-size: 12px; }
.compact-screen .tower-cost { font-size: 11px; bottom: 4px; gap: 2px; }
.compact-screen .tower-cost i { width: 10px; height: 10px; }
.compact-screen .cancel-build { top: auto; right: 1px; bottom: calc(100% + 3px); height: 32px; padding: 0 6px; z-index: 2; }
.compact-screen .battle-orders { position: static; width: auto; height: auto; grid-area: 2 / 2; display: flex; align-items: stretch; gap: 5px; }
.compact-screen .speed-controls { position: static; gap: 2px; }
.compact-screen .speed-controls button { height: 44px; min-width: 29px; padding: 2px; }
.compact-screen .start-wave { position: static; flex: 1; min-width: 0; min-height: 44px; height: auto; gap: 3px; text-align: center; }
.compact-screen .start-wave strong { font-size: 16px; }
.compact-screen .start-wave small { display: none; }
.compact-screen .start-wave > i { width: 15px; height: 15px; }
.compact-screen .pulse-button {
  position: static; width: auto; min-width: 92px; height: auto; min-height: 44px; grid-area: 2 / 1;
  display: flex; align-items: center; justify-content: center; gap: 3px; padding: 3px;
  border: 1px solid #887451; background: #202b31;
}
.compact-screen .pulse-button > span { position: static; width: auto; height: auto; }
.compact-screen .pulse-button strong { font-size: 14px; }
.compact-screen .pulse-button small { display: none; }
.compact-screen .spell-art { border: 0; box-shadow: none; }
.compact-screen .spell-art::before { content: none; }
.compact-screen .spell-art img { position: static; width: 21px; height: 24px; display: block; }
.compact-screen .pulse-button.armed { border-color: #ffdda1; background: #624c37; }
.compact-screen .pulse-button.armed .spell-art { box-shadow: none; }
.compact-screen #onboarding {
  top: auto; bottom: 0; width: min(100%,460px); height: auto; padding: 5px 37px 5px 8px;
  transform: translateX(-50%); pointer-events: none; background: #17212cdb; z-index: 2;
}
.compact-screen #onboarding strong { display: none; }
.compact-screen #onboarding > span { font-size: 11px; gap: 3px; margin: 0; flex-wrap: wrap; }
.compact-screen #onboarding > button { top: 50%; right: 0; transform: translateY(-50%); width: 36px; height: 36px; pointer-events: auto; }
.compact-screen #wave-banner { top: 10%; width: 100%; height: auto; padding: 8px; gap: 3px; text-align: center; }
.compact-screen #wave-banner strong { font-size: 24px; }
.compact-screen #wave-banner small { font-size: 12px; }
.compact-screen #toast { bottom: 20px; width: min(100%,550px); height: auto; min-height: 46px; padding: 6px 14px; font-size: 14px; }

.compact-screen #inspector.tower-popover {
  position: relative; grid-area: 3 / 1 / 5 / -1; align-self: end; justify-self: center;
  inset: auto; width: min(calc(100% - 12px),404px); height: auto; max-height: 100%;
  padding: 9px; overflow-y: auto;
}
.compact-screen #inspector.tower-popover::after { content: none; }
.compact-screen #inspector.tower-popover .inspector-art { top: 7px; left: 9px; width: 54px; height: 63px; }
.compact-screen #inspector.tower-popover .level,
.compact-screen #inspector.tower-popover h2,
.compact-screen #inspector.tower-popover .role {
  position: static; width: auto; height: auto; margin: 0 34px 0 59px;
}
.compact-screen #inspector.tower-popover h2 { font-size: 21px; }
.compact-screen #inspector.tower-popover .popover-close { width: 38px; height: 38px; top: 4px; right: 4px; }
.compact-screen #inspector.tower-popover .stats-grid { position: static; margin: 5px 0 0 59px; }
.compact-screen #inspector.tower-popover .stats-grid strong { font-size: 17px; }
.compact-screen #inspector.tower-popover .upgrade-budget { position: static; height: auto; min-height: 32px; gap: 5px; }
.compact-screen #inspector.tower-popover .upgrade-budget button { min-height: 32px; }
.compact-screen #inspector.tower-popover .inspector-actions { position: static; height: auto; grid-template-rows: 38px 38px; }
.compact-screen #inspector.tower-popover .inspector-actions button { height: 38px; }

.compact-screen #modal-backdrop {
  padding: max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right))
           max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
}
.compact-screen #game-modal {
  display: flex; flex-direction: column; width: min(100%,820px); height: min(100%,744px);
  padding: 10px; border: 1px solid #9e8558; background: linear-gradient(145deg,#252d33,#121b24);
}
.compact-screen .modal-header { flex: none; padding: 0 2px 6px; gap: 6px; }
.compact-screen .modal-header h2 { font-size: 24px; }
.compact-screen .modal-header small { height: auto; margin: 0; font-size: 11px; }
.compact-screen .modal-header small:empty { display: none; }
.compact-screen .modal-header .icon-button { flex: 0 0 44px; height: 44px; }
.compact-screen #modal-tabs { flex: none; height: auto; padding: 0; gap: 4px; overflow-x: auto; }
.compact-screen #modal-tabs[hidden] { display: none !important; }
.compact-screen #modal-tabs button { min-width: max-content; min-height: 42px; height: auto; padding: 4px 10px; font-size: 16px; }
.compact-screen #game-modal .modal-body { flex: 1; padding: 8px 2px; overflow: auto; }
.compact-screen #modal-footer { flex: none; flex-wrap: wrap; gap: 5px; padding: 6px 0 0; }
.compact-screen #modal-footer:empty { display: none; }
.compact-screen #modal-footer > span { flex: 1 1 190px; }
.compact-screen .action-button { min-width: 0; padding: 4px 10px; font-size: 16px; }
.compact-screen .pause-actions { width: min(100%,410px); }
.compact-screen .pause-copy { position: static; width: auto; margin-top: 8px; }
.compact-screen .confirm-box { height: auto; min-height: 100%; gap: 8px; font-size: 14px; }
.compact-screen .confirm-actions { gap: 4px; margin: 4px 0; }
.compact-screen .settings-row { min-height: 54px; height: auto; gap: 8px; padding: 5px 2px; }
.compact-screen .settings-row input[type=range] { width: min(40%,220px); }
.compact-screen .settings-row .toggle { flex-shrink: 0; min-height: 40px; }
.compact-screen .key-grid { grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); padding: 0 2px; gap: 6px; }
.compact-screen .doctrine-choices, .compact-screen .invasion-select, .compact-screen .doctrine-choice p { height: auto; }
.compact-screen .doctrine-choices { gap: 6px; }
.compact-screen .doctrine-choice { padding: 5px 4px 10px; }
.compact-screen .doctrine-choice > img { width: 55px; height: 60px; }
.compact-screen .doctrine-choice h3 { font-size: 20px; }
.compact-screen .invasion-select { align-items: flex-start; flex-wrap: wrap; gap: 5px; padding: 7px 0; }
.compact-screen .invasion-steps { max-width: 100%; flex-wrap: wrap; gap: 4px; }
.compact-screen .invasion-steps button { width: 43px; }
.compact-screen .invasion-steps button:first-child { width: 72px; }
.compact-screen .upgrade-table-header, .compact-screen .upgrade-row { min-width: 560px; }
.compact-screen .modification-choices { height: auto; gap: 6px; }
.compact-screen .branch-choice, .compact-screen .modification-choices button { padding: 8px; height: auto; }
.compact-screen .branch-choice > *, .compact-screen .modification-choices button > * {
  position: static; height: auto; line-height: 1.4; transform: none; white-space: normal; margin: 3px auto;
}
.compact-screen .branch-select { min-height: 40px; }
.compact-screen .relic-choice { height: auto; padding: 8px 10px; }
.compact-screen .relic-choice img { width: 70px; height: 70px; }
.compact-screen .relic-choice p { height: auto; }
.compact-screen .relic-choice > strong { position: static; margin-top: 6px; }
.compact-screen .relic-choice kbd { display: none; }
.compact-screen .result-damage-panel { grid-template-rows: auto auto minmax(0,1fr) auto; min-width: 540px; }
.compact-screen .damage-method { white-space: normal; }

@media (orientation: landscape) {
  .compact-screen .title-menu { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 16px; }
  .compact-screen .command-deck { grid-template-columns: minmax(0,1fr) auto minmax(170px,.48fr); }
  .compact-screen .build-dock { grid-area: 1 / 1; }
  .compact-screen .pulse-button { grid-area: 1 / 2; }
  .compact-screen .battle-orders { grid-area: 1 / 3; }
  .compact-screen #onboarding { bottom: 1px; left: 0; transform: none; width: auto; max-width: 100%; }
}
@media (orientation: landscape) and (max-height: 420px) {
  .compact-screen #play-screen { grid-template: auto auto minmax(0,1fr) auto / minmax(0,1fr) auto auto; }
  .compact-screen .field-left { grid-area: 2 / 1; flex-wrap: wrap; gap: 2px; }
  .compact-screen .expedition-ribbon { grid-area: 2 / 2; }
  .compact-screen .field-right { grid-area: 2 / 3; }
  .compact-screen .command-deck { grid-area: 4 / 1 / 5 / -1; }
  .compact-screen #inspector.tower-popover { grid-area: 3 / 1 / 4 / -1; }
}
@media (max-width: 760px) and (orientation: portrait) {
  .compact-screen .progress-layout, .compact-screen .field-manual { display: block; height: auto; }
  .compact-screen .forge-scene { height: 110px; margin-bottom: 7px; }
  .compact-screen .forge-caption { inset: auto 8px 8px; }
  .compact-screen .forge-caption h3 { font-size: 29px; }
  .compact-screen .manual-art { display: none; }
  .compact-screen .research-row { height: auto; min-height: 83px; gap: 5px; }
  .compact-screen .research-row > img { width: 34px; height: 42px; }
  .compact-screen .research-buy { width: 77px; }
  .compact-screen .mission-row { height: auto; min-height: 75px; gap: 8px; }
  .compact-screen .codex-layout { grid-template-columns: 84px minmax(0,1fr); gap: 7px; }
  .compact-screen .codex-list { padding-right: 1px; }
  .compact-screen .codex-list button { flex-direction: column; text-align: center; gap: 0; min-height: 68px; font-size: 15px; }
  .compact-screen .codex-list button img, .compact-screen .codex-list button .enemy-art { width: 32px; height: 32px; }
  .compact-screen .codex-detail { padding-right: 3px; }
  .compact-screen .detail-hero { height: auto; gap: 4px; }
  .compact-screen .detail-hero h3 { font-size: 23px; }
  .compact-screen .detail-art, .compact-screen .detail-hero .enemy-art { width: 66px; height: 66px; }
  .compact-screen .codex-grid, .compact-screen .modification-choices { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .compact-screen .doctrine-choices { grid-template-columns: 1fr; }
  .compact-screen .doctrine-choice { text-align: left; min-height: 70px; }
  .compact-screen .doctrine-choice > img { float: left; margin-right: 6px; }
  .compact-screen .relic-choice-grid, .compact-screen .branch-choices { grid-template-columns: 1fr; height: auto; }
  .compact-screen #game-modal[data-kind=result] .result-panel:not(.result-damage-panel) { height: auto; }
  .compact-screen #game-modal[data-kind=result] :is(.result-stats,.result-embers,.result-save,.result-damage-summary,.damage-bars) {
    position: static; width: auto; height: auto; padding: 6px 2px; gap: 7px;
  }
  .compact-screen #game-modal[data-kind=result] .result-hero { width: 100%; height: auto; min-height: 76px; }
  .compact-screen .result-embers { flex-wrap: wrap; }
  .compact-screen .result-embers > img { width: 32px; height: 40px; }
  .compact-screen .result-damage-summary { border: 0; }
  .compact-screen .ranking-table th:first-child, .compact-screen .ranking-table td:first-child { width: auto; padding-left: 2px; }
}
