/* Theme variables. These are Cover's (the default); themes.js swaps the colours for the theme a
   comm is wearing. Fonts, sizes and layout never change between themes. */
:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2027;
  --line: #2a3139;
  --line-2: #3d4651;
  --text: #e7eaee;
  --muted: #8e98a3;
  --accent: #f05a28;
  --accent-ink: #ffffff;
  --ok: #46c08a;
  --bad: #e5534b;
  --info: #4fa3ff;
  --handout: #b48cff;
  --warn: #d9a441;
  --zone-a: #8a6a1e;
  --zone-r: #7a2d2a;
  --secret: #3d2f5c;
  --bar: #0d1014;
  --bar-hi: #1d2229;
  --glass: #1c222a;
  --scan: 0.018;
  --radius: 10px;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'SF Mono', monospace;
  /* Condensed capitals for headings, after the rulebook's headings (system fonts only). */
  --display: 'Bahnschrift', 'Avenir Next Condensed', 'Roboto Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100dvh;
}
.mono { font-family: var(--mono); }
/* links take the second accent (the accent itself when a theme has no second one) */
a { color: var(--accent-2, var(--accent)); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- Comm OS: status bar, home screen, app drawer, app bar (os.js) ---------- */
:root { --sb-h: 38px; }
.statusbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--sb-h); display: flex; align-items: center; gap: 10px;
  padding: 0 16px; padding-top: env(safe-area-inset-top);
  background:
    radial-gradient(circle at 7px 50%, var(--line-2) 0 1.6px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 7px) 50%, var(--line-2) 0 1.6px, transparent 2.2px),
    linear-gradient(180deg, var(--bar-hi), var(--bar));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--bar-hi) 60%, transparent) inset;
  font-size: 13px; white-space: nowrap;
}
.sb-home { background: none; border: 0; padding: 4px 6px; margin-left: -6px; border-radius: 6px; cursor: pointer; color: inherit; font: inherit; }
.sb-home:hover, .sb-home:focus-visible { background: var(--panel-2); outline: none; }
.brand { font-family: var(--display); font-stretch: condensed; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); font-size: 14px; font-weight: 700; }
.sb-date { color: var(--text); font-size: 12px; }
.sb-where { color: var(--muted); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-online { color: var(--muted); }
.sb-icon, .sb-who { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 3px 6px; border-radius: 99px; }
.sb-icon:hover, .sb-who:hover { background: var(--panel-2); }
.sb-icon .badge { margin-left: 0; }
/* Play modes (modes.js): the switch, and what each mode hides. */
.sb-mode { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.sb-mode.own { border-color: var(--accent); }
body.hide-dms .rule-aid, body.hide-dms .roll-hint, body.hide-dms .mk-dms { display: none !important; }
body:not(.roll-for-me) .roll-me { display: none !important; }
body.roll-for-me .table-roll-only { display: none !important; }
.mode-pick { display: grid; gap: 8px; }
.mode-pick label { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.mode-pick label:has(input:checked) { border-color: var(--accent); }
.mode-pick .muted { grid-column: 2; }
/* Keep the screen on (pwa.js): bright when on, dim when the screen may sleep. */
.sb-awake { color: var(--accent); font-size: 15px; line-height: 1; }
.sb-awake.off { color: var(--muted); }
.sb-who { max-width: 40vw; }
.sb-who #who { overflow: hidden; text-overflow: ellipsis; }
.sb-who .sb-avatar { width: 22px; height: 22px; font-size: 9px; }
.conn { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); white-space: nowrap; }
.conn::before { content: '●'; margin-right: 5px; }
.conn.ok { color: var(--ok); }
.conn.pending { color: var(--accent); }
.conn.bad { color: var(--bad); }
@media (max-width: 560px) {
  .sb-where { display: none; }
  .conn { font-size: 0; padding: 0; border: 0; } /* just the light */
  .conn::before { font-size: 13px; margin: 0; }
  .sb-who #who { display: none; }
}

/* home screen: the campaign at a glance, like a phone's clock — set like a cover headline */
.drawer-head { text-align: center; padding: 34px 16px 10px; }
.dh-campaign { font-family: var(--display); font-stretch: condensed; font-size: 15px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--text); opacity: .85; }
.dh-date { font-family: var(--display); font-stretch: condensed; font-size: 60px; font-weight: 700; letter-spacing: 0.06em; line-height: 1.05; margin-top: 6px; }
/* the angled accent stroke under the date */
.dh-date::after { content: ''; display: block; width: 180px; height: 3px; margin: 10px auto 0; transform: skewX(-35deg); background: linear-gradient(90deg, transparent, var(--accent) 25%, var(--accent-2, var(--accent)) 75%, transparent); }
.dh-where { font-size: 14px; margin-top: 10px; }

/* the app drawer */
.drawer {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 22px 8px; max-width: 640px; margin: 0 auto; padding: 18px 16px 48px;
}
/* in groups (Traveller, Ship, Referee): each group's name, then its icons on the same grid */
.drawer.grouped { display: block; }
.drawer-group + .drawer-group { margin-top: 26px; }
.dg-title {
  margin: 0 4px 12px; font-family: var(--display); font-stretch: condensed; font-size: 13px; font-weight: 700;
  letter-spacing: .24em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.dg-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.dg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 22px 8px; }
@media (max-width: 480px) {
  .drawer { grid-template-columns: repeat(4, 1fr); gap: 20px 4px; padding: 14px 10px 40px; }
  .dg-tiles { grid-template-columns: repeat(4, 1fr); gap: 20px 4px; }
  .app-icon { width: 56px; height: 56px; border-radius: 15px; }
  .app-name { font-size: 11px; }
  .app-badge { left: calc(50% + 16px); }
  .dh-date { font-size: 38px; }
}
.app-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; padding: 6px 0; border-radius: 14px; -webkit-tap-highlight-color: transparent; }
.app-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-icon {
  width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
  box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 6px 14px rgba(0,0,0,.35);
  transition: transform .12s ease;
}
/* App icons wear the theme (themes.js ICON_STYLES): solid = button-text glyph on a button-coloured
   tile; hollow = button-coloured glyph on an input-coloured tile ringed in the button colour. */
.app-icon, .app-screen-icon, .bn-icon { background: var(--accent); color: var(--accent-ink); }
[data-icons='hollow'] .app-icon, [data-icons='hollow'] .app-screen-icon, [data-icons='hollow'] .bn-icon {
  background: var(--panel-2); color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent) inset;
}
[data-icons='hollow'] .app-icon { box-shadow: 0 0 0 2px var(--accent) inset, 0 6px 14px rgba(0,0,0,.25); }
.app-tile:hover .app-icon { transform: translateY(-2px); }
.app-tile:active .app-icon { transform: scale(.94); }
.app-name { font-size: 12px; line-height: 1.2; text-align: center; color: var(--text); max-width: 84px; }
.app-badge { position: absolute; top: 0; left: calc(50% + 18px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; box-shadow: 0 0 0 2px var(--bg); }

/* the open app's title bar */
.appbar {
  position: sticky; top: var(--sb-h); z-index: 15;
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bar-hi) 70%, var(--bg)), color-mix(in srgb, var(--bar) 60%, var(--bg)));
  border-bottom: 1px solid var(--line);
}
/* The open app's name on an accent tab at the page edge, like a rulebook chapter tab. */
.edge-tab {
  position: fixed; right: 0; top: calc(var(--sb-h) + 96px); z-index: 14;
  writing-mode: vertical-rl; padding: 16px 7px; border-radius: 10px 0 0 10px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-stretch: condensed; font-weight: 700; font-size: 15px; letter-spacing: 0.1em; text-transform: uppercase;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); pointer-events: none;
}
@media (max-width: 900px) { .edge-tab { display: none; } }
.app-back { background: none; border: 0; color: var(--accent-2, var(--accent)); font: inherit; font-size: 15px; cursor: pointer; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.app-back:hover, .app-back:focus-visible { background: var(--panel-2); outline: none; }
.app-screen-icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex: none; }
.appbar h1 { margin: 0; font-family: var(--display); font-stretch: condensed; font-size: 20px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* account profile (profile.js) */
.profile { max-width: 640px; margin: 0 auto; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile .profile-avatar { width: 56px; height: 56px; font-size: 20px; }
.profile-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-who strong { font-size: 17px; }
.session-row .profile-who strong { font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; background: var(--sw); border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg) inset; }
.session-row { padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.session-row:last-child { border-bottom: 0; }

/* theme pickers (profile.js, themesadmin.js) */
.theme-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-tile { display: flex; flex-direction: column; gap: 6px; align-items: stretch; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; color: var(--text); font: inherit; text-align: left; }
.theme-tile:hover { border-color: var(--line-2); }
.theme-tile.on { border-color: var(--accent); }
.theme-swatch { display: block; height: 34px; border-radius: 6px; box-shadow: 0 0 0 1px rgba(0,0,0,.25) inset; }
.theme-swatch.small { width: 56px; height: 20px; flex: none; }
.theme-name { font-family: var(--display); font-stretch: condensed; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.theme-row input[type='color'] { width: 44px; height: 32px; padding: 2px; flex: none; }
.theme-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; margin-top: 10px; }
.theme-color { display: flex; align-items: center; gap: 10px; cursor: pointer; }

/* notification banners, dropping from under the status bar (os.js banner()) */
#banners { position: fixed; top: calc(var(--sb-h) + 8px); left: 50%; transform: translateX(-50%); z-index: 60; width: min(420px, calc(100vw - 20px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.banner {
  pointer-events: auto; background: color-mix(in srgb, var(--glass) 96%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 12px 11px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); touch-action: pan-x;
  animation: bn-in .22s ease-out both;
}
.banner.tappable { cursor: pointer; }
.banner.leaving { animation: bn-out .2s ease-in both; }
.banner.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--line-2)); }
@keyframes bn-in { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes bn-out { to { opacity: 0; transform: translateY(-14px); } }
@media (prefers-reduced-motion: reduce) { .banner, .banner.leaving { animation: none; } }
.bn-head { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.bn-icon { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex: none; }
.bn-app { text-transform: uppercase; letter-spacing: .06em; }
.bn-time { margin-left: auto; }
.bn-close { background: none; border: 0; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px 0 6px; }
.bn-close:hover { color: var(--text); }
.bn-title { font-weight: 600; margin-top: 5px; }
.bn-body { font-size: 14px; color: var(--text); opacity: .9; margin-top: 2px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bn-actions { display: flex; gap: 8px; margin-top: 8px; }

.badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

main { padding: 16px; max-width: 1280px; margin: 0 auto; }

/* ---------- building blocks ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 3%, transparent) inset; }
[data-base='light'] .card { box-shadow: 0 1px 3px rgba(20, 24, 28, .08); }
/* Card headings in condensed capitals, after the rulebook's, with a slanted accent bar. */
.card h2, .card h3 { margin: 0 0 12px; font-family: var(--display); font-stretch: condensed; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.card h2::before, .card h3::before { content: ''; flex: none; width: 14px; height: 4px; background: var(--accent); transform: skewX(-35deg); }
.upp { color: var(--accent); letter-spacing: 0.15em; font-size: 15px; text-transform: none; }

.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; font: inherit; cursor: pointer; min-height: 38px;
}
.btn:hover { border-color: var(--line-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { padding: 2px 10px; min-height: 32px; min-width: 32px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

input, textarea, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 16px; /* 16px stops iOS zooming on focus */
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
input[type='number'] { font-family: var(--mono); }
input[type='checkbox'], input[type='radio'] { width: auto; accent-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }
.field.secret > span { color: var(--handout); }
.field.secret textarea { border-color: var(--secret); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 12px; }
.grid .wide { grid-column: 1 / -1; }

/* ---------- character sheet ---------- */
.char-head, .char-row { display: grid; grid-template-columns: 44px 150px 14px 64px 44px; gap: 8px; align-items: center; }
.char-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.char-row { padding: 4px 0; border-top: 1px solid var(--line); }
.char-row .char-name { font-family: var(--mono); font-weight: 700; }
.char-row.physical .char-name { color: var(--accent); }
.char-row.reduced input[data-path$='.cur'] { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.char-row .of { color: var(--muted); text-align: center; }
.char-row .dm { font-family: var(--mono); text-align: right; }
.stepper { display: grid; grid-template-columns: 34px 1fr 34px; gap: 4px; }
.stepper input { text-align: center; padding: 6px 2px; }
.char-row input[data-path$='.max'] { text-align: center; padding: 6px 2px; }
/* The Calendar: Timeline and Upcoming (calendar.js) */
.tl-day + .tl-day { margin-top: 12px; }
.tl-date { margin: 0 0 4px; font-size: 13px; color: var(--accent); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-item { border-top: 1px solid var(--line); }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; width: 100%; background: none; border: 0; color: var(--text); font: inherit; text-align: left; padding: 7px 2px; }
button.tl-head { cursor: pointer; }
button.tl-head:hover { background: var(--panel-2); }
.tl-time { color: var(--muted); min-width: 3.2em; }
.tl-text { flex: 1 1 200px; }
.tl-item.cp .tl-text { color: var(--muted); font-style: italic; }
.tl-item.skipped .tl-text { text-decoration: line-through; color: var(--muted); }
.tl-item.flag-changed { border-left: 3px solid var(--warn); }
.tl-item.flag-failed { border-left: 3px solid var(--bad); }
.tl-item.overdue .tl-text { color: var(--bad); }
.tl-panel { padding: 6px 2px 12px 3.2em; display: flex; flex-direction: column; gap: 8px; }
.tl-summary { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; flex: 1 1 260px; }
.tl-summary h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tl-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.tl-people { margin: 6px 0 0; padding-left: 18px; }
.tl-compare { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-fix, .tl-preview { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tl-branches { margin-bottom: 10px; }
.tl-branches ul { list-style: none; padding: 0; margin: 6px 0 0; }
.tl-branches li { padding: 6px 0; border-top: 1px solid var(--line); }
@media (max-width: 520px) { .tl-panel { padding-left: 2px; } }
/* The combat tracker (combat.js) */
.combat-app { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.combat-app .card { margin: 0; }
.cb-order { padding: 4px 0; }
.cb-row { border-top: 1px solid var(--line); }
.cb-row:first-child { border-top: 0; }
.cb-row.turn { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cb-row.downed .cb-name { text-decoration: line-through; color: var(--muted); }
.cb-row.side-foe .cb-place { color: var(--bad); }
.cb-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; width: 100%; background: none; border: 0; color: var(--text); font: inherit; text-align: left; padding: 10px 12px; cursor: pointer; }
.cb-head:hover { background: var(--panel-2); }
.cb-place { width: 1.6em; color: var(--accent); font-weight: 700; }
.cb-name { flex: 1 1 140px; font-weight: 600; }
.cb-phys { display: inline-flex; gap: 8px; }
.cb-phys .low { color: var(--bad); }
.cb-state.st-wounded, .cb-state.st-unhurt { color: var(--warn); }
.cb-state.st-ok, .cb-state.st-unhurt { color: var(--muted); }
.cb-state.st-unconscious, .cb-state.st-dead, .cb-state.st-down { color: var(--bad); font-weight: 600; }
.tag.side.foe { color: var(--bad); }
.tag.side.crew { color: var(--accent); }
.tag.turn { color: var(--accent); border-color: var(--accent); }
.cb-hull { display: inline-flex; align-items: center; gap: 6px; }
.cb-bar { display: inline-block; width: 80px; height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.cb-bar span { display: block; height: 100%; background: var(--accent); }
.cb-ranges { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0 12px 8px 40px; }
.cb-ranges select { padding: 2px 4px; }
.cb-panel { padding: 4px 12px 12px 40px; display: flex; flex-direction: column; gap: 10px; }
.cb-form { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.cb-form h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.cb-form > .btn { margin-top: 8px; }
.cb-facts, .cb-mounts { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.cb-crits { margin: 0; padding-left: 18px; color: var(--bad); }
.cb-salvo { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.cb-pending { border-color: var(--bad); }
.cb-chars { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.cb-log { list-style: none; margin: 6px 0 0; padding: 0; max-height: 360px; overflow-y: auto; }
.cb-log li { padding: 4px 0; border-top: 1px solid var(--line); font-size: 13px; }
.cb-archive { margin-top: 10px; }
@media (max-width: 520px) { .cb-panel, .cb-ranges { padding-left: 12px; } }
/* Worlds: the TravellerMap import's preview (worlds.js) */
.tm-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; border-top: 1px solid var(--line); }
.tm-row { display: flex; gap: 8px; align-items: baseline; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.tm-row .tm-name { flex: 1; min-width: 0; }
/* Scenes' two tabs, Scenes and Prepared (scenes.js), and Transmissions' From Prepared picker */
.sc-tabs { margin-bottom: 12px; }
.pick-prepared { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.pick-row { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); padding: 8px 4px; font: inherit; cursor: pointer; }
.pick-row:hover, .pick-row:focus-visible { background: var(--panel-2); outline: none; }
/* Missions and the Jobs board (missions.js, v1.0 step 6) */
.ms-tabs { margin-bottom: 12px; }
.ms-tabs .badge { margin-left: 6px; }
.ms-group + .ms-group { margin-top: 14px; }
.ms-group > summary { cursor: pointer; margin: 6px 0; }
.ms-card { border-top: 1px solid var(--line); }
.ms-card.overdue .ms-title strong { color: var(--bad); }
.ms-head { display: flex; gap: 10px; align-items: center; padding: 10px 2px; cursor: pointer; }
.ms-head:hover { background: var(--panel-2); }
.ms-title { flex: 1; min-width: 0; }
.ms-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tag.ms-ok { color: var(--accent); }
.tag.ms-warn { color: var(--warn); }
.tag.ms-bad { color: var(--bad); }
.tag.ms-info { color: var(--text); }
.ms-body { padding: 0 2px 12px; }
.ms-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; margin-bottom: 8px; }
.ms-brief { white-space: pre-wrap; margin: 6px 0 10px; }
.ms-steps { list-style: none; padding: 0; margin: 0 0 10px; }
.ms-steps li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.ms-steps li label { display: flex; gap: 8px; align-items: center; flex: 1; }
.ms-steps li.done span { text-decoration: line-through; color: var(--muted); }
.ms-steps li.hidden-step span { font-style: italic; }
.ms-actions { gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ms-log ul { list-style: none; padding: 0; margin: 4px 0 0; }
.ms-step-edit { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ms-step-edit .row { width: 100%; }
.ms-pay { display: flex; flex-direction: column; gap: 6px; }
.ms-pay label { display: flex; gap: 8px; align-items: center; }
.ms-roll { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; }
.ms-roll dt { color: var(--muted); }
.ms-roll dd { margin: 0; }
.missions-app .linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
/* Pickers for the table's results (outcomes.js) */
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pick-bands { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pick-bands .btn { text-align: left; white-space: normal; }
.pick-effect .pick-numbers { margin-top: 6px; }
.btn.pick.ok { border-color: var(--good, #3fb950); }
.btn.pick.bad { border-color: var(--bad, #e5534b); }
.btn.pick.chosen { outline: 2px solid var(--accent); }
.btn.pick.num { min-width: 2.6em; }
.pick-table { display: flex; flex-direction: column; gap: 2px; }
.pick-table-head { display: grid; grid-template-columns: 3em 1fr; gap: 8px; padding: 0 6px; }
.pick-table-row { display: grid; grid-template-columns: 3em 1fr; gap: 8px; text-align: left; padding: 6px; background: none; border: 1px solid var(--line, #333); border-radius: 6px; color: inherit; font: inherit; cursor: pointer; }
.pick-table-row:hover, .pick-table-row:focus-visible { border-color: var(--accent); }
/* The character builder (builder.js) */
.builder-app { max-width: 1100px; margin: 0 auto; }
.build-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line, #333); padding: 10px 2px; color: inherit; font: inherit; cursor: pointer; }
.build-row:first-of-type { border-top: 0; }
.build-current { border-color: var(--accent); }
.build-step h4 { margin: 0 0 6px; }
.build-step > * + * { margin-top: 8px; }
.build-event { margin: 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--panel-2, rgba(127,127,127,.08)); font-size: .92em; }
.build-ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.build-choices { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.build-choices .btn { text-align: left; white-space: normal; }
.build-choices select { width: auto; min-width: 9em; }
.build-choices .row { flex-wrap: nowrap; align-items: center; }
.build-table { margin: 4px 0; padding-left: 22px; columns: 2; }
.build-muster { border-collapse: collapse; }
.build-muster td, .build-muster th { padding: 2px 10px 2px 0; text-align: left; }
.build-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: start; }
@media (max-width: 760px) { .build-cols { grid-template-columns: 1fr; } .build-table { columns: 1; } }
.build-upp { font-size: 1.4em; letter-spacing: 0.1em; }
.build-sheet h4 { margin: 10px 0 4px; }
.build-log h5 { margin: 8px 0 2px; color: var(--muted); }
.build-log ul { margin: 0; padding-left: 18px; }
/* Medical (medical.js) */
.med-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-family: var(--mono, monospace); font-size: 0.9em; }
.med-stat.down { color: var(--bad, #e5534b); font-weight: 600; }
.med-card details.sub { margin-top: 6px; }
.med-log { margin: 6px 0 0; padding-left: 18px; }
.medical-app .small-num { width: 5em; }
.medical-app .wide { grid-column: 1 / -1; }
.field.check { display: flex; flex-direction: row; gap: 8px; align-items: center; }
/* the fuller sheet (v1.0 step 3): Mongoose's two sides */
.sheet-side { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 18px 2px 8px; }
.sheet-side:first-child { margin-top: 0; }
.sheet-hint { font-weight: 400; }
.sheet-sub { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.sheet .list-row input[type='checkbox'] { justify-self: center; width: 20px; height: 20px; }
.load { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.load-bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.load-bar span { display: block; height: 100%; background: var(--accent); }
.load.heavy .load-bar span { background: var(--warn); }
.load.over .load-bar span { background: var(--bad); }
.warn-text { color: var(--warn); }
.bad-text { color: var(--bad); }
.sheet-people-group + .sheet-people-group { margin-top: 4px; }
.sheet-person { display: block; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: var(--text); padding: 8px 2px; font: inherit; cursor: pointer; }
.sheet-person:hover { background: var(--panel-2); }
.sheet-changes summary { cursor: pointer; list-style-position: inside; }
.sheet-history-list { list-style: none; margin: 0; padding: 0; }
.sheet-history-list li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); }
.sheet-history-list li > span:nth-child(3) { flex: 1 1 200px; }
.sheet-history-list li.undone > span:nth-child(3) { text-decoration: line-through; color: var(--muted); }

/* editable lists (skills, crew, cargo) */
.list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.list-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.list-row input { min-width: 0; }
.list-row .row-note { flex: 1 0 100%; margin-top: -2px; font-size: 12px; color: var(--warn); }
.list-row.head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.list-row > .btn, .rm-space { flex: 0 0 34px; }
@media (max-width: 520px) { .list-row.head { display: none; } .list-row { padding-bottom: 8px; border-bottom: 1px solid var(--line); } }

/* ship status */
.pair-row { display: grid; grid-template-columns: 56px 150px 14px 74px 40px 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.pair-row:first-of-type { border-top: 0; }
.pair-row .pair-name { font-weight: 600; }
.pair-row .of { color: var(--muted); text-align: center; }
.pair-row input[data-path$='.max'] { text-align: center; padding: 6px 2px; }
.meter { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.3s; }
.meter.low span { background: var(--accent); }
.meter.over span { background: var(--bad); }
@media (max-width: 520px) {
  .pair-row { grid-template-columns: 48px 1fr 10px 64px; }
  .pair-row > :nth-child(5) { display: none; }
  .pair-row .meter { grid-column: 1 / -1; }
}

/* money */
.pos { color: var(--ok); }
.neg, .low { color: var(--bad); }
.big-balance { font-size: 30px; font-weight: 700; color: var(--accent); }
.big-balance.neg { color: var(--bad); }

/* the ship's bills (billspanel.js) */
.bills-next { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 8px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.bills-next strong { font-size: 18px; }
.bill-list, .bills-overdue { display: flex; flex-direction: column; }
.bill-row { display: grid; grid-template-columns: 1fr 110px 74px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bill-row:last-child { border-bottom: 0; }
.bill-row > .mono { text-align: right; }
.bill-name { display: flex; flex-direction: column; min-width: 0; }
.bill-detail { overflow: hidden; text-overflow: ellipsis; }
.bill-row.skipped .bill-name, .struck { text-decoration: line-through; opacity: .6; }
.bill-amt { text-align: right; padding: 4px 6px; }
.warn-line { color: var(--warn); margin: 8px 0 0; }
.warn-box { margin: 8px 0 0; padding: 8px 10px; border: 1px solid var(--warn); border-left-width: 3px; border-radius: 6px; background: color-mix(in srgb, var(--warn) 10%, transparent); }
.warn-box strong { color: var(--warn); }
.warn-box.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.warn-box.bad strong { color: var(--bad); }
.bills-overdue { margin-top: 12px; padding: 8px 10px; border: 1px solid var(--bad); border-radius: 8px; background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.bills-overdue .bill-row { grid-template-columns: 1fr 100px auto; }
.bills-notes { margin-top: 10px; }
.bills-notes p { margin: 4px 0; }
.bills-past { margin-top: 10px; }
.bills-past > summary { cursor: pointer; color: var(--muted); }
.bills-run { padding: 6px 0 4px; border-bottom: 1px solid var(--line); }
.bills-run .bill-row { grid-template-columns: 1fr 100px 90px; border: 0; padding: 2px 0; }
.tag.bill-paid { color: var(--ok); }
.tag.bill-overdue { color: var(--bad); }
.tag.bill-skipped, .tag.bill-waived { color: var(--muted); }
@media (max-width: 480px) { .bill-row { grid-template-columns: 1fr 92px 60px; gap: 6px; } }

/* ledger lines open their receipt (receipt.js) */
.ledger .linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; min-width: 0; }
.ledger .linkish:hover, .ledger .linkish:focus-visible { text-decoration: underline; outline: none; }
.rc-icon { color: var(--accent-2, var(--accent)); }
.receipt { font-size: 14px; background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 6px; padding: 12px 14px; margin-top: 6px; }
.rc-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px dashed var(--line-2); }
.rc-issuer { font-family: var(--display); font-stretch: condensed; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.rc-lines { padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.rc-line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.rc-amt, .rc-total strong { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.rc-total { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line-2); font-size: 15px; }
.rc-facts { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; font-size: 13px; }
.rc-facts > div { display: flex; justify-content: space-between; gap: 12px; }
.rc-facts > div > span:first-child { color: var(--muted); }
.rc-facts > div > span:last-child { text-align: right; }
.rc-note { color: var(--muted); font-size: 12px; margin: 4px 0 0; }

/* the Engineering app (engineering.js) */
.engineering { gap: 10px; }
.eng-card h3 { margin-bottom: 6px; }
/* the open tab's card (tabs: tabbar.js) */
.engineering { display: flex; flex-direction: column; gap: 0; }
.eng-panel { margin-top: 0; }
.eng-head .chev { color: var(--muted); }
.eng-mini { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
/* the open tab's boxes, at the top of its card */
.eng-mini.big { gap: 3px; margin: 0 0 10px; }
.eng-mini.big .mb { width: 14px; height: 14px; border-radius: 3px; }
.eng-mini.big .mb.mw { width: 20px; height: 20px; }
.engineering > .eng-card:last-child { margin-top: 14px; }
.mb { width: 9px; height: 9px; border-radius: 2px; background: var(--bg); border: 1px solid var(--line); }
.mb.k-hull { background: var(--ok); border-color: transparent; }
.mb.k-damage { background: var(--bad); border-color: transparent; }
.mb.k-jury { background: var(--warn); border-color: transparent; }
.mb.k-fuel { background: var(--info); border-color: transparent; }
.mb.k-unrefined { background: #c9a24a; border-color: transparent; }
.mb.k-water { background: #34c49a; border-color: transparent; }
.mb.k-spares { background: #8a7bd1; border-color: transparent; }
.mb.mw { width: 12px; height: 12px; border-radius: 3px; }
.mb.mw.done { background: var(--ok); border-color: transparent; }
.mb.mw.late { background: var(--bad); border-color: transparent; }
.eng-act { gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.eng-crit { border: 1px solid var(--line); border-left: 3px solid var(--bad); border-radius: 0 8px 8px 0; background: var(--panel-2); padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.eng-crit.jury { border-left-color: var(--warn); }
.eng-ref { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 6px; }
.eng-ref > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.eng-warn { border-left: 3px solid var(--warn); padding: 6px 10px; background: var(--panel-2); border-radius: 0 6px 6px 0; }
.maint-weeks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.maint-boxes { display: flex; flex-wrap: wrap; gap: 4px; }
.mw { width: 22px; height: 22px; border-radius: 5px; background: var(--bg); border: 1px solid var(--line); }
.mw.done { background: var(--ok); border-color: transparent; }
.mw.late { background: var(--bad); border-color: transparent; }
.eng-facts { display: flex; flex-direction: column; gap: 3px; }
.eng-facts > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.eng-log { display: flex; flex-direction: column; gap: 3px; max-height: 260px; overflow-y: auto; }

/* where the ship goes at a world (jumps.js stayBox) */
.stay-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin: 8px 0; }
.stay-opt { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; color: var(--text); font: inherit; cursor: pointer; }
.stay-opt:hover:not(:disabled) { border-color: var(--line-2); }
.stay-opt.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); cursor: default; }
.stay-opt:disabled:not(.on) { opacity: .5; cursor: not-allowed; }
.stay-fuel { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.trade-port-note { border-left: 3px solid var(--warn); }

/* Impersonate player (referee's group) */
.viewas-list { display: flex; flex-direction: column; gap: 8px; }
.viewas-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; cursor: pointer; }
.viewas-card:hover, .viewas-card:focus-visible { border-color: var(--accent); outline: none; }
.viewas-who { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.viewas-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewas-card .chev { color: var(--muted); font-size: 20px; }

/* a Traveller's contacts (purse.js) */
.purse-contacts { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.purse-contacts .chip { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.purse-section > summary { cursor: pointer; padding: 4px 0; }

/* profit and loss (reports.js) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--panel-2); color: var(--text); border: 0; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on { background: var(--accent); color: var(--accent-ink); }
.pl-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.pl-totals > div { display: flex; flex-direction: column; gap: 2px; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.pl-totals .mono, .pl-totals strong { font-size: 16px; }
.pl-cats { display: flex; flex-direction: column; }
.pl-cat { display: grid; grid-template-columns: 1fr 110px 110px; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.pl-cat > .mono, .pl-cat.head > span:not(:first-child) { text-align: right; }
.pl-cat:last-child { border-bottom: 0; }
.pl-sub { margin: 16px 0 6px; font-family: var(--display); font-stretch: condensed; letter-spacing: .05em; text-transform: uppercase; }
.pl-courses { display: flex; flex-direction: column; gap: 6px; }
.pl-course { border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.pl-chead { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.pl-cname { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pl-cname .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-cbody { padding: 0 10px 10px; }
.pl-stop { display: grid; grid-template-columns: 1fr 100px 100px 100px; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.pl-stop > .mono, .pl-stop > strong { text-align: right; }
@media (max-width: 480px) {
  .pl-cat { grid-template-columns: 1fr 86px 86px; }
  .pl-stop { grid-template-columns: 1fr 76px 76px 76px; gap: 4px; }
  .pl-totals .mono, .pl-totals strong { font-size: 14px; }
}
.ledger .entry { display: grid; grid-template-columns: 86px 1fr 120px 120px 34px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.ledger .amt, .ledger .bal { text-align: right; }
@media (max-width: 620px) {
  .ledger .entry { grid-template-columns: 1fr auto 34px; gap: 2px 10px; }
  .ledger .date { grid-column: 1 / -1; font-size: 12px; }
  .ledger .bal { display: none; }
}

.narrow { max-width: 880px; }

/* dice */
.split.dice-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.preview { font-size: 13px; color: var(--accent); margin: 10px 0 0; word-break: break-word; }
.log { display: flex; flex-direction: column; gap: 8px; max-height: 75dvh; overflow-y: auto; }
.roll { background: var(--panel-2); border-left: 3px solid var(--line); border-radius: 0 8px 8px 0; padding: 8px 12px; }
.roll.ok { border-left-color: var(--ok); }
.roll.fail { border-left-color: var(--bad); }
.roll-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.roll-head .who { font-weight: 600; }
.roll-body { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 2px; }
.dice { display: inline-flex; gap: 4px; }
.die { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg); font-family: var(--mono); font-weight: 700; }
.die.dropped { opacity: 0.35; text-decoration: line-through; }
.roll .total { font-size: 22px; font-weight: 700; color: var(--accent); }
.roll.ok .verdict strong { color: var(--ok); }
.roll.fail .verdict strong { color: var(--bad); }
.latest { margin-bottom: 14px; }
.latest .roll { padding: 12px 14px; }
.latest .roll .total { font-size: 30px; }
.latest.flash .roll { animation: flash 0.6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--accent); } to { box-shadow: 0 0 0 0 transparent; } }
.tag.secret { color: var(--handout); }
.tag.shared { color: var(--ok); }
.msg.check { border-left-color: var(--accent); }
.popup.check { border-top-color: var(--accent); }

/* worlds */
.route-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.world-card.zone-A { border-color: var(--zone-a); }
.world-card.zone-R { border-color: var(--zone-r); }
.world-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
/* a world card folded down to its heading (Courses tab: where the ship is) */
.world-card.foldable { cursor: pointer; }
/* Folded world cards share one layout: label and ▸ on the top line, the world under it. */
.world-card.foldable .world-top { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 6px; align-items: center; }
.world-card.foldable .world-top .fold-title { grid-column: 1; grid-row: 1; }
.world-card.foldable .world-top .chev { grid-column: 2; grid-row: 1; }
.world-card.foldable .world-top .world-head { grid-column: 1 / -1; grid-row: 2; }
.world-card.foldable .world-top .spacer { display: none; }
/* …and, side by side on the Trade app, the same height while folded. */
/* Side by side (laptop), the two folded cards match heights; stacked (phone), they're as short as
   their content. */
@media (min-width: 821px) {
  .route-cards .world-card.foldable:not(:has(.world-body)) { min-height: 104px; }
  .route-cards:not(:has(.world-body)) { align-items: stretch; }
}
.route-cards > .world-card { margin: 0; }
.world-card.foldable.empty { cursor: default; }
.world-card.foldable.empty:hover { border-color: var(--line); }
.world-card.foldable .world-head { margin-bottom: 0; }
.world-card.foldable .fold-title { text-transform: uppercase; letter-spacing: .08em; }
.world-card.foldable:hover, .world-card.foldable .world-top:focus-visible { border-color: var(--accent); outline: none; }
.world-card.foldable .chev { color: var(--muted); }
.world-card.foldable .world-body { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.world-name { font-size: 18px; font-weight: 700; }
.world-head .uwp { color: var(--accent); letter-spacing: 0.1em; font-size: 16px; }
.zone-tag.A { color: var(--accent); }
.zone-tag.R { color: var(--bad); }
.codes { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.code { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--info); cursor: help; }
.uwp-grid { display: grid; grid-template-columns: auto 22px 1fr; gap: 3px 10px; font-size: 14px; }
.uwp-row { display: contents; }
.code-digit { color: var(--accent); text-align: center; }
.secret-note { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--handout); background: var(--panel-2); white-space: pre-wrap; }
.preview-card .world-card { margin: 12px 0 0; background: var(--panel-2); }

/* trade */
.split.trade-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.card h4 { margin: 14px 0 6px; font-size: 13px; color: var(--text); }
.strong { font-weight: 600; }
.tbl { display: flex; flex-direction: column; }
.tbl-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.tbl-row:first-child { border-top: 0; }
.tbl-row.goods { grid-template-columns: minmax(140px, 1.3fr) 90px minmax(120px, 1fr); }
.tbl-row.goods > :last-child { grid-column: 1 / -1; }
.lots { margin: 8px 0; }
.btn.lot { font-family: var(--mono); }
details.sub { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
details.sub > summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* jump */
.legs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.leg { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 6px 8px; border-radius: 6px; }
.leg.done { color: var(--muted); }
.leg.current { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.leg.misjump { color: var(--bad); }
.jump-result { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; background: var(--panel-2); border-left: 4px solid var(--ok); }
.jump-result.warn { border-left-color: var(--accent); }
.jump-result.bad { border-left-color: var(--bad); }
.jump-result .roll { margin-top: 8px; }
.tag.outcome.ok { color: var(--ok); }
.tag.outcome.warn { color: var(--accent); }
.tag.outcome.bad { color: var(--bad); }
.jumpmap { display: block; max-width: 100%; height: auto; margin: 0 auto 8px; border-radius: 8px; background: #000; }
.picker-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 220px; overflow-y: auto; }
.btn.pick { text-align: left; }
.log-entry { padding: 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.log-entry:first-of-type { border-top: 0; }
.tag.due { color: var(--ok); }

/* ships */
.ship-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.sheet.read-only input:disabled, .sheet.read-only textarea:disabled, .sheet.read-only select:disabled { opacity: 1; color: var(--text); background: transparent; border-color: transparent; padding-left: 0; resize: none; }

/* trip builder */
.split.builder-layout { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); }
.stops { display: flex; flex-direction: column; gap: 4px; }
.stop { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stop.origin { border-color: var(--line-2); }
.stop .grid { grid-template-columns: minmax(0, 1fr); }
.leg-line { color: var(--accent); padding: 2px 12px; font-family: var(--mono); }
.candidates { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; margin-bottom: 10px; }
.cand { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; text-align: left; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; cursor: pointer; }
.cand:hover:not(:disabled) { border-color: var(--accent); }
.cand.blocked { opacity: 0.45; cursor: not-allowed; }
/* Fuel on offer at a world: small boxes, like the base icons on world cards. */
.tag.fuel {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; box-sizing: border-box;
  font: 700 11px/1 var(--mono); letter-spacing: 0; text-transform: none;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 4px;
}
.tag.fuel.off { opacity: 0.45; border-style: dashed; color: var(--muted); }
.tag.fuel.voucher, .tag.voucher { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.vouchers { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.totals { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.trip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.trip-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.trip-card:hover, .trip-card:focus-visible { border-color: var(--accent); outline: none; }
.trip-card.active { border-color: var(--line-2); }
.trip-card.open { border-color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 8px; }
/* Courses tab: the jump map with the fuel vouchers card under it */
.side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side-col > .card { margin: 0; }
.voucher-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.voucher-row:last-child { border-bottom: 0; }
/* the comm's account screen: the user accounts signed in on it */
.accounts { display: flex; flex-direction: column; gap: 8px; }
.account { display: flex; align-items: center; gap: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px 4px 4px; }
.account:hover, .account:focus-within { border-color: var(--accent); }
.account-open { flex: 1; display: flex; align-items: center; gap: 12px; background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 8px; text-align: left; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #0a0e13; font-weight: 700; letter-spacing: .02em; flex: none; }
.account-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.small-avatar { width: 26px; height: 26px; font-size: 12px; }
/* a Traveller inside an account card: name, where to move them, delete — all on one line */
.trip-card .acct-char { flex-wrap: nowrap; border-bottom: 1px solid var(--line); }
.trip-card .acct-char select { width: auto; min-width: 110px; max-width: 160px; flex: none; }
.trip-card .acct-char .btn { flex: none; }
.trip-card .acct-char .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag.warn-tag { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); color: var(--warn); }
/* the × on a Traveller chip (comms list) */
.chip-x { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; margin-left: 6px; padding: 0 2px; opacity: .7; }
.chip-x:hover, .chip-x:focus-visible { opacity: 1; color: var(--bad); outline: none; }
/* an open course card on Astrogation's Courses tab: its legs, then what it is carrying */
.trip-open { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }
.manifest { display: flex; flex-direction: column; gap: 3px; }
.manifest .strong { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.trip-card.due { border-color: var(--ok); }
/* ship deck plan: staterooms (vertical pairs, side by side), low berths, the hold as a rectangle */
.shipmap { --bx: 34px; display: flex; flex-direction: column; gap: 12px; }
.sm-label { color: var(--muted); margin-bottom: 6px; }
.sm-rooms { display: flex; flex-wrap: wrap; gap: 8px; }
.room { display: inline-flex; flex-direction: column; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.room.over { border-color: var(--bad); }
.sm-berths { display: flex; flex-wrap: wrap; gap: 4px; }
.sm-hold { display: grid; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; width: max-content; max-width: 100%; overflow-x: auto; }
.bx { width: var(--bx); height: var(--bx); border-radius: 5px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--mono); color: #0a0e13; flex: none; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.bx.tall { height: calc(var(--bx) * 2 + 3px); }
.bx:hover, .bx:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.bx.picked { outline: 3px solid var(--text); outline-offset: 1px; z-index: 1; }
.bx.mini { width: 14px; height: 14px; border-radius: 3px; cursor: default; }
.bx.mini:hover { outline: none; }
.bx.k-empty { background: var(--bg); border-color: var(--line); }
.bx.k-high { background: var(--accent); }
.bx.k-middle { background: var(--info); }
.bx.k-basic, .bx.k-bunk { background: var(--ok); }
.bx.k-bunk { opacity: 0.75; }
.bx.k-low { background: var(--handout); }
.bx.k-crew { background: #9aa7b4; }
.bx.k-traveller { background: #d9a7f0; }
.bx.k-mail { background: #e07b39; }
.bx.k-freight { background: #3fb6a8; }
.bx.k-goods { background: #c9b458; }
.bx.k-baggage { background: #6d7f92; }
.bx.k-spares { background: #8a7bd1; color: #fff; font-size: 10px; font-weight: 700; }
.bx.over { box-shadow: inset 0 0 0 3px var(--bad); }
.sm-detail { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.sm-detail.k-high { border-left-color: var(--accent); } .sm-detail.k-middle { border-left-color: var(--info); }
.sm-detail.k-basic, .sm-detail.k-bunk { border-left-color: var(--ok); } .sm-detail.k-low { border-left-color: var(--handout); }
.sm-detail.k-mail { border-left-color: #e07b39; } .sm-detail.k-freight { border-left-color: #3fb6a8; }
.sm-detail.k-crew { border-left-color: #9aa7b4; }
.sm-detail.k-traveller { border-left-color: #d9a7f0; }
.sm-detail.k-goods { border-left-color: #c9b458; } .sm-detail.k-baggage { border-left-color: #6d7f92; }
.sm-close { cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.sm-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); }
@media (max-width: 480px) { .shipmap { --bx: 30px; } }

/* Ship status card (shipstatus.js): a standard card any tab can show. All boxes; tap for details. */
.ship-status { display: flex; flex-direction: column; gap: 8px; }
.ship-status .ss-name { font-size: 15px; }
.shipmap.compact { --bx: 18px; gap: 8px; }
.shipmap.compact .bx { font-size: 9px; border-radius: 3px; }
.shipmap.compact .sm-rooms { gap: 4px; }
.shipmap.compact .room { padding: 2px; gap: 2px; border-radius: 5px; }
.shipmap.compact .sm-label { margin-bottom: 3px; }
.shipmap.compact .sm-hold { gap: 2px; padding: 3px; }
/* fuel, hull and status boxes */
.bx.k-fuel { background: var(--info); }
.bx.k-unrefined { background: repeating-linear-gradient(135deg, #c9a24a 0 4px, #a8843a 4px 8px); }
/* water drawn from a world: unrefined too, shown apart (navigation.js fuelMix) */
.bx.k-water { background: repeating-linear-gradient(0deg, #34c49a 0 3px, #24907a 3px 6px); }
.bx.k-hull { background: var(--ok); }
.bx.k-damage { background: var(--bad); }
.bx.k-place { background: var(--panel-2); border-color: var(--info); color: var(--info); }
.bx.k-course { background: var(--accent); }
.bx.k-warn { background: var(--bad); color: #fff; }
.bx.k-costs { background: var(--panel-2); border-color: var(--muted); color: var(--text); }
.sm-detail.k-fuel, .sm-detail.k-place { border-left-color: var(--info); }
.sm-detail.k-unrefined { border-left-color: #c9a24a; }
.sm-detail.k-hull { border-left-color: var(--ok); }
.sm-detail.k-damage, .sm-detail.k-warn { border-left-color: var(--bad); }
.sm-detail.k-course { border-left-color: var(--accent); }

/* rolls entered at the table */
.dice-mode { align-items: flex-start; cursor: pointer; padding: 10px 14px; }
.dice-mode input { margin-top: 3px; }
.roll-box { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 4px; }
.roll-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 3px 0; }
.roll-row > span:first-child { flex: 0 0 130px; }
input.roll-in { width: 58px; padding: 4px 6px; text-align: center; font-family: var(--mono); }
input.roll-in.wide { width: 170px; text-align: left; }
.roll-hint { flex: 1 1 160px; }
/* Trade at the table: the taps that fill in a roll, on their own line under it (trade.js) */
.tap-box { flex: 1 1 100%; display: grid; gap: 4px; }
.tap-box:empty { display: none; }
.tap-box > .btn.pick.chosen { justify-self: start; }
.mk-price-pick { margin: 4px 0 6px; }
.none-note { margin: 10px 0 0; padding: 6px 10px; border: 1px dashed var(--line); border-radius: 8px; }
.trip-list.lots { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.trip-list.lots .trip-card { padding: 8px 10px; gap: 2px; }
.trip-list.lots .trip-actions { margin-top: 2px; padding-top: 6px; }
.trip-card.still .trip-actions:empty { display: none; }
.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; margin-bottom: 8px; }
.space-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.space-row .meter { grid-column: 1 / -1; }
.jump-form { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; cursor: default; }
.resolve { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 6px 0; }
.trip-card.done, .trip-card.misjump { opacity: 0.7; }
.trip-card .row { flex-wrap: wrap; }
.trip-actions { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; align-items: center; }
.side-map .jumpmap { max-width: 100%; }
@media (max-width: 820px) { .split.builder-layout { grid-template-columns: 1fr; } }

/* the player's comm */
body.device::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom, rgb(255 255 255 / var(--scan)) 0 1px, transparent 1px 3px);
}
.boot { color: var(--ok); font-size: 12px; letter-spacing: 0.08em; line-height: 1.6; margin: 0 0 14px; opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) {
  .boot { animation: boot 1.2s steps(12) both; }
  @keyframes boot { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
}

/* library */
.lib-list { display: flex; flex-direction: column; gap: 6px; }
.lib-entry { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.lib-entry summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; list-style: none; }
.lib-entry summary::-webkit-details-marker { display: none; }
.lib-entry summary::before { content: '▸'; color: var(--muted); }
.lib-entry[open] summary::before { content: '▾'; }
.lib-title { font-weight: 600; }
.lib-text { white-space: pre-wrap; margin-top: 10px; line-height: 1.55; }
/* Formatted entries (richtext.js) */
.lib-rich { white-space: normal; }
.lib-rich > :first-child { margin-top: 0; }
.lib-rich p { margin: 0 0 .7em; }
.lib-rich ul, .lib-rich ol { margin: 0 0 .7em; padding-left: 1.3em; }
.lib-rich li { margin: .15em 0; }
.lib-rich .rt-h { margin: .9em 0 .35em; }
.rt-table-wrap { overflow-x: auto; margin: 0 0 .8em; }
.rt-table { border-collapse: collapse; font-size: .92em; min-width: 60%; }
.rt-table th, .rt-table td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.rt-table th { background: var(--panel-2); }
details.card > summary { cursor: pointer; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* campaign date */
.date-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.date-ctl input { width: 104px; padding: 4px 6px; font-family: var(--mono); text-align: center; font-size: 15px; }
.date-ctl .btn { min-height: 30px; padding: 2px 8px; font-size: 13px; }
#date { font-size: 13px; }

/* ---------- referee party view ---------- */
.split { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; align-items: start; }
.roster { display: flex; flex-direction: column; gap: 10px; }
.pc {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; text-align: left; color: inherit; font: inherit; width: 100%;
}
.pc[aria-current='true'] { border-color: var(--accent); }
.pc .top { display: flex; align-items: baseline; gap: 8px; }
.pc .name { font-weight: 600; flex: 1; }
.pc .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.phys { display: flex; gap: 12px; margin-top: 8px; font-family: var(--mono); font-size: 13px; }
.phys .low { color: var(--bad); }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }

/* ---------- messages ---------- */
.kind-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.kind-pick label { display: flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; }
.kind-pick label:has(input:checked) { border-color: var(--accent); }
.recips { display: flex; gap: 6px 14px; flex-wrap: wrap; }
.recips label { display: flex; gap: 6px; align-items: center; }
.msg { border-left: 3px solid var(--info); padding: 8px 12px; background: var(--panel-2); border-radius: 0 8px 8px 0; margin-bottom: 8px; }
.msg.alert { border-left-color: var(--bad); }
.msg.handout { border-left-color: var(--handout); }
.msg.unread { box-shadow: inset 0 0 0 1px var(--accent); }
.msg .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg .t { font-weight: 600; }
.msg .body { white-space: pre-wrap; margin-top: 4px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-2, var(--accent)); font: inherit; cursor: pointer; text-decoration: underline; }

/* the referee's prepared transmissions, filed by adventure (handouts.js) */
#handouts { margin-top: 16px; }
.ho-tree { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ho-folder { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.ho-folder.sub { border-color: var(--line); background: var(--panel-2); }
.ho-fhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; cursor: pointer; }
.ho-fhead strong { font-family: var(--display); font-stretch: condensed; letter-spacing: .04em; text-transform: uppercase; }
.ho-caret { width: 12px; color: var(--muted); }
.ho-children { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 10px 22px; }
.ho-item { border-left: 3px solid var(--handout); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.ho-folder.sub .ho-item { background: var(--panel); }
.ho-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px; cursor: pointer; }
.ho-doc { color: var(--handout); }
.ho-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ho-unsent { font-style: italic; }
.ho-item.ho-info { border-left-color: var(--info); }
.ho-item.ho-alert { border-left-color: var(--bad); }
.ho-info .ho-doc { color: var(--info); }
.ho-alert .ho-doc { color: var(--bad); }
.ho-kind.info { color: var(--info); border-color: var(--info); }
.ho-kind.alert { color: var(--bad); border-color: var(--bad); }
.ho-to { max-width: 30ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .ho-to { display: none; } }
.ho-edit { padding: 4px 10px 10px; }
@media (max-width: 480px) { .ho-children { padding-left: 10px; } }
/* players' documents, grouped by adventure (Messages) */
.docs-adv > summary { cursor: pointer; padding: 6px 0; font-family: var(--display); font-stretch: condensed; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
.docs-adv .msg { margin-left: 4px; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- toasts and pop-ups ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; left: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; max-width: 420px; background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--info); padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 30px #0008; cursor: pointer; white-space: pre-wrap; }
.toast.error { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }

.overlay { position: fixed; inset: 0; background: #000b; display: grid; place-items: center; padding: 16px; z-index: 40; }
.popup { width: min(560px, 100%); max-height: 85dvh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--info); border-radius: var(--radius); padding: 20px; animation: pop 0.25s ease-out; }
.popup.alert { border-top-color: var(--bad); }
.overlay.modal { z-index: 60; }
.modal-list { margin: -6px 0 18px; padding-left: 20px; color: var(--muted); max-height: 40dvh; overflow: auto; }
.pc.sel { border-color: var(--accent); }
.berth-pick { font-size: 13px; padding: 3px 6px; }
.dot.hired { background: #9aa7b4; box-shadow: none; }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.popup.handout { border-top-color: var(--handout); }
.popup h2 { margin: 0 0 4px; font-size: 20px; }
.popup .body { white-space: pre-wrap; margin: 12px 0 18px; font-size: 16px; }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- join screen ---------- */
.join { max-width: 520px; margin: 24px auto; }
.join .pc { display: flex; align-items: center; gap: 10px; }
.qr { background: #fff; padding: 8px; border-radius: 8px; width: 180px; }
.qr svg { display: block; width: 100%; height: auto; }
.url { font-family: var(--mono); font-size: 17px; color: var(--accent); word-break: break-all; }
.pin { font-family: var(--mono); letter-spacing: 0.2em; font-size: 18px; }

/* ---------- contacts (public/js/contacts.js) ---------- */
.contacts-app { --rel: var(--muted); }
.rel.patron { --rel: #e0b341; }
.rel.ally, .ct-item.rel-ally { --rel: var(--ok, #3fb950); }
.rel.contact, .ct-item.rel-contact { --rel: var(--info); }
.rel.rival, .ct-item.rel-rival { --rel: #e8833a; }
.rel.enemy, .ct-item.rel-enemy { --rel: var(--bad); }
.ct-item.rel-patron { --rel: #e0b341; }
.tag.rel { color: var(--rel); border-color: var(--rel); }
.ct-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chip-btn {
  font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
}
.chip-btn.rel { color: var(--rel); }
.chip-btn.on { border-color: var(--rel, var(--accent)); background: color-mix(in srgb, var(--rel, var(--accent)) 18%, var(--panel-2)); }
.chip-btn:not(.rel).on { border-color: var(--accent); }
.ct-group + .ct-group { margin-top: 12px; }
.ct-group-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--rel); margin: 0 0 6px; }
.ct-item { border-left: 3px solid var(--rel, var(--line-2)); background: var(--panel-2); border-radius: 0 8px 8px 0; margin-bottom: 6px; }
.ct-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; flex-wrap: wrap; }
.ct-name { display: flex; flex-direction: column; min-width: 0; }
.ct-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-knownby { max-width: 40ch; text-align: right; }
.ct-portrait { flex: none; border-radius: 50%; object-fit: cover; background: var(--panel); border: 1px solid var(--line); }
.ct-portrait.sm { width: 40px; height: 40px; }
.ct-initials { display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--muted); }
.ct-edit { padding: 4px 12px 12px; border-top: 1px solid var(--line); }
.ct-edit-top { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-top: 10px; }
.ct-edit-pic { flex: 0 0 220px; max-width: 100%; }
.ct-edit-pic .img-zone-pic img { max-height: 200px; }
.ct-edit-fields { flex: 1 1 280px; }
.ct-where { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ct-where > .row { flex: 1 1 100%; }
.ct-where .row input { flex: 1; min-width: 0; }
.ct-where .picker-results { flex: 1 1 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ct-known { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ct-known-row { display: flex; gap: 8px; align-items: center; }
.ref-only > span { color: var(--accent); }
.ct-new { color: var(--accent); font-weight: 700; font-size: 13px; }
/* messages with a contact (mail.js) */
.ct-mail { margin: 10px 0 12px; }
.mail-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; max-height: 420px; overflow-y: auto; }
.mail-msg { max-width: 85%; padding: 8px 10px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.mail-msg.out { align-self: flex-end; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.mail-msg.in { align-self: flex-start; }
.mail-msg.transit { opacity: .75; border-style: dashed; }
.mail-body { white-space: pre-wrap; margin: 2px 0; }
.mail-status { color: var(--muted); margin-top: 4px; display: flex; align-items: center; flex-wrap: wrap; }
.mail-msg:not(.transit) .mail-status { color: var(--ok); }
.mail-compose textarea { width: 100%; }
.mail-attach summary { cursor: pointer; color: var(--muted); margin-top: 4px; }
.mail-attach .img-zone { margin-top: 6px; }
.ct-mailbox { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel-2); }
.ct-mailbox summary { cursor: pointer; }
.ct-thread {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 6px; padding: 6px 8px;
  font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.ct-thread.unread { border-color: var(--accent); }
.ct-thread-text { display: flex; flex-direction: column; min-width: 0; }
.ct-thread-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
@media (max-width: 600px) { .ct-knownby { display: none; } .ct-edit-pic .img-zone-pic img { max-height: 150px; } }

.where-it-is { padding: 6px 0; }

/* ---------- course map (coursemap.js): retro terminal, like the jump map ---------- */
.course-map-card { margin: 8px 0 10px; }
/* Scenes (scenes.js, 2026-11-23): the scene being played, and the list by adventure. */
.scene-now { border-color: var(--accent); }
.sc-sec { margin-top: 12px; }
.sc-label { text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.read-aloud { white-space: pre-wrap; line-height: 1.55; border-left: 3px solid var(--accent); padding: 6px 10px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.sc-notes { white-space: pre-wrap; }
.sc-npcs { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-npc { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 8px; }
.sc-npc[open] { flex-basis: 100%; }
.sc-npc > summary { cursor: pointer; display: flex; gap: 6px; align-items: center; }
.sc-face { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
/* A transmission sent as an NPC (app.js senderLine) */
.msg-from { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.msg-face { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; font-size: 10px; background: var(--line); }
/* NPC stats (npcstats.js) */
.npc-stats { margin-top: 4px; display: grid; gap: 2px; }
.npc-chars { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.npc-stat-text { white-space: pre-wrap; }
.npc-chars-ed { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.npc-char-ed { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.npc-char-ed input { width: 100%; min-width: 0; }
.npc-dm { min-height: 1.2em; }
.ct-statline { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .npc-chars-ed { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sc-check { border-top: 1px solid var(--line); padding: 6px 0; }
.sc-check:first-of-type { border-top: 0; }
.sc-item { padding: 4px 0; border-top: 1px solid var(--line); }
.sc-row { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sc-row:first-of-type { border-top: 0; }
.sc-row-main { flex: 1; min-width: 180px; }
.sc-row.playing strong { color: var(--accent); }
.sc-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; max-height: 220px; overflow-y: auto; }
.sc-check-ed { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin-bottom: 8px; }
/* Trade as a mission board and a market (trade.js, 2026-11-23). */
.ref-menu > summary { cursor: pointer; list-style: none; text-align: right; color: var(--muted); font-size: 13px; padding: 2px 0 4px; }
.ref-menu > summary::-webkit-details-marker { display: none; }
.trade-cap { padding: 10px 14px; }
.cap-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; }
.cap-grid .meter { height: 8px; }
.cap-grid .cap-text { grid-column: span 2; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.chip { font: inherit; font-size: 13px; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: none; color: var(--muted); cursor: pointer; }
.chip.on { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.offers { display: flex; flex-direction: column; }
.offer { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "icon what pay" "icon act act"; gap: 2px 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.offer:first-child { border-top: 0; }
.offer-icon { grid-area: icon; color: var(--muted); text-align: center; align-self: start; padding-top: 2px; }
.offer-what { grid-area: what; min-width: 0; }
.offer-pay { grid-area: pay; text-align: right; white-space: nowrap; }
.offer-act { grid-area: act; display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.offer-act:empty { display: none; }
.offer.dim { opacity: .55; }
.offer.aboard { cursor: pointer; grid-template-areas: "icon what pay" "icon more more"; }
.offer.aboard.due .offer-icon { color: var(--ok); }
.offer-more { grid-area: more; margin-top: 4px; }
input.qty { width: 64px; padding: 4px 6px; text-align: center; }
.look-done > summary { cursor: pointer; }
.mk-list { display: flex; flex-direction: column; }
.mk-row { padding: 10px 0; border-top: 1px solid var(--line); }
.mk-row:first-child { border-top: 0; padding-top: 0; }
.mk-dms { margin: 2px 0 4px; }
.mk-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; }
.find-box { margin-top: 8px; }
/* Library Data as a wiki (wikilinks.js): links to entries and worlds, "Mentioned in", history. */
.wiki-link { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.wiki-link.world { text-decoration-style: dashed; }
.wiki-link:hover, .wiki-link:focus-visible { text-decoration-style: solid; }
.lib-back { margin-top: 10px; }
.lib-history { margin-top: 10px; }
.lib-version { border-top: 1px solid var(--line); padding: 6px 0; }
.lib-version .lib-text { margin-top: 4px; max-height: 8em; overflow: auto; }
.lib-also { padding: 8px 12px; }
.lib-entry.flash { outline: 2px solid var(--accent); outline-offset: 2px; transition: outline-color .6s; }
/* Library Data: a picture in an entry (tap for full screen with zoom). */
.lib-entry .lib-img { display: block; margin-top: 8px; }
.lib-entry .pdf-link { margin-top: 8px; }
/* A worked-out number the referee can type over (refedit.js). */
.ref-num { font: inherit; font-family: var(--mono); color: inherit; background: none; border: 0; border-bottom: 1px dashed var(--muted); padding: 0 1px; cursor: pointer; }
.ref-num:hover, .ref-num:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
.ref-num.changed { color: var(--accent); border-bottom-style: solid; }
.ref-pencil { font-size: .85em; opacity: .7; }
.ref-was { white-space: nowrap; }
/* Campaign app: the automatic backups, newest first. */
.backup-list { max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line); }
.backup-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }
/* Course card / course under way: details left, map right, like Plan; one column on a phone,
   map first. */
.course-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
.course-layout > .course-main { min-width: 0; }
.course-layout > .course-map-card { margin-top: 8px; position: sticky; top: 12px; }
@media (max-width: 820px) {
  .course-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .course-layout > .course-map-card { order: -1; position: static; }
}
.course-map {
  background: #05080c; border: 1px solid var(--line); border-radius: 8px; padding: 6px;
  font-family: var(--mono, monospace);
}
.course-map svg { display: block; width: 100%; height: auto; max-height: 320px; }
.cm-grid polygon { fill: none; stroke: #16313a; stroke-width: 0.6; }
.cm-legs line { stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; }
.cm-legs line.tocome { stroke-dasharray: 3 2.2; opacity: .85; }
.cm-legs line.made { stroke: #5fd38d; }
.cm-stop circle { fill: var(--accent); stroke: #05080c; stroke-width: 0.8; }
.cm-stop.done circle { fill: #5fd38d; }
.cm-stop .cm-ship { fill: none; stroke: #e6f2f5; stroke-width: 1.2; stroke-dasharray: 2 1.4; }
.cm-key { margin: 4px 0 0; }

/* ---------- Fleet (ship.js) ---------- */
.fleet-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.fleet-card { margin: 0; }
.fleet-card[role="button"] { cursor: pointer; }
.fleet-card.commanding { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.fleet-card.sel { outline: 2px solid var(--accent); outline-offset: -2px; }
.fleet-stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 10px 0 0; font-size: 14px; }
.fleet-stats dt { color: var(--muted); }
.fleet-stats dd { margin: 0; }
.crew-positions h3 { margin-top: 0; }
.crew-panel > .card { margin-top: 16px; }

/* ---------- the big red Jump button (jumps.js; referee's request, 2026-11-23) ---------- */
.jump-button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; min-height: 96px; padding: 14px; cursor: pointer; color: #fff;
  font-family: var(--display, inherit); text-transform: uppercase;
  background: radial-gradient(circle at 50% 35%, #ff5a4d 0%, #d9261c 55%, #9e1510 100%);
  border: 3px solid #5c0b07; border-radius: 18px;
  box-shadow: 0 6px 0 #5c0b07, 0 10px 24px rgba(217, 38, 28, .35), inset 0 2px 0 rgba(255, 255, 255, .25);
  transition: transform .06s ease, box-shadow .06s ease;
}
.jump-button .jb-main { font-size: 34px; font-weight: 800; letter-spacing: .18em; line-height: 1; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.jump-button .jb-sub { font-size: 13px; letter-spacing: .08em; opacity: .9; }
.jump-button:hover { filter: brightness(1.06); }
.jump-button:active { transform: translateY(5px); box-shadow: 0 1px 0 #5c0b07, 0 4px 10px rgba(217, 38, 28, .3), inset 0 2px 0 rgba(255, 255, 255, .2); }
.jump-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.jump-button:disabled { cursor: not-allowed; filter: grayscale(.85) brightness(.6); box-shadow: 0 6px 0 #333; }

/* ---------- tabs (tabbar.js): one line, never wrapping ---------- */
.tabbar {
  display: flex; gap: 2px; margin: 0 0 12px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabbar::-webkit-scrollbar { display: none; }
.tb {
  flex: 1 0 auto; position: relative; white-space: nowrap; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; letter-spacing: .02em; padding: 10px 12px 9px;
  color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tb:hover { color: var(--text); }
.tb.on { color: var(--text); border-bottom-color: var(--accent); }
.tb-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-left: 5px; vertical-align: 2px; }
.tb-dot.bad { background: var(--bad); }
.tb-dot.warn { background: var(--warn); }
.funds-balance { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 2px 6px; }
.funds-balance strong { font-size: 22px; }
.funds-balance strong.neg { color: var(--bad); }
.tab-panel-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.tab-panel-head h3 { margin: 0; }
.tab-panel-head .val { font-size: 18px; }
.tab-panel-head .val.neg { color: var(--bad); }
.tab-panel-head .val.warn { color: var(--warn); }

/* ---------- base icons on world cards (worlds.js) ---------- */
.base-icons { display: inline-flex; gap: 4px; vertical-align: middle; }
.base-icon {
  width: 22px; height: 22px; padding: 0; display: inline-grid; place-items: center; cursor: pointer;
  font: 700 12px/1 var(--mono, monospace); color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: 4px;
}
.base-icon:hover, .base-icon:focus-visible { border-color: var(--accent); }
.base-icon.usable { border-color: var(--ok); color: var(--ok); }
.base-icon.other { color: var(--muted); border-style: dashed; }

/* ---------- PDFs (files.js) ---------- */
.pdf-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 10px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); text-decoration: none;
}
.pdf-link:hover, .pdf-link:focus-visible { border-color: var(--accent); }
.pdf-icon { flex: none; font: 700 10px/1 var(--mono, monospace); padding: 4px 5px; border-radius: 4px; background: var(--bad); color: #fff; }
.pdf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pdf-zone .pdf-link { margin-top: 0; }
.mail-attach .pdf-zone { margin-top: 6px; }

/* ---------- images (handouts: public/js/images.js) ---------- */
.img-zone {
  border: 1px dashed var(--line-2); border-radius: 8px; padding: 12px; background: var(--panel-2);
  outline: none;
}
.img-zone:focus-visible, .img-zone.drag { border-color: var(--accent); border-style: solid; }
.img-zone.has-image { border-style: solid; border-color: var(--line); padding: 8px; }
.img-zone-pic { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.img-zone-pic img { max-width: min(100%, 320px); max-height: 220px; border-radius: 6px; cursor: zoom-in; display: block; }
.ho-thumb { width: 22px; height: 22px; object-fit: cover; border-radius: 3px; flex: none; }
.msg-img {
  display: block; margin-top: 8px; max-width: 100%; height: auto; max-height: 50vh;
  /* No frame or backing: a trimmed screenshot's clipped corners show through (images.js). */
  object-fit: contain; cursor: zoom-in;
}
.msg-img.thumb { max-height: 90px; width: auto; }
.msg-img.popup-img { max-height: 55vh; margin: 10px auto 0; }
.image-viewer { z-index: 1000; background: rgba(0, 0, 0, 0.92); padding: 0; display: block; }
.image-viewer .iv-stage {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; cursor: grab;
}
.image-viewer .iv-stage:active { cursor: grabbing; }
.image-viewer img {
  max-width: 100vw; max-height: 100vh; object-fit: contain; transform-origin: center center;
  user-select: none; -webkit-user-drag: none;
}
.image-viewer .iv-close { position: absolute; top: 12px; right: 12px; z-index: 1; }
.image-viewer .iv-hint { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; margin: 0; pointer-events: none; }

@media (max-width: 820px) {
  .split, .split.dice-layout, .split.trade-layout { grid-template-columns: 1fr; }
  .route-cards { grid-template-columns: 1fr; }
  .tbl-row.goods { grid-template-columns: 1fr auto; }
  .tbl-row.goods > :nth-child(3) { grid-column: 1 / -1; }
  main { padding: 12px; }
}
@media (max-width: 420px) {
  .char-head, .char-row { grid-template-columns: 40px 1fr 10px 54px 34px; gap: 6px; }
}

/* ---------- one look for the same things everywhere (UI review, 2026-11-23) ---------- */
/* "ⓘ How it works": a rule or explanation a tap away (common.js about()). */
.about { margin: 8px 0 0; }
.about-btn { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.about-btn:hover, .about-btn[aria-expanded="true"] { color: var(--text); }
.about-text { margin-top: 4px; padding: 6px 10px; border-left: 2px solid var(--line-2); }
/* Every fold that opens: a chevron on the right that turns when it's open, like the world
   cards — not the browser's own triangle. */
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: '▸'; margin-left: auto; color: var(--muted); font-size: 12px; transition: transform .15s ease; flex: none; }
details[open] > summary::after { transform: rotate(90deg); }
.lib-entry summary::before, .lib-entry[open] summary::before { content: none; }
/* Choosing one of a few: chips. The picked one is tinted in the accent (Contacts' relationship
   chips in their own colour). Big choices, like where the ship goes, stay cards. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.seg-btn, .kind-pick label, .chip-btn {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.on, .kind-pick label:has(input:checked), .chip-btn:not(.rel).on {
  border-color: var(--accent); color: var(--text);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
}
.kind-pick label { position: relative; }
.kind-pick input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.kind-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The arrangeable drawer (Arrange apps on the home screen). */
.drawer-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; max-width: 760px; margin: 4px auto 24px; padding: 0 16px; }
.drawer-foot #arrange-hint { flex: 1 1 220px; }
.app-tile { position: relative; }
.tile-move { display: none; }
.drawer.arranging .app-tile { outline: 1px dashed var(--line, rgba(127,127,127,.5)); outline-offset: 2px; cursor: default; }
.drawer.arranging .tile-move {
  display: flex; align-items: center; justify-content: center; position: absolute; top: 2px;
  width: 24px; height: 24px; border-radius: 50%; font-size: 11px; line-height: 1;
  background: var(--panel-2, #1b2027); color: var(--text, #e7eaee); border: 1px solid var(--line, #2a3139); cursor: pointer;
}
.drawer.arranging .tile-move.left { left: 2px; }
.drawer.arranging .tile-move.right { right: 2px; }
.drawer.arranging .tile-move:focus-visible { outline: 2px solid var(--accent); }
.drawer.arranging .app-tile.is-first .tile-move.left, .drawer.arranging .app-tile.is-last .tile-move.right { visibility: hidden; }

/* Spectating: the marker on a comm while it's on the big screen (mirror.js). */
.on-big-screen { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9000;
  padding: 4px 12px; border-radius: 99px; font-size: 12px; background: var(--panel-2, #1b2027); color: var(--text, #e7eaee);
  border: 1px solid var(--accent, #f05a28); box-shadow: 0 2px 10px rgba(0,0,0,.4); pointer-events: none; }

/* ---------- the Pilot app's system mini-map (systemmap.js): an LCD game in the terminal look ---------- */
.system-map { background: #05080c; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin: 8px 0; font-family: var(--mono, monospace); }
.sm-svg { display: block; width: 100%; height: auto; max-height: 260px; }
.sm-svg .off { fill: #0f2228; stroke: #15303a; }
.sm-svg .on { fill: #5fd38d; stroke: #5fd38d; }
.sm-svg .sm-piece.off *, .sm-svg .sm-seg.off { fill: #0f2228; stroke: #15303a; }
.sm-svg .sm-piece.on *, .sm-svg .sm-seg.on { fill: #5fd38d; stroke: #5fd38d; }
.sm-svg line { stroke-width: 2.4; }
.sm-svg .sm-piece.on line { stroke: #5fd38d; }
.sm-svg .sm-piece.off line { stroke: #15303a; }
.sm-svg .sm-glyph { font: 700 11px var(--mono, monospace); stroke: none !important; }
.sm-svg .sm-piece.on .sm-glyph { fill: #05080c !important; }
.sm-svg .sm-piece.off .sm-glyph { fill: #1d3a44 !important; }
.sm-svg .sm-print { font: 600 8px var(--mono, monospace); fill: #3f6f7d; letter-spacing: .12em; }
.sm-svg .sm-limit { fill: none; stroke: #16313a; stroke-dasharray: 3 3; }
.sm-svg .sm-world.on { fill: #12352a; stroke: #5fd38d; stroke-width: 1.5; }
.sm-svg .sm-water { fill: none !important; stroke-width: 1.8; }
.sm-svg .sm-water.on { stroke: #5fd38d; }
.sm-svg .sm-orbit { fill: none; stroke: #2a5a66; stroke-width: 1.4; }
.sm-svg .sm-gg.on { fill: #12352a; stroke-width: 1.5; }
.sm-svg .sm-band { fill: none !important; stroke-width: 2; }
.sm-svg .sm-highport circle, .sm-svg .sm-highport line { fill: none; stroke-width: 2; }
.sm-svg .sm-highport.maybe circle, .sm-svg .sm-highport.maybe line { stroke: #5fd38d; stroke-dasharray: 2 2; opacity: .7; }
.sm-svg .sm-highport.off circle, .sm-svg .sm-highport.off line { stroke: #15303a; }
.sm-svg .sm-hit { fill: transparent; stroke: none; }
.sm-svg .sm-ship { fill: var(--accent); stroke: #05080c; stroke-width: 1; }
.sm-svg .sm-place.can { cursor: pointer; }
.sm-svg .sm-place.can:hover .sm-hit, .sm-svg .sm-place.can:focus-visible .sm-hit { fill: rgba(95, 211, 141, .08); }
.sm-svg .sm-place:focus-visible { outline: none; }
.sm-svg .sm-place.here .sm-orbit { stroke: #5fd38d; }

/* ==========================================================================================
   The second styling pass (referee's request, 2026-11-25): a faint hex grid behind everything,
   like the sector map under a starship's console; tables and lists read as tables; the Personal
   Data sheet as a printed form; the Trade cards with a little texture. Colours come from the
   theme as before (the grid is the theme's line colour), so every theme keeps its own look.
   ========================================================================================== */
:root {
  --hex-tile: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2760%27%20height%3D%2734.64%27%20viewBox%3D%270%200%2060%2034.64%27%3E%3Cpath%20d%3D%27M0%2017.32L10%200H30L40%2017.32L30%2034.64H10ZM40%2017.32H60%27%20fill%3D%27none%27%20stroke%3D%27black%27%20stroke-width%3D%271%27%2F%3E%3C%2Fsvg%3E");
  --hex-w: 60px; --hex-h: 34.64px;
  /* How strong the grid is: the theme's second line colour, mostly see-through. */
  --hex-grid: color-mix(in srgb, var(--line-2) 30%, transparent);
  --zebra: color-mix(in srgb, var(--panel-2) 55%, transparent);
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--hex-grid);
  -webkit-mask: var(--hex-tile) 0 0 / var(--hex-w) var(--hex-h) repeat;
  mask: var(--hex-tile) 0 0 / var(--hex-w) var(--hex-h) repeat;
}

/* A textured card: the grid again, very faint, inside it (world cards, the home screen's header). */
.world-card, .drawer-head { position: relative; isolation: isolate; }
.world-card::before, .drawer-head::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: color-mix(in srgb, var(--line-2) 30%, transparent);
  -webkit-mask: var(--hex-tile) 0 0 / calc(var(--hex-w) * .6) calc(var(--hex-h) * .6) repeat,
    linear-gradient(115deg, #000 0%, transparent 70%);
  -webkit-mask-composite: source-in;
  mask: var(--hex-tile) 0 0 / calc(var(--hex-w) * .6) calc(var(--hex-h) * .6) repeat,
    linear-gradient(115deg, #000 0%, transparent 70%);
  mask-composite: intersect;
}
.world-card { background: linear-gradient(160deg, color-mix(in srgb, var(--panel-2) 70%, var(--panel)), var(--panel)); }

/* ---------- tables and lists that are really tables ---------- */
.build-muster, .rt-table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
.build-muster th, .rt-table th {
  font-family: var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: .07em;
  font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: left;
  padding: 4px 12px 4px 6px; border: 0; border-bottom: 1px solid var(--line-2);
}
.build-muster td, .rt-table td { padding: 5px 12px 5px 6px; border: 0; border-bottom: 1px solid var(--line); }
.build-muster tr:nth-child(even) td, .rt-table tr:nth-child(even) td { background: var(--zebra); }
.build-muster td:first-child { font-family: var(--mono); color: var(--accent); }
.rt-table-wrap { overflow-x: auto; }

.ledger .entry { padding: 7px 6px; border-radius: 4px; }
.ledger .entry:nth-child(even) { background: var(--zebra); }
.ledger .amt, .ledger .bal, .pl-stop > .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pl-stop:nth-child(even) { background: var(--zebra); }

.pick-table-head { font-family: var(--display); font-stretch: condensed; text-transform: uppercase; letter-spacing: .07em; font-size: 11.5px; color: var(--muted); }
.pick-table-row > :first-child { font-family: var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.pick-table-row:nth-child(odd) { background: var(--zebra); }

.mk-row:nth-child(even) { background: var(--zebra); border-radius: 4px; }
.mk-row { padding-inline: 6px; }

/* ---------- the Personal Data sheet as a printed form ---------- */
.sheet input:not([type='checkbox']):not([type='radio']), .sheet textarea, .sheet select {
  background: color-mix(in srgb, var(--panel-2) 45%, transparent);
  border: 0; border-bottom: 1px solid var(--line-2); border-radius: 3px 3px 0 0;
}
.sheet input:not([type='checkbox']):not([type='radio']):focus, .sheet textarea:focus, .sheet select:focus {
  outline: none; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent);
}
.sheet .field > span, .sheet label > span:first-child { text-transform: uppercase; letter-spacing: .07em; font-size: 11px; }
.sheet .upp { font-size: 22px; letter-spacing: .28em; font-family: var(--mono); }
.char-row { padding: 5px 6px; border-radius: 4px; }
.char-row:nth-child(even) { background: var(--zebra); }
.char-row .char-name { letter-spacing: .08em; }
.char-row .dm { justify-self: end; min-width: 2.6em; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line-2); text-align: center; }

/* ---------- Trade cards ---------- */
.trade-cap .meter { height: 10px; background: repeating-linear-gradient(90deg, var(--bg) 0 9px, color-mix(in srgb, var(--line) 70%, var(--bg)) 9px 10px); }
.trade-cap .meter span { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 70%, #000), var(--ok)); }
.trade-cap .cap-grid > span:first-child, .cap-grid > .muted { text-transform: uppercase; letter-spacing: .06em; font-size: 11.5px; }
.world-card .fold-title { font-family: var(--display); font-stretch: condensed; font-size: 12px; }

@media (prefers-reduced-transparency: reduce) { body::before, .world-card::before, .drawer-head::before { display: none; } }

/* ---------- Roll moments and quiet mode (Table and Sim plan, phase 2; rollmoment.js, quiet.js) ---------- */
.roll-moment {
  position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(3px); text-align: center; cursor: pointer; padding: 20px;
}
.roll-moment .rm-what { font-family: var(--display); text-transform: uppercase; letter-spacing: .08em; font-size: 22px; }
.roll-moment .rm-dice { display: flex; gap: 10px; margin: 6px 0; }
.roll-moment .rm-die {
  width: 54px; height: 54px; border-radius: 9px; background: var(--text); color: var(--bg);
  display: flex; align-items: center; justify-content: center; font: 700 30px var(--mono); box-shadow: 0 4px 10px rgba(0,0,0,.45);
}
.roll-moment.tumbling .rm-die { animation: rm-tumble .18s linear infinite; }
@keyframes rm-tumble { 0% { transform: rotate(-14deg) translateY(-2px); } 50% { transform: rotate(12deg) translateY(3px); } 100% { transform: rotate(-14deg) translateY(-2px); } }
.roll-moment .rm-total { font: 700 72px/1 var(--mono); }
.roll-moment.landed .rm-total { animation: rm-land .3s ease-out; }
@keyframes rm-land { from { transform: scale(1.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.roll-moment .rm-vs { font-family: var(--mono); color: var(--muted); }
.roll-moment .rm-band { font-family: var(--display); font-size: 26px; text-transform: uppercase; letter-spacing: .05em; }
.roll-moment .rm-band.ok { color: var(--ok); } .roll-moment .rm-band.bad { color: var(--bad); }
.roll-moment .rm-nat { font-family: var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--warn); }
.roll-moment .rm-skip { position: absolute; bottom: 18px; color: var(--muted); font-size: 12px; }
.roll-moment.tumbling .rm-total, .roll-moment.tumbling .rm-vs, .roll-moment.tumbling .rm-band, .roll-moment.tumbling .rm-nat { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .roll-moment.tumbling .rm-die, .roll-moment.landed .rm-total { animation: none; } }

.quiet-standby {
  position: fixed; inset: 0; z-index: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg); color: var(--text); cursor: pointer; text-align: center;
}
.quiet-standby[hidden] { display: none; }
.quiet-standby .qs-tag { font-family: var(--mono); letter-spacing: .25em; text-transform: uppercase; color: var(--accent); font-size: 12px; }
.quiet-standby .qs-date { font: 700 44px/1.1 var(--mono); margin-top: 8px; }
.quiet-standby .qs-time { font: 500 22px var(--mono); color: var(--muted); }
.quiet-standby .qs-where { font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; font-size: 18px; margin-top: 10px; }
.quiet-standby .qs-hint { position: absolute; bottom: 28px; color: var(--muted); font-size: 12px; opacity: .7; }

/* ---------- The jump ritual on comms (jumpritual.js) ---------- */
.jump-count { position: fixed; inset: 0; z-index: 950; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: color-mix(in srgb, var(--bg) 94%, transparent); text-align: center; padding: 20px; }
.jump-count .jc-who { font-family: var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.jump-count .jc-n { font: 700 140px/1 var(--mono); color: var(--accent); animation: jc-n 1s ease-out; }
@keyframes jc-n { from { transform: scale(1.4); opacity: .2; } to { transform: scale(1); opacity: 1; } }
.jump-count.flash { background: #fff; animation: jc-flash .9s ease-out forwards; }
@keyframes jc-flash { from { opacity: 1; } to { opacity: 0; } }
.jumpspace-card { margin: 0 16px 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px;
  background: radial-gradient(ellipse at 20% 30%, color-mix(in srgb, var(--info) 18%, transparent), transparent 60%), radial-gradient(ellipse at 80% 80%, color-mix(in srgb, var(--handout) 16%, transparent), transparent 55%), var(--panel); }
.jumpspace-card[hidden] { display: none; }
.jumpspace-card .js-tag { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--accent); }
.jumpspace-card .js-title { font-family: var(--display); font-size: 24px; text-transform: uppercase; letter-spacing: .04em; }
.jumpspace-card .js-mine { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.jumpspace-card .js-mine input { flex: 1; min-width: 140px; }
.jumpspace-card .js-crew { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .jump-count .jc-n, .jump-count.flash { animation: none; } }

/* ---------- Fleet: the Shipyard (shipdeals.js; 2026-11-25) ---------- */
.yard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.yard-card { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; color: var(--text); font: inherit; cursor: pointer; position: relative; }
.yard-card:hover, .yard-card:focus-visible { border-color: var(--accent); outline: none; background: var(--panel-2); }
.yard-name { font-family: var(--display); font-size: 17px; letter-spacing: .02em; }
.yard-price { font-size: 18px; color: var(--accent); margin-top: 4px; }
.yard-avail { margin-top: 6px; }
.yard-other { justify-content: center; border-style: dashed; }
.yard-sil { width: 100%; height: 54px; margin-bottom: 4px; background: var(--bar); border: 1px solid var(--line); border-radius: 8px; }
.yard-sil.big { height: auto; max-width: 320px; aspect-ratio: 260 / 110; }
.yard-sil path { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: var(--accent); stroke-width: 1.5; }
.yard-sil .yard-eng { fill: var(--info); opacity: .8; }
.yard-hero { display: grid; grid-template-columns: minmax(0, 320px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 640px) { .yard-hero { grid-template-columns: 1fr; } }
.yard-checkout .field { margin-top: 10px; }
.yard-checkout .field > span:first-child { display: block; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 4px; flex-wrap: wrap; }
.seg-b { background: var(--panel-2); color: var(--text); border: 0; padding: 7px 12px; font: inherit; cursor: pointer; }
.seg-b + .seg-b { border-left: 1px solid var(--line); }
.seg-b.on { background: var(--accent); color: var(--accent-ink); }
.seg-b:disabled { opacity: .45; cursor: not-allowed; }
.yard-share { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.yard-bill { display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; margin: 14px 0 0; padding: 10px 12px; background: var(--bar); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.yard-bill dt { color: var(--muted); }
.yard-bill dd { margin: 0; text-align: right; }
.yard-bill dd.yard-total { color: var(--text); font-weight: 600; border-top: 1px solid var(--line); padding-top: 4px; }
.yard-bill dt:has(+ dd.yard-total) { border-top: 1px solid var(--line); padding-top: 4px; color: var(--text); }
.deal-ask { padding: 8px 0; border-bottom: 1px dashed var(--line); }
p.bad { color: var(--bad); }
.yard-checkout .seg { width: fit-content; max-width: 100%; }

/* ---------- Scene events (sceneevents.js; 2026-11-25) ---------- */
.ev-ed { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }
.ev-out-ed { border-left: 3px solid var(--line-2); padding: 6px 0 6px 10px; margin: 6px 0; }
.ev-effects { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ev-effects > select { align-self: flex-start; }
.ev-list { display: flex; flex-direction: column; gap: 10px; }
.ev-play { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); }
.ev-play.finished { opacity: .75; }
.ev-row { border-top: 1px dashed var(--line); padding: 8px 0 4px; margin-top: 6px; }
.ev-row.done > .row:first-child strong::after { content: ' ✓'; color: var(--ok); }
.ev-log { margin: 4px 0 0; padding-left: 18px; }
.ev-cond { display: inline-flex; align-items: center; gap: 4px; border-color: var(--warn); color: var(--warn); }
.ev-x { background: none; border: 0; color: inherit; cursor: pointer; padding: 0 2px; font: inherit; }
.sheet-conditions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px; }
.sc-items { display: flex; flex-direction: column; gap: 8px; }
.sc-item-ed { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.sc-item-ed > .ev-ed { border: 0; padding: 0; margin: 0; background: none; }
.ev-ref .sc-face { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.link-picker { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.link-picker select { max-width: 100%; }
.link-chip { display: inline-flex; align-items: center; gap: 4px; }
.link-chip.doc { border-color: var(--handout); color: var(--handout); }
.ho-sub { margin: 8px 0 4px; text-transform: uppercase; letter-spacing: .06em; }
.msg-links .btn { text-align: left; }
