/* ============================================================================
   Trucking Challenge — "cabin" design system (2026-07-17 UX redesign).
   The app reads as a trip computer: a deep night-dash ground, amber backlit
   readouts for the numbers that matter, gauge tiles, and one visual voice.
   Same DOM contracts as before — only the chrome changed.
   ========================================================================== */
:root {
  --bg: #0e1116;
  --deep: #0a0d12;          /* instrument wells — darker than the page */
  --panel: #171c24;
  --panel-2: #1f2630;
  --line: #2a323d;
  --bezel: #39424f;
  --text: #e6edf3;
  --muted: #8a97a8;
  --accent: #ffb000;        /* amber, instrument-backlight */
  --accent-2: #3fb950;      /* go-green */
  --red: #f0533a;
  --blue: #4aa3ff;
  --glow: 0 0 12px rgba(255, 176, 0, .35);
  --glow-green: 0 0 12px rgba(63, 185, 80, .30);
  --display: "Cascadia Code", ui-monospace, "SF Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1100px 420px at 50% -10%, #121822 0, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Micro-label: the dashboard's uppercase instrument caption. */
.cell-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .13em;
  color: var(--muted); font-weight: 700;
}

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; background: linear-gradient(180deg, #1a212b, var(--panel));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 800; letter-spacing: .3px; }
.meta { display: flex; align-items: center; gap: 12px; }
.pill {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .05em;
}
/* Top-bar icon button (⚙️ Settings) + the settings page's own ← back button. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; font-size: 17px; line-height: 1;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--bezel); background: #262f3b; }
.icon-btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* The `html.tc-android .meta::after` reserve that used to sit here went with the Android VIEWER app
   (retired 2026-08-08). It held 56px at the right end of this bar for a NATIVE antenna button the
   WebView wrapper parked over the page, and it was one half of a two-file wire contract with that
   app's buildHandle/MEASURE_BAR. With no wrapper there is no native button and nothing to reserve
   for: this bar is a browser bar again, on every device. */

.pill-off { color: var(--muted); background: #11151b; }
.pill-on { color: #04240f; background: var(--accent-2); border-color: var(--accent-2); box-shadow: var(--glow-green); }
.pill-paused { color: #2a1c00; background: var(--accent); border-color: var(--accent); box-shadow: var(--glow); }

/* ---- instrument cluster: bank + telemetry ------------------------------- */
main { padding: 0 14px; }
.cluster {
  /* auto-fit so a hidden cell (bank before the first state push) never leaves an empty column */
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1px;
  margin: 14px 0 0; background: var(--line);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.gauge-cell { background: var(--deep); padding: 14px 16px; min-width: 0; }
.gauge-cell.hidden { display: none; }

.bank .cell-label { display: block; margin-bottom: 6px; }
.bank-amt {
  font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1.05;
  color: var(--accent); text-shadow: var(--glow);
  font-variant-numeric: tabular-nums; letter-spacing: .4px;
  overflow-wrap: anywhere;
}
.bank-amt.negative { color: var(--red); text-shadow: 0 0 12px rgba(240, 83, 58, .35); }
.bank-sub { margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bezel {
  height: 1px; margin-top: 12px; opacity: .6;
  background: repeating-linear-gradient(90deg, var(--bezel) 0 1px, transparent 1px 9px);
}

.tel .cell-label { display: block; margin-bottom: 7px; }
.tel-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tel-game {
  font-family: var(--display); font-weight: 700; font-size: 16px;
  color: var(--accent); text-shadow: var(--glow);
}
.tel-state { color: var(--muted); font-size: 13px; }
.tel-job { margin-top: 6px; color: var(--blue); font-size: 13px; min-height: 1.2em; overflow-wrap: anywhere; }
/* (.odo-row/.odo-cell/.odo-val removed 2026-07-18 with the speed/fuel/odo mini-readouts.) */

/* ---- launch strip (ignition row) ---------------------------------------- */
/* 2026-07-31: the ignition row lives at the BOTTOM now (just above Settings) and is a grid of game
   icon tiles rather than labelled buttons — the art already carries each game's name. auto-fit keeps
   it one clean grid from phone to desktop instead of a row that wraps raggedly. */
.launch-strip { margin: 18px 0 0; }
.launch-tiles {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.ltile {
  padding: 0; cursor: pointer; overflow: hidden; line-height: 0;
  background: linear-gradient(180deg, #1c242f, var(--panel));
  border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .14s, box-shadow .14s, transform .14s;
}
/* Square tiles whatever the column width, so the grid stays even as it reflows. */
.ltile img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
.ltile:hover { border-color: var(--accent); box-shadow: var(--glow); }
.ltile:active { transform: translateY(1px); }
.ltile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Disabled while a session is in flight (app.js drives this off launcher.busy). Greyed AND
   desaturated: dimming alone still reads as "clickable but dark" on the brighter game art. */
.ltile:disabled {
  opacity: .4; cursor: default; border-color: var(--line); box-shadow: none;
}
.ltile:disabled img { filter: grayscale(1); }

/* (.launch-btns / .lbtn — the labelled ▶ buttons — were removed 2026-07-31 with the move to icon
   tiles above. Nothing referenced them afterwards.) */

.econ-status { margin-top: 10px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.econ-status.hidden { display: none; }
.econ-status.ok { color: var(--accent-2); }
.econ-status.no { color: var(--red); }
.econ-status.warn {
  color: #ffb14e; background: rgba(255, 177, 78, .08);
  border: 1px solid rgba(255, 177, 78, .35); border-radius: 8px; padding: 8px 12px;
}

/* ---- the hero: current run (challenge card) ------------------------------ */
.card {
  background:
    radial-gradient(560px 180px at 10% 0, #1a222d 0, transparent 70%),
    var(--panel);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  margin-top: 12px;
}
.muted { color: var(--muted); }

.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge {
  font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: .05em;
  padding: 2px 9px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
}
.badge.kind { color: #241800; background: var(--accent); border-color: var(--accent); }
/* "ACTIVE RUN" eyebrow next to the game badge */
.run-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: .13em;
  color: var(--accent); font-weight: 700;
}

.c-title { font-size: 24px; font-weight: 800; margin: 4px 0 6px; text-wrap: balance; }
.c-flavor {
  font-size: 14.5px; font-style: italic; color: var(--muted); margin: 14px 0 8px;
  line-height: 1.45; border-left: 2px solid var(--bezel); padding-left: 12px;
}
.c-desc { font-size: 15px; color: var(--muted); margin: 0 0 18px; }

.status-line { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* progress = trip meter: deep ticked track, amber glowing fill */
.progress-wrap { margin: 6px 0 18px; }
.progress-track {
  position: relative; height: 14px; background: var(--deep);
  border: 1px solid var(--bezel); border-radius: 8px; overflow: hidden;
}
.progress-track::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 10%);
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #c98700, var(--accent));
  box-shadow: var(--glow);
  transition: width .5s ease;
}
.progress-fill.done { background: linear-gradient(90deg, #2c9440, var(--accent-2)); box-shadow: var(--glow-green); }
.progress-fill.over { background: linear-gradient(90deg, #b4372a, var(--red)); box-shadow: 0 0 12px rgba(240, 83, 58, .4); }
.progress-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 13.5px; }
.progress-pct {
  font-family: var(--display); font-weight: 700; color: var(--accent);
  text-shadow: var(--glow); font-variant-numeric: tabular-nums;
}
.progress-fill.done + * .progress-pct { color: var(--accent-2); }

/* PHASE8: reward line + per-good bars + fines meter */
.reward-line {
  margin: 4px 0 12px; padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: rgba(255, 176, 0, .07); border: 1px solid rgba(255, 176, 0, .3);
  border-left: 3px solid var(--accent);
}
.reward-line.ok {
  background: rgba(63, 185, 80, .08); border-color: rgba(63, 185, 80, .4);
  border-left-color: var(--accent-2);
}
/* The "🎮 In-game" money translation under money goals — present only when a game's factor ≠ 1. */
.equiv-line {
  margin: 2px 0 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
/* Extra top space so each label (below its bar) can't be read as the caption of the NEXT bar. */
.goods .progress-wrap { margin: 16px 0 10px; }
.grp-goods-count { font-size: 13px; margin: 10px 0 0; }
.goods .progress-track { height: 10px; }
.goods .progress-labels { font-size: 13px; margin-top: 4px; }
.progress-wrap.fines .progress-track { height: 10px; border-color: rgba(240, 83, 58, .45); }
.progress-wrap.fines .progress-fill { background: linear-gradient(90deg, #b4372a, var(--red)); box-shadow: 0 0 10px rgba(240, 83, 58, .4); }
.progress-wrap.fines .progress-labels { font-size: 13px; margin-top: 4px; }
.progress-wrap.fines .progress-pct { color: var(--red); text-shadow: none; }

/* challenge-card per-game generation checkboxes */
.cg-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.cg-check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text); }
.cg-check input { accent-color: var(--accent); }

/* two-part kinds (multi-leg card look) */
.ml { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 18px; }
.ml-comp { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); }
.ml-comp.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, var(--glow); }
.ml-comp.done { border-color: var(--accent-2); opacity: .85; }
.ml-comp.pending { opacity: .6; }
.ml-part { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.ml-route { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.ml-city { font-weight: 700; font-size: 16px; }
.ml-sub { color: var(--muted); font-size: 12px; }
.ml-arrow { color: var(--accent); font-weight: 700; margin: 0 2px; }
.ml-dist { color: var(--muted); font-size: 12px; margin-left: auto; }
.ml-status { margin-top: 8px; font-size: 14px; }
.ml-status.ok { color: var(--accent-2); font-weight: 600; }
/* The load already seeded for this part — the origin city used to live only in a dismissible modal. */
.ml-seeded { margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 13px; line-height: 1.5;
             background: color-mix(in srgb, var(--accent) 12%, transparent);
             border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.ml-seeded .ml-seeded-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.ml-legs { margin: 8px 0 0; padding-left: 20px; color: var(--text); font-size: 13px; }
.ml-legs li { margin: 2px 0; }
.ml-cargo { color: var(--muted); }

.done-banner {
  margin: 8px 0 16px; padding: 12px 14px; border-radius: 10px;
  background: rgba(63, 185, 80, .12); border: 1px solid var(--accent-2); color: #9fe6b4;
  font-weight: 600;
}

/* buttons */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
button {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 12px;
  padding: 13px 18px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  flex: 1 1 auto; min-height: 48px;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--accent-2); border-color: var(--accent-2); color: #04240f; }
button.ghost { background: transparent; }
button.danger { background: transparent; border-color: var(--red); color: var(--red); }
/* In the hero card, Cancel is an escape hatch, not the main event — don't let it stretch full-width. */
.card .actions .danger { flex: 0 1 auto; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---- gauge tiles: loan + disc golf --------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); min-width: 0;
}
.tile.hidden { display: none; }
.tile-head { display: flex; align-items: center; gap: 14px; }
.tile-head .arc { flex: none; }
.arc-text {
  font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums;
}
.tile-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-big {
  font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tile-big.amber { color: var(--accent); text-shadow: var(--glow); }
.tile-big.negative { color: var(--red); text-shadow: 0 0 12px rgba(240, 83, 58, .35); }
.tile-sub { font-size: 12.5px; color: var(--muted); }
.tile-sub b { color: var(--text); font-family: var(--display); font-weight: 700; }

/* secondary stat row inside a tile (kept from the old dg-stats look, left-aligned now) */
.dg-stats { display: flex; gap: 16px 20px; flex-wrap: wrap; margin-top: 12px; }
.dg-stat { display: flex; flex-direction: column; gap: 2px; }
.dg-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.dg-stat-val { font-family: var(--display); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dg-tickets { color: var(--accent); }
.econ-amount.negative { color: var(--red); }

.loan-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.loan-actions input {
  flex: 1 1 120px; min-width: 0; max-width: 200px;
  background: var(--deep); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 14px; min-height: 40px;
  font-family: var(--display); font-variant-numeric: tabular-nums;
}
.loan-actions input:focus { outline: none; border-color: var(--accent); }
.loan-actions button { flex: 0 1 auto; min-height: 40px; padding: 8px 16px; font-size: 14px; }
.loan-ledger { margin-top: 12px; }
.loan-ledger summary {
  cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700;
}
.loan-ledger .hist-list { margin-top: 8px; }

/* ---- group / multiplayer section ----------------------------------------- */
.group-sec {
  margin-top: 12px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 16px; padding: 16px 18px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.group-sec.hidden { display: none; }
.grp-restart {
  margin-bottom: 12px; padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 176, 0, .12); border: 1px solid var(--accent); color: #ffd98a;
  font-size: 14px; font-weight: 600; line-height: 1.35;
}
.grp-restart.hidden { display: none; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.group-badge {
  font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 5px; color: #04121f; background: var(--blue);
}
.group-status { color: var(--muted); font-size: 13px; }
.group-body { font-size: 15px; }
.grp-title { font-size: 20px; font-weight: 800; margin: 2px 0 4px; text-wrap: balance; }
.grp-flavor {
  font-size: 14px; font-style: italic; color: var(--muted); margin: 0 0 6px; line-height: 1.4;
  border-left: 2px solid var(--blue); padding-left: 12px;
}
.grp-desc { font-size: 14px; color: var(--muted); margin: 0 0 14px; }
.grp-members { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.grp-members li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 7px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; }
.grp-mname { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-mamt { color: var(--blue); font-variant-numeric: tabular-nums; white-space: nowrap; }
.grp-none { margin: 10px 0 0; }
.grp-controls { display: flex; gap: 10px; margin: 6px 0 14px; }

/* TC Open leaderboard (reuses .grp-members row chrome; columns via flex) */
.tc-board li { justify-content: flex-start; align-items: baseline; }
.tc-place { flex: 0 0 30px; font-weight: 700; }
.tc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-npc { color: var(--muted); }
.tc-score { flex: 0 0 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--display); }
.tc-rounds { flex: 0 0 52px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-prize { flex: 0 0 auto; margin-left: 10px; white-space: nowrap; color: var(--accent-2); font-size: 13px; }
.tc-row.tc-p1 { border-color: rgba(255, 209, 102, .55); background: rgba(255, 209, 102, .07); }
.tc-row.tc-p2 { border-color: rgba(200, 205, 215, .45); background: rgba(200, 205, 215, .06); }
.tc-row.tc-p3 { border-color: rgba(205, 137, 80, .5); background: rgba(205, 137, 80, .07); }

/* ---- The Black Market (2026-08-03) ----------------------------------------
   Same section chrome as GROUP, but edged in red rather than blue: this is the
   one part of the app that can take money OFF you, and it should not read as
   another friendly panel. */
.bm-sec {
  margin-top: 12px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: 16px; padding: 16px 18px; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.bm-sec.hidden { display: none; }
.bm-badge {
  font-family: var(--display); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  padding: 3px 9px; border-radius: 5px; color: #1a0805; background: var(--red);
}

.bm-streak { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.bm-streak-n {
  font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1;
  color: var(--accent); text-shadow: var(--glow); font-variant-numeric: tabular-nums;
}
.bm-streak-label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.bm-bonus { color: var(--accent-2); font-weight: 700; font-size: 13px; }

/* Board rows and the held-job panel share the artwork + text layout. */
.bm-board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bm-row, .bm-held {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.bm-held { border-color: var(--red); background: rgba(240, 83, 58, .07); }
.bm-row.bm-hot { border-color: rgba(255, 176, 0, .35); }
.bm-row.bm-untouchable { border-color: rgba(240, 83, 58, .45); }
.bm-row-text, .bm-held-text { flex: 1 1 auto; min-width: 0; }
.bm-art {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  background: var(--deep); border: 1px solid var(--line);
}
.bm-art-none {
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.bm-eyebrow {
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--red);
}
.bm-name { font-weight: 700; font-size: 15px; text-wrap: balance; }
.bm-heat {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  vertical-align: 2px;
}
.bm-blurb { font-size: 13px; font-style: italic; color: var(--muted); margin: 3px 0 5px; line-height: 1.4; }
.bm-terms { font-size: 13px; color: var(--text); line-height: 1.45; font-variant-numeric: tabular-nums; }
.bm-warn { display: block; color: var(--red); margin-top: 3px; }
/* Why the board never changes (2026-08-05, replacing the re-roll button that used to sit here). */
.bm-note { font-size: 12px; line-height: 1.45; margin: 8px 2px 0; }

/* Distance carried toward a job's total (MinKm accumulates across legs). */
.bm-progress { margin: 6px 0 4px; }
.bm-progress-bar {
  height: 6px; border-radius: 999px; background: var(--deep);
  border: 1px solid var(--line); overflow: hidden;
}
.bm-progress-bar span { display: block; height: 100%; background: var(--accent); box-shadow: var(--glow); }
.bm-progress-text { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* "Now playing" second line: what's riding in the cab, under the real job. */
.tel-contraband {
  margin-top: 5px; font-size: 13px; color: #ffb9ad; line-height: 1.35;
  border-left: 2px solid var(--red); padding-left: 8px;
}
.tel-contraband.hidden { display: none; }
.bm-take { flex: 0 0 auto; align-self: center; }
.bm-stats { margin-top: 14px; }

/* Outcome modal */
.bm-modal-art {
  width: 128px; height: 128px; border-radius: 12px; object-fit: cover;
  margin: 0 auto 12px; display: block; border: 1px solid var(--line);
}
.bm-modal-art.hidden { display: none; }
.bm-modal-money {
  font-family: var(--display); font-size: 30px; font-weight: 800;
  color: var(--accent-2); text-shadow: var(--glow-green); margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.bm-modal-money.bm-loss { color: var(--red); text-shadow: 0 0 12px rgba(240, 83, 58, .35); }
.bm-split { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.bm-split > div {
  display: flex; justify-content: space-between; gap: 12px; font-size: 14px;
  padding: 7px 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.bm-split-total { font-weight: 700; border-color: var(--bezel); }

/* TC Open group settings row */
.tc-set { display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.tc-set input {
  width: 58px; min-height: 0; padding: 4px 6px; font-size: 13px;
  font: inherit; color: var(--text); background: var(--deep);
  border: 1px solid var(--line); border-radius: 8px;
}
.tc-set-apply { min-height: 0; padding: 5px 10px; font-size: 13px; flex: 0 0 auto; }

/* ---- pages (2026-08-03) ----------------------------------------------------
   The dashboard and Settings are two views of one document, swapped on #settings.
   (This replaced the <details> "collapsible" drawer chrome, which nothing else used.)

   NO overflow:hidden here, deliberately. It clips a rounded corner, but it also breaks
   position:sticky for every descendant — which is why the "one save for everything" bar had never
   actually been sticky inside the old drawer. The corners are rounded on the children instead. */
.page { margin: 14px 0 0; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.page.hidden, #dashboard.hidden { display: none; }
.page-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--deep);
  border-radius: 15px 15px 0 0;   /* 1px inside the parent's 16px, so the border isn't overlapped */
}
.page-title { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: .2px; }

/* ---- Help page (2026-08-05) --------------------------------------------------------------------
   Prose, so it is sized for READING rather than for scanning a form: a measure cap, generous line
   height, and headings that separate by space instead of by rules everywhere. Shares .page/.page-head
   with Settings — only the body differs. */
.help-body { padding: 16px; max-width: 760px; margin: 0 auto; }   /* centred: it is a column of prose */
.help-lede { font-size: 15px; line-height: 1.6; margin: 0 0 16px; }
.help-body p { line-height: 1.6; }

/* Contents. Buttons, not links — see the note in index.html about hash routing. */
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.help-toc button {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px;
  color: var(--blue); font: inherit; font-size: 13px; padding: 6px 12px; cursor: pointer;
}
.help-toc button:hover { border-color: var(--bezel); background: #262f3b; }
.help-toc button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.help-group { margin: 0 0 30px; scroll-margin-top: 64px; }   /* clears the sticky top bar on a jump */
.help-h2 {
  font-size: 16px; font-weight: 800; margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.help-h3 { font-size: 14px; font-weight: 700; margin: 18px 0 6px; }
.help-note { color: var(--muted); font-size: 13px; margin: -4px 0 14px; }
.help-aside { color: var(--muted); font-size: 13px; }

/* The four golden rules: a big number beside each so they read as rules, not paragraphs. */
.help-rule { display: flex; gap: 14px; margin: 0 0 16px; }
.help-rule-n {
  flex: 0 0 30px; height: 30px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--bezel); color: var(--blue);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.help-rule h3 { font-size: 14px; font-weight: 700; margin: 4px 0 4px; }
.help-rule p { margin: 0 0 6px; }

/* One card per game, each a definition list so the same four questions line up down the page. */
.help-game {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin: 0 0 12px;
}
.help-game h3 { font-size: 14px; font-weight: 800; margin: 0 0 10px; }
.help-game dl { margin: 0; display: grid; grid-template-columns: 148px 1fr; gap: 8px 14px; }
.help-game dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; padding-top: 2px; }
.help-game dd { margin: 0; font-size: 13px; line-height: 1.55; }
/* Stack the labels above their answers once two columns would squeeze the prose to a ribbon. */
@media (max-width: 560px) {
  .help-game dl { grid-template-columns: 1fr; gap: 2px; }
  .help-game dd { margin: 0 0 10px; }
}

.help-list { margin: 6px 0 0; padding-left: 22px; }
.help-list li { line-height: 1.6; margin: 0 0 8px; }
.help-checks li { padding-left: 2px; }

.connect-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.qr-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.qr-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; text-align: center; width: 192px;
}
.qr {
  width: 168px; height: 168px; background: #fff; padding: 8px; border-radius: 8px;
  image-rendering: pixelated; display: block; margin: 0 auto 8px;
}
.qr-iface { font-weight: 700; }
.qr-url { color: var(--blue); font-size: 13px; word-break: break-all; }
.qr-url a { color: var(--blue); }

/* history (inside its collapsible drawer) */
.hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.hist-item {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: flex-start; gap: 12px;
}
.hist-icon { font-size: 18px; line-height: 1; }
.hist-body { flex: 1 1 auto; min-width: 0; }
.hist-name { font-weight: 700; }
.hist-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.hist-sub .ok { color: var(--accent-2); }
.hist-sub .no { color: var(--red); }
.hist-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.hist-flavor { color: var(--accent); font-style: italic; font-size: 13px; margin-top: 5px; line-height: 1.4; }
.hist-outcome { color: var(--muted); font-style: italic; font-size: 13px; margin-top: 4px; }
.hist-breakdown { color: var(--blue); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hist-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 2px 8px; }
.hidden { display: none; }
.grp-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 6px;
  color: #04121f; background: var(--blue); vertical-align: middle; margin-right: 4px;
}

/* ---- settings: six task-based tabs ---------------------------------------- */
.settings-body { padding: 0; }
.set-tabs {
  display: flex; gap: 2px; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); background: var(--deep);
}
.set-tabs::-webkit-scrollbar { display: none; }
.set-tab {
  flex: 0 0 auto; min-height: 0; font-size: 14px; font-weight: 600;
  color: var(--muted); background: none; border: none; border-radius: 0;
  border-bottom: 2px solid transparent; padding: 10px 13px 12px;
  white-space: nowrap; cursor: pointer; transition: color .12s;
}
.set-tab:hover { color: var(--text); }
.set-tab:active { transform: none; }
.set-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.set-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }

.settings-form { display: flex; flex-direction: column; padding: 16px; }
.set-panel { display: none; flex-direction: column; gap: 14px; }
.set-panel.active { display: flex; animation: panel-in .16s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .set-panel.active { animation: none; } }
.set-intro { font-size: 13px; margin: 0; max-width: 64ch; }

.set-group {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 12px;
}
.set-subhead {
  font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em;
  text-transform: uppercase; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.restart-chip {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #2a1c00; background: var(--accent); padding: 2px 7px; border-radius: 999px;
}
.set-field { display: flex; flex-direction: column; gap: 6px; }
.set-label { font-size: 13px; font-weight: 600; color: var(--text); }
.set-field input {
  font: inherit; color: var(--text); background: var(--deep);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 44px;
}
.set-field input:focus { outline: none; border-color: var(--accent); }
.set-field small { font-size: 12px; }
.set-field button { align-self: flex-start; flex: 0 0 auto; }
.set-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-actions button { flex: 0 0 auto; min-width: 120px; }
.set-status { font-size: 13px; font-weight: 600; }
.set-status.ok { color: var(--accent-2); }
.set-status.no { color: var(--red); }
.set-note { font-size: 12px; margin: 0; }
.set-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.set-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; margin-top: 2px; }

/* sticky save bar: one save for all tabs */
.set-savebar {
  position: sticky; bottom: 0; margin: 16px -16px -16px; padding: 12px 16px;
  background: linear-gradient(180deg, rgba(23, 28, 36, 0), var(--panel) 35%);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.set-savenote { font-size: 12px; flex: 1 1 240px; }
.set-save-all { flex: 0 0 auto; }

code {
  font-family: var(--display); font-size: 12.5px; color: var(--accent);
  background: var(--deep); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

/* connected economy: one row per game (name · ×factor · diagnostics trail) */
.eco-games { display: flex; flex-direction: column; gap: 10px; margin: 2px 0; }
.eco-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.eco-game { font-weight: 700; font-size: 14px; }
.eco-factor { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.eco-factor input {
  font: inherit; color: var(--text); background: var(--deep); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; width: 90px; min-height: 40px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.eco-factor input:focus { outline: none; border-color: var(--accent); }
.eco-factor input:disabled { opacity: .5; }
.eco-last { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.eco-diags { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; }
.eco-diag {
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; line-height: 1.35;
}
.eco-diag.warn { color: #ffb14e; }
.eco-diag-tag {
  display: inline-block; min-width: 52px; margin-right: 6px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; font-size: 10px; opacity: .8;
}

/* debug / diagnostics (now inside Settings → Diagnostics) */
.dbg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; }
.dbg-cell { display: flex; flex-direction: column; min-width: 0; }
.dbg-cell label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.dbg-cell span { font-family: var(--display); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dbg-cell span.over { color: var(--red); }
.dbg-job { margin-top: 4px; color: var(--blue); font-size: 13px; word-break: break-word; }
.dbg-log-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dbg-log {
  list-style: none; margin: 0; padding: 10px 12px;
  background: var(--deep); border: 1px solid var(--line); border-radius: 10px;
  max-height: 260px; overflow-y: auto;
  font: 12px/1.5 var(--display);
  color: #c6d2de; white-space: pre-wrap; word-break: break-word;
}
.dbg-log li { padding: 1px 0; border-bottom: 1px solid rgba(255, 255, 255, .03); }

footer {
  padding: 18px 16px 28px; color: var(--muted); font-size: 13px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* ---- modals ---------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 9, 13, .72); backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-card {
  width: 100%; max-width: 440px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 26px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); text-align: center;
  animation: pop .32s cubic-bezier(.18, .9, .32, 1.2) both;
  /* A tall card (TC Open board on a landscape tablet) must scroll INSIDE the fixed overlay,
     or the bottom button sits unreachable off-screen. 100% = the .modal padding box. */
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
}
@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }
.modal-badge {
  display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .08em; padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.modal-badge.win { color: #04240f; background: var(--accent-2); box-shadow: var(--glow-green); }
.modal-badge.lose { color: #2a0d07; background: var(--red); }
.modal-title { font-size: 22px; font-weight: 800; margin-bottom: 12px; text-wrap: balance; }
.modal-flavor { font-size: 15px; font-style: italic; color: var(--muted); margin: 0 0 12px; line-height: 1.45; }
.modal-outcome { font-size: 17px; color: var(--text); margin: 0 0 22px; line-height: 1.5; white-space: pre-line; }
.modal-card > button { width: 100%; }

/* group reward modal breakdown */
.gm-breakdown { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.gm-breakdown li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; font-variant-numeric: tabular-nums; }
.gm-breakdown li span:first-child { font-weight: 600; }
.gm-breakdown li span:last-child { color: var(--blue); }

/* in-app confirm sheet (replaces native confirm()) */
.confirm-card { text-align: left; }
.confirm-title { font-size: 17px; font-weight: 800; margin-bottom: 12px; text-wrap: balance; }
.confirm-body { font-size: 14px; color: var(--muted); line-height: 1.5; }
.confirm-body p { margin: 0 0 12px; }
.confirm-body strong { color: var(--text); }
.confirm-actions { margin: 16px 0 0; justify-content: flex-end; }
.confirm-actions button { flex: 0 1 auto; }
/* the price grid: instrument-well cells for the numbers that matter */
.price-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 14px;
}
.price-cell { background: var(--deep); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.price-val {
  font-family: var(--display); font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.price-val.amber { color: var(--accent); text-shadow: var(--glow); }
.price-val.red { color: var(--red); }

/* Story guide modal: a wide, scrollable, left-aligned reader for the rendered markdown. */
.guide-card {
  max-width: 760px; max-height: 84vh; overflow-y: auto;
  text-align: left; padding: 22px 26px; position: relative;
}
.guide-close {
  position: sticky; top: -4px; float: right; width: 34px; height: 34px; min-width: 0; min-height: 0;
  margin: -6px -8px 0 0; padding: 0; border-radius: 999px; font-size: 16px; line-height: 1;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  flex: 0 0 auto;
}
.guide-content { line-height: 1.55; font-size: 14px; color: var(--text); }
.guide-content h1 { font-size: 22px; margin: 6px 0 14px; }
.guide-content h2 { font-size: 18px; margin: 22px 0 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.guide-content h3 { font-size: 15px; margin: 16px 0 8px; }
.guide-content p { margin: 0 0 12px; color: var(--muted); }
.guide-content strong { color: var(--text); }
.guide-content em { color: var(--text); }
.guide-content ul, .guide-content ol { margin: 0 0 12px; padding-left: 22px; color: var(--muted); }
.guide-content li { margin: 4px 0; }
.guide-content hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.guide-content code {
  background: var(--deep); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: 12.5px; color: var(--accent);
}
.guide-content pre {
  background: var(--deep); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; color: var(--text);
}
.guide-content pre code { background: none; border: none; padding: 0; color: inherit; }
.guide-content table { border-collapse: collapse; width: 100%; margin: 0 0 14px; font-size: 12.5px; }
.guide-content th, .guide-content td {
  border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top;
}
.guide-content th { background: var(--panel-2); color: var(--text); }
.guide-content td { color: var(--muted); }

/* ---- FS25 farm value (2026-07-18): breakdown table in the Sell/Rebuy modal ---- */
.fv-table { border-collapse: collapse; width: 100%; margin: 0 0 12px; font-size: 13px; }
.fv-table th, .fv-table td {
  border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: right; white-space: nowrap;
}
.fv-table th:first-child, .fv-table td:first-child { text-align: left; white-space: normal; }
.fv-table thead th { color: var(--muted); font-weight: 600; border-bottom: 2px solid var(--line); }
.fv-table td { color: var(--text); }
.fv-table td:first-child { color: var(--muted); }
.fv-table .fv-neg td { color: var(--red); }
.fv-table tfoot th {
  color: var(--accent); text-shadow: var(--glow); font-size: 14px;
  border-bottom: none; padding-top: 9px;
}

/* The same-currency column total above the bank-units line (2026-07-21): closes the FS25-money part
   of the table before the currency switch, so it carries the heavy top border. */
.fv-table .fv-total-game td {
  color: var(--text); font-weight: 600;
  border-top: 2px solid var(--line); border-bottom: 1px dashed var(--line);
}

/* Stored-goods drill-down rows (mod v0.7.1) */
.fv-table .fv-sub td { color: var(--muted); font-size: 12px; padding-top: 2px; padding-bottom: 2px; border-bottom: none; }
.fv-table .fv-sub td:first-child { padding-left: 18px; }

/* Standing tournaments (stage 4d.3) — entered with a ticket, run alongside the challenge. */
#tournaments { display: grid; gap: 10px; margin-bottom: 12px; }
.tourn-card { background: var(--card, #161b22); border: 1px solid var(--line, #232a33);
              border-radius: 10px; padding: 12px 14px; }
.tourn-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tourn-sub { font-size: .9em; margin: 2px 0 8px; }
.tourn-row { display: flex; gap: 10px; align-items: center; justify-content: space-between;
             flex-wrap: wrap; margin-bottom: 8px; }
.tourn-in { color: var(--good, #6ee7a8); font-weight: 600; }
