/* Echoes Beneath the Stone - solo table. Open Dungeons RPG.
   House rules for this file: no CSS blur or backdrop-filter anywhere.
   Patterns and movement keep the eye busy. */
@font-face { font-family: "IM Fell English"; src: url(../fonts/im-fell-english-latin-400-normal.woff2?v=967e40d3) format("woff2"); font-display: swap; }
@font-face { font-family: "IM Fell English"; font-style: italic; src: url(../fonts/im-fell-english-latin-400-italic.woff2?v=a50b0f79) format("woff2"); font-display: swap; }
@font-face { font-family: "Alegreya"; src: url(../fonts/alegreya-latin-400-normal.woff2?v=0aa1533f) format("woff2"); font-display: swap; }
@font-face { font-family: "Alegreya"; font-style: italic; src: url(../fonts/alegreya-latin-400-italic.woff2?v=812f7d9a) format("woff2"); font-display: swap; }
@font-face { font-family: "Alegreya"; font-weight: 700; src: url(../fonts/alegreya-latin-700-normal.woff2?v=0f36c0f1) format("woff2"); font-display: swap; }
@font-face { font-family: "Lora"; src: url(../fonts/lora-latin-400-normal.woff2?v=25f3bc09) format("woff2"); font-display: swap; }
@font-face { font-family: "Caveat"; src: url(../fonts/caveat-latin-400-normal.woff2?v=4649fc79) format("woff2"); font-display: swap; }
@font-face { font-family: "Caveat"; font-weight: 700; src: url(../fonts/caveat-latin-700-normal.woff2?v=2f2cd184) format("woff2"); font-display: swap; }
@font-face { font-family: "Patrick Hand"; src: url(../fonts/patrick-hand-latin-400-normal.woff2?v=a90180de) format("woff2"); font-display: swap; }

:root {
  --gold: #e8c27a; --gold2: #b8873a; --gold3: #6e4d1c; --ink: #1d1410; --parch: #f1e4c4; --parch2: #e3d1ac;
  --night: #07060a; --mara: #c4a2ff; --toby: #8ac8ff; --dn: #ffcf86; --blood: #c0392b; --good: #7ad07a;
  --panel: linear-gradient(rgba(22,14,10,.9), rgba(10,6,5,.94));
  --line: rgba(232,194,122,.42);
  --ts: 1;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --rail-h: 168px;
  --p-knot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cg fill='none' stroke='%23e8c27a' stroke-width='2.2'%3E%3Ccircle cx='0' cy='14' r='9'/%3E%3Ccircle cx='28' cy='14' r='9'/%3E%3Ccircle cx='14' cy='0' r='9'/%3E%3Ccircle cx='14' cy='28' r='9'/%3E%3Ccircle cx='14' cy='14' r='4' stroke='%23b8873a'/%3E%3C/g%3E%3C/svg%3E");
  --p-vine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Crect width='30' height='30' fill='%232a1745'/%3E%3Cg fill='%23c4a2ff'%3E%3Cpath d='M15 4c4 3 4 8 0 11c-4-3-4-8 0-11z'/%3E%3Cpath d='M15 26c4-3 4-8 0-11c-4 3-4 8 0 11z' opacity='.55'/%3E%3Ccircle cx='3' cy='15' r='2'/%3E%3Ccircle cx='27' cy='15' r='2'/%3E%3C/g%3E%3C/svg%3E");
  --p-leather: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cg fill='none' stroke-width='1.3'%3E%3Cg stroke='%23000' stroke-opacity='.45' transform='translate(0 1)'%3E%3Ccircle cx='30' cy='26' r='17'/%3E%3Ccircle cx='0' cy='0' r='17'/%3E%3Ccircle cx='60' cy='0' r='17'/%3E%3Ccircle cx='0' cy='52' r='17'/%3E%3Ccircle cx='60' cy='52' r='17'/%3E%3C/g%3E%3Cg stroke='%23f0c48a' stroke-opacity='.16'%3E%3Ccircle cx='30' cy='26' r='17'/%3E%3Ccircle cx='0' cy='0' r='17'/%3E%3Ccircle cx='60' cy='0' r='17'/%3E%3Ccircle cx='0' cy='52' r='17'/%3E%3Ccircle cx='60' cy='52' r='17'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  --p-filigree: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='14'%3E%3Cg fill='none' stroke='%23e8c27a' stroke-width='1.6'%3E%3Cpath d='M0 7 Q8 0 16 7 T32 7 T48 7 T64 7'/%3E%3Cpath d='M0 7 Q8 14 16 7 T32 7 T48 7 T64 7' stroke='%23b8873a'/%3E%3C/g%3E%3Ccircle cx='16' cy='7' r='1.8' fill='%23e8c27a'/%3E%3Ccircle cx='48' cy='7' r='1.8' fill='%23e8c27a'/%3E%3C/svg%3E");
  --p-diamond: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M12 0L24 12L12 24L0 12Z' fill='none' stroke='%23e8c27a' stroke-opacity='.18' stroke-width='1'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23e8c27a' fill-opacity='.25'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); color: var(--parch); }
body { font-family: "Alegreya", Georgia, serif; -webkit-font-smoothing: antialiased; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ the scene */
#stage { position: fixed; inset: 0; overflow: hidden; background: #050407; }
.art-wrap { position: absolute; inset: -2%; }
.art { position: absolute; inset: 0; background: var(--art, none) center / cover no-repeat; opacity: 0; transition: opacity 1.6s ease; will-change: transform, opacity; }
.art.on { opacity: 1; animation: kenburns 38s ease-in-out infinite alternate; }
@keyframes kenburns { 0% { transform: scale(1.02) translate(0, 0); } 50% { transform: scale(1.045) translate(-1%, .5%); } 100% { transform: scale(1.03) translate(1%, -.6%); } }
/* During play: the whole picture, fit to the screen's height and centered, its left and right edges fading into a
   darkened, warm copy of itself that fills the sides on wide screens (no blur). Narrow screens crop the sides a little.
   The title, character pick and endings keep the full-bleed cover. */
body[data-screen="play"] .art { background: none; }
body[data-screen="play"] .art::before, body[data-screen="play"] .art::after { content: ""; position: absolute; background: var(--art, none) center / cover no-repeat; }
body[data-screen="play"] .art::before { inset: 0; filter: brightness(.34) sepia(.5) saturate(.7); transform: scale(1.12); }
body[data-screen="play"] .art::after { top: 0; left: 50%; height: 100%; aspect-ratio: var(--ar, 1.3333); transform: translateX(-50%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent); }
body[data-screen="play"] .art.on { animation-name: kenburnsSoft; }
@keyframes kenburnsSoft { 0% { transform: scale(1) translate(0, 0); } 50% { transform: scale(1.018) translate(-.5%, .25%); } 100% { transform: scale(1.01) translate(.5%, -.3%); } }
.tint { position: absolute; inset: 0; mix-blend-mode: color; opacity: .6; transition: background 2s; }
.tint[data-mood="outside"] { background: linear-gradient(160deg, #e2b070, #6a4a72 60%, #161028); }
.tint[data-mood="upper"] { background: linear-gradient(160deg, #e0a050, #8a4a1c 60%, #3a1a0c); }
.tint[data-mood="middle"] { background: linear-gradient(160deg, #7cc2a8, #2b5a52 60%, #0d2422); }
.tint[data-mood="lower"] { background: linear-gradient(160deg, #9a8af0, #3a2a7a 60%, #120a2a); }
.tint[data-mood="final"] { background: linear-gradient(160deg, #c05050, #3a0a1a 60%, #08040a); }
.rays { position: absolute; inset: -30%; mix-blend-mode: screen; opacity: .2; transform-origin: 20% 0%;
  background: repeating-conic-gradient(from 200deg at 20% 0%, rgba(255,214,150,0) 0deg, rgba(255,214,150,.55) 2deg, rgba(255,214,150,0) 5deg, rgba(255,214,150,0) 11deg);
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 20% 0%, #000, transparent 75%); mask-image: radial-gradient(ellipse 70% 80% at 20% 0%, #000, transparent 75%);
  animation: sway 16s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-2.5deg); } to { transform: rotate(3deg); } }
.fog { position: absolute; left: -50%; width: 200%; height: 60%; bottom: -8%; opacity: .5; pointer-events: none;
  background: radial-gradient(ellipse 18% 40% at 10% 60%, rgba(220,200,180,.22), transparent 70%), radial-gradient(ellipse 22% 35% at 38% 55%, rgba(220,200,180,.18), transparent 70%), radial-gradient(ellipse 16% 40% at 66% 62%, rgba(220,200,180,.2), transparent 70%), radial-gradient(ellipse 20% 30% at 88% 50%, rgba(220,200,180,.16), transparent 70%);
  animation: drift 60s linear infinite; }
.fog.f2 { bottom: 14%; opacity: .3; animation-duration: 95s; animation-direction: reverse; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(25%); } }
#motes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vig { position: absolute; inset: 0; background: radial-gradient(ellipse 78% 72% at 50% 42%, transparent 42%, rgba(5,3,6,.86) 100%), linear-gradient(transparent 50%, rgba(5,3,6,.92)); transition: background 1s; }
body.whisper .vig { background: radial-gradient(ellipse 50% 50% at 50% 45%, transparent 20%, rgba(2,1,4,.96) 90%); }
.flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .75s ease-out; }
.flash.hurt { background: radial-gradient(ellipse at 50% 70%, rgba(200,20,10,.55), rgba(120,0,0,.25) 60%, transparent); }
.flash.hit { background: radial-gradient(ellipse at 50% 40%, rgba(255,235,190,.35), transparent 60%); }
.flash.magic { background: radial-gradient(ellipse at 50% 45%, rgba(170,120,255,.45), transparent 65%); }
.flash.holy { background: radial-gradient(ellipse at 50% 40%, rgba(255,235,150,.75), rgba(255,200,90,.2) 55%, transparent); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
body.shake #stage { animation: shake .45s ease; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translate(-8px, 4px); } 40% { transform: translate(7px, -5px); } 60% { transform: translate(-5px, 3px); } 80% { transform: translate(3px, -2px); } }

/* ------------------------------------------------------------ top bar */
#bar { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--safe-t)) 18px 22px; background: linear-gradient(rgba(6,4,8,.92), rgba(6,4,8,0)); }
#bar::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 6px; height: 14px; background: var(--p-filigree) repeat-x center / auto 14px; opacity: .55; animation: shimmer 9s linear infinite; }
@keyframes shimmer { from { background-position: 0 center; } to { background-position: 640px center; } }
.crest { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-width: 0; }
.crest img { width: 42px; height: 42px; border-radius: 10px; box-shadow: 0 0 0 1px var(--gold2), 0 0 18px rgba(232,194,122,.35); flex: none; }
.crest div { min-width: 0; }
.crest b { display: block; font: 24px "IM Fell English", serif; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crest span { display: block; font-size: 14px; color: var(--gold); letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#bar nav { display: flex; gap: 8px; flex: none; }
#bar nav button { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 30px; border: 1px solid var(--line); background: linear-gradient(rgba(40,26,18,.9), rgba(18,11,8,.9)); font-size: 15px; transition: border-color .2s, box-shadow .2s; position: relative; }
#bar nav button svg { width: 18px; height: 18px; }
#bar nav button:hover { border-color: var(--gold); box-shadow: 0 0 16px rgba(232,194,122,.35); }
#bar nav button.ping::after { content: ""; position: absolute; inset: -4px; border-radius: 34px; border: 2px solid var(--gold); animation: ping 1.4s ease-out; }
@keyframes ping { from { opacity: 1; transform: scale(.92); } to { opacity: 0; transform: scale(1.25); } }
.i-play { display: none; } body.paused .i-play { display: block; } body.paused .i-pause { display: none; }
body:not([data-screen="play"]) #bar, body:not([data-screen="play"]) .seat, body:not([data-screen="play"]) #rail { display: none; }

/* ------------------------------------------------------------ seats */
.seat { position: fixed; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seat.dn { left: 50%; top: calc(84px + var(--safe-t)); transform: translateX(-50%); }
.seat.mara { left: 3vw; top: 22vh; } .seat.toby { right: 3vw; top: 22vh; }
.medal { --size: 116px; position: relative; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(from 210deg, #fff1c8, var(--gold) 12%, var(--gold3) 30%, var(--gold) 46%, #fff1c8 52%, var(--gold2) 70%, var(--gold3) 85%, #fff1c8);
  box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 2px rgba(0,0,0,.6); animation: bob 6s ease-in-out infinite; transition: box-shadow .1s; }
.seat.dn .medal { --size: 132px; }
.seat.toby .medal { animation-delay: -2s; } .seat.mara .medal { animation-delay: -4s; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.medal .band { position: absolute; inset: 7px; border-radius: 50%; -webkit-mask-image: radial-gradient(circle, transparent 58%, #000 59%); mask-image: radial-gradient(circle, transparent 58%, #000 59%); }
.pat-knot { background: #20160c var(--p-knot); background-size: 22px; animation: turn 60s linear infinite; }
.pat-vine { background: var(--p-vine); background-size: 20px; animation: turn 70s linear infinite reverse; }
.pat-plaid { background: repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 6px, transparent 6px 14px, rgba(255,255,255,.12) 14px 16px, transparent 16px 26px), repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 6px, transparent 6px 14px, rgba(255,255,255,.12) 14px 16px, transparent 16px 26px), #1f4f8a; animation: turn 80s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.medal .core { position: relative; width: 62%; height: 62%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a2a1c, #120b07 75%); box-shadow: inset 0 0 0 2px rgba(232,194,122,.55), inset 0 6px 14px rgba(0,0,0,.8); display: grid; place-items: center; color: var(--gold); }
.medal .core svg { width: 58%; height: 58%; transition: transform .08s; }
.seat.mara .core { color: var(--mara); } .seat.toby .core { color: var(--toby); }
.runes { position: absolute; inset: -22px; width: calc(100% + 44px); height: calc(100% + 44px); animation: turn 50s linear infinite; opacity: .55; pointer-events: none; }
.runes text { font-size: 13px; fill: var(--gold); letter-spacing: 3px; }
.plate { text-align: center; padding: 6px 14px 8px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); min-width: 156px; }
.plate b { display: block; font: 19px "IM Fell English", serif; letter-spacing: 1px; } .plate span { font-size: 13px; color: #d9c49c; }
.seat.mara .plate b { color: var(--mara); } .seat.toby .plate b { color: var(--toby); } .seat.dn .plate b { color: var(--dn); }
.hpbar { display: block; height: 4px; margin-top: 6px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; }
.hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #6cbf6a, #a5e08a); transition: width .5s; }
.hpbar i.low { background: linear-gradient(90deg, #d08a3a, #f0b860); } .hpbar i.down { background: var(--blood); }
.pulse { position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0; pointer-events: none; }
.seat.mara .pulse { border-color: var(--mara); } .seat.toby .pulse { border-color: var(--toby); }
.seat.speaking .pulse { animation: ring 1.8s ease-out infinite; } .seat.speaking .pulse.p2 { animation-delay: .9s; }
@keyframes ring { from { transform: scale(1); opacity: .85; } to { transform: scale(1.5); opacity: 0; } }
.seat.speaking .core svg { transform: scale(calc(1 + var(--lvl, .4) * .16)); }
.badge { position: absolute; right: -6px; bottom: -2px; width: 34px; height: 34px; display: grid; place-items: center; opacity: 0; transform: scale(.4); transition: .25s; pointer-events: none; }
.badge svg { width: 100%; height: 100%; }
.badge.pencil { left: -6px; right: auto; }
.seat.rolling .badge.die { opacity: 1; transform: scale(1); animation: spinbadge .8s ease-out; }
.seat.drawing .badge.pencil { opacity: 1; transform: scale(1); animation: scribble .3s ease-in-out infinite alternate; }
@keyframes spinbadge { from { transform: rotate(-540deg) scale(.4); } to { transform: rotate(0) scale(1); } }
@keyframes scribble { from { transform: translate(-3px, 2px) rotate(-8deg); } to { transform: translate(3px, -2px) rotate(8deg); } }
.seat.down .medal { filter: grayscale(1) brightness(.6); }

/* foes appear in the scene during fights */
#foes { position: fixed; z-index: 6; left: 50%; top: calc(300px + var(--safe-t)); transform: translateX(-50%); display: flex; gap: 18px; }
.foe { width: 170px; border-radius: 14px; padding: 8px 8px 10px; background: var(--panel); border: 1px solid rgba(192,57,43,.75); box-shadow: 0 0 30px rgba(192,57,43,.35), 0 14px 40px rgba(0,0,0,.6); text-align: center; animation: foein .6s cubic-bezier(.2,.9,.3,1.3); }
.foe .ph { height: 120px; border-radius: 9px; background: center / cover; animation: breathe 3.2s ease-in-out infinite; }
.foe b { display: block; font: 18px "IM Fell English", serif; margin-top: 6px; } .foe span { font-size: 13px; color: #f0a092; letter-spacing: 1px; text-transform: uppercase; }
.foe .hpbar i { background: linear-gradient(90deg, #a3271a, #e05a3a); }
.foe.out { opacity: .4; filter: grayscale(1); transform: scale(.92); transition: .5s; }
.foe.hit { animation: foehit .4s ease; } .foe.lunge { animation: lunge .45s ease; }
@keyframes foein { from { opacity: 0; transform: translateY(-30px) scale(.8); } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes foehit { 0%,100% { transform: none; } 30% { transform: translateX(-10px) rotate(-3deg); } 60% { transform: translateX(8px) rotate(2deg); } }
@keyframes lunge { 0%,100% { transform: none; } 40% { transform: translateY(26px) scale(1.12); } }

/* written handouts pop up big, then join the fan */
#note-pop { position: fixed; z-index: 9; left: 50%; top: 44%; width: min(560px, 86vw); transform: translate(-50%, -50%) rotate(-2deg); animation: notein .6s cubic-bezier(.2,.9,.3,1.2); }
#note-pop.out { animation: noteout .7s ease-in forwards; }
@keyframes notein { from { opacity: 0; transform: translate(-50%, -40%) rotate(-12deg) scale(.6); } }
@keyframes noteout { to { opacity: 0; transform: translate(30vw, 40vh) rotate(18deg) scale(.2); } }

/* ------------------------------------------------------------ narration */
#say { position: fixed; z-index: 7; left: 3vw; right: 3vw; bottom: calc(var(--rail-h) + 18px + var(--safe-b)); max-width: 1180px; margin: 0 auto; padding: 18px 26px 20px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,230,180,.12); cursor: pointer; transition: right .3s; }
body.choosing #say { right: calc(3vw + 372px); margin: 0; }
#say::before { content: ""; position: absolute; left: 22px; right: 22px; top: -7px; height: 14px; background: var(--p-filigree) repeat-x center / auto 14px; animation: shimmer 12s linear infinite; }
#say .who { font: 700 13px "Alegreya", serif; letter-spacing: 3px; text-transform: uppercase; color: var(--dn); margin-bottom: 4px; }
#say .who small { letter-spacing: 1px; text-transform: none; font-weight: 400; opacity: .75; font-size: 13px; }
#say[data-who="MARA"] .who { color: var(--mara); } #say[data-who="TOBY"] .who { color: var(--toby); }
#say .line { margin: 0; font-size: calc(23px * var(--ts)); line-height: 1.45; max-height: 30vh; overflow-y: auto; }
#say .line span { transition: opacity .35s ease, color .35s; }
#say .line span.w { opacity: .3; } #say .line span.w.lit { opacity: 1; }
#say[data-who="WHISPER"] .line { font-style: italic; letter-spacing: 1px; color: #d8e2f2; }
#say[data-who="SOREN"] .line, #say[data-who="VOICE"] .line { font-style: italic; }

#choices { position: fixed; z-index: 7; right: 3vw; bottom: calc(var(--rail-h) + 18px + var(--safe-b)); width: 356px; display: flex; flex-direction: column; gap: 9px; max-height: calc(100vh - var(--rail-h) - 300px); overflow-y: auto; padding: 4px; }
#choices.combat { width: 400px; }
body.choosing.combat-choose #say { right: calc(3vw + 416px); }
.choice { text-align: left; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; font-size: calc(18px * var(--ts)); line-height: 1.25;
  border: 1px solid rgba(232,194,122,.55); background: linear-gradient(135deg, rgba(58,38,24,.96), rgba(26,16,10,.96)); box-shadow: 0 10px 30px rgba(0,0,0,.55); position: relative; overflow: hidden; transition: transform .15s, border-color .15s; animation: chin .35s ease both; }
.choice::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,226,170,.2) 50%, transparent 70%); transform: translateX(-120%); animation: sheen 5s ease-in-out infinite; pointer-events: none; }
.choice:nth-child(2) { animation-delay: .05s; } .choice:nth-child(2)::after { animation-delay: .4s; }
.choice:nth-child(3) { animation-delay: .1s; } .choice:nth-child(3)::after { animation-delay: .8s; }
.choice:nth-child(4) { animation-delay: .15s; } .choice:nth-child(5) { animation-delay: .2s; } .choice:nth-child(6) { animation-delay: .25s; }
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes chin { from { opacity: 0; transform: translateX(30px); } }
.choice:hover { transform: translateX(-4px); border-color: var(--gold); }
.choice .k { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 14px "Alegreya", serif; color: var(--ink); background: radial-gradient(circle at 35% 30%, #fff1c8, var(--gold) 50%, var(--gold2)); }
.choice .t { flex: 1; min-width: 0; } .choice small { display: block; font-size: 13px; opacity: .7; margin-top: 2px; }

/* ------------------------------------------------------------ dice panel */
#dice { position: fixed; z-index: 12; left: 50%; top: 47%; transform: translate(-50%, -50%); width: min(460px, 92vw); padding: 18px 22px 20px; border-radius: 22px; text-align: center;
  background: var(--p-diamond), radial-gradient(ellipse at 50% 30%, #2a1a12, #0e0806 80%); background-size: 24px, auto; border: 1px solid var(--gold); box-shadow: 0 30px 90px rgba(0,0,0,.85), 0 0 60px rgba(232,194,122,.25); animation: dicein .45s cubic-bezier(.2,.9,.3,1.25); }
#dice::before { content: ""; position: absolute; left: 20px; right: 20px; top: -7px; height: 14px; background: var(--p-filigree) repeat-x center / auto 14px; }
@keyframes dicein { from { opacity: 0; transform: translate(-50%, -40%) scale(.85); } }
#dice h3 { margin: 0; font: 28px "IM Fell English", serif; }
#dice .formula { margin: 4px 0 0; font-size: 19px; color: #ead9b8; } #dice .why { margin: 2px 0 0; font-size: 14px; color: #bda887; min-height: 1em; }
#dice .help { font-size: 13px; }
#dice .stage3d { position: relative; width: 220px; height: 200px; margin: 6px auto 0; border: 0; padding: 0; background: radial-gradient(ellipse at 50% 60%, #1f5a3c, #0f2c1d 70%); border-radius: 50%; box-shadow: inset 0 0 0 6px #3a2214, inset 0 0 0 8px var(--gold3), inset 0 20px 40px rgba(0,0,0,.6); }
#dice .stage3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#dice .stage3d:not(:disabled) { animation: beckon 1.8s ease-in-out infinite; }
@keyframes beckon { 0%,100% { box-shadow: inset 0 0 0 6px #3a2214, inset 0 0 0 8px var(--gold3), inset 0 20px 40px rgba(0,0,0,.6), 0 0 0 rgba(255,190,100,0); } 50% { box-shadow: inset 0 0 0 6px #3a2214, inset 0 0 0 8px var(--gold), inset 0 20px 40px rgba(0,0,0,.6), 0 0 40px rgba(255,190,100,.55); } }
#dice .pct { display: flex; gap: 14px; justify-content: center; align-items: center; height: 200px; }
#dice .pct i { width: 84px; height: 110px; border-radius: 14px; display: grid; place-items: center; font: 700 64px "Alegreya", serif; font-style: normal; background: linear-gradient(#3d7bb5, #1d4670); box-shadow: inset 0 0 0 3px rgba(255,255,255,.18), 0 10px 26px rgba(0,0,0,.6); }
#dice .tap { margin: 8px 0 0; font-size: 15px; color: var(--gold); letter-spacing: 1px; }
#dice .result { min-height: 58px; margin-top: 6px; font-size: 20px; }
#dice .result b { font: 700 52px "Alegreya", serif; color: #fff; vertical-align: middle; margin-right: 6px; text-shadow: 0 0 24px rgba(255,200,120,.6); }
#dice .result small { color: #bda887; }
.ok { color: #9be08a; font-weight: 700; } .no { color: #ff8f80; font-weight: 700; }
#dice .result .ok, #dice .result .no { display: inline-block; animation: stamp .4s cubic-bezier(.2,.9,.3,1.4); font-size: 22px; letter-spacing: 1px; text-transform: uppercase; }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } }

/* ------------------------------------------------------------ your edge of the table */
#rail { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; height: calc(var(--rail-h) + var(--safe-b)); display: flex; align-items: center; gap: 26px; padding: 18px 3vw calc(14px + var(--safe-b));
  background: var(--p-leather), radial-gradient(ellipse 60% 120% at 50% 0%, #5a3520, #2c180e 70%); background-size: 60px 52px, auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,.6), inset 0 2px 0 rgba(255,210,150,.15); }
#rail::before { content: ""; position: absolute; left: 0; right: 0; top: -4px; height: 14px; background: var(--p-filigree) repeat-x center / auto 14px, linear-gradient(#2a1a10, #1a0f08); border-top: 1px solid var(--gold2); border-bottom: 1px solid var(--gold3); animation: shimmer 14s linear infinite reverse; }
#rail > button { border: 0; padding: 0; background: none; }
.you { display: flex; align-items: center; gap: 14px; min-width: 260px; text-align: left; }
.you .ring { --hp: 1; width: 96px; height: 96px; border-radius: 50%; padding: 6px; background: conic-gradient(var(--good) calc(var(--hp) * 360deg), rgba(255,255,255,.1) 0); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--gold2), 0 10px 26px rgba(0,0,0,.5); flex: none; }
.you .ring.low { background: conic-gradient(#e0a040 calc(var(--hp) * 360deg), rgba(255,255,255,.1) 0); } .you .ring.down { background: conic-gradient(var(--blood) 360deg, var(--blood) 0); }
.you .core { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #3a2a1c, #120b07 75%); display: grid; place-items: center; color: var(--gold); }
.you .core svg { width: 54%; }
.you b { display: block; font: 22px "IM Fell English", serif; } .you span { display: block; font-size: 14px; color: #e3cfa6; } .you .stats { color: var(--gold); margin-top: 3px; }
.you:hover .ring { box-shadow: 0 0 0 2px var(--gold), 0 0 24px rgba(232,194,122,.5); }
.you.hurt .ring { animation: hurtring .5s ease; }
@keyframes hurtring { 0%,100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.tray { position: relative; width: 150px; height: 128px; border-radius: 18px !important; background: radial-gradient(ellipse at 50% 40%, #1f5a3c, #0f2c1d 75%) !important; box-shadow: inset 0 0 0 5px #3a2214, inset 0 0 0 7px var(--gold3), 0 10px 26px rgba(0,0,0,.5); flex: none; }
.tray canvas { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
body.rolling .tray { box-shadow: inset 0 0 0 5px #3a2214, inset 0 0 0 7px var(--gold), 0 0 30px rgba(232,194,122,.6); }
#rail span.lbl, .tray > span, .mapcard > span, .fan > span { position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #d9c49c; pointer-events: none; }
.mapcard { position: relative; width: 140px; height: 112px; border-radius: 6px !important; transform: rotate(-4deg); background-color: #efe6d2 !important; background-image: linear-gradient(rgba(70,120,170,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(70,120,170,.25) 1px, transparent 1px) !important; background-size: 10px 10px !important; box-shadow: 0 10px 22px rgba(0,0,0,.5); transition: transform .2s; flex: none; }
.mapcard:hover { transform: rotate(0) translateY(-6px); }
.mapcard.drawing { animation: wiggle .3s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-5deg); } to { transform: rotate(-2.5deg) translateY(-2px); } }
.mapcard .map-host { position: absolute; inset: 6px; }
.map-host svg { width: 100%; height: 100%; display: block; }
.map-svg .map-label { font: 700 22px "Caveat", cursive; fill: #2b2b31; }
.map-svg .sheet-title { font: 700 26px "Caveat", cursive; fill: #7a1d12; }
.map-svg .erasing { animation: erase 1.3s ease forwards; }
@keyframes erase { 0% { opacity: 1; } 60% { opacity: .3; } 100% { opacity: 0; } }
.mapcard .map-host .map-label, .mapcard .map-host .sheet-title { display: none; }
.fan { position: relative; width: 230px; height: 130px; margin-left: auto; flex: none; }
.fan .c { position: absolute; bottom: 10px; left: 60px; width: 92px; height: 122px; border-radius: 6px; padding: 0; background: #efe5cd center / cover; border: 4px solid #efe5cd; box-shadow: 0 10px 22px rgba(0,0,0,.55); transform-origin: 50% 120%;
  transform: rotate(calc(var(--r) * 1deg)) translateX(calc(var(--x) * 1px)); transition: transform .3s; }
.fan .c:hover { transform: rotate(calc(var(--r) * 1deg)) translateX(calc(var(--x) * 1px)) translateY(-20px); z-index: 2; }
.fan .c.note { display: grid; place-items: center; font: 700 15px "Caveat", cursive; color: #3a2a1c; text-align: center; line-height: 1; padding: 6px; overflow: hidden; }
.fan .c.new { animation: cardin 1s cubic-bezier(.2,.9,.3,1.1); }
@keyframes cardin { from { transform: translate(-40vw, -50vh) rotate(-40deg) scale(2.4); opacity: 0; } 60% { opacity: 1; } }

/* ------------------------------------------------------------ toasts, pause, modals */
#toasts { position: fixed; z-index: 30; left: 50%; top: calc(76px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--line); padding: 8px 18px; border-radius: 24px; font-size: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.6); animation: tin .35s cubic-bezier(.2,.9,.3,1.3); transition: opacity .5s, transform .5s; }
@keyframes tin { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
.toast.out { opacity: 0; transform: translateY(-10px); }
.toast.loot { border-color: var(--gold); color: #ffe2a6; box-shadow: 0 0 24px rgba(232,194,122,.4), 0 8px 30px rgba(0,0,0,.6); }
.toast.bad { border-color: rgba(220,70,55,.85); } .toast.good { border-color: rgba(120,200,110,.8); } .toast small { opacity: .7; }
#paused-veil { display: none; }
body.paused #paused-veil { display: grid; place-items: center; position: fixed; inset: 0; z-index: 19; background: rgba(0,0,0,.62); }
#paused-veil button { font: 26px "IM Fell English", serif; padding: 14px 30px; border-radius: 32px; border: 1px solid var(--gold); background: var(--panel); animation: beckon2 2s ease-in-out infinite; }
@keyframes beckon2 { 0%,100% { box-shadow: 0 0 0 rgba(232,194,122,0); } 50% { box-shadow: 0 0 40px rgba(232,194,122,.5); } }

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(5,3,2,.8); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .25s; }
.modal.open { opacity: 1; }
.modal-card { position: relative; max-width: min(880px, 100%); max-height: calc(100% - 20px); overflow: auto; background: var(--p-diamond), radial-gradient(ellipse at 50% 0%, #2a1a12, #120b08 70%); background-size: 24px, auto; border: 1px solid var(--line); border-radius: 18px; padding: 24px 24px 18px; box-shadow: 0 20px 80px rgba(0,0,0,.85); animation: mcin .35s cubic-bezier(.2,.9,.3,1.15); }
@keyframes mcin { from { transform: translateY(20px) scale(.96); opacity: 0; } }
.modal .x { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(12,8,5,.78); font-size: 30px; color: var(--gold); z-index: 2; }
.mh { margin: 0 0 12px; font: 30px "IM Fell English", serif; }
/* in-game yes / no box (Jump to section, Start over) */
.ask-modal { z-index: 70; }
.ask-modal .modal-card { width: min(460px, 100%); padding: 26px 28px 24px; text-align: center; border: 1px solid var(--gold2); border-radius: 18px; box-shadow: 0 0 0 1px rgba(232,194,122,.15), 0 24px 60px rgba(0,0,0,.7); }
.ask-modal .mh { color: var(--gold); font-size: 27px; line-height: 1.2; margin-bottom: 10px; }
.ask-modal p { margin: 0 0 22px; font: 18px/1.45 "Alegreya", serif; color: var(--parch); }
.ask-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ask-btns button { font: 18px "IM Fell English", serif; letter-spacing: 1px; min-width: 150px; padding: 10px 24px; border-radius: 26px; border: 1px solid var(--gold); cursor: pointer; transition: box-shadow .2s, filter .2s; }
.ask-btns .ask-no { background: #1c120b; color: var(--gold); }
.ask-btns .ask-yes { background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; border-color: #f0c47a; }
.ask-btns button:hover, .ask-btns button:focus-visible { box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,194,122,.45); outline: none; }
.ask-btns .ask-yes:hover { filter: brightness(1.08); }
@media (max-width: 420px) { .ask-btns button { flex: 1 1 100%; } }
.card-modal .modal-card { padding: 14px; background: #efe5cd; color: var(--ink); }
.card-big { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 4px; }
.cap { text-align: center; margin: 10px 0 0; font: 700 20px "Alegreya", serif; }
.note-big { min-width: min(520px, 80vw); min-height: 280px; display: grid; place-items: center; padding: 30px; border-radius: 6px; color: #2b2017; box-shadow: 0 20px 60px rgba(0,0,0,.7); }
.note-big p { font: 40px "Caveat", cursive; text-align: center; margin: 0; line-height: 1.15; }
.note-big.scratch { background: repeating-linear-gradient(25deg, #8d8a83 0 12px, #858279 12px 13px); } .note-big.scratch p { font-weight: 700; font-size: 58px; letter-spacing: 2px; transform: rotate(-3deg); }
.note-big.carved { background: repeating-linear-gradient(0deg, #5f5d58 0 22px, #57554f 22px 24px); } .note-big.carved p { font: 78px "IM Fell English", serif; color: #2b2a27; text-shadow: 0 2px 0 #8a877f; letter-spacing: 8px; }
.note-big.ledger { background: repeating-linear-gradient(#cdb98d 0 31px, #b9a477 31px 32px); } .note-big.ledger p { font: 28px "Patrick Hand", cursive; text-align: left; }
.note-big.note { background: #ece0c4; } .note-big.fakemap { background: #d9c79f; } .note-big img { width: 100%; max-width: 520px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery button { border: 0; padding: 6px; background: #efe5cd; border-radius: 6px; color: var(--ink); text-align: center; transition: transform .2s; }
.gallery button:hover { transform: translateY(-4px) rotate(-1deg); }
.gallery img { width: 100%; height: 110px; object-fit: cover; border-radius: 3px; display: block; }
.gallery span { display: block; font-size: 14px; font-weight: 700; margin-top: 4px; }
.mh-count { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; margin-left: 8px; vertical-align: 6px; border-radius: 17px; background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; font: 700 17px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.gallery-hint { margin: -4px 0 14px; font-size: 15px; opacity: .8; }
.modal.over { z-index: 61; }                          /* a card opened from the gallery sits above it */
/* the handout stack: a "More Handouts" button with the count (tap it, or the cards, to see them all) */
.fan { cursor: pointer; }
.fan.has-more > span { display: none; }
.fan .fan-more { position: absolute; z-index: 20; left: 50%; bottom: -16px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 5px 6px 5px 16px; border-radius: 22px; border: 1px solid var(--gold); background: rgba(22,14,9,.94); color: var(--parch); cursor: pointer;
  font: 600 15px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .3px; box-shadow: 0 6px 16px rgba(0,0,0,.6); transition: box-shadow .2s, background .2s; }
.fan .fan-more b { min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; font-weight: 700; font-size: 14px; }
.fan .fan-more:hover, .fan .fan-more:focus-visible, .fan:hover .fan-more { background: #2a1a10; box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,194,122,.5); outline: none; }
.fan .fan-more[hidden] { display: none; }
@media (max-width: 760px) { .fan .fan-more { font-size: 11.5px; gap: 5px; padding: 3px 4px 3px 9px; bottom: -14px; left: auto; right: 0; transform: none; } .fan .fan-more b { min-width: 20px; height: 20px; font-size: 11.5px; padding: 0 5px; } }
@media (max-height: 560px) and (orientation: landscape) { .fan .fan-more { font-size: 12px; padding: 3px 4px 3px 10px; bottom: -14px; } .fan .fan-more b { min-width: 20px; height: 20px; font-size: 12px; } }
.note-mini { height: 110px; display: grid; place-items: center; font: 20px "Caveat", cursive; overflow: hidden; padding: 6px; background: #e3d4b3; border-radius: 3px; white-space: pre-line; }
.map-modal-wrap .modal-card { max-width: min(1100px, 100%); width: 100%; background: #e9e3d4; color: var(--ink); }
.map-modal .tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.map-modal .tabs button { border: 1px solid #b7a27f; background: #f4eee0; border-radius: 10px; padding: 6px 14px; color: var(--ink); }
.map-modal .tabs button.on { background: #7a1d12; color: #fff; border-color: #7a1d12; }
.graph { background-color: #f3efe4; background-image: linear-gradient(rgba(70,120,170,.25) 1px, transparent 1px), linear-gradient(90deg, rgba(70,120,170,.25) 1px, transparent 1px); background-size: 20px 20px; }
.graph.mapbig { aspect-ratio: 1000 / 640; width: min(100%, max(340px, calc((100vh - 355px) * 1.5625))); margin: 0 auto; border-radius: 4px; box-shadow: inset 0 0 30px rgba(0,0,0,.12); }   /* sized so the walk bar and Exit fit on screen */
.map-modal-wrap .modal-foot { position: static; }   /* Exit sits below the map, never on top of the walk bar or credit line */
.graph.mapbig svg { width: 100%; height: 100%; display: block; }
.map-modal .tiny, .map-modal a { color: #5a1a10; }
.sheet-modal .modal-card { background: #f0e5cb; color: var(--ink); max-width: 720px; }
.sheet-paper header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #b39a72; padding: 0 34px 8px 0; }
.sheet-paper h2 { margin: 0; font: 34px "IM Fell English", serif; } .sheet-paper header p { margin: 0; color: #6d5440; }
.sheet-paper .emblem { width: 60px; height: 60px; color: #7a1d12; }
.vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0; }
.vitals div { background: #fff8e8; border: 1px solid #c9b48c; border-radius: 10px; text-align: center; padding: 6px; position: relative; }
.vitals b { display: block; font-size: 15px; letter-spacing: 2px; color: #7a1d12; } .vitals span { font: 700 30px "Alegreya", serif; color: #000; }
.vitals a { position: absolute; right: 7px; top: 3px; font-size: 16px; font-weight: 700; color: #7a1d12; text-decoration: none; }
.abils { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ab { background: #fff8e8; border: 1px solid #c9b48c; border-radius: 10px; text-align: center; padding: 4px 2px; }
.ab b { display: block; font-size: 15px; letter-spacing: 1px; color: #7a1d12; } .ab span { font: 700 26px "Alegreya", serif; display: block; color: #000; } .ab em { font: 700 18px "Alegreya", serif; font-style: normal; color: #000; }
.sheet-paper h4 { margin: 20px 0 6px; font: 26px "IM Fell English", serif; color: #5a1a10; }
.sheet-paper h4 small { font: 17px "Alegreya", serif; color: #000; margin-left: 6px; }
.sheet-paper p, .sheet-paper li { font-size: 18px; line-height: 1.45; color: #000; } .sheet-paper p { margin: 6px 0; } .sheet-paper ul { margin: 0; padding-left: 20px; } .sheet-paper li { margin: 0 0 6px; }
.sheet-paper .small, .sheet-paper .note { font-size: 17px; color: #000; } .sheet-paper a { color: #7a1d12; }
.sheet-paper .desc { color: #000; }
.sheet-paper header p { font-size: 18px; color: #000; }
/* saves, as boxes like the vitals: Quick Dex, Tough Con, Mind Wis */
.saves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.saves div { background: #fff8e8; border: 1px solid #c9b48c; border-radius: 10px; text-align: center; padding: 6px 4px; }
.saves b { display: block; font-size: 15px; letter-spacing: 1px; color: #7a1d12; } .saves span { font: 700 24px "Alegreya", serif; color: #000; }
/* the potion: drink any time, then it's checked off */
.potion { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff8e8; border: 1px solid #c9b48c; border-radius: 12px; padding: 10px 12px; margin: 4px 0; }
.potion b { display: block; font-size: 18px; color: #000; } .potion span { font-size: 17px; color: #000; }
.potion-drink { flex: none; font: 700 18px "Alegreya", serif; color: #1b0f06; background: linear-gradient(#e7a24c, #b8702a); border: 0; border-radius: 22px; padding: 8px 20px; cursor: pointer; }
.potion-drink:hover, .potion-drink:focus-visible { box-shadow: 0 0 0 2px #7a1d12; outline: none; }
.potion.used > div { opacity: .55; } .potion.used b { text-decoration: line-through; }
.potion-done { flex: none; font: 700 18px "Alegreya", serif; color: #2f6b2a; }
.spells li.used { text-decoration: line-through; opacity: .55; }
.menu-modal .modal-card { max-width: 520px; width: 100%; }
.settings { display: grid; gap: 10px; }
.settings label { display: grid; gap: 4px; font-size: 16px; }
.settings label.row { display: flex; gap: 10px; align-items: center; }
.settings input[type=range] { width: 100%; accent-color: var(--gold); }
.settings input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--gold); }
.menu-btns { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.menu-btns button { flex: 1; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: linear-gradient(rgba(58,38,24,.95), rgba(26,16,10,.95)); }
.menu-modal h3 { font: 22px "IM Fell English", serif; margin: 10px 0 4px; }
.links { columns: 2; padding-left: 18px; margin: 0; } .links li { margin: 4px 0; }
.tiny { font-size: 13px; color: #a8957a; line-height: 1.45; }

/* ------------------------------------------------------------ title, character pick, ending */
/* the title, character pick and ending screens scroll INSIDE the gold frame, so nothing slides under its line */
#title, #ending { position: fixed; inset: 15px; z-index: 50; overflow: auto; overscroll-behavior: contain; border-radius: 18px; background: transparent; }
#ending::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(rgba(12,8,6,.5), rgba(12,8,6,.78)); }
/* the title and character-pick pictures, dimmed so the words stand out (raise .42 for darker, lower for lighter) */
#title::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: rgba(8,5,3,.42); }
body[data-screen="pick"] #title::before { background: rgba(8,5,3,.55); }   /* "Who are you playing?": a little darker */
.frame-orn { position: fixed; inset: 14px; border: 1px solid rgba(232,194,122,.45); border-radius: 18px; pointer-events: none; z-index: 1; }
.frame-orn::before, .frame-orn::after { content: ""; position: absolute; left: 30px; right: 30px; height: 14px; background: var(--p-filigree) repeat-x center / auto 14px; animation: shimmer 10s linear infinite; }
.frame-orn::before { top: -7px; } .frame-orn::after { bottom: -7px; animation-direction: reverse; }
.title-inner { position: relative; z-index: 2; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 22px calc(36px + var(--safe-b)); max-width: 780px; margin: 0 auto; }
.od-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gold); font-size: 15px; letter-spacing: 3px; text-transform: uppercase; }
.od-mark img { width: 46px; height: 46px; border-radius: 10px; box-shadow: 0 0 0 1px var(--gold2), 0 0 24px rgba(232,194,122,.4); }
.title-inner h1 { font: clamp(48px, 9.5vw, 104px) / .95 "IM Fell English", serif; margin: 18px 0 14px; background: linear-gradient(100deg, #f8e7c2 20%, #fff8e6 40%, #e8c27a 50%, #f8e7c2 62%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: titleglint 7s ease-in-out infinite; }
@keyframes titleglint { 0%, 60% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sub { font-size: clamp(17px, 2.4vw, 22px); color: #ffffff; line-height: 1.5; max-width: 640px; margin: 0 auto; text-shadow: 0 2px 10px rgba(0,0,0,.9); }
.title-btns { display: flex; flex-direction: column; gap: 12px; margin: 32px 0 18px; width: min(380px, 100%); }
.big { font: 25px "IM Fell English", serif; padding: 14px 26px; border-radius: 40px; border: 1px solid var(--gold); background: rgba(20,14,11,.82); text-decoration: none; color: var(--parch); display: block; text-align: center; position: relative; overflow: hidden; }
.big small { display: block; font: 14px "Alegreya", serif; color: #cdbb9a; margin-top: 2px; }
.big.primary { background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; border-color: #ffd894; box-shadow: 0 0 40px rgba(232,162,76,.45); animation: beckon2 2.6s ease-in-out infinite; }
.big.primary small { color: #3b210c; }
.big::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,250,230,.45) 50%, transparent 70%); transform: translateX(-120%); animation: sheen 4.5s ease-in-out infinite; pointer-events: none; }
.big:hover { filter: brightness(1.08); }
.hint { color: #dccaa6; font-size: 15px; text-shadow: 0 2px 8px #000; }
.pick { position: relative; z-index: 2; padding: calc(34px + var(--safe-t)) 20px calc(34px + var(--safe-b)); max-width: 1200px; margin: 0 auto; text-align: center; }
.pick h2 { font: clamp(36px, 6vw, 60px) "IM Fell English", serif; margin: 10px 0; text-shadow: 0 4px 20px #000; }
.pcs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 28px 0 16px; }
.pc-card { position: relative; text-align: left; color: var(--ink); border: 0; border-radius: 18px; padding: 0; overflow: hidden; background: #e8d9b6; box-shadow: 0 16px 44px rgba(0,0,0,.7); transition: box-shadow .25s; display: flex; flex-direction: column; }
.pc-card.enter { animation: chup .6s cubic-bezier(.2,.9,.3,1.2) both; }
.pc-card.enter:nth-child(2) { animation-delay: .08s; } .pc-card.enter:nth-child(3) { animation-delay: .16s; } .pc-card.enter:nth-child(4) { animation-delay: .24s; }
@keyframes chup { from { opacity: 0; transform: translateY(40px) rotate(-3deg); } }
/* hover / tap: no tilt, a warm gold glow that breathes */
.pc-card:hover, .pc-card:focus-visible, .pc-card.lit { box-shadow: 0 0 0 3px var(--gold), 0 0 34px 8px rgba(255,196,104,.55), 0 16px 44px rgba(0,0,0,.7); animation: cardglow 1.8s ease-in-out infinite; outline: none; }
.pc-card:hover .medal, .pc-card.lit .medal { box-shadow: 0 0 0 2px #fff1c8, 0 0 26px 6px rgba(255,210,130,.7); }
@keyframes cardglow { 0%,100% { box-shadow: 0 0 0 3px var(--gold), 0 0 26px 5px rgba(255,196,104,.42), 0 16px 44px rgba(0,0,0,.7); } 50% { box-shadow: 0 0 0 3px #fff1c8, 0 0 44px 12px rgba(255,196,104,.7), 0 16px 44px rgba(0,0,0,.7); } }
@media (prefers-reduced-motion: reduce) { .pc-card:hover, .pc-card.lit { animation: none; } }
.pc-top { height: 128px; display: grid; place-items: center; position: relative; overflow: hidden; }
.pc-top::before { content: ""; position: absolute; inset: -50%; background-size: 26px; animation: turn 90s linear infinite; }
.pc-card[data-cls="fighter"] .pc-top { background: #3a1512; } .pc-card[data-cls="fighter"] .pc-top::before { background-image: var(--p-knot); opacity: .5; }
.pc-card[data-cls="cleric"] .pc-top { background: #2e2410; } .pc-card[data-cls="cleric"] .pc-top::before { background-image: var(--p-diamond), var(--p-diamond); background-size: 18px; opacity: 1; filter: brightness(2.4); }
.pc-card[data-cls="wizard"] .pc-top { background: #1d1638; } .pc-card[data-cls="wizard"] .pc-top::before { background-image: var(--p-vine); opacity: .55; }
.pc-card[data-cls="thief"] .pc-top { background: #102a24; } .pc-card[data-cls="thief"] .pc-top::before { background: repeating-linear-gradient(45deg, rgba(232,194,122,.14) 0 3px, transparent 3px 16px), repeating-linear-gradient(-45deg, rgba(232,194,122,.14) 0 3px, transparent 3px 16px); }
.pc-top .medal { --size: 96px; }
.pc-top .medal .core { color: var(--gold); }
.pc-body { padding: 14px 18px 16px; flex: 1; display: flex; flex-direction: column; background: var(--p-diamond), linear-gradient(#f1e6c9, #ddc9a0); background-size: 24px, auto; }
.pc-card h3 { margin: 0; font: 28px "IM Fell English", serif; }
/* race / class, blurb and stat labels: a plain, easy-to-read font (each device's own: Segoe UI, San Francisco, Roboto, Arial) */
.pc-card em { display: block; margin-top: 3px; font: normal 600 18px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #6d4a30; letter-spacing: .2px; }
.pc-card p { flex: 1; font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #2a1a10; }
.pc-card dl { display: flex; gap: 8px; margin: 0; } .pc-card dl div { flex: 1; background: #fff8e8; border-radius: 10px; text-align: center; padding: 4px; border: 1px solid #c9b48c; }
.pc-card dt { font: 700 15px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: 1.5px; color: #7a1d12; } .pc-card dd { margin: 0; font: 700 22px "Alegreya", serif; }
.link { background: none; border: 0; color: var(--gold); text-decoration: underline; font-size: 16px; }
.end-card { position: relative; z-index: 2; max-width: 940px; margin: 0 auto; padding: calc(44px + var(--safe-t)) 22px calc(44px + var(--safe-b)); text-align: center; }
.kicker { color: var(--gold); letter-spacing: 4px; text-transform: uppercase; font-size: 14px; }
.end-card h1 { font: clamp(48px, 8.5vw, 92px) / 1 "IM Fell English", serif; margin: 6px 0 12px; background: linear-gradient(100deg, #f8e7c2 20%, #fff8e6 40%, #e8c27a 50%, #f8e7c2 62%); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: titleglint 7s ease-in-out infinite; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 26px 0; text-align: left; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; animation: chup .5s ease both; }
.stats dt { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); } .stats dd { margin: 2px 0 0; font-size: 18px; }
.end-card h2 { font: 38px "IM Fell English", serif; margin: 30px 0 4px; }
.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 18px 0 28px; text-align: left; }
.next a { display: block; text-decoration: none; color: var(--ink); background: var(--p-diamond), linear-gradient(#f1e6c9, #ddc9a0); background-size: 24px, auto; border-radius: 14px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.6); transition: transform .2s; }
.next a:hover { transform: translateY(-4px); } .next b { display: block; font: 22px "IM Fell English", serif; } .next span { font-size: 15px; color: #5a4636; }
.end-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.end-btns .big { min-width: 240px; }

/* ------------------------------------------------------------ phones */
@media (max-width: 760px) {
  :root { --rail-h: 108px; }
  #bar { padding: calc(8px + var(--safe-t)) 10px 18px; gap: 8px; }
  .crest img { width: 34px; height: 34px; } .crest b { font-size: 17px; } .crest span { font-size: 12px; }
  #bar nav { gap: 5px; } #bar nav button { padding: 8px; } #bar nav button span { display: none; }
  .seat.dn { top: calc(66px + var(--safe-t)); } .seat .medal { --size: 66px; } .seat.dn .medal { --size: 84px; }
  .seat.mara { left: 10px; top: calc(78px + var(--safe-t)); } .seat.toby { right: 10px; top: calc(78px + var(--safe-t)); }
  .seat .plate { min-width: 0; padding: 3px 9px 5px; } .seat .plate span { display: none; } .seat .plate b { font-size: 14px; }
  .runes { inset: -14px; width: calc(100% + 28px); height: calc(100% + 28px); }
  .badge { width: 24px; height: 24px; }
  #foes { top: calc(214px + var(--safe-t)); gap: 8px; } .foe { width: 112px; padding: 5px 5px 7px; } .foe .ph { height: 72px; } .foe b { font-size: 14px; } .foe span { font-size: 11px; }
  #say { left: 8px; right: 8px; bottom: calc(var(--rail-h) + 12px + var(--safe-b)); padding: 12px 15px 14px; }
  body.choosing #say, body.choosing.combat-choose #say { right: 8px; bottom: auto; top: calc(200px + var(--safe-t)); }
  #say .line { font-size: calc(18px * var(--ts)); max-height: 26vh; }
  #choices, #choices.combat { left: 8px; right: 8px; width: auto; bottom: calc(var(--rail-h) + 12px + var(--safe-b)); max-height: 46vh; }
  #choices.combat { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #choices.combat .choice small { display: none; } #choices.combat .choice { font-size: calc(15px * var(--ts)); padding: 9px 10px; } #choices.combat .choice .k { display: none; }
  .choice { font-size: calc(16px * var(--ts)); padding: 10px 12px; }
  #rail { gap: 12px; padding: 14px 10px calc(10px + var(--safe-b)); }
  .you { min-width: 0; } .you .you-txt { display: none; } .you .ring { width: 66px; height: 66px; padding: 5px; }
  .tray { width: 92px; height: 78px; } .mapcard { width: 82px; height: 68px; } .fan { width: 112px; height: 86px; } .fan .c { width: 52px; height: 70px; left: 26px; border-width: 3px; }
  #rail span.lbl, .tray > span, .mapcard > span, .fan > span { font-size: 9px; letter-spacing: 1px; bottom: -14px; }
  #dice { padding: 14px 14px 16px; } #dice .stage3d { width: 180px; height: 166px; }
  .vitals { grid-template-columns: repeat(2, 1fr); } .abils { grid-template-columns: repeat(3, 1fr); } .links { columns: 1; }
  .frame-orn { inset: 8px; } #title, #ending { inset: 9px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  :root { --rail-h: 96px; }
  .seat .medal { --size: 62px; } .seat.dn .medal { --size: 72px; } .seat .plate span { display: none; }
  .seat.mara, .seat.toby { top: 70px; }
  .you .you-txt { display: none; } .you .ring { width: 64px; height: 64px; } .tray { width: 90px; height: 74px; } .mapcard { width: 84px; height: 66px; } .fan { height: 80px; }
  #say .line { font-size: calc(17px * var(--ts)); max-height: 22vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body.rolling #say { opacity: .25; transition: opacity .3s; }
.pick .sub { text-shadow: 0 2px 6px #000, 0 0 18px #000; }
.title-inner .sub-top { margin-top: 14px; }              /* the tagline sits above the title; the title then leads into the buttons */
.title-inner .sub-top + h1 { margin: 16px 0 28px; }
@media (max-width: 700px) { .title-inner { padding-top: calc(78px + var(--safe-t)); } }   /* clear of the "Tap for sound" button */

/* ---------------------------------------------------------------- going back: exits, walking by map, you-are-here */
.choice.go .k { background: radial-gradient(circle at 35% 30%, #e9f3ff, #8fb3d9 50%, #3f6b99); color: #0d1a29; }
.choice.go .t::before { content: "\2192\00a0"; color: #9fc3ea; }
.choice.walk { border-style: dashed; background: rgba(20,14,10,.72); }
.choice.walk .k { background: none; color: var(--gold); box-shadow: inset 0 0 0 1.5px var(--gold); }
.choice.walk .k svg { width: 16px; height: 16px; }
.here-mark .pin { fill: #b3261e; stroke: #fff4dc; stroke-width: 3; }
.here-mark .pin-hole { fill: #fff4dc; }
.here-mark .here-label { font: 700 30px "Caveat", cursive; fill: #b3261e; paint-order: stroke; stroke: #fff8e8; stroke-width: 6px; stroke-linejoin: round; }
.here-mark .bob { animation: herebob 1.3s ease-in-out infinite; }
@keyframes herebob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.here-mark .ping { fill: none; stroke: #b3261e; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: hereping 2.4s ease-out infinite; }
.here-mark .ping.p2 { animation-delay: 1.2s; }
@keyframes hereping { from { transform: scale(.7); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
.mapcard .here-mark { transform-origin: center; }
.walk-spot rect { fill: rgba(63,107,153,.08); stroke: #3f6b99; stroke-width: 3; stroke-dasharray: 10 8; cursor: pointer; pointer-events: all; animation: walkdash 1.4s linear infinite; }
.walk-spot:hover rect, .walk-spot.sel rect { fill: rgba(63,107,153,.22); stroke-width: 4; }
.walk-spot.here rect { fill: none; stroke: #b3261e; stroke-dasharray: none; cursor: default; animation: none; opacity: .7; }
@keyframes walkdash { to { stroke-dashoffset: -36; } }
.walk-hint { margin: 0 0 8px; color: #7a2a12; font-size: 17px; font-weight: 700; }
.walk-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(63,107,153,.18); border: 1px solid #5b87b5; font-size: 17px; color: #22160e; }
.walk-bar span { flex: 1; min-width: 180px; }
@media (prefers-reduced-motion: reduce) {
  .here-mark .ping, .walk-spot rect { animation: none; }
  /* the "You are here!" pin keeps its slow, small bob even with reduced motion: it's how players find themselves */
  .here-mark .bob { animation: herebob 1.3s ease-in-out infinite !important; }
}
.walk-bar .btn { font: 18px "IM Fell English", serif; padding: 8px 20px; border-radius: 30px; border: 1px solid var(--gold); background: rgba(20,14,11,.82); color: var(--parch); cursor: pointer; }
.walk-bar .btn.primary { background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; border-color: #ffd894; }

.legal { margin: 18px auto 0; max-width: 640px; font-size: 12.5px; line-height: 1.45; color: #a8957a; text-align: center; }
.legal a { color: #cdb487; }

/* ---------------------------------------------------------------- "New to Open Dungeons?" popup */
.intro-modal .modal-card { max-width: 720px; width: 100%; }
.intro-banner { display: block; width: 100%; max-width: 520px; margin: 4px auto 18px; border-radius: 10px; border: 1px solid var(--gold3); }
.intro-modal .intro p { font-size: calc(18px * var(--ts)); line-height: 1.6; margin: 0 0 14px; color: #ecdcbc; }
.intro-modal .intro h3 { font: 26px "IM Fell English", serif; color: var(--gold); margin: 22px 0 10px; }
.intro-modal .intro h3.intro-cta { text-align: center; margin-top: 26px; }
.intro-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0 6px; }
.intro-btns .big { font-size: 20px; padding: 11px 22px; }

/* ---------------------------------------------------------------- music / sound check button */
.sound-btn { position: fixed; z-index: 55; top: calc(18px + var(--safe-t)); right: 22px; display: none; align-items: center; gap: 10px; padding: 9px 16px 9px 13px; border-radius: 30px; border: 1px solid var(--gold); background: rgba(16,10,7,.82); color: var(--parch); font: 16px "Alegreya", serif; cursor: pointer; }
body[data-screen="title"] .sound-btn { display: inline-flex; }
.sound-btn .bars { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.sound-btn .bars i { width: 4px; height: 6px; border-radius: 2px; background: var(--gold); }
.sound-btn.on .bars i { animation: eq 0.9s ease-in-out infinite; }
.sound-btn.on .bars i:nth-child(2) { animation-delay: .2s; } .sound-btn.on .bars i:nth-child(3) { animation-delay: .45s; } .sound-btn.on .bars i:nth-child(4) { animation-delay: .1s; }
@keyframes eq { 0%,100% { height: 5px; } 50% { height: 18px; } }
.sound-btn.off { animation: soundbeckon 1.8s ease-in-out infinite; }
@keyframes soundbeckon { 0%,100% { box-shadow: 0 0 0 0 rgba(232,194,122,.0); } 50% { box-shadow: 0 0 0 7px rgba(232,194,122,.25); } }
.sound-btn.muted { opacity: .75; } .sound-btn.muted .bars i { background: #8a7a62; }
@media (max-width: 700px) { .sound-btn { top: calc(26px + var(--safe-t)); right: 26px; font-size: 14px; padding: 7px 12px 7px 10px; } }
@media (prefers-reduced-motion: reduce) { .sound-btn.on .bars i, .sound-btn.off { animation: none; } }

/* ---------------------------------------------------------------- character pick: back button */
.pick-back-top { position: fixed; z-index: 3; top: calc(26px + var(--safe-t)); left: 28px; padding: 9px 18px 9px 14px; border-radius: 30px; border: 1px solid var(--gold); background: rgba(16,10,7,.82); color: var(--parch); font: 17px "Alegreya", serif; cursor: pointer; }
.pick-back-top span { color: var(--gold); margin-right: 4px; }
.pick-back-top:hover { border-color: #fff1c8; }
@media (max-width: 700px) { .pick-back-top { position: absolute; top: calc(30px + var(--safe-t)); left: 26px; font-size: 15px; padding: 7px 14px 7px 11px; } .pick { padding-top: calc(80px + var(--safe-t)); } }
.sound-btn.warn { border-color: #e0a15a; color: #ffd9a8; }
.sound-btn * { pointer-events: none; }
.sound-btn { min-width: 172px; justify-content: center; } @media (max-width: 700px) { .sound-btn { min-width: 150px; } }

/* footer playback controls */
#rail .ctl { display: flex; gap: 14px; flex: none; align-items: center; }
/* Jump to section: a chapter list right above rewind / pause / forward */
#rail .ctl-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: none; margin-top: -14px; }
#jump { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 260px; height: 32px; padding: 4px 32px 4px 12px; border-radius: 16px; border: 1px solid var(--gold2);
  background: #1c120b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 7l5-5 5 5' fill='none' stroke='%23e8c27a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
  color: var(--parch); font: 15px "IM Fell English", serif; letter-spacing: .5px; text-align: left; cursor: pointer; box-shadow: 0 6px 16px rgba(0,0,0,.45); transition: box-shadow .2s, border-color .2s; }
#jump .jl-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#jump .ki { flex: none; width: 16px; height: 16px; color: var(--gold); }
#jump:hover, #jump:focus-visible, #jump[aria-expanded="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,194,122,.4); outline: none; }
#jump:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
/* the chapter list, opened above the button */
#jump-list { position: fixed; z-index: 60; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 8px; border-radius: 14px; border: 1px solid var(--gold2);
  background: #140d08; box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 18px 48px rgba(0,0,0,.75); outline: none; scrollbar-width: thin; scrollbar-color: #6b5230 transparent; }
#jump-list[hidden] { display: none; }
#jump-list .jl-lvl { position: sticky; top: 0; z-index: 1; padding: 10px 16px 6px; background: #140d08; border-bottom: 1px solid rgba(232,194,122,.14);
  color: var(--gold); font: 600 11.5px/1 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: 1.6px; text-transform: uppercase; }
#jump-list .jl-opt { display: flex; align-items: center; gap: 11px; padding: 7px 16px 7px 14px; border-left: 3px solid transparent; cursor: pointer;
  color: var(--parch); font: 16px/1.3 "IM Fell English", serif; letter-spacing: .3px; }
#jump-list .jl-opt .ki { flex: none; width: 18px; height: 18px; color: var(--gold); }
#jump-list .jl-k { color: #a8957a; font-size: 14px; white-space: nowrap; }
#jump-list .jl-opt.act { background: rgba(232,194,122,.09); }
#jump-list .jl-opt[aria-selected="true"] { background: rgba(232,194,122,.16); border-left-color: var(--gold); }
@media (max-width: 760px) { #jump-list .jl-opt { padding: 9px 14px 9px 12px; font-size: 16.5px; } }
#rail .ctl-btn { position: relative; width: 64px; height: 64px; border-radius: 50% !important; background: radial-gradient(circle at 40% 35%, #3a2a1c, #120b07 75%) !important; color: var(--gold); box-shadow: 0 0 0 2px var(--gold2), 0 10px 22px rgba(0,0,0,.5); display: grid; place-items: center; transition: box-shadow .2s; }
#rail .ctl-btn svg { width: 46%; height: 46%; }
#rail .ctl-btn:hover, #rail .ctl-btn:focus-visible { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(232,194,122,.55); outline: none; }
#rail .ctl-btn:active { box-shadow: 0 0 0 3px var(--gold), 0 0 26px rgba(255,210,130,.7); }
#rail .ctl-btn > span { position: absolute; left: -10px; right: -10px; bottom: -20px; text-align: center; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: #d9c49c; pointer-events: none; }
body.paused #rail { z-index: 20; }
/* Exit along the bottom of every popup */
.modal-foot { position: sticky; bottom: -18px; display: flex; justify-content: center; margin: 18px -24px -18px; padding: 12px 24px 14px; background: linear-gradient(rgba(14,9,6,0), rgba(14,9,6,.92) 40%); border-radius: 0 0 18px 18px; z-index: 3; }
.modal-foot .exit { font: 18px "IM Fell English", serif; letter-spacing: 1px; min-width: 150px; padding: 10px 26px; border-radius: 26px; border: 1px solid var(--gold); background: #1c120b; color: var(--gold); cursor: pointer; }
.modal-foot .exit:hover, .modal-foot .exit:focus-visible { background: #2a1a10; box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,194,122,.45); outline: none; }
.card-modal .modal-foot { bottom: -14px; margin: 12px -14px -14px; padding: 10px 14px 12px; }
.card-modal .modal-foot, .map-modal-wrap .modal-foot, .sheet-modal .modal-foot { background: linear-gradient(rgba(60,40,20,0), rgba(60,40,20,.25) 40%); }
.card-modal .modal-foot .exit, .map-modal-wrap .modal-foot .exit, .sheet-modal .modal-foot .exit { background: #2a1a10; }
@media (max-width: 760px) {
  #rail .ctl { flex-direction: column; gap: 8px; }
  #rail .ctl-btn { width: 40px; height: 40px; } #rail .ctl-btn > span { display: none; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #rail .ctl-btn { width: 50px; height: 50px; }
}
@media (max-width: 760px) {
  #rail { gap: 10px; padding-left: 8px; padding-right: 8px; }
  .you { flex: none; } .you .ring { width: 58px; height: 58px; }
  .tray { width: 80px; height: 70px; } .mapcard { width: 72px; height: 62px; } .fan { width: 88px; }
  .fan .c { left: 16px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #rail { gap: 16px; }
  .you { min-width: 0; flex: none; } .fan { width: 150px; }
  #rail .ctl { gap: 10px; }
}

/* captions: hidden by default, one tap to show */
#cc-btn { position: absolute; top: 12px; right: 16px; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 20px; border: 1px solid var(--gold3); background: rgba(12,8,5,.7); color: #e9d8b4; font: 14px "Alegreya", serif; cursor: pointer; z-index: 2; }
#cc-btn b { font: 700 11px "Alegreya", serif; letter-spacing: 1px; padding: 2px 5px; border-radius: 4px; border: 1.5px solid currentColor; color: var(--gold); }
#cc-btn:hover, #cc-btn:focus-visible { border-color: var(--gold); box-shadow: 0 0 14px rgba(232,194,122,.35); outline: none; }
body:not(.cc-off) #cc-btn { opacity: .75; } body:not(.cc-off) #cc-btn:hover { opacity: 1; }
body.cc-off #say { padding-top: 14px; padding-bottom: 14px; }
body.cc-off #say .who { margin-bottom: 0; line-height: 28px; }
body.cc-off #say .line { display: none; }
#say .who { padding-right: 170px; }
@media (max-width: 760px) { #cc-btn { top: 9px; right: 10px; padding: 4px 10px 4px 6px; font-size: 12.5px; } #say .who { padding-right: 140px; } }

/* "Be first to know" sign-up (title and ending screens) */
.signup { width: min(470px, 100%); margin: 4px auto 18px; text-align: center; }
.signup label { display: block; font: 19px "IM Fell English", serif; color: var(--parch); text-shadow: 0 2px 8px #000; margin-bottom: 8px; }
.su-row { display: flex; border: 1px solid var(--gold2); border-radius: 40px; background: rgba(20,14,11,.82); overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.su-row:focus-within { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,194,122,.3), 0 8px 24px rgba(0,0,0,.45); }
.su-row input[type=email] { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--parch); font: 17px "Alegreya", serif; padding: 12px 18px; outline: none; }
.su-row input::placeholder { color: #9d8a6c; }
.su-row button { flex: none; border: 0; border-left: 1px solid var(--gold2); background: linear-gradient(#ecb260, #b8702a); color: #1b0f06; font: 19px "IM Fell English", serif; padding: 0 22px; cursor: pointer; }
.su-row button:hover { filter: brightness(1.08); } .su-row button:disabled { filter: grayscale(.6); cursor: wait; }
.su-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.su-msg { font-size: 14px; color: #cdbb9a; margin: 7px 0 0; text-shadow: 0 2px 6px #000; min-height: 1.2em; }
.signup.bad .su-msg { color: #ffb4a8; } .signup.bad .su-row { border-color: #d9826f; }
.signup.joined p { font: 18px "IM Fell English", serif; color: var(--gold); text-shadow: 0 2px 8px #000; margin: 0; }
.end-card .signup { margin-top: 14px; }
@media (max-width: 420px) {
  .su-row { flex-direction: column; border-radius: 18px; }
  .su-row input[type=email] { text-align: center; }
  .su-row button { border-left: 0; border-top: 1px solid var(--gold2); padding: 11px; }
}

/* ---------------------------------------------------------------- footer fit (rewind / pause / forward)
   desktop: one row. 941-1240: one row, scaled down. up to 940 (phones, upright tablets): two rows,
   a slim playback bar on top like a media app, sheet / dice / map / handouts below. */
@media (min-width: 941px) and (max-width: 1240px) and (min-height: 561px) {
  #rail { gap: 16px; padding-left: 22px; padding-right: 22px; }
  .you { min-width: 0; gap: 10px; } .you .ring { width: 80px; height: 80px; } .you b { font-size: 19px; }
  .tray { width: 122px; height: 104px; } .mapcard { width: 114px; height: 92px; } .fan { width: 176px; }
  .fan .c { left: 40px; width: 78px; height: 104px; }
  #rail .ctl { gap: 10px; } #rail .ctl-btn { width: 52px; height: 52px; }
}
@media (max-width: 940px) and (min-height: 561px) {
  :root { --rail-h: 224px; }
  #rail { flex-wrap: wrap; align-content: space-between; row-gap: 10px; padding-top: 22px; padding-bottom: calc(28px + var(--safe-b)); }
  #rail .ctl-wrap { order: -1; flex: 0 0 100%; gap: 8px; margin-top: 0; }
  #rail .ctl { flex-direction: row; justify-content: center; gap: 26px; }
  #jump { max-width: min(300px, 80vw); height: 30px; font-size: 14px; }
  #rail .ctl-btn { width: 40px; height: 40px; } #rail .ctl-btn > span { display: none; }
  #rail .ctl-btn#rail-pause { width: 46px; height: 46px; }
  #rail .ctl-btn svg { width: 50%; height: 50%; }
}
@media (min-width: 761px) and (max-width: 940px) and (min-height: 561px) {
  :root { --rail-h: 260px; }
  #rail { gap: 20px; }
  .you { min-width: 0; } .you .ring { width: 78px; height: 78px; }
  .tray { width: 116px; height: 98px; } .mapcard { width: 108px; height: 86px; } .fan { width: 160px; }
  .fan .c { left: 36px; width: 74px; height: 98px; }
}
@media (max-width: 380px) and (min-height: 561px) {
  #rail { gap: 7px; padding-left: 6px; padding-right: 6px; }
  .you .ring { width: 52px; height: 52px; }
  .tray { width: 72px; height: 64px; } .mapcard { width: 64px; height: 56px; } .fan { width: 78px; }
  .fan .c { left: 12px; }
}
@media (max-height: 560px) and (orientation: landscape) {
  #rail { align-items: flex-start; padding-top: 12px; }
  .you .ring { width: 56px; height: 56px; } .tray { width: 76px; height: 58px; } .mapcard { width: 70px; height: 54px; }
  .tray > span, .mapcard > span, .fan > span { white-space: nowrap; font-size: 10px; letter-spacing: 1px; bottom: -16px; left: -12px; right: -12px; }
  #rail .ctl-wrap { flex-direction: row; align-self: center; gap: 10px; margin-top: 0; }
  #jump { width: 150px; height: 30px; font-size: 13px; }
  #rail .ctl { gap: 8px; align-self: center; } #rail .ctl-btn { width: 44px; height: 44px; } #rail .ctl-btn > span { display: none; }
}

/* @glow: a control someone is pointing at glows green for 8 s, or until tapped.
   --own keeps each control's own shadow (the dice tray's frame, the map's drop shadow) under the glow. */
.glow { animation: glowgreen 1.3s ease-in-out infinite; }
.tray.glow { --own: inset 0 0 0 5px #3a2214, inset 0 0 0 7px var(--gold3); }
.mapcard.glow { --own: 0 10px 22px rgba(0,0,0,.5); }
.fan.glow { border-radius: 16px; }
#rail .ctl-btn.glow { --own: 0 10px 22px rgba(0,0,0,.5); }
#you.glow { animation: none; }
#you.glow .ring { --own: 0 10px 26px rgba(0,0,0,.5); animation: glowgreen 1.3s ease-in-out infinite; }
#you.glow b { color: #b8ffcf; transition: color .3s; }
@keyframes glowgreen {
  0%, 100% { box-shadow: var(--own, 0 0 #0000), 0 0 0 2px rgba(120,255,160,.9), 0 0 14px 3px rgba(60,230,120,.55); }
  50% { box-shadow: var(--own, 0 0 #0000), 0 0 0 2px rgba(150,255,185,1), 0 0 30px 10px rgba(60,240,130,.8); }
}
@media (prefers-reduced-motion: reduce) {
  .glow, #you.glow .ring { animation: none; box-shadow: var(--own, 0 0 #0000), 0 0 0 2px rgba(120,255,160,.9), 0 0 22px 6px rgba(60,230,120,.7); }
}

/* speech box tools: Skip intro (only during the table introductions) beside CC */
.say-tools { position: absolute; top: 12px; right: 16px; display: flex; gap: 8px; align-items: center; z-index: 2; }
.say-tools #cc-btn { position: static; }
#skip-intro { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 14px; border-radius: 20px; border: 1px solid var(--gold); background: rgba(40,26,14,.85); color: var(--gold); font: 14px "Alegreya", serif; cursor: pointer; }
#skip-intro svg { width: 15px; height: 15px; }
#skip-intro:hover, #skip-intro:focus-visible { background: #3a2614; box-shadow: 0 0 14px rgba(232,194,122,.35); outline: none; }
body.intro #say .who { padding-right: 290px; }
@media (max-width: 760px) {
  .say-tools { top: 9px; right: 10px; gap: 6px; }
  #skip-intro { padding: 4px 10px 4px 11px; font-size: 12.5px; }
  body.intro #say .who { padding-right: 230px; }
}

/* no filigree border along the top bar or the footer */
#bar::after, #rail::before { display: none; }
/* wide screens: room under the footer tiles for their labels (Your dice, Toby's map, Handouts) */
@media (min-width: 941px) and (min-height: 561px) {
  #rail { padding-top: 8px; padding-bottom: calc(30px + var(--safe-b)); }
}
/* the handouts fan matches the dice tray's height so its label lines up with the others */
@media (min-width: 761px) and (max-width: 940px) and (min-height: 561px) {
  :root { --rail-h: 236px; }
  #rail { padding-bottom: calc(40px + var(--safe-b)); }
  .fan { height: 98px; }
}
@media (max-height: 560px) and (orientation: landscape) { .fan { height: 58px; } .fan .c { height: 58px; width: 44px; bottom: 4px; } }
@media (max-width: 760px) and (min-height: 561px) { .fan { height: 70px; } }

/* Skip intro glows red for as long as it is offered */
#skip-intro { border-color: #e2554a; color: #ffd6cf; animation: skipglow 1.6s ease-in-out infinite; }
#skip-intro:hover, #skip-intro:focus-visible { background: #4a1712; }
@keyframes skipglow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(226,85,74,.6), 0 0 8px 1px rgba(226,60,50,.45); }
  50% { box-shadow: 0 0 0 1px rgba(255,120,105,.9), 0 0 20px 5px rgba(240,60,45,.75); }
}
/* the map can glow and wiggle (Toby drawing) at the same time */
.mapcard.drawing.glow { animation: wiggle .3s ease-in-out infinite alternate, glowgreen 1.3s ease-in-out infinite; }

/* popups and the dice panel: plain background so the text reads cleanly (no diamond pattern) */
.modal-card { background: radial-gradient(ellipse at 50% 0%, #2a1a12, #120b08 70%); }
.card-modal .modal-card { background: #efe5cd; } .map-modal-wrap .modal-card { background: #e9e3d4; } .sheet-modal .modal-card { background: #f0e5cb; }
#dice { background: radial-gradient(ellipse at 50% 30%, #2a1a12, #0e0806 80%); }
/* the blank map: graph paper with a short note */
.map-blank { display: grid; place-items: center; min-height: 320px; }
.map-blank p { font: 700 22px "Caveat", cursive; color: #5a4636; text-align: center; padding: 0 20px; margin: 0; }

/* no squiggly filigree lines anywhere: title / picker / ending frame, caption box, dice panel */
.frame-orn::before, .frame-orn::after, #say::before, #dice::before { display: none; }

/* speaking: a big two-layer glow in the speaker's own color that swells with the voice,
   brighter band and icon, a slight grow, and the name plate lit.
   The glow is drawn once (.medal::after) and the voice only changes its size and brightness
   (transform + opacity), which phones do on the graphics chip without redrawing anything. */
.seat { --seat: 255,200,120; } .seat.mara { --seat: 196,150,255; } .seat.toby { --seat: 120,195,255; }
.seat .medal { transition: scale .12s ease-out; }
.seat.speaking .medal {
  scale: calc(1 + var(--lvl, .4) * .07);
  box-shadow: 0 14px 40px rgba(0,0,0,.6), 0 0 0 3px rgba(var(--seat), .95);
}
.seat .medal::after { content: ""; position: absolute; inset: calc(-1 * var(--glow, 170px)); z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle closest-side, rgba(var(--seat), .95) calc(var(--size) / 2), rgba(var(--seat), .6) calc(var(--size) / 2 + var(--glow, 170px) * .2),
    rgba(var(--seat), .28) calc(var(--size) / 2 + var(--glow, 170px) * .5), rgba(var(--seat), .08) calc(var(--size) / 2 + var(--glow, 170px) * .8), rgba(var(--seat), 0) 100%);
  opacity: 0; transform: scale(.8); transition: opacity .25s ease-out, transform .12s ease-out; will-change: opacity, transform; }
@media (max-width: 760px) { .seat .medal::after { --glow: 120px; } }
.seat.speaking .medal::after { opacity: calc(.62 + var(--lvl, .4) * .38); transform: scale(calc(.92 + var(--lvl, .4) * .32)); }
.seat.speaking .band { filter: brightness(1.45) saturate(1.6); }
.seat.speaking .core { box-shadow: inset 0 0 0 2px rgba(var(--seat), .9), inset 0 0 26px rgba(var(--seat), .55); }
.seat.speaking .core svg { filter: brightness(1.5) saturate(1.5); }
.seat.speaking .plate { border-color: rgba(var(--seat), .9); box-shadow: 0 0 18px rgba(var(--seat), .45); }
.seat.speaking .plate b { text-shadow: 0 0 12px rgba(var(--seat), .9); }
@media (prefers-reduced-motion: reduce) { .seat.speaking .medal { scale: 1.04; } }

/* name plates sit a little lower, clear of the medal (the DN's rune ring reaches further) */
.seat { gap: 22px; } .seat.dn { gap: 50px; }
@media (max-width: 760px) { .seat { gap: 12px; } .seat.dn { gap: 32px; } }
@media (max-height: 560px) and (orientation: landscape) { .seat { gap: 10px; } .seat.dn { gap: 20px; } }

/* "More adventures": email sign-up link. Desktop: in the empty middle of the bottom bar. Phones and tablets: an icon in the top bar. */
#rail .rail-sub { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 10px; padding: 11px 22px 11px 18px; border-radius: 30px;
  border: 1px solid var(--gold2); background: rgba(22,14,9,.88); color: var(--parch); font: 19px "IM Fell English", serif; letter-spacing: .4px; white-space: nowrap; cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.45); transition: box-shadow .2s, border-color .2s; }
#rail .rail-sub svg { width: 22px; height: 22px; color: var(--gold); flex: none; }
#rail .rail-sub:hover, #rail .rail-sub:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(232,194,122,.45); outline: none; }
#bar nav #btn-sub { display: none; }
@media (max-width: 1240px) { #rail .rail-sub span { display: none; } #rail .rail-sub { padding: 12px; } }
@media (max-width: 940px), (max-height: 560px) and (orientation: landscape) { #rail .rail-subwrap { display: none; } #bar nav #btn-sub { display: flex; } }
/* small phones: the top bar keeps the OD crest, the title text makes room for the icons (the chapter name is in the bottom dropdown) */
@media (max-width: 440px) { .crest div { display: none; } }
.sub-modal .modal-card { max-width: 560px; text-align: center; }
.sub-modal .sub-pitch { margin: 0 0 18px; font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #e9dcc0; }
.sub-modal .signup { margin-bottom: 4px; }

/* Mute: after Show captions in the speech box. Glows red while on. */
#mute-btn { display: flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: 20px; border: 1px solid var(--gold3); background: rgba(12,8,5,.7); color: #e9d8b4; font: 14px "Alegreya", serif; cursor: pointer; transition: box-shadow .2s, border-color .2s, color .2s; }
#mute-btn svg { width: 17px; height: 17px; color: var(--gold); }
#mute-btn .w-off { display: none; }
#mute-btn:hover, #mute-btn:focus-visible { border-color: var(--gold); box-shadow: 0 0 14px rgba(232,194,122,.35); outline: none; }
#mute-btn.on { border-color: #ff4a3d; color: #ffd9d4; background: rgba(70,10,8,.85); box-shadow: 0 0 0 1px #ff4a3d, 0 0 16px 3px rgba(255,60,45,.65); animation: mutePulse 1.8s ease-in-out infinite !important; }
#mute-btn.on:hover, #mute-btn.on:focus-visible { border-color: #ff4a3d; }
#mute-btn.on svg { color: #ff6b5f; }
#mute-btn.on .w-on { display: none; } #mute-btn.on .w-off { display: inline; }
@keyframes mutePulse { 0%, 100% { box-shadow: 0 0 0 1px #ff4a3d, 0 0 12px 2px rgba(255,60,45,.5); } 50% { box-shadow: 0 0 0 1px #ff4a3d, 0 0 22px 6px rgba(255,60,45,.8); } }
#say .who { padding-right: 270px; }
body.intro #say .who { padding-right: 390px; }
@media (max-width: 760px) {
  #mute-btn { padding: 4px 8px; font-size: 12.5px; }
  #mute-btn span { display: none; }
  #say .who { padding-right: 175px; }
  body.intro #say .who { padding-right: 265px; }
}

/* Beta Early Access badge, top of the title screen: a slow light sweep now and then (still for reduced motion) */
.beta-badge { border: 0; padding: 0; background: none; cursor: pointer; transition: transform .2s, box-shadow .2s; position: relative; display: inline-block; width: clamp(210px, 30vw, 290px); border-radius: 999px; overflow: hidden; line-height: 0; margin: 0 0 16px; box-shadow: 0 6px 22px rgba(0,0,0,.5); }
.beta-badge img { display: block; width: 100%; height: auto; }
.beta-badge::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 36%, rgba(255,255,255,.34) 48%, rgba(255,255,255,.1) 54%, transparent 62%); transform: translateX(-130%); animation: betaShine 7s ease-in-out 1.5s infinite; }
@keyframes betaShine { 0% { transform: translateX(-130%); } 20%, 100% { transform: translateX(130%); } }
@media (prefers-reduced-motion: reduce) { .beta-badge::after { display: none; } }
.beta-badge:hover, .beta-badge:focus-visible { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--gold), 0 8px 26px rgba(0,0,0,.55); outline: none; }
/* the Beta popup */
.beta-modal .modal-card { max-width: 620px; width: 100%; }
.beta-info .beta-top { display: block; width: min(280px, 80%); height: auto; margin: 2px auto 16px; border-radius: 999px; }
.beta-info .mh { text-align: center; color: var(--gold); }
.beta-info p, .beta-info li { font: calc(18px * var(--ts)) / 1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #ecdcbc; }
.beta-info p { margin: 0 0 12px; }
.beta-info h3 { font: 24px "IM Fell English", serif; color: var(--gold); margin: 20px 0 8px; }
.beta-info ul { margin: 0 0 6px; padding-left: 22px; }
.beta-info li { margin: 0 0 8px; }
/* the Beta badge, toned down to a warm grey-brown */
.beta-badge img, .rail-beta img, .beta-info .beta-top { filter: grayscale(.85) sepia(.7) brightness(.72) contrast(.95); }
/* "More adventures" with the Beta badge under it: two separate buttons, stacked, centered in the bar together */
#rail > .rail-subwrap { margin-left: auto; flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
#rail .rail-subwrap .rail-sub { margin-left: 0; }
.rail-beta { display: block; padding: 0; border: 0; background: none; border-radius: 999px; line-height: 0; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.5); transition: box-shadow .2s; }
.rail-beta img { display: block; width: 0; min-width: 100%; height: auto; border-radius: 999px; }   /* as wide as the button above, never wider */
.rail-beta:hover, .rail-beta:focus-visible { box-shadow: 0 0 0 2px var(--gold), 0 4px 14px rgba(0,0,0,.5); outline: none; }
@media (max-width: 1240px) { .rail-beta { display: none; } }
@media (max-width: 940px), (max-height: 560px) and (orientation: landscape) { #rail > .rail-subwrap { display: none; } }   /* phones: the top bar has the envelope */
/* phones and small screens: Play / Pause is the big one in the middle */
@media (max-width: 940px) and (min-height: 561px) { #rail .ctl-btn#rail-pause { width: 62px; height: 62px; } #rail .ctl-btn#rail-pause svg { width: 50%; height: 50%; } #rail .ctl-btn:not(#rail-pause) { width: 44px; height: 44px; } }
@media (max-height: 560px) and (orientation: landscape) { #rail .ctl-btn#rail-pause { width: 56px; height: 56px; } }
@media (min-width: 761px) and (max-width: 940px) and (min-height: 561px) { :root { --rail-h: 266px; } #rail { padding-bottom: calc(52px + var(--safe-b)); } }   /* room for the bigger Play / Pause, and the labels under the dice, map and handouts */
@media (min-width: 761px) and (max-width: 940px) { #bar nav { gap: 6px; } #bar nav button { padding: 8px 10px; gap: 5px; } }   /* tablets: the labelled buttons stay clear of the logo */
@media (min-width: 761px) and (max-width: 800px) { #bar nav { gap: 5px; } #bar nav button { padding: 8px 8px; gap: 4px; font-size: 14px; } }
/* sheet: what each ability is doing right now */
.ab-tag { display: inline-block; margin-left: 6px; padding: 3px 10px 4px; border-radius: 20px; font: 700 13px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; letter-spacing: .3px; white-space: nowrap; vertical-align: 2px; }
.ab-tag.ok { background: #2f6b2a; color: #fff; }
.ab-tag.used { background: #d6c9ad; color: #000; }
.ab-tag.fight { background: #7a1d12; color: #fff; }
.ab-tag.on { background: #fff8e8; color: #000; border: 1px solid #b39a72; }
.ab-tag.table { background: none; color: #3b2f22; border: 1px dashed #9c8762; }
.potion-drink:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.potion .potion-wait { display: block; margin-top: 4px; font-size: 15px; font-style: italic; color: #000; }
/* Share: the top bar button, the popup (desktop), the handout card button, the ending button */
.share-modal .modal-card { width: min(460px, 100%); text-align: center; border-color: var(--gold2); }
.share-modal .mh { margin-bottom: 10px; }
.share-prev { display: block; max-width: 100%; max-height: 220px; margin: 0 auto 12px; border-radius: 8px; box-shadow: 0 8px 22px rgba(0,0,0,.6); }
.share-text { margin: 0 0 16px; color: var(--parch); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.share-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-btns a, .share-btns button { display: flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(rgba(58,38,24,.95), rgba(26,16,10,.95)); color: var(--parch); font: 600 14.5px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.share-btns a:hover, .share-btns button:hover, .share-btns a:focus-visible, .share-btns button:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); outline: none; }
.share-btns .share-copy { border-color: var(--gold2); color: var(--gold); }
.share-url { margin: 14px 0 0; color: #a8957a; font: 13px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; word-break: break-all; }
@media (max-width: 420px) { .share-btns { grid-template-columns: repeat(2, 1fr); } }
.card-share, .end-share { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.card-share { margin: 10px auto 2px; padding: 7px 16px 7px 13px; border-radius: 20px; border: 1px solid rgba(43,29,18,.45); background: rgba(43,29,18,.08); color: var(--ink); font: 700 15px "Alegreya", serif; }
.card-share:hover, .card-share:focus-visible { background: rgba(43,29,18,.16); border-color: rgba(43,29,18,.8); outline: none; }
.card-modal .modal-card { text-align: center; }
.card-share svg, .end-share svg { width: 18px; height: 18px; flex: none; }
.end-share { margin: 22px auto 0; padding: 10px 22px 10px 18px; border-radius: 24px; border: 1px solid var(--gold2); background: rgba(20,13,8,.6); color: var(--gold); font: 18px "IM Fell English", serif; letter-spacing: .5px; }
.end-share:hover, .end-share:focus-visible { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,194,122,.35); outline: none; }
/* tablets and landscape phones: Share is icon-only so the labelled buttons stay clear of the logo */
@media (max-width: 940px), (max-height: 560px) and (orientation: landscape) { #bar nav #btn-share span { display: none; } }
/* Handouts gallery: a real width, so big screens get a grid instead of one skinny column */
.cards-modal .modal-card { width: min(940px, 100%); }
.cards-modal .gallery { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.cards-modal .gallery img { height: 124px; }
@media (max-width: 420px) { .cards-modal .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; } .cards-modal .gallery img { height: 100px; } }
/* the potion: "One use." in red, and Drink it / Give to Sable / Give to Hollis */
.potion { flex-wrap: wrap; }
.potion .potion-info { flex: 1 1 220px; min-width: 0; }
.potion .one-use { color: #b3170c; font-weight: 700; }
.potion-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.potion-acts .potion-drink { font-size: 16px; padding: 7px 14px; }
.potion-acts .potion-give { color: #1b0f06; background: #fff8e8; border: 1.5px solid #b8702a; }
.potion-acts .potion-give:not(:disabled):hover { background: #f6e3c0; }
.potion-acts .potion-drink small { font: 600 13px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; opacity: .75; margin-left: 3px; }
@media (max-width: 520px) { .potion-acts { justify-content: flex-start; width: 100%; } }
/* Kickstarter badge and its popup */
.ks-badge { display: block; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer; width: min(360px, 100%); border-radius: 999px; transition: transform .2s, filter .2s; }
.ks-badge img { display: block; width: 100%; height: auto; }
.ks-badge:hover, .ks-badge:focus-visible { transform: translateY(-2px); filter: brightness(1.12); outline: none; }
.sub-ks { margin: 18px 0 2px; }
.end-ks { margin: 30px 0 0; } .end-ks .ks-badge { width: min(420px, 100%); }
.ks-modal .modal-card { max-width: 620px; width: 100%; }
.ks-info .ks-top { display: block; width: min(340px, 86%); height: auto; margin: 0 auto 14px; }
.ks-info { text-align: center; }
.ks-info p { text-align: left; }
.ks-go { display: inline-block; margin: 8px auto 0; padding: 12px 26px; border-radius: 30px; background: #05ce78; color: #052e1b; font: 700 17px system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; text-decoration: none; box-shadow: 0 6px 18px rgba(0,0,0,.45); transition: transform .15s, box-shadow .15s; }
.ks-go:hover, .ks-go:focus-visible { transform: translateY(-1px); box-shadow: 0 0 0 2px #e9fff4, 0 8px 22px rgba(0,0,0,.5); outline: none; }
.ks-info p.ks-note { text-align: center; margin: 8px 0 0; font-size: 14px; color: #a8957a; }
.beta-ks { margin: 20px 0 2px; }

/* phones only: the media-volume tip under the title buttons */
.hint-phone { display: none; }
@media (pointer: coarse) { .hint-phone { display: block; margin-top: 4px; } }

/* "Tap for sound": shown only when a phone has the game's sound asleep as a voice is due */
#tap-sound { position: fixed; z-index: 80; left: 50%; top: 42%; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 26px; border-radius: 40px; border: 2px solid var(--gold); background: rgba(16,10,7,.94); color: var(--parch);
  font: 20px "Alegreya", serif; white-space: nowrap; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,.6); animation: tapsound 1.6s ease-in-out infinite; }
#tap-sound[hidden] { display: none; }
#tap-sound svg { width: 26px; height: 26px; color: var(--gold); }
@keyframes tapsound { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.05); } }

