/* ================= In-game HUD (classic two-bar layout, in leather) ================= */
.game-loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-body); font-style: italic; font-size: 2.4rem; color: #a08560; }
#screen[data-screen="game"] { pointer-events: none; }
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; font-size: 1.6rem; color: var(--ink); }
#hud .hud-block, #hud .hud-block * { pointer-events: auto; }
#modal-layer { z-index: 70; }   /* above the HUD (20) and the launcher cover (60), which hosts creation and the vault */

.hud-left, .hud-right { position: absolute; top: 0; bottom: 0; width: 9.6rem; display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 1.4rem 0; }
.hud-left { left: 0; border-right: .25rem solid #1a0d05; }
.hud-right { right: 0; border-left: .25rem solid #1a0d05; }
.hud-left.stitched::after, .hud-right.stitched::after, .hud-bottom.stitched::after { inset: .55rem; border-radius: .4rem; }
.hl-party { display: flex; flex-direction: column; gap: .6rem; position: relative; z-index: 1; }
.hl-spacer { flex: 1; }

.pc {
  position: relative; width: 7rem; height: 9.1rem; border-radius: .4rem; overflow: hidden;
  border: .2rem solid #1a0d05; outline: .15rem solid rgba(214, 178, 94, .45); outline-offset: -.35rem;
  box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .7); background: #2a1a10; transition: border-color .15s, box-shadow .15s;
}
.pc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pc:hover { border-color: #8a6a3a; }
.pc.sel { border-color: #5ce05c; box-shadow: 0 0 1rem rgba(92, 224, 92, .55), 0 .3rem .8rem rgba(0, 0, 0, .7); }
.pc-hp { position: absolute; left: .4rem; right: .4rem; bottom: .4rem; height: .6rem; background: rgba(0, 0, 0, .65); border-radius: .3rem; overflow: hidden; }
.pc-hp-fill { display: block; height: 100%; width: 100%; background: linear-gradient(#6fd06f, #2f8a2f); }
.pc-hptext { position: absolute; left: 0; right: 0; bottom: 1.05rem; text-align: center; font-family: var(--f-display); font-size: 1.35rem; color: #fff3d0; text-shadow: 0 0 .3rem #000, 0 .1rem .2rem #000; pointer-events: none; }
.pc-hptext.hurt { color: #ffd070; } .pc-hptext.low { color: #ff8a70; }

/* square menu/action buttons: parchment tab art in a dark leather socket */
.hb-sq {
  position: relative; z-index: 1; width: 6.6rem; height: 6.6rem; border-radius: .5rem; overflow: hidden; flex-shrink: 0;
  border: .2rem solid #1a0d05; box-shadow: inset 0 0 0 .12rem rgba(214, 178, 94, .35), 0 .25rem .6rem rgba(0, 0, 0, .7);
  background: #2a170b; transition: transform .12s, filter .12s, box-shadow .12s;
}
.hb-sq img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hb-sq:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-.15rem); }
.hb-sq:disabled { opacity: .45; cursor: default; }
.hb-sq.on { box-shadow: 0 0 0 .2rem var(--gold-bright), 0 0 1.4rem rgba(245, 210, 120, .55); }
.hb-parch { display: grid; place-items: center; width: 100%; height: 100%; background: var(--parch) center / 20rem; }
.hb-parch img { width: 70%; height: 70%; object-fit: contain; }
.hb-glyph { font-family: var(--f-display); font-size: 2.4rem; color: var(--gold-bright); background: linear-gradient(#4a2c18, #24140a); text-shadow: 0 .15rem .2rem #000; }
.hb-glyph-ink { font-size: 3.4rem; color: #4a3020; }
.hb-pause { padding: 0; background: radial-gradient(circle at 40% 35%, #5a3a24, #24140a); border-radius: 50%; }
.hb-pause.on { box-shadow: 0 0 0 .2rem #c83a2a, 0 0 1.4rem rgba(200, 58, 42, .7); }
.td-dial, .td-dial svg { display: block; width: 100%; height: 100%; }
.td-knot { pointer-events: none; }
.td-k-back { fill: none; stroke: #23262b; stroke-width: 4.4; }   /* the dark ground behind the braid */
.td-k-border { fill: none; stroke: url(#td-pewter); stroke-width: .9; }
.td-k-ink { fill: none; stroke: #121417; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.td-k-metal { fill: none; stroke: url(#td-pewter); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.td-k-hi { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: .3; transform: translate(-.15px, -.2px); }
.td-disc { transform-box: view-box; transform-origin: 0 0; transition: transform .45s cubic-bezier(.3, 1.7, .45, 1); }   /* the clockwork tick */
.td-disc.td-jump { transition: none; }
.td-sun { fill: #ffe68a; stroke: #c8862a; stroke-width: .7; }
.td-moon { fill: #e8eefc; }
.td-moon-shade { fill: #0f1a3e; opacity: .92; }
.td-crater { fill: #c8d2ea; }
.td-star { fill: #f4f0d8; }
.td-cloud ellipse { fill: #f6f2ea; opacity: .85; }
.td-ground { fill: #22160c; }
.td-ground-edge { fill: none; stroke: #0e0904; stroke-width: .9; }
.td-rim-in { fill: none; stroke: rgba(30, 18, 6, .7); stroke-width: .6; }
.td-time { font: 400 6.6px var(--f-display); fill: #f0dcb0; }
.td-time.on-land { stroke: #102018; stroke-width: .25px; paint-order: stroke; }   /* readable over the painted landscape */
.td-pausemark { display: none; fill: #ff8a70; }
.hb-pause.on .td-pausemark { display: inline; }
.hb-pause.on .td-disc { filter: brightness(.65); }
.hb-return { display: none; }
#hud.book-open .hb-return { display: block; }

.hud-bottom {
  position: absolute; left: 9.6rem; right: 9.6rem; bottom: 0; height: 12.4rem;
  border-top: .25rem solid #1a0d05; display: grid; grid-template-columns: minmax(18rem, 1fr) auto 17rem; gap: 1.2rem; padding: 1.1rem 1.4rem;
}
.hb-main { display: flex; flex-direction: column; gap: .7rem; min-width: 0; position: relative; z-index: 1; }
.hb-log {
  flex: 1; min-height: 0; padding: .5rem 1rem; border-radius: .4rem;
  background: rgba(12, 7, 3, .82); border: .15rem solid rgba(214, 178, 94, .35); box-shadow: inset 0 0 1rem rgba(0, 0, 0, .8);
  font-size: 1.4rem; line-height: 1.35; color: #e6d2a8;
}
.log-line.hint { color: #a8c890; font-style: italic; }
.log-line.warn { color: #f0907a; }
.hb-actions { display: flex; gap: .6rem; }
.hb-act { width: 4.4rem; height: 4.4rem; border-radius: .4rem; border: .15rem solid #1a0d05; background: linear-gradient(#1c130b, #120c07); box-shadow: inset 0 0 0 .1rem rgba(214, 178, 94, .28), inset 0 .2rem .6rem rgba(0, 0, 0, .9); padding: .3rem; }
.hb-act img { width: 100%; height: 100%; object-fit: contain; }
.hb-act:hover:not(:disabled) { filter: brightness(1.15); }
.hb-act:disabled { opacity: .5; cursor: default; filter: grayscale(.4); }
.hb-side { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: var(--gold-bright); text-shadow: 0 .15rem .3rem #000; text-align: center; }
.hb-area { font-family: var(--f-display); font-size: 2.2rem; line-height: 1.1; }
.hb-rot { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.hb-rotbtn { font-size: 2.1rem; color: var(--gold); width: 3.2rem; height: 3.2rem; border-radius: 50%; border: .15rem solid rgba(214, 178, 94, .45); line-height: 1; background: rgba(0, 0, 0, .25); }
.hb-rotbtn:hover { background: rgba(214, 178, 94, .18); }
.hb-compass { font-family: var(--f-sc); font-size: 1.6rem; min-width: 6rem; }
.hb-clock { font-size: 1.4rem; font-style: italic; color: #cdb07a; }

/* pause frame over the play area only */
.hud-paused { position: absolute; left: 9.6rem; right: 9.6rem; top: 0; bottom: 12.4rem; pointer-events: none; opacity: 0; transition: opacity .2s; box-shadow: inset 0 0 0 .35rem rgba(200, 50, 30, .55), inset 0 0 5rem rgba(120, 20, 10, .3); }
.hud-paused.on { opacity: 1; }
.hud-paused span { position: absolute; top: 1.2rem; left: 50%; transform: translateX(-50%); font-family: var(--f-display); font-size: 3rem; color: #ffd8c0; text-shadow: 0 0 1rem rgba(200, 50, 30, .9), 0 .2rem .3rem #000; letter-spacing: .2rem; }

.marquee { position: fixed; display: none; border: 1px solid #5ce05c; background: rgba(92, 224, 92, .12); pointer-events: none; z-index: 40; }

/* ================= In-game book menu (native aspect, never stretched) ================= */
.gb-veil { position: absolute; left: 9.6rem; right: 9.6rem; top: 0; bottom: 12.4rem; display: grid; place-items: center; background: rgba(6, 4, 2, .62); animation: fadein .2s ease; }
.gbook {
  position: relative; aspect-ratio: 1805 / 1055;
  width: min(calc(100vw - 21.2rem), calc((100vh - 14rem) * 1.7109), 112rem);   /* capped in rem so the text keeps its proportion to the page */
  filter: drop-shadow(0 1rem 2.4rem rgba(0, 0, 0, .75));
  animation: bookin .3s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes bookin { from { transform: scale(.96); opacity: 0; } }
.gb-art { position: absolute; inset: 0; background: url('../assets/ui/book_menu.webp') center / 100% 100% no-repeat; } /* box has the art's own aspect ratio */
.gb-equip { position: absolute; pointer-events: none; opacity: .92; }
/* the paper doll: the character's live 3D model, warmed a touch to sit on the parchment */
.gb-doll { position: absolute; pointer-events: none; }
.gb-doll3d { width: 100%; height: 100%; display: block; pointer-events: auto; cursor: grab; filter: sepia(.18) saturate(.92) drop-shadow(0 .4rem .5rem rgba(60, 35, 10, .35)); }
.gb-doll3d:active { cursor: grabbing; }
.gb-sheet { position: absolute; overflow: hidden; }
.gb-div { position: absolute; background: url('../assets/ui/divider_rule.png') center / 100% 100% no-repeat; }
.gb-page { position: absolute; display: flex; flex-direction: column; }
.gb-right { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gb-tab { position: absolute; border-radius: .6rem; transition: box-shadow .15s, background .15s; }
.gb-tab:hover { background: rgba(255, 240, 200, .12); }
.gb-tab.on { box-shadow: inset 0 0 0 .2rem rgba(110, 29, 26, .7), 0 0 1rem rgba(255, 220, 150, .4); background: rgba(255, 240, 200, .1); }
.gb-title { text-align: center; font-size: 3.4rem; margin: 0 0 .1rem; }
.gb-sub { font-size: 2rem; margin: .8rem 0 .2rem; border-bottom: .1rem solid var(--ink-faint); }
.gb-scroll { flex: 1; min-height: 0; padding-right: .6rem; font-size: 1.6rem; line-height: 1.4; }
.gb-empty { font-size: 1.9rem; text-align: center; margin-top: 3rem; }
.gb-note { margin: .3rem 0; }
.gb-time { font-family: var(--f-sc); color: var(--ink-soft); font-size: 1.3rem; }
.gb-foot { display: flex; justify-content: space-between; align-items: center; padding-top: .5rem; border-top: .1rem solid var(--ink-faint); font-family: var(--f-display); font-size: 1.9rem; }
.gb-foot b { font-weight: 400; }
.gb-map { width: 100%; height: auto; border-radius: .4rem; border: .15rem solid #4a3020; cursor: crosshair; margin: .6rem 0; }
.gb-spells { list-style: none; margin: 0; padding: 0; }
.gb-spells li { display: flex; justify-content: space-between; padding: .25rem .4rem; border-bottom: .1rem dashed rgba(58, 36, 18, .2); }
.gb-spells b { font-family: var(--f-display); font-weight: 400; font-size: 1.9rem; }
.gb-spells small { font-style: italic; color: var(--ink-soft); }
.gb-options .opt-row { grid-template-columns: 13rem 1fr 6rem; }
.gb-options .opt-label { font-size: 1.7rem; }
.gb-options .opt-tab { font-size: 1.8rem; padding: .2rem .8rem; }
.gb-page .rec { flex: 1; min-height: 0; overflow-y: auto; }

/* compact character sheet across the top of the left page */
.gb-sheet .sheet-head { height: 100%; grid-template-columns: 12.5rem 13rem 1fr; gap: .4rem; }
.gb-sheet .sh-stat { font-size: 1.5rem; line-height: 1.2; }
.gb-sheet .sh-stat b { min-width: 3.4rem; }
.gb-sheet .sh-portrait { height: 13.4rem; }
.gb-sheet .sh-oval { width: 8.2rem; height: 11rem; }
.gb-sheet .sh-meter { width: 3.2rem; height: 12rem; }
.gb-sheet .sh-mlabel { font-size: .95rem; }
.gb-sheet .sh-id { font-size: 1.55rem; gap: 0; }
.gb-sheet .sh-name { font-size: 1.9rem; }

/* ================= Items, slots, loot ================= */
.item { position: relative; width: 100%; height: 100%; display: grid; place-items: center; cursor: grab; border-radius: .3rem; touch-action: none; }
.item img { width: 92%; height: 92%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 .15rem .2rem rgba(0, 0, 0, .55)); }
.item .it-glyph { font-size: 2.4rem; color: #4a3020; text-shadow: 0 .1rem 0 rgba(255, 240, 210, .5); pointer-events: none; }
.item .it-qty { position: absolute; right: .2rem; bottom: .05rem; font-family: var(--f-display); font-weight: 400; font-size: 1.3rem; color: #fff3d0; text-shadow: 0 0 .3rem #000, 0 .1rem .1rem #000; pointer-events: none; }
.item.unusable { background: rgba(160, 30, 20, .28); }
.item.dragging { opacity: .3; }
.item-ghost { position: fixed; z-index: 90; pointer-events: none; opacity: .9; transform: scale(1.1); }
.drop-ok { box-shadow: 0 0 0 .2rem var(--gold-bright), 0 0 1rem rgba(245, 210, 120, .6) !important; }

.gb-slots { position: absolute; inset: 0; pointer-events: none; }
.gb-slot { position: absolute; pointer-events: auto; border-radius: .5rem; }
.gb-slot:hover { background: rgba(110, 70, 30, .12); }
.gb-slot.filled { background: radial-gradient(circle, rgba(255, 244, 214, .95) 40%, rgba(232, 214, 170, .9)); box-shadow: inset 0 0 .5rem rgba(90, 55, 20, .5), 0 0 0 .1rem rgba(90, 55, 20, .35); }
.gb-pack, .lp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.gb-pack { margin: .6rem 0; }
.gb-cell { aspect-ratio: 1; border-radius: .4rem; background: radial-gradient(circle, rgba(255, 246, 222, .7) 40%, rgba(236, 220, 180, .6)); box-shadow: inset 0 0 .35rem rgba(90, 55, 20, .3), 0 0 0 .1rem rgba(90, 55, 20, .22); }
.gb-hint { margin: .5rem 0 0; }
.gb-right .gb-foot { margin-top: auto; }

.hover-label { position: fixed; z-index: 45; pointer-events: none; display: none; padding: .3rem .9rem; border-radius: .3rem; white-space: nowrap;
  background: #e8d3a6 url('../assets/ui/parchment.jpg') center / 30rem; border: .12rem solid #6a4a2c; color: var(--ink, #2a1a0c); font-family: var(--f-body); font-size: 1.45rem; box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .55); }
.hover-label.on { display: block; }

/* loot panel replaces the bottom bar */
#hud.loot-open .hud-bottom { display: none; }
.hud-loot {
  position: absolute; left: 9.6rem; right: 9.6rem; bottom: 0; height: 17rem; border-top: .25rem solid #1a0d05;
  display: grid; grid-template-columns: 16rem auto 3rem 7rem auto; justify-content: center; gap: 1.6rem; align-items: center; padding: 1.1rem 1.6rem; z-index: 2;
}
.hud-loot > * { position: relative; z-index: 1; }
.lp-side { display: flex; flex-direction: column; gap: .5rem; }
.lp-side .plaque { font-size: 1.7rem; padding: .4rem .6rem; }
.lp-title { font-family: var(--f-display); font-size: 2.2rem; color: var(--gold-bright); text-shadow: 0 .15rem .3rem #000; text-align: center; }
.lp-note { font-size: 1.3rem; color: #cdb07a; font-style: italic; text-align: center; }
.lp-grid { --cell: 6.2rem; padding: .6rem; border-radius: .5rem; background: var(--parch) center / 30rem; box-shadow: inset 0 0 1.4rem rgba(90, 55, 20, .5);
  grid-template-columns: repeat(5, var(--cell)); grid-auto-rows: var(--cell); height: calc(var(--cell) * 2 + .5rem + 1.2rem); overflow-y: auto; box-sizing: border-box; }
.lp-grid .gb-cell { aspect-ratio: auto; }
.lp-arrow { font-size: 2.6rem; color: var(--gold); text-align: center; text-shadow: 0 .15rem .3rem #000; }
.lp-who { display: flex; flex-direction: column; align-items: center; gap: .3rem; font-family: var(--f-display); color: var(--gold-bright); font-size: 1.6rem; text-shadow: 0 .1rem .2rem #000; }
.lp-who img { width: 6rem; height: 7.8rem; object-fit: cover; border-radius: .4rem; border: .15rem solid #1a0d05; }
.gb-cell.empty { opacity: .6; }

.iteminfo { display: grid; grid-template-columns: 9rem 1fr; gap: 1.6rem; align-items: start; }
.ii-icon { width: 9rem; height: 9rem; background: rgba(110, 70, 30, .14); border-radius: .6rem; box-shadow: inset 0 0 .6rem rgba(90, 55, 20, .45); }

.save-list { display: flex; flex-direction: column; gap: .4rem; max-height: 34rem; overflow-y: auto; }
.save-row { display: flex; gap: 1rem; align-items: center; padding: .4rem .6rem; border-bottom: .1rem dashed var(--ink-faint); font-size: 1.6rem; }
.save-row img { width: 3.6rem; height: 4.6rem; object-fit: cover; border-radius: .3rem; }
.save-row b { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; display: block; }
.save-row small { color: var(--ink-soft); font-style: italic; }
.save-row.empty { opacity: .55; }
.save-name-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; font-family: var(--f-display); font-size: 1.8rem; }
.save-name { flex: 1; font-size: 1.7rem; padding: .3rem .6rem; background: rgba(255, 248, 225, .5); border: .15rem solid var(--ink-faint); border-radius: .4rem; }
.card .card-actions { flex-wrap: wrap; }
.gb-pack { gap: .4rem; margin: .4rem 0; }
.hud-bottom { grid-template-rows: minmax(0, 1fr); }
.hb-main { min-height: 0; overflow: hidden; }
.hb-actions { flex-shrink: 0; }

/* ================= Inventory page rework ================= */
.gb-cats { display: flex; justify-content: center; gap: .5rem; margin: .1rem 0 .3rem; flex-shrink: 0; }
.gb-cat { position: relative; width: 4.4rem; height: 4.4rem; border-radius: .5rem; padding: .2rem; transition: background .12s, box-shadow .12s, opacity .12s; }
.gb-cat img { width: 100%; height: 100%; object-fit: contain; display: block; }
.gb-cat:hover { background: rgba(110, 70, 30, .14); }
.gb-cat.on { background: rgba(110, 29, 26, .14); box-shadow: inset 0 0 0 .18rem rgba(110, 29, 26, .65); }
.gb-cat.none { opacity: .38; }
.gb-cat b { position: absolute; right: -.1rem; bottom: -.2rem; min-width: 1.7rem; height: 1.7rem; padding: 0 .3rem; border-radius: .9rem; background: #6e1d1a; color: #f6e7c8; font: 400 1.2rem/1.7rem var(--f-display); text-align: center; }
.gb-pack { width: 82%; margin: .2rem auto; flex-shrink: 0; }
.gb-pack .gb-cell.dim .item { opacity: .22; filter: grayscale(1); }
.gb-pack .gb-cell.hit { box-shadow: inset 0 0 0 .18rem rgba(110, 29, 26, .55), inset 0 0 .5rem rgba(90, 55, 20, .45); }
.gb-cell.viewing { box-shadow: inset 0 0 0 .2rem var(--gold), inset 0 0 .8rem rgba(214, 178, 94, .6); }
.gb-cell.pickable { animation: pickpulse 1s ease-in-out infinite alternate; }
@keyframes pickpulse { to { box-shadow: inset 0 0 0 .22rem #3a7ad0, inset 0 0 1rem rgba(80, 140, 230, .6); } }
.gb-pick { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .4rem .8rem; margin: .1rem 0 .3rem; border-radius: .5rem; background: rgba(58, 122, 208, .14); font-family: var(--f-display); font-size: 1.7rem; color: #23406a; }
.gb-weight { display: flex; justify-content: space-between; width: 82%; margin: 0 auto .2rem; font-family: var(--f-display); font-size: 1.6rem; color: var(--ink-soft); flex-shrink: 0; }
.gb-weight .warn { color: #8a1a10; }
.gb-groundhead { display: flex; align-items: center; gap: .6rem; padding-top: .3rem; border-top: .1rem solid var(--ink-faint); flex-shrink: 0; }
.gb-gtitle { font-family: var(--f-display); font-size: 2rem; flex: 1; }
.gb-gnote { font-style: italic; color: var(--ink-soft); font-size: 1.4rem; }
.gb-groundhead .ink-btn { font-size: 1.5rem; padding: .1rem .7rem; }
.gb-groundgrid { width: 82%; margin: 0 auto; flex-shrink: 0; display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: min-content; gap: .4rem; padding: .2rem 0; overflow-y: auto; border-radius: .5rem;
  /* two rows of the same boxes as the pack above (82% of the page, five across), then scroll */
  aspect-ratio: 5 / 2.1; }
.gb-groundgrid .gb-cell.empty { opacity: .5; }

/* item / spell details take over the left page */
.gbook.detail .gb-leftset { display: none; }
.gb-detail { position: absolute; display: none; flex-direction: column; padding: 0 1rem; }
.gbook.detail .gb-detail { display: flex; animation: fadein .18s ease; }
.gd-head { display: grid; grid-template-columns: 10rem 1fr; gap: 1.4rem; align-items: center; }
.gd-icon { width: 10rem; height: 10rem; border-radius: .8rem; background: radial-gradient(circle, rgba(255, 244, 214, .95) 40%, rgba(232, 214, 170, .9)); box-shadow: inset 0 0 .8rem rgba(90, 55, 20, .5), 0 0 0 .12rem rgba(90, 55, 20, .35); padding: .6rem; }
.gd-name { font-size: 3.2rem; margin: 0; line-height: 1.05; }
.gd-kind { font-family: var(--f-sc); color: var(--ink-soft); font-size: 1.5rem; }
.gd-body { flex: 1; min-height: 0; overflow-y: auto; font-size: 1.7rem; line-height: 1.45; }
.gd-table { width: 100%; margin: .2rem 0 .6rem; }
.gd-desc { margin: .4rem 0; }
.gd-acts { display: flex; flex-wrap: wrap; gap: .6rem; padding-top: .6rem; border-top: .1rem solid var(--ink-faint); }
.gd-acts .ink-btn { font-size: 1.8rem; padding: .2rem 1.1rem; }

/* spell tiles */
.spell-tile { position: relative; width: 100%; height: 100%; display: grid; place-items: center; border-radius: .6rem; cursor: pointer; touch-action: none;
  background: radial-gradient(circle at 40% 35%, #fff4d8, #d8bf8c); box-shadow: inset 0 0 0 .2rem var(--sch, #6a5030), inset 0 0 .6rem rgba(60, 35, 10, .5); }
.spell-tile img { position: absolute; inset: 5%; width: 90%; height: 90%; object-fit: cover; border-radius: .45rem; pointer-events: none; }
.spell-tile .sp-glyph { font-size: 2.2rem; color: var(--sch, #4a3020); pointer-events: none; line-height: 1; }
.spell-tile .sp-abbr { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; font: normal 400 1rem/1 var(--f-sc); color: #3a2410; pointer-events: none; }
.spell-tile img ~ .sp-abbr { display: none; }
.spell-tile .it-qty { right: -.1rem; bottom: -.2rem; }
.spell-tile.dim { filter: grayscale(.85) brightness(.85); opacity: .7; }
.spell-tile.dragging { opacity: .3; }
.sch-abj { --sch: #3a6a9a; } .sch-conj { --sch: #8a5a1a; } .sch-div { --sch: #2a7a7a; } .sch-ench { --sch: #9a3a7a; }
.sch-illu { --sch: #6a3a9a; } .sch-evoc { --sch: #b03a1a; } .sch-necro { --sch: #3a3a3a; } .sch-trans { --sch: #4a7a2a; } .sch-power { --sch: #a8781a; }
.gb-memo, .gb-known { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; margin: .4rem 0 .6rem; }
.gb-cell.sp { padding: .25rem; }
.gb-cell.sp.resting { box-shadow: inset 0 0 0 .15rem rgba(58, 36, 18, .35), inset 0 0 .5rem rgba(90, 55, 20, .45); }
.gb-cell.locked { opacity: .55; }
.gb-magicnote { margin-top: .8rem; }

/* ================= Quick bar (BG3-style hotbar) ================= */
.hb-main { grid-row: 1; }
.hb-bar { position: relative; z-index: 1; display: flex; align-items: center; gap: .8rem; padding: .5rem .8rem; border-radius: .8rem;
  background: linear-gradient(rgba(10, 6, 3, .78), rgba(20, 12, 6, .88)); box-shadow: inset 0 0 0 .12rem rgba(214, 178, 94, .35), inset 0 .1rem 1rem rgba(0, 0, 0, .7), 0 .2rem .6rem rgba(0, 0, 0, .5); }
.hb-core { display: grid; grid-template-columns: repeat(2, 4.3rem); grid-auto-rows: 4.3rem; gap: .4rem; align-content: center; padding-right: .8rem; border-right: .12rem solid rgba(214, 178, 94, .25); }
.hb-core .hb-act { width: 4.3rem; height: 4.3rem; }
.qbar { display: flex; align-items: center; }
.qb-grid { display: grid; grid-template-columns: repeat(11, 4.3rem); grid-auto-rows: 4.3rem; gap: .4rem; }
.qb-none { color: #a08560; font-style: italic; font-size: 1.4rem; padding: 0 2rem; }
.qb-slot { position: relative; border-radius: .5rem; background: linear-gradient(#1c130b, #120c07); box-shadow: inset 0 0 0 .1rem rgba(214, 178, 94, .28), inset 0 .2rem .6rem rgba(0, 0, 0, .9); transition: box-shadow .12s, transform .12s; }
.qb-slot:not(.empty):hover { box-shadow: inset 0 0 0 .14rem var(--gold-bright), 0 0 .9rem rgba(245, 210, 120, .45); transform: translateY(-.1rem); }
.qb-slot.empty { opacity: .65; }
.qb-slot .item { padding: .15rem; }
.qb-slot .item .it-qty { font-size: 1.15rem; }
.qb-slot .spell-tile { width: 88%; height: 88%; margin: 6%; }
.qb-slot.active { box-shadow: inset 0 0 0 .16rem #5ce05c, 0 0 .7rem rgba(92, 224, 92, .4); }
.qb-slot.spent .item, .qb-slot.spent .spell-tile { filter: grayscale(.9) brightness(.7); }
.qb-glyph { width: 100%; height: 100%; display: grid; place-items: center; color: #6a5030; font-size: 2rem; }
.qb-act { width: 100%; height: 100%; padding: .35rem; border-radius: .5rem; background: none; cursor: pointer; touch-action: none; }
.qb-act img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.qb-slot .item, .qb-act { cursor: pointer; }

/* effect glyphs on the portraits */
.pc-fx { position: absolute; top: .2rem; right: .25rem; display: flex; flex-direction: column; gap: .1rem; pointer-events: none; }
.pc-fx i { font-style: normal; font-size: 1.15rem; line-height: 1.5rem; width: 1.6rem; height: 1.6rem; text-align: center; border-radius: 50%; background: rgba(20, 40, 70, .82); color: #cfe4ff; box-shadow: 0 0 .3rem rgba(120, 180, 255, .6); }
#hud.targeting .pc { cursor: cell; }
.item.unid { box-shadow: inset 0 0 0 .12rem rgba(58, 122, 208, .45); }
.spell-tile .it-qty { z-index: 2; font-size: 1.3rem; }
/* softbox shape: rounded squares for spell icons, quick slots and item cells */
.spell-tile { border-radius: 22%; }
.spell-tile img { border-radius: 18%; }
.qb-slot, .qb-act, .gb-cell, .gb-slot, .gd-icon { border-radius: 22%; }
.qb-slot .spell-tile { width: 90%; height: 90%; margin: 5%; }
/* hold-Tab loot labels */
.loot-labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.loot-label { position: absolute; transform: translate(-50%, -100%); padding: .2rem .8rem; border-radius: .3rem; white-space: nowrap;
  background: #e8d3a6 url('../assets/ui/parchment.jpg') center / 30rem; border: .12rem solid #6a4a2c; border-left: .45rem solid #4a9cff;
  color: var(--ink, #2a1a0c); font-size: 1.35rem; box-shadow: 0 .25rem .6rem rgba(0, 0, 0, .55); }
.loot-label.owned { border-left-color: #f03a2a; }
.loot-label.secret { border-left-color: #b060f0; }
.loot-label.gather { border-left-color: #5ad06a; }
.loot-label.curio { border-left-color: #e8b84a; }
.craft-row.refine .lt-name { font-style: italic; }
.craft-row .warn { color: #e0806a; }
.loot-label.trap { border-left-color: #f03a2a; color: #7a1408; }

/* ================= Conversation panel (bottom bar grows, BG-style) ================= */
#hud.talk-open .hud-bottom, #hud.talk-open .hud-loot { display: none; }
.hud-talk { position: absolute; left: 9.6rem; right: 9.6rem; bottom: 0; height: 26rem; border-top: .25rem solid #1a0d05; z-index: 3;
  display: grid; grid-template-columns: 13rem 1fr 10rem; gap: 1.2rem; padding: 1.3rem 1.6rem; }
.hud-talk > * { position: relative; z-index: 1; min-height: 0; }
.tk-who, .tk-you { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.tk-portrait { width: 11rem; height: 14.3rem; border-radius: .5rem; overflow: hidden; border: .2rem solid #1a0d05; outline: .15rem solid rgba(214, 178, 94, .45); outline-offset: -.35rem; box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .7); background: #2a1a10; }
.tk-portrait.small { width: 7rem; height: 9.1rem; }
.tk-curio { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 40%, #4a3020, #1e120a); }
.tk-curio svg { width: 70%; height: auto; }
.tk-say.tk-look { font-style: italic; }
.tk-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tk-name { font-family: var(--f-display); font-size: 2rem; color: var(--gold-bright); text-shadow: 0 .15rem .3rem #000; line-height: 1.1; }
.tk-name.small { font-size: 1.6rem; }
.tk-title { font-size: 1.3rem; font-style: italic; color: #cdb07a; }
.tk-main { display: flex; flex-direction: column; gap: .6rem; background: rgba(12, 7, 3, .82); border: .15rem solid rgba(214, 178, 94, .35); border-radius: .5rem; box-shadow: inset 0 0 1rem rgba(0, 0, 0, .8); padding: .7rem 1.2rem; }
.tk-log { flex: 1; min-height: 0; overflow-y: auto; font-size: 1.6rem; line-height: 1.45; color: #e6d2a8; }
.tk-log p { margin: 0 0 .5rem; }
.tk-say b { color: var(--gold-bright); font-family: var(--f-display); font-weight: 400; }
.tk-echo { color: #a8c890; padding-left: 1.2rem; font-style: italic; }
.tk-note { color: #9ab8e0; font-size: 1.35rem; padding-left: 1.2rem; }
.tk-replies { list-style: none; margin: 0; padding: .4rem 0 0; border-top: .1rem solid rgba(214, 178, 94, .3); max-height: 45%; overflow-y: auto; }
.tk-reply { padding: .2rem .6rem; border-radius: .3rem; cursor: pointer; font-size: 1.6rem; color: #f0dcb0; }
.tk-reply:hover { background: rgba(214, 178, 94, .16); color: #fff3c8; }
.tk-num { color: var(--gold); font-family: var(--f-display); }
.log-line.gain { color: #e8d070; }
.log-line.quest { color: #f0b860; font-family: var(--f-display); font-size: 1.55rem; }

/* ================= Shops on the open book ================= */
.gbook.shop .shop-art, .gbook.plain .gb-art { background-image: url('../assets/ui/book_plain.webp'); }
.gbook.plain .gb-tab { display: none; }
.sh-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sh-head { flex-shrink: 0; }
.sh-tabs { display: flex; gap: .4rem; justify-content: center; margin: .2rem 0 .1rem; flex-wrap: wrap; }
.sh-tabs .opt-tab { font-size: 1.7rem; padding: .15rem .9rem; }
.sh-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5rem; font-size: 1.6rem; }
.sh-act { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding-top: .3rem; border-top: .1rem solid var(--ink-faint); font-family: var(--f-display); font-size: 1.6rem; flex-shrink: 0; }
.sh-act .ink-btn { font-size: 1.8rem; }
.sh-who { display: flex; gap: .8rem; align-items: center; margin: .2rem 0 .4rem; }
.sh-who img { width: 4.6rem; height: 6rem; object-fit: cover; border-radius: .4rem; border: .15rem solid #4a3020; }
.sh-who b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 1.9rem; }
.sh-who small { color: var(--ink-soft); font-style: italic; font-size: 1.25rem; }
.sh-rumors { flex: 1; min-height: 0; overflow-y: auto; }
.sh-rumor { font-style: italic; margin: .3rem 0 .6rem; }
.sh-rumor.drivel { opacity: .72; }
.sh-rumor.lead, .sh-rumor.tip { font-weight: 600; }
.sh-rumor.refused { font-style: normal; color: var(--ruby, #9a2a20); }
.sh-noted { font-style: normal; color: var(--gold, #b08a3a); }
.sh-rep { display: flex; align-items: baseline; gap: 1rem; justify-content: center; }
.sh-rep b { font-size: 6rem; font-weight: 400; color: var(--blood); }
.sh-rep span { font-family: var(--f-display); font-size: 2.4rem; }
.gb-quest { margin: .3rem 0 .7rem; }
.gb-quest > b { font-weight: 400; font-size: 1.9rem; }
.gb-quest.done { opacity: .65; }
#hud.talk-open .hud-paused { opacity: 0; }
/* portraits are drag sources now */
.pc { cursor: pointer; touch-action: none; }
.pc.item-ghost { width: 7rem; height: 9.1rem; }
/* formation picker */
.hb-form { display: grid; place-items: center; background: var(--parch) center / 20rem; }
.form-ico { width: 78%; height: 78%; }
.form-ico circle { fill: #6a4a2a; }
.form-ico circle.lead { fill: #8a1a10; }
.form-pop { position: absolute; left: 10.2rem; bottom: 8rem; padding: 1rem; z-index: 5; border: .2rem solid #1a0d05; border-radius: .6rem; box-shadow: 0 .6rem 1.6rem rgba(0, 0, 0, .7); }
.form-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, 6rem); gap: .6rem; }
.form-opt { width: 6rem; height: 6rem; border-radius: .5rem; background: var(--parch) center / 20rem; border: .15rem solid #1a0d05; display: grid; place-items: center; }
.form-opt:hover { filter: brightness(1.12); }
.form-opt.on { box-shadow: 0 0 0 .2rem var(--gold-bright), 0 0 1rem rgba(245, 210, 120, .5); }
.gb-cat.gb-pouch { border-left: .1rem solid var(--ink-faint); border-radius: 0 .5rem .5rem 0; margin-left: .2rem; }
.gb-pack.pouch .gb-cell { background: rgba(80, 110, 50, .14); }

/* reply outlook (LG … CE) shown beside the player's portrait */
.tk-tone { display: flex; flex-direction: column; align-items: center; gap: 0; min-height: 5.4rem; margin-top: .3rem; opacity: 0; transition: opacity .15s; }
.tk-tone.on { opacity: 1; }
.tk-tone b { font: 400 3rem/1 var(--f-display); letter-spacing: .1rem; text-shadow: 0 .2rem .3rem #000; }
.tk-tone small { font-size: 1.1rem; text-align: center; color: #cdb07a; line-height: 1.1; }
.tk-tone.good b, .tk-tag.good { color: #f0d070; }
.tk-tone.evil b, .tk-tag.evil { color: #e06a50; }
.tk-tone.neutral b, .tk-tag.neutral { color: #b8c0c8; }
.tk-tag { font-style: normal; font-family: var(--f-display); font-size: 1.25rem; margin-right: .4rem; padding: 0 .3rem; border: .1rem solid currentColor; border-radius: .3rem; opacity: .85; }

/* ================= Area map: parchment chart on the leather ================= */
.mp-veil { position: absolute; left: 9.6rem; right: 9.6rem; top: 0; bottom: 12.4rem; display: grid; place-items: center; padding: 2rem; animation: fadein .2s ease; box-shadow: inset 0 0 4rem rgba(0, 0, 0, .7); }
.mp-sheet { position: relative; width: min(100%, 110rem); height: min(100%, 64rem); display: flex; flex-direction: column; padding: 2rem 3.4rem 1.4rem; border-radius: .6rem;
  box-shadow: 0 1rem 2.6rem rgba(0, 0, 0, .75), inset 0 0 3rem rgba(90, 55, 20, .45); }
.mp-clasp { position: absolute; width: 9rem; height: auto; pointer-events: none; z-index: 2; }
.mp-clasp.tr { right: -.6rem; top: -.6rem; }
.mp-clasp.bl { left: -.6rem; bottom: -.6rem; }
.mp-title { text-align: center; font-size: 3.4rem; margin-bottom: .6rem; }
.mp-frame { flex: 1; min-height: 0; display: grid; place-items: center; }
.mp-canvas { border: .2rem solid rgba(58, 36, 18, .55); border-radius: .3rem; box-shadow: 0 0 1.2rem rgba(90, 55, 20, .35); cursor: crosshair; }
.mp-legend { display: flex; flex-wrap: wrap; gap: 1.6rem; align-items: center; justify-content: center; padding-top: .7rem; font-family: var(--f-display); font-size: 1.6rem; color: var(--ink-soft); }
.mp-legend .dot { display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 50%; margin-right: .4rem; vertical-align: -.1rem; border: .1rem solid #2a1608; }
.dot.party { background: #f0e0b0; } .dot.npc { background: #d8a840; } .dot.exit { background: rgba(60, 110, 60, .6); border-radius: .2rem; } .dot.note { background: #8a1a10; }
.dot.place { background: #d8b040; border-radius: .15rem; transform: rotate(45deg) scale(.85); } .dot.gather { background: #3f8a3a; border-radius: .15rem; clip-path: polygon(50% 0, 100% 100%, 0 100%); border: none; }
.mp-help { font-family: var(--f-body); font-style: italic; font-size: 1.35rem; }
.mp-close { position: absolute; right: 2.4rem; bottom: 1.6rem; font-size: 1.9rem; }
.mp-world { position: absolute; right: 11rem; bottom: 1.6rem; font-size: 1.9rem; }
.qbar { min-width: 51.3rem; }

/* side bars fit any window height: portraits and buttons shrink rather than overflow */
.hud-left, .hud-right { overflow: hidden; }
.hud-left { --pc-h: min(9.1rem, calc((100vh - 18.6rem) / 6 - .6rem)); }
.hl-party .pc { height: var(--pc-h); width: calc(var(--pc-h) * .77); }
.hud-right { --sq: min(6.6rem, calc((100vh - 3.4rem) / 9 - .7rem)); }
.hud-right .hb-sq, .hud-left .hb-sq { width: var(--sq, 6.6rem); height: var(--sq, 6.6rem); }
.hud-right .hb-sq.hb-pause { width: calc(var(--sq, 6.6rem) * 1.16); height: calc(var(--sq, 6.6rem) * 1.16); }   /* the clock a little larger, to read at a glance; still inside the bar */
.hud-left { --sq: min(6.6rem, calc((100vh - 4rem) / 9 - .7rem)); }
.pc .pc-hptext { font-size: min(1.35rem, calc(var(--pc-h) * .15)); }

/* portrait as health bar (BG1/BG2): red wash from the top, numbers top-left, buffs along the bottom */
.pc .pc-dmg { position: absolute; left: 0; right: 0; top: 0; height: 0; background: linear-gradient(rgba(150, 0, 0, .55), rgba(190, 10, 10, .5)); mix-blend-mode: multiply; pointer-events: none; transition: height .35s ease; }
.pc .pc-dmg::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: .15rem; background: rgba(255, 60, 40, .7); }
.pc .pc-hptext { left: .35rem; right: auto; top: .2rem; bottom: auto; text-align: left; font-family: var(--f-body); font-weight: 700; font-size: min(1.3rem, calc(var(--pc-h) * .14)); color: #6fe06f; text-shadow: 0 0 .25rem #000, .1rem .1rem .1rem #000; }
.pc .pc-hptext.hurt { color: #f0e070; } .pc .pc-hptext.low { color: #ff5a4a; }
.pc .pc-fx { top: auto; bottom: .25rem; left: .25rem; right: .25rem; flex-direction: row; flex-wrap: wrap-reverse; gap: .15rem; }
.pc .pc-fx i { width: 1.45rem; height: 1.45rem; font-size: 1rem; line-height: 1.45rem; }
/* closer to BG2: a stronger, flat translucent red; bigger green numbers */
.pc .pc-dmg { background: rgba(205, 10, 10, .58); mix-blend-mode: normal; }
.pc .pc-hptext { font-size: min(1.6rem, calc(var(--pc-h) * .17)); letter-spacing: -.02rem; }
/* the red rises from the bottom, like blood pooling (BG2) */
.pc .pc-dmg { top: auto; bottom: 0; }
.pc .pc-dmg::after { top: 0; bottom: auto; }

/* ---- combat ---- */
.float-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.float-text { position: absolute; left: 0; top: 0; font: 700 1.35rem/1 var(--font-display, serif); color: #f3d9a0; text-shadow: 0 0 .25rem #000, 0 .08rem .15rem #000; white-space: nowrap; will-change: transform, opacity; }
.float-text.dmg { color: #ffd0a0; }
.float-text.dmg.party { color: #ff6a4a; }
.float-text.miss { color: #c8c0b0; font-size: .85rem; font-style: italic; font-weight: 400; }
.float-text.heal { color: #8ef08a; }
.pc.out img { filter: grayscale(.6) brightness(.6); }
.pc.dead img { filter: grayscale(1) brightness(.55) contrast(1.1); }
.pc.dead { filter: grayscale(1); }
.pc.out::after { content: 'Unconscious'; position: absolute; left: 0; right: 0; top: 42%; text-align: center; font: italic .7rem var(--font-body, serif); color: #f0e0c0; text-shadow: 0 0 .3rem #000; pointer-events: none; }
.pc-lvl { display: none; position: absolute; right: .25rem; top: .25rem; z-index: 4; width: 2.6rem; height: 2.6rem; cursor: pointer; border-radius: 50%;
  background: radial-gradient(circle, rgba(40, 24, 8, .75) 55%, transparent 72%); filter: drop-shadow(0 0 .35rem rgba(255, 200, 60, .9)); animation: lvlPulse 1.6s ease-in-out infinite; }
.pc-lvl::before, .pc-lvl::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: linear-gradient(#fff2b0, #e8b030 60%, #a8701a); border-radius: .15rem; box-shadow: 0 0 0 .1rem #3a2008; }
.pc-lvl::before { width: 1.8rem; height: .5rem; } .pc-lvl::after { width: .5rem; height: 1.8rem; }
.pc.lvl .pc-lvl { display: block; }
.pc-lvl:hover { filter: drop-shadow(0 0 .6rem rgba(255, 220, 100, 1)); }
@keyframes lvlPulse { 50% { transform: scale(1.12); } }
/* the level-up screen (game/combat.js levelUp) */
.lu-screen { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem; align-items: start; }
.lu-head { display: flex; gap: 1.2rem; align-items: center; margin-bottom: .8rem; }
.lu-head b { font-family: var(--f-display); font-weight: 400; font-size: 2.4rem; }
.lu-port { width: 6.4rem; height: 8.2rem; object-fit: cover; border-radius: .4rem; border: .15rem solid #4a3020; }
.lu-table { width: 100%; border-collapse: collapse; font-size: 1.55rem; }
.lu-table td { padding: .25rem .4rem; border-bottom: .1rem dashed var(--ink-faint); }
.lu-table td:nth-child(2), .lu-table td:nth-child(4) { text-align: right; white-space: nowrap; }
.lu-table td.arrow { width: 2rem; text-align: center; color: var(--ink-soft); }
.lu-table tr.up td:nth-child(4) { color: #2f6a2a; font-weight: 600; }
.lu-note { margin: .5rem 0 0; }
.lu-right { max-height: 52rem; overflow-y: auto; }
@keyframes lvlPulse { 50% { opacity: .45; transform: translateY(-.1rem); } }
.lvl-up p { margin: .25rem 0; text-align: center; }
.lvl-skills { margin-top: .8rem; display: grid; gap: .3rem; }
.lvl-skill { display: grid; grid-template-columns: 1fr 3rem 2rem 2rem; align-items: center; gap: .4rem; }
.lvl-skill .ink-btn.small { padding: .1rem .4rem; min-width: 0; }
.log-line.combat, .hud-log .combat { color: #d8c8a8; font-size: .92em; }
.pc.dead .pc-dmg { display: none; }

/* ---- Magic page: wizard / priest tabs, level filter, list colours */
.sp-tabs { display: flex; align-items: center; gap: .4rem; margin: 0 0 .3rem; flex-wrap: wrap; }
.sp-tab { font-family: var(--f-display); font-size: 1.8rem; padding: .15rem 1rem; border-radius: .4rem .4rem 0 0; border: .12rem solid var(--ink-faint); border-bottom: none; background: rgba(110, 70, 30, .08); color: var(--ink-soft); }
.sp-tab.on.wiz { background: rgba(50, 80, 160, .16); color: #1e3570; box-shadow: inset 0 .25rem 0 #3a5fb0; }
.sp-tab.on.pri { background: rgba(180, 130, 30, .18); color: #6a4a08; box-shadow: inset 0 .25rem 0 #c08a20; }
.sp-lvls { margin-left: auto; display: flex; gap: .25rem; }
.sp-lvl { min-width: 2.6rem; height: 2.6rem; border-radius: 50%; font-family: var(--f-display); font-size: 1.5rem; border: .12rem solid var(--ink-faint); background: transparent; color: var(--ink-soft); padding: 0 .4rem; }
.sp-lvl.on { background: #6e1d1a; color: #f6e7c8; border-color: #6e1d1a; }
.sp-count { font-family: var(--f-body); font-size: 1.3rem; color: var(--ink-soft); }
.gb-memo.wiz .gb-cell, .gb-known.wiz .gb-cell { box-shadow: inset 0 0 0 .14rem rgba(58, 95, 176, .45), inset 0 0 .5rem rgba(90, 55, 20, .35); }
.gb-memo.pri .gb-cell, .gb-known.pri .gb-cell { box-shadow: inset 0 0 0 .14rem rgba(192, 138, 32, .55), inset 0 0 .5rem rgba(90, 55, 20, .35); }
.gb-memo .gb-cell.viewing, .gb-known .gb-cell.viewing { box-shadow: inset 0 0 0 .22rem var(--gold), inset 0 0 .8rem rgba(214, 178, 94, .6); }
.sp-kind.wiz { color: #1e3570; }
.sp-kind.pri { color: #6a4a08; }
.gd-icon.wiz { box-shadow: inset 0 0 0 .2rem rgba(58, 95, 176, .6), inset 0 0 .8rem rgba(90, 55, 20, .5); }
.gd-icon.pri { box-shadow: inset 0 0 0 .2rem rgba(192, 138, 32, .7), inset 0 0 .8rem rgba(90, 55, 20, .5); }
.sp-stats td:first-child { white-space: nowrap; color: var(--ink-soft); padding-right: 1rem; vertical-align: top; }

/* ---- shop rework: BG2-style list rows, room quadrant, donation */
.sh-ilist { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem; padding: .2rem .3rem .2rem 0; }
.sh-irow { display: grid; grid-template-columns: 4.6rem 1fr auto; align-items: center; gap: .9rem; padding: .3rem .6rem .3rem .3rem; border-radius: .4rem; cursor: inherit;
  background: rgba(110, 70, 30, .08); box-shadow: inset 0 0 0 .1rem rgba(90, 55, 20, .18); transition: background .1s; }
.sh-irow:hover { background: rgba(110, 70, 30, .16); }
.sh-irow:focus-visible { outline: .2rem solid #6e1d1a; outline-offset: .1rem; }
.sh-irow.no-icon { grid-template-columns: 1fr auto; min-height: 4.6rem; padding-left: .9rem; }
.sh-irow.sel { background: rgba(80, 150, 70, .2); box-shadow: inset 0 0 0 .2rem #3a7a3a; }
.sh-irow.dim { opacity: .5; }
.sh-irow-icon { width: 4.6rem; height: 4.6rem; border-radius: 22%; background: rgba(110, 70, 30, .14); box-shadow: inset 0 0 .4rem rgba(90, 55, 20, .45); display: grid; place-items: center; overflow: hidden; }
.sh-irow-icon > * { width: 100%; height: 100%; }
.sh-irow-icon img { object-fit: contain; }
.sh-irow-name span { display: block; font-family: var(--f-display); font-size: 1.8rem; line-height: 1.1; }
.sh-irow-name small { display: block; font-size: 1.25rem; color: var(--ink-soft); font-style: italic; }
.sh-irow-price { font-family: var(--f-display); font-weight: 400; font-size: 1.8rem; color: #6e1d1a; white-space: nowrap; }
.sh-rooms { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; flex: 1; min-height: 0; align-content: start; }
.sh-roomcard { display: flex; flex-direction: column; gap: .4rem; padding: .4rem; border-radius: .5rem; background: rgba(110, 70, 30, .1); border: .15rem solid rgba(90, 55, 20, .3); }
.sh-roomcard.sel { border-color: #6e1d1a; box-shadow: 0 0 0 .15rem rgba(110, 29, 26, .4); background: rgba(110, 29, 26, .08); }
.sh-roompic { aspect-ratio: 3 / 2; overflow: hidden; background: transparent; }   /* the room pictures are cut out (PNG) and sit on the parchment */

.sh-roompic img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 .2rem .3rem rgba(40, 20, 5, .35)); }
.sh-roomname { font-family: var(--f-sc, var(--f-display)); text-transform: uppercase; letter-spacing: .1em; font-size: 1.6rem; text-align: center; }
.sh-roomtitle { font-size: 2.4rem; margin: .2rem 0; font-weight: 400; }
.sh-donatepage { gap: 1rem; align-items: center; }
.sh-bowl { width: 70%; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.sh-bowl img { max-width: 100%; max-height: 100%; }
.sh-bowl-css { width: 80%; height: 55%; border-radius: 50%; background: radial-gradient(ellipse at 50% 40%, #f0d890 0%, #c09040 35%, #7a5418 70%, #3a2408 100%); box-shadow: 0 1rem 1.6rem rgba(0,0,0,.45), inset 0 -.6rem 1.2rem rgba(0,0,0,.4); }
.sh-amountrow { display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: 1.8rem; }
.sh-amountbox { display: flex; gap: .3rem; align-items: center; }
.sh-amount { width: 10rem; font: 400 2rem var(--f-display); text-align: center; padding: .2rem .4rem; background: rgba(255, 248, 225, .6); border: .15rem solid var(--ink-faint); border-radius: .3rem; }
.sh-donatebtn { font-size: 2rem; }
.sh-note { padding: 1.2rem 1.4rem; border-radius: .3rem; background: #efdcae url('../assets/ui/parchment.jpg') center / 30rem; box-shadow: 0 .3rem .8rem rgba(0,0,0,.25), inset 0 0 1.2rem rgba(90,55,20,.3); font-size: 1.6rem; line-height: 1.45; }
.sh-note p { margin: 0 0 .6rem; }
/* sold out: kept on the list in red until the shop is reopened */
.sh-irow.out { cursor: default; }
.sh-irow.out .sh-irow-name span, .sh-irow.out .sh-irow-name small, .sh-irow.out .sh-irow-price { color: #a3221c; }
.sh-irow.out .sh-irow-icon { filter: grayscale(.7); opacity: .6; }
.sh-irow.out:hover { background: none; }
.gb-foot .sh-purse { color: var(--ink-soft); }
/* splitting a stack, in the item details */
.gd-split { margin-top: 1rem; padding: .8rem 1rem; border-radius: .5rem; background: rgba(110, 70, 30, .1); box-shadow: inset 0 0 0 .1rem var(--ink-faint); }
.gd-split-amt { display: flex; align-items: center; gap: 1rem; font-size: 1.7rem; }
.gd-split-amt input[type=range] { flex: 1; accent-color: #7a4a1c; }
.gd-split-n { font-family: var(--f-display); font-size: 2rem; min-width: 2.4rem; text-align: right; }
.gd-split-btns { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 .3rem; }
.gd-split-btns .ink-btn { font-size: 1.5rem; padding: .2rem .8rem; }
.log-line.banter { color: #e0d2b4; font-style: italic; }
/* slots the painted art doesn't show yet (the quivers): a faint ink glyph like the painted ones */
.gb-slot.ghost:not(.filled)::after { content: attr(data-ghost); position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.4rem; color: rgba(92, 58, 22, .62); text-shadow: 0 0 .9rem rgba(92, 58, 22, .45); }

/* high-level abilities and dual-classing (screens/progression.js) */
.hla-list { display: flex; flex-direction: column; gap: .35rem; max-height: 52vh; overflow-y: auto; padding-right: .4rem; text-align: left; }
.hla-left { margin: 0 0 .3rem; }
.hla-opt { display: grid; grid-template-columns: 15rem 1fr; column-gap: 1rem; align-items: baseline; text-align: left; background: rgba(90, 60, 30, .08); border: 1px solid rgba(90, 60, 30, .3); border-radius: 4px; padding: .45rem .7rem; font: inherit; color: inherit; cursor: pointer; }
.hla-opt b { font-family: var(--f-display); font-size: 1.25em; }
.hla-opt small { grid-column: 1; color: #8a5a20; }
.hla-opt .hla-desc { grid-column: 2; grid-row: 1 / span 2; font-size: .92em; }
.hla-opt:hover:not(:disabled) { background: rgba(160, 110, 40, .2); border-color: #8a5a20; }
.hla-opt.off { opacity: .5; cursor: default; }
.hla-opt.taken { border-color: #8a5a20; }
.gb-sub.learn { color: #8a3a10; }
.dual-list { display: flex; flex-direction: column; gap: .3rem; margin-top: .6rem; }
.dual-opt { display: flex; gap: 1rem; align-items: baseline; }
.dual-opt.off { opacity: .5; }

/* a familiar on the party bar: a little smaller, with a paw-print corner (game/familiars.js) */
.pc.familiar { transform: scale(0.82); transform-origin: top left; margin-bottom: -10px; }
.pc.familiar::after { content: '✦'; position: absolute; right: 4px; bottom: 2px; color: #e8d070; font-size: 1.2rem; text-shadow: 0 0 3px #000; }

/* ================= Merchant window (stores, inns, temples): the character creator's frame ====== */
.shopframe {
  position: relative; width: min(calc(100vw - 21.2rem), 112rem); height: min(calc(100vh - 14rem), 66rem);
  filter: drop-shadow(0 1rem 2.4rem rgba(0, 0, 0, .75)); animation: bookin .3s cubic-bezier(.2, .9, .3, 1.1);
}
.shopframe-bg { position: absolute; inset: 0; border-radius: .8rem; }
.sf-title { position: absolute; left: 0; right: 0; top: 1.3rem; text-align: center; font-family: var(--f-display); font-size: 3rem; color: #e8cf9a; text-shadow: 0 .2rem .4rem #000; letter-spacing: .1rem; pointer-events: none; }
.sf-close { position: absolute; top: 1.2rem; right: 1.6rem; width: 3.4rem; height: 3.4rem; border-radius: 50%; border: .15rem solid #8a6a3a; background: rgba(30, 18, 8, .7); color: #e8cf9a; font-size: 1.8rem; cursor: pointer; z-index: 4; }
.sf-close:hover { background: rgba(110, 29, 26, .85); }
.shopframe > .sf-left, .shopframe > .sf-right { position: absolute; top: 6rem; bottom: 2rem; display: flex; flex-direction: column; }
.shopframe > .sf-left { left: 2rem; width: calc(56% - 3rem); padding: 1.6rem 2rem; }
.shopframe > .sf-right { right: 2rem; width: calc(44% - 2rem); padding: 1.6rem 1.8rem; }
.sf-left > .sh-page, .sf-right > .sh-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.shopframe .sh-roompic { aspect-ratio: 2 / 1; }
.shopframe .sh-body { min-height: 0; }
.shopframe .sh-rooms { min-height: 0; overflow-y: auto; }
.sh-roombig { flex: 1; min-height: 0; display: grid; place-items: center; margin: .6rem 0; } .sh-roombig img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 .3rem .5rem rgba(40, 20, 5, .4)); }
/* an open container item (gem bag, scroll case…) below the pack */
.gb-baghead .gb-gtitle { color: var(--blood, #6a1a12); }
.gb-baggrid { background: rgba(90, 60, 30, .08); box-shadow: inset 0 0 0 .1rem rgba(90, 60, 30, .25); }
/* spell storage picker (sequencers, triggers, contingencies) */
.ss-body p { margin: 0 0 .6rem; }
.ss-list { max-height: 26rem; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; margin: .4rem 0 .8rem; }
.ss-row { display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: .8rem; padding: .25rem .6rem; border-radius: .4rem; text-align: left; background: none; }
.ss-row:hover { background: var(--wash, rgba(90, 60, 30, .08)); }
.ss-row.on { background: var(--wash-strong, rgba(90, 60, 30, .18)); box-shadow: inset 0 0 0 .12rem var(--blood, #6a1a12); }
.ss-row .sp-ic { width: 2.6rem; height: 2.6rem; display: inline-flex; border-radius: .35rem; overflow: hidden; }
.ss-row .sp-ic img { width: 100%; height: 100%; object-fit: contain; }
.ss-lvl { font-size: 1.2rem; font-style: italic; opacity: .7; }
.ss-opts { display: flex; flex-direction: column; gap: .5rem; }
.ss-select { font: inherit; padding: .2rem .4rem; margin-left: .4rem; background: rgba(255, 250, 235, .7); border: .1rem solid rgba(90, 60, 30, .4); border-radius: .3rem; }
/* long choice lists (wishes) */
.choose-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.choose-opt { text-align: left; padding: .5rem .9rem; border-radius: .4rem; background: rgba(90, 60, 30, .08); box-shadow: inset 0 0 0 .1rem rgba(90, 60, 30, .25); font: inherit; }
.choose-opt:hover { background: rgba(90, 60, 30, .18); box-shadow: inset 0 0 0 .12rem var(--blood, #6a1a12); }

/* ---- world map (game/travel.js) */
.wm-body { display: flex; flex-direction: column; align-items: center; gap: .5rem; max-width: 100%; }
.wm-map { position: relative; max-width: 100%; border-radius: 6px; overflow: hidden;
  background: radial-gradient(ellipse at 40% 45%, rgba(255, 240, 200, .1) 0%, rgba(110, 70, 25, .4) 100%), var(--parch) repeat; background-size: auto, 34rem;
  box-shadow: inset 0 0 40px rgba(90, 60, 20, .45), 0 0 0 2px #6b4a24; }
.wm-routes { position: absolute; inset: 0; pointer-events: none; }
.wm-route { stroke: #5a3a1a; stroke-width: 2.2; stroke-dasharray: 7 6; opacity: .7; }
.wm-loc { position: absolute; transform: translate(-50%, -1.25rem); display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; color: #3a2410; font-family: var(--f-body); font-size: 1.6rem; cursor: default; text-shadow: 0 0 3px #f4e6c4; }
.wm-loc i { font-style: normal; font-size: 2rem; color: #6b3a1a; }
.wm-loc.here i { color: #8a2a14; font-size: 2.4rem; }
.wm-loc.can { cursor: pointer; }
.wm-loc.can:hover span { text-decoration: underline; color: #7a1e0e; }

/* ---- journal: the player's own notes */
.gb-noteadd { display: flex; gap: .6rem; align-items: flex-start; margin: .4rem 0 1rem; }
.gb-noteinput { flex: 1; font-family: var(--f-body); font-size: 1.4rem; background: rgba(255, 248, 225, .55); border: 1px solid rgba(90, 60, 25, .4); border-radius: 4px; padding: .3rem .5rem; color: var(--ink); resize: vertical; }
.gb-usernote { position: relative; padding-right: 2rem; }
.gb-x { position: absolute; right: 0; top: 0; background: none; border: 0; color: #7a3a1a; cursor: pointer; font-size: 1.2rem; opacity: .6; }
.gb-x:hover { opacity: 1; }

/* ---- quick loot (game/partyTools.js) and the Defend order */
.hb-act > i { font-style: normal; font-size: 2.4rem; line-height: 1; color: #5a3a1a; }
.hb-qloot > i { color: #b8301e; }
.hb-qloot.on { box-shadow: 0 0 .8rem rgba(230, 80, 50, .7) inset; }
.ql-strip { position: fixed; left: 50%; transform: translateX(-50%); bottom: 13.2rem; display: none; align-items: center; gap: .5rem;
  max-width: 70vw; overflow-x: auto; padding: .5rem .8rem; border-radius: .6rem; background: var(--parch) repeat; background-size: 34rem; box-shadow: 0 0 0 2px #5a3a1a, 0 .4rem 1.2rem rgba(0, 0, 0, .5); pointer-events: auto; }
.ql-strip.on { display: flex; }
.ql-title { font-family: var(--f-body); font-size: 1.4rem; color: var(--ink); white-space: nowrap; margin-right: .4rem; }
.ql-cell { width: 4.6rem; height: 4.6rem; flex: none; }
.ql-gold { font-family: var(--f-body); font-size: 1.4rem; background: rgba(240, 200, 90, .35); border: 1px solid #8a6a2a; border-radius: .4rem; padding: .3rem .6rem; cursor: pointer; white-space: nowrap; }

/* ---- multiplayer (game/netPanel.js) */
.hb-mp { font-family: var(--f-sc); font-size: 1.2rem; color: var(--gold); padding: .15rem .8rem; border-radius: .4rem; border: .12rem solid rgba(214, 178, 94, .45); background: rgba(0, 0, 0, .25); }
.hb-mp.on { color: var(--gold-bright); box-shadow: 0 0 .6rem rgba(245, 210, 120, .5); }
.mp-panel { position: fixed; right: 13rem; bottom: 14rem; width: 34rem; max-height: 62vh; overflow-y: auto; padding: 1rem 1.3rem 1.2rem; border-radius: .6rem;
  background: var(--parch) repeat; background-size: 34rem; box-shadow: 0 0 0 2px #5a3a1a, 0 .4rem 1.4rem rgba(0, 0, 0, .55); pointer-events: auto; font-family: var(--f-body); font-size: 1.4rem; color: var(--ink); display: flex; flex-direction: column; gap: .5rem; }
.mp-panel h3 { font-family: var(--f-display); font-size: 2rem; margin: 0; }
.mp-panel p { margin: 0; }
.mp-x { position: absolute; right: .6rem; top: .3rem; font-size: 2rem; color: var(--ink-soft); }
.mp-small { font-size: 1.2rem; font-style: italic; color: var(--ink-soft); }
.mp-sub { font-family: var(--f-sc); font-size: 1.3rem; border-bottom: .1rem solid var(--ink-faint); margin-top: .3rem; }
.mp-code { display: flex; align-items: baseline; gap: .8rem; }
.mp-code b { font-family: var(--f-display); font-size: 2.6rem; letter-spacing: .3rem; color: #6a2a10; user-select: all; }
.mp-in { font: inherit; padding: .3rem .5rem; border: .1rem solid #8a6a3a; border-radius: .3rem; background: rgba(255, 250, 235, .7); color: var(--ink); width: 100%; box-sizing: border-box; }
.mp-row { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.mp-players > div, .mp-char { display: flex; align-items: center; gap: .6rem; justify-content: space-between; }
.mp-players > div { justify-content: flex-start; }
.mp-dot { width: .8rem; height: .8rem; border-radius: 50%; background: #9a8a70; display: inline-block; }
.mp-dot.on { background: #3f8f3a; }
.mp-sel { font: inherit; background: rgba(255, 250, 235, .7); border: .1rem solid #8a6a3a; border-radius: .3rem; max-width: 15rem; }
.mp-owner.mine { font-weight: bold; color: #2f6a2a; }
.mp-chat { min-height: 5rem; max-height: 14rem; overflow-y: auto; background: rgba(255, 250, 235, .45); border-radius: .3rem; padding: .3rem .5rem; font-size: 1.3rem; }
.log-line.chat { color: #9fd6ff; }
.mp-vault { display: flex; flex-direction: column; gap: .4rem; max-height: 50vh; overflow-y: auto; }
.mp-vrow { display: grid; grid-template-columns: 4rem 1fr; grid-template-rows: auto auto; column-gap: .8rem; align-items: center; text-align: left; padding: .4rem .6rem; border-radius: .4rem; border: .1rem solid rgba(90, 58, 26, .4); background: rgba(255, 250, 235, .4); font: inherit; color: var(--ink); cursor: pointer; }
.mp-vrow:hover { background: rgba(255, 240, 200, .8); }
.mp-vrow img, .mp-vimg { grid-row: span 2; width: 4rem; height: 5rem; object-fit: cover; border-radius: .3rem; background: rgba(90, 58, 26, .25); }
.mp-vrow b { font-family: var(--f-display); font-size: 1.8rem; font-weight: 400; }
.mp-vrow span { font-size: 1.3rem; color: var(--ink-soft); font-style: italic; }
.mp-check { display: flex; gap: .6rem; align-items: center; }

/* ---- listening to another player's conversation, and votes on replies (net/session.js) */
.hud-talk.listen .tk-reply.inert { cursor: default; }
.tk-reply.voted { text-decoration: underline; text-decoration-color: #c9a24a; }
.tk-votes { color: #e7c46a; font-size: .85em; font-style: italic; margin-left: .3rem; }
.tk-listening { display: flex; flex-direction: column; align-items: center; gap: .3rem; margin-top: .4rem; color: #cdb07a; font-style: italic; }
.mp-listen { position: fixed; left: 50%; top: 6rem; transform: translateX(-50%); z-index: 40; display: flex; align-items: center; gap: .8rem; padding: .6rem 1rem; border-radius: .6rem;
  background: var(--parch) repeat; background-size: 34rem; box-shadow: 0 0 0 2px #5a3a1a, 0 .4rem 1.2rem rgba(0, 0, 0, .5); pointer-events: auto; font-family: var(--f-body); font-size: 1.45rem; color: var(--ink); }
.log-line.talk { color: #d8c9a6; font-style: italic; }
.tk-listening .ink-btn { font-size: 1.2rem; padding: .1rem .5rem; }
.mp-pname { flex: 1; }
.mp-pact { display: flex; gap: .3rem; }
.mp-mini { font: inherit; font-size: 1.15rem; padding: 0 .45rem; border-radius: .3rem; border: .1rem solid #8a6a3a; background: rgba(255, 250, 235, .6); color: var(--ink); cursor: pointer; }
.mp-mini.warn { color: #8a2a1a; border-color: #8a2a1a; }
.pc.following { box-shadow: 0 0 0 .2rem #7fc4ff, 0 0 1rem rgba(127, 196, 255, .6); }
.mp-link { color: var(--ink-soft); font-style: italic; }
.mp-buttons { display: flex; gap: .6rem; flex-wrap: wrap; }
.craft-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: .3rem; }
.craft-row { display: grid; grid-template-columns: 14rem 1fr auto; gap: .8rem; align-items: center; padding: .25rem .4rem; border-bottom: .1rem solid var(--ink-faint); }
.craft-row .small { font-size: 1.25rem; color: var(--ink-soft); }
.craft-art { display: block; height: 11rem; width: auto; max-width: 100%; object-fit: contain; margin: .6rem auto -.4rem; }
.nwp-help .nwp-art { height: 8rem; }

/* ---- the area map as the zoomed-out view (screens/overview.js): notable places marked */
.ov-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.ov-mark { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: .5rem; margin: -1.1rem 0 0 -1.1rem; white-space: nowrap; will-change: transform; }
.ov-pin { width: 2.2rem; height: 2.2rem; flex: none; transform: rotate(45deg) scale(.72); border: .2rem solid #2a1608; box-shadow: 0 .2rem .5rem rgba(0, 0, 0, .6); background: #d8b040; }
.ov-mark span { padding: .15rem .7rem; border-radius: .3rem; background: #e8d3a6 url('../assets/ui/parchment.jpg') center / 30rem; border: .12rem solid #6a4a2c;
  color: var(--ink, #2a1a0c); font-family: var(--f-display); font-size: 1.5rem; box-shadow: 0 .25rem .6rem rgba(0, 0, 0, .55); }
.ov-mark.k-inn .ov-pin { background: #c8782a; } .ov-mark.k-shop .ov-pin { background: #d8b040; } .ov-mark.k-temple .ov-pin { background: #e8ecf4; }
.ov-mark.k-place .ov-pin { background: #a8402a; } .ov-mark.k-craft .ov-pin, .ov-mark.k-gather .ov-pin { background: #4a8a3a; } .ov-mark.k-danger .ov-pin { background: #c82a1a; }

/* ---- party management, after BG2:EE */
/* under the portraits: formation, reveal details, party AI, select all (2 x 2) */
.hl-party-btns { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, 3.9rem); gap: .4rem; }
.hb-sq.hb-small { width: 3.9rem; height: 3.9rem; border-radius: .4rem; }
.hb-sq.hb-small.hb-glyph { font-size: 1.6rem; display: grid; place-items: center; }
.hb-sq.hb-small.hb-form svg, .hb-sq.hb-small.hb-form img { width: 100%; height: 100%; }
.hb-sq.hb-ai:not(.on) { color: #8a7a60; filter: saturate(.4) brightness(.85); }
/* the pick-party panel (screens/pickParty.js): docked above the bottom bar, as in BG2:EE */
.pp-veil { position: absolute; inset: 0; z-index: 25; background: rgba(0, 0, 0, .25); }
.pp-panel { position: absolute; left: 50%; bottom: 13.4rem; transform: translateX(-50%); display: flex; gap: 2rem; align-items: stretch; padding: 1.4rem 2rem 1.6rem; border-radius: .5rem;
  border: .25rem solid #1a0d05; box-shadow: inset 0 0 0 .15rem rgba(0, 0, 0, .55), inset 0 0 3rem rgba(0, 0, 0, .55), 0 1rem 2.4rem rgba(0, 0, 0, .7); animation: fadein .25s ease; }
.pp-panel > .cv-seam { z-index: 0; }
.pp-main, .pp-side { position: relative; z-index: 1; }
.pp-head { font-size: 2.2rem; margin: 0 0 .6rem .2rem; }
.pp-row { display: flex; gap: .7rem; }
.pp-pc { position: relative; width: 7rem; padding: 0; border: .2rem solid #1a0d05; border-radius: .4rem; background: #2a1a10; cursor: pointer; overflow: hidden;
  outline: .15rem solid rgba(214, 178, 94, .45); outline-offset: -.35rem; box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .7); transition: border-color .15s, box-shadow .15s; }
.pp-pc img { display: block; width: 100%; height: 9.1rem; object-fit: cover; }
.pp-pc span { display: block; padding: .2rem 0; font-family: var(--f-display); font-size: 1.35rem; color: #e8d3a6; background: rgba(0, 0, 0, .55); }
.pp-pc:hover:not(:disabled) { border-color: #8a6a3a; }
.pp-pc.sel { border-color: #ff7a4a; box-shadow: 0 0 1.2rem rgba(255, 120, 70, .7), 0 .3rem .8rem rgba(0, 0, 0, .7); }
.pp-pc.leader { opacity: .75; cursor: default; }
.pp-side { display: flex; flex-direction: column; justify-content: center; gap: 1rem; min-width: 18rem; }
.pp-count { text-align: center; font-family: var(--f-display); font-size: 2rem; color: #9fd38a; text-shadow: 0 .1rem .2rem #000; }
.pp-count.over { color: #ff9a6a; }
.pp-btns { display: flex; flex-direction: column; gap: .8rem; align-items: center; }
.pp-btns .cv-plate { width: 15rem; height: 4rem; margin-left: 1.9rem; }
.pp-btns .cv-plate > .plaque { font-size: 1.85rem; padding: 0 .6rem 0 1.4rem; }
.pp-btns .cv-plate .cv-mount { width: 3.6rem; left: -1.7rem; }
/* the right bar holds ten buttons now (Crafting joined): a little smaller so they fit the 72rem stage */
.hud-right { gap: .55rem; }
.hud-right .hb-sq { width: 6.2rem; height: 6rem; }
.hb-craft { font-size: 2.6rem; }

/* a companion's farewell (townlife.js farewell) */
.farewell { display: flex; gap: 1.6rem; align-items: center; }
.farewell img { width: 8rem; height: 10.4rem; object-fit: cover; border-radius: .4rem; border: .15rem solid #4a3020; flex: none; }
.farewell p { font-size: 1.8rem; font-style: italic; margin: 0; }
/* the level-up screen in the creator's frame (screens/levelUpScreen.js) */
.lu-stage { display: block; background: rgba(5, 3, 2, .55); }
.lu-stage .cframe { animation: fadein .25s ease; }
.lu-body .lvl-skills { margin: 0; }
.lu-body .lu-table { font-size: 1.7rem; }
.lu-body .lvl-skills > p { font-size: 1.7rem; margin: 0 0 .6rem; }
.lu-body .lvl-skill { grid-template-columns: 1fr 9rem 3.2rem 3.2rem; font-size: 1.8rem; padding: .2rem .4rem; border-bottom: .1rem dashed var(--ink-faint); }
.lu-body .lvl-skill b { text-align: right; font-weight: 400; }
.lu-body .lvl-skill .ink-btn.small { font-size: 1.8rem; padding: .05rem .5rem; }
/* the Record page's button row (as BG2's): Level Up, Dual-Class, Reform Party, Export */
.gb-recbar { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem 1.2rem; margin-top: auto; padding-top: .8rem; border-top: .1rem solid var(--ink-faint); }
.gb-recbar .plaque { min-width: 0; white-space: nowrap; }
.gb-recbar .plaque:disabled { opacity: .45; filter: grayscale(.6); }
.gb-reform { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.gb-reform-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 1.9rem; }
/* the Codex */
.cx-list { display: flex; flex-direction: column; gap: .2rem; max-height: 100%; overflow-y: auto; }
.cx-item { text-align: left; background: none; border: 0; padding: .35rem .6rem; font: inherit; font-size: 1.8rem; color: var(--ink); cursor: pointer; border-radius: .3rem; }
.cx-item:hover { background: rgba(120, 80, 30, .1); }
.cx-item.sel { background: rgba(120, 80, 30, .2); font-weight: 600; }
.cx-head { display: flex; gap: 1rem; align-items: center; }
.cx-icon { width: 5.6rem; height: 5.6rem; object-fit: contain; }
.cx-sec { margin-bottom: 1rem; }
.cx-sec.locked h3 { opacity: .5; letter-spacing: .3rem; }
.cx-count { text-align: right; padding-top: .4rem; }
.gb-codexlist { position: absolute; display: none; flex-direction: column; padding: 0 1rem; }
.gbook.codex .gb-leftset, .gbook.codex .gb-detail { display: none; }
.gbook.codex .gb-codexlist { display: flex; animation: fadein .18s ease; }
.cx-cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.cx-cat { background: none; border: .1rem solid var(--ink-faint); border-radius: .4rem; padding: .25rem .8rem; font: inherit; font-family: var(--f-display); font-size: 1.7rem; color: var(--ink-soft); cursor: pointer; }
.cx-cat.on { background: rgba(120, 80, 30, .18); color: var(--ink); border-color: var(--ink-soft); }
.gb-codexlist .cx-list { flex: 1; min-height: 0; }
/* shop: how many of a stack to buy (stepper on a picked line, and the shift-click dialog) */
.sh-qty { display: inline-flex; align-items: center; gap: .3rem; margin-top: .3rem; }
.sh-qty button { font: inherit; font-family: var(--f-display); font-size: 1.4rem; line-height: 1; min-width: 2.4rem; height: 2.4rem; padding: 0 .5rem; border-radius: .3rem;
  border: 1px solid rgba(60, 38, 18, .55); background: rgba(255, 246, 222, .7); color: var(--ink); cursor: inherit; }
.sh-qty button:hover:not(:disabled) { background: #fff6dc; border-color: #8a5a20; }
.sh-qty button:disabled { opacity: .4; }
.sh-qty .sh-qty-n { min-width: 4rem; font-weight: 700; }
.sh-qty .sh-qty-max { font-size: 1.15rem; }
.sh-qty-dlg { display: flex; align-items: center; gap: 1.2rem; margin: .6rem 0 1rem; }
.sh-qty-range { flex: 1; accent-color: #8a5a20; }
.sh-qty-in { width: 8rem; font: inherit; font-size: 1.6rem; padding: .3rem .5rem; background: #fff6dc; color: #2a1a0c; border: 1px solid rgba(60, 38, 18, .6); border-radius: .3rem; }
b.bad { color: #a3221c; }
/* Customize (record screen): colours, portrait, voice, biography at any time */
.cz-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; border-bottom: 1px solid rgba(60, 38, 18, .35); }
.cz-tab { font: inherit; font-family: var(--f-display); font-size: 1.7rem; padding: .3rem 1.2rem; border: 0; background: none; color: var(--ink-soft); cursor: inherit; border-bottom: .25rem solid transparent; }
.cz-tab.sel { color: var(--ink); border-bottom-color: #8a5a20; }
.cz-body { min-height: 30rem; max-height: 60vh; overflow: auto; }
.cz-body .sw-any { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.cz-body .sw-any input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: inherit; }
.cz-portraits { max-height: 52vh; }
.cz-bio { width: 100%; box-sizing: border-box; font: inherit; font-size: 1.6rem; line-height: 1.4; padding: .8rem; background: rgba(255, 246, 222, .7); color: #2a1a0c; border: 1px solid rgba(60, 38, 18, .5); border-radius: .4rem; resize: vertical; }
/* the book's corner clasps: the dialogs' metalwork, sized to the book */
.gbook .gb-clasp { width: 10%; z-index: 6; }
.gbook .gb-clasp.tr { top: -.3%; right: -.2%; }   /* proud of the corner by a few pixels; the rest lies on the leather */
.gbook .gb-clasp.bl { bottom: -.3%; left: -.2%; }
/* inventory as a list (Menu - Inventory.psd): icon, name and kind, the number that matters, details */
.gb-catbar { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-shrink: 0; }
.gb-catbar .gb-cats { margin: .1rem 0 .3rem; }
.gb-view { width: 3.4rem; height: 3.4rem; font-size: 2rem; line-height: 1; border-radius: .4rem; border: 1px solid rgba(60, 38, 18, .35); background: rgba(255, 246, 222, .35); color: #4a2e14; cursor: inherit; }
.gb-view:hover { background: rgba(255, 246, 222, .7); }
.gb-plist { flex: 1; min-height: 12rem; overflow-y: auto; margin: .4rem 0; padding-right: .6rem; border-top: .1rem solid rgba(90, 55, 20, .35); }
.gb-prow { display: grid; grid-template-columns: 4.4rem 1fr auto 2.6rem; align-items: center; gap: 1rem; padding: .45rem .4rem; border-bottom: .1rem solid rgba(90, 55, 20, .35); cursor: inherit; }
.gb-prow:hover { background: rgba(110, 70, 30, .08); }
.gb-prow.viewing { background: rgba(110, 70, 30, .14); }
.gb-prow.dim { opacity: .4; }
.gb-prow.hit { background: rgba(80, 150, 70, .12); }
.gb-prow.pickable { box-shadow: inset 0 0 0 .2rem rgba(60, 120, 200, .55); }
.gb-prow-icon { width: 4.4rem; height: 4.4rem; border-radius: .4rem; background: rgba(110, 70, 30, .12); box-shadow: inset 0 0 .4rem rgba(90, 55, 20, .35); }
.gb-prow-icon > * { width: 100%; height: 100%; }
.gb-prow-name span { display: block; font-family: var(--f-display); font-size: 1.75rem; line-height: 1.1; color: #2a1a0c; }
.gb-prow-name small { display: block; font-size: 1.2rem; font-style: italic; color: var(--ink-soft); }
.gb-prow-stat { font-family: var(--f-display); font-weight: 400; font-size: 1.6rem; color: #3a2410; white-space: nowrap; }
.gb-prow-go { border: 0; background: none; font-size: 1.8rem; color: #5a3a1c; cursor: inherit; opacity: .75; }
.gb-prow-go:hover { opacity: 1; color: #6e1d1a; }
.gb-pempty { text-align: center; margin-top: 2rem; }
.gb-prow.empty { padding: .25rem .4rem; cursor: default; }
.gb-prow.empty .gb-prow-icon { height: 3rem; background: none; box-shadow: inset 0 0 0 .12rem rgba(90, 55, 20, .25); border-radius: .4rem; }
.gb-prow.empty small { font-size: 1.25rem; color: rgba(90, 55, 20, .5); }
/* the Crafting page in the book */
.gb-page .craft-list { max-height: none; flex: 1; min-height: 0; }
.gb-page .craft-head { display: flex; align-items: center; gap: 1rem; margin-top: .6rem; }
.gb-page .craft-head .craft-art { height: 5.5rem; margin: 0; }
/* Customize from the sheet: the portrait and a quill under the name */
.gb-czpic { cursor: pointer; }
.gb-czpic:hover { filter: brightness(1.08) drop-shadow(0 0 .4rem rgba(255, 220, 150, .6)); }
.gb-cz { margin-top: .3rem; font-size: 1.3rem; align-self: center; }
.gb-page .craft-row { grid-template-columns: 1fr auto; row-gap: .1rem; padding: .45rem .4rem; }
.gb-page .craft-row .lt-name { grid-column: 1; font-family: var(--f-display); font-size: 1.75rem; }
.gb-page .craft-row .small { grid-column: 1; grid-row: 2; }
.gb-page .craft-row .ink-btn { grid-column: 2; grid-row: 1 / span 2; }
/* BG2's weapon slots: the one in hand is marked; slots 3 and 4 draw their own outline */
.gb-slot { background: center / 100% 100% no-repeat; }
.gb-slot.active { box-shadow: 0 0 0 .2rem rgba(110, 29, 26, .75), 0 0 .8rem rgba(255, 210, 120, .6); border-radius: .5rem; }
/* the action bar as the book's page: parchment, with the inventory's light squares (one style, not two) */
.hb-bar { background: var(--parch) center / 30rem; box-shadow: inset 0 0 1.2rem rgba(90, 55, 20, .55), 0 .2rem .6rem rgba(0, 0, 0, .5); }
.hb-core { border-right-color: rgba(90, 55, 20, .35); }
.hb-act, .hb-core .hb-act { border: 0; background: radial-gradient(circle, rgba(255, 246, 222, .7) 40%, rgba(236, 220, 180, .6)); box-shadow: inset 0 0 .35rem rgba(90, 55, 20, .3), 0 0 0 .1rem rgba(90, 55, 20, .22); border-radius: 22%; }
.hb-act:hover:not(:disabled) { filter: none; box-shadow: inset 0 0 0 .14rem rgba(110, 29, 26, .6), 0 0 .5rem rgba(255, 220, 150, .5); }
.qb-slot { background: radial-gradient(circle, rgba(255, 246, 222, .7) 40%, rgba(236, 220, 180, .6)); box-shadow: inset 0 0 .35rem rgba(90, 55, 20, .3), 0 0 0 .1rem rgba(90, 55, 20, .22); }
.qb-slot.empty { opacity: .55; }
.qb-slot:not(.empty):hover { box-shadow: inset 0 0 0 .14rem rgba(110, 29, 26, .6), 0 0 .5rem rgba(255, 220, 150, .5); }
.qb-slot.active { box-shadow: inset 0 0 0 .18rem #3a7a3a, 0 0 .5rem rgba(80, 150, 70, .45); }
.qb-glyph, .hb-act > i { color: #563e13; opacity: .8; }
.qb-none { color: #6a5030; }

/* the paper doll spans the page behind the equipment slots; it turns by dragging anywhere between them */
#hud .gbook .gb-slots, #hud .gbook .gb-doll { pointer-events: none; }
#hud .gbook .gb-doll3d { pointer-events: auto; }
#hud .gbook .gb-slot { pointer-events: auto; }
.gbook .gb-doll { z-index: 1; }
.gbook .gb-slots { z-index: 2; }
/* Crafting across the spread: schematics on the left page, the chosen one on the right */
.gb-craftlist { position: absolute; display: none; flex-direction: column; padding: 0 1rem; }
.gbook.craft .gb-leftset, .gbook.craft .gb-detail { display: none; }
.gbook.craft .gb-craftlist { display: flex; animation: fadein .18s ease; }
.gb-craftlist .gb-plist { flex: 1; min-height: 0; }
.gb-craftrank { margin: .2rem 0 .4rem; }
.gb-crafttabs { justify-content: flex-start; flex-wrap: wrap; gap: .5rem; margin: .2rem 0 .4rem; }
.gb-crafttab { width: auto; min-width: 4.4rem; padding: .2rem .7rem; }
.gb-crafttab img { width: 3.8rem; height: 3.8rem; object-fit: contain; }
.gb-crafttab-t { font-family: var(--f-display); font-size: 1.6rem; color: #4a2e14; white-space: nowrap; line-height: 3.8rem; }
.gb-craftrow { cursor: pointer; }
.gb-craftview { display: grid; grid-template-columns: 14rem 1fr; gap: 1.2rem; align-items: start; margin: .4rem 0 .8rem; }
.gb-craftbig { width: 14rem; height: 14rem; border-radius: 22%; background: radial-gradient(circle, rgba(255, 246, 222, .7) 40%, rgba(236, 220, 180, .6)); box-shadow: inset 0 0 .5rem rgba(90, 55, 20, .3), 0 0 0 .1rem rgba(90, 55, 20, .22); padding: .8rem; }
.gb-craftbig > * { width: 100%; height: 100%; }
.gb-craftinfo .gd-desc { font-size: 1.45rem; line-height: 1.35; }
.gb-craftmats { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .6rem; }
.gb-craftmat { display: grid; grid-template-columns: 4rem 1fr auto; align-items: center; gap: .8rem; font-size: 1.6rem; }
.gb-craftmat .gb-prow-icon { width: 4rem; height: 4rem; }
.gb-craftmat b { font-family: var(--f-display); font-weight: 400; }
.gb-craftmat.short b { color: #a3221c; }
.gb-craftrow.dim { opacity: .62; }
