/* Native hierarchy/material adaptation of the adopted ui-battle-r2 master.
   Desktop card dimensions and shared editor layout anchors are preserved. */
#ui:not(.touch-ui) .tower-card{padding:0;text-align:center;background:linear-gradient(150deg,#10293c,#06131f 75%);box-shadow:inset 0 -2px #346d84}
#ui:not(.touch-ui) .tower-card img{left:50%;top:2px;transform:translateX(-50%);width:90px;height:57px;filter:drop-shadow(0 4px 5px #0009)}
#ui:not(.touch-ui) .tower-card b{position:absolute;top:56px;left:3px;right:3px;margin:0;font-size:15px;line-height:18px;letter-spacing:1px}
#ui:not(.touch-ui) .tower-card span{position:absolute;top:75px;left:3px;right:3px;margin:0;font-size:12px;line-height:14px}
#ui:not(.touch-ui) .tower-card.selected{background:linear-gradient(150deg,#14374c,#092235);box-shadow:inset 0 -3px #5bdeed,0 0 12px #32c6e522}
#ui:not(.touch-ui) .tower-card:disabled{opacity:.55}
#ui:not(.touch-ui) .topbar .brand{font-size:29px;font-style:italic;letter-spacing:2px;text-shadow:1px 0 #39d9ed,-1px 1px #662859}
.topbar,.dock{background:linear-gradient(110deg,#071726fa,#0b2030f5 55%,#061421fa);box-shadow:inset 0 1px #63879b40,0 8px 25px #01071180}
.wave-panel{background:linear-gradient(145deg,#102c40f5,#061523f5);box-shadow:inset 0 1px #8dd5e433,0 8px 22px #01071199}
.modal{background:linear-gradient(135deg,#102c40fc,#071725fc 72%);box-shadow:inset 0 1px #8dd5e440,0 18px 70px #010711cc}
.chapter{background:linear-gradient(135deg,#10273aeF,#061321f5)}
.map-instruction{background:linear-gradient(90deg,#071624ef,#10293ae8,#071624ef)}
.network-backdrop{position:absolute;inset:0;overflow:hidden;pointer-events:none!important;background:linear-gradient(90deg,#071320b8,#091b2b22)}
.network-backdrop img{position:absolute;right:-60px;top:-160px;width:1000px;height:1050px;object-fit:contain;opacity:.12;filter:blur(4px)}
#ui:not(.touch-ui) .chapter .chapter-art{position:absolute;right:2px;top:16px;float:none;margin:0;width:330px;height:206px;object-fit:contain;opacity:.85;pointer-events:none}
#ui:not(.touch-ui) .chapter .route-preview{position:absolute;left:20px;bottom:49px;float:none;width:182px;height:96px;margin:0;z-index:1;box-shadow:0 3px 14px #0008}
#ui:not(.touch-ui) .chapter .title{position:absolute;left:22px;top:24px;margin:0;z-index:2;font-size:27px;text-shadow:0 2px 5px #020814}
#ui:not(.touch-ui) .chapter p{position:absolute;left:226px;bottom:38px;width:300px;min-height:0;padding:12px 14px;margin:0;font-size:13px;line-height:1.6;background:#061422d9;border-left:1px solid #3e687a;z-index:2}
#ui:not(.touch-ui) .chapter .bottom{position:absolute;bottom:0;left:0;right:0;z-index:3}
#ui:not(.touch-ui) .chapter .number{z-index:2;text-shadow:0 2px 5px #020814}
.touch-ui .chapter .chapter-art{position:absolute;right:12px;top:0;float:none;margin:0;width:150px;height:100%;object-fit:contain;opacity:.3;pointer-events:none}
.touch-ui .chapter .title,.touch-ui .chapter .number,.touch-ui .chapter .bottom,.touch-ui .chapter .route-preview{position:relative;z-index:1}
.touch-ui .chapter .number,.touch-ui .chapter .bottom{position:absolute}
.chapter:disabled{opacity:1;background:#081a2af5;border-color:#294557}
.chapter:disabled :is(.title,.number,.chapter-art,.route-preview,.bottom){opacity:.48}
.chapter:disabled p{opacity:1;color:#90acbc;background:#061422f5}

/* r6 derived reference: non-battle phone background fills the viewport. */
/* Prospective non-battle mobile backdrop treatment, shared-world geometry stays contain. */
body:has(#ui.touch-ui .home-copy),body:has(#ui.touch-ui .chapter-pick){background:radial-gradient(ellipse at 64% 38%,#10293c,#071321 80%)}
body:has(#ui.touch-ui .home-copy) #viewport,body:has(#ui.touch-ui .chapter-pick) #viewport{background:radial-gradient(ellipse at 64% 38%,#10293c,#071321 80%)}
body:has(#ui.touch-ui .home-copy) #stage,body:has(#ui.touch-ui .chapter-pick) #stage{background:transparent;box-shadow:none}
body:has(#ui.touch-ui .home-copy) #world,body:has(#ui.touch-ui .chapter-pick) #world{mask-image:linear-gradient(90deg,transparent,#000 10%,#000 90%,transparent)}

/* Upgrade family: adopted refit-derived-r4, native CSS touch targets. */
.refit-panel{box-sizing:border-box;width:840px;height:500px;padding:24px;border:1px solid #39d6ed;background:linear-gradient(135deg,#0b2130,#061522 75%);box-shadow:0 0 0 5px #051b28bb,0 15px 60px #0008;display:grid;grid-template-rows:48px 28px 1fr 48px;gap:12px;pointer-events:auto;color:#d5f3fc}
.refit-heading{display:flex;align-items:center;justify-content:space-between}.refit-heading h1{margin:0;font:700 32px/44px GameBody,sans-serif;letter-spacing:0}.refit-panel button{box-sizing:border-box;font-family:GameBody,sans-serif;border:1px solid #72eaff;border-radius:3px;min-height:44px;letter-spacing:0}
.refit-close{width:44px;height:44px;line-height:34px;font-size:29px;padding:0;background:#103c50;color:#d7f8ff}
.refit-subtitle{font:16px/28px GameBody,sans-serif;color:#a6d0df}
.refit-choices{display:grid;grid-template-columns:1fr 1fr;gap:20px;min-height:0}.refit-choice{border:1px solid #4acde7;padding:12px;display:grid;grid-template-rows:1fr 48px;gap:8px;min-height:0;background:#09253699}.refit-choice.special{border-color:#ce78eb}
.refit-content{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:6px;min-height:0;text-align:center}.refit-content img{width:180px;height:100px;object-fit:contain;flex:none}.refit-content h2{font:700 23px/34px GameBody,sans-serif;margin:0 0 4px}.refit-content p{font:16px/26px GameBody,sans-serif;margin:0;color:#bbdfea;overflow-wrap:anywhere}
.refit-buy{height:48px;font-size:17px;line-height:28px;background:#46dced;color:#042535;font-weight:700;padding:0 8px}.special .refit-buy{background:#e69cf2;color:#2f153d}.refit-panel .refit-buy:disabled{background:#203746;color:#829ca8;border-color:#36505d;opacity:.8}
.refit-footer{display:flex;align-items:center;justify-content:space-between;gap:12px}.refit-footer span{font:16px/28px GameBody,sans-serif;color:#94becd}.refit-cancel{width:180px;height:44px;font-size:15px;background:#0b2538;color:#d7f8ff;padding:0 8px}
.touch-ui .refit-panel{position:relative;width:min(736px,calc(100vw - 32px));height:310px;padding:12px;grid-template-rows:44px 22px 1fr 44px;gap:8px}
.touch-ui .refit-heading h1{font-size:25px;line-height:36px}.touch-ui .refit-subtitle{font-size:14px;line-height:22px}.touch-ui .refit-choices{gap:12px}.touch-ui .refit-choice{padding:6px;grid-template-rows:1fr 44px;gap:4px}.touch-ui .refit-content{flex-direction:row;justify-content:flex-start;gap:8px;text-align:left}.touch-ui .refit-content img{width:100px;height:84px}.touch-ui .refit-content h2{font-size:19px;line-height:30px}.touch-ui .refit-content p{font-size:14px;line-height:22px}.touch-ui .refit-buy{height:44px}.touch-ui .refit-footer span{font-size:14px;line-height:24px}

/* Adopted from reviewed dispatch-city-derived-r4: next plan vs live+queue. */
.wave-ribbon.dispatch-panel{display:grid;grid-template-columns:auto 1fr;grid-template-rows:20px 30px;gap:3px 8px;padding:8px 12px}
.wave-ribbon.dispatch-panel .wave-title{grid-area:1/1;white-space:nowrap}.wave-ribbon.dispatch-panel p{grid-area:1/2;justify-self:end;margin:0}
.wave-ribbon.dispatch-panel .composition{grid-area:2/1/3/3;display:flex;gap:12px;margin:0;height:30px}.dispatch-panel .wave-kind{gap:2px}
.launch.early{background:linear-gradient(140deg,#ffdb85,#e89a45);border-color:#fff0bc;color:#172434;box-shadow:inset 0 0 0 2px #8a632b}.launch.early small{color:#26313d}
.label-mobile,.wave-short{display:none}
#ui:not(.touch-ui) .wave-panel:not(.wave-ribbon).many .composition{display:grid;grid-template-columns:repeat(3,1fr);gap:2px;height:66px;margin-top:3px}
#ui:not(.touch-ui) .wave-panel:not(.wave-ribbon).many .wave-kind{flex-direction:row;gap:1px}#ui:not(.touch-ui) .wave-panel:not(.wave-ribbon).many .composition img{width:24px;height:24px}
.touch-ui .wave-panel.dispatch-panel{display:block;height:auto!important;min-height:114px;padding:8px}
.touch-ui .dispatch-panel .wave-title{white-space:normal}.touch-ui .dispatch-panel p{margin-top:4px}
.touch-ui .dispatch-panel .composition{display:grid;grid-template-columns:1fr 1fr;height:auto;gap:4px 1px;margin-top:5px}
.touch-ui .dispatch-panel.many .composition{grid-template-columns:repeat(3,1fr);gap:5px 0}.touch-ui .dispatch-panel.many .wave-kind{display:block;position:relative;width:28px;height:40px}
.touch-ui .dispatch-panel.many .wave-name{display:none}.touch-ui .dispatch-panel.many small{position:absolute;right:0;bottom:14px;background:#061523e8;padding:0 1px;font-size:9px;line-height:11px}.touch-ui .dispatch-panel.many img{width:23px;height:23px}
.touch-ui .launch.early small{white-space:normal;font-size:10px;line-height:12px}
.touch-ui .label-pc{display:none}.touch-ui .label-mobile{display:inline}
.touch-ui .dispatch-panel.many .wave-short{display:block;position:absolute;top:29px;left:0;width:28px;text-align:center;font-size:10px;line-height:11px;color:#c8dfeb}

/* Alternate specialists stay inside the existing two-card dialog. */
.refit-tabs{display:flex;justify-content:center;gap:6px;margin:0 0 6px}.refit-panel .refit-tab{min-height:28px;height:28px;padding:0 10px;font:14px/24px GameBody,sans-serif;background:#132735;color:#a9c2d0;border-color:#47637a}.refit-panel .refit-tab[aria-pressed="true"]{background:#462d56;color:#f5c4ff;border-color:#e69cf2}.has-refit-tabs .refit-content img{height:88px}.touch-ui .has-refit-tabs .refit-content h2{font-size:18px;line-height:24px;margin-bottom:2px}.touch-ui .has-refit-tabs .refit-content p{font-size:13px;line-height:18px}.touch-ui .refit-tabs{justify-content:flex-start;gap:4px;margin-bottom:3px}.touch-ui .refit-panel .refit-tab{min-height:26px;height:26px;font-size:13px;line-height:22px;padding:0 7px}
