/* SPDX-License-Identifier: MIT - Copyright (C) 2026 Gonzi Audio - Beat & Dungeon in a browser:
   1-bit pictures (ink and bone, Obra Dinn) inside old RPG windows (Ultima), one accent: blood red. */
@font-face { font-family: "Jacquard 24"; src: url(fonts/bd-jacquard.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "Silkscreen"; src: url(fonts/silkscreen-latin-400-normal.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "VT323"; src: url(fonts/vt323-latin-400-normal.woff2) format("woff2"); font-display: block; }
@font-face { font-family: "IM Fell English"; font-style: italic; src: url(fonts/IMFeENit28P.ttf); font-display: swap; }

:root {
  --c-ink: #17130f; --c-bone: #e9dfc4; --page: #0c0a08; --deep: #0c0a08;
  --ink: #17130f; --bone: #e9dfc4; --blood: #a3191b; --red: #a3191b; --dim: #6a604e;
  --title: "Jacquard 24", serif; --px: "Silkscreen", monospace; --body: "VT323", monospace; --book: "IM Fell English", Georgia, serif;
  /* 1-bit tones (2 px dots) */
  --d50: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM2 2h2v2H2z' fill='%2317130f'/%3E%3C/svg%3E");
  --d25: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0z' fill='%2317130f'/%3E%3C/svg%3E");
  --d12: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM4 4h2v2H4z' fill='%2317130f'/%3E%3C/svg%3E");
  --b12: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM4 4h2v2H4z' fill='%23e9dfc4'/%3E%3C/svg%3E");
  --b25: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0z' fill='%23e9dfc4'/%3E%3C/svg%3E");
  --r50: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM2 2h2v2H2z' fill='%23a3191b'/%3E%3C/svg%3E");
  /* an old RPG window: ink line, bone gap, ink line */
  --frame: inset 0 0 0 2px var(--ink), inset 0 0 0 5px var(--bone), inset 0 0 0 6px var(--ink);
  --frame-inv: inset 0 0 0 2px var(--bone), inset 0 0 0 5px var(--ink), inset 0 0 0 6px var(--bone);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page) url(img/1b/wall.png) 0 0 / 512px 512px; image-rendering: pixelated; }
/* a soft darkening of the edges, pinned to the screen (a fixed background is unreliable on phones) */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at 50% 40%, transparent 30%, #0007 100%); }
html, body { margin: 0; color: var(--ink); font: 24px/1.08 var(--body); }
body { display: flex; justify-content: center; padding: clamp(0px, 2vw, 26px); background: transparent; }
body > * { image-rendering: auto; }
img { image-rendering: pixelated; image-rendering: crisp-edges; }
#app {
  position: relative; width: min(1280px, 100%); min-height: min(720px, 100vh); background: var(--bone);
  box-shadow: 0 0 0 3px var(--bone), 0 0 0 6px var(--ink), 0 0 0 8px var(--bone), 12px 12px 0 8px #000;
}
/* the four corner studs of the window */
#app::before, #app::after { content: ""; position: absolute; width: 14px; height: 14px; background: var(--bone); border: 3px solid var(--ink); z-index: 9; pointer-events: none; }
#app::before { left: -13px; top: -13px; }
#app::after { right: -13px; bottom: -13px; }
.loading { display: grid; place-items: center; height: 70vh; font: 64px var(--title); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; border-radius: 0; touch-action: manipulation; }
/* a long press on LANCER (= a hard pad hit) must not open the phone's text menu */
.seal { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
h1, h2, h3 { font-family: var(--title); font-weight: normal; margin: 0; letter-spacing: .01em; }
h2 { font-size: clamp(44px, 5vw, 64px); line-height: 1; text-align: center; }
h4 { font: 14px var(--px); margin: 16px 0 8px; letter-spacing: .04em; text-transform: uppercase; }
.red { color: var(--red) !important; } .gold { color: var(--ink); }
.hint, small, .foot { color: var(--dim); font-size: 20px; }
.lead { text-align: center; font: italic 22px/1.25 var(--book); margin: 8px auto 18px; max-width: 900px; }
.page { padding: 26px clamp(16px, 3vw, 40px) 32px; position: relative; }
::selection { background: var(--ink); color: var(--bone); }
:focus-visible { outline: 2px dashed var(--blood); outline-offset: 3px; }

/* ---- the menu bar */
.tabs { display: flex; gap: 0; background: var(--ink); padding: 0 10px; position: relative; z-index: 2; flex-wrap: wrap; border-bottom: 3px solid var(--ink); }
.tabs.hidden { display: none; }
.tabs button { font: 15px var(--px); letter-spacing: .06em; background: transparent; border: none; color: var(--bone); padding: 10px 16px 9px; text-transform: uppercase; }
.tabs button:not(.on):hover { box-shadow: inset 0 -3px 0 var(--bone); }
.tabs button.on { background: var(--bone); color: var(--ink); }
.tabs button.on::before { content: "\25B8 "; color: var(--red); }
.tabs .sp { flex: 1; }
.tabs .icon { width: 46px; padding: 10px 0; font-family: var(--body); font-size: 22px; }

/* ---- buttons */
.btn { font: 15px var(--px); letter-spacing: .05em; text-transform: uppercase; background: var(--bone); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 11px 20px 10px; transition: none; position: relative; }
.btn:hover { background: var(--ink); color: var(--bone); }
.btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn.small { font-size: 13px; padding: 8px 13px 7px; box-shadow: 3px 3px 0 var(--ink); }
.btn.small:active { transform: translate(3px, 3px); }
.btn.wide { width: 100%; font-size: 17px; padding: 15px; }
.btn.go { position: absolute; right: 40px; bottom: 40px; font-size: 18px; padding: 15px 30px; }
.btn.wide::before, .btn.go::before { content: "\25B8 "; color: var(--red); }
.btn:hover::before { color: var(--bone); }
.chip { font: 14px var(--px); letter-spacing: .04em; text-transform: uppercase; background: var(--bone); border: 2px solid var(--ink); padding: 8px 12px 7px; margin: 3px; }
.chip:not(.on):hover { box-shadow: inset 0 0 0 2px var(--ink); }
.chip.on { background: var(--ink); color: var(--bone); }
.chip.on::before { content: "\25A0 "; color: var(--red); }
.chip.role { min-width: 120px; font-size: 14px; padding: 11px 12px 10px; }
.roles.small .chip, .roles.small .chip.role { min-width: 0; font-size: 12px; padding: 6px 8px 5px; }
.seal { --st: polygon(8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%, 8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px), 0 8px, 4px 8px, 4px 4px, 8px 4px);
  min-width: 136px; height: 66px; padding: 3px; border: none; position: relative; background: var(--c-ink); clip-path: var(--st); display: inline-flex; vertical-align: middle; }
/* layers: ink outline > blood > bone line > blood, the word on top */
.seal span { position: relative; flex: 1; isolation: isolate; display: grid; place-items: center; padding: 0 20px; white-space: nowrap;
  font: 16px var(--px); letter-spacing: .06em; color: var(--c-bone); background: var(--blood); clip-path: var(--st); }
.seal span::before, .seal span::after { content: ""; position: absolute; z-index: -1; clip-path: var(--st); }
.seal span::before { inset: 3px; background: var(--c-bone); }
.seal span::after { inset: 5px; background: var(--blood); }
.seal:hover span::after { background: var(--c-ink); }
.seal:active { transform: translate(2px, 2px); }
.seal.charging span::after { animation: charge 1.2s steps(6) forwards; }
@keyframes charge { from { background: var(--blood); } 50% { background: var(--c-ink); } to { background: var(--c-bone); } }
.seal.charging span { animation: chargetext 1.2s steps(6) forwards; }
@keyframes chargetext { to { color: var(--red); } }
.seal.big { height: 84px; min-width: 190px; font-size: 22px; } .seal.big span { font-size: 22px; padding: 0 30px; }
.seal.small { height: 50px; min-width: 104px; font-size: 12px; } .seal.small span { font-size: 12px; padding: 0 16px; }
.seal.corner { position: absolute; right: 40px; bottom: 34px; } .seal.corner.left { right: auto; left: 40px; }

/* ---- cards: windows */
.card { position: relative; background: var(--bone); box-shadow: var(--frame), 5px 5px 0 var(--ink); padding: 18px 22px; }
.card .kicker { font: 12px var(--px); letter-spacing: .06em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.card .kicker.center { justify-content: center; }
.card h3 { font-size: 42px; line-height: .95; margin: 6px 0 6px; }
.card p { margin: 4px 0; font-size: 25px; line-height: 1.05; }
.rule { padding-left: 104px; min-height: 150px; }
.rule .cap { position: absolute; left: 20px; top: 20px; width: 66px; height: 66px; background: var(--ink); color: var(--bone); font: 62px/66px var(--title); text-align: center;
  box-shadow: 0 0 0 2px var(--bone), 0 0 0 4px var(--ink); }
.rule .meta { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rule.crit { box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--blood); }
.rule.crit .cap { background: var(--blood); color: var(--c-bone); }
.rule.crit h3 { color: var(--red); }
.rule.dim { opacity: 1; } .rule.dim > * { visibility: hidden; } .rule.dim { background: var(--bone) var(--d12) 0 0 / 8px 8px; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 10px; height: 10px; border: 2px solid var(--ink); display: inline-block; }
.pips i.on { background: var(--ink); }
.kind svg { width: 30px; height: 30px; fill: none; stroke: var(--ink); stroke-width: 2; vertical-align: middle; shape-rendering: crispEdges; }
.kind svg .f { fill: var(--ink); }

.curse { background: var(--ink); color: var(--bone); box-shadow: var(--frame-inv), 5px 5px 0 var(--blood); padding-right: 140px; }
.curse .kicker { color: var(--bone); } .curse h3 { color: var(--bone); font-size: 46px; } .curse .target { margin-left: auto; color: var(--c-bone); background: var(--blood); padding: 3px 6px 2px; }
.curse.blocked { background: var(--bone) var(--d50) 0 0 / 4px 4px; color: var(--ink); padding-right: 22px; box-shadow: var(--frame), 5px 5px 0 var(--ink); }
.curse.blocked > * { background: var(--bone); display: table; padding: 0 6px; }
.curse.blocked h3, .curse.blocked .kicker { color: var(--ink); }
.wax { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); width: 88px; height: 88px; background: var(--blood); display: grid; place-items: center; font-size: 52px; color: var(--ink);
  clip-path: polygon(30% 0, 70% 0, 70% 8%, 92% 8%, 92% 30%, 100% 30%, 100% 70%, 92% 70%, 92% 92%, 70% 92%, 70% 100%, 30% 100%, 30% 92%, 8% 92%, 8% 70%, 0 70%, 0 30%, 8% 30%, 8% 8%, 30% 8%); }
.wax span { line-height: 1; }

.creature { display: flex; gap: 22px; align-items: center; padding: 16px 22px 16px 16px; }
.creature img { width: 220px; height: 220px; flex: none; box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--bone), 0 0 0 7px var(--ink); margin: 7px; }
.creature h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.creature > div { flex: 1; }
/* the effect to put on the track: the thing to act on, so it is the largest line of the card */
.creature .effect { display: flex; align-items: baseline; gap: 14px; margin: 10px 0 8px; padding: 10px 14px 8px; box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 4px var(--bone), inset 0 0 0 6px var(--blood); }
.creature .effect span { font: 13px var(--px); text-transform: uppercase; letter-spacing: .06em; color: var(--c-bone); background: var(--blood); padding: 5px 8px 4px; flex: none; }
.creature .effect b { font: 34px/1 var(--body); font-weight: normal; }
.creature p { font: italic 21px/1.25 var(--book); }

.event { text-align: center; } .event .hint { font-size: 20px; }
.ribbon { display: inline-block; font: 38px/1 var(--title); color: var(--bone); background: var(--ink); padding: 6px 54px 8px; position: relative; margin: 2px auto 10px;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 33%, 100% 33%, calc(100% - 14px) 66%, 100% 66%, 100% 100%, 0 100%, 0 66%, 14px 66%, 0 33%, 14px 33%); }
.ribbon.big { display: block; width: fit-content; font-size: 50px; }
.calm { text-align: center; background: transparent; box-shadow: none; border: 2px dashed var(--ink); }
.calm h3 { font: italic 30px var(--book); }
.calm p { color: var(--dim); font: italic 19px var(--book); }
.lantern p { font: italic 21px var(--book); }
.quest { box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--ink); }
.quest .coin { margin-left: auto; width: 22px; height: 22px; background: var(--bone); border: 3px solid var(--ink); box-shadow: inset 3px 3px 0 var(--bone), inset -3px -3px 0 var(--dim); }
.quest.big { max-width: 760px; margin: 0 auto; }
.guardian { background: var(--ink); color: var(--bone); box-shadow: var(--frame-inv), 6px 6px 0 var(--blood); max-width: 900px; margin: 14px auto; text-align: left; }
.guardian .kicker { color: var(--bone); } .guardian h3 { color: var(--bone); } .guardian .narr { font-size: 19px; color: var(--bone); margin: 0 0 10px; }
.item { text-align: center; } .item h3 { font-size: 48px; }

/* ---- the status bar of the dungeon pages */
.bar { display: flex; align-items: center; gap: 18px; padding: 10px 24px 10px; background: var(--bone); border-bottom: 3px solid var(--ink); box-shadow: 0 3px 0 var(--bone), 0 5px 0 var(--ink); margin-bottom: 8px; flex-wrap: wrap; }
.bar h1 { font-size: clamp(40px, 4.4vw, 58px); line-height: 1; white-space: nowrap; }
.bar .mid { flex: 1; text-align: center; font: 15px var(--px); text-transform: uppercase; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar .role { background: var(--ink); color: var(--bone); padding: 4px 10px 3px; }
.bar .doors { font-size: 12px; color: var(--red); }
.bar .tempo { font: 30px var(--body); }
.items { display: flex; gap: 6px; } .items .it svg, .items .it img { height: 34px; width: auto; display: block; animation: pop .4s steps(3); }
.pressure { display: flex; align-items: center; gap: 4px; font: 12px var(--px); }
.pressure span { margin-right: 6px; } .pressure b { font: 32px var(--body); color: var(--red); margin-left: 6px; min-width: 32px; font-weight: normal; }
.pressure i { width: 12px; height: 22px; border: 2px solid var(--ink); }
.pressure i.on { background: var(--blood); box-shadow: inset 0 0 0 2px var(--bone); }
.purse { display: flex; gap: 5px; }
.purse i { width: 24px; height: 24px; position: relative; image-rendering: pixelated;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges' fill='%238a7f69'%3E%3Cpath d='M4 0h1v1H4zM7 0h1v1H7zM10 3h1v1h-1zM11 6h1v1h-1zM10 9h1v1h-1zM7 11h1v1H7zM4 11h1v1H4zM1 9h1v1H1zM0 5h1v1H0zM1 2h1v1H1z'/%3E%3C/svg%3E") 0 0 / 100% 100%; }
.purse i.full { animation: pop .4s steps(3);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h6v1h2v2h1v6h-1v2H9v1H3v-1H1V9H0V3h1V1h2z' fill='%2317130f'/%3E%3Cpath d='M3 1h6v1h1v1h1v6h-1v1H9v1H3v-1H2V9H1V3h1V2h1z' fill='%23e9dfc4'/%3E%3Cpath d='M4 3h4v1h1v4H8v1H4V8H3V4h1z' fill='%2317130f'/%3E%3Cpath d='M5 4h2v4H5z' fill='%23e9dfc4'/%3E%3Cpath d='M2 3h1v2H2zM3 2h2v1H3z' fill='%23fff'/%3E%3C/svg%3E"); }
.purse i.capped::after { content: "\00D7"; position: absolute; inset: -5px 0 0; text-align: center; font: 26px var(--body); color: var(--ink); }
@keyframes pop { 0% { transform: scale(.4); } 66% { transform: scale(1.15); } }
.narr { font: italic 21px/1.3 var(--book); margin: 10px 28px; min-height: 27px; animation: typein 1.2s steps(24); }
.narrwrap { position: relative; }
.flash { margin: 0; text-align: center; font: 15px var(--px); text-transform: uppercase; color: var(--c-bone); background: var(--blood); padding: 9px 8px 8px; animation: flash 6s steps(1) forwards; }
.narrwrap .flash { position: absolute; inset: 0 20px auto; }
@keyframes flash { 0% { opacity: 0; } 3%, 6% { opacity: 1; } 4.5% { opacity: 0; } 92% { opacity: 1; } 100% { opacity: 0; } }
/* the message line of the old games */
.status { font: 25px var(--body); margin: 16px 24px 18px; padding: 10px 14px 9px; background: var(--ink); color: var(--bone); min-height: 44px; }
.status::before { content: "> "; color: var(--red); }
.status::after { content: "_"; animation: blink 1s steps(1) infinite; }
.status:empty::before { content: "> "; }
@keyframes blink { 50% { opacity: 0; } }

/* ---- the room */
.roomgrid { display: grid; grid-template-columns: 300px 1fr; grid-template-rows: auto auto; gap: 18px 26px; padding: 8px 24px 0; }
.fate { text-align: center; padding: 14px 14px 16px; }
.dslot { display: block; position: relative; width: 100%; aspect-ratio: 1; }
.die3d { position: relative; z-index: 1; width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }
.fate .dslot { margin: 6px 0 6px; box-shadow: inset 0 0 0 2px var(--ink); background: var(--bone); }
.fate .dslot::before { content: ""; position: absolute; inset: 6px; border: 2px dotted var(--ink); pointer-events: none; }
.fate .kind { font: 38px/1 var(--title); min-height: 40px; margin-top: 4px; } .kind.k2, .kind.k4 { color: var(--red); } .kind.k3 { color: var(--red); animation: blink .5s steps(1) 6; }
.calc { display: flex; justify-content: center; gap: 12px; font: 28px var(--body); } .calc b { color: var(--ink); background: var(--ink); color: var(--bone); padding: 0 8px; font-weight: normal; }
.cards { display: flex; flex-direction: column; gap: 18px; }
.actions { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.reroll { display: flex; align-items: center; gap: 10px; font: 13px var(--px); text-transform: uppercase; }
.d6panel { display: flex; gap: 18px; align-items: center; box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--ink); }
.d6s { display: flex; gap: 6px; width: 260px; flex: none; } .dslot.small { width: 125px; }
.d6txt p { font-size: 21px; }
.rollrow { display: flex; align-items: center; gap: 18px; margin-top: 10px; } .rollrow b { color: var(--red); font: 13px var(--px); text-transform: uppercase; }

/* the result waits until the die has stopped */
#app.landing .room .fate .kind, #app.landing .room .calc, #app.landing .room .cards > :not(.dim), #app.landing .room .actions { visibility: hidden; }
#app.revealed .room .cards > *, #app.revealed .room .fate .kind, #app.revealed .room .calc { animation: wipe .36s steps(6) both; }
@keyframes wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

/* ---- the door */
.doorgrid { display: grid; grid-template-columns: 420px 1fr; gap: 30px; padding: 8px 24px 0; }
.doorimg { margin: 0; } .doorimg img { width: 100%; height: min(48vw, 500px); object-fit: cover; object-position: center 60%; display: block; box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--bone), 0 0 0 7px var(--ink), 9px 9px 0 4px var(--ink); margin: 7px; width: calc(100% - 14px); }
.doorimg figcaption { font: italic 19px var(--book); margin-top: 16px; }
.doorright h4 { font-size: 16px; margin-top: 8px; }
.roles { display: flex; flex-wrap: wrap; }
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 12px; }
.path { box-shadow: var(--frame); padding: 14px 16px; background: var(--bone); } .path.on { box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--ink); }
.path .kicker { font: 12px var(--px); text-transform: uppercase; display: flex; } .path .kicker b { margin-left: auto; font: 32px/.8 var(--title); color: var(--red); font-weight: normal; }
.path p { font: italic 18px/1.25 var(--book); min-height: 60px; }
.doorright .rollrow { justify-content: flex-end; margin-top: 22px; } .doorright .rollrow .btn { margin-right: auto; }
.padhint { text-align: right; display: flex; flex-direction: column; gap: 4px; } .padhint b { color: var(--red); font: 15px var(--px); text-transform: uppercase; }
.padhint span { font-size: 20px; color: var(--dim); }

/* ---- welcome: the title screen */
.welcome { display: grid; grid-template-columns: 1fr 1.3fr; min-height: 720px; background: var(--ink); color: var(--bone); }
.cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 30px; text-align: center; }
.logo { font-family: var(--title); display: flex; flex-direction: column; align-items: center; line-height: .82; }
.logo span { font-size: clamp(80px, 10vw, 140px); display: block; text-transform: lowercase; } .logo span::first-letter { text-transform: uppercase; } .logo em { font: 70px/.9 var(--title); color: var(--red); }
.sub { font: 15px var(--px); letter-spacing: .1em; border-top: 3px solid var(--bone); border-bottom: 3px solid var(--bone); padding: 10px 6px 9px; margin-top: 8px; }
.tome { font: italic 24px var(--book); margin-bottom: 16px; }
.lang .chip { background: var(--ink); color: var(--bone); border-color: var(--bone); } .lang .chip.on { background: var(--bone); color: var(--ink); }
.by { font: 13px var(--px); color: var(--dim); letter-spacing: .06em; }
.plate { margin: 44px 44px 40px 0; display: flex; flex-direction: column; }
.plate img { width: 100%; aspect-ratio: 4/3; display: block; box-shadow: 0 0 0 3px var(--bone), 0 0 0 7px var(--ink), 0 0 0 10px var(--bone); }
.plate figcaption { text-align: center; font: italic 21px var(--book); margin-top: 22px; }

/* ---- preparation, quest, entry */
.dicecards { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.dicecard { display: grid; grid-template-columns: 150px 1fr; grid-template-rows: auto 1fr auto; text-align: left; background: var(--bone); box-shadow: var(--frame), 5px 5px 0 var(--ink); border: none; padding: 16px; gap: 2px 16px; }
.dicecard .dslot { grid-row: span 3; } .dicecard h3 { font-size: 42px; line-height: 1; } .dicecard p { margin: 0; font-size: 22px; }
.dicecard em { font: 12px var(--px); font-style: normal; text-transform: uppercase; color: var(--dim); }
.dicecard:hover { box-shadow: var(--frame), 5px 5px 0 var(--ink), inset 0 0 0 9px var(--bone), inset 0 0 0 10px var(--dim); }
.dicecard.on { box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--blood); }
.dicecard.on em { color: var(--c-bone); background: var(--blood); padding: 4px 8px 3px; justify-self: start; font-size: 14px; }
.settings { display: grid; grid-template-columns: 220px 1fr; align-items: center; gap: 8px 18px; margin: 26px 0 10px; }
.settings label { font: 13px var(--px); text-transform: uppercase; text-align: right; } .settings small { margin-left: 12px; font-size: 20px; }
.code { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.digit { width: 54px; height: 58px; font: 46px/1 var(--body); background: var(--ink); color: var(--bone); border: none; box-shadow: 0 0 0 2px var(--bone) inset; }
.digit:hover { background: var(--blood); }
.foot { text-align: center; margin-top: 20px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; align-items: baseline; max-width: 760px; margin: 24px auto; }
.facts span { font: 13px var(--px); text-transform: uppercase; } .facts b { font: 44px/1 var(--body); letter-spacing: .14em; font-weight: normal; }
.entrygrid { display: grid; grid-template-columns: 270px auto 1fr; gap: 30px; align-items: start; }
.nums { display: grid; grid-template-columns: repeat(5, 76px); gap: 10px; } .nums.d6 { grid-template-columns: repeat(3, 110px); }
.num { height: 64px; font: 40px/1 var(--body); background: var(--bone); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); } .nums.d6 .num { height: 100px; font-size: 64px; }
.num:not(.on):hover { box-shadow: 3px 3px 0 var(--ink), inset 0 0 0 2px var(--ink); }
.num.on { background: var(--blood); color: var(--c-bone); border-color: var(--ink); }
.legend { font-size: 22px; } .legend ol { padding-left: 22px; margin: 4px 0; font-size: 21px; } .legend ol.plain { list-style: none; padding: 0; }

/* ---- choice rooms */
.choice .ribbon.big { margin: 10px auto 6px; }
.two, .three { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 16px 0; align-items: start; }
.three { grid-template-columns: 1fr 1fr 1fr; } .two > *, .three > div { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.two > .card, .three .card { width: 100%; align-items: stretch; }
.two > .btn { justify-self: center; min-width: 180px; } .two > span { align-self: center; }
.two.top { align-items: start; } .two.top > div { align-items: stretch; }
.three .rule, .two .rule { padding-left: 92px; } .three .rule .cap, .two .rule .cap { width: 54px; height: 54px; font-size: 50px; line-height: 54px; }
.three .rule h3 { font-size: 34px; } .three .rule p { font-size: 22px; }
.rule.hard { box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--ink); }
.rule.mirror { background: var(--bone) var(--d12) 0 0 / 8px 8px; } .rule.mirror > * { background: var(--bone); }
.gain { font: 13px var(--px); color: var(--red); text-transform: uppercase; font-style: normal; }
.scene { display: grid; grid-template-columns: 1fr 1.2fr; gap: 34px; align-items: center; }
.scene img { width: min(100%, 420px); aspect-ratio: 1; margin: auto; display: block; box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--bone), 0 0 0 7px var(--ink), 9px 9px 0 4px var(--ink); }
blockquote { font: italic 32px/1.2 var(--book); color: var(--red); margin: 6px 0 16px; text-align: center; }
.terms { box-shadow: var(--frame); padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; font-size: 23px; } .terms b { font: 12px var(--px); text-transform: uppercase; font-weight: normal; }
.terms em { font: italic 18px var(--book); color: var(--dim); }
.chest { display: grid; grid-template-columns: 1fr 300px 1fr; gap: 24px; align-items: center; } .chest > div { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.chest img { width: 100%; aspect-ratio: 1; display: block; box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--bone), 0 0 0 7px var(--ink); } .chest .card { width: 100%; }

/* ---- end: the closing screen */
.end { background: var(--ink); color: var(--bone); min-height: 720px; text-align: center; }
.end h2 { font-size: 86px; } .end .lead { color: var(--bone); }
.stats { display: flex; justify-content: center; gap: clamp(20px, 6vw, 90px); margin: 18px 0; }
.stats div { box-shadow: var(--frame-inv); padding: 14px 18px 12px; min-width: 150px; }
.stats b { display: block; font: 92px/.9 var(--body); font-weight: normal; } .stats span { font: 12px var(--px); text-transform: uppercase; }
.questend { font: 38px var(--title); } .questend em { font: 14px var(--px); text-transform: uppercase; font-style: normal; color: var(--dim); } .questend em.done { color: var(--c-bone); background: var(--blood); padding: 3px 6px; }
.titlewon { font: 58px/1 var(--title); margin: 10px 0 20px; } .titlewon small { display: block; font: 13px var(--px); text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.end .btn.wide { max-width: 340px; box-shadow: 4px 4px 0 var(--blood); } .end .btn { color: var(--ink); } .end .btn:hover { color: var(--bone); background: var(--blood); }
.end .foot { color: var(--dim); }

/* the end page: the whole dungeon, room by room (1.8) */
.recap { max-width: 980px; margin: 6px auto 18px; text-align: left; }
.recap h4 { text-align: center; color: var(--bone); }
.recap table { width: 100%; border-collapse: collapse; font-size: 21px; box-shadow: var(--frame-inv); }
.recap th { font: 12px var(--px); text-transform: uppercase; text-align: left; padding: 12px 8px 6px; color: var(--bone); border-bottom: 2px solid var(--bone); font-weight: normal; }
.recap td { padding: 4px 8px; border-bottom: 2px dotted #e9dfc455; color: var(--bone); } .recap td.red { color: var(--red) !important; }
.recap td.note { color: var(--dim); font-size: 18px; } .recap th:first-child, .recap td:first-child { padding-left: 14px; }
@media (max-width: 900px) and (orientation: portrait) { .recap { overflow-x: auto; } .recap table { min-width: 560px; } }

/* ---- shop, journal, book, rules */
.shop .bar .greet { flex: 1; font: italic 20px var(--book); margin: 0; }
.shopgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 18px 24px; }
.shopitem { padding-left: 96px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.shopitem .cap { position: absolute; left: 20px; top: 20px; width: 58px; height: 58px; background: var(--ink); color: var(--bone); font: 54px/58px var(--title); text-align: center; box-shadow: 0 0 0 2px var(--bone), 0 0 0 4px var(--ink); }
.shopitem h3 { display: flex; width: 100%; } .shopitem .price { margin-left: auto; font: 14px var(--px); text-transform: uppercase; background: var(--ink); color: var(--bone); padding: 6px 8px 5px; align-self: center; }
.keys { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; } .keys small { margin-right: 8px; }
.chip.key { min-width: 44px; padding: 6px 8px; position: relative; } .chip.key.locked { background: var(--bone) var(--d50) 0 0 / 4px 4px; color: var(--ink); text-shadow: 0 0 2px var(--bone), 0 0 2px var(--bone); }
.chip.key.locked::after { content: "\25A0"; position: absolute; top: -9px; right: -7px; font-size: 14px; color: var(--red); }
.journal table { width: 100%; border-collapse: collapse; font-size: 23px; box-shadow: var(--frame); }
.journal th { font: 12px var(--px); text-transform: uppercase; text-align: left; padding: 14px 8px 8px; background: var(--ink); color: var(--bone); font-weight: normal; }
.journal th:first-child { padding-left: 16px; } .journal td:first-child { padding-left: 16px; }
.journal td { padding: 6px 8px; border-bottom: 2px dotted var(--ink); } .journal tr:last-child td { border-bottom: none; } .journal td.note { color: var(--dim); font-size: 20px; }
.bookgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; } .book .right { background: var(--bone); box-shadow: var(--frame), 5px 5px 0 var(--ink); padding: 22px 26px; }
.book .right h2 { text-align: left; font-size: 46px; } .book ul { padding-left: 0; list-style: none; font-size: 22px; line-height: 1.1; } .book ul li { margin-bottom: 6px; padding-left: 22px; position: relative; }
.book ul li::before { content: "\25B8"; position: absolute; left: 0; color: var(--red); } .book .facts { margin: 0 0 18px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; } .subtabs .chip { font-size: 15px; padding: 9px 16px 8px; }
.rulelist { columns: 2; column-gap: 44px; padding-left: 34px; margin: 8px 0; } .rulelist li { break-inside: avoid; margin-bottom: 12px; }
.rulelist li::marker { font: 22px var(--body); } .rulelist b { font: 30px/1 var(--title); font-weight: normal; } .rulelist li.d3 b { color: var(--red); }
.rulelist p { margin: 2px 0 0; font-size: 21px; line-height: 1.05; }
.rulelist .pips { margin-left: 10px; } .rulelist .kind svg { width: 20px; height: 20px; margin-left: 6px; }
.rulelist.plain { columns: 1; list-style: none; padding: 0; }
.rulelist.steps li { display: flex; gap: 16px; align-items: baseline; } .rulelist.steps b { color: var(--red); min-width: 26px; } .rulelist.steps p { margin: 0; font-size: 24px; }
.tuto > div { align-items: stretch; }
.rulelist.plain img { width: 36px; height: 36px; vertical-align: -6px; margin-right: 12px; }
.rulelist .eff { font: 12px var(--px); text-transform: uppercase; margin-left: 10px; background: var(--ink); color: var(--bone); padding: 3px 6px 2px; }

/* ---- motion: stepped, like old machines */
.enter { animation: pagein .3s steps(3); } .pop { animation: popcard .3s steps(3); } .flip { animation: wipe .36s steps(6); }
.still, .still * { animation: none !important; }
.enter.nopage { animation: none; }
.flash.still { animation: none !important; }
@keyframes pagein { from { opacity: 0; } }
@keyframes popcard { from { transform: scale(.9); opacity: 0; } }
@keyframes typein { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.curse.pop { animation: popcard .3s steps(3), shake .4s steps(4) .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
/* a curse falls: the whole screen flashes inverted, twice */
.room:has(.curse.pop:not(.blocked):not(.still))::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; background: #fff; mix-blend-mode: difference; opacity: 0; animation: invert .5s steps(1) 2; }
#app.landing .room::before { display: none; }
@keyframes invert { 0%, 20% { opacity: 1; } 21%, 100% { opacity: 0; } }
.room, .door { position: relative; }
.diecol { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.diecol .dslot { box-shadow: var(--frame); }


/* ---- night: the same window, ink and bone swapped (dimmed), the menu and message line sink into the dark */
:root[data-theme=night] {
  --ink: #d8cdb0; --bone: #1b1712; --dim: #9a8f76; --blood: #b3221f; --red: #e05a4a;
  --d50: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM2 2h2v2H2z' fill='%23d8cdb0'/%3E%3C/svg%3E");
  --d25: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0z' fill='%23d8cdb0'/%3E%3C/svg%3E");
  --d12: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h2v2H0zM4 4h2v2H4z' fill='%23d8cdb0'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme=night] .tabs { background: var(--deep); border-bottom-color: var(--ink); }
:root[data-theme=night] .tabs button { color: var(--ink); }
:root[data-theme=night] .tabs button.on { background: var(--ink); color: var(--bone); }
:root[data-theme=night] .tabs button:not(.on):hover { box-shadow: inset 0 -3px 0 var(--ink); }
:root[data-theme=night] .status { background: var(--deep); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
:root[data-theme=night] .curse { background: var(--deep); color: var(--ink); box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--deep), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--blood); }
:root[data-theme=night] .curse .kicker, :root[data-theme=night] .curse h3 { color: var(--ink); }
:root[data-theme=night] .guardian { background: var(--deep); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 5px var(--deep), inset 0 0 0 6px var(--ink), 6px 6px 0 var(--blood); }
:root[data-theme=night] .guardian .kicker, :root[data-theme=night] .guardian h3, :root[data-theme=night] .guardian .narr { color: var(--ink); }
:root[data-theme=night] .purse i.full { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h6v1h2v2h1v6h-1v2H9v1H3v-1H1V9H0V3h1V1h2z' fill='%23d8cdb0'/%3E%3Cpath d='M3 1h6v1h1v1h1v6h-1v1H9v1H3v-1H2V9H1V3h1V2h1z' fill='%231b1712'/%3E%3Cpath d='M4 3h4v1h1v4H8v1H4V8H3V4h1z' fill='%23d8cdb0'/%3E%3Cpath d='M5 4h2v4H5z' fill='%231b1712'/%3E%3C/svg%3E"); }
:root[data-theme=night] #app { box-shadow: 0 0 0 3px var(--bone), 0 0 0 6px var(--ink), 0 0 0 8px var(--bone), 12px 12px 0 8px #000; }
/* the title and closing screens stay dark in both modes */
.welcome, .end { --ink: #17130f; --bone: #e9dfc4; --dim: #9a8f76; --red: #e05a4a; }
/* the Guardian's card on the end page: bone on dark in both modes (the night rule above used the page's dark ink) */
.end .guardian, :root[data-theme=night] .end .guardian { background: #0c0a08; color: #e9dfc4;
  box-shadow: inset 0 0 0 2px #e9dfc4, inset 0 0 0 5px #0c0a08, inset 0 0 0 6px #e9dfc4, 6px 6px 0 var(--blood); }
.end .guardian .kicker, .end .guardian h3, .end .guardian p, .end .guardian .narr,
:root[data-theme=night] .end .guardian .kicker, :root[data-theme=night] .end .guardian h3, :root[data-theme=night] .end .guardian .narr { color: #e9dfc4; }
.end .guardian .narr { color: #b9ad92; }
.theme { font: 13px var(--px); }

/* ---- small screens */
/* phones held upright: one column. Held sideways (landscape), the desktop layout is scaled to fit (app.js fitScreen) */
@media (max-width: 900px) and (orientation: portrait) {
  html, body { font-size: 22px; }
  .roomgrid, .doorgrid, .welcome, .dicecards, .shopgrid, .bookgrid, .two, .three, .scene, .chest, .entrygrid { grid-template-columns: 1fr; }
  .fate { max-width: 340px; margin: 0 auto; width: 100%; }
  .plate { margin: 0 24px 34px; } .welcome { min-height: 0; }
  .settings { grid-template-columns: 1fr; } .settings label { text-align: left; }
  .rule { padding-left: 22px; } .rule .cap { display: none; } .card h3 { font-size: 34px; } .card p { font-size: 22px; }
  .three .rule, .two .rule { padding-left: 22px; }
  .rulelist { columns: 1; } .seal.corner, .btn.go { position: static; margin: 22px auto 0; display: flex; width: fit-content; }
  .bar { padding: 8px 14px; gap: 10px; } .narr, .status { margin-left: 14px; margin-right: 14px; }
  .doorright .rollrow { flex-wrap: wrap; justify-content: center; } .nums { grid-template-columns: repeat(5, 1fr); }
  .curse { padding-right: 22px; } .wax { display: none; } .creature { flex-direction: column; text-align: center; } .creature .effect { justify-content: center; flex-wrap: wrap; }
  .creature h3 { justify-content: center; }
  .d6panel { flex-direction: column; }
  .doorimg img { height: min(90vw, 460px); }
  .fate .dslot { max-width: 260px; margin: 6px auto; }
  .stats div { min-width: 0; padding: 10px; } .stats b { font-size: 60px; }
  #app::before, #app::after { display: none; }
  .journal { overflow-x: auto; } .journal table { min-width: 560px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 12px 10px 11px; font-size: 13px; flex: none; } .tabs .sp { min-width: 8px; }
  .dicecard { grid-template-columns: 96px 1fr; } .dicecard h3 { font-size: 32px; }
}
/* landscape on a small screen: the whole window on the screen, scaled (zoom set by app.js) */
html.fit body { padding: 0; align-items: flex-start; }
html.fit #app { box-shadow: none; margin: 0 auto; }
html.fit #app::before, html.fit #app::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .narr, .kind.k3, .status::after, .room::before, .enter, .pop, .flip { animation: none !important; }
}

/* 1.9: the dungeon map (one cell per room: to come, current, played, cursed, protected) */
.dmap { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 360px; }
.dmap i { width: 13px; height: 13px; box-sizing: border-box; border: 2px solid var(--ink); background: var(--bone); font: 11px/9px var(--px); font-style: normal; color: var(--bone); text-align: center; }
.dmap .m1 { border-style: dotted; opacity: .55; }
.dmap .m2 { border-color: var(--red); background: var(--bone); box-shadow: 0 0 0 1px var(--red); animation: mapblink 1.2s steps(2) infinite; }
.dmap .m3 { background: var(--ink); }
.dmap .m4 { background: var(--red); border-color: var(--red); }
.dmap .m5 { background: var(--ink); box-shadow: inset 0 0 0 2px var(--bone); }
.dmap.big { max-width: none; gap: 5px; margin: 6px auto 14px; }
.dmap.big i { width: 22px; height: 22px; border-width: 3px; font-size: 18px; line-height: 15px; }
.dmap.big .m5 { box-shadow: inset 0 0 0 3px var(--bone); }
@keyframes mapblink { 50% { background: var(--red); } }
.maplegend { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; font: 13px var(--px); text-transform: uppercase; color: var(--dim); margin: -6px 0 14px; }
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }
.maplegend .dmap i { width: 12px; height: 12px; }
@media (prefers-reduced-motion: reduce) { .dmap .m2 { animation: none; background: var(--red); } }

/* 1.9: the scene engravings (quest page, merchant, Guardian, the way out) */
.sceneimg { margin: 0; }
.sceneimg img { display: block; width: 100%; height: auto; box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--bone), 0 0 0 7px var(--ink), 9px 9px 0 4px var(--ink); }
.qgrid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 34px; align-items: start; max-width: 1120px; margin: 0 auto; }
.qgrid .quest.big, .qgrid .facts { margin-left: 0; }
.shopwrap { display: grid; grid-template-columns: minmax(240px, 360px) 1fr; gap: 26px; padding: 18px 24px; align-items: start; }
.shopwrap .shopgrid { padding: 0; gap: 18px; }
.shopitem { padding-left: 20px; }
.shopitem .ipic { margin: 0 0 4px; width: 100%; height: 118px; display: flex; align-items: center; justify-content: center; position: relative; background: var(--bone); box-shadow: inset 0 0 0 2px var(--ink); }
.shopitem .ipic img { max-height: 104px; max-width: 70%; }
.shopitem .ipic .price { position: absolute; right: 6px; top: 6px; margin: 0; font: 14px var(--px); text-transform: uppercase; background: var(--ink); color: var(--bone); padding: 6px 8px 5px; }
.guardgate { display: grid; grid-template-columns: minmax(260px, 400px) 1fr; gap: 44px; align-items: center; text-align: left; }
.guardgate h2 { font-size: 86px; margin: 4px 0 10px; } .guardgate .kicker { color: var(--red); }
.guardgate .lead { font: italic 24px/1.35 var(--book); max-width: 560px; }
.guardgate .seal { margin-top: 18px; }
.sceneimg.tall img { box-shadow: 0 0 0 2px #e9dfc4, 0 0 0 5px #17130f, 0 0 0 7px #e9dfc4, 9px 9px 0 4px var(--blood); }
.endhero { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 40px; align-items: center; max-width: 1100px; margin: 0 auto 10px; text-align: left; }
.endhero h2 { font-size: 72px; margin: 0 0 6px; }
.endhero .titlewon { font-size: 76px; color: var(--red); margin: 18px 0 14px; }
.endhero .titlewon span { display: block; }
.endhero .stats { justify-content: flex-start; gap: 16px; margin: 16px 0 0; } .endhero .stats div { min-width: 0; padding: 10px 14px 8px; } .endhero .stats b { font-size: 62px; }
.guardian { display: flex; gap: 20px; align-items: center; }
.guardian .gthumb { width: 92px; height: 138px; object-fit: cover; flex: none; box-shadow: 0 0 0 2px #e9dfc4; }
@media (max-width: 900px) and (orientation: portrait) {
  .qgrid, .shopwrap, .guardgate, .endhero { grid-template-columns: 1fr; }
  .qgrid .sceneimg, .shopwrap .merchant { max-width: 260px; margin: 0 auto; }
  .guardgate .sceneimg, .endhero .sceneimg { max-width: 300px; margin: 0 auto; }
  .guardgate { text-align: center; } .guardgate h2, .endhero h2 { font-size: 56px; } .endhero { text-align: center; } .endhero .stats { justify-content: center; }
  .endhero .titlewon { font-size: 50px; }
}
.guardgate .gatetext, .guardgate .gatetext h2 { text-align: left; }
.endhero .stats div { text-align: center; }
/* the end page is always dark: light cells on it */
.end .dmap i { border-color: #e9dfc4; background: transparent; color: #17130f; }
.end .dmap .m3 { background: #e9dfc4; }
.end .dmap .m4 { background: var(--red); border-color: var(--red); color: #e9dfc4; }
.end .dmap .m5 { background: #e9dfc4; box-shadow: inset 0 0 0 3px #17130f; }
@media (max-width: 900px) and (orientation: portrait) { .guardgate .gatetext, .guardgate .gatetext h2 { text-align: center; } }
.qgrid .btn.go { position: static; margin: 4px 0 14px; display: inline-flex; }
.qgrid .foot { text-align: left; }
.guardgate .gatetext p { text-align: left; } @media (max-width: 900px) and (orientation: portrait) { .guardgate .gatetext p { text-align: center; } }
/* the map in the band: a little bigger, the rooms to come easier to see */
.bar .dmap { gap: 4px; max-width: 440px; margin-top: 2px; }
.bar .dmap i { width: 16px; height: 16px; font-size: 13px; line-height: 12px; }
.dmap .m1 { opacity: .8; }

/* 1.9.1 (retours de partie) */
/* the map: bigger cells with the room numbers */
.dmap i, .bar .dmap i { width: 22px; height: 22px; font: 13px/18px var(--px); font-style: normal; color: var(--ink); text-align: center; }
.bar .dmap { gap: 3px; max-width: 300px; }
.dmap .m3, .dmap .m5 { color: var(--bone); }
.dmap .m4 { color: #e9dfc4; }
.dmap.big i { width: 30px; height: 30px; font-size: 15px; line-height: 24px; }
.end .dmap i { color: #e9dfc4; } .end .dmap .m3, .end .dmap .m5 { color: #17130f; }
.maplegend .dmap i { width: 12px; height: 12px; }
/* a critical hit shines gold, a disaster stays blood red */
:root { --gold: #8a5c08; } :root[data-theme=night] { --gold: #e8b94a; } .end, .welcome { --gold: #e8b94a; }
.kind.k3 { color: var(--gold); }
.rule.crit { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--gold), 5px 5px 0 var(--gold); }
.rule.crit .cap { background: var(--gold); color: #17130f; } .rule.crit h3 { color: var(--gold); }
/* the curse that is coming (before ACCEPTER) */
.threat { text-align: center; background: transparent; box-shadow: none; border: 2px dashed var(--red); }
.threat h3 { font: italic 30px var(--book); color: var(--red); } .threat p { color: var(--dim); font: italic 19px var(--book); }
/* shorter page changes */
.enter { animation: pagein .14s steps(2); }
/* a compact merchant: the four cards fit a small screen */
.shopwrap { grid-template-columns: minmax(200px, 280px) 1fr; padding: 12px 24px; gap: 20px; }
.shopwrap .shopgrid { gap: 14px; }
.shopitem { padding: 12px 14px; gap: 4px; }
.shopitem .ipic { height: 70px; } .shopitem .ipic img { max-height: 60px; }
.shopitem h3 { font-size: 30px; margin: 0; } .shopitem p { margin: 0; font-size: 19px; line-height: 1.2; }
.shopitem .roles.small { margin: 2px 0; } .shopitem .keys { margin: 2px 0; }
/* a compact end page */
.endhero { grid-template-columns: minmax(180px, 250px) 1fr; gap: 30px; }
.endhero h2 { font-size: 60px; } .endhero .titlewon { font-size: 64px; margin: 10px 0; }
.endhero .stats b { font-size: 50px; }
.calc.crit b { color: var(--gold); }
/* inventory cards: the object on the left, its price in the corner (no scrolling on a small screen) */
.shopitem { display: flex; flex-direction: row; align-items: flex-start; gap: 14px; padding: 14px 16px; position: relative; }
.shopitem .ipic { flex: none; width: 84px; height: 96px; margin: 0; box-shadow: inset 0 0 0 2px var(--ink); display: flex; align-items: center; justify-content: center; }
.shopitem .ipic img { max-width: 76px; max-height: 88px; }
.shopitem > .price { position: absolute; right: 12px; top: 12px; margin: 0; font: 14px var(--px); text-transform: uppercase; background: var(--ink); color: var(--bone); padding: 6px 8px 5px; }
.shopitem .ibody { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-width: 0; }
.shopitem .ibody h3 { padding-right: 60px; }
/* 1.9.2: 8 roles, two rows of 4 */
.doorright .roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.doorright .roles .chip { margin: 0; text-align: center; justify-content: center; }
@media (max-width: 900px) and (orientation: portrait) { .doorright .roles { grid-template-columns: repeat(2, 1fr); } }
.cover .tools { font: italic 18px var(--book); color: var(--dim); margin-top: -6px; }

/* 1.9.4: small readability touches */
.bar .dmap { max-width: 360px; } .bar .dmap i, .dmap i { width: 26px; height: 26px; font-size: 15px; line-height: 22px; }
.dmap.big i { width: 36px; height: 36px; font-size: 17px; line-height: 30px; }
.maplegend { font-size: 16px; gap: 18px; } .maplegend .dmap i { width: 14px; height: 14px; }
.purse { align-items: center; } .purse b { font: 15px var(--px); text-transform: uppercase; margin-left: 6px; white-space: nowrap; }
.doorright .hint { font-size: 21px; color: var(--ink); opacity: .85; }
.btn.poor { opacity: .45; border-style: dashed; box-shadow: none; }
.btn.poor:hover { background: var(--bone); color: var(--ink); }
.reroll.poor span { color: var(--red); }
/* PISTE TERMINÉE: the room's main action, red like LANCER */
.btn.main { background: var(--blood); color: #f3ead2; border-color: var(--blood); box-shadow: 4px 4px 0 var(--ink); }
.btn.main::before { color: #f3ead2; }
.btn.main:hover { background: var(--ink); color: var(--bone); border-color: var(--ink); }
.dmap { display: grid; grid-template-columns: repeat(var(--cols, 12), auto); justify-content: center; }
.bar .dmap { max-width: none; }
.maplegend .dmap { display: inline-flex; }
/* 1.9.5: a page change never shows an empty screen (it starts dimmed, not invisible) */
@keyframes pagein { from { opacity: .4; } }
.critpick select { font: 20px var(--body); background: var(--bone); color: var(--ink); border: 2px solid var(--ink); padding: 6px 8px; width: 100%; margin: 6px 0; }
.critpick h3 { color: var(--gold); } .critpick .kicker { color: var(--gold); }
.critpick { box-shadow: inset 0 0 0 2px var(--gold), 5px 5px 0 var(--gold); }
/* 1.10: the blessing */
.bless select { font: 20px var(--body); background: var(--bone); color: var(--ink); border: 2px solid var(--ink); padding: 6px 8px; width: 100%; margin: 6px 0; }
.bless h3, .bless .kicker { color: var(--gold); }
.bless { box-shadow: inset 0 0 0 2px var(--gold), 5px 5px 0 var(--gold); }
.calc.crit b { background: transparent; color: var(--gold); box-shadow: none; }

/* ================= 1.9.7 (tests du site : 6 parties, téléphone, anglais) ================= */
/* the action bar: the message and the buttons of the moment, always on screen (it sticks to the bottom of the window) */
.dock { position: sticky; bottom: 0; z-index: 8; display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 10px 24px max(10px, env(safe-area-inset-bottom));
  background: var(--bone); border-top: 3px solid var(--ink); box-shadow: 0 -3px 0 var(--bone), 0 -5px 0 var(--ink); }
.dock .status { flex: 1; margin: 0; min-height: 44px; font-size: 23px; }
.dock .dleft, .dock .dright { display: flex; align-items: center; gap: 12px; flex: none; }
.dock .dleft:empty, .dock .dright:empty { display: none; }
.dock .btn.wide { width: auto; min-width: 250px; }
.dock .seal { height: 58px; }
.page > .dock { margin: 22px calc(-1 * clamp(16px, 3vw, 40px)) -32px; }
.end .dock { display: none; }
.seal.poor { opacity: .45; }
#app.landing .room .dock > * { visibility: hidden; }
.prep .foot { margin-bottom: 0; }
/* what the player carries: the merchant's pictures, framed like his cards */
.items { gap: 8px; align-items: center; }
.items .it { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; background: var(--bone); box-shadow: inset 0 0 0 2px var(--ink); animation: pop .4s steps(3); }
.items .it img, .items .it svg { height: 44px; width: auto; display: block; animation: none; }
.items .it b { font: 15px var(--px); font-weight: normal; }
/* the lantern is lit: the die first */
.lantern.lit { display: flex; gap: 18px; align-items: center; margin-top: 8px; box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 5px var(--bone), inset 0 0 0 7px var(--blood), 5px 5px 0 var(--ink); }
.lantern.lit img { height: 96px; width: auto; flex: none; } .lantern.lit h3 { font-size: 38px; } .lantern .hint { font-size: 19px; font-style: normal; }
/* a curse that fell just before a choice room: shown above the choice */
.fallen { max-width: 760px; margin: 6px auto 14px; } .fallen .curse h3 { font-size: 36px; } .fallen .curse p { font-size: 22px; }
/* the merchant: an object already carried */
.shopitem .owned { font: 13px var(--px); font-style: normal; text-transform: uppercase; color: var(--c-bone); background: var(--blood); padding: 6px 9px 5px; }
.shopitem.own .ipic { box-shadow: inset 0 0 0 2px var(--blood), inset 0 0 0 4px var(--bone), inset 0 0 0 6px var(--blood); }
.shop .bar .items { margin-right: 4px; }
/* the menu: the three small buttons stay together, at the right */
.tabs .navtools { display: flex; margin-left: auto; }
.endbtns { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: center; } .endbtns .btn.wide { width: auto; min-width: 300px; }
.end .endbtns .btn { box-shadow: 4px 4px 0 var(--blood); }
.padhint { margin-top: 20px; }
@media (hover: none) and (pointer: coarse) { .padhint b, .d6txt .rollrow { display: none; } }
/* a short laptop screen (720 px high and less): the Destin card a little smaller, so the room fits above the bar */
@media (min-width: 901px) and (max-height: 760px) { .roomgrid { grid-template-columns: 250px 1fr; } .fate { padding: 10px 12px 12px; } .fate .kind { font-size: 32px; } }

/* phones held upright: these come last, the single-column rules above were overridden by later desktop rules
   (the end page was cut on the right, the merchant was 553 px wide) */
@media (max-width: 900px) and (orientation: portrait) {
  .endhero, .shopwrap, .guardgate, .qgrid { grid-template-columns: 1fr; }
  .shopwrap .shopgrid { grid-template-columns: 1fr; }
  .shopwrap { padding: 10px 12px; } .shopwrap .merchant { max-width: 200px; }
  .endhero { text-align: center; gap: 16px; } .endhero .sceneimg { max-width: 220px; }
  .endhero h2 { font-size: 48px; } .endhero .titlewon { font-size: 44px; } .endhero .stats { flex-wrap: wrap; gap: 10px; } .endhero .stats b { font-size: 44px; }
  .end.page { padding-left: 12px; padding-right: 12px; }
  .guardian { flex-direction: column; text-align: center; }
  /* the menu on two rows when it must: nothing is hidden any more */
  .tabs { flex-wrap: wrap; overflow-x: visible; padding: 0 4px; } .tabs button { padding: 11px 7px 10px; font-size: 12px; } .tabs .icon { width: 40px; }
  /* the door: a smaller engraving, the roles and LANCER come sooner */
  .doorimg img { height: min(46vw, 230px); } .doorimg figcaption { margin-top: 10px; }
  .fate .dslot { max-width: 200px; } .fate { max-width: 300px; }
  .dock { flex-wrap: wrap; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); gap: 8px; }
  .dock .status { order: -1; flex-basis: 100%; font-size: 20px; min-height: 0; padding: 7px 10px 6px; }
  .dock .dleft { margin-right: auto; } .dock .dright { margin-left: auto; }
  .dock .btn.wide { min-width: 190px; padding: 13px 14px; } .dock .seal { height: 54px; min-width: 120px; }
  .page > .dock { margin-left: -16px; margin-right: -16px; }
  .lantern.lit img { height: 70px; } .bar h1 { white-space: normal; }
  .items .it img { height: 36px; }
  .shop .bar .greet { flex-basis: 100%; order: 5; } .shop .bar h1 { font-size: 40px; }
  .questend { font-size: 30px; }
}
.questend em { display: inline-block; white-space: nowrap; }

/* 1.0: the cover's links and the About page */
.also { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; justify-content: center; font-size: 21px; }
.also a, .linkish { color: var(--bone); text-decoration: underline; text-underline-offset: 4px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.also a:hover, .linkish:hover { color: var(--red); }
.about h2 { text-align: left; } .about .lead { text-align: left; font-size: 25px; line-height: 1.2; max-width: 900px; margin: 6px 0 24px; }
.aboutlist { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 44px; } .aboutlist li { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.aboutlist p { font-size: 22px; } .aboutlist a.btn { margin-top: 8px; text-decoration: none; display: inline-block; color: var(--ink); }
.aboutlist a.btn:hover { color: var(--bone); }
.aboutlist .links { display: flex; flex-wrap: wrap; gap: 0 12px; }
@media (max-width: 760px) { .aboutlist { grid-template-columns: 1fr; } }

/* 1.0: on a tall screen the window sits in the middle of the page instead of hanging from the top. Its height is held
   steady so that it does not jump from one page to the next; a page taller than the screen still scrolls from the top. */
@media (min-height: 860px) and (min-width: 900px) {
  html:not(.fit) body { min-height: 100vh; box-sizing: border-box; align-items: center; }
  html:not(.fit) #app { min-height: min(820px, calc(100vh - 60px)); display: flex; flex-direction: column; }
  html:not(.fit) #app > section, html:not(.fit) #app > main { flex: 1; }
}
