/* The Parsonage — candlelit tokens (after Harlin's Ballad), phone-first portrait layout. */
:root {
  --ts: 1;   /* text size, from the menu (core/settings.js) */
  --bg: #1a120b;
  --panel: #2a1c11;
  --panel-2: #33231552;
  --line: #5a3d22;
  --ink: #f1e4c8;
  --ink-dim: #c2ad8a;
  --gold: #e8b04a;
  --ember: #d9573f;
  --green: #8fbf5a;
  --shadow: 0 2px 0 #0008;
  --pix: 'VT323', ui-monospace, monospace;
  --fell: 'IM Fell English', Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
html { touch-action: manipulation; }   /* no double-tap zoom (fast tapping zoomed iPhones in); pinch still works */
body {
  font-family: var(--pix); font-size: calc(19px * var(--ts, 1)); line-height: 1.2; font-variant-numeric: tabular-nums;
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
canvas.spr, canvas.portrait, .scene { image-rendering: pixelated; image-rendering: crisp-edges; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.small { font-size: calc(16px * var(--ts, 1)); color: var(--ink-dim); }

/* HUD */
.hud { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: linear-gradient(#1a120bf2, #1a120bd9); border-bottom: 1px solid var(--line); }
.coinbox { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.coin-ico { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe39a, var(--gold) 60%, #8a5a1c); box-shadow: 0 0 0 2px #1a120b, 0 0 0 3px #8a5a1c; align-self: center; flex: none; }
#coin { font-size: calc(34px * var(--ts, 1)); font-weight: 600; color: var(--gold); text-shadow: var(--shadow); white-space: nowrap; }
.rate { color: var(--ink-dim); font-size: calc(19px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: calc(16px * var(--ts, 1)); padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink-dim); white-space: nowrap; }
.badge.hot { color: #1a120b; background: var(--gold); border-color: var(--gold); }
.menu .vol { display: grid; gap: 4px; padding: 0 4px; }
.menu .vol input { width: 100%; accent-color: var(--gold, #d4a64a); touch-action: pan-y; }
.menu { position: absolute; right: 16px; top: 52px; z-index: 6; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; min-width: 200px; }

/* Scene */
.scene { display: block; width: 100%; aspect-ratio: 16 / 9; background: #120c07; border-bottom: 2px solid var(--line); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; padding: 6px 10px; border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0; background: #22170e; color: var(--ink-dim); font-size: calc(18px * var(--ts, 1)); white-space: nowrap; }
.tab.on { background: var(--panel); color: var(--ink); }
.tab:disabled { opacity: .55; }
.panel { background: var(--panel); margin: 0 16px 24px; border: 1px solid var(--line); border-radius: 0 0 10px 10px; padding: 10px; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: #3a2716; border-radius: 8px; padding: 8px 10px; cursor: pointer; text-decoration: none; text-align: center; min-height: 40px; box-shadow: var(--shadow); }
.btn:active:not(:disabled) { translate: 0 1px; box-shadow: none; }   /* translate, not transform: centred buttons (transform: translateX(-50%)) must not jump sideways when pressed */
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--gold); color: #1a120b; border-color: #8a5a1c; font-weight: 600; }
.btn.icon { min-width: 40px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.seg-group { display: flex; gap: 2px; }
.btn.seg { min-height: 34px; padding: 2px 9px; font-size: calc(18px * var(--ts, 1)); border-radius: 6px; }
.btn.seg.on { background: var(--gold); color: #1a120b; }
.btn.lastcall { margin-left: auto; font-size: calc(17px * var(--ts, 1)); min-height: 34px; padding: 4px 10px; }
.btn.lastcall.active { background: var(--ember); border-color: #7a2414; animation: glow 1s ease-in-out infinite alternate; }

/* Business rows */
.biz-list { display: grid; gap: 8px; }
.biz { display: grid; gap: 8px; padding: 8px; background: #22170e; border: 1px solid var(--line); border-radius: 10px; }
.biz-main { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.biz-actions { display: flex; gap: 6px; }
.biz-actions > * { flex: 1 1 0; min-width: 0; }
.staffed { display: flex; align-items: center; justify-content: center; border: 1px dashed #4f7a3a; border-radius: 8px; color: var(--green); font-size: calc(16px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.biz.locked { opacity: .8; }
.biz-left { position: relative; }
.biz-icon { width: 56px; height: 56px; border-radius: 10px; border: 2px solid var(--line); background: radial-gradient(circle at 50% 40%, #4a311b, #2a1c11); display: grid; place-items: center; cursor: pointer; padding: 0; }
.biz-icon.auto { border-color: var(--green); }
.biz-icon.pressed { transform: scale(.93); }
.owned { position: absolute; right: -6px; bottom: -6px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; font-size: calc(16px * var(--ts, 1)); padding: 1px 6px; min-width: 22px; text-align: center; }
.biz-mid { min-width: 0; }
.biz-top { display: flex; justify-content: space-between; gap: 6px; }
.biz-name { font-size: calc(20px * var(--ts, 1)); }
.ms { font-size: calc(17px * var(--ts, 1)); color: var(--gold); white-space: nowrap; }
.bar { height: 10px; margin: 5px 0; background: #120c07; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.fill { height: 100%; width: 0; background: linear-gradient(90deg, #b8742a, var(--gold)); }
.biz-sub { display: flex; gap: 10px; flex-wrap: wrap; font-size: calc(18px * var(--ts, 1)); color: var(--ink-dim); }
.earn { color: var(--ink); }
.btn.buy { font-size: calc(17px * var(--ts, 1)); white-space: nowrap; }
.btn.hire { font-size: calc(16px * var(--ts, 1)); background: #24331a; border-color: #4f7a3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.waiting { position: relative; }
.tab.waiting::after { content: ''; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px #1a120b; }
.nudge { animation: nudge 1s ease-in-out infinite; }
.hold { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.hold.holding { filter: brightness(1.25); }

/* Upgrades */
.ledger { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.ledger summary { cursor: pointer; color: var(--gold); padding: 4px 0; }
.upgrades { display: grid; gap: 6px; margin-top: 6px; }
.upg { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 8px; background: #22170e; border-radius: 8px; border: 1px solid var(--line); }

/* Overlays: story dialog, away summary */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; padding: calc(16px + env(safe-area-inset-top)) 16px 16px; background: #0009;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* a card sits at the bottom when it fits; taller than the screen, its top stays on screen and it scrolls */
.overlay > * { margin-top: auto; flex: none; }
.dlg { width: 100%; max-width: 528px; background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 8px 30px #000a; margin-bottom: env(safe-area-inset-bottom); }
.dlg.letter { background: #e9e2d0; color: #2a1d14; border-color: #b39a6a; }
.dlg.letter .dlg-text { font-style: italic; }
.dlg-who { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: calc(22px * var(--ts, 1)); }
.dlg.letter .dlg-who { color: #6b4423; }
.portrait { width: 48px; height: 48px; border: 2px solid var(--line); border-radius: 8px; background: #120c07; }
.dlg-text { font-family: var(--fell); font-size: calc(19px * var(--ts, 1)); line-height: 1.45; margin: 12px 0 14px; user-select: text; }
.dlg-next { width: 100%; }
.dlg h2 { margin: 0 0 8px; color: var(--gold); font-weight: 600; }
.dlg .big { font-size: calc(26px * var(--ts, 1)); color: var(--gold); margin: 8px 0; }
.char-form { display: grid; gap: 10px; }
.gender { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.choice { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn.choice.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.look-picker { display: grid; gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.45); cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.name-input { font: inherit; font-size: calc(18px * var(--ts, 1)); padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: #120c07; color: var(--ink); user-select: text; }
.err { color: var(--ember); font-size: calc(16px * var(--ts, 1)); min-height: 1em; font-family: var(--fell); }

.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20; pointer-events: none; background: var(--panel); border: 1px solid var(--gold); border-radius: 10px; padding: 10px 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px #000a; }

@keyframes nudge { 50% { box-shadow: 0 0 0 4px #e8b04a88; } }
@keyframes glow { to { box-shadow: 0 0 14px #d9573f; } }
@media (prefers-reduced-motion: reduce) { .nudge, .btn.lastcall.active { animation: none; } }
@media (max-width: 380px) { .biz-icon { width: 48px; height: 48px; } .biz-actions .btn { font-size: calc(15px * var(--ts, 1)); padding: 6px 6px; } }
.update { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 30; box-shadow: 0 6px 20px #000a; }

/* Workers */
.grade { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 5px; border-radius: 6px; font-size: calc(18px * var(--ts, 1)); color: #1a120b; background: #9a9a9a; border: 1px solid #0006; flex: none; }
.grade.g0 { background: #8f8f8f; } .grade.g1 { background: #b08a5a; } .grade.g2 { background: #7fbf5a; } .grade.g3 { background: #5aa0d9; }
.grade.g4 { background: #b07ad9; } .grade.g5 { background: #f0c050; } .grade.g6 { background: #f09a40; } .grade.g7 { background: #e85a4a; color: #fff; }
.grade.g8 { background: linear-gradient(90deg, #e85a4a, #f0c050, #7fbf5a, #5aa0d9, #b07ad9); color: #fff; text-shadow: 0 1px 0 #000; }
.btn.crew { display: flex; align-items: center; justify-content: center; gap: 4px; background: #24331a; border-color: #4f7a3a; font-size: calc(16px * var(--ts, 1)); white-space: nowrap; overflow: hidden; }
.btn.crew .grade { min-width: 26px; height: 22px; font-size: calc(16px * var(--ts, 1)); }
.smith-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.smith-row .btn.crew { max-width: 100%; color: var(--ink); }
.slots { color: var(--ink-dim); }
.wline { display: flex; align-items: center; gap: 10px; }
.wtext { flex: 1; min-width: 0; }
.wname { font-size: calc(20px * var(--ts, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { color: var(--gold); }
.card { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; }
.card.legend, .wline.legend .wname { border-color: var(--gold); }
.card.legend { box-shadow: 0 0 0 1px #e8b04a55 inset; }
.card .lore { font-family: var(--fell); font-size: calc(16px * var(--ts, 1)); margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card-actions .btn { min-height: 34px; padding: 4px 9px; font-size: calc(16px * var(--ts, 1)); }
.btn.ghost { background: transparent; }
.working { color: var(--green); } .idle { color: var(--ember); }
.board, .roster { display: grid; gap: 8px; margin-bottom: 12px; }
.notices { display: grid; gap: 6px; margin-bottom: 10px; }
.btn.notice { text-align: left; font-size: calc(17px * var(--ts, 1)); }
.btn.crier { display: block; width: 100%; margin: -4px 0 10px; text-align: left; }
.panel h3 { margin: 8px 0 6px; color: var(--gold); font-weight: 400; font-size: calc(22px * var(--ts, 1)); }
.tab.locked { opacity: .55; }
.dlg.picker { max-height: 80dvh; display: grid; grid-template-rows: auto 1fr; }
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.picker-body, .dlg.picker > .plist { overflow: auto; min-height: 0; overscroll-behavior: contain; }
.plist { display: grid; gap: 8px; }
.plist h3 { margin: 6px 0 0; color: var(--gold); font-weight: 400; }
.job-ico { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #2a1c11; flex: none; }

/* Renovations */
.ledger summary.hot { color: #1a120b; background: var(--gold); border-radius: 6px; padding: 4px 8px; display: inline-block; }
.upg.reno.legend { border-color: #8a5a1c; background: #2a1d10; opacity: .9; }
.lockmark { font-size: calc(20px * var(--ts, 1)); }

/* Story cards and the Tales book */
.story-card { margin: -4px -4px 10px; border: 2px solid var(--gold); border-radius: 10px; overflow: hidden; position: relative; background: #000; }
.story-card .card-art { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.card-chapter { position: absolute; left: 10px; top: 8px; font-size: calc(16px * var(--ts, 1)); color: #fff4c8; text-shadow: 0 1px 0 #000, 0 0 6px #000; text-transform: uppercase; letter-spacing: 0; }
.card-title { font-family: var(--fell); font-size: calc(26px * var(--ts, 1)); color: var(--gold); text-align: center; padding: 6px 8px; background: #1a120b; border-top: 1px solid var(--line); }
.dlg.has-card { animation: cardIn .45s ease-out; }
.btn.tale { display: grid; text-align: left; gap: 2px; }
.btn.tale b { font-family: var(--fell); font-size: calc(20px * var(--ts, 1)); font-weight: 400; color: var(--gold); }
@keyframes cardIn { from { transform: translateY(16px) scale(.97); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dlg.has-card { animation: none; } }

/* Gathering */
.mats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.mat { display: grid; justify-items: center; background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 6px 4px; }
.mat b { font-size: calc(24px * var(--ts, 1)); color: var(--gold); font-weight: 400; }
.hint { margin: 4px 0 8px; }
.gbuys { display: grid; gap: 6px; margin-bottom: 8px; }
.btn.gbuy { text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: calc(16px * var(--ts, 1)); padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); background: #22170e; white-space: nowrap; }
.chip.t2 { border-color: #b08a5a; } .chip.t3 { border-color: #7fbf5a; } .chip.t4 { border-color: #5aa0d9; } .chip.t5 { border-color: #b07ad9; }
.chip.t6 { border-color: #f0c050; } .chip.t7 { border-color: #f09a40; } .chip.t8 { border-color: #e85a4a; } .chip.t9 { border-color: #fff; box-shadow: 0 0 6px #fff8; }
.upg.locked { opacity: .65; }

/* Expedition tab */
.chapter { background: #1b1a2e; border: 1px solid #3a3550; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.chapter h3 { margin: 2px 0 4px; }
.chapter .lore { font-family: var(--fell); font-size: calc(18px * var(--ts, 1)); margin: 0; color: var(--ink); }
.hero-line { display: flex; align-items: center; gap: 12px; margin: 8px 0 12px; }
.btn.big-go { width: 100%; font-size: calc(24px * var(--ts, 1)); padding: 12px; }

/* The run: full screen, nothing scrolls or zooms underneath */
body.in-run { overflow: hidden; }
.run { position: fixed; inset: 0; z-index: 40; background: #0d0c16; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.run-canvas, .run-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.run-canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
.run-overlay { touch-action: none; }
.run-hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + env(safe-area-inset-top)) 12px 0; display: grid; gap: 6px; pointer-events: none; }
.run-row { display: flex; align-items: center; gap: 10px; color: var(--ink); text-shadow: 0 1px 0 #000; }
.run-bar { height: 8px; background: #0008; border: 1px solid #ffffff30; border-radius: 99px; overflow: hidden; }
.run-bar .fill.xp { background: linear-gradient(90deg, #5aa0d9, #9fd0ff); transition: width .15s; }
.run-bar.hpbar { flex: 1; height: 12px; }
.run-bar .fill.hp { background: linear-gradient(90deg, #a8322d, #e85a4a); transition: width .12s; }
.run-time { font-size: calc(22px * var(--ts, 1)); min-width: 64px; text-align: right; }
.run-lvl { color: var(--gold); }
.run-pause { pointer-events: auto; min-height: 36px; min-width: 40px; }
.run-hint { position: absolute; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); color: var(--ink); background: #0009; border-radius: 10px; padding: 8px 12px; pointer-events: none; transition: opacity .6s; text-align: center; max-width: calc(100% - 32px); }
.run-hint.gone { opacity: 0; }
/* a card taller than the screen scrolls (it's its own scroller, so the run's touch-action: none doesn't stop it);
   margin: auto centres it when it fits and pins its top when it doesn't */
.run-modal { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  background: #0008; backdrop-filter: blur(2px); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.run-modal > * { margin: auto; flex: none; }
.run-card-wrap { width: 100%; max-width: 420px; display: grid; gap: 10px; text-align: center; background: var(--panel); border: 2px solid var(--gold); border-radius: 14px; padding: 16px; animation: cardIn .3s ease-out; }
.run-card-wrap h2 { margin: 0; color: var(--gold); font-weight: 400; font-size: calc(32px * var(--ts, 1)); }
@media (max-height: 740px) { .run-card-wrap { gap: 8px; padding: 12px; } .run-card-wrap h2 { font-size: calc(26px * var(--ts, 1)); } }
.run-card-wrap p { margin: 0; }
.pick-tools { display: flex; gap: 8px; justify-content: center; }
.run-card:disabled { opacity: .45; }
.run-card.banishing { border-color: #c0503a; box-shadow: 0 0 0 1px #c0503a inset; }
.run-card { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: #22170e; cursor: pointer; }
.run-card:active { transform: scale(.98); }
.run-card .spr { flex: none; width: 44px !important; height: 44px !important; object-fit: contain; }
.run-card b { font-size: calc(22px * var(--ts, 1)); font-weight: 400; color: var(--ink); }
.run-card .lv { color: var(--gold); }

/* Expedition: hero and stage select */
.hero-card { display: flex; gap: 12px; align-items: center; background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.hero-card .grow { flex: 1; min-width: 0; }
.hero-card .lvl { color: var(--gold); }
.stages { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.stage { position: relative; width: 52px; height: 52px; border-radius: 10px; border: 1px solid var(--line); background: #2a2440; color: var(--ink); font-size: calc(22px * var(--ts, 1)); }
.stage.cleared { background: #24331a; border-color: #4f7a3a; }
.stage.boss { border-color: #a8322d; }
.stage.sel { box-shadow: 0 0 0 2px var(--gold); }
.stage.locked { opacity: .5; }
.stage .tick { position: absolute; right: 4px; top: 0; font-size: calc(14px * var(--ts, 1)); color: var(--green); }
.stage-detail { background: #1b1a2e; border: 1px solid #3a3550; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.stage-detail h3 { margin: 2px 0 4px; }
.new-foe { color: var(--ember); }
.run-card-wrap.foe .spr { margin: 0 auto; }
.hero-gain { background: #22170e; border: 1px solid var(--gold); border-radius: 10px; padding: 8px; display: grid; gap: 4px; }
.hero-gain .big { color: var(--gold); font-size: calc(22px * var(--ts, 1)); }
.hero-gain .unlock { color: var(--green); }
/* stars, loot, gear */
.stage .tick { color: var(--gold); font-size: calc(13px * var(--ts, 1)); letter-spacing: -1px; }
.star-goals { display: grid; gap: 1px; margin: 4px 0 6px; }
.star-goals .got { color: var(--gold); }
.loot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 4px 0 8px; }
.loot-item { display: inline-flex; align-items: center; gap: 2px; }
.stars-won { color: var(--gold); }
.gear-line { color: var(--ink-dim); }
.gear-tag { color: var(--gold); font-size: calc(15px * var(--ts, 1)); }
.mats.forge-mats { grid-template-columns: repeat(4, 1fr); }
.mat .spr { margin-bottom: 2px; }
.forge-card { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.forge-head { display: flex; gap: 10px; align-items: center; }
.forge-head .grow { flex: 1; min-width: 0; }
.forge-icon { width: 48px; height: 48px; display: grid; place-items: center; background: #160f09; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.forge-next { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; display: grid; gap: 4px; }
.forge-next .up { color: var(--green); }
.ability-grant { display: flex; gap: 8px; align-items: center; background: #2a1d10; border: 1px solid #8a5a1c; border-radius: 8px; padding: 6px 8px; }
.ability-grant b { color: var(--gold); font-weight: 400; }
.costs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 4px; }
.cost-item { display: inline-flex; align-items: center; gap: 3px; }
.cost-item.short { color: var(--ember); }
.tab { padding: 6px 7px; font-size: calc(16px * var(--ts, 1)); }

/* Erik in a run: the Firecracker button */
.run-fire { position: absolute; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3; width: 78px; height: 78px; border-radius: 50%;
  border: 2px solid #ff9a3a; background: radial-gradient(circle, #5a2a12, #2a140a); box-shadow: 0 0 14px #ff9a3a88; display: grid; place-items: center; padding: 0; touch-action: none; }
.run-fire .n { position: absolute; bottom: 4px; font-size: calc(18px * var(--ts, 1)); color: #ffd36b; text-shadow: 0 1px 0 #000; }
.run-fire.spent { opacity: .4; box-shadow: none; filter: grayscale(.6); }
.run-fire.boss:not(.spent) { animation: firePulse .7s ease-in-out infinite alternate; }
@keyframes firePulse { from { box-shadow: 0 0 8px #ff9a3a88; } to { box-shadow: 0 0 26px #ffd36b; transform: scale(1.06); } }
.gear-tag.who { color: #e8a080; }

/* Expedition: companions and the scouting party */
.hero-card.companion { border-color: #8a4a3a; }
.hero-card.companion.hurt { opacity: .95; background: #2a1510; }
.toggle { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: calc(17px * var(--ts, 1)); }
.toggle input { width: 20px; height: 20px; accent-color: var(--gold); }
.scouts { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 10px 0; display: grid; gap: 6px; }
.scout-pick { display: flex; align-items: center; width: 100%; text-align: left; font-size: calc(17px * var(--ts, 1)); }
.scout-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px; background: #22170e; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.scout-row.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.starts { margin-top: 8px; display: grid; gap: 6px; }
.starts-head { opacity: 0.85; }
.start-slot { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; background: #22170e; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.start-slot .lv { color: var(--gold); }
.start-slot.shut { opacity: 0.6; border-style: dashed; }
.start-slot.ward { margin-left: 18px; width: calc(100% - 18px); border-color: #6b5a2a; }
.starts-ward { color: var(--gold); }
.start-ico { flex: none; width: 48px; display: grid; place-items: center; }
.start-slot .start-ico { width: 32px; }
.start-empty { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 6px; color: var(--gold); font-size: calc(18px * var(--ts, 1)); }
.scout-row .num { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #120c07; font-size: calc(17px * var(--ts, 1)); }
.scout-row.boss .num { color: #e05a4a; }
.scout-row .stars { color: var(--gold); }
.scout-row .tick { flex: none; color: var(--gold); font-size: calc(20px * var(--ts, 1)); width: 18px; }

/* Forge: the anvil and the hammer */
.anvil-card { background: #2a160c; border: 1px solid #8a4a2a; border-radius: 10px; padding: 10px; margin: 10px 0; box-shadow: inset 0 0 24px #ff6a2a22; }
.anvil-card.idle { box-shadow: none; border-color: var(--line); }
.anvil-row { display: flex; gap: 10px; align-items: center; }
.anvil-art { position: relative; display: grid; justify-items: center; }
.anvil-art > :first-child { margin-bottom: -6px; }
.anvil-art.hit { animation: anvilHit .18s ease-out; }
.anvil-art.perfect::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; background: radial-gradient(circle, #ffd36baa, transparent 70%); animation: spark .4s ease-out forwards; }
@keyframes anvilHit { 0% { transform: translateY(3px) scale(1.05); } 100% { transform: none; } }
@keyframes spark { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: scale(1.5); } }
.hammer { margin-top: 8px; display: grid; gap: 6px; }
.hammer-bar { position: relative; height: 26px; background: #120c07; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.hammer-bar .zone { position: absolute; top: 0; bottom: 0; }
.hammer-bar .zone.good { left: 32.5%; width: 35%; background: #b8742a55; }
.hammer-bar .zone.perfect { left: 45%; width: 10%; background: #ffd36bcc; box-shadow: 0 0 10px #ffd36b; }
.hammer-bar .marker { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background: #fff4c8; box-shadow: 0 0 6px #fff; }
.hammer-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pips { display: flex; gap: 4px; }
.pip { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); background: #120c07; }
.pip.miss { background: #4a2a22; } .pip.ok { background: #8a6a3a; } .pip.good { background: #b8742a; } .pip.perfect { background: #ffd36b; box-shadow: 0 0 6px #ffd36b; }
.verdict { font-size: calc(18px * var(--ts, 1)); min-width: 6em; }
.verdict.perfect { color: #ffd36b; } .verdict.good { color: var(--gold); } .verdict.miss { color: var(--ember); }
.btn.strike { font-size: calc(22px * var(--ts, 1)); min-height: 52px; }
.queued { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.btn.tiny { min-height: 28px; padding: 2px 8px; font-size: calc(15px * var(--ts, 1)); }

/* Mine */
.stage-card { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.stage-top { display: flex; align-items: baseline; gap: 4px; }
.neck { color: var(--ember); font-size: calc(16px * var(--ts, 1)); }
.stage-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.stage-btns .btn { flex: 1 1 auto; }
.geodes { display: flex; align-items: center; gap: 10px; background: #1e1426; border: 1px solid #5d3a6e; border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.upg.shaft { display: flex; align-items: center; gap: 8px; }
.shaft-ico { flex: none; }
.upg.breaking { border-color: var(--gold); }
.grow { flex: 1; min-width: 0; }
.tab { padding: 6px 6px; font-size: calc(15px * var(--ts, 1)); }
.run-fire.storm { border-color: #7fd0ff; background: radial-gradient(circle, #12304a, #0a1622); box-shadow: 0 0 14px #7fd0ff88; }
.run-fire.storm.boss:not(.spent) { animation: stormPulse .7s ease-in-out infinite alternate; }
@keyframes stormPulse { from { box-shadow: 0 0 8px #7fd0ff88; } to { box-shadow: 0 0 26px #bfe8ff; transform: scale(1.06); } }
.hero-head { margin: 14px 0 6px; }
.mat { cursor: pointer; }
.infest { background: #1e1210; border: 1px solid #8a3a2a; border-radius: 10px; padding: 10px; margin: 8px 0; display: flex; gap: 10px; align-items: center; }
.furnace-off { opacity: .6; }
.stage-btns.col { flex-direction: column; }

.run-fire.crystal { border-color: #bfe8ff; background: radial-gradient(circle, #1a3a4a, #0a1822); box-shadow: 0 0 14px #bfe8ff88; }
.run-fire.wallb { border-color: #e8b04a; background: radial-gradient(circle, #4a3a12, #22180a); box-shadow: 0 0 14px #e8b04a88; }

.relics { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 10px 0; }
.relics summary { cursor: pointer; font-size: calc(19px * var(--ts, 1)); }
.relic { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.relic.missing { opacity: .55; }
.relic .q { width: 24px; height: 24px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 4px; flex: none; }
.relic-won { display: flex; gap: 10px; align-items: center; border-color: var(--gold) !important; }
.away-gains { margin: 8px 0; }
.away-notes { margin: 8px 0; padding-left: 18px; text-align: left; font-size: calc(17px * var(--ts, 1)); }
.away-notes li { margin: 4px 0; }

.hold { background: #22170e; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 10px 0; display: grid; gap: 6px; }
.hold-row { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 6px; }

/* The Road */
.road-head { display: grid; gap: 2px; margin-bottom: 6px; }
.road-head .fame { color: var(--gold); font-size: calc(20px * var(--ts, 1)); }
.fair { font-size: calc(16px * var(--ts, 1)); color: var(--ink-dim); padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px; margin: 4px 0 8px; }
.fair.on { color: #1a120b; background: linear-gradient(90deg, #e8b04a, #ffd36b); border: 1px solid #8a5a1c; }
.road-list { display: grid; gap: 8px; }
.goal { display: grid; gap: 0; }
.goal-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tiers { display: flex; flex-wrap: wrap; gap: 4px; }
.tier { font-size: calc(14px * var(--ts, 1)); color: var(--ink-dim); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; }
.tier.paid { color: #1a120b; background: var(--gold); border-color: var(--gold); }
.segs { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; }
.segs.wrap { flex-wrap: wrap; }
.segs .btn { min-height: 34px; padding: 4px 8px; font-size: calc(16px * var(--ts, 1)); }
.cabinet { display: grid; gap: 6px; margin: 4px 0 8px; }
.curio { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; background: #22170e; border: 1px solid var(--line); border-radius: 8px; }
.curio.empty { display: block; text-align: center; border-style: dashed; padding: 10px; }
.curio.r1 { border-color: #5a8ad0; } .curio.r2 { border-color: #a070d0; box-shadow: 0 0 0 1px #a070d044 inset; } .curio.r3 { border-color: var(--gold); box-shadow: 0 0 0 1px #e8b04a66 inset; }
.curio .card-actions { justify-content: flex-end; align-items: center; }

/* the Lore (in the Tales book) */
.picker-tabs { display: flex; gap: 6px; }
.lore-group { margin: 12px 0 4px; font-size: calc(15px * var(--ts, 1)); }
.lore-page { padding: 6px 2px; border-bottom: 1px solid rgba(255,255,255,.08); }
.lore-page summary { cursor: pointer; font-weight: 600; }
.lore-page p { margin: 6px 0 2px; line-height: 1.4; }
.lore-page.locked { opacity: .55; }

/* guides: a ring around the thing to use, Moira's bubble at the bottom */
.guide-ring { position: absolute; z-index: 40; pointer-events: none; border: 3px solid #ffd36b; border-radius: 10px;
  box-shadow: 0 0 0 3px rgba(26,18,11,.6), 0 0 18px 4px rgba(255,211,107,.55); animation: guide-pulse 1.2s ease-in-out infinite; }
@keyframes guide-pulse { 50% { box-shadow: 0 0 0 3px rgba(26,18,11,.6), 0 0 28px 8px rgba(255,211,107,.85); } }
.guide { position: fixed; z-index: 41; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto;
  background: #2b1d12; border: 2px solid #e8b04a; border-radius: 12px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.6); }
.guide-who { display: flex; align-items: center; gap: 8px; }
.guide-text { margin: 6px 0 8px; line-height: 1.35; }
.guide-btns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guide-wait { opacity: .7; font-style: italic; }

/* the tabs: a grid of four across, wrapping to a second row, so every mode (and what's coming)
   is in sight on a phone instead of scrolled off the edge */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; overflow: visible; padding: 8px 16px 6px; }
.tab { padding: 7px 2px; font-size: calc(16px * var(--ts, 1)); text-align: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; text-overflow: ellipsis; }
.tab.on { border-color: var(--gold, #e8b04a); box-shadow: inset 0 -2px 0 var(--gold, #e8b04a); }
.tab { position: relative; }
.tab .lock { position: absolute; top: 1px; right: 3px; font-size: calc(9px * var(--ts, 1)); }
.panel { border-radius: 10px; }

/* install-as-an-app offer (js/install.js): near the top, so it doesn't sit on a guide bubble */
.install { position: fixed; z-index: 45; left: 12px; right: 12px; top: calc(60px + env(safe-area-inset-top)); max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: 48px 1fr; gap: 6px 12px; align-items: center; background: var(--panel); border: 1px solid var(--gold);
  border-radius: 12px; padding: 12px; box-shadow: 0 8px 24px #000c; text-align: left; }
.install-ico { width: 48px; height: 48px; border-radius: 10px; image-rendering: pixelated; }
.install-text { margin: 0; font-family: var(--fell); font-size: calc(16px * var(--ts, 1)); color: var(--ink); }
.install-btns { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.install.bottom { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }

/* the opening scene (run/prologue.js): subtitles, the place name, Skip, and the fade to the card */
.run-caption { position: absolute; left: 12px; right: 12px; bottom: calc(22px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 520px; z-index: 3;
  text-align: center; font-size: calc(20px * var(--ts, 1)); line-height: 1.3; color: #f4e7c8; text-shadow: 0 2px 0 #000, 0 0 8px #000; pointer-events: none; }
.run-caption b { color: var(--gold); }
.run-caption .narr { font-family: var(--fell); font-style: italic; color: #d8cbb0; }
.run-place { position: absolute; left: 0; right: 0; top: 34%; z-index: 3; text-align: center; font-family: var(--fell); font-size: calc(40px * var(--ts, 1)); color: #e9e4cf;
  text-shadow: 0 0 18px #000, 0 2px 0 #000; letter-spacing: .06em; opacity: 0; pointer-events: none; }
.run-place.show { animation: placeIn 3.6s ease both; }
@keyframes placeIn { 0% { opacity: 0; transform: translateY(6px); } 25%, 65% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.run-skip { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 4; opacity: .75; }
.prologue-shade { position: fixed; inset: 0; z-index: 60; background: #000; opacity: 0; transition: opacity 1.4s ease; display: grid; place-items: center; pointer-events: none; }
.prologue-shade.on { opacity: 1; pointer-events: auto; }
.prologue-card { font-family: var(--fell); font-style: italic; font-size: calc(30px * var(--ts, 1)); color: #e9e4cf; opacity: 0; transition: opacity 1s ease; padding: 16px; text-align: center; }
.prologue-card.on { opacity: 1; }
.btn.primary.danger { background: #a8322d; border-color: #d9573f; color: #fff4e8; }
.btn.primary.danger:disabled { background: #3a2018; border-color: var(--line); color: var(--ink-dim); }
.btn.primary.danger { background: #a8322d; border-color: #d9573f; color: #fff4e8; }
.btn.primary.danger:disabled { background: #3a2018; border-color: var(--line); color: var(--ink-dim); }
.btn.merge-ready { animation: mergeGlow 1.6s ease-in-out infinite; }
@keyframes mergeGlow { 50% { box-shadow: 0 0 0 2px #ffd36b88, 0 0 14px #ffd36b66; } }

/* a new player's first two hours (body.teaching, set by the guide): every button that closes a card
   or moves things on pulses with the guide's gold ring, so there's never a doubt what to tap */
body.teaching .dlg-next, body.teaching .char-form .btn.primary, body.teaching #away .btn.primary,
body.teaching .run-modal .btn.primary, body.teaching .run-modal .run-card, body.teaching .run-skip {
  animation: tap-pulse 1.2s ease-in-out infinite; }
@keyframes tap-pulse { 0%, 100% { box-shadow: 0 0 0 2px #ffd36b, 0 0 10px 2px rgba(255,211,107,.45); } 50% { box-shadow: 0 0 0 3px #ffd36b, 0 0 22px 6px rgba(255,211,107,.8); } }
body.guiding #panel { padding-bottom: 230px; }   /* room to scroll what the guide points at above its bubble */
.find-line { margin: 8px 0; padding: 8px 10px; border-left: 3px solid var(--gold); background: #22170e; border-radius: 6px; line-height: 1.35; }
.run-band { position: absolute; left: 0; right: 0; top: 28%; text-align: center; pointer-events: none; color: var(--ink); text-shadow: 0 2px 0 #000, 0 0 12px #000; transition: opacity 1.2s; }
.run-band.fade { opacity: 0; }
.run-band-hint { max-width: 80%; margin: 8px auto 0; font-style: italic; }
.run-band-name { font-size: calc(34px * var(--ts, 1)); color: var(--gold); letter-spacing: 1px; }
/* ★ MAX on a level-up card (Adam, 2026-11-04); hidden combos are never announced */
.run-card.maxing { border-color: #ffd36b; box-shadow: 0 0 0 1px #ffd36b66, 0 0 14px #ffd36b44; }
.max-tag { color: #ffd36b; font-size: calc(15px * var(--ts, 1)); letter-spacing: 1px; }
.max-line { color: #ffe9a8; margin-top: 2px; }

/* ---- the Open Road: the map (trade mode, TRADE.md) ---- */
.map-hud { position: absolute; left: 0; right: 0; top: 0; padding: calc(8px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); display: flex; gap: 8px; align-items: flex-start; pointer-events: none; }
.map-where { flex: 1; min-width: 0; color: var(--ink); text-shadow: 0 1px 0 #000, 0 0 8px #000; }
.map-area { font-family: var(--fell); font-size: calc(24px * var(--ts, 1)); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-sub { color: var(--ink); opacity: .85; }
.map-btn { pointer-events: auto; min-height: 40px; min-width: 44px; font-size: calc(20px * var(--ts, 1)); }
.map-visit { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(28px + env(safe-area-inset-bottom)); pointer-events: auto; max-width: calc(100% - 32px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 4px 14px #000a; }
.map-edge { position: absolute; left: 50%; top: calc(76px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(380px, calc(100% - 32px)); text-align: center; color: var(--ink); background: #000b; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; pointer-events: none; font-style: italic; }
.map-card .map-ov-wrap { background: #120e0a; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.map-ov { display: block; width: 100%; height: auto; }
.map-card .map-ov-wrap:has(.map-ov.wide) { overflow-x: auto; overscroll-behavior: contain; }
.map-ov.wide { width: auto; max-width: none; height: min(46vh, 300px); }
.map-signs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.map-signs .btn { min-height: 36px; padding: 6px 10px; font-size: calc(16px * var(--ts, 1)); }
.town-card .soon { display: grid; gap: 4px; text-align: left; border-top: 1px solid var(--line); padding-top: 8px; }
.soon-note { opacity: .8; font-style: italic; }
/* the Open Road's markets */
.run-card-wrap.market { max-height: calc(100vh - 40px); overflow-y: auto; }
.run-card-wrap.market h2 { font-size: calc(26px * var(--ts, 1)); }
.market h3 { margin: 4px 0 0; font-size: calc(15px * var(--ts, 1)); font-weight: 400; color: var(--gold); text-align: left; border-top: 1px solid var(--line); padding-top: 6px; }
.mk-list { display: grid; gap: 6px; }
.mk-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; text-align: left; }
.mk-good { flex: 1 1 8em; }
.mk-word { opacity: .75; }
.mk-price { min-width: 4.5em; text-align: right; }
.mk-row .btn { padding: 6px 10px; font-size: calc(14px * var(--ts, 1)); min-height: 0; }
.mk-row.tight { flex-wrap: nowrap; }
.mk-step { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.mk-step .btn { min-width: 36px; font-size: calc(18px * var(--ts, 1)); padding: 4px 0; }
.mk-count { min-width: 22px; text-align: center; font-weight: 700; }
.run-card-wrap.still { animation: none; }
.mk-row.tight .mk-good { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-row.tight .mk-word, .mk-row.tight .mk-price, .mk-row.tight .btn { white-space: nowrap; flex: 0 0 auto; }
.run-card-wrap.market { grid-template-columns: minmax(0, 1fr); }
.run-card-wrap.market > *, .mk-list > * { min-width: 0; }
.mk-row.tight .mk-word { font-size: calc(12px * var(--ts, 1)); }
.mk-row.picked { outline: 1px solid var(--gold); border-radius: 6px; padding: 2px 4px; }
.mk-row.tight div.mk-good { white-space: normal; }
.mk-row.tight div.mk-good > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The Open Road: supply runs (slice D) — pack or wagon, the stable, town services */
.mk-take { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.mk-ups { display: grid; gap: 4px; margin-top: 4px; }
.mk-ups .btn { text-align: left; white-space: normal; }
.mk-row.stable { align-items: flex-start; }
.mk-row.stable .mk-good { flex: 1 1 100%; }

/* The Open Road: talking to townsfolk (slice E) */
.talk-card .talk-who { display: flex; align-items: center; gap: 12px; text-align: left; }
.talk-card .talk-who h2 { margin: 0; }
.talk-card .talk-line { font-style: italic; margin: 12px 0; }
.talk-job { text-align: left; margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,211,107,0.15); display: flex; flex-direction: column; gap: 4px; }
.talk-job.offer { border-color: rgba(255,211,107,0.55); }
.talk-job.due { border-color: rgba(159,191,90,0.7); }
.talk-job .btn { align-self: flex-start; }
.talk-job .mk-take { margin: 2px 0 0; }
.talk-job.news { border-color: rgba(140,180,230,0.45); }
.hero-gain.trouble { border-color: rgba(255,154,60,0.7); }

/* ---- the tables (DESIGN.md §26): bones at the Parsonage, Dressler's cards ---- */
.overlay.gamble-host { overflow-y: auto; }
.gamble .gamble-stakes, .gamble .gamble-opps { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.gamble .gamble-stakes .btn { flex: 1 1 0; min-width: 0; display: grid; gap: 2px; padding: 6px 4px; }
.gamble .gamble-stakes .btn.primary .small { color: inherit; opacity: .8; }
.gamble .gamble-opps .btn { display: inline-flex; align-items: center; gap: 6px; }
.gamble .gamble-score { font-size: calc(22px * var(--ts, 1)); color: var(--gold); }
.dice { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 6px 0; }
.die { width: 52px; height: 52px; padding: 6px; border-radius: 10px; border: 2px solid #c8b894; background: linear-gradient(#f6eedb, #e2d5b6); box-shadow: 0 3px 0 #8a7650;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center; cursor: pointer; }
.die.roll { animation: dieIn .35s ease-out; }
.die i { width: 9px; height: 9px; border-radius: 50%; }
.die i.on { background: #2a1a10; }
.die.kept { transform: translateY(-6px); border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 6px 0 #8a7650; }
.die:disabled { cursor: default; opacity: 1; }
@keyframes dieIn { 0% { transform: rotate(-200deg) scale(.6); opacity: 0; } 70% { transform: rotate(15deg) scale(1.05); } 100% { transform: none; opacity: 1; } }
.cards { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 74px; }
.pcard { width: 50px; height: 72px; border-radius: 7px; background: #f6eedb; border: 1px solid #8a7650; color: #1a120b; display: grid; place-content: center; text-align: center; box-shadow: 0 2px 0 #5a4630; }
.pcard.new { animation: dieIn .3s ease-out; }
.pcard b { font-size: calc(20px * var(--ts, 1)); line-height: 1; } .pcard span { font-size: calc(20px * var(--ts, 1)); }
.pcard.red { color: #a8322d; }
.pcard.back { background: repeating-linear-gradient(45deg, #6a1e1a 0 4px, #8a2a24 4px 8px); border-color: #3a1410; }
.deck-row { display: flex; justify-content: center; padding: 8px 0 18px; }
.deck { position: relative; width: 50px; height: 72px; }
.deck .pcard { position: absolute; left: 0; top: 0; }
.deck .pcard:nth-child(2) { left: 2px; top: -2px; } .deck .pcard:nth-child(3) { left: 4px; top: -4px; }
.deck .pcard.fly { left: 4px; top: -4px; z-index: 3; }
.deck .pcard.fly.from-top { animation: flyTop .65s ease-in forwards; }
.deck .pcard.fly.from-bottom { z-index: 0; left: 0; top: 0; animation: flyBottom .65s ease-in forwards; }   /* out from under the deck: the tell */
@keyframes flyTop { 0% { transform: none; } 100% { transform: translate(0, -90px) rotate(-8deg); opacity: 0; } }
@keyframes flyBottom { 0% { transform: none; } 35% { transform: translate(14px, 18px); } 100% { transform: translate(10px, -90px) rotate(6deg); opacity: 0; } }
.gamble .btn.call { font-size: calc(20px * var(--ts, 1)); }
.gamble .gamble-faces { justify-content: center; }
.gamble-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gb-seat { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: #0003; }
.gb-seat.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.gb-seat.top { background: #e8b04a33; border-color: var(--gold); }
.gb-seat.you > b:first-child { font-size: calc(20px * var(--ts, 1)); line-height: 24px; }
.talk-line.bark { animation: cardIn .25s ease-out; }
.gamble-tray { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; min-height: 0; }
.die.small { width: 26px; height: 26px; padding: 3px; border-radius: 5px; box-shadow: 0 2px 0 #8a7650; }
.die.small i { width: 4px; height: 4px; }
.gamble .btn.skip { justify-self: center; }
.die { transition: transform .2s, box-shadow .2s, border-color .2s; }
.gamble-board.five { grid-template-columns: repeat(5, 1fr); gap: 4px; }
.gamble-board.five .gb-seat .small { font-size: calc(13px * var(--ts, 1)); }
.gamble-holds { display: flex; gap: 6px; justify-content: center; }
.gamble-holds .gh { display: grid; justify-items: center; padding: 4px 8px; border: 1px dashed var(--line); border-radius: 8px; opacity: .45; }
.gamble-holds .gh.on { opacity: 1; border-style: solid; border-color: var(--gold); background: #e8b04a22; }
.gamble-holds .gh b { font-size: calc(20px * var(--ts, 1)); }
.die.cargo { border-color: #6ab0d8; box-shadow: 0 0 0 2px #6ab0d8, 0 3px 0 #8a7650; }
.gamble-board.seats6 { grid-template-columns: repeat(6, 1fr); gap: 3px; }
.gamble-board.seats6 .gb-seat { padding: 5px 1px; }
.gamble-board.seats6 .gb-seat .small { font-size: calc(12px * var(--ts, 1)); }
.gamble-board.seats4 { grid-template-columns: repeat(4, 1fr); } .gamble-board.seats3 { grid-template-columns: repeat(3, 1fr); } .gamble-board.seats2 { grid-template-columns: repeat(2, 1fr); }
