/* v7: the timeline under the stats, the portrait always on the stage (the narrator beside it on the prologue),
   and a fixed-size text card that scrolls inside with its own scrollbar */

/* ---------- the timeline: part of the header, right under the six stats ---------- */
#s-story .st-main > .st-tl { order: 0; flex: none; margin: .1rem 0 .15rem; padding: .22rem .6rem; }

/* ---------- the stage ---------- */
#s-story .st-stage { position: relative; gap: .8rem; padding: .2rem 0 .35rem; justify-content: center; }
#s-story .st-stage .st-portrait { flex: 0 1 auto; min-height: 4rem; height: min(9.4rem, 19vh); max-height: 100%; }
#s-story .st-stage .st-portrait img { height: 100%; width: auto; max-width: none; }
/* the narrator stands at the stage's right edge on the prologue, never over the timeline or the text */
#s-story .st-stage .st-chron { position: absolute; left: auto; top: auto; right: -.2rem; bottom: .1rem; width: auto; height: min(8.2rem, 16vh); z-index: 1; pointer-events: none; }
#s-story .st-stage.talk #st-sub.subtitle.top { z-index: 3 !important; }

/* ---------- the text card: fixed size, smaller type, scrolls inside ---------- */
/* v15: the card gives way (and scrolls) before the stage does, so the portrait is never squeezed */
#s-story .st-card { position: relative; flex: 0 1 auto; height: clamp(8.6rem, 24vh, 13rem); min-height: 6.4rem; max-height: none; overflow: hidden; padding: 0; }
#s-story .st-main .st-stage { min-height: min(10.5rem, 22vh); }
/* the text fades out at the top and bottom edges, so it never runs into the card's corner ornaments */
#s-story .st-scroll { position: absolute; inset: .4rem 1.15rem .4rem 1.05rem; padding: .5rem .55rem .5rem 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 .55rem, #000 calc(100% - .7rem), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 .55rem, #000 calc(100% - .7rem), transparent 100%); }
#s-story .st-scroll::-webkit-scrollbar { display: none; }
#s-story .st-card h3 { font-size: .92rem; margin: 0 0 .3rem; }
#s-story #st-text { font-size: .88rem; line-height: 1.65; margin: 0; }
/* v15: smaller choices and reaction lines */
#s-story .choices { gap: .5rem; margin-top: .8rem; }
#s-story .choice { min-height: 2.95rem; padding: .45rem .9rem; }
#s-story .choice .lbl { font-size: .9rem; line-height: 1.3; }
#s-story .choice .hidtag { font-size: .7rem; }
#s-story .rx-beat { margin: .45rem 0 .15rem; gap: .5rem; }
#s-story .rx-beat .rx-av { flex-basis: 2.2rem; width: 2.2rem; height: 2.2rem; }
#s-story .rx-beat .rx-body b { font-size: .85rem; }
#s-story .rx-beat .rx-body p, #s-story .rx-beat.nar p { font-size: .86rem; line-height: 1.5; }
/* the card's own scrollbar: a hairline gold track with a brighter thumb, shown only when the text overflows */
#s-story .st-sbar { position: absolute; right: .5rem; top: .95rem; bottom: .95rem; width: .22rem; border-radius: .2rem; background: rgba(226, 199, 142, .14);
  opacity: 0; transition: opacity .25s ease; pointer-events: none; }
#s-story .st-sbar.on { opacity: 1; }
#s-story .st-sbar i { position: absolute; left: 0; right: 0; top: 0; height: 30%; border-radius: .2rem;
  background: linear-gradient(180deg, #f4e3b8, #c9a560); box-shadow: 0 0 6px rgba(244, 227, 184, .5); }

/* ---------- v15: the ending's buttons line up; the fate tree's boxes sit on one grid ---------- */
#en-body .en-head { display: flex; flex-direction: column; align-items: center; }
#en-body .en-head .en-ptwrap { order: 0; } #en-body .en-head .en-no { order: 1; } #en-body .en-head .en-badge { order: 2; }
#en-body .en-head .en-title { order: 3; } #en-body .en-head .en-who { order: 4; } #en-body .en-head .en-new { order: 5; }
#en-body .en-head .en-replay { order: 6; }
#en-body .en-head .en-replay, #en-body .tree-btn { box-sizing: border-box; width: 84%; max-width: 22rem; margin: .55rem auto 0; display: flex; }
#en-body .tree-btn { margin-top: .5rem; }
#modal-box .tr-nodes { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; margin: 0 !important; }
#modal-box .tr-n { box-sizing: border-box; width: auto !important; margin: 0 !important; min-height: 3.1rem !important;
  display: flex !important; flex-direction: column; justify-content: center; align-items: flex-start; padding: .4rem .65rem !important; line-height: 1.3; }
#modal-box .tr-n small { display: block; margin: 0 0 .12rem !important; }
#modal-box .tr-n.sub { grid-column: 1 / -1; }
#modal-box .tr-nodes > .tr-n:last-child:nth-child(odd) { grid-column: 1 / -1; }
