/* RPG's Gate — base styles.
   Layout unit: 1rem = 1/128 of the 16:9 stage width (the stage is 128rem x 72rem).
   js/core/scale.js sets the root font-size so the UI is pixel-crisp from 720p to 4K. */

/* no scroll anchoring: the screens rebuild their lists after every click, and the browser's anchoring
   then nudged a scrolled list by a row each time (core/ui.js keeps the scroll position itself) */
* { overflow-anchor: none; }

@font-face { font-family: 'Almendra'; src: url('../assets/fonts/almendra-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: block; }
@font-face { font-family: 'Almendra'; src: url('../assets/fonts/almendra-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: block; }
@font-face { font-family: 'Almendra'; src: url('../assets/fonts/almendra-latin-400-italic.woff2') format('woff2'); font-style: italic; font-display: block; }
@font-face { font-family: 'IM Fell English'; src: url('../assets/fonts/im-fell-english-latin-400-normal.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'IM Fell English'; src: url('../assets/fonts/im-fell-english-latin-400-italic.woff2') format('woff2'); font-style: italic; font-display: block; }
@font-face { font-family: 'IM Fell English SC'; src: url('../assets/fonts/im-fell-english-sc-latin-400-normal.woff2') format('woff2'); font-display: block; }
/* Drop Yataghan.ttf (the font used in the original PSD mockups) into assets/fonts to use it. */
@font-face { font-family: 'Yataghan'; src: local('Yataghan'), url('../assets/fonts/Yataghan.ttf') format('truetype'); font-display: swap; }

:root {
  --f-display: 'Yataghan', 'Almendra', 'Palatino Linotype', serif;
  --f-body: 'IM Fell English', 'Palatino Linotype', Georgia, serif;
  --f-sc: 'IM Fell English SC', 'IM Fell English', serif;
  --ink: #3a2412;
  --ink-soft: #6a4a2c;
  --ink-faint: rgba(58, 36, 18, .45);
  --wash: rgba(110, 70, 30, .16);
  --wash-strong: rgba(95, 55, 20, .3);
  --blood: #6e1d1a;
  --gold: #d6b25e;
  --gold-bright: #f5dc93;
  --gold-deep: #8d6a2a;
  --night: #0b0806;
  --good: #2f6a5a;
  --bad: #8a2a1e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--night); }
html { font-size: 10px; }
body { font-family: var(--f-body); color: var(--ink); user-select: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; user-select: text; }
img { -webkit-user-drag: none; user-select: none; }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; }   /* the game handles pinch, pan and twist itself */
#stage {
  position: fixed; left: 50%; top: 50%;
  width: 128rem; height: 72rem;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
}
#screen { position: absolute; inset: 0; }
#modal-layer { z-index: 70; position: fixed; left: 50%; top: 50%; width: 128rem; height: 72rem; transform: translate(-50%, -50%); pointer-events: none; font-size: 1.6rem; }
#modal-layer > * { pointer-events: auto; }
#fader { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .5s ease; z-index: 50; }
#fader.on { opacity: 1; pointer-events: auto; }

/* ---- the launcher (index.html #boot): the journal's cover, after the classic games' Enhanced Edition
   start screens. Laid out on a 1000×780 frame in its own unit (--u), since it shows before the stage
   scaling runs; the SVG decoration and the buttons share that frame. Art at native aspect throughout. */
#boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 60; transition: opacity .7s ease;
  background: radial-gradient(ellipse at 50% 45%, rgba(30, 18, 10, .55), rgba(4, 2, 1, .94) 72%), url(../assets/textures/planks_dark.jpg) center / 48vmin, #070402; }
#boot.gone { opacity: 0; pointer-events: none; }
.launcher { --u: min(calc(100vw / 1000), calc(100vh / 780)); font-family: var(--f-display); }
.ln-stage { overflow: hidden; position: relative; width: calc(var(--u) * 1000); height: calc(var(--u) * 780); border-radius: calc(var(--u) * 3);
  background:
    radial-gradient(ellipse 30% 22% at 22% 30%, rgba(20, 10, 4, .35), transparent 70%),
    radial-gradient(ellipse 26% 30% at 78% 68%, rgba(20, 10, 4, .32), transparent 70%),
    radial-gradient(ellipse 18% 14% at 64% 18%, rgba(140, 90, 50, .14), transparent 70%),
    radial-gradient(ellipse at 50% 46%, rgba(120, 76, 44, .12), rgba(10, 5, 2, .6) 82%),
    url(../assets/ui/leather.jpg) center / cover, #3a2416;
  box-shadow: 0 calc(var(--u) * 14) calc(var(--u) * 40) rgba(0, 0, 0, .85), inset 0 0 calc(var(--u) * 40) rgba(0, 0, 0, .55), inset 0 0 0 calc(var(--u) * 2) rgba(0, 0, 0, .6); }
.ln-decor { position: absolute; inset: 0; width: 100%; height: 100%; }
/* wear on the leather: the journal PSD's own Book Cover Grunge layer, cropped to the cover's shape */
.ln-stage::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url(../assets/ui/launcher/cover_grunge.jpg) 0 0 / 100% 100%; mix-blend-mode: overlay; opacity: .45; }
.ln-stage::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url(../assets/ui/launcher/cover_grunge.jpg) 0 0 / 100% 100%; mix-blend-mode: multiply; opacity: .15; }
/* gems in the medallion: unlit and lit crossfade when the matching menu item is hovered */
.ln-gem .lit, .ln-gem .halo { opacity: 0; transition: opacity .25s ease; }
.ln-gem.on .lit, .ln-gem.on .halo { opacity: 1; }
/* the medallion sits on top of the plates and pins their inner ends */
.ln-medal { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.ln-claspgems { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.ln-spill, .ln-glow, .ln-light { animation: ln-flicker 3.2s ease-in-out infinite; }
.ln-gap { animation: ln-flicker 2.3s ease-in-out infinite reverse; }
@keyframes ln-flicker { 0%, 100% { opacity: .55; } 40% { opacity: .8; } 60% { opacity: .62; } 75% { opacity: .9; } }
.ln-clasp { position: absolute; width: calc(var(--u) * 132); height: auto; pointer-events: none; filter: drop-shadow(0 calc(var(--u) * 4) calc(var(--u) * 5) rgba(0, 0, 0, .6)); }
/* pushed a hair past the edge, so the metal sits tight against it (the stage clips the overhang) */
.ln-clasp.tr { top: calc(var(--u) * -2); right: calc(var(--u) * -2); }
.ln-clasp.bl { bottom: calc(var(--u) * -2); left: calc(var(--u) * -2); }
/* gold leaf pressed into the leather: foil gradient, worn by the leather's grain, with a debossed edge */
.ln-gold { background: url(../assets/ui/leather.jpg) center / calc(var(--u) * 600), linear-gradient(180deg, #f8eab4 0%, #dcbc68 40%, #a48038 68%, #dec474 100%);   /* a touch less orange */
  background-blend-mode: soft-light; -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 calc(var(--u) * -1.2) 0 rgba(0, 0, 0, .75)) drop-shadow(0 calc(var(--u) * 1.2) 0 rgba(255, 214, 150, .16)); }
.ln-title { position: absolute; left: 0; right: 0; top: calc(var(--u) * 66); text-align: center; font-size: calc(var(--u) * 80); line-height: 1; letter-spacing: .02em; }
.ln-knot { position: absolute; left: calc(var(--u) * 330); right: calc(var(--u) * 330); top: calc(var(--u) * 152); height: calc(var(--u) * 17); display: flex; filter: drop-shadow(0 calc(var(--u) * -1) 0 rgba(0, 0, 0, .7)); }
/* the knotwork in the same gold leaf: the divider art is the mask, the foil shows through it */
.ln-knot i { display: block; height: 100%;
  background: url(../assets/ui/leather.jpg) center / calc(var(--u) * 600), linear-gradient(180deg, #f8eab4 0%, #dcbc68 40%, #a48038 68%, #dec474 100%); background-blend-mode: soft-light;
  -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x; -webkit-mask-size: auto 100%; mask-size: auto 100%; }
.ln-knot .l { width: calc(var(--u) * 40); -webkit-mask-image: url(../assets/ui/divider_l.png); mask-image: url(../assets/ui/divider_l.png); }
.ln-knot .m { flex: 1; -webkit-mask-image: url(../assets/ui/divider_m.png); mask-image: url(../assets/ui/divider_m.png); }
.ln-knot .r { width: calc(var(--u) * 78); -webkit-mask-image: url(../assets/ui/divider_r.png); mask-image: url(../assets/ui/divider_r.png); }
.ln-tag { position: absolute; left: 0; right: 0; top: calc(var(--u) * 176); text-align: center; font-family: var(--f-body); font-style: italic; font-size: calc(var(--u) * 19); }
/* parchment plates with torn edges (the mask is made by the launcher script); ink lettering */
/* six plate positions either side of the medallion; each holds a parchment plate or, when its menu
   has nothing there, shows the stitched recess underneath */
.ln-pos { position: absolute; width: calc(var(--u) * 276); height: calc(var(--u) * 60); }
.ln-pos.l1, .ln-pos.r1 { top: calc(var(--u) * 333); } .ln-pos.l2, .ln-pos.r2 { top: calc(var(--u) * 391); } .ln-pos.l3, .ln-pos.r3 { top: calc(var(--u) * 448); }
.ln-pos.l1, .ln-pos.l2, .ln-pos.l3 { left: calc(var(--u) * 110); } .ln-pos.r1, .ln-pos.r2, .ln-pos.r3 { right: calc(var(--u) * 110); }
.ln-pos .ln-plate { position: absolute; inset: 0; width: auto; height: auto; transition: opacity .22s ease, transform .22s ease, filter .2s; }
.ln-pos.empty .ln-plate, .launcher.swap .ln-plate { opacity: 0; transform: translateY(calc(var(--u) * 4)); pointer-events: none; }
.ln-pos .ln-slot { position: absolute; left: 0; right: 0; top: calc(var(--u) * 2); }
.ln-plate { filter: drop-shadow(0 calc(var(--u) * 4) calc(var(--u) * 4) rgba(0, 0, 0, .7)); }
.ln-plate.cont { position: absolute; left: calc(var(--u) * 388); top: calc(var(--u) * 648); width: calc(var(--u) * 224); height: calc(var(--u) * 48); transition: filter .2s; }
.ln-plate:has(> :not(:disabled):hover), .ln-plate:has(> :focus-visible) { filter: drop-shadow(0 0 calc(var(--u) * 3) rgba(255, 200, 90, .9)) drop-shadow(0 0 calc(var(--u) * 10) rgba(255, 160, 50, .45)) drop-shadow(0 calc(var(--u) * 4) calc(var(--u) * 4) rgba(0, 0, 0, .7)); }
.ln-btn, .ln-continue { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; overflow: hidden;
  font-family: var(--f-display); font-size: calc(var(--u) * 23); letter-spacing: .03em; color: #3a2410; text-shadow: 0 1px 0 rgba(255, 240, 210, .35);
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, transparent 50%, rgba(110, 62, 22, .5) 88%, rgba(60, 30, 8, .8) 100%),
    radial-gradient(circle at 18% 30%, rgba(140, 90, 40, .18), transparent 22%), radial-gradient(circle at 82% 75%, rgba(140, 90, 40, .16), transparent 20%),
    url(../assets/ui/parchment_tile.jpg) center / calc(var(--u) * 260), #e8d6aa;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; transition: color .15s, transform .1s; }
.ln-continue { font-size: calc(var(--u) * 21); }
/* lettering centred on the part of the plate the medallion leaves showing */
.ln-pos.l1 .ln-btn, .ln-pos.l2 .ln-btn, .ln-pos.l3 .ln-btn { padding-right: calc(var(--u) * 44); }
.ln-pos.r1 .ln-btn, .ln-pos.r2 .ln-btn, .ln-pos.r3 .ln-btn { padding-left: calc(var(--u) * 44); }
.ln-btn:not(:disabled):hover, .ln-btn:focus-visible, .ln-continue:not(:disabled):hover, .ln-continue:focus-visible { color: #7a1a10; outline: none; }
.ln-btn:not(:disabled):active, .ln-continue:not(:disabled):active { transform: translateY(1px); }
.ln-btn:disabled, .ln-continue:disabled { color: rgba(58, 36, 16, .42); cursor: default; }
.ln-slot { position: absolute; height: calc(var(--u) * 56); border-radius: calc(var(--u) * 6); border: calc(var(--u) * 1.6) dashed rgba(216, 184, 136, .6);
  background: rgba(10, 5, 2, .4); box-shadow: inset 0 calc(var(--u) * 3) calc(var(--u) * 8) rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 220, 160, .08); }
.ln-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(122, 26, 16, .35), rgba(160, 60, 24, .3)); transition: width .35s ease, opacity .6s; }
.ln-label { position: relative; font-family: var(--f-body); font-style: italic; font-size: .8em; }
.launcher.ready .ln-fill { opacity: 0; }
.launcher.ready .ln-label { font-family: var(--f-display); font-style: normal; font-size: 1em; }
.ln-ver { position: absolute; left: calc(var(--u) * 76); top: calc(var(--u) * 693); font-family: var(--f-display); font-size: calc(var(--u) * 15); }   /* tucked into the bottom-left, beside the clasp */

#tooltip {
  position: fixed; z-index: 70; max-width: 38rem; padding: 1rem 1.3rem; pointer-events: none;
  font-size: 1.5rem; line-height: 1.35; color: var(--ink);
  background: #e8d3a6 url('../assets/ui/parchment.jpg') center/40rem;
  border: .15rem solid #6a4a2c; border-radius: .4rem; box-shadow: 0 .6rem 2rem rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(.4rem); transition: opacity .12s ease, transform .12s ease;
}
#tooltip.show { opacity: 1; transform: none; }
#tooltip b { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; display: block; margin-bottom: .3rem; }

/* ---------- shared ink-on-parchment widgets ---------- */
/* knotwork divider at native aspect: two end knots and a seamlessly repeating chain between them */
.divider { position: relative; height: 1.7rem; padding: 0 7.8rem 0 4rem; background: url('../assets/ui/divider_m.png') left center / auto 100% repeat-x; background-origin: content-box; background-clip: content-box; opacity: .95; }
.divider::before, .divider::after { content: ''; position: absolute; top: 0; height: 100%; background: center / auto 100% no-repeat; }
.divider::before { left: 0; width: 4rem; background-image: url('../assets/ui/divider_l.png'); }
.divider::after { right: 0; width: 7.8rem; background-image: url('../assets/ui/divider_r.png'); }
.h-display { font-family: var(--f-display); font-weight: 400; color: var(--ink); line-height: 1; margin: 0; }
.ink-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .55rem 1.6rem; font-family: var(--f-display); font-size: 2.1rem; color: var(--ink);
  border-radius: .4rem; transition: background .15s ease, color .15s ease, opacity .15s;
}
.ink-btn:hover:not(:disabled) { background: var(--wash); color: #1d0f05; }
.ink-btn:active:not(:disabled) { background: var(--wash-strong); }
.ink-btn:disabled { opacity: .35; cursor: default; }
.ink-btn.primary { color: var(--blood); }
.ink-btn.boxed { border: .15rem solid var(--ink-faint); }
.ink-btn:focus-visible, .opt:focus-visible { outline: .2rem dashed var(--ink-soft); outline-offset: .2rem; }

.opt {
  display: flex; align-items: center; gap: 1rem; width: 100%; text-align: left;
  padding: .55rem 1.1rem; border-radius: .4rem; font-size: 2rem; font-family: var(--f-display);
  transition: background .15s ease;
}
.opt:hover:not(.disabled) { background: var(--wash); }
.opt.sel { background: var(--wash-strong); box-shadow: inset .4rem 0 0 var(--blood); }
.opt.disabled { opacity: .38; cursor: not-allowed; }
.opt small { font-family: var(--f-body); font-size: 1.4rem; color: var(--ink-soft); margin-left: auto; font-style: italic; }

.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #6a4a2c transparent; }
.scroll::-webkit-scrollbar { width: .8rem; }
.scroll::-webkit-scrollbar-thumb { background: #6a4a2c; border-radius: .4rem; }
.scroll::-webkit-scrollbar-track { background: url('../assets/ui/scrollbar.png') center/100% 100%; }

.pips { display: inline-flex; gap: .4rem; }
.pip { width: 1.4rem; height: 1.4rem; border-radius: 50%; border: .15rem solid var(--ink-soft); }
.pip.on { background: radial-gradient(circle at 35% 35%, #b5452f, var(--blood)); border-color: var(--blood); }

.stepper { display: inline-flex; align-items: center; gap: .3rem; }
.stepper button {
  width: 2.6rem; height: 2.6rem; border-radius: 50%; font-family: var(--f-display); font-size: 2rem; line-height: 1;
  border: .15rem solid var(--ink-faint); display: grid; place-items: center;
}
.stepper button:hover:not(:disabled) { background: var(--wash); }
.stepper button:disabled { opacity: .3; cursor: default; }

/* ---------- modals (parchment card) ---------- */
.modal-veil { position: absolute; inset: 0; background: rgba(5, 3, 2, .62); display: grid; place-items: center; animation: fadein .2s ease; }
.card {
  position: relative; width: 62rem; min-height: 30rem; max-height: 64rem; padding: 4.5rem 6% 3.5rem 15%;
  background: url('../assets/ui/card_front.webp') center/100% 100% no-repeat;
  filter: drop-shadow(0 1.5rem 3rem rgba(0, 0, 0, .7));
  display: flex; flex-direction: column; animation: cardin .28s cubic-bezier(.2, .9, .3, 1.2);
}
.card h2 { font-family: var(--f-display); font-weight: 400; font-size: 4rem; margin: 0 0 .4rem; text-align: center; }
.card .card-body { flex: 1; font-size: 1.8rem; line-height: 1.45; }
.card .card-actions { display: flex; justify-content: center; gap: 1.5rem; margin-top: 1.6rem; }
@keyframes cardin { from { transform: scale(.92) translateY(2rem); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }

/* small-window notice */
#stage[data-small="1"]::after {
  content: 'Window is below 1280×720 — RPG\'s Gate is designed for 720p and above.';
  position: fixed; left: 50%; bottom: .4rem; transform: translateX(-50%); padding: .3rem 1rem; border-radius: 1rem;
  font-size: 1.3rem; color: #e0c48a; background: rgba(0, 0, 0, .7); z-index: 80; white-space: nowrap;
}

/* Infinity Engine–style cursors (js/core/cursors.js): the gilded pointer everywhere, an open
   gauntlet over things you can pick up and drag */
html.bg-cursor, html.bg-cursor body { cursor: var(--cur-default); }
html.bg-cursor :is(button, a, label, select, summary, .tk-reply, .pc, .spell-tile, .qb-act, .hud-block, .hud-block *, .modal-veil, .modal-veil *, .gb-veil, .gb-veil *) { cursor: var(--cur-default); }
html.bg-cursor :is(.item, .qb-slot .item) { cursor: var(--cur-use); }
html.bg-cursor #hud.targeting .pc { cursor: var(--cur-cast); }
html.bg-cursor :is(input[type=text], textarea) { cursor: text; }

/* ---- bug reporter (enabled after login): compact, clear of the 9.6rem right HUD */
.bug-btn { position: fixed; z-index: 95; top: .8rem; right: 1rem; width: 4.4rem; height: 4.4rem; min-width: 32px; min-height: 32px; padding: .65rem; border: .18rem solid #71512d; border-radius: .4rem;
  background: #d6bf8c url('../assets/ui/parchment_tile.jpg') center / 20rem; box-shadow: inset 0 0 .6rem #805a3066, 0 .2rem .5rem #0009; opacity: .9; }
body:has(.hud-right) .bug-btn { right: 10.6rem; }
.bug-btn img { display: block; width: 100%; height: 100%; object-fit: contain; }
.bug-btn:hover { opacity: 1; filter: brightness(1.12); }
.bug-btn:focus-visible { outline: .2rem solid var(--gold-bright); outline-offset: .2rem; }
.bug-btn.hidden, .bug-panel.hidden { display: none; }
.bug-panel { position: fixed; z-index: 96; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(52rem, 92vw); padding: 1.6rem 2rem; border-radius: .6rem;
  background: var(--parch, #e8d6aa) center / 40rem; color: #2a1a0c; box-shadow: 0 1rem 3rem rgba(0,0,0,.7), inset 0 0 2rem rgba(90,55,20,.45); font-size: 1.5rem; display: flex; flex-direction: column; gap: .8rem; }
.bug-panel h3 { margin: 0; font-family: var(--f-display); font-size: 2.4rem; font-weight: 400; }
.bug-panel textarea { width: 100%; box-sizing: border-box; margin-top: .3rem; font: inherit; padding: .5rem; background: rgba(255,248,225,.6); border: .12rem solid rgba(90,55,20,.4); border-radius: .3rem; resize: vertical; }
.bug-row { display: flex; gap: .8rem; align-items: center; }
.bug-hint { font-style: italic; font-size: 1.3rem; opacity: .75; }
.bug-picks { margin: 0; padding-left: 1.6rem; font-size: 1.35rem; }
.bug-actions { justify-content: flex-end; }
.bug-status { font-style: italic; min-height: 1.6rem; }
.bug-hl { position: fixed; z-index: 97; pointer-events: none; border: .2rem solid #d04030; background: rgba(208,64,48,.12); display: none; }

/* ---- dice (core/dice3d.js, core/diceShow.js) */
#dice-layer { position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0; transition: opacity .2s; }
#dice-layer.on { opacity: 1; }
/* TableCraft-style: the dice roll over the whole screen, no tray; the settled dice fly into result slots */
#dice-box { position: absolute; inset: 0; }
#dice-box canvas { width: 100% !important; height: 100% !important; }
.dice-in-flight { position: fixed; z-index: 950; pointer-events: none; transform-origin: 0 0; will-change: transform; }
.dc-slot { display: inline-flex; align-items: center; justify-content: center; gap: .1rem; }
.dc-slot img { width: 3.4rem; height: 3.4rem; object-fit: contain; filter: drop-shadow(0 .15rem .2rem rgba(0,0,0,.35)); }
.dc-slot.dropped { margin-left: .5rem; opacity: .45; filter: grayscale(.8); }
.dc-slot.dropped + .dc-slot.dropped { margin-left: 0; }
.dice-cards { position: fixed; top: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 901; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.dice-card { min-width: 22rem; padding: .7rem 1.2rem .8rem; border-radius: .6rem; background: var(--parch) repeat; background-size: 34rem; color: var(--ink);
  box-shadow: 0 0 0 2px #5a3a1a, 0 .4rem 1.4rem rgba(0, 0, 0, .55); font-family: var(--f-body); font-size: 1.4rem; text-align: center; animation: dcIn .35s ease-out; transition: opacity .5s, transform .5s; }
.dice-card.gone { opacity: 0; transform: translateY(-1rem); }
@keyframes dcIn { from { opacity: 0; transform: translateY(-1rem) scale(.96); } to { opacity: 1; transform: none; } }
.dc-title { font-family: var(--f-display); font-size: 1.9rem; }
.dc-who { font-family: var(--f-body); font-size: 1.3rem; color: var(--ink-soft); }
.dc-faces { display: flex; gap: .35rem; justify-content: center; align-items: center; flex-wrap: wrap; margin: .35rem 0; }
.dc-die { min-width: 2.6rem; height: 2.6rem; line-height: 2.6rem; padding: 0 .3rem; border-radius: .4rem; background: #efe2bf; border: .12rem solid #6a4a2a; font-weight: bold; color: #3a2414; }
.dc-die.d20 { border-radius: 50%; background: #e8d3a6; }
.dc-die.dropped { opacity: .4; text-decoration: line-through; }
.dc-total { font-size: 1.8rem; margin-left: .3rem; }
.dc-need { font-size: 1.25rem; font-style: italic; color: var(--ink-soft); }
.dc-outcome { font-family: var(--f-sc); font-size: 1.6rem; margin-top: .2rem; }
.dice-card.success .dc-outcome { color: #2f6a2a; }
.dice-card.fail .dc-outcome { color: #8a2a1a; }
/* ---- the journal opened on the launcher's cover (Options, Load Game) */
.ln-book { position: absolute; inset: 0; z-index: 3; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.launcher.panel .ln-book { opacity: 1; pointer-events: auto; }
.launcher.panel .ln-title, .launcher.panel .ln-knot, .launcher.panel .ln-tag, .launcher.panel .ln-pos, .launcher.panel .ln-medal,
.launcher.panel .ln-plate.cont, .launcher.panel .ln-ver, .launcher.panel .ln-tab { opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.ln-title, .ln-knot, .ln-tag, .ln-medal, .ln-ver { transition: opacity .25s ease; }
/* two parchment cards with the journal's clasps, as on the character creation screen */
.ln-card { position: absolute; border-radius: calc(var(--u) * 6);
  background: var(--parch) repeat, #e8d6aa; background-size: calc(var(--u) * 300); border: calc(var(--u) * 2) solid #241307;
  box-shadow: inset 0 0 calc(var(--u) * 22) rgba(110, 70, 25, .45), inset 0 0 calc(var(--u) * 4) rgba(80, 50, 20, .5), 0 calc(var(--u) * 6) calc(var(--u) * 16) rgba(0, 0, 0, .65); }
/* the two cards differ in size: a larger left page, a smaller right one set a little lower */
.ln-card.l { left: calc(var(--u) * 62); top: calc(var(--u) * 106); width: calc(var(--u) * 478); height: calc(var(--u) * 522); }
.ln-card.r { left: calc(var(--u) * 562); top: calc(var(--u) * 138); width: calc(var(--u) * 372); height: calc(var(--u) * 470); }
.ln-cclasp { position: absolute; width: calc(var(--u) * 54); pointer-events: none; filter: drop-shadow(0 calc(var(--u) * 2) calc(var(--u) * 3) rgba(0, 0, 0, .55)); background: center / contain no-repeat; }
/* left card: clasps flipped to the other diagonal; right card as the journal. Each card pairs a large
   clasp with a small one, so the two never mirror each other; superseded: the cards differ in size instead */
.ln-cclasp.tr { top: calc(var(--u) * -4); right: calc(var(--u) * -4); aspect-ratio: 263 / 251; background-image: url(../assets/ui/clasp_tr.png); }
.ln-cclasp.bl { bottom: calc(var(--u) * -4); left: calc(var(--u) * -4); aspect-ratio: 250 / 249; background-image: url(../assets/ui/clasp_bl.png); }
.ln-cclasp.tl { top: calc(var(--u) * -4); left: calc(var(--u) * -4); aspect-ratio: 263 / 251; background-image: url(../assets/ui/clasp_tr.png); transform: scaleX(-1); }
.ln-cclasp.br { bottom: calc(var(--u) * -4); right: calc(var(--u) * -4); aspect-ratio: 250 / 249; background-image: url(../assets/ui/clasp_bl.png); transform: scaleX(-1); }

.ln-ptitle { position: absolute; left: 0; right: 0; top: calc(var(--u) * 46); text-align: center; font-family: var(--f-display); font-size: calc(var(--u) * 48); line-height: 1; }
.ln-page { position: absolute; color: #3a2410; font-family: var(--f-body); font-size: calc(var(--u) * 15.5); }
.ln-page.left { left: calc(var(--u) * 92); top: calc(var(--u) * 132); height: calc(var(--u) * 472); width: calc(var(--u) * 420); overflow-y: auto; padding-right: calc(var(--u) * 8); }
.ln-page.right { left: calc(var(--u) * 590); top: calc(var(--u) * 164); height: calc(var(--u) * 420); width: calc(var(--u) * 318); display: flex; flex-direction: column; }
.ln-page h2 { font-family: var(--f-display); font-weight: normal; font-size: calc(var(--u) * 26); margin: 0 0 calc(var(--u) * 4); color: #3a2410; }
.ln-page .ln-knot-sm { height: calc(var(--u) * 12); margin: calc(var(--u) * 2) 0 calc(var(--u) * 10); background: url(../assets/ui/divider_m.png) repeat-x 0 0 / auto 100%; opacity: .85; }
.ln-page p { margin: 0 0 calc(var(--u) * 8); line-height: 1.35; }
.ln-help { margin-top: auto; min-height: calc(var(--u) * 120); padding: calc(var(--u) * 10) calc(var(--u) * 12); border: 1px solid rgba(90, 55, 20, .45); border-radius: calc(var(--u) * 4); background: rgba(120, 80, 40, .08); font-style: italic; line-height: 1.35; }
.ln-page .ln-link { align-self: flex-start; margin-top: calc(var(--u) * 10); font-family: var(--f-display); font-size: calc(var(--u) * 16); color: #7a1a10; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline dotted; }
/* settings rows, inked on the page */
.ln-page .opt-row { display: grid; grid-template-columns: 1fr auto calc(var(--u) * 46); align-items: center; gap: calc(var(--u) * 8); padding: calc(var(--u) * 5) 0; border-bottom: 1px dashed rgba(90, 55, 20, .25); }
.ln-page .opt-row:hover { background: rgba(160, 100, 40, .08); }
.ln-page .opt-label { font-family: var(--f-display); font-size: calc(var(--u) * 16.5); }
.ln-page .opt-val { font-size: calc(var(--u) * 13); text-align: right; color: #6a4420; }
.ln-page .opt-note { font-family: var(--f-display); margin: calc(var(--u) * 10) 0 calc(var(--u) * 2); color: #7a1a10; font-size: calc(var(--u) * 15); }
/* toggles are gems: unlit off, lit on */
.ln-page input[type=checkbox] { appearance: none; -webkit-appearance: none; width: calc(var(--u) * 24); height: calc(var(--u) * 24); margin: 0; cursor: pointer;
  background: url(../assets/ui/launcher/gems/gem_ruby_off.png) center / contain no-repeat; transition: filter .15s; }
.ln-page input[type=checkbox]:checked { background-image: url(../assets/ui/launcher/gems/gem_ruby_lit.png); }
.ln-page input[type=checkbox]:hover { filter: brightness(1.15); }
/* sliders: an inked groove with an amber gem for a handle */
.ln-page input[type=range] { -webkit-appearance: none; appearance: none; width: calc(var(--u) * 130); height: calc(var(--u) * 20); background: transparent; cursor: pointer; }
.ln-page input[type=range]::-webkit-slider-runnable-track { height: calc(var(--u) * 5); border-radius: 99px; background: linear-gradient(90deg, rgba(90, 40, 16, .35), rgba(138, 42, 16, .75)); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.ln-page input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: calc(var(--u) * 20); height: calc(var(--u) * 20); margin-top: calc(var(--u) * -7.5); border: 0; background: url(../assets/ui/launcher/gems/gem_amber_lit.png) center / contain no-repeat; }
.ln-page input[type=range]::-moz-range-track { height: calc(var(--u) * 5); border-radius: 99px; background: linear-gradient(90deg, rgba(90, 40, 16, .35), rgba(138, 42, 16, .75)); }
.ln-page input[type=range]::-moz-range-thumb { width: calc(var(--u) * 20); height: calc(var(--u) * 20); border: 0; background: url(../assets/ui/launcher/gems/gem_amber_lit.png) center / contain no-repeat; }
.ln-page select, .ln-page .opt-text { max-width: calc(var(--u) * 170); font-family: var(--f-body); font-size: calc(var(--u) * 14); color: #3a2410; background: rgba(255, 245, 220, .5); border: 1px solid rgba(90, 55, 20, .55); border-radius: calc(var(--u) * 3); padding: calc(var(--u) * 3) calc(var(--u) * 5); }
.ln-page .opt-key, .ln-page .ink-btn.boxed { font-family: var(--f-display); font-size: calc(var(--u) * 14); color: #3a2410; background: rgba(255, 245, 220, .45); border: 1px solid rgba(90, 55, 20, .6); border-radius: calc(var(--u) * 3); padding: calc(var(--u) * 2) calc(var(--u) * 8); cursor: pointer; }
.ln-page .opt-key:hover, .ln-page .ink-btn.boxed:hover { color: #7a1a10; }
/* the save list */
.ln-save { display: grid; grid-template-columns: calc(var(--u) * 40) 1fr; gap: calc(var(--u) * 8); align-items: center; padding: calc(var(--u) * 6) calc(var(--u) * 4); border-bottom: 1px dashed rgba(90, 55, 20, .25); cursor: pointer; }
.ln-save:hover { background: rgba(160, 100, 40, .1); }
.ln-save.sel { background: rgba(122, 26, 16, .12); box-shadow: inset 3px 0 0 #7a1a10; }
.ln-save img, .ln-save .ph { width: calc(var(--u) * 40); height: calc(var(--u) * 50); object-fit: cover; border-radius: calc(var(--u) * 3); border: 1px solid rgba(60, 30, 10, .6); background: rgba(90, 55, 20, .2); }
.ln-save b { display: block; font-family: var(--f-display); font-weight: normal; font-size: calc(var(--u) * 16); }
.ln-save small { display: block; font-size: calc(var(--u) * 12.5); color: #6a4420; }
.ln-save-big { width: 100%; height: calc(var(--u) * 150); object-fit: contain; margin-bottom: calc(var(--u) * 8); }
/* torn parchment plates along the bottom, like the menu's own (no gems on them) */
.ln-pbtns { position: absolute; left: 0; right: 0; top: calc(var(--u) * 646); display: flex; justify-content: center; gap: calc(var(--u) * 36); }
.ln-pbtns .ln-plate { position: relative; width: calc(var(--u) * 210); height: calc(var(--u) * 50); }
.ln-pbtns .ln-btn { display: flex; align-items: center; justify-content: center; }
.ln-pbtns .ln-btn .g { display: none; }   /* plain plaques: the gems stay on the settings, not the buttons */
/* fields and lists on the launcher's cards */
.ln-field { display: flex; flex-direction: column; gap: calc(var(--u) * 4); margin: calc(var(--u) * 12) 0 0; }
.ln-field > span { font-family: var(--f-display); font-size: calc(var(--u) * 16); color: #5a3418; }
.ln-page .ln-code, .ln-page .ln-text { font-family: var(--f-body); color: #2a1608; background: rgba(255, 245, 220, .55); border: 1px solid rgba(90, 55, 20, .6); border-radius: calc(var(--u) * 4);
  box-shadow: inset 0 1px 3px rgba(60, 30, 10, .3); padding: calc(var(--u) * 6) calc(var(--u) * 10); outline: none; }
.ln-page .ln-code { font-family: var(--f-display); font-size: calc(var(--u) * 34); letter-spacing: .3em; text-align: center; text-transform: uppercase; }
.ln-page .ln-text { font-size: calc(var(--u) * 18); }
.ln-page .ln-code:focus, .ln-page .ln-text:focus { border-color: #7a1a10; box-shadow: inset 0 1px 3px rgba(60, 30, 10, .3), 0 0 0 2px rgba(122, 26, 16, .25); }
.ln-err { min-height: calc(var(--u) * 20); margin-top: calc(var(--u) * 10) !important; color: #8a2a1a; font-style: italic; }
.ln-steps { margin: 0; padding-left: calc(var(--u) * 22); line-height: 1.45; }
.ln-steps li { margin-bottom: calc(var(--u) * 10); }
.ln-credit b { display: block; font-family: var(--f-display); font-weight: normal; color: #7a1a10; font-size: calc(var(--u) * 15); }
/* the mount pinning each bottom plate (rendered in PhotoCraft like the buckles), gem in its socket */
.ln-mount { position: absolute; left: calc(var(--u) * -16); top: 50%; width: calc(var(--u) * 46); aspect-ratio: 372 / 360; transform: translateY(-50%);
  background: url(../assets/ui/launcher/mount.png) center / contain no-repeat; pointer-events: none; filter: drop-shadow(0 calc(var(--u) * 2) calc(var(--u) * 3) rgba(0, 0, 0, .6)); }
.ln-mount i { position: absolute; left: 38%; top: 49.1%; width: calc(var(--u) * 17); height: calc(var(--u) * 17); transform: translate(-50%, -50%); background: center / contain no-repeat; transition: opacity .2s; }
.ln-mount .lit { opacity: 0; } .ln-mount.on .lit { opacity: 1; }
.ln-pbtns .ln-btn { padding-left: 0; }   /* lettering stays centred on the plate; the mount simply overlaps it */
/* finished art from helper task 038, switched on by the launcher once each file exists */
.launcher.leather-v2 .ln-stage { background: radial-gradient(ellipse at 50% 46%, transparent 55%, rgba(10, 5, 2, .45) 100%), url(../assets/ui/launcher/cover_leather.jpg) center / 100% 100%, #3a2416; }
.launcher.leather-v2 .ln-stage::before, .launcher.leather-v2 .ln-stage::after { display: none; }
.launcher.mount-v2 .ln-mount { background-image: url(../assets/ui/launcher/mount_v2.png); aspect-ratio: 400 / 390; }
.launcher.plates-v2 .ln-btn, .launcher.plates-v2 .ln-continue { -webkit-mask-image: none !important; mask-image: none !important; background: url(../assets/ui/launcher/plates/plate_1.png) center / 100% 100% no-repeat; }
.launcher.plates-v2 .ln-pos.l2 .ln-btn, .launcher.plates-v2 .ln-pos.r3 .ln-btn { background-image: url(../assets/ui/launcher/plates/plate_2.png); }
.launcher.plates-v2 .ln-pos.l3 .ln-btn, .launcher.plates-v2 .ln-pos.r1 .ln-btn, .launcher.plates-v2 .ln-continue { background-image: url(../assets/ui/launcher/plates/plate_3.png); }
.launcher.plates-v2 .ln-pbtns .ln-btn { background-image: url(../assets/ui/launcher/plates/plate_small.png); }
/* character creation and the vault, shown on the cover (js/main.js: HOSTED, fitHost). The launcher
   gives the leather, seam, clasps and gold heading; the screen brings its cards and plates. */
#ln-host { position: absolute; width: 100rem; height: 71rem; transform-origin: 0 0; z-index: 5; display: none; }
.launcher.hosting #ln-host { display: block; }
.launcher.hosting .ln-card, .launcher.hosting .ln-page, .launcher.hosting .ln-pbtns { display: none; }
#ln-host .cv-cover, #ln-host .cv-clasp, #ln-host .cf-title { display: none; }
#ln-host .cframe { animation: none; }
.launcher.panel .ln-straps, .launcher.panel .ln-gems, .launcher.panel .ln-scene { opacity: 0; transition: opacity .25s ease; }
.ln-straps, .ln-gems { transition: opacity .25s ease; }
/* hosted screens are a little taller than the game stage, so the actions sit at the card's foot */
#ln-host .cf-bottom { top: auto; bottom: 3.4rem; }
.launcher.hosting .ln-book { pointer-events: none; }   /* only its heading shows; clicks go to the hosted screen */
/* hosted creation and vault: one parchment page. A narrow column on its left holds the abbreviated
   character; the builder (or the vault's list) fills the rest; the steps are plates down the right */
#ln-host .cf-main { left: 1.5rem; top: 1rem; right: 21rem; bottom: 7.4rem; padding-left: 20.4rem; }
#ln-host .cframe.no-side .cf-main { right: 1.5rem; }
#ln-host .cf-summary { left: 1.5rem; top: 1rem; width: 18.4rem; bottom: 7.4rem; z-index: 3; padding: 2.2rem 1.4rem 1.6rem 1.8rem;
  background: none; border: 0; box-shadow: none; border-right: .12rem dashed rgba(90, 55, 20, .35); border-radius: 0; }
#ln-host .cf-summary > .clasp { display: none; }
#ln-host .cs-portrait { width: 12rem; height: 14.8rem; }
#ln-host .cf-side { right: 1rem; width: 18.4rem; top: 2.2rem; bottom: 7.4rem; gap: .6rem; }
#ln-host .cf-bottom { bottom: 1.4rem; }
#ln-host .cf-bottom { gap: 1.8rem; }
#ln-host .cf-bottom .cv-plate { width: 14.6rem; }

/* Skills sub-tabs: one tight line; .cf-wide (set by CharCreate.fitTabs) drops the summary when they still don't fit */
#ln-host .sub-tabs { flex-wrap:nowrap; gap:.1rem; justify-content:space-between; overflow:hidden; }
#ln-host .sub-tabs .ink-btn { font-size:1.55rem; padding:.2rem .55rem; white-space:nowrap; flex:0 1 auto; }
#ln-host .cframe.cf-wide .cf-summary { display:none; }
#ln-host .cframe.cf-wide .cf-main { padding-left:1.5rem; }

/* labels stay on one line; long ones get a wider plate */
.cv-plate > .plaque { white-space: nowrap; }
#ln-host .cf-bottom .cv-plate.long, .cf-bottom .cv-plate.long { width: 20rem; }

/* Baldur's Gate import: the portrait beside its picker */
.imp-row { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .6rem; }
.imp-portrait { flex: 0 0 auto; width: 84px; height: 112px; border: 2px solid #6b4a26; border-radius: 4px; background: #2a1d12; display: grid; place-items: center; overflow: hidden; color: #c9a86a; font-size: 1.6rem; }
.imp-portrait img { width: 100%; height: 100%; object-fit: cover; }

/* import from a Baldur's Gate folder: the list of characters to pick */
.bgf-list { max-height: 26rem; display: flex; flex-direction: column; gap: .35rem; }
.bgf-row { display: flex; align-items: center; gap: .7rem; padding: .3rem .4rem; border-radius: 4px; cursor: pointer; }
.bgf-row:hover { background: rgba(120, 80, 30, .12); }
.bgf-row.bad { opacity: .6; cursor: default; }
.bgf-row input { width: 1.1rem; height: 1.1rem; }
.bgf-pic { flex: 0 0 auto; width: 42px; height: 56px; border: 1px solid #6b4a26; border-radius: 3px; background: #2a1d12; display: grid; place-items: center; overflow: hidden; color: #c9a86a; }
.bgf-pic img { width: 100%; height: 100%; object-fit: cover; }
.bgf-text { display: flex; flex-direction: column; }
.bgf-text small { opacity: .8; }
.bgf-report > li { margin-bottom: .4rem; }
