/* Wasteland Table: a dark terminal look with a phosphor-green accent. */
:root {
  --bg: #0f1210; --panel: #171c18; --line: #2a332c; --text: #d9e4d6; --muted: #8b9a88;
  --accent: #7ee08a; --accent-ink: #0b130c; --warn: #f2c14e; --bad: #ff7a6b;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--accent); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brand { font: 600 15px var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; }
.who { color: var(--muted); font-size: 14px; }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 60px; }
h1, h2, h3 { font-family: var(--mono); font-weight: 600; letter-spacing: .03em; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.muted { color: var(--muted); }
.tag { font: 600 11px var(--mono); padding: 1px 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 3px; }
form.stack, .stack { display: grid; gap: 10px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
main > .grid + .card { margin-top: 16px; }
input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: 600 14px var(--sans); color: var(--accent-ink); background: var(--accent); border: 0; border-radius: var(--r); padding: 8px 14px; cursor: pointer; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button.link { background: none; color: var(--accent); padding: 0 0 0 8px; font-weight: 400; }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.pool { display: flex; align-items: center; gap: 10px; }
.pool .n { font: 600 28px var(--mono); min-width: 2.5ch; text-align: center; color: var(--accent); }
.pool .max { color: var(--muted); font-family: var(--mono); }
.err { color: var(--bad); min-height: 1.2em; font-size: 14px; }
.ok { color: var(--accent); }
.status { font: 12px var(--mono); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.status.live { color: var(--accent); border-color: var(--accent); }
.status.poll { color: var(--warn); border-color: var(--warn); }
.copy { display: flex; gap: 6px; }
.copy input { flex: 1; font-family: var(--mono); font-size: 13px; }
.log { font: 12px/1.6 var(--mono); color: var(--muted); max-height: 220px; overflow: auto; margin: 0; padding: 0; list-style: none; }
/* tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; padding-bottom: 10px; }
.tab { padding: 5px 11px; color: var(--accent); background: var(--panel); text-decoration: none; border: 1px solid var(--line); border-radius: var(--r);
  font: 600 12px var(--mono); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.tab:hover { border-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tab.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
/* settings */
.settings-page { max-width: 760px; }
.setting-list { display: grid; }
.setting { display: grid; grid-template-columns: 1fr minmax(180px, 280px); gap: 6px 16px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.setting:first-child { border-top: 0; padding-top: 0; }
.setting.is-bool { grid-template-columns: 1fr auto; }
.setting-text label { color: var(--text); font-size: 15px; display: block; }
.setting-text p { margin: 2px 0 0; }
.setting-control select, .setting-control input.short { width: 100%; }
.small { font-size: 13px; }
button.link.small { padding: 0; margin-top: 4px; }
.choices { display: grid; gap: 6px; }
.choice { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
@media (max-width: 560px) { .setting { grid-template-columns: 1fr; } .setting.is-bool { grid-template-columns: 1fr auto; } }
.narrow { max-width: 420px; margin: 40px auto; }
@media (max-width: 520px) { main { padding: 16px 16px 48px; } .pool .n { font-size: 24px; } }

/* buttons that are links, danger buttons */
a.button { display: inline-block; font: 600 14px var(--sans); color: var(--accent-ink); background: var(--accent); border-radius: var(--r); padding: 8px 14px; text-decoration: none; }
button.danger { background: var(--bad); color: #1a0806; }
button.ghost.small, button.small { padding: 3px 9px; font-size: 13px; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap input { flex: 1; min-width: 0; }
.danger-zone .setting-text label { color: var(--bad); }

/* confirmation dialog */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; max-width: 440px; width: 100%; display: grid; gap: 12px; }
.dialog h2 { color: var(--text); text-transform: none; font-size: 17px; margin: 0; }
.dialog p { margin: 0; }
.dialog label { color: var(--text); }
.dialog-actions { justify-content: flex-end; }

/* character list and sheet */
.callout { border-color: var(--accent); }
.hp { font-family: var(--mono); color: var(--accent); }
.list.compact li { padding: 6px 10px; }
.list .tag, td .tag, summary .tag { margin-left: 6px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-name { color: var(--text); text-transform: none; font-size: 20px; margin: 0; }
.sheet-head p { margin: 2px 0 0; }
.stat { display: grid; gap: 2px; }
.stat-label { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-value { font: 600 18px var(--mono); color: var(--text); }
.stat-value.big { font-size: 24px; color: var(--accent); }
.hpbox { text-align: right; display: grid; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px 16px; }
.special { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.special-cell { display: grid; justify-items: center; padding: 8px 0; border: 1px solid var(--line); border-radius: var(--r); }
.special-letter { font: 600 12px var(--mono); color: var(--muted); }
.special-value { font: 600 22px var(--mono); color: var(--accent); min-width: 2ch; text-align: center; }
table.skills { width: 100%; border-collapse: collapse; font-size: 14px; }
table.skills th { text-align: left; font: 600 11px var(--mono); text-transform: uppercase; color: var(--muted); padding: 4px; border-bottom: 1px solid var(--line); }
table.skills td { padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.skills tr.tagged td:first-child, table.skills.edit tr.tagged td:nth-child(2) { color: var(--accent); }
table.skills td.rank { white-space: nowrap; }
table.skills td.rank span { display: inline-block; min-width: 2ch; text-align: center; font-family: var(--mono); }
details.rule { border-top: 1px solid var(--line); padding-top: 8px; }
details.rule summary { cursor: pointer; }
details.rule p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.note { border-left: 3px solid var(--warn); padding-left: 10px; color: var(--warn); font-size: 14px; }

/* wizard */
.stepper { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.stepper li button { color: var(--muted); font-size: 14px; padding: 0; }
.stepper li.active button { color: var(--accent); font-weight: 600; }
.stepper li.done button { color: var(--text); }
.wizard-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; align-items: start; }
.preview { position: sticky; top: 12px; }
.wizard-nav { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 12px; }
.wizard-nav > :last-child { margin-left: auto; }
.card.inset { background: var(--bg); }
.card.inset h3 { margin: 0 0 6px; font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin: 0; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.option-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); color: var(--text); font-size: 14px; cursor: pointer; }
.option-card.on { border-color: var(--accent); }
.option-card.locked { opacity: .55; cursor: default; }
.option-card input { margin-top: 2px; flex: none; }
.option-card .rules { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.perk-list { display: grid; gap: 6px; max-height: 60vh; overflow: auto; }
.points { font: 600 14px var(--mono); color: var(--accent); margin: 0; }
.points.over { color: var(--bad); }
.special-edit { display: grid; gap: 6px; }
.special-row { display: grid; grid-template-columns: 3ch 9ch auto 3ch auto 1fr; gap: 8px; align-items: center; }
ul.gear { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.warn { color: var(--warn); padding-left: 18px; margin: 8px 0 0; }
textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; width: 100%; }
input[type=search] { flex: 1; min-width: 180px; }
@media (max-width: 760px) {
  .wizard-body { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  .special-row { grid-template-columns: 3ch auto 3ch auto 1fr; }
  .special-row .name { display: none; }
  .special { grid-template-columns: repeat(4, 1fr); }
}
.notice { border-left: 3px solid var(--warn); padding: .4rem .7rem; background: rgba(242,193,78,.08); }

/* inventory */
.stack.tight { gap: 6px; }
.inventory h3 { margin: 6px 0 0; font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.list.items li { align-items: center; }
.list.items li.on { border-color: var(--accent); }
.item-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.item-name { overflow-wrap: anywhere; }
.item .weight { white-space: nowrap; font-family: var(--mono); }
.item-actions { gap: 6px; }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.caps { font-family: var(--mono); color: var(--accent); }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; padding: 2px 9px; border: 1px solid var(--line); border-radius: var(--r); color: var(--accent); line-height: 1.4; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .menu-items { position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 6px; display: grid; gap: 2px; min-width: 200px; width: max-content; max-width: min(300px, calc(100vw - 16px)); box-shadow: 0 6px 20px rgba(0,0,0,.4); overflow-y: auto; }
/* placed by script against the window (core.js), so a card's edge never clips or crowds it */
details.menu .menu-items.placed { position: fixed; right: auto; }
details.menu .menu-items button { text-align: left; padding: 6px 8px; }
.danger-text { color: var(--bad) !important; }
.weightbar { position: relative; height: 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); overflow: hidden; }
.weightbar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.weightbar.warn > span { background: var(--warn); }
.weightbar.bad > span { background: var(--bad); }
.weightbar > i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.warn { color: var(--warn); }
table.dr td:not(:first-child), table.dr th:not(:first-child) { text-align: center; font-family: var(--mono); width: 3.5em; }
input.short { width: 5.5em; }
@media (max-width: 520px) {
  .list.items li { flex-wrap: wrap; }
  .item-main { flex-basis: 100%; }
  .item .weight { margin-right: auto; }
}
.place-name { font: 600 20px var(--mono); color: var(--accent); margin: 0; }
li.hidden-thing { border-style: dashed; }
li.hidden-thing > .item-main, li.hidden-thing > span:first-child { opacity: .75; }   /* not the menu: it must stay solid */
.note { border-left: 2px solid var(--line); padding-left: 8px; }
.effects-list { margin: 0; padding-left: 18px; }
fieldset.roll { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; }
fieldset.roll legend { padding: 0 4px; font-size: 14px; }
.tag.soft { border-color: var(--line); color: var(--text); margin-right: 6px; }
li.addiction { border-color: var(--bad); }
.hpbox { display: grid; justify-items: end; gap: 2px; }
.grid > .card { align-self: start; }
.stack { align-content: start; }
fieldset.roll input[type=number] { width: 4.5em; flex: none; }
fieldset.roll label.row { flex-wrap: wrap; }
a.button.small { padding: 4px 10px; font-size: 13px; }

/* combat tracker */
ol.turns { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
li.turn { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; display: grid; gap: 8px; }
li.turn.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: rgba(126,224,138,.05); }
li.turn.acted:not(.current) { opacity: .7; }
li.turn.out { opacity: .45; }
li.turn.hidden-turn { border-style: dashed; display: flex; gap: 10px; align-items: center; }
.turn-head { display: grid; grid-template-columns: 2.2em 1fr auto auto; gap: 8px; align-items: center; }
.turn-head .order { font: 600 15px var(--mono); color: var(--muted); text-align: center; }
.turn-head .health { font-family: var(--mono); white-space: nowrap; }
.turn-body { display: grid; gap: 8px; padding-left: 2.6em; }
.pip-row { gap: 14px; }
.pips { display: inline-flex; align-items: center; gap: 4px; }
.pip-label { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
button.pip { width: 34px; height: 34px; padding: 0; border-radius: 50%; background: transparent; color: var(--accent); border: 1px solid var(--accent); font-size: 18px; line-height: 1; }
button.pip.costs:not(.used) { border-style: dashed; }
button.pip.used { background: var(--accent); color: var(--accent-ink); }
button.pip:disabled { opacity: .35; }
button.pip.used:disabled { opacity: .6; }
.end-turn { justify-self: start; }
.your-turn { margin: 0; padding: 8px 12px; border-radius: var(--r); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ready input { flex: 1; }
.menu-items .hp-edit { gap: 4px; }
ul.log { list-style: none; margin: 0; padding: 0; font: 13px var(--mono); color: var(--muted); display: grid; gap: 3px; }
ul.log strong { color: var(--text); }
@media (max-width: 520px) {
  .turn-head { grid-template-columns: 2em 1fr auto; }
  .turn-head > .row { grid-column: 2 / -1; }
  .turn-body { padding-left: 0; }
}

/* ---- dice roller (§9) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dialog.wide { max-width: 560px; width: calc(100vw - 32px); max-height: calc(100vh - 32px); overflow-y: auto; }
.stack.tight { gap: 6px; }
.seg { gap: 4px 14px; }
.roll-facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 0; }
.dice-row { gap: 6px; flex-wrap: wrap; }
input.die { width: 3.6em; min-width: 3.6em; flex: none; text-align: center; font: 600 16px var(--mono); padding: 6px 4px; }
input.die.assist { border-style: dashed; }
.dice-view { gap: 6px; flex-wrap: wrap; }
.die-face { display: inline-grid; place-items: center; min-width: 44px; padding: 4px 6px; border: 1px solid var(--line); border-radius: var(--r); font-family: var(--mono); line-height: 1.1; }
.die-face b { font-size: 18px; }
.die-face small { font-size: 11px; min-height: 1.1em; color: var(--muted); }
.die-face.hit { border-color: var(--accent); }
.die-face.hit small, .die-face.crit small { color: var(--accent); }
.die-face.crit { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.die-face.comp { border-color: var(--bad); }
.die-face.comp small { color: var(--bad); }
.die-face.assist { border-style: dashed; }
.die-face.discarded { opacity: .4; text-decoration: line-through; }
.verdict { font: 600 15px var(--mono); margin: 0; }
.verdict.pass { color: var(--accent); }
.verdict.fail { color: var(--warn); }
.rolls-feed li.waiting { border-left: 3px solid var(--warn); padding-left: 8px; }
.rolls-feed .item-main { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tag.bad { border-color: var(--bad); color: var(--bad); }
.scale-preview p { margin: 2px 0; }
.scale-preview:empty { display: none; }

/* ---- scene actions (§7) */
.here .scavenge { border-left: 3px solid var(--accent); padding-left: 10px; }
.here .scavenge p { margin: 0 0 4px; }
.here .item-main { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 7rem; flex: 1 1 7rem; }
.here .list li { flex-wrap: wrap; }
.here .list li > .row.nowrap { flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.here .item-main .tag { margin-left: 0; white-space: nowrap; }
.bodies li { border-left: 3px solid var(--bad); padding-left: 8px; }
.terminal-screen { font-family: var(--mono); color: var(--accent); background: #0a0d0a; border: 1px solid var(--line); padding: 10px; border-radius: var(--r); margin: 0; }
table.ranges { width: 100%; border-collapse: collapse; }
table.ranges td, table.ranges th { padding: 2px 4px; text-align: left; }
.loot-row select { flex: 1; min-width: 0; }
.haul li { align-items: flex-start; }
.here > .err:empty { display: none; }

/* ---- the clock (§22) */
.clock { border-top: 1px solid var(--line); padding-top: 10px; }
.clock-face { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-family: var(--mono); }
.clock ul { margin: 0; }

/* ---- level-ups (D8) */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.skill-grid button { text-align: left; }
.perks-pick { max-height: 50vh; overflow-y: auto; }
.perks-pick li { align-items: flex-start; }
.perks-pick li.blocked summary { color: var(--muted); }
.perks-pick .why { max-width: 16em; text-align: right; }
.dialog h3 { margin: 6px 0 0; font-size: 15px; }

/* shops and bartering */
.trade-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.trade-cols .list { max-height: 16rem; overflow-y: auto; }
table.totals { width: 100%; border-collapse: collapse; }
table.totals td { padding: .15rem 0; }
table.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
table.totals tr.total td { border-top: 1px solid var(--line, currentColor); font-weight: 600; }
.traders .list li { align-items: center; }

/* journal */
.journal-row { cursor: pointer; }
.journal-row:hover, .journal-row:focus-visible { background: var(--panel); }
.journal-body { line-height: 1.55; overflow-wrap: anywhere; }
.journal-body blockquote { border-left: 3px solid var(--line); margin: 0.5rem 0; padding-left: 0.75rem; color: var(--muted); }
.journal-body a { color: inherit; text-decoration: underline; }
.rt-toolbar { gap: 4px; flex-wrap: wrap; }
.rt-area { min-height: 10rem; max-height: 50vh; overflow-y: auto; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); line-height: 1.5; }
.rt-area:focus { outline: 2px solid currentColor; outline-offset: 1px; }
.objectives .struck { text-decoration: line-through; opacity: 0.75; }
label.grow { flex: 1 1 14rem; }

[hidden] { display: none !important; }

/* notifications */
.bell { position: relative; }
.bell .count { position: absolute; top: -4px; right: -6px; min-width: 1.2em; padding: 0 4px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 0.7rem; line-height: 1.2em; text-align: center; }
.toasts { position: fixed; right: 16px; top: 56px; pointer-events: none; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); }
.toast.warning { border-color: #c9a227; }
.notes li.unread { font-weight: 600; }
.notes li.read { opacity: 0.8; }

/* who is online */
.presence { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: transparent; border: 1.5px solid var(--muted); flex: none; }
.presence.on { background: #3fbf5f; border-color: #3fbf5f; }

/* damage resistance, laid out like the body */
.dr-figure { display: grid; grid-template-columns: 1fr 1.2fr 1fr; grid-template-areas: ". top ." "ml mid mr" "ll lo lr"; gap: 8px; align-items: start; }
.dr-slot { display: grid; gap: 8px; }
.dr-top { grid-area: top; } .dr-mid-l { grid-area: ml; } .dr-mid { grid-area: mid; } .dr-mid-r { grid-area: mr; }
.dr-low-l { grid-area: ll; } .dr-low { grid-area: lo; } .dr-low-r { grid-area: lr; }
.dr-cell { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); text-align: center; justify-items: center; }
.dr-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; font: 12px var(--mono); }
@media (max-width: 420px) { .dr-figure { grid-template-columns: 1fr 1fr 1fr; gap: 4px; } .dr-cell { padding: 5px 3px; } .dr-nums { grid-template-columns: 1fr; } .dr-cell strong { font-size: 12px; } }

/* the GM's workspace (§8.4): a place being set up out of the players' sight */
.card.workspace { border-style: dashed; }
.card.workspace .card-head { align-items: center; gap: .5rem; }
.card.workspace .card-head h2 { margin: 0; }
.card.workspace .here.workspace { padding: 0; border: 0; box-shadow: none; background: transparent; }
/* people at a place and their lines (§8.6) */
.here .people .item-main { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
ol.dialogue { padding-left: 1.2rem; }
ol.dialogue .line { white-space: pre-wrap; margin: 0; }
ol.lines-edit { padding-left: 1.2rem; }
ol.lines-edit li { border-bottom: 1px solid var(--line, #ddd); padding-bottom: .5rem; }
ol.lines-edit textarea { width: 100%; }
/* talking with an NPC (§8.6): their lines, your questions */
.chat { max-height: 50vh; overflow-y: auto; }
.chat p, .dialog .npc-says { margin: 0; white-space: pre-wrap; }
.npc-says { border-left: 3px solid var(--accent, #6fd36f); padding: .35rem .6rem; background: rgba(255,255,255,.03); }
.you-say { align-self: flex-end; text-align: right; color: var(--muted); font-style: italic; }
.asks .ask { text-align: left; justify-content: flex-start; }
.asks .ask.asked { opacity: .6; }
dl.asks-list dt { font-weight: 600; margin-top: .4rem; }
dl.asks-list dd { margin: 0 0 0 1rem; white-space: pre-wrap; }
/* desktop: Here and the Workspace take the whole row, their sections flowing in columns */
@media (min-width: 900px) {
  .grid { grid-auto-flow: row dense; }   /* small cards fill the gaps the wide ones leave */
  .grid > .here, .grid > .workspace { grid-column: 1 / -1; }
}
/* Here and the Workspace: the place, people, things (columns on a wide screen) */
.here-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 12px 28px; align-items: start; }
.here-col { min-width: 0; }
.here-label { margin: 0; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.here .list li { gap: 6px 10px; }
.here .list li > .row.nowrap { gap: 6px; }
/* combat: which actions are major and which minor */
.action-kind { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; min-width: 3.6rem; text-align: center; }
.action-kind.major { border-color: var(--warn); color: var(--warn); }
.action-kind.minor { border-color: var(--accent); color: var(--accent); }
.action-group { align-items: center; }
ul.pick-side li { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
ul.pick-side select.side { width: auto; }
/* cards that fold to their heading */
.card.foldable > :first-child h2, .card.foldable > h2:first-child { cursor: pointer; user-select: none; }
.card.foldable > :first-child h2::after, .card.foldable > h2:first-child::after { content: ' ▾'; color: var(--muted); }
.card.foldable.folded > :first-child h2::after, .card.foldable.folded > h2:first-child::after { content: ' ▸'; }
.card.foldable.folded > :not(:first-child) { display: none; }
/* the GM's log */
.log-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.log-list li { display: grid; grid-template-columns: 9.5rem 8rem 1fr; gap: 8px; padding: 4px 6px; border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); align-items: baseline; }
.log-list li.log-delete .log-text { color: var(--bad, #e57373); }
.log-list li .log-raw { grid-column: 1 / -1; }
.log-list pre { white-space: pre-wrap; font-size: .75rem; margin: 4px 0; }
@media (max-width: 640px) { .log-list li { grid-template-columns: 1fr; gap: 0; } }
@media (min-width: 900px) { .grid > .players-home { grid-column: span 2; } }
.players-list > li { border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); padding: 6px 0; }
/* the encyclopedia */
.ency-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.ency-link:hover { color: var(--accent); }
.ency-page { display: grid; gap: 16px; grid-template-columns: minmax(16rem, 22rem) 1fr; align-items: start; }
@media (max-width: 800px) { .ency-page { grid-template-columns: 1fr; } }
.ency-results ul { max-height: 70vh; overflow-y: auto; }
.ency-results li.current { background: rgba(255,255,255,.06); }
.ency-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; }
.ency-facts dt { color: var(--muted); }
.ency-facts dd { margin: 0; }
.ency-text h4, .ency-related h4 { margin: 8px 0 2px; }
.ency-text p, .ency-desc { white-space: pre-wrap; margin: 0; }
.chip { padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: transparent; border: 1px solid var(--line, rgba(255,255,255,.2)); color: inherit; }
.chip:hover { border-color: var(--accent); }
.ency-gm { padding: 6px 8px; border: 1px dashed var(--line, rgba(255,255,255,.2)); border-radius: 6px; }
.chip.on { border-color: var(--accent); color: var(--accent); }
.ency-i { font-size: .8rem; text-decoration: none; color: var(--muted); }
.ency-i:hover { color: var(--accent); }
.lookups { white-space: normal; }
.sub-seg { gap: 4px 8px; padding-left: 10px; border-left: 2px solid var(--line, #ccc); }
.chip.small { font-size: .85em; padding: 1px 8px; }
.load-more { gap: 10px; align-items: center; }
/* power armor (§11.4) and temporary attribute changes */
.special-cell.boosted { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.special-cell.lowered { border-color: var(--bad); }
.special-base { font-size: 11px; color: var(--muted); }
td.boosted { color: var(--accent); font-weight: 700; }
.boost-note { margin: 0; padding: 4px 8px; border-left: 3px solid var(--accent); background: rgba(255,255,255,.03); }
.pa-hp { display: inline-flex; align-items: center; gap: 6px; min-width: 7rem; }
.pa-hp-bar { position: relative; flex: 1; height: 8px; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--bg); min-width: 4rem; }
.pa-hp-bar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.pa-hp-bar.warn > span { background: var(--warn, #d8b24a); }
.pa-hp-bar.bad > span { background: var(--bad); }
.pa-pieces li.damaged { border-style: dashed; }
.dr-cell.pa { border-color: var(--accent); }
.dr-cell.pa-damaged { border-color: var(--bad); border-style: dashed; }
.dr-pa { display: grid; font-size: 12px; color: var(--accent); }
.pa-core.bad { color: var(--bad); }
.reminders { margin: 0; padding-left: 1.1rem; color: var(--accent); }

/* vehicles (§5.1) */
.grid.vehicles { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.vehicle .vehicle-stats { gap: 6px 14px; }
.vehicle h3 { margin: 6px 0 0; font-size: 1rem; }
.tag.pending { border-color: var(--warn); color: var(--warn); }
.fuel-gauge { display: inline-flex; gap: 3px; }
.fuel-step { width: 18px; height: 10px; border: 1px solid var(--muted, currentColor); border-radius: 2px; }
.fuel-step.on { background: var(--accent); border-color: var(--accent); }
.fuel-gauge.low .fuel-step.on { background: var(--bad); border-color: var(--bad); }
table.vehicle-locs { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.vehicle-locs th, table.vehicle-locs td { padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--line, rgba(127,127,127,.3)); }
table.vehicle-locs tr.crit td { color: var(--bad); }
.vehicle li.damaged, .fight-vehicles li.damaged { opacity: .65; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pilot-actions { gap: 4px; flex-wrap: wrap; }
.fight-vehicles h3 { margin: 8px 0 0; }
@media (max-width: 420px) { .grid.vehicles { grid-template-columns: 1fr; } }
.tag.pending { border-color: var(--warn); color: var(--warn); }
.fight-vehicles li { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.fight-vehicles .row, .vehicle .row { flex-wrap: wrap; }
/* grid children size to their content by default; keep the turn list inside a phone screen */
ol.turns, li.turn, .turn-body, .turn-body > .actions, .fight-vehicles { grid-template-columns: minmax(0, 1fr); }

/* the Map tab (§8.7) */
.travel-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .travel-layout { grid-template-columns: minmax(0, 1fr); } }
.map-wrap { position: relative; width: 100%; border-radius: var(--r); overflow: hidden; background: var(--panel); line-height: 0; user-select: none; }
.map-img { display: block; width: 100%; height: auto; }
.map-wrap.editing .map-img { cursor: crosshair; }
.map-blank { line-height: 1.4; padding: 48px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); }
.map-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-route line { stroke: var(--accent); stroke-width: 0.6; stroke-dasharray: 1.5 1; vector-effect: non-scaling-stroke; stroke-width: 3px; }
.map-route polyline { fill: none; stroke: var(--accent); stroke-dasharray: 1.5 1; vector-effect: non-scaling-stroke; stroke-width: 3px; stroke-linejoin: round; }
.map-route.journey polyline { stroke: var(--warn); }
.map-waypoint { position: absolute; transform: translate(-50%, -50%); width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); color: var(--text); font-size: 11px; line-height: 14px; text-align: center; pointer-events: none; }
.map-party { position: absolute; transform: translate(-50%, -50%); width: 16px; height: 16px; border-radius: 3px; background: var(--warn); border: 2px solid var(--bg); box-shadow: 0 0 0 3px rgba(240,190,80,.35); pointer-events: none; }
.route-legs li { gap: .5rem; flex-wrap: wrap; }
.route-legs select { max-width: 13rem; }
.travel-legs { width: 100%; border-collapse: collapse; }
.travel-legs th, .travel-legs td { text-align: left; padding: .15rem .4rem; border-bottom: 1px solid var(--line); }
.journey-days table td { padding: .15rem .3rem; }
.journey-days tr.today td:first-child { font-weight: 600; }
.camp-nights button.warn { border-color: var(--warn); color: var(--warn); }

/* the dot sits on the point; the label hangs to its right */
.map-pin { position: absolute; transform: translate(-50%, -50%); width: 14px; height: 14px; background: none; border: 0; padding: 0; min-height: 0; line-height: 1.2; cursor: pointer; display: block; }
.map-pin .map-pin-label { position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%); }
.map-pin.secret .map-pin-dot { border-style: dashed; opacity: .7; }
.map-pin.secret .map-pin-label { font-style: italic; opacity: .8; }
.map-pin-dot { display: block; box-sizing: border-box; width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 2px solid var(--bg); box-shadow: 0 0 0 1px var(--line); flex: none; }
.map-pin.here .map-pin-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(126,224,138,.35); }
.map-pin.dest .map-pin-dot { background: var(--warn); }
.map-pin.unvisited .map-pin-dot { background: transparent; border-color: var(--text); }
.map-pin.encounter .map-pin-dot { border-radius: 2px; }
/* exploring (§31): a waypoint is a diamond; a camp a small square with a warm glow */
.map-pin.waypoint .map-pin-dot { border-radius: 2px; transform: rotate(45deg) scale(.85); background: transparent; border: 2px dashed var(--warn); box-shadow: none; }
.map-pin.waypoint.here .map-pin-dot { background: var(--accent); border: 2px solid var(--bg); box-shadow: 0 0 0 3px rgba(126,224,138,.35); }
.map-pin.waypoint.dest .map-pin-dot { background: var(--warn); border-style: solid; }
.map-pin.camp .map-pin-dot { border-radius: 3px; background: #e8873a; box-shadow: 0 0 0 3px rgba(232,135,58,.3); }
.map-pin.camp.here .map-pin-dot { box-shadow: 0 0 0 3px rgba(126,224,138,.45); }
.waypoints .waypoint-chip { gap: 2px; }
.callout.wilds { border-left: 3px solid var(--warn); }
.card.proposal { border-color: var(--warn); }
.card.proposal h3 .tag { margin-left: 8px; }
.map-sight { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1 / 1; border-radius: 50%; border: 1px dashed rgba(126,224,138,.55); background: rgba(126,224,138,.06); pointer-events: none; }
.sight-line .sky { display: inline-flex; margin-left: 8px; gap: 4px; }
.map-pin-label { font: 600 12px var(--sans); color: var(--text); background: rgba(15,18,16,.78); padding: 1px 5px; border-radius: 4px; white-space: nowrap; }
.map-pin:hover .map-pin-label, .map-pin:focus-visible .map-pin-label { background: var(--accent); color: var(--accent-ink); }
.journey-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.journey-bar > span { display: block; height: 100%; background: var(--accent); }
.journey.stopped { border-color: var(--warn); }
.travel-survival { border-collapse: collapse; width: 100%; font-size: .85rem; }
.travel-survival th, .travel-survival td { padding: 3px 6px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.travel-survival td.short { color: var(--bad); }
.warn-text { color: var(--warn); }
.plan-result .ency-facts { margin: 0; }
.tag.cover { border-color: var(--accent); color: var(--accent); }
/* the GM's Survival panel (§23.7) */
.survival-panel .travel-survival th[scope=row] { white-space: nowrap; }
.survival-panel tr.sub td { padding-bottom: 8px; }
.survival-panel tr:not(.sub) td, .survival-panel tr:not(.sub) th { border-bottom: none; }
.survival-panel .row.nowrap .tag { min-width: 5.5em; text-align: center; }
@media (max-width: 640px) { .survival-panel .travel-survival { font-size: .8rem; } .survival-panel .row.nowrap .tag { min-width: 0; } }
@media (min-width: 900px) { .grid > .survival-panel { grid-column: 1 / -1; } }
.survival-panel .table-scroll { overflow-x: auto; }
/* legendary items and creatures (§6.7, §3.8) */
.tag.legendary { background: color-mix(in srgb, #d4a017 22%, transparent); color: #e8c25a; border-color: #b8891a; }

/* the Workshop (§20.7): a weapon's picture with a dropdown for each slot, joined by a line to where it goes */
.ws-stage { position: relative; display: grid; gap: 10px; }
.ws-lane { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; position: relative; z-index: 1; }
.ws-lane.below { align-items: flex-start; }
.ws-lane.above { align-items: flex-end; }
.ws-slot { display: grid; gap: 3px; flex: 1 1 170px; max-width: 260px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.ws-slot.changed { border-color: var(--warn); }
.ws-slot select { width: 100%; padding: 6px 8px; }
.ws-slot-name { font: 600 12px var(--mono); text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ws-slot.changed .tag { border-color: var(--warn); color: var(--warn); }
.ws-picbox { position: relative; justify-self: center; width: min(100%, 560px); }
/* the picture's backdrop is taken out in the page; a faint light edge keeps dark metal readable on the dark panel */
.ws-pic { display: block; width: 100%; }
.ws-pic canvas, .ws-pic img { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 1px rgba(217, 228, 214, .55)) drop-shadow(0 0 10px rgba(217, 228, 214, .16)); }
.ency-pic { max-width: 420px; margin: 0; display: grid; gap: 4px; }
.ws-dots { position: absolute; inset: 0; pointer-events: none; }
.ws-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent); border: 2px solid var(--accent-ink); }
.ws-leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ws-leaders line { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; filter: drop-shadow(0 0 1.5px #000) drop-shadow(0 0 1px #000); }
.ws-leaders line.changed { stroke: var(--warn); }
.ws-dot { box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); }
.ws-readonly .tag { border-color: var(--warn); color: var(--warn); margin-right: 4px; }
.ws-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.ws-grid .ws-slot { max-width: none; }
.ws-stats { font-size: 14px; }
.ws-credit { margin: 0; text-align: center; }
@media (max-width: 640px) { .ws-slot { flex-basis: 100%; max-width: none; } }

/* traps and mines on the Here card (§20.8) */
.traps-box { min-width: 0; }
.traps-box .list li { display: grid; gap: 4px; justify-content: stretch; }

/* handouts: pictures and audio clips (§15.2) */
.handout-pics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.handout-pics figure { margin: 0; display: grid; gap: 4px; }
.handout-pics img { width: 100%; height: auto; max-height: 320px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.handout-media .clips li { display: grid; gap: 4px; }
/* the now-playing bar: what this user is hearing */
.now-playing { position: fixed; left: 12px; bottom: 12px; z-index: 55; max-width: min(460px, calc(100vw - 24px)); display: grid; gap: 6px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--r); box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
.now-playing .np-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.now-playing .np-title { flex: 1 1 160px; font-size: 14px; }
.now-playing .np-title::before { content: '♪ '; color: var(--accent); }
.now-playing .np-volume input[type=range] { width: 110px; }
.now-playing .tap-to-listen { justify-self: start; }
.file-thumb { width: 40px; height: 30px; object-fit: cover; border-radius: 3px; vertical-align: middle; margin-right: 6px; }

/* ---------------------------------------------------------------- the Casino tab (§25) */
.casino-layout { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .casino-layout { grid-template-columns: minmax(0, 1fr); } }
.casino-head h2 { margin: 0; }
.casino-balance { font-size: 1.15rem; }
.casino-feed ul { max-height: 28rem; overflow-y: auto; }
.casino-feed li.win { color: var(--accent); }
.casino-feed li.note { color: var(--warn); }
.slot-machine { border: 3px solid var(--warn); border-radius: 14px; padding: .75rem; background: linear-gradient(#2a1d0e, #160f07); box-shadow: 0 0 18px rgba(240,190,80,.15) inset; max-width: 26rem; }
.slot-machine.won { animation: slot-win 1.2s ease-in-out 2; }
@keyframes slot-win { 50% { box-shadow: 0 0 28px rgba(240,190,80,.75); } }
.slot-top { text-align: center; font-family: var(--mono, monospace); letter-spacing: .2em; color: var(--warn); font-size: .8rem; margin-bottom: .5rem; }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.reel { height: 80px; overflow: hidden; border-radius: 8px; background: #f3ead2; box-shadow: inset 0 8px 10px rgba(0,0,0,.45), inset 0 -8px 10px rgba(0,0,0,.45); position: relative; }
.reel-strip { will-change: transform; }
.reel-cell { height: 80px; display: flex; align-items: center; justify-content: center; font-size: 2.6rem; line-height: 1; color: #1b1b1b; }
.reel-cell.sym-seven { font-family: Georgia, serif; font-weight: 700; color: #c0281e; font-size: 3rem; }
.slot-result { text-align: center; min-height: 1.4em; margin: .5rem 0 0; font-weight: 600; }
.slot-lever { min-width: 6rem; }
.luck-row { gap: .4rem; }
.paytable td { padding: .1rem .5rem; }
.roulette { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 1rem; align-items: center; }
@media (max-width: 640px) { .roulette { grid-template-columns: minmax(0, 1fr); } .wheel-wrap { max-width: 240px; margin: 0 auto; } }
.wheel-wrap { position: relative; }
.wheel { width: 100%; height: auto; display: block; }
.wheel-rot { transform-origin: 0 0; }
.pocket.red { fill: #b3261e; } .pocket.black { fill: #1d1d1d; } .pocket.green { fill: #1f7a3a; }
.pocket { stroke: #c9a85c; stroke-width: .6; }
.pocket-num { fill: #f3ead2; font-size: 7px; text-anchor: middle; dominant-baseline: middle; font-family: system-ui, sans-serif; }
.wheel-hub { fill: #5b3b1c; stroke: #c9a85c; stroke-width: 2; }
.wheel-pointer { fill: var(--warn); }
.wheel-last { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 3rem; height: 3rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; border: 2px solid #c9a85c; pointer-events: none; }
.wheel-last.red { background: #b3261e; } .wheel-last.black { background: #1d1d1d; } .wheel-last.green { background: #1f7a3a; }
.rgrid { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); grid-template-rows: auto auto; gap: 3px; }
.rzeros { display: grid; grid-template-rows: 1fr 1fr; gap: 3px; }
.rnums { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(3, 1fr); gap: 3px; }
.routside { grid-column: 2; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; }
.rbet { position: relative; padding: .35rem .1rem; font-size: .75rem; border-radius: 4px; background: #1f5a33; color: #f3ead2; border: 1px solid #c9a85c55; min-width: 0; }
.rbet.red { background: #8f2019; } .rbet.black { background: #1d1d1d; } .rbet.green { background: #1f7a3a; }
.rbet:hover { outline: 2px solid var(--warn); }
.rchip { position: absolute; right: -4px; top: -6px; background: var(--warn); color: #111; border-radius: 999px; font-size: .65rem; padding: 0 .3rem; font-weight: 700; }
.chipbtn { min-width: 2.6rem; border-radius: 999px; }
.bj-table { background: radial-gradient(ellipse at center, #1f5a33, #123a21); border-radius: 14px; }
.bj-table .muted { color: #cfe3d3; }
.bj-row { display: flex; align-items: center; gap: 1rem; min-height: 6.5rem; flex-wrap: wrap; }
.bj-label { min-width: 8rem; font-weight: 600; color: #f3ead2; }
.bj-cards { display: flex; gap: .4rem; flex-wrap: wrap; }
.pcard { width: 3.6rem; height: 5rem; border-radius: 6px; background: #fbf8f0; color: #1b1b1b; display: flex; flex-direction: column; justify-content: space-between; padding: .25rem .35rem; box-shadow: 0 2px 6px rgba(0,0,0,.4); font-weight: 700; }
.pcard.red { color: #b3261e; }
.pcard .pc-s { align-self: flex-end; font-size: 1.4rem; }
.pcard.back { background: repeating-linear-gradient(45deg, #7a1f1a 0 6px, #5b1612 6px 12px); border: 3px solid #fbf8f0; }
.pcard.deal { animation: deal-in .45s cubic-bezier(.2,.8,.3,1) both; }
@keyframes deal-in { from { transform: translate(-120px, -60px) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.pot { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; }
.pot-total { font-weight: 700; color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .pcard.deal, .slot-machine.won { animation: none; } }

/* a currency exchange: one row per currency, name on top, controls below (no squeezing) */
.exchange ul.list > li.exchange-row { display: flex; flex-direction: column; align-items: stretch; gap: .4rem; }
.exchange-name { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.exchange-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.exchange-out { min-width: 0; overflow-wrap: anywhere; }
.weapon-check li { flex-wrap: wrap; }

.reel-img { width: 78%; height: 78%; object-fit: contain; pointer-events: none; user-select: none; }
.pay-syms { white-space: nowrap; }
.pay-syms .reel-img { width: 1.4em; height: 1.4em; vertical-align: middle; margin-right: 2px; }

/* ---------------------------------------------------------------- factions (§26): hostile NPCs are red */
li.hostile-npc, .turn.hostile-npc { background: rgba(190, 40, 30, .22) !important; box-shadow: inset 3px 0 0 #c0281e; }
.faction-card .rank-0 { color: #ff6b5e; } .faction-card .rank-1 { color: #f0be50; } .faction-card .rank-2 { color: var(--muted); }
.faction-card .rank-3 { color: #9be29b; } .faction-card .rank-4 { color: #5fd38a; } .faction-card .rank-5 { color: #3fe0c0; }
.faction-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1rem; align-items: start; }
.faction-ranks td { padding: .15rem .4rem; }
.rank-pill { font-weight: 700; }
/* notification settings (§17) */
.table-scroll { overflow-x: auto; }
.notify-prefs { width: 100%; border-collapse: collapse; }
.notify-prefs th, .notify-prefs td { padding: .3rem .4rem; border-bottom: 1px solid var(--line, #3334); text-align: left; }
.notify-prefs th:not(:first-child), .notify-prefs td.center { text-align: center; width: 4.5rem; }
/* the Settlement tab (§27) */
.settlement .warn { padding-left: 0; margin: 0; }
.sg-scores { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.sg-score { display: grid; gap: 0; padding: 6px 4px; background: var(--panel); color: var(--text); border: 1px solid var(--line); text-align: center; font-weight: 400; }
.sg-score .n { font: 600 18px var(--mono); color: var(--accent); }
.sg-score .l { font-size: 11px; color: var(--muted); line-height: 1.2; }
.sg-score.bad { border-color: var(--bad); }
.sg-score.bad .n { color: var(--bad); }
.sg-score.on { outline: 2px solid var(--accent); }
.sg-lines { margin: 0; padding-left: 18px; color: var(--muted); }
.sg-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; align-items: start; }
.sg-mapwrap { overflow-x: auto; max-width: 100%; }
.sg-map { position: relative; border: 1px solid var(--line); touch-action: none; user-select: none; }
.sg-ter { display: grid; position: absolute; inset: 0; }
.sg-ter i, .sg-legend i, i.sw { display: block; width: var(--c, 12px); height: var(--c, 12px); }
.sg-legend i, i.sw { width: 12px; height: 12px; display: inline-block; border: 1px solid var(--line); margin-right: 4px; vertical-align: -2px; }
.t-d { background: #3a2f22; box-shadow: inset 0 0 0 .5px #4a3d2d; }
.t-c { background: #3b3e3c; box-shadow: inset 0 0 0 .5px #4a4d4b; }
.t-w { background: #1f3b4d; box-shadow: inset 0 0 0 .5px #2a4a60; }
.t-o { background: #2c4426 repeating-linear-gradient(45deg, transparent 0 3px, #3c5a33 3px 5px); }
.t-x { background: #141614 repeating-linear-gradient(-45deg, transparent 0 4px, #2a2a2a 4px 6px); }
.sg-wires { position: absolute; inset: 0; pointer-events: none; }
.sg-wires line { stroke: #f2c14e; stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .7; }
.sg-block { position: absolute; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 0; padding: 2px 3px; overflow: hidden;
  font: 600 10px/1.15 var(--sans); color: #e9f1e6; border: 1px solid rgba(255,255,255,.25); border-radius: 3px; background: #4b5a4c; text-align: left; cursor: pointer; }
.sg-block .nm { text-shadow: 0 1px 1px #000; word-break: break-word; }
.sg-block.c-power { background: #6a5a1f; } .sg-block.c-defense { background: #6b2f2a; } .sg-block.c-resource { background: #2f5a3a; }
.sg-block.c-store { background: #2f4a6b; } .sg-block.c-crafting { background: #5a3f6b; } .sg-block.c-task { background: #555; }
.sg-block.field { background: #3d6b2a repeating-linear-gradient(90deg, transparent 0 4px, rgba(0,0,0,.18) 4px 5px); }
.sg-block.s-planned { background-color: transparent !important; background-image: none; border: 1.5px dashed var(--accent); color: var(--accent); }
.sg-block.s-damaged { border: 1.5px solid var(--bad); background-image: repeating-linear-gradient(45deg, transparent 0 5px, rgba(255,122,107,.35) 5px 8px); }
.sg-block.s-off { filter: grayscale(1) brightness(.7); }
.sg-block.sel { outline: 2px solid #fff; z-index: 2; }
.sg-block.trouble { box-shadow: 0 0 0 1px var(--warn) inset; }
.sg-block.moving { opacity: .4; }
.sg-block.drop-on, .sg-lane.drop-on, [data-drop].drop-on { outline: 2px dashed var(--warn); outline-offset: 1px; }
.sg-block .bar { display: block; width: 100%; height: 3px; background: rgba(0,0,0,.4); } .sg-block .bar > span { display: block; height: 100%; background: var(--accent); }
.sg-block .who { position: absolute; right: 2px; bottom: 2px; font: 600 9px var(--mono); background: rgba(0,0,0,.55); padding: 0 2px; border-radius: 2px; }
.sg-block .warn-dot { position: absolute; right: 2px; top: 1px; color: var(--warn); font-weight: 700; }
.sg-ghost { position: absolute; pointer-events: none; border: 2px solid; border-radius: 3px; display: grid; place-items: center; font: 600 11px var(--mono); }
.sg-ghost.yes { border-color: var(--accent); background: rgba(126,224,138,.25); color: var(--accent); }
.sg-ghost.no { border-color: var(--bad); background: rgba(255,122,107,.25); color: var(--bad); }
.sg-legend { margin-top: 6px; color: var(--muted); }
.sg-side { position: sticky; top: 8px; overflow: auto; }
.sg-pal li { align-items: flex-start; }
.sg-pal li.dim > .stack > span:first-child { opacity: .65; }
.sg-slot { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 6px; display: grid; gap: 4px; }
.sg-slot.free { border-style: dashed; }
.sg-slot select { width: 100%; }
.sg-lanes { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.sg-lane { min-height: 72px; }
.sg-lane h3 { margin: 0; font-size: 13px; }
.sg-settler { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding: 5px 6px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.sg-settler .grow { flex: 1; min-width: 0; }
.sg-settler select { order: 9; flex: 1 1 100%; padding: 3px 4px; font-size: 13px; }
.sg-settler.out { opacity: .7; }
.sg-settler.shift { border-style: dashed; }
.sg-settler .grip { cursor: grab; touch-action: none; font-size: 18px; color: var(--muted); padding: 0 2px; }
.sg-floating { position: fixed; z-index: 1000; pointer-events: none; opacity: .9; box-shadow: 0 4px 16px rgba(0,0,0,.6); }
.settlement-alarm { border-color: var(--bad); }
.settlement-alarm.coming { border-color: var(--warn); }
.sg-log li.new { border-color: var(--accent); }
.sg-log li.k-attack { border-left: 3px solid var(--bad); }
.sg-slider input[type=range] { width: 100%; accent-color: var(--accent); }
.sg-slider .on { color: var(--accent); font-weight: 600; }
.meter { height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter.bad > span { background: var(--bad); }
@media (max-width: 760px) {
  .sg-scores { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sg-body { grid-template-columns: minmax(0, 1fr); }
  .sg-side { position: static; max-height: none; }
  .sg-slider .row span { font-size: 11px; }
}

.sg-reach { position: absolute; pointer-events: none; border: 1px dashed rgba(242,193,78,.8); background: rgba(242,193,78,.08); border-radius: 3px; }
.sg-duty { color: var(--text); opacity: .85; }
/* scrollbars in the app's colors (Firefox, then Chrome, Edge and Safari) */
* { scrollbar-color: var(--line) var(--bg); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3f4c41; }
::-webkit-scrollbar-thumb:active { background: var(--accent); }
::-webkit-scrollbar-corner { background: var(--bg); }
.sg-block .nm.tagged { font: 700 12px var(--mono); }
.sg-block.c-defense:has(.tagged) { border-radius: 50%; align-items: center; justify-content: center; }

/* battlemaps (§28): the library and the baking tool */
.bm-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.bm-card { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; background: var(--bg); }
.bm-card img, .bm-nopic { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; background: #222; }
.bm-nopic { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.bm-editor { position: fixed; inset: 0; z-index: 900; background: var(--bg); display: grid; grid-template-rows: auto 1fr; }
.bm-bar { padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.bm-bar .grow { flex: 1; }
.bm-name { width: 16em; font-weight: 600; }
.bm-main { display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 0; }
.bm-stage { overflow: auto; display: grid; place-items: center; padding: 4px; min-height: 0; }
.bm-canvas { cursor: crosshair; touch-action: none; box-shadow: 0 0 0 1px var(--line); }
.bm-side { overflow: auto; padding: 10px; border-left: 1px solid var(--line); }
.bm-borders li.sel, .bm-side li.sel { border-color: var(--accent); }
.bm-side select { max-width: 100%; }
@media (max-width: 760px) { .bm-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 40vh; } .bm-side { border-left: 0; border-top: 1px solid var(--line); } .bm-name { width: 10em; } }
.bm-side .list li { flex-wrap: wrap; }
.bm-side .list li > .link { text-align: left; padding-left: 0; }
/* a fight on a battlemap (§28.1) */
.fight-map .fm-wrap { width: 100%; overflow: hidden; display: flex; justify-content: center; }
.fm-canvas { display: block; touch-action: none; border-radius: var(--r); border: 1px solid var(--line); background: #111; }
.fm-doors ul { margin-top: 6px; }
.target-unseen { color: var(--muted); }
.fm-cal-bar { height: 22px; background: var(--accent); border-radius: 3px; max-width: 100%; }
body.popout header.top { display: none; }
body.popout main { max-width: none; padding: 8px 12px; }
.fm-popout { border: 0; padding: 0; background: transparent; }
.fm-zone-bar:empty { display: none; }
.fight-map .fm-wrap { position: relative; }
.fm-menu { position: absolute; z-index: 5; width: 220px; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--panel); border: 1px solid var(--accent); border-radius: var(--r); box-shadow: 0 6px 20px rgba(0,0,0,.55); }
.fm-menu[hidden] { display: none; }
.fm-menu p { margin: 0 0 2px; }
.fm-menu button { text-align: left; }
.token-preview { width: 96px; height: 96px; border-radius: var(--r); background: #1a1d1a; border: 1px solid var(--line); flex: none; }
body.standby-on { background: #000; }
body.standby-on main { padding: 0; }
.standby { position: fixed; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.standby img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------- the Pip-Boy (§33) */
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/IBMPlexMono-Regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/IBMPlexMono-Bold.woff') format('woff'); font-weight: 700; font-display: swap; }
.pb-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pb-stage.full { position: fixed; inset: 0; z-index: 50; background: #000; padding: 6px; overflow: hidden; }
.pb-stage.pb-fill { position: fixed; inset: 0; z-index: 50; background: #000; padding: 0; gap: 0; overflow: hidden; }
.pb-stage.pb-fill .pb-view { max-width: none; }
.pb-stage.pb-fill .pb-tools { position: absolute; top: 4px; right: 6px; left: auto; z-index: 10; opacity: .3; transition: opacity .2s; }
.pb-stage.pb-fill .pb-tools:hover, .pb-stage.pb-fill .pb-tools:focus-within { opacity: 1; }
.pb-stage.pb-fill .pb-tools select, .pb-stage.pb-fill .pb-tools .pb-who { display: none; }
.pb-tools { display: flex; gap: 8px; align-self: stretch; justify-content: flex-end; align-items: center; }
.pb-tools .pb-who { margin-right: auto; color: var(--muted); font-size: 13px; }
.pb-tools select { margin-right: auto; }
.pb-device { position: relative; flex: none; }
.pb-device.generic { background: linear-gradient(#45463e, #26271f); border-radius: 5% / 7%; box-shadow: inset 0 0 0 3px #5b5c52, inset 0 0 18px #000, 0 8px 24px #000; }
.pb-generic-label { position: absolute; bottom: 4%; left: 0; right: 0; text-align: center; font: 700 14px 'IBM Plex Mono', monospace; letter-spacing: .35em; color: #c9b98a; }
.pb-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; user-select: none; }
.pb-screen-wrap { position: absolute; z-index: 1; }
.pb-screen { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--pb-bg); }
.pb-screen.fx::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.2) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.6) 100%); }
.pb-green { --pb: #2bff88; --pb-dim: #18924d; --pb-solid: #021309; --pb-bg: radial-gradient(ellipse at center, #07331a 0%, #021309 78%); --pb-glow: rgba(43,255,136,.45); --pb-sel: rgba(43,255,136,.16); }
.pb-amber { --pb: #ffb642; --pb-dim: #a0692a; --pb-solid: #140b02; --pb-bg: radial-gradient(ellipse at center, #33200a 0%, #140b02 78%); --pb-glow: rgba(255,182,66,.42); --pb-sel: rgba(255,182,66,.16); }
.pb-content { position: absolute; }
.pb-canvas { position: absolute; transform-origin: 0 0; box-sizing: border-box; padding: 8px 12px; display: flex; flex-direction: column;
  font-family: 'IBM Plex Sans Condensed', 'Roboto Condensed', 'Arial Narrow', 'DejaVu Sans Condensed', sans-serif; font-size: 18px; line-height: 1.25; color: var(--pb); text-shadow: 0 0 6px var(--pb-glow); }
.pb-canvas button { font: inherit; color: inherit; text-shadow: inherit; cursor: pointer; }
.pb-mains, .pb-subs { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; border-bottom: 2px solid var(--pb-dim); padding-bottom: 4px; margin-bottom: 6px; }
.pb-tab, .pb-sub { background: none; border: 2px solid transparent; color: var(--pb-dim) !important; font-weight: 600 !important; letter-spacing: .06em; text-transform: uppercase; padding: 1px 8px; }
.pb-sub { font-size: 15px !important; flex: none; }
.pb-subs { flex-wrap: nowrap; justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
.pb-subs::-webkit-scrollbar { display: none; }
.radio-player.inline { display: none; }
.pb-radio-text { width: 100%; height: 100%; overflow-y: auto; padding: 6px 8px; box-sizing: border-box; font-size: 16px; align-self: stretch; }
.pb-radio-text p { margin: 0 0 6px; }
.pb-tab.on, .pb-sub.on { color: var(--pb) !important; border-color: var(--pb); }
.pb-body { flex: 1; min-height: 0; overflow: hidden; }
.pb-footer { display: flex; gap: 8px; border-top: 2px solid var(--pb-dim); padding-top: 5px; margin-top: 6px; font-size: 15px; }
.pb-footer > span { flex: 1; text-align: center; background: var(--pb-sel); padding: 1px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; height: 100%; }
.pb-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: 100%; scrollbar-width: thin; scrollbar-color: var(--pb-dim) transparent; }
.pb-list li { display: flex; gap: 6px; padding: 1px 6px; cursor: pointer; }
.pb-list li.on { background: var(--pb); color: var(--pb-solid); text-shadow: none; }
.pb-list .mark { width: 14px; flex: none; }
.pb-list .name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-list .right { flex: none; }
.pb-detail { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--pb-dim) transparent; }
.pb-detail h3 { margin: 0 0 6px; font-size: 20px; }
.pb-detail p { margin: 0 0 6px; font-size: 16px; }
.pb-canvas dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 8px; font-size: 16px; }
.pb-canvas dt { color: var(--pb-dim); }
.pb-canvas dd { margin: 0; text-align: right; }
.pb-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pb-btn { background: none; border: 2px solid var(--pb); padding: 1px 10px; letter-spacing: .06em; }
.pb-btn.on { background: var(--pb); color: var(--pb-solid) !important; text-shadow: none !important; }
.pb-empty { color: var(--pb-dim); }
.pb-note { color: var(--pb-dim); font-size: 14px; margin: 4px 0; }
.pb-status { display: grid; grid-template-columns: 290px 1fr; gap: 16px; height: 100%; }
.pb-figure { position: relative; width: 290px; align-self: start; }
.pb-figure img { width: 100%; display: block; }
.pb-limb { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: stretch; }
.pb-limb .bar { display: block; width: 100%; height: 6px; box-sizing: border-box; border: 1px solid var(--pb); }
.pb-limb .bar > span { display: block; height: 100%; background: var(--pb); }
.pb-limb .cond { font-size: 10px; font-weight: 700; letter-spacing: .02em; text-align: center; white-space: nowrap; line-height: 1.1; }
.pb-limb .cond.bad { background: var(--pb); color: var(--pb-solid); text-shadow: none; padding: 0 3px; }
.pb-limb .lbl { position: absolute; top: calc(100% + 7px); left: 0; right: 0; text-align: center; font-size: 10px; color: var(--pb-dim); }
.pb-limb.head .lbl { top: 50%; left: 100%; right: auto; transform: translate(10px, -50%); }
.pb-stats { overflow-y: auto; }
.pb-objectives { list-style: none; margin: 0; padding: 0; font-size: 16px; }
.pb-objectives li { display: flex; gap: 6px; }
.pb-objectives li.done { color: var(--pb-dim); }
.pb-objectives .box { flex: none; }
.pb-statlist { font-size: 18px !important; }
.pb-mapbox { height: 100%; display: flex; flex-direction: column; }
.pb-map { position: relative; overflow: hidden; flex: 1; min-height: 0; touch-action: none; cursor: grab; outline: none; border: 1px solid var(--pb-dim); }
.pb-map:active { cursor: grabbing; }
.pb-map:focus-visible { border-color: var(--pb); }
.pb-map-inner { position: absolute; }
.pb-map-inner img { width: 100%; height: 100%; display: block; user-select: none; pointer-events: none; filter: grayscale(1) contrast(1.3) brightness(.75) sepia(1) hue-rotate(80deg) saturate(3); }
.pb-amber .pb-map img { filter: grayscale(1) contrast(1.3) brightness(.8) sepia(1) hue-rotate(-10deg) saturate(3); }
.pb-map-ctl { position: absolute; right: 6px; top: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
.pb-map-ctl button { width: 30px; height: 30px; padding: 0; background: var(--pb-solid); border: 1px solid var(--pb); font-size: 20px; line-height: 1; }
.pb-zoom-level { font-size: 11px; background: var(--pb-solid); padding: 0 2px; }
.pb-pin { position: absolute; width: 8px; height: 8px; background: var(--pb); transform: translate(-50%, -50%); box-shadow: 0 0 6px var(--pb-glow); }
.pb-pin.wp { background: none; border: 2px dashed var(--pb); transform: translate(-50%, -50%) rotate(45deg); }
.pb-pin.here, .pb-pin.party { width: 12px; height: 12px; border-radius: 50%; animation: pb-blink 1.2s steps(2) infinite; }
.pb-pin .lbl { position: absolute; left: 10px; top: -6px; font-size: 11px; white-space: nowrap; color: var(--pb); background: var(--pb-solid); padding: 0 2px; }
.pb-pin.wp .lbl { transform: rotate(-45deg); }
@keyframes pb-blink { 50% { opacity: .25; } }
.pb-radio { display: grid; grid-template-columns: 1fr 300px; gap: 16px; height: 100%; }
.pb-tuner { display: flex; flex-direction: column; gap: 6px; }
.pb-radio-slot { width: 300px; height: 200px; border: 2px solid var(--pb-dim); display: flex; align-items: center; justify-content: center; background: var(--pb-solid); }
.pb-wave { font-size: 36px; letter-spacing: -2px; color: var(--pb-dim); animation: pb-blink 2s steps(2) infinite; }
.pb-on-air { flex: 2 !important; }
.pb-hw-button { position: absolute; z-index: 4; aspect-ratio: 1; transform: translateY(-50%); border-radius: 50%; border: none; padding: 0; cursor: pointer; background: rgba(0,0,0,.42); }
.pb-hw-button.on { background: radial-gradient(circle, rgba(255,214,120,.55) 0%, rgba(255,150,30,.25) 55%, transparent 72%); box-shadow: 0 0 16px 5px rgba(255,170,60,.55); }
.pb-hw-button:focus-visible { outline: 2px solid #fff; }
.pb-date { position: absolute; z-index: 4; display: flex; justify-content: space-around; align-items: center; background: #161612; border-radius: 3px; font-family: 'IBM Plex Mono', monospace; font-weight: 700; color: #efe7cc; letter-spacing: .08em; }
.pb-date .bell { color: #d39a2a; font-size: .8em; }
.radio-player { position: fixed; z-index: 60; width: 240px; background: #111; border: 1px solid #444; border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 6px 20px #000; }
.radio-player[hidden] { display: none; }
.radio-player-bar { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 2px 6px; font-size: 12px; color: #ddd; }
.radio-player-video { aspect-ratio: 16 / 9; }
.radio-player.docked { border: 0; border-radius: 0; background: #000; box-shadow: none; }
.radio-player.docked .radio-player-bar { display: none; }
.radio-player.docked .radio-player-video { aspect-ratio: auto; flex: 1; }
.radio-player iframe { width: 100%; height: 100%; border: 0; display: block; }
.radio-player.kind-audio .radio-player-video, .radio-player.kind-text .radio-player-video { aspect-ratio: auto; }
.radio-player audio { width: 100%; display: block; }
.radio-player-text { max-height: 140px; overflow-y: auto; padding: 6px 8px; margin: 0; font-size: 13px; color: #ddd; }
.radio-player.docked .radio-player-text { max-height: none; height: 100%; box-sizing: border-box; color: var(--pb, #ddd); background: var(--pb-solid, #000); font-size: 15px; }
.radio-player.docked.kind-audio .radio-player-video { display: flex; align-items: center; padding: 0 8px; }
.pb-rich { font-size: 16px; } .pb-rich p { margin: 0 0 6px; } .pb-rich a { color: inherit; }
.pb-pic { margin: 6px 0; } .pb-pic img { max-width: 100%; filter: grayscale(1) contrast(1.2) brightness(.85); mix-blend-mode: screen; opacity: .9; }
.pb-pic figcaption { font-size: 13px; color: var(--pb-dim); }
.pb-clip { margin: 4px 0; }
.pb-tape-entry { border-top: 1px solid var(--pb-dim); padding-top: 6px; margin-top: 6px; } .pb-tape-entry h4 { margin: 0 0 4px; font-size: 17px; }
.pb-games { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; } .pb-games li { display: flex; gap: 6px; align-items: center; } .pb-games li > span { flex: 1; }
.pb-game { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.pb-game-head { display: flex; align-items: baseline; gap: 12px; } .pb-game-head h3 { margin: 0; font-size: 20px; }
.pb-game-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 200px; gap: 12px; }
.pb-game-board { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; }
.pb-game.paused .pb-game-board > :not(.pb-pause) { opacity: .25; }
.pb-pause { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; background: color-mix(in srgb, var(--pb-solid) 70%, transparent); }
.pb-pause strong { font-size: 28px; letter-spacing: .2em; }
.pb-seats { list-style: none; margin: 0; padding: 0; font-size: 16px; } .pb-seats li { display: flex; gap: 4px; flex-wrap: wrap; } .pb-seats li.turn { font-weight: 700; } .pb-seats .mark { width: 14px; }
.pb-game.solo .pb-game-main { grid-template-columns: 1fr; }
.pb-game-head { flex-wrap: wrap; }
.pb-btn.on { background: var(--pb); color: var(--pb-solid); text-shadow: none; }
/* minefield */
.pb-mines-wrap { display: flex; gap: 12px; height: 100%; width: 100%; align-items: center; justify-content: center; }
.pb-mines { display: grid; gap: 2px; flex: none; }
.pb-mines .cell { border: 1px solid var(--pb-dim); background: var(--pb-sel); padding: 0; font-size: inherit !important; font-weight: 700; width: 100%; height: 100%; min-width: 0; min-height: 0; line-height: 1; overflow: hidden; box-sizing: border-box; }
.pb-mines .cell.open { background: transparent; border-color: color-mix(in srgb, var(--pb-dim) 40%, transparent); }
.pb-mines .cell.boom { background: var(--pb); color: var(--pb-solid); text-shadow: none; }
.pb-mines-side { width: 120px; font-size: 15px; } .pb-mines-side p { margin: 0 0 6px; }
/* terminal hacking */
.pb-hack { font-family: 'IBM Plex Mono', 'Share Tech Mono', monospace; font-size: 13px; width: 100%; height: 100%; display: flex; flex-direction: column; }
.pb-hack-head p { margin: 0 0 2px; letter-spacing: .05em; }
.pb-hack-body { display: grid; grid-template-columns: auto auto 1fr; gap: 14px; margin-top: 6px; min-height: 0; }
.pb-hack .ln { white-space: pre; line-height: 1.35; } .pb-hack .addr { color: var(--pb-dim); }
.pb-hack .word { font: inherit; background: none; border: 0; padding: 0; letter-spacing: 0; color: inherit; }
.pb-hack .word:not(:disabled):hover, .pb-hack .word:focus-visible { background: var(--pb); color: var(--pb-solid); text-shadow: none; outline: none; }
.pb-hack .word.tried { color: var(--pb-dim); text-decoration: line-through; }
.pb-hack .log { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; line-height: 1.3; overflow: hidden; }
.pb-hack .cursor { animation: pb-blink 1s steps(2) infinite; }
/* solitaire */
.pb-sol { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pb-sol .top, .pb-sol .tab { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pb-sol .waste { display: flex; } .pb-sol .waste .under { margin-right: -30px; opacity: .6; }
.pb-sol .card { width: 100%; max-width: 64px; height: 34px; box-sizing: border-box; border: 1px solid var(--pb); background: var(--pb-solid); padding: 2px 4px; text-align: left; font-weight: 700; display: block; }
.pb-sol .card.red { color: var(--pb-solid) !important; background: var(--pb); text-shadow: none; }
.pb-sol .card.back { background: repeating-linear-gradient(45deg, var(--pb-sel) 0 3px, transparent 3px 6px); border-color: var(--pb-dim); }
.pb-sol .card.back.empty { background: none; text-align: center; }
.pb-sol .card.found { color: var(--pb-dim); } .pb-sol .card.found.red { color: var(--pb-solid) !important; }
.pb-sol .card.sel { outline: 2px solid var(--pb); outline-offset: 2px; box-shadow: 0 0 8px var(--pb-glow); }
.pb-sol .slot { display: block; width: 100%; max-width: 64px; height: 34px; border: 1px dashed var(--pb-dim); background: none; }
.pb-sol .tab { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.pb-sol .pile { display: flex; flex-direction: column; min-height: 40px; }
.pb-sol .pile .card { margin-bottom: -18px; } .pb-sol .pile .card.back { margin-bottom: -26px; height: 34px; }
.pb-sol .pile > :last-child { margin-bottom: 0; }
.pb-sol .pb-note { margin: 0; }
/* holotape stories */
.pb-story { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px; }
.pb-story-text { flex: 1; min-height: 0; overflow-y: auto; white-space: pre-wrap; font-size: 18px; line-height: 1.35; scrollbar-width: thin; scrollbar-color: var(--pb-dim) transparent; }
.pb-story-choices { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.pb-story-choices .pb-btn { width: 100%; text-align: left; letter-spacing: 0; font-size: 17px; }
.pb-story-end { text-align: center; letter-spacing: .2em; margin: 0; }
.pb-game-board:has(.pb-story) { align-items: stretch; }
/* lock-picking */
.pb-lock { display: grid; grid-template-columns: 1fr 200px; gap: 12px; width: 100%; align-items: center; }
.pb-lock-dial svg { width: 100%; display: block; }
.pb-lock-dial .arc { fill: none; stroke: var(--pb-dim); stroke-width: 3; }
.pb-lock-dial .pick { stroke: var(--pb); stroke-width: 3; stroke-linecap: round; }
.pb-lock-dial .core { fill: var(--pb-solid); stroke: var(--pb); stroke-width: 2; }
.pb-lock-dial .try { fill: var(--pb-dim); } .pb-lock-dial .lbl { fill: var(--pb-dim); font-size: 8px; text-anchor: middle; }
.pb-lock-dial .spot { fill: var(--pb-sel); stroke: var(--pb); stroke-width: .5; }
.pb-lock-side p { margin: 0 0 6px; font-size: 15px; } .pb-lock-side label { color: var(--pb-dim); } .pb-lock-side input[type=range] { width: 100%; accent-color: var(--pb); }
/* a game in a window, away from the Pip-Boy */
.pb-window { width: 100%; min-width: min(520px, 80vw); height: min(400px, 65vh); border-radius: 12px; }
.pb-window .pb-lock { grid-template-columns: 1fr 170px; } .pb-window .pb-lock-dial { max-width: 360px; }
.pb-window-canvas { position: absolute; inset: 0; transform: none; }
.pb-tictactoe { display: grid; grid-template-columns: repeat(3, 72px); grid-template-rows: repeat(3, 72px); gap: 4px; }
.pb-tictactoe .cell { border: 2px solid var(--pb-dim); background: transparent; font-size: 44px; font-weight: 700; padding: 0; }
.pb-tictactoe .cell:not(:disabled):hover { background: var(--pb-sel); } .pb-tictactoe .cell.won { background: var(--pb); color: var(--pb-solid); text-shadow: none; }
.pb-calib-pic { position: relative; max-width: 900px; user-select: none; touch-action: none; cursor: crosshair; }
.pb-calib-pic img { width: 100%; display: block; pointer-events: none; background: repeating-conic-gradient(#333 0 25%, #222 0 50%) 0 0 / 24px 24px; }
.pb-calib .cal-rect { position: absolute; border: 2px solid #ff3cff; pointer-events: none; }
.pb-calib .cal-rect.safe { border-style: dashed; border-color: #3cf; }
.pb-calib .cal-rect.date { border-color: #ffd23c; }
.pb-calib .cal-btn { position: absolute; aspect-ratio: 1; transform: translateY(-50%); border: 2px solid #ff3cff; border-radius: 50%; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.pb-calib .cal-btn span { font: 700 10px sans-serif; color: #fff; background: rgba(0,0,0,.7); padding: 0 2px; }
.pb-view { position: relative; display: flex; justify-content: center; overflow: hidden; flex: none; max-width: 100%; }

/* the holotape story editor (§34.4) */
.story-pages { max-height: 60vh; overflow-y: auto; }
.story-page.start { border-color: var(--accent, #6fe08f); }
.story-page textarea { width: 100%; box-sizing: border-box; }
.story-choices { margin: 0; padding-left: 1.2em; display: grid; gap: 4px; }
/* card games (§34.6) */
.dialog.wide:has(.pb-window.wide) { max-width: 820px; }
.pb-window.wide { height: min(520px, 76vh); }
.pc { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 52px; box-sizing: border-box; border: 1px solid var(--pb); border-radius: 4px;
  background: var(--pb-solid); color: var(--pb); font-weight: 700; font-size: 15px; padding: 0; flex: none; }
.pc.red { background: var(--pb); color: var(--pb-solid) !important; text-shadow: none; }
.pc.back { background: repeating-linear-gradient(45deg, var(--pb-sel) 0 3px, transparent 3px 6px); border-color: var(--pb-dim); }
.pc.small { width: 28px; height: 38px; font-size: 12px; }
.pc.sel { outline: 2px solid var(--pb); outline-offset: 2px; transform: translateY(-4px); box-shadow: 0 0 8px var(--pb-glow); }
button.pc:disabled { opacity: 1; cursor: default; }
.pb-hand { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pb-hand.mini { gap: 2px; }
.pb-cards { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pb-cards-seats { display: flex; gap: 6px; flex-wrap: wrap; }
.pb-cards-seat { border: 1px solid var(--pb-dim); padding: 3px 6px; display: flex; flex-direction: column; gap: 2px; min-width: 96px; }
.pb-cards-seat.turn { border-color: var(--pb); box-shadow: 0 0 6px var(--pb-glow); }
.pb-cards-seat.dim { opacity: .5; }
.pb-cards-mid { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-cards-log { font-size: 12px; color: var(--pb-dim); }
.pb-bet { font-weight: 700; }
.pb-num { width: 70px; background: var(--pb-solid); color: var(--pb); border: 1px solid var(--pb); font: inherit; padding: 1px 4px; }
.pb-poker-acts { align-items: center; flex-wrap: wrap; }
.pb-mini { background: none; border: 1px solid var(--pb-dim); padding: 0 5px; font-size: 12px !important; line-height: 1.4; }
.pb-caravan { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pb-lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pb-lane { border: 1px dashed var(--pb-dim); min-height: 62px; padding: 3px; display: flex; flex-direction: column; gap: 2px; }
.pb-lane.sold { border-style: solid; } .pb-lane.won { border-color: var(--pb); box-shadow: inset 0 0 8px var(--pb-glow); }
.pb-lane-head { display: flex; gap: 6px; align-items: center; } .pb-lane-head .pb-mini { margin-left: auto; }
.pb-lane-cards { display: flex; gap: 2px; flex-wrap: wrap; align-items: flex-start; }
.pb-lane-card { display: flex; flex-direction: column; } .pb-lane-card > :not(:first-child) { margin-top: -26px; margin-left: 6px; }
.pb-lane .add { align-self: flex-start; }
/* checkers and bets (§34.7) */
.pb-checkers-wrap { display: flex; gap: 12px; align-items: center; justify-content: center; width: 100%; height: 100%; }
.pb-checkers { display: grid; grid-template-columns: repeat(8, 34px); grid-template-rows: repeat(8, 34px); border: 2px solid var(--pb); flex: none; }
.pb-checkers .sq { padding: 0; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.pb-checkers .sq.dark { background: var(--pb-sel); }
.pb-checkers .sq.last { box-shadow: inset 0 0 0 1px var(--pb-dim); }
.pb-checkers .sq.tgt { box-shadow: inset 0 0 0 2px var(--pb); }
.pb-checkers .sq.sel { background: var(--pb-dim); }
.pb-checkers .sq img { width: 30px; height: 30px; filter: none; }
.pb-checkers-side { width: 150px; font-size: 14px; } .pb-checkers-side p { margin: 0 0 6px; }
.pb-warn { color: var(--pb-solid) !important; background: var(--pb); text-shadow: none; padding: 1px 4px; font-weight: 700; }
.pb-bet-box { border: 1px solid var(--pb-dim); padding: 4px 8px; font-size: 14px; } .pb-bet-box p { margin: 0 0 4px; }


/* the saved-places library (§35.4) */
.place-folder > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.place-folder > .list { margin: 4px 0 8px; }
