/* v4: figure first, periods, the lifeline, hidden choices, collapse endings and the dated timeline */

/* ---------- figure select ---------- */
.fg-sub { display: flex; align-items: center; gap: .6rem; padding: 0 1rem .55rem; flex: none; }
.fg-sub span { flex: 1; min-width: 0; font-size: .86rem; line-height: 1.35; color: var(--muted); text-shadow: 0 1px 0 #000; }
.fg-sub .btn { flex: none; min-height: 2.9rem; padding: .3rem .85rem; font-size: .86rem; line-height: 1.2; max-width: 52%; }
.fg-tabs-wrap { padding: .1rem .5rem .55rem; }
#fg-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem .55rem; align-content: start; touch-action: pan-y; }
#fg-list.from-r .fg-card { animation-name: fromR; }
#fg-list.from-l .fg-card { animation-name: fromL; }
.fg-era { grid-column: 1 / -1; margin: .55rem 0 0; font-size: .9rem; font-weight: 800; letter-spacing: .05em; color: var(--gold); text-shadow: 0 1px 0 #000; }
.fg-era:first-child { margin-top: .1rem; }
.fg-card { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: .55rem .35rem .6rem; border-radius: .85rem; cursor: pointer;
  background: linear-gradient(180deg, rgba(74,22,17,.94), rgba(26,13,8,.96)); border: 1.5px solid #7f6131;
  box-shadow: inset 0 1px 0 rgba(255,230,180,.2), 0 4px 10px rgba(0,0,0,.55); transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; }
.fg-card:active { transform: scale(.95); }
.fg-card.played { border-color: var(--gold); box-shadow: inset 0 1px 0 rgba(255,230,180,.3), 0 0 10px rgba(230,196,124,.25), 0 4px 10px rgba(0,0,0,.55); }
.fg-pt { position: relative; width: 84%; aspect-ratio: 1; }
.fg-pt img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; object-position: 50% 18%; background: #1a0f08;
  border: .17rem solid var(--gold2); box-shadow: 0 0 0 .12rem #2a1206, 0 4px 10px rgba(0,0,0,.7); }
.fg-card.played .fg-pt img { border-color: var(--gold); }
.fg-pt .vo, .fp-pt .vo { position: absolute; right: -.15rem; top: -.1rem; width: 1.5rem; height: 1.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #a3302a, #5a1311); border: 1.5px solid var(--gold); box-shadow: 0 2px 4px #000; }
.fg-pt .vo svg, .fp-pt .vo svg { width: .9rem; height: .9rem; fill: #fff0cc; }
.fg-yr { position: absolute; left: 50%; bottom: -.5rem; transform: translateX(-50%); padding: .06rem .45rem; border-radius: .6rem; white-space: nowrap;
  font-size: .76rem; font-weight: 900; color: #2a1406; background: linear-gradient(180deg, #f3d792, #c99a48); border: 1px solid #fff0c0; box-shadow: 0 2px 4px #000; }
.fg-nm { margin-top: .75rem; min-height: 2.4em; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.2;
  font-size: .88rem; font-weight: 800; color: #fff0cc; text-shadow: 0 2px 0 #000; overflow-wrap: anywhere; }
.fg-card .prog { width: 78%; margin-top: .3rem; }

/* ---------- a figure's page ---------- */
#fp-body { padding-top: .1rem; }
.fp-hero { display: flex; align-items: center; gap: 1rem; margin-bottom: .8rem; padding: .9rem; border-radius: 1rem;
  background: linear-gradient(135deg, rgba(74,21,16,.95), rgba(24,12,7,.95)); border: 2px solid var(--gold2);
  box-shadow: inset 0 1px 0 rgba(255,230,180,.25), 0 6px 16px rgba(0,0,0,.6); }
.fp-pt { position: relative; flex: none; width: 6.8rem; aspect-ratio: 4 / 5; }
.fp-pt img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: #1a0f08;
  border: .22rem solid var(--gold); box-shadow: 0 0 0 .18rem #2a1206, 0 8px 18px #000, 0 0 24px rgba(230,196,124,.3); }
#s-figure.active .fp-pt img { animation: popIn .5s cubic-bezier(.2,1.5,.4,1) both; }
.fp-info { flex: 1; min-width: 0; }
.fp-info .ct { font-size: .78rem; font-weight: 700; color: var(--gold); text-shadow: 0 1px 0 #000; }
.fp-info .nm { margin: .12rem 0 .15rem; font-size: 1.45rem; font-weight: 900; line-height: 1.2; color: #fff0cc; text-shadow: 0 2px 0 #000, 0 0 12px rgba(230,196,124,.35); }
.fp-info .rl { font-size: .86rem; line-height: 1.4; color: #e2d0aa; }
.fp-end { display: inline-flex; margin-top: .6rem; min-height: 2.9rem; padding: .3rem .85rem; font-size: .85rem; }
.fp-ev { position: relative; height: 6.2rem; margin-bottom: .8rem; border-radius: .9rem; overflow: hidden; background-size: cover, cover; background-position: center 38%, center;
  border: 2px solid #8b6a35; box-shadow: 0 5px 12px rgba(0,0,0,.6); }
.fp-ev::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(12,7,4,.93) 0%, rgba(12,7,4,.62) 55%, rgba(12,7,4,.1) 100%); }
.fp-ev-in { position: absolute; left: .9rem; right: .9rem; bottom: .7rem; }
.fp-ev-in small { display: block; font-size: .78rem; font-weight: 700; color: var(--gold); text-shadow: 0 1px 0 #000; }
.fp-ev-in b { display: block; margin-top: .1rem; font-size: 1.15rem; color: #fff3da; text-shadow: 0 2px 0 #000; }
.fp-rules { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .9rem; }
.fp-rule { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border-radius: .8rem; background: rgba(20,11,6,.9); border: 1.5px solid #5d4423; }
.fp-rule .ic { flex: none; width: 2.3rem; height: 2.3rem; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 35%, #c9473b, #641512); border: 1.5px solid #ffb19a; box-shadow: 0 2px 6px #000; }
.fp-rule .ic svg { width: 1.25rem; height: 1.25rem; fill: #fff0cc; }
.fp-rule b { display: block; font-size: .9rem; line-height: 1.3; color: #fff0cc; }
.fp-rule small { display: block; margin-top: .12rem; font-size: .8rem; line-height: 1.4; color: var(--muted); }
.fp-rule.key { border-color: rgba(224,96,74,.55); background: linear-gradient(90deg, rgba(70,14,10,.9), rgba(20,11,6,.9)); }
.fp-rule.key b { color: #ffc2b2; }
.fp-rule.hid { border-color: rgba(230,196,124,.6); background: linear-gradient(90deg, rgba(64,46,14,.9), rgba(20,11,6,.9)); }
.fp-rule.hid .ic { background: radial-gradient(circle at 40% 35%, #fff0b8, #b8862e); border-color: #fff4cc; }
.fp-rule.hid .ic svg { fill: #3a1c06; }
.fp-rule.hid b { color: #f6dc9a; }
.period-card { position: relative; overflow: hidden; margin-bottom: .7rem; padding: .75rem 1rem .8rem; border-radius: .9rem; cursor: pointer; border: 2px solid var(--gold2);
  box-shadow: inset 0 1px 0 rgba(255,230,180,.25), 0 5px 12px rgba(0,0,0,.55); transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; }
.period-card:active { transform: scale(.97); }
.period-card::after { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); font: 900 3.4rem/1 Georgia, "Times New Roman", serif; color: rgba(255,240,200,.13); pointer-events: none; }
.period-card.p-rise { background: linear-gradient(90deg, rgba(38,60,42,.96), rgba(16,24,15,.96)); border-color: #b9c9a0; }
.period-card.p-rise::after { content: "I"; }
.period-card.p-storm { background: linear-gradient(90deg, rgba(96,25,19,.96), rgba(32,13,8,.96)); border-color: var(--gold); }
.period-card.p-storm::after { content: "II"; }
.period-card.p-brink { background: linear-gradient(90deg, rgba(36,42,86,.96), rgba(13,15,34,.96)); border-color: #a9b8ec; }
.period-card.p-brink::after { content: "III"; }
.pc-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.pc-top b { font-size: 1.22rem; color: #fff0cc; text-shadow: 0 2px 0 #000; }
.pc-n { flex: none; padding: .12rem .55rem; border-radius: 1rem; font-size: .78rem; font-weight: 800; color: var(--gold); background: rgba(0,0,0,.45); border: 1px solid rgba(230,196,124,.4); white-space: nowrap; }
.pc-span { position: relative; z-index: 1; margin-top: .2rem; font-size: .86rem; font-weight: 800; color: var(--gold); text-shadow: 0 1px 0 #000; }
.p-rise .pc-span { color: #d5e6bc; } .p-brink .pc-span { color: #c9d4ff; }
.period-card small { position: relative; z-index: 1; display: block; margin-top: .25rem; padding-right: 2.8rem; font-size: .84rem; line-height: 1.45; color: #e6d6b2; }

/* ---------- story: the dated timeline bar ---------- */
.stats { row-gap: .62rem; padding-top: .55rem; }
.subtitle.top { top: 12.6rem; }
.st-tl { flex: none; display: flex; align-items: center; gap: .45rem; margin: .35rem 0 auto; padding: .38rem .75rem; border-radius: 2rem;
  background: rgba(12,7,4,.74); border: 1px solid rgba(230,196,124,.35); box-shadow: 0 3px 10px rgba(0,0,0,.45); }
.tl-y { flex: none; font-size: .76rem; font-weight: 800; color: var(--muted); white-space: nowrap; text-shadow: 0 1px 0 #000; }
.tl-y.end { color: var(--gold); }
.tl-track { position: relative; flex: 1; height: .32rem; margin: 0 .45rem; border-radius: .2rem; background: rgba(255,255,255,.16); }
.tl-track b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: .2rem; background: linear-gradient(90deg, #a87c34, #f6dc9a); transition: width .6s cubic-bezier(.3,1.2,.5,1); }
.tl-dot { position: absolute; top: 50%; width: .62rem; height: .62rem; border-radius: 50%; transform: translate(-50%, -50%); background: #3a2a18; border: 1.5px solid #8b6a35; transition: background .3s, border-color .3s; }
.tl-dot.past { background: #e6c47c; border-color: #fff0c0; }
.tl-dot.era { border-color: #b9c9a0; } .tl-dot.era.past { background: #a3b88e; }
.tl-dot.dilemma { border-color: #c8a8d8; } .tl-dot.dilemma.past { background: #b591c8; }
.tl-dot.cur { width: .95rem; height: .95rem; background: #fff0c0; border-color: #fff; animation: tlPulse 1.6s ease-in-out infinite; }
.tl-dot.fin { width: .82rem; height: .82rem; border-radius: .14rem; transform: translate(-50%, -50%) rotate(45deg); background: #7d1f1c; border-color: #ffb19a; }
.tl-dot.fin.cur { width: 1rem; height: 1rem; background: #ff7a5a; border-color: #fff; }
@keyframes tlPulse { 0%,100% { box-shadow: 0 0 0 .15rem rgba(230,196,124,.3), 0 0 6px rgba(255,230,160,.7); } 50% { box-shadow: 0 0 0 .32rem rgba(230,196,124,.12), 0 0 14px rgba(255,230,160,1); } }

/* ---------- stats: the lifeline and the hidden stat ---------- */
.stat em.life { position: absolute; left: 50%; top: -.62rem; transform: translateX(-50%); z-index: 2; padding: 0 .4rem; border-radius: .5rem; white-space: nowrap; pointer-events: none;
  font-style: normal; font-size: .76rem; font-weight: 900; line-height: 1.05rem; color: #fff0e6; background: linear-gradient(180deg, #c8402f, #7a1612); border: 1px solid #ffb19a; box-shadow: 0 2px 4px #000; }
.stat.key { border-color: #d0604a; box-shadow: inset 0 0 10px rgba(224,96,74,.25); }
.stat.key .bar2 i { background: linear-gradient(90deg, #9c2a20, #ff8a6a); }
.stat.key.top { box-shadow: inset 0 0 10px rgba(224,96,74,.25), 0 0 10px rgba(230,196,124,.5); }
.stat.warn { border-color: #ff5a46; animation: warnPulse 1.1s ease-in-out infinite; }
.stat.warn .v { color: #ff9a86; }
@keyframes warnPulse { 0%,100% { background: rgba(60,8,6,.85); box-shadow: 0 0 0 rgba(255,80,60,0); } 50% { background: rgba(120,14,10,.9); box-shadow: 0 0 14px rgba(255,80,60,.75); } }
.stat.hidok { border-color: #fff0b8; box-shadow: 0 0 12px rgba(255,214,120,.7); }
.stat.hidok::after { content: "✦"; position: absolute; right: .25rem; top: -.55rem; font-size: .9rem; color: #ffe08a; text-shadow: 0 0 6px rgba(255,214,120,.9), 0 1px 0 #000; animation: pulse 1.4s ease-in-out infinite; }
.stat.dead { border-color: #555; background: rgba(10,4,3,.95) !important; filter: grayscale(.6); animation: deadShake .5s ease both; }
.stat.dead .v { color: #ff5a46; }
@keyframes deadShake { 0%,100% { transform: none; } 20% { transform: translateX(-4px) rotate(-2deg); } 40% { transform: translateX(4px) rotate(2deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* ---------- choices: many, hidden and locked ---------- */
.choices.many { gap: .45rem; margin-top: .8rem; }
.choices.many .choice { min-height: 2.95rem; padding: .45rem .9rem; }
.choices.many .choice .lbl { font-size: .97rem; }
.choices.in .btn:nth-child(4) { animation-delay: .18s; }
.choice.hid { position: relative; overflow: hidden; color: #2a1406; text-shadow: 0 1px 0 rgba(255,244,210,.55);
  background: linear-gradient(180deg, #f2d27c 0%, #c99a40 55%, #94681a 100%); border-color: #fff3c4;
  box-shadow: inset 0 1px 0 rgba(255,250,220,.7), inset 0 -3px 0 rgba(80,40,0,.35), 0 4px 10px rgba(0,0,0,.6), 0 0 18px rgba(255,214,120,.55); }
.choice.hid::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255,255,240,.55), transparent); transform: skewX(-20deg); animation: hidShine 2.6s ease-in-out infinite; pointer-events: none; }
@keyframes hidShine { 0% { left: -40%; } 55%,100% { left: 120%; } }
.hidtag { display: block; margin-bottom: .1rem; font-size: .76rem; font-weight: 900; letter-spacing: .03em; color: #5a2a04; text-shadow: none; }
.locked-opt { cursor: default; justify-content: center; text-align: center; color: #b19c74; text-shadow: 0 1px 0 #000; filter: none;
  background: rgba(20,12,6,.72) !important; border: 1.5px dashed #7a5d30 !important; box-shadow: none !important; }
.locked-opt .lbl { flex: none; font-size: .86rem !important; font-weight: 700; }
.locked-opt:active { transform: none !important; }

/* ---------- cutscenes and the ending ---------- */
.cine-stamp.col { color: #f4e8d2; border-color: #f4e8d2; background: rgba(96,8,6,.82); text-shadow: 0 0 10px rgba(0,0,0,.8), 0 3px 0 #000; box-shadow: 0 0 30px rgba(140,0,0,.6), inset 0 0 18px rgba(0,0,0,.4); }
.cine-stamp.hid { color: #ffe9a8; border-color: #ffe9a8; background: rgba(54,28,4,.55); text-shadow: 0 0 16px rgba(255,214,120,.85), 0 3px 0 #000; box-shadow: 0 0 30px rgba(255,214,120,.45), inset 0 0 18px rgba(255,214,120,.25); }
#cine.col.on .cine-art { animation-name: cinePanCol; }
@keyframes cinePanCol {
  0% { transform: scale(1.5) translate(var(--px, 4%), var(--py, 3%)); filter: brightness(.3) grayscale(.9) contrast(1.2); }
  100% { transform: scale(1.04) translate(0, 0); filter: brightness(.62) grayscale(.75) sepia(.35) contrast(1.15); }
}
#cine.col .cine-shade { background: radial-gradient(ellipse at 50% 42%, rgba(90,0,0,.1) 30%, rgba(60,0,0,.65) 100%), linear-gradient(180deg, transparent 45%, rgba(0,0,0,.88) 78%, rgba(0,0,0,.96) 100%); }
#cine.col .cine-title { color: #ffd8cc; text-shadow: 0 3px 0 #000, 0 0 24px rgba(255,60,40,.75); }
#cine.col .cine-head b { color: #ffb19a; }
.en-badge { display: inline-block; margin-top: .4rem; padding: .18rem .8rem; border-radius: 1rem; font-size: .84rem; font-weight: 900; letter-spacing: .06em; }
.en-badge.col { color: #f4e8d2; background: linear-gradient(180deg, #8a1a14, #3a0806); border: 1.5px solid #ffb19a; box-shadow: 0 0 12px rgba(200,40,30,.5); }
.en-badge.hid { color: #3a1c06; background: linear-gradient(180deg, #fff0b8, #d8a63c); border: 1.5px solid #fff4cc; box-shadow: 0 0 14px rgba(255,214,120,.6); }
#s-ending.active .en-badge { animation: popIn .45s cubic-bezier(.2,1.5,.4,1) .35s both; }

/* ---------- chronicle ---------- */
.sl-node.hid .sl-dot { background: #ffe08a; border-color: #fff; box-shadow: 0 0 12px rgba(255,214,120,.9); }
.sl-node.hid .sl-body { border-color: #d8a63c; background: linear-gradient(135deg, rgba(70,48,12,.93), rgba(22,12,6,.93)); }
.sl-node.hid .sl-tag { color: #ffe08a; }
.sl-node.col .sl-dot { left: -1.47rem; width: 1.1rem; height: 1.1rem; background: #1a0605; border-color: #ff5a46; box-shadow: 0 0 12px rgba(255,80,60,.8); }
.sl-node.col .sl-body { border-color: #b8332a; background: linear-gradient(135deg, rgba(60,8,6,.95), rgba(14,5,4,.95)); }
.sl-node.col .sl-tag { color: #ff9f86; }
.sl-body p.sl-h1.col { font-weight: 900; color: #ff9f86; }

/* ---------- gallery: the hidden row and the collapse ending ---------- */
.grid12 .rh.hid { color: #f6dc9a; }
.grid12 .rh.col { color: #ffb19a; }
.tile.hid { border-style: dashed; border-color: #8a6a2c; }
.tile.hid.on { border-style: solid; border-color: #fff0c0; background: radial-gradient(circle, #d9a640, #6a4510); }
.tile.wide { grid-column: 1 / -1; justify-self: stretch; max-width: none; aspect-ratio: auto; height: 3rem; gap: .5rem; padding: 0 .7rem; }
.tile.wide.on img { width: 2.1rem; height: 2.1rem; flex: none; }
.tile.wide span { min-width: 0; font-size: .88rem; color: #ffe2d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.wide .tr { right: .4rem; bottom: auto; top: 50%; transform: translateY(-50%); }
.tile.col { border-color: #6a2a20; }
.tile.col.on { background: linear-gradient(90deg, #5a0e0a, #1a0504); border-color: #e0604a; }
