/* b132 Story result screen (result-ui.ts; docs/SCREEN_RULES.md → Story result screen). Layout only; the chrome is
   the game's own: story-mode #online, #story-settings, the #tabs bar with .back-arrow, .help-button, .paper,
   .reward-tile, button.primary / .secondary, the Story header plaque, uiStarRow and the light burst.
   Values are the owner-accepted v5b layout (Max 430x932 / Compact 375x667). */
/* Visual polish (layout): the dimmed scenery also runs under the top safe area; #content carries the inset. */
#online.story-mode.story-result-screen{padding-top:0;padding-bottom:0}
#online.story-mode.story-result-screen #stage{display:none}
/* The bottom bar every child screen uses (Gear, Collectibles): the same #tabs and the same grey Back arrow. */
#online.story-mode.story-result-screen #tabs{display:flex!important;flex:none}
#online.story-result-screen #content{position:relative;isolation:isolate;flex:1;min-height:0;display:flex;flex-direction:column;padding:calc(6px + var(--safe-top,env(safe-area-inset-top,0px))) 12px 8px!important;overflow:hidden}

/* Live chapter scenery (the Story scene painter), dimmed and softened behind everything. */
.sr-backdrop{overflow:hidden}
.sr-backdrop canvas{position:absolute;inset:0;width:100%;height:100%;opacity:1}
.sr-backdrop .sr-scene-soft{filter:blur(2.6px) saturate(.92);transform:scale(1.04)}
.story-result-defeat .sr-backdrop .sr-scene-soft{filter:blur(2.6px) saturate(.32) brightness(.86)}
.sr-dim,.sr-fade{position:absolute;inset:0;pointer-events:none}
.sr-dim{background:#1b173357}
.story-result-defeat .sr-dim{background:#1a284861}
.sr-fade{background:linear-gradient(#28263200 0%,#28263200 36%,#282632b0 58%,#282632f2 76%,var(--ink-plum-2) 100%)}
.story-result-defeat .sr-fade{background:linear-gradient(#141a2c00 0%,#141a2c00 38%,#141a2ca8 58%,#141a2cee 76%,#141a2c 100%)}

.sr-screen:not([data-ready]){visibility:hidden}
.sr-screen{position:relative;flex:1;min-height:0;display:flex;flex-direction:column;align-items:center;gap:8px}
/* (?) exactly where Gear and Collectibles put theirs (14 px under the safe top and 12 px in on Max). */
.sr-help{position:absolute;z-index:6;top:8px;right:0}
/* The defeat cause stays available to VoiceOver (aria-describedby); no rule or cause text on screen. */
.sr-note{position:absolute;width:1px;height:1px;margin:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* The shared light burst behind the hero (ui-components.ts), born on the touchdown. */
.sr-light-clip{z-index:0;mix-blend-mode:screen}
.sr-light{position:absolute;width:0;height:0;pointer-events:none}
.sr-light-pop{position:absolute;left:0;top:0;width:205vw;height:205vw;translate:-50% -50%;opacity:0}
.sr-light-pop .victory-aura{position:absolute;inset:0;--lb-size:100%;--lb-blend:normal;--lb-tint:#ffb534}

/* Title: the Story header plaque (story-ui.css .story-act-plaque) with the title in its cream Lucky. */
.sr-title{position:relative;z-index:3;flex:none;width:100%;padding-top:46px}
.sr-plaque{--sr-w:min(100%,400px);position:relative;container-type:inline-size;width:var(--sr-w);aspect-ratio:var(--sr-ar);margin:0 auto;transform-origin:50% -60%;filter:drop-shadow(0 4px 2px #17232a80)}
.sr-plaque-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;transform-origin:50% -40%}
.sr-plaque-title{position:absolute;z-index:2;left:var(--sr-tl);right:var(--sr-tr);top:var(--sr-tt);bottom:var(--sr-tb);display:grid;place-items:center;margin:0;
 font:400 9.6cqw/1 Lucky,'Hiragino Sans','Hiragino Maru Gothic ProN','Noto Sans JP',sans-serif;color:var(--cream-250);white-space:nowrap;
 -webkit-text-stroke:.07em #4a2611;paint-order:stroke fill;filter:drop-shadow(0 .07em 0 #3b271a)}
.sr-plaque-title>span,.sr-plaque-slot>span{white-space:nowrap}
.sr-plaque-slot{position:absolute;z-index:2;left:var(--sr-sl);right:var(--sr-sr);top:var(--sr-st);bottom:var(--sr-sb);display:grid;place-items:center;
 font:400 3.3cqw/1 Lucky,sans-serif;color:#e9ecda;filter:drop-shadow(0 1px #14232a);white-space:nowrap;overflow:hidden}
/* Defeat: the same board, darker and weathered. */
.story-result-defeat .sr-plaque{--sr-w:min(100%,296px)}
.story-result-defeat .sr-plaque-art{filter:saturate(.45) brightness(.7) contrast(1.08) hue-rotate(-12deg)}
.story-result-defeat .sr-plaque-title{color:#e8e6dc;-webkit-text-stroke-color:#2c2a33;filter:drop-shadow(0 .07em 0 #1d1c24)}
.story-result-defeat .sr-title{padding-top:6px}
/* The star row (uiStarRow) in its own band under the plaque, with air above it. */
.sr-starband{position:relative;z-index:1;display:flex;justify-content:center;margin-top:12px}
.sr-starband .star-row{--sr:28px}
/* Defeat: what the run still saved, as small chips in the same band. */
.sr-saved{display:flex;gap:8px}
.sr-saved>span{display:flex;align-items:center;gap:4px;padding:3px 10px 3px 6px;border:2px solid var(--ink-plum-2);border-radius:999px;background:linear-gradient(var(--gold-50),#d9b576);box-shadow:inset 0 2px #fff9dd,0 3px #19151fa0;color:#4b3523;font:16px/1 Lucky,sans-serif}
.sr-saved img{width:22px;height:22px;object-fit:contain}

/* Stage: the universal pedestal; the active form's portrait seated on its top centre by result-ui.ts. */
.sr-stage{position:relative;z-index:2;flex:1 1 auto;min-height:0;width:100%}
.sr-pedestal{position:absolute}
/* b134 AC659: the floating podium, the hero on it (and Defeat's cloud) bob together; a soft glow under the tip. */
.sr-hover{position:absolute;inset:0;pointer-events:none}
.sr-hover-glow{position:absolute;left:50%;top:100%;width:var(--sr-glow-w,80px);height:calc(var(--sr-glow-w,80px) * .42);translate:-50% -50%;border-radius:50%;background:radial-gradient(closest-side,#ffe2a0a6,#ffcf7347 52%,#ffcf7300);opacity:.85;pointer-events:none}
.sr-pedestal img{position:absolute;display:block;max-width:none;pointer-events:none}
.sr-anchor{position:absolute;width:0;height:0}
.sr-anchor>div{position:absolute;left:0;top:0;width:0;height:0;transform-origin:0 0}
.sr-shadow{position:absolute;left:0;top:0;display:block;width:var(--sr-shadow-w,80px);height:calc(var(--sr-shadow-w,80px) * .26);translate:-50% -50%;border-radius:50%;background:radial-gradient(closest-side,#2a1a10a8,#2a1a1066 55%,#2a1a1000)}
.sr-screen img.sr-hero{position:absolute;display:block;max-width:none;max-height:none;object-fit:fill;filter:drop-shadow(0 3px 0 #1c142030)}
.sr-cloud{position:absolute}.sr-cloud-inner,.sr-cloud svg{display:block;width:100%;height:100%;overflow:visible}
/* b133: the Defeat drizzle is CSS on the compositor (no canvas loop): streaks falling the height of .sr-rain behind
   the hero and small splash rings at its foot. Hidden until the timeline fades it in; absent with reduced motion. */
.sr-rain{position:absolute;opacity:0;pointer-events:none}
.sr-rain>i{position:absolute;top:0;width:1.8px;height:11px;border-radius:1px;background:linear-gradient(#c8deff00,#c8deffee);animation:sr-drop .62s linear var(--d,0s) infinite;will-change:transform}
.sr-rain>b{position:absolute;bottom:-2px;width:12px;height:4px;margin-left:-6px;border:1.3px solid #d2e4ffb0;border-radius:50%;opacity:0;animation:sr-splash .62s ease-out var(--d,0s) infinite}
@keyframes sr-drop{0%{transform:translate(0,-6px) rotate(7deg);opacity:0}12%{opacity:.8}88%{opacity:.8}100%{transform:translate(-4px,var(--fall,60px)) rotate(7deg);opacity:0}}
@keyframes sr-splash{0%,55%{transform:scale(.2);opacity:0}65%{opacity:.7}100%{transform:scale(1);opacity:0}}
@media(prefers-reduced-motion:reduce){.sr-rain{display:none}}
.sr-fx{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:20}

/* The parchment sheet: rewards (Victory) or Get stronger (Defeat). */
#online.story-result-screen .sr-panel{position:relative;z-index:2;flex:none;width:100%;margin:0;padding:10px 12px 14px}
#online.story-result-screen .sr-panel h2{margin:0 0 8px;text-align:center;font-size:22px;line-height:1.1}
.sr-rewards{gap:10px}
.sr-rewards .reward-tile{width:auto;animation:none}
#modal .sr-rewards .reward-tile-face,.sr-rewards .reward-tile-face{width:68px;height:68px;padding:9px;cursor:default}
.sr-rewards .reward-tile-face .reward-tile-count{font-size:15px;bottom:3px}
@media(min-height:800px){.sr-rewards .reward-tile-face{width:78px;height:78px;padding:11px}.sr-rewards .reward-tile-face .reward-tile-count{font-size:16px}}
/* Get stronger rows: 12 px gaps, 58 px rows, the icon on its own item plate, the arrow on the right. */
.sr-rows{display:flex;flex-direction:column;gap:12px}
#online.story-result-screen.story-result-defeat .sr-panel{padding:14px 14px 16px}
#online.story-result-screen .sr-row{display:flex;align-items:center;gap:10px;width:100%;min-height:58px;margin:0;padding:0 16px 0 10px;font-size:21px;text-align:left}
#online.story-result-screen .sr-row>.button-label{display:flex;align-items:center;justify-content:flex-start;gap:12px;flex:1;min-width:0;text-align:left;white-space:nowrap}
.sr-row .sr-row-plate{flex:none;width:40px;height:40px;min-height:0;padding:4px;cursor:inherit;-webkit-text-stroke:0}
.sr-row-plate img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 1px 0 #3f302a55)}
.sr-row-text{min-width:0;overflow:hidden;text-overflow:clip}
.sr-row-go{position:relative;font:26px/1 Lucky,sans-serif;translate:0 -2px}
.sr-row>.attention-badge{top:-2px;right:-4px}

.sr-actions{position:relative;z-index:2;flex:none;width:100%}
#online.story-result-screen .sr-actions>button.primary{margin:2px 0 8px;width:100%;white-space:nowrap}
#online.story-result-screen .sr-actions>button.primary>.button-label{white-space:nowrap}
/* Try again carries the Hub Start button's energy chip (story-ui.css .hub-launch .button-cost). */
#online.story-result-screen .sr-actions>button.primary .button-cost{display:inline-flex;align-items:center;gap:2px;margin-left:10px;padding:2px 9px 2px 4px;border:2px solid #20452c;border-radius:999px;background:var(--cream-250);color:#2c4a2c;font:21px/1 Lucky;-webkit-text-stroke:0;text-shadow:none}
#online.story-result-screen .sr-actions>button.primary .button-cost img{width:20px;height:24px;object-fit:contain}

@media(max-height:760px){
 .sr-plaque{--sr-w:min(100%,296px)}
 .sr-title{padding-top:30px}
 .sr-starband{margin-top:8px}
 .story-result-defeat .sr-title{padding-top:0}
 .story-result-defeat .sr-plaque{--sr-w:min(100%,268px)}
 /* Compact screens tuck the (?) 5 px under the safe top and 10 px in (Gear, Collectibles). */
 .sr-help{top:-1px;right:-2px}
 .sr-screen{gap:6px}
 .sr-rows{gap:8px}
 #online.story-result-screen.story-result-defeat .sr-panel{padding:10px 12px 12px}
 #online.story-result-screen .sr-panel h2{font-size:20px;margin-bottom:8px}
 #online.story-result-screen .sr-row{min-height:48px;font-size:19px}
 .sr-row .sr-row-plate{width:36px;height:36px;padding:3px}
 /* The energy chip tightens on Compact so the longest Try again (pl "Spróbuj ponownie") stays on one line. */
 #online.story-result-screen .sr-actions>button.primary{padding-left:12px;padding-right:12px}
 #online.story-result-screen .sr-actions>button.primary .button-cost{margin-left:6px;padding:1px 7px 1px 3px;font-size:18px}
 #online.story-result-screen .sr-actions>button.primary .button-cost img{width:16px;height:20px}
}

/* Visual polish round 2, story lane. #35/#250: one or two Victory rewards are the sheet's subject: their tiles are 1.3x
   (68 -> 88 px, 78 -> 100 px on tall phones) on a warm-gold glow that belongs to the tile, so it is born and lands with
   it (AC640: never before its subject; Defeat has no reward sheet). #15: the Get stronger rows read like the other
   cream list rows: dark ink labels and chevrons, no white lettering on the light face. */
.sr-rewards:not(:has(>:nth-child(3))) .reward-tile{position:relative;isolation:isolate}
.sr-rewards:not(:has(>:nth-child(3))) .reward-tile::before{content:none}
.sr-rewards .sr-reward-light{position:absolute;z-index:-1;left:50%;top:50%;margin:0;width:180%;height:auto;aspect-ratio:1;translate:-50% -50%;pointer-events:none}
.sr-rewards .sr-reward-light>*{animation-play-state:running}
#modal .sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face,.sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face{width:88px;height:88px;padding:12px}
.sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face .reward-tile-count{font-size:18px;bottom:4px}
@media(min-height:800px){.sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face{width:100px;height:100px;padding:14px}.sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face .reward-tile-count{font-size:20px}}
@media(max-height:700px){.sr-rewards:not(:has(>:nth-child(3))) .reward-tile-face{width:80px;height:80px;padding:10px}}
#online.story-result-screen .sr-row>.button-label,#online.story-result-screen .sr-row .sr-row-go{color:var(--text-on-cream);-webkit-text-stroke:0;text-shadow:none;paint-order:normal}
/* #260: the departing Battle row copy (battleRowLeave) never shows through the result screen's blur: it is gone the
   moment the result screen mounts, before the scene dims. */
#online.story-result-screen>.battle-row-ghost{visibility:hidden}
