/* Battle resources and result ceremony. Gameplay remains behind these independent layers. */
.home-top{gap:10px;align-items:flex-start}.home-treasury{display:grid;grid-template-columns:30px auto;grid-template-rows:26px 15px;gap:2px 7px;align-items:center;min-width:105px;padding:8px 12px;background:linear-gradient(150deg,#435141,#173e44);border:1px solid #d5b85e;border-bottom:4px solid #092834;border-radius:15px;color:#ffe8a0;box-shadow:0 4px 12px #071c3566}.home-treasury>img{width:30px;height:30px;grid-row:1;grid-column:1}.home-treasury>b{font:800 23px/1.1 Arial,sans-serif;grid-column:2;grid-row:1;font-variant-numeric:tabular-nums}.home-treasury>span{grid-column:1/-1;grid-row:2;font-size:10px;line-height:1.3;text-align:center;color:#c4ddcd}
.home-top .home-progress{margin-inline-start:auto}.home-top .home-progress span{font-size:10px}.home-top .home-progress{padding:9px 12px;min-width:120px;min-height:58px}.home-top .home-progress img{width:30px;height:30px}
#game[data-screen=battle] .hud-top{top:10px;right:12px;left:auto;width:330px;max-width:calc(100% - 24px);padding:10px 12px 11px;background:linear-gradient(135deg,#123748ef,#102a3de8);border:1px solid #79989899;border-bottom:3px solid #051c2c;border-radius:17px;text-shadow:none}
#game[data-screen=battle] .heading{gap:10px}.mission-meta{min-width:0}#game[data-screen=battle] .mission-meta p{font-size:12px;line-height:1.3;margin:0 0 5px}#game[data-screen=battle] .mission-meta>span{font-size:10px;line-height:1.3;white-space:nowrap}#game[data-screen=battle] #wave-status{display:none}
#game[data-screen=battle] .wallet{position:relative;display:grid;grid-template-columns:29px minmax(35px,auto);grid-template-rows:26px 13px;column-gap:5px;align-items:center;min-width:96px;width:auto;min-height:55px;padding:6px 8px;background:linear-gradient(#385867,#244656);border:1px solid #c4a865;border-radius:11px;box-shadow:inset 0 1px #ffe09e44;color:#ffe8aa;text-shadow:none}#game[data-screen=battle] .wallet>img{grid-column:1;grid-row:1;width:29px;height:29px}#game[data-screen=battle] .wallet>span{grid-column:2;grid-row:1;font:800 22px/1.1 Arial,sans-serif}#game[data-screen=battle] .wallet>small{position:static;display:block;grid-column:1/-1;grid-row:2;font:500 9px/1.3 'Baloo Game',sans-serif;white-space:nowrap;color:#c4d9d6}
#game[data-screen=battle] .base-health{margin-top:7px;gap:3px 12px}#game[data-screen=battle] .base-row{font-size:9px}#game[data-screen=battle] .health-track{height:5px}
#coin-notice{position:absolute;inset:auto 18px -24px auto;min-width:48px;margin:0;padding:2px 8px;border-radius:8px;background:#265842;border:1px solid #d9ca75;font:800 15px/1.3 Arial,sans-serif;color:#ffe999;box-shadow:0 2px 6px #0004}#coin-notice[hidden]{display:none}
.combat-label{font-size:15px!important;-webkit-text-stroke:1px #453a1b;text-shadow:0 2px 1px #10263a!important}.coin-fly{width:24px!important;height:24px!important}.coin-fly img{width:100%;height:100%}
#overlay{z-index:80;padding:18px;pointer-events:auto;overflow-y:auto;align-items:center;background:#061825b3;backdrop-filter:blur(3px)}#overlay[hidden]{display:none}
#overlay .result-card{width:min(100%,430px);max-width:430px;max-height:calc(100dvh - 36px);overflow-y:auto;padding:22px 22px 16px;position:relative;display:flex;flex-direction:column;gap:12px;border-radius:25px;border:1px solid #a5bfbd;border-top:3px solid #f2d185;border-bottom:6px solid #071d30;background:radial-gradient(ellipse at 50% 30%,#316879,#143c50 60%,#0c263a);box-shadow:inset 0 0 0 4px #a5cdcf13,0 22px 80px #0009;color:#fff0bf;text-align:center;backdrop-filter:none;isolation:isolate}
#overlay .result-heading{display:flex;align-items:center;gap:10px;text-align:start;flex:none;min-height:52px}#overlay .result-heading>div:nth-child(2){min-width:0;flex:1}#overlay .dialog-icon{display:grid;flex:none;min-width:46px;width:46px;height:46px;min-height:46px;margin:0;padding:0;background:none;border:0;border-radius:0;box-shadow:none}#overlay .dialog-icon>img{width:46px;height:46px;max-width:46px;max-height:46px;object-fit:contain}
#overlay #dialog-kicker{font-size:11px;line-height:1.3;color:#a7c7cb;margin:0 0 5px}#overlay #dialog-title{font-size:29px;line-height:1.25;color:#ffe7a9;margin:0;letter-spacing:0;text-shadow:0 3px #123848}#overlay #dialog-copy{font-size:13px;line-height:1.5;margin:0;color:#c8dce0}#overlay #dialog-copy:empty{display:none}
#overlay .result-bank{display:grid;grid-template-columns:25px minmax(26px,auto);grid-template-rows:25px 13px;column-gap:5px;align-items:center;flex:none;padding:6px 8px;border:1px solid #b8a56b;border-radius:11px;background:#102e3fcc}#overlay .result-bank[hidden]{display:none}#overlay .result-bank>img{grid-row:1;grid-column:1;width:25px;height:25px}#overlay .result-bank>b{grid-row:1;grid-column:2;font:800 20px/1.1 Arial,sans-serif;color:#ffe08a}#overlay .result-bank>span{grid-row:2;grid-column:1/-1;color:#acc6c2;font-size:9px;text-align:center;line-height:1.3}
.victory-showcase{height:218px;width:100%;position:relative;flex:none;margin:-6px 0 -4px;isolation:isolate}.victory-showcase[hidden]{display:none}#victory-canvas{height:100%;width:100%;position:relative;z-index:1}#victory-canvas[hidden]{display:none}#victory-fallback{position:absolute;inset:0;width:190px;height:190px;object-fit:contain;margin:auto}#victory-fallback[hidden]{display:none}
.reward-rays{position:absolute;inset:5% 6%;border-radius:50%;background:repeating-conic-gradient(from 0deg,#ffd88e18 0deg 12deg,transparent 12deg 30deg);mask-image:radial-gradient(ellipse,black,transparent 70%);opacity:.6;animation:reward-rays 30s linear infinite}.victory-showcase[data-phase=reveal] .reward-rays{opacity:1}
.victory-prize{position:absolute;z-index:2;bottom:0;left:50%;translate:-50% 0;display:flex;align-items:center;gap:6px;white-space:nowrap;padding:7px 13px;border-radius:13px;border:1px solid #e4c175;background:#123f4df2;box-shadow:0 5px 0 #072f3a;color:#ffe394}.victory-prize[hidden]{display:none}.victory-prize img{width:31px;height:31px}.victory-prize b{font:800 30px/1.1 Arial,sans-serif;direction:ltr}.victory-prize span{font-size:11px;color:#d6e2c5}
.victory-unlock{display:flex;align-items:center;justify-content:center;gap:8px;padding:8px 10px;border:1px solid #85c7b1;border-radius:11px;background:#3b7a6955;color:#d8ffe8;font-size:14px;line-height:1.4}.victory-unlock[hidden]{display:none}.victory-unlock>img{width:25px;height:25px}
#reward-flight-layer{position:absolute;inset:0;pointer-events:none;z-index:5;overflow:visible}#reward-flight-layer>img{position:absolute;top:0;left:0;width:27px;height:27px;filter:drop-shadow(0 3px 1px #0005)}#reward-flight-layer>img[hidden]{display:none}
#overlay .result-stats{display:flex;justify-content:center;gap:24px;padding:7px 0;align-items:center;border-top:1px solid #91b7bd44;border-bottom:1px solid #91b7bd44}#overlay .result-stats[hidden]{display:none}#overlay .result-stats>span{display:flex;align-items:center;gap:6px;font-size:11px;color:#a9cace}#overlay .result-stats img{width:27px;height:27px}#overlay .result-stats b{font:700 20px/1.1 Arial,sans-serif;color:#e8f8f6}#overlay .result-stats small{font-size:11px}
#overlay .result-details{font-size:11px;text-align:start;color:#b1cdd1;margin:0}#overlay .result-details[hidden]{display:none}#overlay .result-details summary{cursor:pointer;min-height:28px;padding:3px 5px;line-height:1.5}#overlay .result-economy{border:0;background:none;margin:0;padding:8px 0;font-size:12px;line-height:1.5}#overlay .result-economy[hidden]{display:none}#overlay .result-economy dl{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 16px;margin:0}#overlay .result-economy dl>div{display:flex;justify-content:space-between;gap:7px;border-bottom:1px solid #83b8c333;padding:4px 0}#overlay .result-economy dt{font-size:10px;color:#a8c6ce}#overlay .result-economy dd{margin:0;color:#ffe7ad;font:700 13px Arial,sans-serif}
#overlay #primary{display:flex;align-items:center;justify-content:center;gap:12px;flex:none;min-height:59px;height:auto;width:100%;padding:11px 14px;border:1px solid #92e4f1;border-top:2px solid #d7f8ec;border-bottom:5px solid #166086;border-radius:15px;background:linear-gradient(#42b9d4,#2781ad);box-shadow:inset 0 0 0 2px #9ce5f129,0 4px 13px #021d3866;font:800 20px/1.25 'Baloo Game',sans-serif;white-space:nowrap;text-shadow:0 2px #23647f;color:#fff6d3;transform:none;transition:translate .16s}#overlay #primary>img{width:33px;height:33px;flex:none;object-fit:contain}#overlay #primary>span{white-space:nowrap;line-height:1.3}#overlay #primary:disabled{opacity:.7;filter:saturate(.6)}#overlay #primary:active:not(:disabled){translate:0 3px}
#overlay .result-actions{display:flex;justify-content:center;align-items:center;gap:24px;flex:none;min-height:38px}#overlay .secondary-button{display:flex;align-items:center;justify-content:center;gap:5px;min-height:38px;width:auto;padding:5px 10px;font-size:13px;line-height:1.4;white-space:nowrap;background:transparent;border:0;color:#b6d1d6;margin:0;border-radius:10px}#overlay .secondary-button>img{width:24px;height:24px;object-fit:contain}#overlay .secondary-button[hidden]{display:none}#overlay .gesture-hint{font-size:10px;line-height:1.4;margin:0;color:#a1c6c9}#overlay .gesture-hint:empty{display:none}
#upgrade-receipt{max-width:380px;padding:11px 12px;gap:10px}#upgrade-receipt>img{width:47px;height:47px}#upgrade-receipt strong{font-size:17px}#upgrade-receipt p{font-size:12px;margin:4px 0;line-height:1.5}#upgrade-receipt small{font-size:10px}
@keyframes reward-rays{to{rotate:360deg}}
@media(max-width:540px){.home-top{gap:6px;left:12px;right:12px}.home-treasury{min-width:95px;padding:7px 9px}.home-top .home-progress{min-width:110px;min-height:60px;font-size:11px}.home-top .home-progress b{font-size:22px}.home-top .home-progress span{font-size:9px}#game[data-screen=battle] .hud-top{right:10px;top:8px;max-width:calc(100% - 20px);width:calc(100% - 20px)}#game[data-screen=battle] .view-tools{top:132px;left:10px;gap:7px}#game[data-screen=battle] .view-tools .icon-button{width:40px;height:40px}#game[data-screen=battle] .castle-energy{top:136px;left:auto;right:10px;max-width:176px}#overlay{padding:12px}#overlay .result-card{padding:17px 15px 12px;max-height:calc(100dvh - 24px);gap:10px}#overlay #dialog-title{font-size:26px}.victory-showcase{height:205px}#overlay #primary{min-height:55px;font-size:19px}}
@media(max-width:360px){.home-treasury{min-width:83px;padding:6px}.home-top .home-progress{min-width:96px;padding:8px 6px}.home-top .icon-button{width:42px;height:42px}#overlay .result-card{padding:15px 12px 10px}.victory-showcase{height:180px}#overlay .result-heading{gap:7px}#overlay #dialog-title{font-size:24px}#overlay .dialog-icon,#overlay .dialog-icon>img{width:37px;height:37px;min-width:37px;min-height:37px}#overlay .result-bank{padding:5px;grid-template-columns:22px 25px}#overlay .result-bank img{width:22px;height:22px}#overlay .result-bank b{font-size:18px}#overlay .result-stats{gap:18px}#overlay .result-economy dl{grid-template-columns:1fr}}
@media(max-height:550px) and (min-width:541px){#overlay{padding:10px}#overlay .result-card{width:min(96%,660px);max-width:660px;max-height:calc(100dvh - 20px);display:grid;grid-template-columns:1fr 1fr;gap:8px 18px;padding:15px 18px 10px}#overlay .result-heading{grid-column:1/-1}#overlay #dialog-copy{grid-column:2;grid-row:2;font-size:12px}.victory-showcase{grid-column:1;grid-row:2/6;height:205px;margin:0}#overlay .victory-unlock{grid-column:2;grid-row:3;font-size:12px;padding:5px}#overlay .result-stats{grid-column:2;grid-row:4;padding:5px}#overlay #primary{grid-column:2;grid-row:5;font-size:17px;min-height:52px}#overlay .result-actions{grid-column:2;grid-row:6}#overlay .result-details{grid-column:1/-1;grid-row:7}#overlay[data-state=pause] .result-card{display:flex;width:380px}#overlay .gesture-hint{grid-column:1/-1}#game[data-screen=battle] .hud-top{width:300px;max-width:50%}}
@media(prefers-reduced-motion:reduce){.reward-rays{animation:none}#overlay #primary{transition:none}.command-arrival{animation:none}}

.victory-star-badge{position:absolute;z-index:3;top:8px;right:12px;display:flex;align-items:center;gap:4px;color:#ffe293;text-shadow:0 2px #15344a}.victory-star-badge[hidden]{display:none}.victory-star-badge>img{width:34px;height:34px;object-fit:contain}.victory-star-badge>b{font:800 22px/1.1 Arial,sans-serif;direction:ltr}.victory-unlock:not([hidden]){animation:unlock-arrive .4s ease-out}@keyframes unlock-arrive{from{translate:0 7px;scale:.96}to{translate:0 0;scale:1}}@media(prefers-reduced-motion:reduce){.victory-unlock:not([hidden]){animation:none}}

#overlay{transition:none}#overlay .result-card{transition:none}#overlay #dialog-title{line-height:1.85}#overlay:not([hidden]) .result-card{animation:result-arrive .24s ease-out}@keyframes result-arrive{from{translate:0 10px}to{translate:0 0}}@media(max-height:550px) and (min-width:541px){#overlay #dialog-title{font-size:24px;line-height:1.8}#overlay .result-card{gap:6px 18px}}@media(prefers-reduced-motion:reduce){#overlay:not([hidden]) .result-card{animation:none}}
.home-treasury{grid-template-rows:26px 18px}.home-treasury>span{line-height:1.8}#game[data-screen=battle] .wallet{grid-template-rows:26px 18px;min-height:60px}#game[data-screen=battle] .wallet>small{font-size:10px;line-height:1.8}#game[data-screen=battle] .mission-meta p{line-height:1.8}#overlay .result-bank{grid-template-rows:25px 18px}#overlay .result-bank>span{font-size:10px;line-height:1.8}
/* Absolute centering must not shrink the prize to half of a narrow hero. */
.victory-prize{width:max-content;max-width:calc(100% - 12px)}.victory-prize>img,.victory-prize>b,.victory-prize>span{flex:none}

/* A warm light sits behind the chest. The numbers and controls stay still. */
#overlay[data-state=result] .result-card{
 width:min(100%,460px);max-width:460px;gap:10px;
 background:radial-gradient(ellipse at 50% 36%,#284d50,#122f43 56%,#091f32);
 border-color:#6f9da4;border-top-color:#f7d38c;border-bottom-color:#071d30;
}
#overlay[data-state=result] .result-heading{min-height:48px}
#overlay[data-state=result] #dialog-title{font-size:clamp(26px,5vw,34px);line-height:1.42}
#overlay[data-state=result] .result-bank{background:#081f30a6;border-color:#8d815a}
#overlay[data-state=result] .victory-showcase{
 height:clamp(226px,36dvh,318px);margin:0;
 background:radial-gradient(ellipse 48% 17% at 50% 75%,#091a26a8,transparent 100%);
}
#overlay[data-state=result] #victory-canvas{height:calc(100% - 36px)}
#overlay[data-state=result] #victory-fallback{bottom:36px}
#overlay[data-state=result] .reward-rays{
 inset:-4% -4% 13%;opacity:.4;
 background:
  radial-gradient(ellipse at 50% 57%,#fff7bece 0%,#ffd47c87 17%,#e6a45744 34%,transparent 65%),
  repeating-conic-gradient(from -13deg at 50% 57%,#ffd97c44 0deg 8deg,transparent 14deg 30deg);
 mask-image:radial-gradient(ellipse at 50% 57%,black 12%,transparent 67%);
 animation:none;pointer-events:none;
}
#overlay[data-state=result] [data-phase=opening] .reward-rays{animation:chest-charge .65s ease-out both}
#overlay[data-state=result] [data-phase=reveal] .reward-rays{animation:chest-reveal .85s ease-out both}
#overlay[data-state=result] [data-phase=collecting] .reward-rays{opacity:.67}
@keyframes chest-charge{
 from{opacity:.22;transform:scale(.72) rotate(-5deg)}
 to{opacity:.9;transform:scale(.96)}
}
@keyframes chest-reveal{
 0%{opacity:.9;transform:scale(.96)}
 30%{opacity:1;transform:scale(1.14) rotate(4deg)}
 100%{opacity:.67;transform:scale(1) rotate(7deg)}
}
#overlay[data-state=result] .victory-prize{
 bottom:0;gap:8px;padding:5px 14px;
 background:#0b2636;border-color:#c9a865;box-shadow:0 3px #061b29,0 0 22px #ffc66030;
}
#overlay[data-state=result] .victory-prize b{font-size:29px}
#overlay[data-state=result] .victory-star-badge{top:8%;right:5%;filter:drop-shadow(0 0 8px #f6c95673)}
#overlay[data-state=result] .victory-star-badge:not([hidden]){animation:unlock-arrive .4s ease-out}
#overlay[data-state=result] .victory-unlock{
 align-self:center;min-height:26px;padding:0;gap:5px;
 border:0;background:none;color:#bcebd8;font-size:13px;
}
#overlay[data-state=result] .victory-unlock img{width:23px;height:23px}
#overlay[data-state=result] .victory-showcase:not([hidden])+.victory-unlock[hidden]{
 display:flex!important;visibility:hidden;
}
#overlay[data-state=result] .victory-showcase:not([hidden])~#primary img{scale:-1 1}
#overlay[data-state=result] .result-details{order:2;text-align:center;font-size:12px}
#overlay[data-state=result] .result-details summary{min-height:34px;padding:7px}
#overlay[data-state=result] .result-stats{margin-top:4px}
#overlay[data-state=result] .result-actions{order:3;border-top:1px solid #91b7bd33;gap:16px}
#overlay[data-state=result] .secondary-button{min-height:40px}

#overlay button:focus-visible,#overlay summary:focus-visible,#move-cancel:focus-visible{
 outline:2px solid #fff0b3;outline-offset:3px;
}
@media(max-width:360px){
 #overlay[data-state=result] .victory-star-badge{top:0;right:4%;gap:2px}
 #overlay[data-state=result] .victory-star-badge img{width:28px;height:28px}
 #overlay[data-state=result] .victory-star-badge b{font-size:18px}
}
@media(max-height:550px) and (min-width:541px){
 #overlay[data-state=result] .result-card{width:min(100%,660px);max-width:660px}
 #overlay[data-state=result] .result-card:not(:has(.victory-showcase:not([hidden]))){display:flex;width:min(100%,400px)}
 #overlay[data-state=result] .victory-showcase{height:clamp(180px,59dvh,260px);grid-row:2/7}
 #overlay[data-state=result] #primary{grid-row:4;align-self:end}
 #overlay[data-state=result] .result-details{grid-column:2;grid-row:5}
 #overlay[data-state=result] .result-actions{grid-row:6}
 #overlay[data-state=result] .victory-unlock{align-self:end}
}
@media(prefers-reduced-motion:reduce){
 #overlay[data-state=result] .victory-showcase[data-phase] .reward-rays,
 #overlay[data-state=result] .victory-star-badge:not([hidden]){animation:none}
 #overlay[data-state=result] .victory-showcase[data-phase=reveal] .reward-rays{opacity:.67}
}

/* Results are a full-screen ceremony over the battlefield, separate from pause cards. */
#overlay[data-state=result]{padding:0;overflow:hidden;align-items:stretch;background:radial-gradient(ellipse at 50% 42%,#12344777,#061b2bd9);backdrop-filter:none}
#overlay[data-state=result] .result-card,#overlay[data-state=result] .result-card:not(:has(.victory-showcase:not([hidden]))){width:100%;max-width:none;height:100%;max-height:none;min-width:0;min-height:0;box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto auto auto;align-items:center;justify-items:center;gap:10px;padding:max(20px,env(safe-area-inset-top)) max(22px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(22px,env(safe-area-inset-left));overflow:hidden;border:0;border-radius:0;box-shadow:none;background:none;animation:none}
#overlay[data-state=result] .result-heading{grid-column:1;grid-row:1;width:min(100%,760px);min-width:0;min-height:56px}
#overlay[data-state=result] #dialog-title{font-size:clamp(30px,5vw,48px)}
#overlay[data-state=result] #dialog-kicker{font-size:14px}
#overlay[data-state=result] .result-bank{padding:8px 12px}
#overlay[data-state=result] .result-bank>b{font-size:25px}
#overlay[data-state=result] .result-bank>span{font-size:12px}
#overlay[data-state=result] .victory-showcase{grid-column:1;grid-row:2;width:min(100%,760px);height:100%;min-height:0;margin:0;background:none}
#overlay[data-state=result] #victory-canvas{height:calc(100% - 48px);min-height:0;max-width:100%}
#overlay[data-state=result] #victory-fallback{width:min(65%,280px);height:calc(100% - 52px);bottom:48px}
#overlay[data-state=result] .reward-rays{inset:0;overflow:hidden}
#overlay[data-state=result] .victory-prize{bottom:4px;padding:7px 18px}
#overlay[data-state=result] .victory-prize b{font-size:34px}
#overlay[data-state=result] .victory-star-badge{top:12%;right:10%}
#overlay[data-state=result] .victory-unlock{grid-column:1;grid-row:3;min-height:26px;font-size:16px}
#overlay[data-state=result] #primary{grid-column:1;grid-row:4;align-self:center;width:min(100%,430px);min-height:60px;font-size:23px}
#overlay[data-state=result] .result-actions{grid-column:1;grid-row:5;border:0;width:min(100%,430px);min-height:44px;gap:20px}
#overlay[data-state=result] .secondary-button{font-size:16px;min-height:44px}
#overlay[data-state=result] #dialog-copy:not(:empty){grid-column:1;grid-row:2;align-self:center;max-width:480px;font-size:18px}
#overlay[data-state=result] .gesture-hint{display:none}
#overlay[data-state=result] .result-details{position:absolute;bottom:24px;right:24px;margin:0;z-index:5;max-width:calc(100% - 48px);color:#d5e7e3}
#overlay[data-state=result] .result-details summary{font-size:14px;min-height:44px;padding:10px}
#overlay[data-state=result] .result-details[open]{grid-area:auto;align-self:stretch;justify-self:stretch;inset:100px max(24px,calc((100% - 700px)/2)) 170px;max-width:none;border:1px solid #7d9d9d;border-radius:16px;background:#0a283bf5;padding:12px;overflow:auto}
#overlay[data-state=result] .result-details[open] summary{font-size:17px}
#overlay[data-state=result] .result-economy dl{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 20px}
#overlay[data-state=result] .result-economy dt{font-size:13px}
#overlay[data-state=result] .result-economy dd{font-size:16px}
#overlay[data-state=result] .result-stats>span,#overlay[data-state=result] .result-stats small{font-size:14px}
#overlay[data-state=result]:has(.result-details[open]) .victory-showcase{visibility:hidden}
@media(max-width:540px){
 #overlay[data-state=result] .result-card{padding:16px 14px;gap:8px}
 #overlay[data-state=result] .result-heading{gap:8px}
 #overlay[data-state=result] .result-bank{padding:7px}
 #overlay[data-state=result] .result-bank>b{font-size:22px}
 #overlay[data-state=result] .victory-star-badge{right:4%}
 #overlay[data-state=result] .result-details{position:static;grid-column:1;grid-row:6;max-width:100%}
 #overlay[data-state=result] .result-card{grid-template-rows:auto minmax(0,1fr) auto auto auto auto}
 #overlay[data-state=result] .result-details[open]{position:absolute;inset:90px 14px 200px;max-width:none}
 #overlay[data-state=result] .result-economy dl{gap:6px 12px}
}
@media(max-height:550px) and (min-width:541px){
 #overlay[data-state=result] .result-card{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:52px minmax(26px,1fr) 54px 42px 36px;padding:12px 24px;gap:4px 24px}
 #overlay[data-state=result] .result-heading{grid-column:1/-1;grid-row:1;min-height:46px}
 #overlay[data-state=result] #dialog-title{font-size:30px}
 #overlay[data-state=result] .victory-showcase{grid-column:1;grid-row:2/6;height:100%}
 #overlay[data-state=result] .victory-unlock{grid-column:2;grid-row:2;align-self:end;font-size:14px}
 #overlay[data-state=result] #primary{grid-column:2;grid-row:3;min-height:50px;font-size:20px}
 #overlay[data-state=result] .result-actions{grid-column:2;grid-row:4}
 #overlay[data-state=result] .result-details{position:static;grid-column:2;grid-row:5;max-width:100%;align-self:center}
 #overlay[data-state=result] .result-details summary{min-height:36px;padding:6px}
 #overlay[data-state=result] .result-details[open]{position:absolute;inset:70px 24px 12px;max-width:none;padding:8px 16px}
 #overlay[data-state=result] .result-economy dl{gap:4px 18px}
 #overlay[data-state=result] .result-stats{padding:4px;margin:0}
 #overlay[data-state=result] #dialog-copy:not(:empty){grid-column:1;grid-row:2/6}
}
/* Keep the battlefield, rather than its controls, behind the result ceremony. */
#game:has(>#overlay[data-state=result]:not([hidden]))>:is(.hud-top,.hud-bottom,.view-tools,.planning-bar,#castle-energy,#toast,#current-build){visibility:hidden;pointer-events:none}
@media(max-height:550px) and (min-width:541px){
 #overlay[data-state=result] .result-card:not(:has(.victory-showcase:not([hidden]))){grid-template-columns:minmax(0,1fr);grid-template-rows:52px minmax(0,1fr) 54px 42px 36px}
 #overlay[data-state=result] .result-card:not(:has(.victory-showcase:not([hidden])))>:is(#dialog-copy,#primary,.result-actions,.result-details){grid-column:1}
 #overlay[data-state=result] .result-card:not(:has(.victory-showcase:not([hidden])))>#dialog-copy{grid-row:2}
}
