#play .overlay.chapter-overlay{inset:52px 0 0;padding:12px}
#play .chapter-overlay .modal{display:flex;flex-direction:column;gap:10px;width:min(850px,100%);max-width:850px;max-height:100%;padding:18px 22px;text-align:left;overflow:auto}
.chapter-intro-body{display:grid;gap:10px;min-height:0;overflow:auto;overscroll-behavior:contain}
.chapter-heading .eyebrow{margin:0 0 4px!important;font-size:9px!important}
#play .chapter-heading h2{font-size:28px;margin:0 0 4px}
.chapter-heading>p:last-child{font-size:12px;margin:0!important}
.chapter-route{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.chapter-stage{min-width:0;min-height:44px;display:grid;gap:4px;padding:6px;background:#e8eedc;border:2px solid #b1c4a7;border-radius:7px;text-align:left;touch-action:manipulation;color:#214d47}
.chapter-stage img{width:100%;height:76px;object-fit:cover;border-radius:4px}
.chapter-stage strong{font-size:12px;line-height:1.2}
.chapter-stage small{font-size:11px!important;color:#806225}
.chapter-stage[data-selected=true]{border-color:#278877;background:#dbeed8;box-shadow:0 0 0 1px #278877}
.chapter-stage:disabled{opacity:.57;filter:saturate(.4)}
.chapter-preview{display:grid;grid-template-columns:1.3fr 1fr;gap:14px;padding:10px 12px;background:#edf1df;border:1px solid #bfcdb2;border-radius:7px}
.chapter-level-copy .eyebrow{margin:0 0 3px}
.chapter-level-copy h3{font-size:19px;margin:0 0 5px;color:#205d51}
.chapter-level-copy p{font-size:11px!important;line-height:1.45;margin:5px 0}
.chapter-level-copy>strong{font-size:12px}
.chapter-level-copy dl,.chapter-result-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:8px 0 0}
.chapter-level-copy dt,.chapter-result-stats dt{font-size:10px}
.chapter-level-copy dd,.chapter-result-stats dd{margin:2px 0 0;font-size:20px;font-weight:800;color:#23594f}
.chapter-hero{display:grid;grid-template-columns:64px 1fr;gap:6px 9px;align-content:center;align-items:center}
.chapter-hero img{width:64px;height:76px;object-fit:contain;grid-row:1/3}
.chapter-hero p{margin:0!important;font-size:11px!important;line-height:1.35}
.chapter-hero select{width:100%;min-height:44px}
.chapter-storage{font-size:10px!important;line-height:1.3;margin:0!important;color:#5d7059}
.chapter-actions{display:flex;gap:8px;flex:none;padding-top:8px;border-top:1px solid #bdcbb1}
#play .chapter-actions button{flex:1;min-width:0;min-height:44px!important;margin:0!important;padding:7px 9px!important;font-size:12px!important;line-height:1.2}
.chapter-actions .secondary{border:1px solid #a1b899;border-radius:6px;background:#eff1df;color:#25554e}
.chapter-result-body{min-height:0}
.chapter-earned-stars{font-size:45px;letter-spacing:8px;color:#ac772b;margin:10px 0;text-align:center}
.chapter-rating{text-align:center;font-size:10px!important;margin:0 0 12px}
.chapter-next-note{padding:10px;background:#e3edda;border-left:3px solid #4b927f;font-size:12px!important;line-height:1.4}
#play[data-dialog=chapter-result] .chapter-actions{position:sticky;bottom:0;background:#faf8e9}
@media(max-width:520px) and (orientation:portrait){
 #play .chapter-overlay .modal{padding:12px 14px;gap:8px}
 .chapter-route{gap:5px}
 .chapter-stage{padding:4px}
 .chapter-intro-body{gap:6px}
 .chapter-heading>p:last-child{display:none}
 .chapter-stage img{height:34px}
 .chapter-stage strong{font-size:10px}
 .chapter-preview{grid-template-columns:1fr;padding:8px 10px;gap:7px}
 .chapter-level-copy>p:not(.chapter-hint):not(.eyebrow){display:none}
 .chapter-hero{grid-template-columns:40px 1fr}
 .chapter-hero img{width:40px;height:48px;grid-row:auto}
 .chapter-hero p{grid-column:1/-1;font-size:10px!important;line-height:1.25}
 .chapter-level-copy dd{font-size:17px}
 .chapter-level-copy h3{font-size:17px}
 .chapter-preview .chapter-hint{margin:3px 0}
 .chapter-stage small{font-size:9px!important}
 .chapter-intro-body .chapter-storage{font-size:9px!important}
 #play .chapter-heading h2{font-size:23px}
}
@media(max-height:550px) and (orientation:landscape){
 #play .overlay.chapter-overlay{padding:6px 12px}
 #play .chapter-overlay.intro-overlay .modal{gap:5px;padding:8px 12px}
 .chapter-intro-body{grid-template-columns:1fr 1fr;gap:5px 14px}
 .chapter-overlay .chapter-heading{grid-column:1;grid-row:1}
 #play .chapter-heading h2{font-size:22px;margin:0}
 .chapter-heading>p:last-child{display:none}
 .chapter-route{grid-column:1;grid-row:2;gap:5px;align-self:start}
 .chapter-stage{padding:4px;gap:3px}
 .chapter-stage img{height:36px}
 .chapter-stage strong{font-size:10px;min-height:24px}
 .chapter-stage small{font-size:9px!important}
 .chapter-preview{grid-column:2;grid-row:1/3;display:flex;flex-direction:column;padding:6px 9px;gap:5px}
 .chapter-level-copy>p:not(.chapter-hint):not(.eyebrow){display:none}
 .chapter-level-copy h3{font-size:16px;margin:0 0 3px}
 .chapter-level-copy>strong{font-size:10px}
 .chapter-level-copy p{font-size:10px!important;margin:3px 0;line-height:1.25}
 .chapter-level-copy dl{margin-top:4px}
 .chapter-level-copy dt{font-size:8px}
 .chapter-level-copy dd{font-size:16px;margin:0}
 .chapter-hero{display:flex;align-items:center;gap:8px}
 .chapter-hero img{width:35px;height:40px}
 .chapter-hero p{display:none}
 .chapter-hero .hero-picker{flex:1;display:flex;align-items:center;gap:8px}
 .chapter-hero select{min-height:44px}
 .chapter-intro-body>.chapter-storage{grid-column:1/-1;grid-row:3;font-size:9px!important}
 .chapter-actions{grid-column:1/-1;grid-row:4;padding-top:5px}

}
#play.mobile-compact .mobile-action-dock>strong{display:block!important;font-size:10px;line-height:1.25;color:#22584f;margin:0 0 5px}
#play.mobile-compact .has-mobile-actions .inspect-heading{display:none}
#play.mobile-compact .mobile-action-dock .tower-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important}
#play.mobile-compact .mobile-action-dock #upgrade{grid-column:1/-1;order:0}
#play.mobile-compact .mobile-action-dock #relocate{order:1;background:#e0ecde!important;color:#27534c;border:1px solid #91ae97}
#play.mobile-compact .mobile-action-dock #sell{order:2}
#play.mobile-compact .mobile-action-dock #mobile-build{order:3;grid-column:auto}
#play.mobile-compact .mobile-action-dock #mobile-tower-details{order:4;background:#e0ecde;border:1px solid #91ae97;color:#27534c}
#play.mobile-compact .mobile-action-dock .tower-actions button{width:100%;min-width:0;min-height:44px!important;margin:0!important;padding:5px 4px!important;font-size:11px!important;line-height:1.25}
#play.mobile-compact .mobile-action-dock .tower-actions #relocate{display:flex;flex-direction:column;align-items:center;justify-content:center}
#play.mobile-compact .mobile-action-dock :is(#upgrade,#sell)::before{display:none}
#play.mobile-compact .command:not([data-expanded=true]).has-mobile-actions .inspect-tabs{display:none}
#play.mobile-compact .command.has-mobile-actions[data-expanded=true] .control-heading{display:flex}
#play.mobile-compact .command.has-mobile-actions[data-expanded=true] .mobile-action-dock{display:none}
#play.mobile-compact .command.has-mobile-actions:not([data-expanded=true]) .control-tabs #commands-tab{display:none}
@media(max-height:550px) and (orientation:landscape){
 #play.mobile-compact .mobile-action-dock .action-detail{font-size:8px!important;line-height:1.15}
 #play.mobile-compact.landscape-stage:not([data-interface-hidden=true]):has(.command.has-mobile-actions:not([data-expanded=true])) .game-layout{
  grid-template-columns:minmax(0,1fr) 218px!important;
 }
 #play.mobile-compact .command.has-mobile-actions .site-selector{display:none}
 #play.mobile-compact .command.has-mobile-actions{padding:7px!important}
 #play.mobile-compact .mobile-action-dock{margin:2px 0!important}
}
.chapter-hero-loadout{display:grid;gap:6px;align-content:start;min-width:0}
.chapter-talent{display:grid;gap:3px;font-size:10px;font-weight:750;color:#285447}
.chapter-talent select{min-height:44px;width:100%;max-width:100%;border:1px solid #a6bb9c;border-radius:5px;background:#f7f8eb;color:#254f45;padding:4px 6px;font:inherit;font-size:12px}
.chapter-rule-note{border-left:2px solid #57a595;padding-left:6px;color:#235f56}
@media(max-height:550px) and (orientation:landscape){
 .chapter-talent{grid-template-columns:auto minmax(0,1fr);align-items:center;gap:6px}
 .chapter-talent select{font-size:11px}
}

#play[data-dialog=chapter-result] .modal{overflow:hidden;gap:10px}
#play[data-dialog=chapter-result] .chapter-result-body{display:block;overflow:auto;overscroll-behavior:contain;min-height:0;padding:0 3px 2px}
.chapter-result-top{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center}
.chapter-result-top .chapter-earned-stars{display:flex;gap:4px;grid-column:auto;grid-row:auto;margin:0;font-size:34px;letter-spacing:0;white-space:nowrap}
.chapter-earned-stars>span{color:#b8bdae}
.chapter-earned-stars>span[data-earned=true]{color:#af7b25;animation:chapter-star-earned .5s ease-out both;animation-delay:calc(var(--star-order)*.13s)}
@keyframes chapter-star-earned{from{opacity:.3;transform:translateY(8px) scale(.65)}70%{transform:translateY(-2px) scale(1.12)}to{opacity:1;transform:none}}
.chapter-star-goal{margin:9px 0 0!important;padding:8px 10px;background:#e7eddb;border:1px solid #bbcaaa;border-radius:6px;color:#325846;font-size:12px!important;line-height:1.4!important}
.chapter-star-goal[data-perfect=true]{background:#f4eac5;border-color:#d6ba77;color:#74531c}
#play[data-dialog=chapter-result] .chapter-result-stats{margin:10px 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
.chapter-hero-recap{font-size:11px!important;line-height:1.4;margin:8px 0!important;color:#425c4d}
.chapter-review{margin:10px 0 0;border:1px solid #abc1a4;border-radius:6px;background:#edf1e4}
.chapter-review summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:9px 12px;font-size:12px;font-weight:750;cursor:pointer;color:#24594e;touch-action:manipulation}
.chapter-review summary::-webkit-details-marker{display:none}
.chapter-review summary>span:last-child{font-size:19px;line-height:1;transition:transform .16s}
.chapter-review[open] summary>span:last-child{transform:rotate(45deg)}
.chapter-wave-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;padding:0 9px 9px}
.chapter-wave-tabs button{display:grid;align-content:center;gap:2px;min-height:48px;padding:5px 8px;border:1px solid #a5bba0;border-radius:5px;background:#f5f6e9;text-align:center;color:#315746;font-size:12px;touch-action:manipulation}
.chapter-wave-tabs button[aria-selected=true]{background:#24685f;border-color:#24685f;color:#fff2ca}
.chapter-wave-tabs small{font-size:10px;line-height:1.2}
#chapter-wave-panel{padding:0 12px 11px}
.chapter-wave-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.chapter-wave-metrics>div{display:grid;gap:3px;padding:8px 0;border-top:1px solid #becdb5}
.chapter-wave-metrics span{font-size:10px;line-height:1.3}
.chapter-wave-metrics strong{font-size:20px;font-variant-numeric:tabular-nums;color:#2c6653}
.chapter-wave-metrics [data-loss=true] strong{color:#ab4d35}
.chapter-wave-leaks{display:grid;gap:4px;font-size:11px!important;line-height:1.45!important;margin:5px 0!important}
.chapter-wave-leaks>span>span{display:inline-block;padding:3px 6px;margin:0 4px 3px 0;border:1px solid #d4b499;border-radius:4px;background:#f6e9d2;color:#774b32}
.chapter-wave-skills{font-size:10px!important;line-height:1.5!important;margin:7px 0!important}
.chapter-wave-advice{border-left:3px solid #56927f;padding:6px 9px;background:#e0eada;font-size:11px;line-height:1.4}
.chapter-wave-advice>p{margin:3px 0 0!important;font-size:11px!important;line-height:1.4!important}
#play[data-dialog=chapter-result] .chapter-next-note{margin:8px 0!important;padding:7px 9px}
#play[data-dialog=chapter-result] .chapter-actions{position:static;flex:none;flex-wrap:wrap;gap:7px}
#play[data-dialog=chapter-result] .chapter-actions button{flex:1 1 100px}
@media(max-width:520px) and (orientation:portrait){
 .chapter-result-top{grid-template-columns:1fr;gap:6px}
 .chapter-result-top .chapter-earned-stars{justify-content:center;font-size:31px}
 .chapter-wave-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
 .chapter-wave-metrics>div{padding:5px 0}
 #play[data-dialog=chapter-result] .chapter-actions #chapter-next{flex-basis:100%}
 #play[data-dialog=chapter-result] .chapter-heading h2{font-size:22px}
}
@media(max-height:550px) and (orientation:landscape){
 #play[data-dialog=chapter-result] .modal{padding:9px 14px;gap:5px}
 #play[data-dialog=chapter-result] .chapter-heading h2{font-size:23px}
 #play[data-dialog=chapter-result] .chapter-result-stats{margin:6px 0}
 .chapter-result-stats dd{font-size:21px}
 .chapter-star-goal{margin-top:5px!important;padding:6px 9px;font-size:11px!important}
 .chapter-result-top .chapter-earned-stars{font-size:30px}
 .chapter-wave-tabs button{min-height:44px}
}
@media(prefers-reduced-motion:reduce){.chapter-earned-stars>span[data-earned=true]{animation:none}.chapter-review summary>span:last-child{transition:none}}

.chapter-practice-wave{
 display:flex;
 align-items:center;
 justify-content:space-between;
 gap:10px;
 width:100%;
 min-height:44px;
 margin:0 0 9px;
 padding:8px 11px;
 border:1px solid #638e7c;
 border-radius:5px;
 background:#dcebdd;
 color:#214f45;
 font-size:12px;
 font-weight:750;
 text-align:left;
 touch-action:manipulation;
}
.chapter-practice-wave:hover{background:#cfe5d4}
.chapter-practice-wave>span:last-child{font-size:19px;line-height:1}
.chapter-practice-note{
 margin:0 0 8px!important;
 color:#4c6656;
 font-size:11px!important;
 line-height:1.45!important;
}
#play .chapter-brief-trigger{
 min-height:44px;
 padding:8px 13px;
 border:1px solid #88a690;
 border-radius:6px;
 background:#e2edd9;
 color:#24594d;
 font-size:12px;
 font-weight:750;
}
#play[data-dialog=chapter-brief] .modal{overflow:hidden;gap:8px}
.chapter-brief-body{display:grid;gap:9px;min-height:0;overflow:auto;overscroll-behavior:contain;padding:1px 3px}
.chapter-brief-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}
.chapter-brief-heading .eyebrow{margin:0 0 3px!important}
#play .chapter-brief-heading h2{margin:0;font-size:25px}
.chapter-brief-heading dl{display:flex;gap:8px;margin:0}
.chapter-brief-heading dl>div{padding:5px 8px;border-radius:5px;background:#e7eddc}
.chapter-brief-heading dt{font-size:9px;color:#4f6e5d}
.chapter-brief-heading dd{margin:2px 0 0;font-size:15px;font-weight:800;color:#2a5b4f;font-variant-numeric:tabular-nums}
.chapter-brief-threat{display:grid;grid-template-columns:52px minmax(0,1fr);gap:4px 9px;align-items:center;padding:7px 9px;border:1px solid #c7b488;border-left:3px solid #bc8944;border-radius:6px;background:#f3ebd7}
.chapter-brief-threat img{object-fit:contain;border-radius:5px;background:#284d53}
.chapter-brief-threat small,.chapter-brief-threat strong{display:block;color:#294e45}
.chapter-brief-threat small{font-size:9px}
.chapter-brief-threat strong{font-size:14px}
.chapter-brief-threat p,.chapter-brief-option p,.chapter-brief-note,.chapter-brief-tide{margin:0!important;font-size:11px!important;line-height:1.4!important}
.chapter-brief-advice{grid-column:1/-1}
.chapter-brief-roster{display:flex;align-items:center;flex-wrap:wrap;gap:4px;color:#30594c;font-size:10px}
.chapter-brief-roster>strong{margin-inline-end:4px}
.chapter-brief-enemy{padding:3px 5px;background:#edf1e2;border:1px solid #c2d0b6;border-radius:4px}
.chapter-brief-tide{color:#216458;font-weight:700}
.chapter-brief-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,175px),1fr));gap:8px;align-items:stretch}
.chapter-brief-option{display:flex;flex-direction:column;gap:4px;padding:8px;border:1px solid #b7c8ac;border-radius:6px;background:#edf1e4;color:#2d5349}
.chapter-brief-option header{display:flex;justify-content:space-between;gap:4px;align-items:baseline;font-size:10px}
.chapter-brief-option header b{color:#795422;white-space:nowrap}
.chapter-brief-option h3{margin:0;font-size:13px}
.chapter-brief-budget{color:#38674f}
.chapter-brief-budget[data-shortfall=true]{color:#8f492d}
.chapter-brief-option button{
 display:flex;justify-content:space-between;align-items:center;
 min-height:44px;width:100%;margin:auto 0 0!important;padding:6px 9px;
 border:1px solid #86a88e;border-radius:5px;background:#dcebdd;color:#214f45;
 font-size:11px;font-weight:750;text-align:left;touch-action:manipulation;
}
.chapter-brief-option button:hover{background:#cfe5d4}
.chapter-brief-note{color:#50695b}
@media(max-height:550px) and (orientation:landscape){
 #play[data-dialog=chapter-brief] .modal{padding:8px 12px;gap:5px}
 .chapter-brief-body{grid-template-columns:minmax(0,.8fr) minmax(0,1.3fr);align-content:start;gap:5px 10px}
 .chapter-brief-heading,.chapter-brief-note{grid-column:1/-1}
 #play .chapter-brief-heading h2{font-size:21px}
 .chapter-brief-threat{grid-column:1;grid-row:2;grid-template-columns:32px minmax(0,1fr);padding:5px 6px}
 .chapter-brief-threat img{width:32px;height:32px}
 .chapter-brief-roster{grid-column:1;grid-row:3}
 .chapter-brief-options{grid-column:2;grid-row:2/4;grid-template-columns:repeat(auto-fit,minmax(min(100%,130px),1fr));gap:6px}
 .chapter-brief-option{padding:6px}
 .chapter-brief-threat p,.chapter-brief-option p,.chapter-brief-note,.chapter-brief-tide{font-size:10px!important}
}
@media(max-height:360px) and (orientation:landscape){
 #play .chapter-brief-heading h2{font-size:19px}
 .chapter-brief-heading dl>div{padding:3px 7px}
 .chapter-brief-heading dd{font-size:13px}
 .chapter-brief-options{align-self:start}
 .chapter-brief-option{gap:3px}
 .chapter-brief-enemy{display:none}
}

.chapter-edition{font-size:10px!important;line-height:1.5;color:#6a6850}
.chapter-edition:empty{display:none}
.opening-plan{grid-column:1/-1;padding:8px;border:1px solid #9cbba0;border-radius:7px;background:#e7f0e1;color:#234e48}
.opening-plan header{display:flex;justify-content:space-between;gap:5px;align-items:baseline;font-size:12px;margin-bottom:6px}
.opening-plan header>span{font-size:10px;text-align:right}
.opening-plan header b{color:#785322}
.opening-plan-steps{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.opening-plan-step{display:flex;align-items:center;text-align:left;gap:7px;min-height:47px;padding:4px 6px;border:1px solid #9ab59b;border-radius:6px;background:#f6f7e8;color:#224e45;cursor:pointer}
.opening-plan-step:hover,.opening-plan-step:focus-visible{background:#d0e8d3;border-color:#507d68}
.opening-plan-step:disabled{opacity:.74;cursor:default}
.opening-plan-site{display:grid;place-items:center;flex:none;width:24px;height:24px;border-radius:50%;background:#e5c782;color:#1d443e;font-size:12px;font-weight:800}
.opening-plan-step strong,.opening-plan-step small{display:block;font-size:11px;line-height:1.25}
.opening-plan-step small{font-size:9px;margin-top:2px}
#play .opening-plan p{font-size:10px!important;line-height:1.35;margin:5px 0 0!important}
@media(max-height:550px) and (orientation:landscape){
 .opening-plan{padding:5px}
 .opening-plan header{margin-bottom:4px}
}

.terrain-preview-button{min-height:44px;margin-inline-start:5px;padding:5px 8px;border:1px solid #83a798;border-radius:6px;background:#f5f7e7;color:#245348;font-weight:750}
