/* Shangsi ending: share the opening's floral paper, position and button.
   Only recap layout/appearance and reveal timing differ; settlement stays untouched. */
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story {
 top:24.5%;
 bottom:4%;
 left:5.2%;
 width:48%;
 height:auto;
 max-height:none;
 min-height:0;
 display:flex;
 flex-direction:column;
 align-items:flex-start;
 overflow:visible;
 gap:clamp(9px,1.25cqw,18px);
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-copy {
 flex:1 1 auto;
 min-height:0;
 max-height:none;
 width:100%;
 display:flex;
 flex-direction:column;
 padding:0;
 overflow:hidden;
}
/* The paper border and floral corners stay on the non-scrolling card. */
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-scroll {
 position:relative;
 z-index:1;
 flex:1 1 auto;
 min-width:0;
 min-height:0;
 box-sizing:border-box;
 width:100%;
 padding:clamp(16px,1.85cqw,29px) clamp(18px,2.15cqw,34px);
 overflow-x:hidden;
 overflow-y:auto;
 overscroll-behavior:contain;
 scrollbar-width:thin;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-scroll > p {
 font-size:var(--font-story);
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-copy::before {z-index:2;}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-copy::after {z-index:3;}
/* Summary sits inside the same floral paper card, after the ending prose. */
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary {
 position:relative;
 z-index:1;
 margin:clamp(12px,1.4cqw,21px) 0 0;
 padding:clamp(9px,1cqw,15px) 0 0;
 border-top:1px solid rgba(177,128,68,.48);
 color:#553b2b;
 font-family:var(--palace-story-font,serif);
 opacity:1;
 visibility:visible;
 transform:translateY(0);
 transition:opacity .22s ease .08s,transform .3s ease .08s,visibility 0s;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > h3 {
 position:relative;z-index:1;
 margin:0 0 .45em;
 color:#713f26;
 font-size:var(--font-body);
 font-weight:650;
 letter-spacing:.07em;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > p {
 position:relative;z-index:1;
 margin:.34em 0;
 font-family:var(--palace-story-font,serif);
 font-size:var(--font-body);
 font-weight:500;
 line-height:1.6;
 letter-spacing:.01em;
 color:#553b2b;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > .spring-outing-achievement {
 font-weight:700;
 color:#82502b;
}
/* The existing typewriter controls data-typing on the story shell.
   Wait until all prose finishes before revealing the recap; the action is
   separately held inert and hidden by revealNarrative until narration ends. */
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='true'] .spring-outing-summary {
 opacity:0;visibility:hidden;transform:translateY(7px);transition:none;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > :is(h3,p) {
 opacity:1;transform:translateY(0);transition:opacity .28s ease,transform .28s ease;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='true'] .spring-outing-summary > :is(h3,p) {
 opacity:0;transform:translateY(5px);transition:none;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] .spring-outing-summary > h3 {transition-delay:.12s;}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] .spring-outing-summary > p:nth-of-type(1) {transition-delay:.28s;}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] .spring-outing-summary > p:nth-of-type(2) {transition-delay:.43s;}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] .spring-outing-summary > p:nth-of-type(n+3) {transition-delay:.57s;}

/* The action never scrolls with the recap; the paper alone scrolls. */
html body[data-game='palace'].game-shell #game.spring-outing-ending-page .spring-outing-ending-story > button {
 flex:0 0 auto;
 align-self:flex-start;
 position:relative;
 z-index:5;
 max-width:100%;
 box-shadow:inset 0 0 0 3px rgba(255,251,238,.95),
            inset 0 0 0 4px rgba(205,148,73,.72),
            0 6px 17px rgba(72,44,19,.28);
}
/* A quiet but explicit invitation to scroll, visible only for clipped content. */
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-scroll-hint {
 position:absolute;
 z-index:6;
 bottom:clamp(56px,6.5cqw,94px);
 right:clamp(7px,1.1cqw,17px);
 max-width:85%;
 padding:clamp(5px,.57cqw,9px) clamp(9px,1.0cqw,15px);
 color:#654020;
 background:rgba(255,247,224,.97);
 border:1px solid rgba(170,119,57,.8);
 border-radius:22px;
 box-shadow:0 4px 14px rgba(54,34,17,.22);
 font-family:var(--palace-story-font,serif);
 font-size:var(--font-note);
 font-weight:650;
 line-height:1.4;
 pointer-events:none;
 white-space:nowrap;
}
html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-scroll-hint[hidden] {display:none;}
@keyframes shangsi-ending-action-reveal {
 from{opacity:0;transform:translateY(6px);}
 to{opacity:1;transform:translateY(0);}
}
html body[data-game='palace'].game-shell #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] > button {
 animation:shangsi-ending-action-reveal .3s ease .65s both;
}
@media (orientation:landscape) and (max-height:500px) {
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-story {
  top:24%;bottom:4%;left:5%;width:49%;gap:7px;
 }
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-copy {
  min-height:0;max-height:none;padding:0;
 }
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-scroll {
  padding:10px 13px;
 }
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-ending-scroll > p {line-height:1.58;}
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-scroll-hint {
  bottom:clamp(42px,6cqw,66px);
  padding:4px 8px;

 }
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary {
  margin-top:8px;padding-top:6px;
 }
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > h3 {font-size:var(--font-body);}
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > p {line-height:1.45;}
}
@media (prefers-reduced-motion:reduce) {
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary,
 html body[data-game='palace'] #game.spring-outing-ending-page .spring-outing-summary > :is(h3,p) {transition:none;}
 html body[data-game='palace'].game-shell #game.spring-outing-ending-page .spring-outing-ending-story[data-typing='false'] > button {animation:none;}
}
