/* Talewalkers - illuminated storybook UI. No external fonts or assets. */
:root {
  --parch: #efe4cc; --parch-2: #e5d5b2; --parch-3: #f7efdc;
  --ink: #2b2118; --ink-soft: #54443a; --ember: #c8641e; --ember-ink: #8f3f0c;
  --gold: #b8913a; --gold-hi: #e3c377; --moss: #4f6b4a; --moss-ink: #3b5237; --night: #1d2430; --night-2: #2a3344;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --r: 10px 7px 12px 8px / 8px 12px 7px 10px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .13 0 0 0 0 .09 0 0 0 -1.5 .95'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.45'/%3E%3C/svg%3E");
  --wash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='w'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.008' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .4 0 0 0 0 .2 0 0 0 .9 -.32'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23w)'/%3E%3C/svg%3E");
  --party-h: 92px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { overscroll-behavior-y: none; }
button, .choice, .chip { touch-action: manipulation; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--night); color: var(--ink);
  font-family: var(--serif); font-size: 1.0625rem; line-height: 1.5;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .4em; font-weight: 700; }
p { margin: 0 0 .6em; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--ember-ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--parch); padding: 8px 12px; border: 2px solid var(--ink); }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }
.center { text-align: center; }
.kicker { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ember-ink); margin-bottom: .2em; }
.on-dark, .kicker.on-dark { color: var(--parch); text-shadow: 0 1px 2px #000, 0 0 12px rgba(0,0,0,.6); }
.kicker.on-dark { color: var(--gold-hi); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; margin: 14px 0; }

/* ---------------------------------------------------------------- stage */
#stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--night); --px: 0; --py: 0; }
.stage-layer { position: absolute; inset: -4%; opacity: 0; transition: opacity 1.4s ease; transform: translate(calc(var(--px) * -18px), calc(var(--py) * -12px)); }
.stage-layer.on { opacity: 1; }
.stage-layer img { width: 100%; height: 100%; object-fit: cover; animation: drift 46s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.04) translate(-1%, 0); } to { transform: scale(1.12) translate(1.2%, -1.2%); } }
#atmo { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage-shade { position: absolute; inset: 0; background:
  linear-gradient(to bottom, rgba(29,36,48,.25) 0%, rgba(29,36,48,0) 22%, rgba(29,36,48,.15) 45%, rgba(29,36,48,.72) 100%),
  radial-gradient(ellipse at 50% 40%, transparent 55%, rgba(20,14,10,.55) 100%); }
#stage[data-mood="battle"] .stage-shade { background-color: rgba(200,100,30,.12); }
#stage[data-mood="sorrow"] .stage-shade { background-color: rgba(29,36,48,.25); }
#stage[data-mood="tense"] .stage-shade { background-color: rgba(29,36,48,.12); }
.stage-paper { position: absolute; inset: 0; background-image: var(--grain); mix-blend-mode: multiply; opacity: .55; box-shadow: inset 0 0 0 6px rgba(43,33,24,.85), inset 0 0 0 8px rgba(184,145,58,.7); }
body[data-screen="scene"] #stage .stage-layer { inset: -4% -4% 30% -4%; }
body[data-screen="scene"] .stage-shade { background:
  linear-gradient(to bottom, rgba(29,36,48,.15) 0%, rgba(29,36,48,0) 25%, rgba(29,36,48,.55) 58%, var(--night) 72%),
  radial-gradient(ellipse at 50% 30%, transparent 50%, rgba(20,14,10,.5) 100%); }
@media (min-width: 900px) { body[data-screen="scene"] #stage .stage-layer { inset: -4%; } body[data-screen="scene"] .stage-shade { background: linear-gradient(to right, rgba(29,36,48,0) 0%, rgba(29,36,48,.1) 40%, rgba(29,36,48,.75) 100%), radial-gradient(ellipse at 40% 40%, transparent 50%, rgba(20,14,10,.5) 100%); } }

/* ---------------------------------------------------------------- shell */
#shell { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; padding-bottom: calc(var(--party-h) + 24px + env(safe-area-inset-bottom)); }
body[data-screen="landing"] #shell, body[data-screen="lobby"] #shell, body[data-screen="ending"] #shell { padding-bottom: 40px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); max-width: 1100px; margin: 0 auto; }
.brand img { height: 34px; width: auto; filter: drop-shadow(0 1px 0 rgba(239,228,204,.6)) drop-shadow(0 0 10px rgba(239,228,204,.55)); }
.brand { display: inline-flex; align-items: center; min-height: 44px; border-radius: 6px; padding: 2px 6px; background: rgba(239,228,204,.82); }
body[data-screen="landing"] .brand { visibility: hidden; }
.room-chip { font-size: .85rem; letter-spacing: .2em; padding: 3px 10px; border-radius: 999px; background: rgba(29,36,48,.75); color: var(--gold-hi); border: 1px solid var(--gold); }
.toggles { margin-left: auto; display: flex; gap: 8px; }
main { max-width: 680px; margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); outline: none; }
@media (min-width: 900px) { body[data-screen="scene"] main { max-width: 560px; margin-right: max(32px, calc((100vw - 1100px) / 2)); } }

/* ---------------------------------------------------------------- surfaces */
.parchment {
  background-color: var(--parch); background-image: var(--grain), var(--wash), linear-gradient(var(--parch-3), var(--parch) 40%, var(--parch-2));
  border: 2px solid var(--ink); border-radius: var(--r);
  box-shadow: inset 0 0 0 3px var(--parch), inset 0 0 0 4.5px rgba(184,145,58,.75), 0 10px 28px rgba(0,0,0,.38), 0 2px 0 rgba(43,33,24,.4);
}
.panel { padding: 18px 16px; margin: 0 0 16px; }
.framed { position: relative; display: block; overflow: hidden; border-radius: 6px; background: var(--night-2); }
.framed img { width: 100%; height: 100%; object-fit: cover; }
.framed::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background-image: var(--grain); mix-blend-mode: multiply; opacity: .5;
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px var(--parch), inset 0 0 0 5.5px var(--gold), inset 0 0 22px rgba(43,33,24,.45); }
.portrait { aspect-ratio: 3 / 4; }

/* ---------------------------------------------------------------- buttons & fields */
.btn {
  appearance: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 44px; padding: 8px 16px; border: 2px solid var(--ink); border-radius: var(--r);
  background: var(--parch-3); color: var(--ink); font-weight: 700; box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s, background .2s;
}
.btn:hover { background: #fff6e2; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: 0 3px 0 var(--ink); }
.btn.primary { background: linear-gradient(#d67a32, var(--ember) 55%, #a9521a); color: #fff8ea; border-color: #4a230b; box-shadow: 0 3px 0 #4a230b, inset 0 0 0 2px rgba(227,195,119,.55); text-shadow: 0 1px 0 rgba(43,33,24,.6); }
.btn.primary:hover { background: linear-gradient(#e08a42, #cf6c25 55%, #b05a1e); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.15rem; margin-top: 10px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; }
.btn.round { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: rgba(29,36,48,.75); color: var(--gold-hi); border-color: var(--gold); box-shadow: none; }
.btn.round[aria-pressed="true"] { background: var(--gold); color: var(--ink); }
.btn.tiny { min-height: 32px; padding: 2px 8px; font-size: .8rem; box-shadow: 0 2px 0 var(--ink); }
.btn.icon-btn { width: 44px; padding: 0; flex: none; }
.ico { display: inline-flex; font-size: 1.15em; line-height: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--ember-ink); text-decoration: underline; cursor: pointer; }
.lbl { display: block; font-weight: 700; margin: 12px 0 4px; }
.field { width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 6px; background: #fbf5e6; box-shadow: inset 0 2px 4px rgba(43,33,24,.15); font-size: 1.05rem; }
.field::placeholder { color: #8a7a68; font-style: italic; }
.field.code { text-transform: uppercase; letter-spacing: .35em; font-weight: 700; text-align: center; font-size: 1.3rem; }
textarea.field { resize: vertical; min-height: 64px; }

/* ---------------------------------------------------------------- landing */
.landing { padding-top: 2vh; min-height: calc(100dvh - 96px); display: flex; flex-direction: column; }
.landing-gap { flex: 1 1 auto; min-height: 26vh; }
.landing .landing-card { padding: 14px 16px 12px; background-color: rgba(239,228,204,.9); }
.more-ways { margin-top: 10px; }
.more-ways summary { cursor: pointer; text-align: center; font-style: italic; color: var(--ink-soft); padding: 8px 0; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.more-ways[open] summary { margin-bottom: 4px; }
.more-ways .join-row + .join-row { margin-top: 12px; }
@media (max-width: 520px) { .landing .pitch { font-size: 1rem; margin-top: 8px; } .landing .hero-title { margin-bottom: 0; } }
.hero-title { text-align: center; margin-bottom: 18px; }
.logo { width: min(92%, 520px); height: auto; margin: 0 auto; padding: 10px 18px; background: rgba(239,228,204,.88); border-radius: var(--r); border: 2px solid var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 0 0 3px var(--parch), inset 0 0 0 4.5px var(--gold); }
.pitch { color: var(--parch); font-size: 1.2rem; font-style: italic; max-width: 30em; margin: 16px auto 0; text-shadow: 0 1px 2px #000, 0 0 18px rgba(0,0,0,.8); }
.landing-card { padding: 18px 18px 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-style: italic; font-size: .9rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--ink-soft); opacity: .5; }
.join-row .row .field { flex: 1; }
.demo-link { text-align: center; color: var(--parch); text-shadow: 0 1px 2px #000; }
.demo-link a { color: var(--gold-hi); font-weight: 700; }
.connecting { text-align: center; padding-top: 22vh; color: var(--parch); text-shadow: 0 1px 3px #000; }
.seal { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; border: 4px solid var(--gold); border-top-color: transparent; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- lobby */
.room-card { text-align: center; }
.code-big { display: flex; justify-content: center; gap: 6px; margin: 10px 0 14px; }
.code-big span { width: 2.1em; height: 2.6em; display: grid; place-items: center; font-size: clamp(1.3rem, 6vw, 2rem); font-weight: 700; background: var(--night); color: var(--gold-hi); border-radius: 6px; border: 2px solid var(--gold); box-shadow: 0 3px 0 var(--ink); }
.players { list-style: none; padding: 0; margin: 0 0 6px; }
.player { display: grid; grid-template-columns: 12px 40px 1fr; grid-template-areas: "dot pt name" "dot pt status"; column-gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed rgba(43,33,24,.3); }
.player:last-child { border-bottom: 0; }
.player.away { opacity: .6; }
.player .dot { grid-area: dot; }
.player .pt { grid-area: pt; }
.pl-name { grid-area: name; font-weight: 700; }
.pl-status { grid-area: status; font-size: .9rem; color: var(--ink-soft); font-style: italic; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #8d8478; border: 2px solid var(--ink); }
.dot.on { background: #6fae5b; box-shadow: 0 0 6px #8fd07a; }
.tag { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: 1px 6px; border-radius: 999px; background: var(--parch-2); border: 1px solid var(--ink-soft); vertical-align: middle; font-weight: 700; }
.tag.host { background: var(--gold); color: var(--ink); border-color: var(--ink); }
.pt { display: inline-block; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; border: 2px solid var(--ink); background: var(--gold); box-shadow: 0 0 0 2px var(--gold); flex: none; }
.pt img { width: 100%; height: 133%; object-fit: cover; object-position: 50% 18%; }
.pt.mini { width: 40px; height: 40px; }
.pt.tiny { width: 30px; height: 30px; box-shadow: 0 0 0 1.5px var(--gold); }
.pt.empty { display: grid; place-items: center; font-weight: 700; background: var(--parch-2); color: var(--ink-soft); }
.ready-card { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: center; }
.forge h2 { margin: 18px 0 8px; font-size: 1.5rem; }
.carousel { position: relative; display: flex; align-items: center; gap: 6px; margin: 0 -16px; }
.carousel > .btn { display: none; }
@media (min-width: 620px) { .carousel { margin: 0; } .carousel > .btn { display: inline-flex; } }
.arch-track { position: relative; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px 11vw 18px; scrollbar-width: none; flex: 1; overscroll-behavior-x: contain; }
@media (min-width: 620px) { .arch-track { padding: 8px 60px 18px; } }
.arch-track::-webkit-scrollbar { display: none; }
.arch-card { scroll-snap-align: center; flex: 0 0 min(78vw, 300px); text-align: left; cursor: pointer; padding: 12px; color: var(--ink);
  background-color: var(--parch); background-image: var(--grain), var(--wash); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: 0 8px 22px rgba(0,0,0,.35); transition: transform .25s, box-shadow .25s; transform: scale(.94); opacity: .88; }
.arch-card.sel { transform: scale(1); opacity: 1; box-shadow: 0 0 0 3px var(--gold-hi), 0 10px 30px rgba(0,0,0,.5); }
.arch-card .portrait { margin-bottom: 10px; }
.arch-card h3 { font-size: 1.45rem; margin: 0; }
.role { color: var(--ember-ink); font-style: italic; margin: 0 0 6px; }
.blurb { font-size: .95rem; }
.stats { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 3px; }
.stats li { display: grid; grid-template-columns: 22px 64px 1fr; align-items: center; font-size: .9rem; }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; transform: rotate(45deg); border-radius: 2px; }
.pip.on { background: var(--ember); box-shadow: inset 0 0 0 2px var(--gold-hi); }
.hp-line { font-size: .9rem; color: var(--moss-ink); margin: 0; }
.dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(239,228,204,.4); }
.dots i.on { background: var(--gold-hi); }
.traits { display: grid; gap: 8px; }
@media (min-width: 520px) { .traits { grid-template-columns: 1fr 1fr; } }
.trait { text-align: left; display: grid; gap: 1px; padding: 8px 10px; border: 2px solid rgba(43,33,24,.5); border-radius: 8px; background: #f7efdc; cursor: pointer; min-height: 44px; }
.trait[aria-checked="true"] { border-color: var(--ink); background: #fff3d6; box-shadow: inset 0 0 0 2px var(--gold), 0 2px 0 var(--ink); }
.tr-name { font-weight: 700; }
.tr-adv { font-size: .8rem; color: var(--moss-ink); display: flex; align-items: center; gap: 3px; }
.tr-blurb { font-size: .85rem; color: var(--ink-soft); font-style: italic; }
.row.wrap .field { flex: 1 1 200px; }
.selfie-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview { display: grid; grid-template-columns: 74px 1fr; gap: 12px; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px dashed rgba(43,33,24,.35); }
.pv-name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.start-slot { margin-top: 8px; }

/* ---------------------------------------------------------------- scene */
.scene-screen { padding-top: 26vh; }
@media (min-width: 900px) { .scene-screen { padding-top: 6vh; } }
.scene-title { color: var(--parch); font-size: clamp(1.9rem, 7vw, 2.6rem); text-shadow: 0 2px 3px #000, 0 0 24px rgba(0,0,0,.7); margin-bottom: 12px; }
.watch-banner { display: flex; align-items: center; gap: 6px; background: rgba(29,36,48,.85); color: var(--gold-hi); border: 1px solid var(--gold); border-radius: 999px; padding: 6px 14px; width: fit-content; }
.spotlight { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; margin: 0 0 12px; padding: 6px 16px 6px 6px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(227,195,119,.95), rgba(184,145,58,.92)); border: 2px solid var(--ink); box-shadow: 0 0 24px rgba(227,195,119,.6), 0 4px 0 var(--ink); }
.spotlight .pt { width: 46px; height: 46px; box-shadow: 0 0 0 2px var(--parch); }
.spotlight > span:last-child { display: grid; line-height: 1.15; }
.sp-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; }
.spotlight b { font-size: 1.1rem; }
.spotlight.arrive { animation: arrive .8s cubic-bezier(.2,1.4,.4,1); }
@keyframes arrive { from { transform: translateX(-30px) scale(.9); opacity: 0; } }
.enemy { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; padding: 10px; margin-bottom: 14px; background-color: #2a2420; background-image: var(--grain); color: var(--parch); border-color: #120c08; box-shadow: inset 0 0 0 3px #2a2420, inset 0 0 0 4.5px var(--ember), 0 10px 28px rgba(0,0,0,.5); }
.enemy-art { aspect-ratio: 1; }
.enemy-name { font-size: 1.35rem; color: var(--gold-hi); margin-bottom: 6px; }
.enemy-hp { margin: 4px 0 0; color: #e8d6b6; }
.crack { position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity .4s; background:
  linear-gradient(118deg, transparent 47%, rgba(255,190,90,.9) 48%, transparent 50%), linear-gradient(62deg, transparent 58%, rgba(255,160,60,.8) 59%, transparent 60.5%), linear-gradient(160deg, transparent 30%, rgba(255,190,90,.7) 31%, transparent 32%); }
.enemy.cracked .crack { opacity: .9; }
.enemy.broken .enemy-art img { filter: grayscale(1) brightness(.6); }
.enemy.hit { animation: hitflash .65s ease; }
@keyframes hitflash { 0% { filter: brightness(2.2) saturate(1.5); transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { filter: brightness(1.2); transform: translateX(-2px); } 100% { filter: none; transform: none; } }
.hpbar { display: block; height: 10px; border-radius: 999px; background: rgba(43,33,24,.55); border: 1.5px solid var(--ink); overflow: hidden; }
.hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(#9cc47e, #5e8a4c); transition: width .6s ease; }
.hpbar[data-level="mid"] i { background: linear-gradient(#f0c56a, #c49030); }
.hpbar[data-level="low"] i { background: linear-gradient(#ee8a5a, #b8441a); }
.hpbar.big { height: 16px; border-color: #000; }
.hpbar.big i { background: linear-gradient(#ffb15a, var(--ember) 60%, #8f3f0c); }

.narration { position: relative; padding: 20px 18px 18px; margin-bottom: 16px; font-size: 1.16rem; line-height: 1.62; cursor: pointer; }
.narration.waiting .narr-text::before { content: "The narrator gathers breath..."; font-style: italic; color: var(--ink-soft); }
.narration.waiting .narr-text::first-letter { float: none; font-size: inherit; color: inherit; text-shadow: none; padding: 0; font-weight: 400; }
.narr-text { margin: 0; white-space: pre-line; min-height: 3em; }
.narr-text::first-letter { float: left; font-size: 3.4em; line-height: .82; padding: 6px 8px 0 0; color: var(--ember-ink); font-weight: 700; text-shadow: 2px 2px 0 var(--gold-hi); }
.caret { display: inline-block; width: .5em; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--ember); opacity: .7; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.skip-hint { position: absolute; right: 12px; bottom: 6px; font-size: .75rem; font-style: italic; color: var(--ink-soft); opacity: 0; transition: opacity .3s; }
.narration.typing .skip-hint { opacity: 1; }
.speaker-lines:empty { display: none; }
.quote { margin: 14px 0 0; padding: 10px 14px 10px 18px; border-left: 4px solid var(--ember); background: rgba(184,145,58,.14); border-radius: 0 8px 8px 0; animation: rise .5s ease both; }
.quote p { margin: 0 0 4px; font-style: italic; font-size: 1.12rem; }
.quote cite { font-style: normal; font-size: .9rem; font-weight: 700; color: var(--ember-ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 1.3rem; }
.choices { display: grid; gap: 10px; }
@media (min-width: 560px) { .choices { grid-template-columns: 1fr 1fr; } }
.choice { display: grid; grid-template-columns: 42px 1fr; grid-template-areas: "ic label" "ic meta"; column-gap: 10px; align-items: center; text-align: left; cursor: pointer;
  padding: 10px 12px; min-height: 64px; border: 2px solid var(--ink); border-radius: var(--r); background: #fbf3e0; box-shadow: 0 3px 0 var(--ink); transition: transform .1s, background .2s; }
.choice:hover { background: #fff7e6; }
.choice:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.choice:disabled { cursor: default; opacity: .6; }
.choice.picked { opacity: 1; background: #fff0c8; box-shadow: 0 0 0 3px var(--gold), 0 3px 0 var(--ink); }
.stat-badge { grid-area: ic; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; color: #fff8ea; border: 2px solid var(--ink); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.s-might { background: #a8431a; } .s-wits { background: #3c5a7a; } .s-grace { background: var(--moss); } .s-heart { background: #a2335a; }
.c-label { grid-area: label; font-weight: 700; line-height: 1.25; }
.c-meta { grid-area: meta; font-size: .8rem; text-transform: capitalize; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.c-meta .pips { margin-left: 4px; gap: 3px; }
.dd { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--ink-soft); }
.dd.on { background: var(--ink); border-color: var(--ink); }
.own-act { margin-top: 14px; }
.act-note { display: none; margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: rgba(79,107,74,.14); border: 1px dashed var(--moss); font-style: italic; color: var(--moss-ink); }
.act-note.show { display: block; animation: rise .4s ease both; }
.who-slot { margin-top: 12px; }
.who { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0; flex-wrap: wrap; }
.who li { position: relative; opacity: .45; filter: grayscale(.8); transition: opacity .3s, filter .3s; }
.who li.done { opacity: 1; filter: none; }
.who-tick { position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: var(--moss); color: #fff; display: grid; place-items: center; font-size: 11px; border: 1.5px solid var(--parch); }
.onward-panel .onward { font-size: 1.3rem; }
.vote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote-card { display: grid; gap: 6px; text-align: left; padding: 8px; cursor: pointer; border: 2px solid var(--ink); border-radius: var(--r); background: #fbf3e0; box-shadow: 0 3px 0 var(--ink); }
.vote-card.mine { background: #fff0c8; box-shadow: 0 0 0 3px var(--ember), 0 3px 0 var(--ink); }
.vote-art { aspect-ratio: 16 / 10; }
.v-label { font-weight: 700; line-height: 1.25; }
.v-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .85rem; color: var(--ink-soft); min-height: 30px; }
.voters { display: flex; }
.voters .pt { margin-left: -8px; }
.chronicle { padding: 8px 14px; margin-bottom: 16px; }
.chronicle summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 6px; min-height: 44px; }
.chron { margin: 6px 0 4px; padding-left: 20px; font-size: .92rem; color: var(--ink-soft); max-height: 240px; overflow: auto; }

/* countdown ring */
.ring { position: relative; width: 46px; height: 46px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.r-bg { stroke: rgba(43,33,24,.18); }
.r-fg { stroke: var(--gold); stroke-dasharray: 100; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.r-num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: .9rem; }
.ring.urgent .r-fg { stroke: var(--ember); }
.ring.urgent .r-num { color: var(--ember-ink); }

/* ---------------------------------------------------------------- party bar */
#party-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 8px max(8px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: linear-gradient(rgba(29,36,48,.92), var(--night)); border-top: 2px solid var(--gold); box-shadow: 0 -6px 20px rgba(0,0,0,.4); }
.party-list { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-width: 640px; }
.chip { position: relative; display: grid; justify-items: center; gap: 3px; padding: 4px 2px 6px; border-radius: 10px; color: var(--parch); transition: background .3s, opacity .3s; }
.chip-pt { width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid var(--gold); background: var(--gold); transition: box-shadow .3s; }
.chip-pt img { width: 100%; height: 133%; object-fit: cover; object-position: 50% 18%; }
.chip-body { display: grid; gap: 2px; width: 100%; justify-items: center; }
.chip-name { font-size: .74rem; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.chip .hpbar { width: 86%; height: 6px; border-color: #000; }
.chip-hp { font-size: .68rem; color: #d9cbb0; line-height: 1; }
.chip.me .chip-name { color: var(--gold-hi); }
.chip.spot { background: rgba(227,195,119,.16); }
.chip.spot .chip-pt { box-shadow: 0 0 0 2px var(--parch), 0 0 16px 4px rgba(227,195,119,.85); animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px var(--parch), 0 0 26px 8px rgba(227,195,119,.6); } }
.chip.down { opacity: .55; }
.chip.down .chip-pt img { filter: grayscale(1) brightness(.6); }
.chip.down .chip-hp { color: #f0a080; font-weight: 700; }
.chip.away .chip-pt { border-style: dashed; opacity: .6; }
.chip-tick { position: absolute; top: 2px; right: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--moss); color: #fff; display: none; place-items: center; font-size: 12px; border: 1.5px solid var(--parch); }
.chip.chosen .chip-tick { display: grid; }
.chip.hurt { animation: hurt .5s ease; }
@keyframes hurt { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); background: rgba(200,60,30,.45); } 60% { transform: translateX(3px); } }
.chip.healed { animation: healed .7s ease; }
@keyframes healed { 30% { background: rgba(120,190,100,.4); transform: translateY(-3px); } }
.chip.spot-pulse .chip-pt { animation: spotpulse 1.5s ease; }
@keyframes spotpulse { 30% { transform: scale(1.18); } }

/* ---------------------------------------------------------------- floaters, shake */
.floater { position: fixed; z-index: 60; transform: translate(-50%, 0); pointer-events: none; font-weight: 800; font-size: 1.6rem; color: #ff9a6a; text-shadow: 0 2px 0 #2b2118, 0 0 8px #000; animation: floatup 1.35s ease-out forwards; }
.floater.heal { color: #a9e88d; }
.floater.big { font-size: 2.4rem; color: #ffd27a; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.shake { animation: shake .4s ease; }
.shake-big { animation: shake-big .55s ease; }
@keyframes shake { 20% { transform: translate(-3px, 1px); } 40% { transform: translate(3px, -1px); } 60% { transform: translate(-2px, 1px); } 80% { transform: translate(2px, 0); } }
@keyframes shake-big { 10% { transform: translate(-8px, 3px) rotate(-.4deg); } 30% { transform: translate(7px, -4px) rotate(.4deg); } 50% { transform: translate(-5px, 2px); } 70% { transform: translate(4px, -1px); } 90% { transform: translate(-2px, 0); } }

/* ---------------------------------------------------------------- roll overlay */
#roll-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at center, rgba(29,36,48,.78), rgba(10,8,6,.92)); cursor: pointer; animation: fadein .2s ease; }
#roll-overlay[hidden] { display: none; }
#roll-overlay.leaving { animation: fadeout .26s ease forwards; }
@keyframes fadein { from { opacity: 0; } }
@keyframes fadeout { to { opacity: 0; } }
.roll-card { display: grid; justify-items: center; gap: 14px; width: min(100%, 420px); }
.die { width: 150px; height: 150px; filter: drop-shadow(0 12px 18px rgba(0,0,0,.6)); }
.die svg { width: 100%; height: 100%; overflow: visible; }
.d-out { fill: var(--parch); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.d-in { fill: #fff7e4; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.d-edge { stroke: var(--ink); stroke-width: 2; fill: none; opacity: .75; }
.d-num { font-family: var(--serif); font-weight: 800; font-size: 25px; fill: var(--ink); }
.die.tumbling { animation: tumble .72s cubic-bezier(.3,.6,.4,1) both; }
@keyframes tumble {
  0% { transform: translate(-120px, -260px) rotate(-200deg) scale(.5); }
  45% { transform: translate(30px, 10px) rotate(160deg) scale(1.05); }
  62% { transform: translate(-10px, -40px) rotate(250deg) scale(.95); }
  80% { transform: translate(6px, 0) rotate(330deg) scale(1.02); }
  100% { transform: translate(0, 0) rotate(360deg) scale(1); } }
.die.landed { animation: land .35s ease-out; }
@keyframes land { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.die.o-critical .d-out { fill: var(--gold-hi); } .die.o-critical { filter: drop-shadow(0 0 24px rgba(255,210,120,.95)); }
.die.o-fumble .d-out { fill: #c9a090; } .die.o-fumble { filter: drop-shadow(0 0 20px rgba(200,60,30,.9)); }
.roll-banner { width: 100%; text-align: center; padding: 12px 14px; border-radius: var(--r); background: var(--parch); background-image: var(--grain); border: 2px solid var(--ink); box-shadow: inset 0 0 0 3px var(--parch), inset 0 0 0 4.5px var(--gold), 0 12px 30px rgba(0,0,0,.5); opacity: 0; transform: translateY(14px) scale(.96); transition: opacity .25s, transform .3s cubic-bezier(.2,1.4,.4,1); }
.roll-banner.show { opacity: 1; transform: none; }
.rb-outcome { font-size: 2rem; font-weight: 800; letter-spacing: .04em; line-height: 1.1; }
.o-critical .rb-outcome { color: #8a6200; text-shadow: 0 0 14px rgba(227,195,119,.9); }
.o-success .rb-outcome { color: var(--moss-ink); }
.o-partial .rb-outcome { color: #7a5a10; }
.o-fail .rb-outcome { color: var(--ink-soft); }
.o-fumble .rb-outcome { color: #9b2a10; }
.rb-who { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 6px 0 4px; font-weight: 700; }
.rb-who img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--ink); }
.rb-stat { font-weight: 400; font-style: italic; color: var(--ink-soft); }
.rb-math { font-size: 1rem; color: var(--ink-soft); }
.rb-math b { color: var(--ink); font-size: 1.2rem; }
.rb-dice s { text-decoration: line-through; opacity: .6; margin-right: 3px; }
.rb-dice s.kept { text-decoration: none; opacity: 1; font-weight: 700; }

/* ---------------------------------------------------------------- ending / saga card */
.ending { padding-top: 10px; }
.saga-card { overflow: hidden; margin-bottom: 16px; background-color: var(--parch); background-image: var(--grain), var(--wash); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: inset 0 0 0 3px var(--parch), inset 0 0 0 4.5px var(--gold), 0 14px 40px rgba(0,0,0,.55); animation: rise .7s ease both; }
.saga-art { position: relative; aspect-ratio: 16 / 9; border-bottom: 3px solid var(--ink); }
.saga-art img { width: 100%; height: 100%; object-fit: cover; }
.saga-art::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); mix-blend-mode: multiply; opacity: .5; box-shadow: inset 0 0 40px rgba(43,33,24,.5); }
.ribbon { position: absolute; z-index: 1; left: 50%; bottom: -18px; transform: translateX(-50%); padding: 6px 28px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: #fff8ea; background: var(--ember); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); }
.defeat .ribbon { background: var(--night-2); color: var(--gold-hi); }
.saga-body { padding: 30px 18px 18px; text-align: center; }
.saga-body h1 { font-size: clamp(1.8rem, 7vw, 2.4rem); }
.saga-text { font-size: 1.08rem; font-style: italic; }
.saga-heroes { list-style: none; padding: 0; margin: 16px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.saga-heroes li { display: grid; justify-items: center; width: 92px; text-align: center; line-height: 1.2; }
.saga-heroes .portrait.tiny { width: 70px; margin-bottom: 4px; }
.saga-heroes li.fallen img { filter: grayscale(1); }
.saga-heroes b { font-size: .88rem; }
.deeds { text-align: left; margin-top: 10px; border-top: 1px dashed rgba(43,33,24,.4); padding-top: 12px; }
.deeds h2 { font-size: 1.15rem; text-align: center; }
.deeds ul { list-style: none; padding: 0; margin: 0; }
.deeds li { padding-left: 24px; position: relative; margin-bottom: 6px; }
.deeds li::before { content: "✦"; position: absolute; left: 2px; color: var(--ember); }
.seed { color: var(--ink-soft); margin: 12px 0 0; letter-spacing: .05em; }
.saga-actions { display: grid; gap: 12px; margin-bottom: 30px; }

/* ---------------------------------------------------------------- toasts, pill, demo, modal */
#toasts { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--party-h) + 20px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
body:not([data-screen="scene"]) #toasts { bottom: calc(20px + env(safe-area-inset-bottom)); }
.toast { padding: 10px 14px; border-radius: 10px; background: rgba(29,36,48,.95); color: var(--parch); border: 1px solid var(--gold); box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: rise .3s ease both; transition: opacity .4s; font-size: .98rem; }
.toast.ok { border-color: #8fd07a; } .toast.warn { border-color: var(--gold-hi); } .toast.danger { border-color: var(--ember); background: rgba(70,24,10,.95); }
.toast.out { opacity: 0; }
#conn-pill { position: fixed; z-index: 80; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--parch); border: 2px solid var(--ink); font-weight: 700; font-size: .9rem; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
#conn-pill[hidden] { display: none; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--ember); border-top-color: transparent; animation: spin .8s linear infinite; }
.demo-bar { position: fixed; z-index: 90; top: calc(62px + env(safe-area-inset-top)); right: 8px; background: rgba(29,36,48,.92); color: var(--parch); border: 1px solid var(--gold); border-radius: 10px; padding: 4px 8px; font-size: .85rem; max-width: 220px; }
.demo-bar summary { cursor: pointer; font-weight: 700; color: var(--gold-hi); }
.demo-btns { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 0 2px; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(10,8,6,.7); }
.modal-card h2 { padding-right: 36px; }
.modal-card { position: relative; width: min(100%, 460px); max-height: 92vh; overflow: auto; padding: 20px 18px; }
.sf-x { position: absolute; top: 4px; right: 4px; width: 44px; font-size: 1.6rem; text-decoration: none; }
.sf-list { padding-left: 20px; }
.sf-check { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; margin: 12px 0; }
.sf-check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--ember); }
.sf-body .row { justify-content: flex-end; flex-wrap: wrap; margin-top: 12px; }
.sf-frame { border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; background: #000; max-height: 56vh; margin: 0 auto; }
.sf-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.sf-result img { width: 70%; margin: 0 auto; aspect-ratio: 3 / 4; object-fit: cover; border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 0 0 4px var(--gold); }
.painting { text-align: center; padding: 20px 0; }
.brush { width: 110px; height: 140px; margin: 0 auto 14px; border-radius: 8px; border: 3px solid var(--ink); background: linear-gradient(120deg, var(--gold-hi), var(--ember), var(--moss), var(--night-2), var(--gold-hi)); background-size: 400% 400%; animation: paint 3s ease-in-out infinite; box-shadow: 0 0 0 4px var(--gold); }
@keyframes paint { 50% { background-position: 100% 100%; } }

/* ---------------------------------------------------------------- reduced motion */
html.still *, html.still *::before, html.still *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
html.still .stage-layer img { animation: none; transform: scale(1.06); }
html.still .stage-layer { transform: none; }
@media (prefers-reduced-motion: reduce) { .stage-layer img { animation: none; } }
@media (forced-colors: active) { .btn, .choice, .parchment { border: 2px solid CanvasText; } }

/* ---------------------------------------------------------------- install tip */
.install-tip { position: fixed; z-index: 85; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 12px; animation: rise .4s ease both; }
.install-tip img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-tip p { margin: 0; flex: 1; font-size: .95rem; line-height: 1.35; }
.install-tip .btn.primary { min-height: 44px; padding: 6px 14px; }
.tip-x { width: 44px; font-size: 1.5rem; text-decoration: none; flex: none; }
#conn-pill[data-offline] { background: var(--night); color: var(--gold-hi); border-color: var(--gold); }

/* own result in narration */
mark.mine { background: linear-gradient(transparent 55%, rgba(227,195,119,.6) 55%); color: inherit; font-weight: 700; padding: 0 1px; border-radius: 2px; }
.closed-screen { padding-top: 14vh; }
.closed-screen .panel { display: grid; gap: 10px; }

/* ---------------------------------------------------------------- world picker */
body[data-screen="worlds"] .topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; }
body[data-screen="worlds"] .brand { visibility: hidden; }
body[data-screen="worlds"] #shell { padding-bottom: 0; }
body[data-screen="worlds"] main { max-width: none; padding: 0; }
.world-picker { position: fixed; inset: 0; z-index: 20; overflow: hidden; background: #000; touch-action: pan-y; user-select: none; -webkit-user-select: none; outline: none; --accent: var(--ember); }
.wp-track { position: absolute; inset: 0; display: flex; will-change: transform; }
.wp-slide { position: relative; flex: 0 0 100%; height: 100%; overflow: hidden; }
.wp-art { position: absolute; inset: 0; }
.wp-layer { position: absolute; inset: -6% -14%; will-change: transform; }
.wp-layer img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.wp-slide.active .wp-layer.l0 img { animation: kenburns 26s ease-in-out infinite alternate; }
.wp-slide.active .wp-layer.l1 img { animation: kenburns2 30s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.16) translate(-2.5%, -2%); } }
@keyframes kenburns2 { from { transform: scale(1.0); } to { transform: scale(1.07) translate(1.5%, -1%); } }
.wp-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 45%, rgba(0,0,0,.78) 78%, rgba(0,0,0,.9) 100%); box-shadow: inset 0 0 0 6px rgba(0,0,0,.6), inset 0 0 0 8px color-mix(in srgb, var(--accent) 70%, transparent); }
.wp-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.wp-copy { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; padding: 0 max(22px, env(safe-area-inset-left)) calc(64px + env(safe-area-inset-bottom)); color: #fff8ea; text-shadow: 0 2px 8px rgba(0,0,0,.85); max-width: 640px; }
@media (min-width: 900px) { .wp-copy { left: 6vw; bottom: 6vh; } }
.wp-genre { display: inline-block; margin: 0 0 8px; padding: 3px 12px; border-radius: 999px; font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; background: var(--accent); color: #fff; text-shadow: none; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.wp-title { font-size: clamp(2.6rem, 12vw, 4.6rem); line-height: .95; margin: 0 0 4px; letter-spacing: .01em; }
.wp-world { font-style: italic; font-size: 1.1rem; margin: 0 0 8px; color: #f3e6c8; }
.wp-pitch { font-size: 1.12rem; line-height: 1.45; margin: 0 0 14px; max-width: 32em; }
.wp-swatches { display: flex; gap: 6px; margin-bottom: 14px; }
.wp-swatches i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); }
.wp-enter { background: var(--accent); border-color: rgba(0,0,0,.6); box-shadow: 0 3px 0 rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.25); max-width: 420px; }
.wp-enter:hover { filter: brightness(1.08); background: var(--accent); }
.wp-slide:not(.active) .wp-copy { opacity: 0; transform: translateY(16px); }
.wp-slide .wp-copy { transition: opacity .5s ease .1s, transform .5s ease .1s; }
.wp-arrow { position: absolute; z-index: 5; top: 50%; transform: translateY(-50%); display: none; }
.wp-arrow.prev { left: max(12px, env(safe-area-inset-left)); } .wp-arrow.next { right: max(12px, env(safe-area-inset-right)); }
@media (min-width: 700px) { .wp-arrow { display: inline-flex; } }
.wp-back { position: absolute; z-index: 31; top: calc(10px + env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.wp-dots { position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 2px; }
.wp-dot { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; }
.wp-dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,.45); transition: width .3s, background .3s; }
.wp-dot[aria-selected="true"]::before { width: 26px; border-radius: 6px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.world-picker.fade-mode .wp-track { display: block; }
.world-picker.fade-mode .wp-slide { position: absolute; inset: 0; transition: opacity .6s ease; }

/* ---------------------------------------------------------------- cinematic */
.cinematic { position: fixed; inset: 0; z-index: 200; background: #000; overflow: hidden; cursor: pointer; }
.cine-art { position: absolute; inset: 0; animation: cine-zoom 2.9s cubic-bezier(.5,0,.2,1) forwards; }
.cine-art .wp-art { position: absolute; inset: 0; }
@keyframes cine-zoom { from { transform: scale(1); filter: brightness(1); } to { transform: scale(1.55); filter: brightness(.55); } }
.cinematic .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 2; animation: bars .7s ease-out .1s forwards; }
.cinematic .bar.top { top: 0; } .cinematic .bar.bottom { bottom: 0; }
@keyframes bars { to { height: 13vh; } }
.cine-title { position: absolute; z-index: 3; inset: 0; display: grid; place-content: center; text-align: center; color: #fff8ea; text-shadow: 0 2px 12px #000; opacity: 0; animation: cine-title 2.2s ease .6s forwards; padding: 0 20px; }
.cine-title h2 { font-size: clamp(2.4rem, 11vw, 4.4rem); margin: 0; letter-spacing: .02em; }
.cine-genre { letter-spacing: .3em; text-transform: uppercase; font-size: .85rem; color: var(--gold-hi); margin: 0 0 8px; }
.cine-chapter { font-style: italic; font-size: 1.3rem; margin: 10px 0 0; color: #f3e6c8; }
.cine-chapter::before, .cine-chapter::after { content: "\2014"; margin: 0 10px; color: var(--ember); }
@keyframes cine-title { 0% { opacity: 0; transform: scale(.96); letter-spacing: .3em; } 30% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 1; transform: scale(1); letter-spacing: .02em; } }
.cine-fade { position: absolute; inset: 0; z-index: 4; background: #000; opacity: 0; pointer-events: none; }
.cinematic.out { animation: fadeout .45s ease forwards; }
.cinematic.still .cine-art, .cinematic.still .bar { animation: none; }
.cinematic.still .bar { height: 13vh; }
.cinematic.still .cine-title { animation: none; opacity: 1; }

/* ---------------------------------------------------------------- mic */
.btn.mic.listening { background: var(--ember); color: #fff; border-color: #4a230b; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ember) 35%, transparent), 0 3px 0 var(--ink); } }
.act-note .btn.tiny { margin-left: 6px; min-height: 36px; }

/* Locked worlds: shown as a teaser, not playable yet */
.wp-slide.wp-locked .wp-layer { filter: grayscale(.55) brightness(.72); }
.wp-slide.wp-locked .wp-copy::before { content: 'Coming soon'; display: inline-block; margin-bottom: .5rem; padding: .2rem .7rem; border: 1px solid currentColor; border-radius: 999px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.wp-enter.wp-soon { opacity: .7; cursor: not-allowed; }

/* ---------- World memory: saga code + Journal ---------- */
.saga-code { margin-top: 1rem; text-align: center; }
.saga-code-text { font-size: 1.35rem; letter-spacing: .12em; padding: .3rem .7rem; border: 1px dashed currentColor; border-radius: 8px; }
.continue-saga { margin-top: .25rem; }
.journal-btn { position: fixed; right: max(12px, env(safe-area-inset-right)); top: calc(64px + env(safe-area-inset-top)); z-index: 40; box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.journal-btn.pulse { animation: jr-pulse 1.2s ease-in-out 2; }
@keyframes jr-pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(200,100,30,.35); } }
dialog.journal { width: min(520px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; border: 0; border-radius: 14px; padding: 1rem 1.1rem; }
dialog.journal::backdrop { background: rgba(10,8,6,.55); backdrop-filter: blur(2px); }
.journal .recap { font-style: italic; }
.journal ul { list-style: none; padding: 0; margin: .4rem 0 1rem; display: grid; gap: .55rem; }
.journal .npc { padding: .6rem .7rem; border-radius: 10px; border: 1px solid rgba(43,33,24,.18); }
.journal .npc .badge { font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; border: 1px solid currentColor; }
.journal .remembers { margin: .3rem 0 0; font-style: italic; }
.journal .mood-friendly .badge, .journal .mood-devoted .badge { color: #3f7a3a; }
.journal .mood-wary .badge { color: #a46a12; }
.journal .mood-hostile .badge { color: #a3341f; }
.journal .objectives li.done { opacity: .6; text-decoration: line-through; }
@media (prefers-reduced-motion: reduce) { .journal-btn.pulse { animation: none; } }

/* =====================================================================
   Cinematic play screen ("the new look"): the world fills the screen,
   the narrator speaks in subtitles, characters speak in dialogue cards.
   ===================================================================== */
body[data-screen="scene"] #stage .stage-paper { opacity: .18; box-shadow: none; }
body[data-screen="scene"] #stage .stage-shade {
  background:
    radial-gradient(120% 85% at 50% 35%, rgba(0,0,0,0) 40%, rgba(5,4,3,.55) 100%),
    linear-gradient(180deg, rgba(8,7,6,.35) 0%, rgba(8,7,6,0) 22%, rgba(8,7,6,0) 52%, rgba(8,7,6,.82) 100%);
}
body[data-screen="scene"] #stage .stage-layer img { filter: saturate(1.08) contrast(1.06); animation-duration: 34s; }
/* letterbox bars while the narrator speaks */
body::before, body::after { content: ''; position: fixed; left: 0; right: 0; height: 0; background: #050403; z-index: 30; transition: height .7s cubic-bezier(.2,.7,.2,1); pointer-events: none; }
body::before { top: 0; } body::after { bottom: 0; }
body.letterbox[data-screen="scene"]::before, body.letterbox[data-screen="scene"]::after { height: 6vh; }

.scene-screen.film { padding-top: 34vh; color: #f3ead8; }
.film .kicker { color: rgba(243,234,216,.75); letter-spacing: .14em; text-transform: uppercase; font-size: .72rem; }
.film .scene-title { color: #fff6e2; font-size: clamp(1.7rem, 6vw, 2.6rem); text-shadow: 0 2px 18px rgba(0,0,0,.75); margin: .1rem 0 .8rem; animation: title-in 1.2s ease both; }
@keyframes title-in { from { opacity: 0; letter-spacing: .12em; filter: blur(4px); } to { opacity: 1; letter-spacing: normal; filter: none; } }

/* glass surfaces replace parchment on the play screen */
.film .subtitle, .film .action-panel .parchment, .film .enemy.parchment, .film .chronicle.parchment {
  background: rgba(14,12,10,.58); color: #f3ead8; border: 1px solid rgba(255,236,200,.14);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); border-radius: 16px;
}
.film .muted, .film .c-meta, .film .small { color: rgba(243,234,216,.72); }
.film .subtitle .narr-text { font-size: 1.08rem; line-height: 1.6; text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: pre-line; }
.film .subtitle mark.mine { background: rgba(200,100,30,.32); color: #fff; border-radius: 4px; padding: 0 .15em; }

/* dialogue cards */
.film .speaker-lines { display: grid; gap: .6rem; margin: 0 0 .8rem; }
.dialogue-card { display: flex; gap: .7rem; align-items: flex-start; margin: 0; padding: .65rem .8rem; border-radius: 14px;
  background: rgba(20,16,12,.72); border: 1px solid rgba(255,236,200,.16); box-shadow: 0 8px 24px rgba(0,0,0,.45);
  animation: card-in .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 280ms); }
.dialogue-card.foe { border-color: rgba(200,70,30,.55); background: rgba(40,12,8,.72); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.dc-face { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(184,145,58,.8); background: #2b2118; display: grid; place-items: center; }
.dc-face img { width: 100%; height: 100%; object-fit: cover; }
.dc-face.mono { font-weight: 700; font-size: 1.2rem; color: #f3d9a6; }
.dialogue-card figcaption { display: grid; gap: .15rem; }
.dc-name { font-weight: 700; color: #fff1d6; }
.dc-badge { justify-self: start; font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; padding: .05rem .45rem; border-radius: 999px; border: 1px solid currentColor; }
.dc-badge.mood-friendly, .dc-badge.mood-devoted { color: #9fd38f; }
.dc-badge.mood-neutral { color: #d8cdb5; }
.dc-badge.mood-wary { color: #f0b65a; }
.dc-badge.mood-hostile { color: #ff8a6a; }
.dc-text { font-style: italic; color: #f3ead8; quotes: '\201C' '\201D'; }

/* HUD: current objective + pack */
.film .hud { position: fixed; top: calc(58px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: 110px; z-index: 35; display: flex; gap: .4rem; flex-wrap: wrap; pointer-events: none; }
.hud-pill { pointer-events: auto; display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .3rem .65rem; border-radius: 999px; font-size: .78rem;
  color: #f3ead8; background: rgba(14,12,10,.6); border: 1px solid rgba(255,236,200,.18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; }
.hud-pill.objective span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }

/* choices on dark glass: voice-first, big tappable rows */
.film .choice { background: rgba(255,246,226,.06); color: #f3ead8; border: 1px solid rgba(255,236,200,.2); }
.film .choice:hover, .film .choice:focus-visible { background: rgba(200,100,30,.22); border-color: rgba(240,170,90,.6); }
.film .own-act .field { background: rgba(0,0,0,.35); color: #fff; border-color: rgba(255,236,200,.25); }
.film .own-act .lbl { color: rgba(243,234,216,.85); }
@media (prefers-reduced-motion: reduce) {
  .dialogue-card, .film .scene-title { animation: none; }
  body::before, body::after { transition: none; }
}
.film .subtitle .narr-text::first-letter { font-size: inherit; float: none; color: inherit; margin: 0; line-height: inherit; padding: 0; font-weight: inherit; text-shadow: inherit; }
.film .subtitle { background-image: none; padding: .9rem 1rem; }
.film .subtitle::before, .film .subtitle::after { display: none; }

/* =====================================================================
   3D d20 roll theatre (dice3d.js) - canvas + CSS outcome flair
   ===================================================================== */
.d3 { position: relative; width: min(100%, 380px); height: 230px; --fx-x: 50%; --fx-y: 55%; cursor: pointer; }
.d3::before { content: ''; position: absolute; left: 6%; right: 6%; bottom: 2%; height: 48%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,226,170,.17), rgba(255,226,170,.05) 60%, rgba(255,226,170,0)); }
.d3-canvas { position: relative; z-index: 1; display: block; width: 100%; height: 100%; }
.d3-rays, .d3-burst, .d3-crack { position: absolute; left: var(--fx-x); top: var(--fx-y); transform: translate(-50%, -50%); pointer-events: none; opacity: 0; }
.d3-rays { z-index: 0; width: 360px; height: 360px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,214,120,.6) 0deg 5deg, rgba(255,214,120,0) 5deg 20deg);
  -webkit-mask: radial-gradient(closest-side, #000 18%, rgba(0,0,0,.5) 55%, transparent 100%); mask: radial-gradient(closest-side, #000 18%, rgba(0,0,0,.5) 55%, transparent 100%); }
.d3-burst { z-index: 2; width: 90px; height: 90px; border-radius: 50%; mix-blend-mode: screen; }
.d3-crack { z-index: 2; width: 130px; height: 130px; }
.d3-crack svg { width: 100%; height: 100%; overflow: visible; }
.d3-crack path { fill: none; stroke: #ff6a40; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(255,60,20,.9)); stroke-dasharray: 300; stroke-dashoffset: 300; }
.d3.landed.o-critical .d3-rays { animation: d3-rays 1.8s ease-out both; }
.d3.landed.o-critical .d3-burst { background: radial-gradient(circle, rgba(255,240,190,.95), rgba(255,190,80,.55) 40%, rgba(255,170,60,0) 70%); animation: d3-burst .7s ease-out both; }
.d3.landed.o-fumble .d3-burst { background: radial-gradient(circle, rgba(255,120,90,.9), rgba(200,30,20,.5) 45%, rgba(160,0,0,0) 70%); animation: d3-burst .5s ease-out both; }
.d3.landed.o-fumble .d3-crack { opacity: 1; }
.d3.landed.o-fumble .d3-crack path { animation: d3-crack .32s ease-out .05s forwards; }
.d3.landed.o-fumble { animation: d3-jolt .35s ease-out; }
.d3.landed.o-success .d3-burst { background: radial-gradient(circle, rgba(170,240,160,0) 50%, rgba(170,240,160,.55) 62%, rgba(170,240,160,0) 72%); animation: d3-ring .6s ease-out both; }
.d3.landed.o-partial .d3-burst { background: radial-gradient(circle, rgba(250,200,110,0) 50%, rgba(250,200,110,.45) 62%, rgba(250,200,110,0) 72%); animation: d3-ring .6s ease-out both; }
/* full-overlay flash for the big moments */
#roll-overlay:not(.leaving):has(.d3.landed.o-critical) { animation: d3-flash-gold .6s ease-out; }
#roll-overlay:not(.leaving):has(.d3.landed.o-fumble) { animation: d3-flash-red .45s ease-out; }
@keyframes d3-rays { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.35) rotate(0deg); } 20% { opacity: 1; } 100% { opacity: .45; transform: translate(-50%, -50%) scale(1.15) rotate(35deg); } }
@keyframes d3-burst { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(4); } }
@keyframes d3-ring { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.6); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
@keyframes d3-crack { to { stroke-dashoffset: 0; } }
@keyframes d3-jolt { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-2px); } }
@keyframes d3-flash-gold { 0% { box-shadow: inset 0 0 0 100vmax rgba(255,214,130,.35); } 100% { box-shadow: inset 0 0 0 100vmax rgba(255,214,130,0); } }
@keyframes d3-flash-red { 0% { box-shadow: inset 0 0 0 100vmax rgba(200,30,20,.4); } 100% { box-shadow: inset 0 0 0 100vmax rgba(200,30,20,0); } }
/* reduced motion / animations off: flat number badge with a short fade (beats the global .001ms rule) */
.die.fade-in { animation: fadein .22s ease both; }
html.still .die.fade-in { animation-duration: .22s !important; }
@media (prefers-reduced-motion: reduce) { .d3-rays, .d3-burst, .d3-crack, .d3.landed.o-fumble { animation: none !important; } #roll-overlay { animation: none !important; } }

/* =====================================================================
   Voice-first controls on the play screen (voice.js voiceComposer)
   ===================================================================== */
.vc { display: grid; justify-items: center; gap: .55rem; margin: .3rem 0 .8rem; }
.vc-bubble { position: relative; width: 100%; min-height: 3.4rem; padding: .75rem 1rem; margin-bottom: .2rem; border-radius: 18px; display: grid; place-items: center;
  background: rgba(255,246,226,.08); border: 1px solid rgba(255,236,200,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px rgba(0,0,0,.3);
  backdrop-filter: blur(8px) saturate(1.2); -webkit-backdrop-filter: blur(8px) saturate(1.2); }
.vc-text { margin: 0; text-align: center; font-size: 1.08rem; line-height: 1.45; color: #fff6e2; overflow-wrap: anywhere; }
.vc-text.placeholder { color: rgba(243,234,216,.62); font-style: italic; font-size: .98rem; }
.vc-mic { position: relative; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 2.3rem; color: #fff8ea;
  border: 2px solid rgba(255,214,150,.6); background: radial-gradient(circle at 35% 30%, #ec9550, #c0601f 55%, #6e2f0c);
  box-shadow: 0 10px 26px rgba(0,0,0,.55), inset 0 2px 0 rgba(255,255,255,.28), 0 0 0 6px rgba(200,100,30,.14);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; transition: transform .15s ease, box-shadow .2s; }
.vc-mic:hover { box-shadow: 0 10px 26px rgba(0,0,0,.55), inset 0 2px 0 rgba(255,255,255,.28), 0 0 0 8px rgba(200,100,30,.22); }
.vc-mic:active, .vc-mic.listening { transform: scale(1.07); }
.vc-mic.listening { background: radial-gradient(circle at 35% 30%, #ffb070, #e0702a 55%, #8a3a0e); }
.vc-mic.listening::before, .vc-mic.listening::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(255,160,80,.65); animation: vc-ring 1.2s ease-out infinite; pointer-events: none; }
.vc-mic.listening::after { animation-delay: .6s; }
@keyframes vc-ring { from { transform: scale(.92); opacity: 1; } to { transform: scale(1.45); opacity: 0; } }
.vc-mic:focus-visible { outline: 3px solid #ffd58a; outline-offset: 5px; box-shadow: 0 10px 26px rgba(0,0,0,.55); }
html.still .vc-mic.listening::before { animation: none !important; opacity: 1; } html.still .vc-mic.listening::after { display: none; }
@media (prefers-reduced-motion: reduce) { .vc-mic.listening::before { animation: none; opacity: 1; } .vc-mic.listening::after { display: none; } }
.vc-label { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(243,234,216,.82); }
.vc-pair { display: flex; gap: .6rem; width: 100%; margin-top: .2rem; }
.vc-pair .btn { flex: 1; min-height: 48px; }
.film .vc-redo { background: rgba(255,246,226,.08); color: #f3ead8; border-color: rgba(255,236,200,.3); box-shadow: none; }
.quick-label { margin: .2rem 0 .5rem; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(243,234,216,.7); }
.type-row { margin-top: .6rem; }
.type-instead { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; padding: 0 .3rem; font-size: .95rem; }
.film .type-instead { color: #f3d9a6; }
.film .act-note { background: rgba(0,0,0,.35); border-color: rgba(255,236,200,.3); color: #f3ead8; }
.voice-first .own-act { margin-top: .2rem; }
.film .act-note .btn.tiny { min-height: 44px; padding: 6px 14px; }

/* Veo loop over a world card: fades in once playing */
.wp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.wp-video.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .wp-video { display: none; } }
#t-voice.off { opacity: .55; }
/* The Ashen Crown's beacon burns grey: drain the colour from the card loop */
.wp-video { filter: saturate(.35) contrast(1.05); }
.stage-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; filter: saturate(.35) contrast(1.05); pointer-events: none; }
.stage-video.on { opacity: 1; }

/* ---- living world: who is here, chapter cards, previously, library, like */
.cast { list-style: none; margin: .2rem 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.cast-chip { display: flex; align-items: center; gap: .45rem; padding: .25rem .7rem .25rem .25rem; border-radius: 999px; background: rgba(20,16,12,.62); border: 1px solid rgba(227,195,119,.35); color: var(--parch); backdrop-filter: blur(4px); }
.cast-face { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; display: grid; place-items: center; background: var(--night-2); border: 1px solid var(--gold); font-weight: 700; color: var(--gold-hi); }
.cast-face img { width: 100%; height: 100%; object-fit: cover; }
.cast-text { display: grid; line-height: 1.1; }
.cast-text b { font-size: .9rem; }
.cast-mood { font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: #d8cdb5; }
.cast-chip.mood-friendly .cast-mood, .cast-chip.mood-devoted .cast-mood { color: #9fd38f; }
.cast-chip.mood-wary .cast-mood { color: var(--gold-hi); }
.cast-chip.mood-hostile .cast-mood { color: #ff8f6b; }
.cast-chip.mood-friendly, .cast-chip.mood-devoted { border-color: rgba(159,211,143,.55); }
.cast-chip.mood-hostile { border-color: rgba(255,143,107,.55); }
.cast-chip.shift { animation: castShift 1.6s ease 2; }
@keyframes castShift { 0%,100% { box-shadow: 0 0 0 0 rgba(227,195,119,0); } 50% { box-shadow: 0 0 0 6px rgba(227,195,119,.35); } }
.previously .cast-chip { background: rgba(43,33,24,.08); color: var(--ink); border-color: rgba(43,33,24,.2); backdrop-filter: none; }
.previously .cast-mood { color: var(--ink-soft); }
.previously .recap { font-style: italic; }

.chapter-card { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; text-align: center; gap: .4rem; padding: 24px; background: radial-gradient(ellipse at center, rgba(12,10,8,.82), rgba(5,4,3,.96)); color: var(--parch); animation: ccIn .7s ease both; cursor: pointer; }
.chapter-card.out { opacity: 0; transition: opacity .6s; }
.cc-chapter { margin: 0; font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-hi); }
.cc-line { margin: 0; font-size: .95rem; letter-spacing: .18em; text-transform: uppercase; color: #d8cdb5; }
.cc-title { margin: .2rem 0 0; font-family: var(--serif); font-size: clamp(1.8rem, 7vw, 3rem); color: #fff6e2; text-shadow: 0 2px 18px rgba(200,100,30,.45); }
@keyframes ccIn { from { opacity: 0; } to { opacity: 1; } }
.chapter-card .cc-title { animation: ccTitle 1.4s ease both; }
@keyframes ccTitle { from { opacity: 0; transform: translateY(10px); letter-spacing: .08em; } to { opacity: 1; transform: none; letter-spacing: 0; } }
@media (prefers-reduced-motion: reduce) { .chapter-card, .chapter-card .cc-title, .cast-chip.shift { animation: none; } }

.library { margin: 1.4rem 0 .5rem; }
.lib-h { font-family: var(--serif); color: var(--parch); font-size: 1.15rem; margin: 0 0 .6rem; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.wl-row { list-style: none; margin: 0; padding: 0 0 .5rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 46%); gap: .7rem; overflow-x: auto; scroll-snap-type: x mandatory; }
@media (min-width: 700px) { .wl-row { grid-auto-columns: minmax(170px, 23%); } }
.wl-row > li { scroll-snap-align: start; }
.wl-card { width: 100%; display: grid; gap: .2rem; text-align: left; padding: 0 0 .6rem; border-radius: 12px; overflow: hidden; background: rgba(20,16,12,.72); border: 1px solid rgba(227,195,119,.35); color: var(--parch); font: inherit; cursor: pointer; }
.wl-card:hover:not([disabled]), .wl-card:focus-visible { border-color: var(--gold-hi); }
.wl-card > span, .wl-card > b { padding: 0 .65rem; }
.wl-art { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 0 !important; background: var(--night-2); color: var(--gold-hi); margin-bottom: .3rem; }
.wl-art img { width: 100%; height: 100%; object-fit: cover; }
.wl-art svg { width: 38px; height: 38px; }
.wl-soon { position: absolute; left: 8px; top: 8px; font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; background: rgba(0,0,0,.65); color: var(--gold-hi); }
.wl-card.locked { cursor: default; opacity: .78; }
.wl-card.builder { border-style: dashed; cursor: default; }
.wl-genre { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-hi); }
.wl-title { font-family: var(--serif); font-size: 1rem; }
.wl-stats { font-size: .78rem; color: #d8cdb5; }
.like-btn.on { color: #ff8f8f; border-color: #ff8f8f; }
.wl-initial { font-family: var(--serif); font-size: 2.6rem; color: rgba(255,246,226,.85); text-shadow: 0 2px 12px rgba(0,0,0,.5); }

/* ---- holiday season (1 Dec - 6 Jan): snowfall, twinkling lights, featured holiday tale */
.snowfall { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.holiday-banner { display: grid; gap: .1rem; width: 100%; margin: 0 0 .9rem; padding: .7rem 1rem; text-align: left; font: inherit; cursor: pointer;
  border-radius: 12px; border: 1px solid #e5b84b; color: #fff8ea; background: linear-gradient(135deg, rgba(47,107,69,.92), rgba(192,57,43,.88));
  box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.holiday-banner:hover, .holiday-banner:focus-visible { filter: brightness(1.08); }
.hb-kicker { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #ffe7a6; }
.holiday-banner b { font-family: var(--serif); font-size: 1.15rem; }
.hb-line { font-size: .82rem; opacity: .92; }
.wl-soon.wl-holiday { background: #c0392b; color: #fff8ea; }

/* ---- host sign-in strip (home screen, only when Google sign-in is configured) */
.account-strip { margin: .7rem 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; color: var(--parch); font-size: .85rem; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.account-hint { opacity: .9; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--gold-hi); text-decoration: underline; cursor: pointer; }

/* ---- library: swipe on phones without a visible scrollbar; full grid on big screens */
.wl-row { scrollbar-width: none; -ms-overflow-style: none; }
.wl-row::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  body[data-screen="landing"] main { max-width: 1100px; }
  body[data-screen="landing"] .landing-card, body[data-screen="landing"] .holiday-banner,
  body[data-screen="landing"] .account-strip, body[data-screen="landing"] .demo-link { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }
  body[data-screen="landing"] .hero-title { max-width: 680px; margin-left: auto; margin-right: auto; }
  .wl-row { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-auto-columns: unset; overflow: visible; }
  .lib-h { font-size: 1.35rem; }
}

/* ---- end-of-tale beta feedback */
.feedback { display: grid; gap: .6rem; margin-top: 1rem; }
.feedback h2 { margin: 0; font-size: 1.1rem; }
.stars { display: flex; gap: .25rem; }
.star { font-size: 1.9rem; line-height: 1; background: none; border: 0; padding: 0 .1rem; cursor: pointer; color: rgba(43,33,24,.28); }
.star.on { color: #d79b22; }
.feedback textarea { resize: vertical; min-height: 3rem; font: inherit; }
.pass-row { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem .6rem; margin-top: .3rem; }
.pass-badge { padding: .1rem .55rem; border-radius: 999px; background: var(--gold); color: var(--ink); font-weight: 700; font-size: .78rem; }
.btn.small { padding: .35rem .9rem; font-size: .9rem; }
