/* Sword Coast Guilds — the map carries the colour; the chrome stays quiet slate. One loud thing: the wax turn seal. */
:root {
  --sea: #1A2631;
  --slate: #1C2530;
  --slate-2: #253140;
  --slate-3: #2E3B4B;
  --line: #34424F;
  --vellum: #E9E2D0;
  --vellum-dim: #A8A291;
  --verdigris: #4FA38E;
  --verdigris-ink: #0E201B;
  --brass: #C9A04E;
  --psionic: #A47BDB;
  --wax: #8E2F3C;
  --wax-hi: #AE4756;
  --danger: #E08178;
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --panel-w: 420px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--sea);
  color: var(--vellum);
  font: 16px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 400; margin: 0; }
h2 { font-family: var(--display); font-size: 1.6rem; line-height: 1.15; }
h3 { font-family: var(--display); font-size: 1.22rem; margin: 1.4rem 0 .5rem; }
p { margin: .5rem 0; }
small { font-size: .86rem; }
.muted { color: var(--vellum-dim); }
.help { display: block; color: var(--vellum-dim); font-size: .86rem; margin-top: .25rem; }

/* ---------- controls ---------- */
.btn, .btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: 7px; padding: .55rem 1rem; cursor: pointer; font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.btn { background: var(--verdigris); color: var(--verdigris-ink); border: 1px solid var(--verdigris); }
.btn:hover { background: #5DB59F; }
.btn-quiet { background: transparent; border: 1px solid var(--line); color: var(--vellum); }
.btn-quiet:hover { border-color: var(--vellum-dim); background: var(--slate-2); }
.btn.sm, .btn-quiet.sm { padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled, .btn-quiet:disabled { opacity: .55; cursor: wait; }
.danger { color: var(--danger); }
.btn-quiet.danger:hover { border-color: var(--danger); }
.link { background: none; border: 0; padding: 0; color: var(--verdigris); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.file { position: relative; }

label { display: block; margin: .8rem 0 0; font-size: .92rem; color: var(--vellum-dim); }
label > input:not([type=checkbox]):not([type=color]):not([type=radio]), label > select, label > textarea {
  display: block; width: 100%; margin-top: .3rem;
  background: var(--slate-2); border: 1px solid var(--line); border-radius: 6px;
  padding: .5rem .65rem; color: var(--vellum); font-size: 1rem;
}
textarea { resize: vertical; line-height: 1.45; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--vellum); }
input[type=color] { width: 3rem; height: 2rem; border: 1px solid var(--line); background: var(--slate-2); border-radius: 6px; padding: 2px; display: block; margin-top: .3rem; }
.form-error { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin: .6rem 0; }
.inline-form label { margin: 0; }
.inline-form select { background: var(--slate-2); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .5rem; max-width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 .6rem; }
.span2 { grid-column: 1 / -1; }
.grid2 .span2 > .btn-quiet { margin-top: .8rem; }

/* ---------- gate (login / setup) ---------- */
body.gate { overflow: auto; background:
  radial-gradient(1200px 600px at 20% 10%, #22323F 0%, transparent 60%),
  radial-gradient(900px 600px at 90% 90%, #1F2A36 0%, transparent 55%), var(--sea); }
.gate-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: min(420px, 100%); background: var(--slate); border: 1px solid var(--line); border-radius: 12px; padding: 32px 28px 28px; position: relative; }
.gate-card h1 { font-family: var(--display); font-size: 2.1rem; margin-top: 2.2rem; }
.gate-card .btn { width: 100%; margin-top: 1.4rem; padding: .7rem; }
.gate-seal { position: absolute; top: -36px; left: 28px; }

/* ---------- layout ---------- */
.bar {
  height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 16px; background: var(--slate); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-size: 1.35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { display: flex; align-items: center; gap: .8rem; }
.who { display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap; }
.who i, .players i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); display: inline-block; flex: none; }
.who small, .players small { color: var(--brass); font-size: .78rem; border: 1px solid currentColor; border-radius: 4px; padding: 0 .3rem; margin-left: .2rem; }

.stage { height: calc(100% - 52px); display: grid; grid-template-columns: 1fr var(--panel-w); }
#map { position: relative; overflow: hidden; background: var(--sea); touch-action: none; user-select: none; -webkit-user-select: none; }
.panel { background: var(--slate); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.sheet-handle { display: none; }
.tabs { display: flex; padding: 8px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs button {
  background: none; border: 0; padding: .55rem .5rem .6rem; color: var(--vellum-dim); cursor: pointer; font-size: .96rem;
  border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500;
}
.tabs button[aria-selected=true] { color: var(--vellum); border-bottom-color: var(--brass); }
.badge { font-style: normal; font-size: .72rem; background: var(--wax-hi); color: var(--vellum); border-radius: 9px; padding: 0 .4rem; margin-left: .35rem; vertical-align: 1px; }
.panel-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; overscroll-behavior: contain; }
.notice { background: var(--slate-3); padding: .5rem 18px; font-size: .9rem; }
.head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; }

/* ---------- the turn seal ---------- */
.seal-wrap { position: absolute; z-index: 3; top: 14px; left: 14px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.seal {
  width: 84px; height: 84px; border-radius: 50%; flex: none; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 34% 28%, var(--wax-hi) 0%, var(--wax) 55%, #6C2230 100%);
  box-shadow: 0 0 0 3px rgba(142, 47, 60, .35), 0 0 0 6px rgba(142, 47, 60, .12), 0 8px 18px rgba(0, 0, 0, .45);
  color: var(--vellum);
}
.seal::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; border: 1px dashed rgba(233, 226, 208, .38); }
.seal-small { font-family: var(--display); font-style: italic; font-size: .82rem; line-height: 1; opacity: .85; }
.seal-num { font-family: var(--display); font-size: 2.3rem; line-height: .95; }
.seal.phase-awaiting_gm { filter: saturate(.75); }
.seal-note {
  background: rgba(28, 37, 48, .9); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .65rem;
  display: flex; flex-direction: column; line-height: 1.25; backdrop-filter: blur(4px);
}
.seal-note b { font-weight: 500; }
.seal-note span { color: var(--vellum-dim); font-size: .86rem; font-family: var(--display); font-style: italic; }
.seal.gate-seal .seal-num { font-size: 2.6rem; }

/* ---------- map ---------- */
.mapsvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.mapsvg:active { cursor: grabbing; }
#map.picking .mapsvg { cursor: crosshair; }
.mapimg { image-rendering: auto; }
.plancanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.zoom button[data-z=mode], .zoom button[data-z=names] { font-size: .72rem; width: auto; min-width: 40px; padding: 0 .3rem; }
.zoom button[data-z=names][aria-pressed=false] { opacity: .55; }
.route { stroke: var(--c); stroke-width: 2.5; stroke-dasharray: 7 6; fill: none; opacity: .95; }
.route.planned { stroke-width: 2; opacity: .55; stroke-dasharray: 2 6; stroke-linecap: round; }
.pick-dot { fill: var(--brass); stroke: var(--sea); stroke-width: 2; }

.loc { cursor: pointer; }
.loc .hit, .tok .hit { fill: transparent; }
.loc-shape { fill: var(--brass); stroke: #1A2631; stroke-width: 1.6; }
.loc-core { fill: #1A2631; }
.loc-shape.enc { fill: #D98A4E; }
.loc-mark { stroke: #1A2631; stroke-width: 2; stroke-linecap: round; }
.loc-shape.camp { fill: #9DB08A; }
.t-dungeon .loc-shape { fill: #B9B2A0; }
.hidden-loc { opacity: .6; }
.hidden-loc .loc-shape { stroke: var(--psionic); stroke-dasharray: 2 2; }
.loc-label {
  font: 500 13px var(--ui); fill: var(--vellum); text-anchor: middle;
  paint-order: stroke; stroke: rgba(20, 28, 36, .92); stroke-width: 3.5px; stroke-linejoin: round;
}
.loc.major .loc-label { font: 400 15px var(--display); }
.sel-ring { fill: none; stroke: var(--vellum); stroke-width: 1.5; stroke-dasharray: 3 3; }

.tok { cursor: pointer; }
.tok-disc { fill: var(--c); stroke: var(--vellum); stroke-width: 2; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55)); }
.tok.mine .tok-disc { stroke-width: 2.5; }
.tok.sel .tok-disc { stroke: #fff; stroke-width: 3.5; }
.tok.afield .tok-disc { stroke-dasharray: 3 2; }
.tok-text { font: 700 11px var(--ui); fill: #13202A; text-anchor: middle; pointer-events: none; }

.zoom { position: absolute; z-index: 3; right: 14px; bottom: 14px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: rgba(28, 37, 48, .92); }
.zoom button { background: none; border: 0; width: 40px; height: 36px; cursor: pointer; font-size: 1.1rem; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button[data-z=fit] { font-size: .8rem; }
.zoom button:hover { background: var(--slate-2); }

.map-hint {
  position: absolute; z-index: 4; left: 50%; top: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: .8rem; background: var(--slate); border: 1px solid var(--brass);
  border-radius: 8px; padding: .5rem .6rem .5rem 1rem; max-width: calc(100% - 28px); box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 120px 20px 20px; }
.empty-card { max-width: 440px; text-align: left; background: var(--slate); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.empty-card .btn { margin-top: .8rem; }

/* ---------- lists ---------- */
.roster, .places, .checklist, .who-here, .players, .clocks, .effects, .objections { list-style: none; padding: 0; margin: 0; }
.row {
  width: 100%; display: flex; align-items: center; gap: .75rem; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: .7rem .2rem; cursor: pointer;
}
.row:hover { background: rgba(255, 255, 255, .025); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 500; font-size: 1.05rem; }
.row-main small { color: var(--vellum-dim); }
.row-main small.where { color: var(--vellum); opacity: .8; }
.pill { font-size: .78rem; border: 1px solid var(--line); border-radius: 20px; padding: .05rem .55rem; color: var(--vellum-dim); white-space: nowrap; }
.pill.ok { border-color: var(--verdigris); color: var(--verdigris); }
.pill.psi { border-color: var(--psionic); color: var(--psionic); }
.group { font-size: 1.05rem; color: var(--brass); margin-top: 1.2rem; }

.tokdot {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  background: var(--c); color: #13202A; font-weight: 700; font-size: .78rem; border: 2px solid var(--vellum);
}
.tokdot.sm { width: 22px; height: 22px; font-size: .62rem; border-width: 1.5px; }
.shape-ico { width: 18px; height: 18px; flex: none; fill: var(--brass); }
.shape-ico.t-dungeon { fill: #B9B2A0; }
.shape-ico.t-encounter { fill: #D98A4E; }
.shape-ico.t-camp { fill: #9DB08A; }

.checklist li, .who-here li { display: flex; align-items: center; gap: .55rem; padding: .35rem 0; }
.checklist li small { margin-left: auto; color: var(--vellum-dim); }
.checklist li.done small { color: var(--verdigris); }
.players li { display: flex; align-items: center; gap: .55rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.players li span { flex: 1; }

.back { background: none; border: 0; color: var(--vellum-dim); padding: 0 0 .6rem; cursor: pointer; }
.back::before { content: '\2039'; margin-right: .4rem; }
.back:hover { color: var(--vellum); }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 1rem 1.1rem; color: var(--vellum-dim); margin: .6rem 0; }
.callout { border-left: 3px solid var(--brass); padding: .4rem .8rem; background: var(--slate-2); border-radius: 0 6px 6px 0; }

/* ---------- character sheet ---------- */
.abilities { border: 0; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.abilities legend { color: var(--vellum-dim); font-size: .92rem; margin-bottom: .3rem; padding: 0; }
.ab { margin: 0; background: var(--slate-2); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem .5rem; text-align: center; }
.ab span { display: block; font-size: .78rem; }
.abilities label.ab > input[type=number] { width: 100%; margin: 0; text-align: center; background: transparent; border: 0; font-family: var(--display); font-size: 1.6rem; padding: 0; color: var(--vellum); -moz-appearance: textfield; }
.abilities label.ab > input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ab output { display: block; font-weight: 700; color: var(--brass); }
.ab-ro { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0; }
.ab-ro div { background: var(--slate-2); border-radius: 8px; padding: .4rem; text-align: center; }
.ab-ro dt { font-size: .78rem; color: var(--vellum-dim); }
.ab-ro dd { margin: 0; font-family: var(--display); font-size: 1.3rem; }
.ab-ro dd small { font-family: var(--ui); color: var(--brass); font-weight: 700; }
.host-tools { margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.host-tools h3 { color: var(--brass); }
details.account { margin-top: 2rem; border-top: 1px solid var(--line); padding-top: .8rem; }
details summary { cursor: pointer; color: var(--vellum-dim); }

/* ---------- orders ---------- */
.order { border-top: 1px solid var(--line); padding: 1rem 0 1.2rem; }
.order-head { display: flex; gap: .7rem; align-items: center; }
.order-head h3 { margin: 0; }
.order-head p { margin: 0; }
.order-head .shape-ico { width: 26px; height: 26px; }

/* ---------- chronicle ---------- */
.report { font-size: 1.02rem; line-height: 1.6; }
.report h2, .report h3 { color: var(--vellum); }
.report h2 { font-size: 1.45rem; margin-top: 1rem; }
.report blockquote { margin: .8rem 0; padding: 0 0 0 1rem; border-left: 2px solid var(--brass); font-family: var(--display); font-style: italic; font-size: 1.08rem; }
.report hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.report.pending { border: 1px solid var(--wax-hi); border-radius: 10px; padding: .2rem 1rem 1rem; margin-bottom: 1.4rem; }
.pending-banner { margin: 0 -1rem .6rem; padding: .45rem 1rem; background: var(--wax); border-radius: 9px 9px 0 0; font-weight: 500; }
.private { border: 1px solid var(--psionic); border-radius: 8px; padding: .2rem .9rem .5rem; margin: 1rem 0; background: rgba(164, 123, 219, .07); }
.private h4 { color: var(--psionic); font-family: var(--display); font-style: italic; font-size: 1.05rem; margin-top: .5rem; }
.table-wrap { overflow-x: auto; }
.rolls { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.35; }
.rolls th { text-align: left; font-weight: 500; color: var(--vellum-dim); border-bottom: 1px solid var(--line); padding: .3rem .4rem .3rem 0; }
.rolls td { border-bottom: 1px solid var(--line); padding: .35rem .4rem .35rem 0; vertical-align: top; }
.rolls small { color: var(--vellum-dim); }
.effects li { padding: .3rem 0 .3rem 1rem; position: relative; font-size: .95rem; }
.effects li::before { content: ''; position: absolute; left: 0; top: .78rem; width: 6px; height: 6px; background: var(--brass); transform: rotate(45deg); }
.objections li { padding: .3rem 0; }
.objection { margin-top: .4rem; }
.objection .btn-quiet { margin-top: .5rem; }
.host-decide { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.report-entry { border-top: 1px solid var(--line); padding: .6rem 0; }
.report-entry summary { display: flex; align-items: baseline; gap: .8rem; list-style: none; color: var(--vellum); }
.report-entry summary::-webkit-details-marker { display: none; }
.r-turn { font-family: var(--display); font-size: 1.3rem; }
.r-date { color: var(--vellum-dim); font-family: var(--display); font-style: italic; }
.prose { line-height: 1.55; }

/* ---------- host ---------- */
.host-sec { border-top: 1px solid var(--line); padding-bottom: .6rem; }
.host-sec:first-of-type { border-top: 0; }
.host-sec h3 { margin-top: 1rem; }

/* ---------- threats module ---------- */
.clock-row { display: flex; gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.clock-row.is-hidden { opacity: .75; }
.clock-main { flex: 1; min-width: 0; }
.clock-main b { display: block; font-weight: 500; font-size: 1.05rem; }
.clock-main small { color: var(--vellum-dim); }
.clock-main p { margin: .35rem 0 0; font-size: .95rem; }
.clock-main .actions { margin-top: .5rem; }
.clock { flex: none; }
.clock path { stroke: var(--slate); stroke-width: 1.5; }
.clock .on { fill: var(--psionic); }
.clock .off { fill: var(--slate-3); }
.clock .rim { fill: none; stroke: var(--psionic); stroke-width: 1.5; opacity: .6; }
.clock.full .rim { opacity: 1; stroke-width: 2.5; }
details.ended { margin-top: 1rem; }

/* ---------- play: events, travel, requests ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: .86rem; }
.play-char { border-top: 1px solid var(--line); padding: 1rem 0 1.2rem; }
.play-char .order-head { margin-bottom: .4rem; }
.event-card {
  margin: .9rem 0; padding: .2rem 0 .9rem 1rem; border-left: 3px solid var(--wax-hi);
  background: linear-gradient(90deg, rgba(142, 47, 60, .12), transparent 70%); border-radius: 0 8px 8px 0;
}
.event-card h4 { font-family: var(--display); font-size: 1.3rem; margin: .5rem 0 .1rem; }
.deadline { color: var(--vellum-dim); font-size: .88rem; margin-top: 0; }
.options { border: 0; padding: 0; margin: .8rem 0 0; }
.opt {
  display: flex; gap: .65rem; align-items: flex-start; margin: 0 0 .45rem; padding: .55rem .7rem; cursor: pointer;
  background: var(--slate-2); border: 1px solid var(--line); border-radius: 8px; color: var(--vellum);
}
.opt:hover { border-color: var(--vellum-dim); }
.opt:has(input:checked) { border-color: var(--verdigris); background: rgba(79, 163, 142, .12); }
.opt input { margin-top: .3rem; accent-color: var(--verdigris); }
.opt b { font-weight: 500; display: block; }
.opt small { color: var(--vellum-dim); display: block; }
.opt.cant { opacity: .55; cursor: not-allowed; }
.opt.own { margin-top: .6rem; border-style: dashed; }
.options textarea { display: block; width: 100%; margin: 0 0 .6rem; background: var(--slate-2); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .65rem; color: var(--vellum); }
.event-card .btn { margin-top: .2rem; }
.result { border: 1px solid var(--verdigris); border-radius: 10px; padding: .2rem 1rem .8rem; margin: .4rem 0 1rem; }
.result-head { font-family: var(--display); font-size: 1.2rem; margin: .6rem 0 .2rem; }
.roll-line { font-size: .92rem; color: var(--vellum-dim); margin: .25rem 0; }
.roll-line b { color: var(--brass); font-weight: 700; }
.waiting { background: var(--slate-2); border-radius: 8px; padding: .55rem .8rem; font-size: .95rem; }
.waiting .muted { margin-left: .3rem; }
.quote { display: block; margin-top: .3rem; padding-left: .7rem; border-left: 2px solid var(--line); font-family: var(--display); font-style: italic; }
.travel, .ask { margin-top: .4rem; }
.travel .actions { margin-top: .5rem; }
.ask .btn-quiet { margin-top: .5rem; }
.quiet-h { font-size: 1.05rem; color: var(--vellum-dim); }
.elsewhere { list-style: none; padding: 0; margin: 0; color: var(--vellum-dim); }
.elsewhere li { padding: .2rem 0; }
.pill.wax { border-color: var(--wax-hi); color: #F0A9B3; }

/* ---------- map additions ---------- */
.tok-flag circle { fill: var(--wax-hi); stroke: var(--vellum); stroke-width: 1.5; }
.tok-flag text { font: 700 10px var(--ui); fill: var(--vellum); text-anchor: middle; }
.tok.halted .tok-disc { stroke: var(--wax-hi); }
.seal.paused { filter: grayscale(.7); }

/* ---------- chronicle feed ---------- */
h3.day { font-size: 1.15rem; color: var(--brass); margin: 1.4rem 0 .2rem; }
.entry { border-top: 1px solid var(--line); padding: .7rem 0 .8rem; }
.entry header { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.e-kind { font-family: var(--display); font-size: 1.12rem; }
.entry time { color: var(--vellum-dim); font-size: .86rem; font-variant-numeric: tabular-nums; }
.entry .prose { margin-top: .2rem; }
.entry .prose p { margin: .35rem 0; }
.entry.simple { padding: .45rem 0; }
.entry.simple header { display: none; }
.entry.simple .prose p { margin: 0; color: var(--vellum-dim); }
.entry.k-dispatch .e-kind { color: var(--brass); }
.entry.k-threat .e-kind { color: var(--psionic); }
.entry blockquote { margin: .5rem 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--line); font-family: var(--display); font-style: italic; }
.private-tag { display: inline-block; margin: .2rem 0; font-size: .8rem; color: var(--psionic); border: 1px solid var(--psionic); border-radius: 20px; padding: 0 .55rem; }
.objections { margin: .4rem 0; padding-left: .8rem; border-left: 2px solid var(--wax-hi); }
.objections li { font-size: .92rem; padding: .2rem 0; }
.reply { display: block; color: var(--vellum-dim); margin-top: .15rem; }
.link.small { font-size: .86rem; color: var(--vellum-dim); }
.objection textarea { width: 100%; background: var(--slate-2); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .65rem; color: var(--vellum); margin-top: .4rem; }

/* ---------- character sheet: skills ---------- */
.skills { border: 0; padding: 0; margin: 1rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 .8rem; }
.skills legend { color: var(--vellum-dim); font-size: .92rem; margin-bottom: .3rem; padding: 0; }
label.check.sk { margin: .15rem 0; font-size: .95rem; }
label.check.sk small { color: var(--vellum-dim); font-size: .72rem; }

/* ---------- host ---------- */
.clock-form { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) 5rem 3.6rem; gap: 0 .5rem; align-items: end; }
.clock-form .btn-quiet { grid-column: 1 / -1; justify-self: start; margin-top: .7rem; }
.clock-form.no-hour { grid-template-columns: 3.6rem minmax(0, 1fr) 5rem; }
.facts { display: grid; gap: .3rem; margin: .6rem 0 .8rem; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dotted var(--line); padding: .2rem 0; }
.facts dt { color: var(--vellum-dim); }
.facts dd { margin: 0; text-align: right; }
.errors { padding-left: 1rem; color: var(--danger); font-size: .9rem; }
.host-events { list-style: none; padding: 0; margin: 0; }
.host-events li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.host-events small { display: block; color: var(--vellum-dim); }
h4 { font-weight: 500; margin: .8rem 0 .2rem; }

/* ---------- linked maps ---------- */
.map-crumbs { position: absolute; z-index: 3; top: 112px; left: 14px; max-width: calc(100% - 90px); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; pointer-events: none; }
.map-crumbs:empty { display: none; }
.map-crumbs .trail, .map-crumbs .credit { pointer-events: auto; background: rgba(28, 37, 48, .9); border: 1px solid var(--line); border-radius: 6px; backdrop-filter: blur(4px); }
.map-crumbs .trail { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; padding: .25rem .6rem; font-family: var(--display); font-size: 1.02rem; }
.map-crumbs .trail i { font-style: normal; color: var(--vellum-dim); }
.map-crumbs .trail button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--brass); font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.map-crumbs .credit { margin: 0; padding: .15rem .55rem; font-size: .8rem; color: var(--vellum-dim); }
.map-crumbs .credit a { color: var(--vellum); }
.map-ring { fill: none; stroke: var(--brass); stroke-width: 1.5; stroke-dasharray: 3 2.4; }
.loc.has-map .loc-label { text-decoration: underline; text-decoration-color: rgba(201, 160, 78, .7); text-underline-offset: 3px; }
h3.map-group { font-size: 1.25rem; margin-top: 1.5rem; padding-top: .6rem; border-top: 1px solid var(--line); }
h3.map-group small { font-family: var(--ui); font-size: .78rem; color: var(--verdigris); margin-left: .3rem; }
h4.group { font-family: var(--display); font-size: 1rem; color: var(--brass); margin: 1rem 0 .1rem; font-weight: 400; }
.map-list { list-style: none; padding: 0; margin: 0; }
.map-row { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.map-row b { font-weight: 500; }
.map-row small { color: var(--vellum-dim); }
.map-row .facts-line { display: block; margin-top: .15rem; }
.map-row .actions { margin-top: .5rem; }
.actions label.file { margin: 0; }
.map-row.current b::after { content: ' (on screen)'; color: var(--verdigris); font-weight: 400; font-size: .85rem; }
.map-edit { margin-top: .4rem; }

/* ---------- belongings, people, shops ---------- */
.items-sec { margin-top: 1.6rem; border-top: 1px solid var(--line); }
.items-sec h3 small, .shop h3 small { font-family: var(--ui); font-size: .9rem; color: var(--brass); margin-left: .4rem; }
.items, .wares, .people { list-style: none; padding: 0; margin: 0; }
.items li { display: grid; grid-template-columns: 1fr auto; gap: 0 .8rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.items li small { grid-column: 1; color: var(--vellum-dim); }
.items li .link { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.it-name { font-weight: 500; }
.it-name small { display: block; font-weight: 400; color: var(--vellum-dim); }
.inline-form label.grow { flex: 1; min-width: 12rem; }
.inline-form label > input:not([type=checkbox]), .inline-form label > select { margin-top: .3rem; }
input.qty { width: 4.5rem; }
.wares li { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.price { text-align: right; font-variant-numeric: tabular-nums; color: var(--brass); white-space: nowrap; }
.price small { display: block; color: var(--vellum-dim); font-size: .78rem; }
.wares .btn-quiet:disabled { opacity: .35; cursor: not-allowed; }
.shop { margin-top: 1.4rem; border-top: 1px solid var(--line); }
.npc h2 { margin-top: .2rem; }

/* ---------- quests module ---------- */
.quest { border-left: 3px solid var(--brass); padding: .1rem 0 .6rem .9rem; margin: .8rem 0; }
.quest h4 { font-family: var(--display); font-size: 1.2rem; margin: .4rem 0 .1rem; font-weight: 400; }
.quest.q-done { border-left-color: var(--verdigris); opacity: .85; }
.quest.q-failed { border-left-color: var(--danger); opacity: .75; }
.qlog { list-style: none; padding: 0; margin: .4rem 0; font-size: .9rem; }
.qlog li { padding: .15rem 0; }
.qlog time { color: var(--vellum-dim); font-family: var(--display); font-style: italic; margin-right: .3rem; }

/* ---------- toasts ---------- */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: min(92vw, 460px); }
.toast { background: var(--vellum); color: #18222C; padding: .55rem .9rem; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); font-weight: 500; }
.toast.err { background: #F1C8C2; color: #4A1712; }

/* ---------- phones: the panel becomes a bottom sheet ---------- */
@media (max-width: 760px) {
  .bar { height: 48px; padding: 0 12px; }
  .brand { font-size: 1.15rem; }
  .who { display: none; }
  .stage { height: calc(100% - 48px); grid-template-columns: 1fr; position: relative; }
  #map { height: 100%; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: 46%;
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, .4); transition: height .22s ease;
  }
  .panel[data-size=min] { height: 104px; }
  .panel[data-size=full] { height: calc(100% - 10px); }
  .sheet-handle { display: block; background: none; border: 0; padding: 8px 0 2px; cursor: pointer; flex: none; }
  .sheet-handle span { display: block; margin: 0 auto; width: 42px; height: 4px; border-radius: 2px; background: var(--line); }
  .tabs { padding-top: 0; }
  .seal-wrap { top: 10px; left: 10px; gap: 8px; }
  .seal { width: 64px; height: 64px; }
  .seal-num { font-size: 1.75rem; }
  .seal-small { font-size: .7rem; }
  .zoom { top: 10px; bottom: auto; right: 10px; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .clock-form { grid-template-columns: 3.6rem minmax(0, 1fr) 5rem 3.6rem; }
  .map-hint { top: 84px; }
  .map-crumbs { top: 84px; left: 10px; max-width: calc(100% - 70px); }
  .map-crumbs .trail { font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }

/* ---------- fighting ---------- */
.ro-val { display: block; padding: .45rem .1rem; font-weight: 700; font-size: 1.05rem; }
.fight-sec { margin-top: 1.6rem; border-top: 1px solid var(--line); }
.fight-line { margin: .5rem 0 .2rem; }
.fight-line small { color: var(--vellum-dim); }
.warn { list-style: none; padding: 0; margin: .5rem 0; }
.warn li { color: var(--danger); font-size: .9rem; padding: .15rem 0; }
.warn li::before { content: '! '; font-weight: 700; }
.tactics { margin-top: 1rem; padding: .2rem .9rem .8rem; background: var(--slate-2); border-radius: 8px; }
.tactics h4 { margin: .6rem 0 .1rem; font-family: var(--display); font-weight: 400; font-size: 1.1rem; }
.tactics .check { display: flex; gap: .5rem; align-items: flex-start; margin: .35rem 0; }
.tactics .check input { margin-top: .25rem; }
.blow { margin: .5rem 0 .2rem; }
.blow summary { cursor: pointer; color: var(--brass); font-size: .9rem; }
.blow-log { max-height: 22rem; overflow-y: auto; margin-top: .4rem; padding: .2rem .7rem; border-left: 2px solid var(--line); font-size: .88rem; }
.blow-log h5 { margin: .6rem 0 .2rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--vellum-dim); }
.blow-log p { margin: .15rem 0; }
.k-combat { border-left-color: var(--wax-hi); }
.fight-test .chips { display: flex; flex-wrap: wrap; gap: .2rem 1rem; border: 0; padding: 0; margin: .4rem 0; }
.fight-test .chips legend { width: 100%; padding: 0; margin-bottom: .2rem; }
.fight-result { margin-top: 1rem; padding-top: .6rem; border-top: 1px dashed var(--line); }
.odds-line { font-size: 1.05rem; margin: .2rem 0; }
.odds { width: 100%; border-collapse: collapse; margin: .5rem 0; font-size: .92rem; }
.odds th, .odds td { text-align: left; padding: .3rem .4rem; border-bottom: 1px solid var(--line); }
.odds th { color: var(--vellum-dim); font-weight: 400; font-size: .82rem; }

/* ---------- route editor (host) ---------- */
.route-bar {
  position: absolute; z-index: 4; left: 14px; top: 14px; width: min(340px, calc(100% - 28px)); max-height: 60%; overflow: auto;
  background: var(--slate); border: 1px solid var(--brass); border-radius: 8px; padding: .6rem .7rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
}
.route-bar[hidden] { display: none; }
.rb-top { display: flex; align-items: baseline; gap: .6rem; }
.rb-top b { flex: 1; font-weight: 500; }
.rb-top small, .rb-hint { color: var(--vellum-dim); }
.rb-modes, .rb-draw, .rb-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .45rem; }
.rb-modes .on, .rb-row .on { border-color: var(--brass); color: var(--brass); }
.rb-draw select, .rb-draw input { min-width: 0; flex: 1 1 7rem; }
.rb-hint { margin: .5rem 0 0; font-size: .9rem; }
.rb-report { margin-top: .5rem; border-top: 1px solid var(--line); padding-top: .4rem; font-size: .92rem; }
.rb-report ul { margin: 0; padding-left: 1.1rem; }
.rb-report .link { text-align: left; }
.redge { fill: none; stroke-width: 3; stroke-linecap: round; pointer-events: none; }
.redge.k-street { stroke: var(--vellum); }
.redge.k-road { stroke: var(--brass); stroke-width: 3.5; }
.redge.k-trail { stroke: var(--vellum-dim); stroke-dasharray: 6 5; }
.redge.k-sea { stroke: #5B8FD6; stroke-dasharray: 2 7; stroke-width: 4; }
.redge-hit { stroke: transparent; stroke-width: 18; fill: none; pointer-events: stroke; }
.rlink { stroke: var(--verdigris); stroke-width: 1.5; stroke-dasharray: 3 3; pointer-events: none; }
.rlink.hand { stroke: var(--psionic); }
.rnode .rdot { fill: var(--slate); stroke: var(--vellum); stroke-width: 2; }
.rnode .hit { fill: transparent; }
.rnode.sel .rdot, .rnode.last .rdot { fill: var(--brass); }
.rnode.bad .rdot { stroke: var(--danger); stroke-width: 3; }
.bad-ring { fill: none; stroke: var(--danger); stroke-width: 2.5; }
.arrival-tag circle { fill: var(--verdigris); stroke: var(--sea); stroke-width: 1.5; }
.arrival-tag.sea circle { fill: #5B8FD6; }
.arrival-tag text { font-size: 9px; text-anchor: middle; fill: var(--verdigris-ink); }
@media (max-width: 760px) { .route-bar { top: 84px; left: 10px; max-height: 38%; } }

/* ---------- terrain tool (host) ---------- */
.terrain-tool { position: fixed; inset: 0; z-index: 50; display: flex; background: var(--sea); }
.tt-side { width: 320px; flex: none; overflow: auto; padding: .8rem; background: var(--slate); border-right: 1px solid var(--line); }
.tt-side h4 { margin: .8rem 0 .3rem; }
.tt-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.tt-tools, .tt-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.tt-tools .on { border-color: var(--brass); color: var(--brass); }
.tt-classes { list-style: none; margin: 0; padding: 0; }
.tt-classes li { border-bottom: 1px solid var(--line); padding: .35rem .2rem; display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }
.tt-classes li.on { background: rgba(201, 160, 78, .12); }
.tt-cls { flex: 1 1 100%; display: flex; align-items: center; gap: .5rem; background: none; border: 0; color: inherit; cursor: pointer; text-align: left; padding: .15rem 0; }
.tt-cls i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--line); }
.tt-cls small { margin-left: auto; color: var(--vellum-dim); }
.tt-samples { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.tt-samples button { width: 18px; height: 18px; border-radius: 3px; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.tt-speed { font-size: .85rem; color: var(--vellum-dim); }
.tt-speed input { width: 3.6rem; }
.tt-slider, .tt-check { display: block; margin: .5rem 0; }
.tt-slider input { width: 100%; }
.tt-stage { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; }
.tt-stage canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
@media (max-width: 760px) { .terrain-tool { flex-direction: column; } .tt-side { width: auto; max-height: 45%; border-right: 0; border-bottom: 1px solid var(--line); } }

.tt-stage canvas { transform: none; }
.tt-ring { position: absolute; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #000; pointer-events: none; }
.tt-ring[hidden] { display: none; }
.tt-read { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .6); padding: .15rem .5rem; border-radius: 4px; font-size: .85rem; pointer-events: none; }
.tt-eye { display: inline-flex; align-items: center; }
.tt-classes li { flex-wrap: wrap; }
.tt-cls { flex: 1 1 60%; }
.tt-classes li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .2rem .5rem; }
.tt-classes .tt-cls { flex: none; min-width: 0; }
.tt-classes .tt-samples { grid-column: 2 / 4; min-height: 0; }
.tt-classes .tt-speed { display: flex; align-items: center; gap: .3rem; }
.tt-classes .tt-speed input { width: 3.2rem; padding: .15rem .3rem; }
.tt-actions .tt-speed { display: inline-flex; align-items: center; gap: .3rem; }
.tt-actions .tt-speed input { width: 3.4rem; padding: .15rem .3rem; }

/* ---------- character builder ---------- */
.builder h3 { margin: .9rem 0 .4rem; font-family: var(--display); font-weight: 400; }
.builder h4 { margin: 1rem 0 .35rem; color: var(--vellum-dim); font-weight: 500; font-size: .95rem; }
.builder h4 small { font-weight: 400; }
.steps { list-style: none; display: flex; gap: .3rem; padding: 0; margin: .5rem 0 0; }
.steps li { flex: 1; text-align: center; }
.steps span, .steps button { display: block; width: 100%; padding: .25rem 0; font-size: .85rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--vellum-dim); }
.steps button { cursor: pointer; color: var(--verdigris); border-color: var(--verdigris); }
.steps .now span { border-color: var(--brass); color: var(--brass); }
.picks { display: flex; flex-direction: column; gap: .4rem; }
.pick { display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: left; padding: .6rem .75rem; background: var(--slate-2); border: 1px solid var(--line); border-radius: 8px; color: var(--vellum); font: inherit; cursor: pointer; min-height: 44px; }
.pick small { color: var(--vellum-dim); font-size: .86rem; }
.pick.on { border-color: var(--verdigris); box-shadow: inset 3px 0 0 var(--verdigris); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .4rem .7rem; min-height: 40px; background: var(--slate-2); border: 1px solid var(--line); border-radius: 20px; color: var(--vellum); font: inherit; font-size: .92rem; cursor: pointer; }
.chip.on { border-color: var(--verdigris); background: rgba(79, 163, 142, .18); }
.chip:disabled { opacity: .4; cursor: default; }
.pts { font-size: 1.1rem; margin: .2rem 0; position: sticky; top: 0; z-index: 1; padding: .3rem 0; background: var(--slate); }
.pts b { font-family: var(--display); font-size: 1.8rem; color: var(--brass); }
.pts.zero b { color: var(--verdigris); }
.pt-list { list-style: none; padding: 0; margin: .5rem 0; }
.pt-row { display: grid; grid-template-columns: 1fr 44px 3ch 44px 3ch 3.5ch 3.5ch; gap: .35rem; align-items: center; padding: .25rem 0; }
.pt-row button { min-height: 40px; padding: 0; }
.pt-val, .pt-fin { text-align: center; font-family: var(--display); font-size: 1.2rem; }
.pt-bonus, .pt-mod { text-align: center; color: var(--vellum-dim); }
.builder .need { color: var(--danger); min-height: 1.2em; }
.builder .actions { margin-top: .8rem; }
.review p { margin: .45rem 0; }
