:root {
  --bg: #0d1119;
  --panel: #171e2c;
  --panel-2: #1f2839;
  --ink: #ece7da;
  --ink-dim: #98a1b3;
  --accent: #e9c46a;
  --accent-deep: #c9962f;
  --accent-2: #2a9d8f;
  --danger: #e63946;
  --line: #2c3750;
  font-size: 15px;
}

* { box-sizing: border-box; }
#file-warning { display: none; }
html, body { height: 100%; }
/* The viewport scroller lives on <html>: lock it there too, or programmatic
 * scrolls (focus jumps, scroll anchoring) still shove the app offscreen. */
html { overflow: hidden; overflow: clip; overflow-anchor: none; }
/* iOS Safari: track the dynamic viewport so the layout doesn't jump or hide
   behind the collapsing toolbar. */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  /* `hidden` merely hides the scrollbar — focus jumps and Chrome's scroll
   * anchoring can still scroll the body programmatically, leaving the game
   * shoved up with dead space below and NO way for the user to scroll back.
   * `clip` removes the scroll box entirely (hidden stays as the fallback
   * for older engines, with anchoring disabled so it can't drift either). */
  overflow: hidden;
  overflow: clip;
  overflow-anchor: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button, summary, input { touch-action: manipulation; }
button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#app, .screen { height: 100%; }
.screen { display: none; }
.screen.active { display: block; }

/* ---------- global mute / help ---------- */
#btn-mute, #btn-help, #btn-games {
  position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 50;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(18, 23, 35, .72); border: 1px solid var(--line);
  color: var(--ink); font-size: 1.1rem; cursor: pointer;
  backdrop-filter: blur(6px);
}
.mute-menu {
  position: fixed; top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px)); z-index: 50;
}
.mute-menu > #btn-mute { position: static; }
.mute-panel {
  position: absolute; top: 48px; right: 0; display: flex; flex-direction: column; gap: 4px;
  padding: 8px; border-radius: 10px; background: rgba(14,17,26,.95);
  border: 1px solid var(--line); min-width: 140px;
}
.mute-panel.hidden { display: none; }
.mute-panel .mute-cat { text-align: left; font-size: .85rem; padding: 8px 10px; }
.mute-panel .mute-cat.off { opacity: .55; text-decoration: line-through; }
#btn-mute { right: calc(14px + env(safe-area-inset-right, 0px)); }
#btn-help { right: calc(64px + env(safe-area-inset-right, 0px)); font-family: Georgia, serif; font-weight: 700; color: var(--accent); }
#btn-games { right: calc(114px + env(safe-area-inset-right, 0px)); }
.games-list { margin: 0 0 12px; text-align: left; }
.game-row { display: flex; gap: 6px; margin-top: 6px; }
.game-resume { flex: 1; text-align: left; font-size: .84rem; padding: 7px 12px; }
.game-resume.your-move { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 8px rgba(233,196,106,.25); }
.game-forget { padding: 2px 10px; }
#btn-mute:hover, #btn-help:hover { border-color: var(--accent); }

#help-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 7, 12, .72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.help-card {
  width: min(680px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid rgba(233, 196, 106, .35);
  border-radius: 14px; padding: 28px 34px;
  box-shadow: 0 30px 90px rgba(0,0,0,.7);
}
.rules-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rules-head h2 {
  margin: 0; color: var(--accent);
  font-family: "Didot", Georgia, serif; letter-spacing: .04em;
}
.rules-section { margin: 26px 0; font-size: .95rem; line-height: 1.65; color: var(--ink-dim); }
.rules-section b { color: var(--ink); }
.rules-section h3 {
  font-family: "Didot", Georgia, serif; color: var(--ink);
  letter-spacing: .04em; margin: 0 0 8px;
  border-bottom: 1px solid rgba(233, 196, 106, .25); padding-bottom: 6px;
}
.rules-art {
  width: 100%; border-radius: 10px; margin-bottom: 12px;
  border: 1px solid rgba(233, 196, 106, .25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
}
.payoff-lookup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.payoff-lookup select {
  flex: 1; min-width: 130px; background: rgba(10, 14, 22, .8); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: .88rem;
}
.payoff-arrow { color: var(--ink-dim); }
.payoff-result {
  font-family: ui-monospace, monospace; color: var(--accent);
  font-size: 1.05rem; font-weight: 700; min-width: 80px; text-align: right;
}
.conductor-section { border-top: 1px dashed var(--line); padding-top: 18px; }
.conductor-hint { font-size: .85rem; }
#conductor-log { max-height: 240px; overflow-y: auto; margin: 10px 0; }
.conductor-q {
  background: rgba(233, 196, 106, .1); border-radius: 8px 8px 8px 2px;
  padding: 8px 12px; margin: 8px 0 4px; color: var(--ink); font-size: .9rem;
}
.conductor-a {
  border-left: 3px solid var(--accent); padding: 6px 12px;
  margin: 0 0 10px 10px; font-size: .92rem; color: var(--ink-dim);
}
.conductor-a.pending { opacity: .6; font-style: italic; }
.conductor-error { border-left-color: var(--danger); color: var(--danger); }
#conductor-form { display: flex; gap: 8px; }
#conductor-form input { flex: 1; }
#conductor-form button { padding: 8px 18px; }

/* ---------- identity ---------- */
.avatar-chip {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(233, 196, 106, .45); flex: none; background: #0b0e14;
  /* The portraits are dark oils — lift them off the dark UI. */
  filter: brightness(1.18) contrast(1.05);
  cursor: zoom-in;
}
.avatar-chip.clickable { cursor: pointer; width: 48px; height: 48px; }
.avatar-chip.clickable:hover { filter: brightness(1.35); }

/* Tap any portrait to see it properly. */
/* ---- deals -------------------------------------------------------- */
.trade-offer {
  margin: 8px 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(233, 196, 106, .08); border: 1px solid rgba(233, 196, 106, .35);
  font-size: .88rem; line-height: 1.5;
}
#trade-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 16, .88); backdrop-filter: blur(6px);
  animation: win-fade .2s ease-out;
}
.trade-card {
  width: min(440px, 92vw); max-height: 86vh; overflow: auto;
  background: var(--panel); border: 1px solid rgba(233, 196, 106, .35);
  border-radius: 12px; padding: 18px 20px;
  box-shadow: 0 20px 70px rgba(0,0,0,.7);
}
.trade-card h3 { margin: 0 0 10px; font-family: "Didot", Georgia, serif; }
.trade-card h4 {
  margin: 14px 0 6px; font-size: .78rem; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: .08em;
}
.trade-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 6px 0; font-size: .9rem;
}
.trade-row select, .trade-row input {
  background: rgba(10, 14, 22, .8); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  font-size: .88rem; min-width: 150px;
}
.trade-deeds { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.trade-deeds label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#portrait-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(8, 10, 16, .93); backdrop-filter: blur(6px);
  animation: win-fade .2s ease-out; cursor: zoom-out;
}
#portrait-overlay img {
  width: min(340px, 78vw); height: min(340px, 78vw); border-radius: 50%;
  object-fit: cover; border: 4px solid var(--line);
  filter: brightness(1.15) contrast(1.05);
  box-shadow: 0 20px 70px rgba(0,0,0,.7);
}
#portrait-overlay .portrait-name {
  font-family: "Didot", Georgia, serif; font-size: 1.4rem; letter-spacing: .04em;
}
.identity-picker { margin: 6px 0 14px; }
.picker-label {
  display: block; font-size: .72rem; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: .1em; margin: 10px 0 6px;
}
.avatar-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.avatar-pick {
  width: 62px; height: 62px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,.14); cursor: pointer; background: #0b0e14;
  filter: brightness(1.18) contrast(1.05);
  transition: transform .1s, border-color .15s;
}
.avatar-pick:hover { transform: scale(1.12); }
.avatar-pick.selected { border-color: var(--accent); box-shadow: 0 0 10px rgba(233,196,106,.4); }
.color-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick {
  width: 26px; height: 26px; border-radius: 50%; padding: 0;
  border: 2px solid rgba(255,255,255,.25); cursor: pointer;
}
.color-pick.selected { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,.35); }
.color-pick.taken { opacity: .25; cursor: not-allowed; }
.hotseat-row { display: flex; align-items: center; gap: 10px; }
.hotseat-row input { flex: 1; }
.hotseat-row input:disabled { opacity: .4; }
.bot-toggle {
  width: 38px; height: 38px; padding: 0; border-radius: 8px;
  font-size: 1.05rem; flex: none;
}
.bot-toggle.is-bot { border-color: var(--accent); box-shadow: 0 0 8px rgba(233,196,106,.25); }
.bot-remove { padding: 2px 8px; font-size: .78rem; }
.bot-level-tag { padding: 2px 10px; font-size: .74rem; border-radius: 10px; }
.bot-level-tag:disabled { opacity: .7; cursor: default; }
.game-options {
  margin: 10px 0 2px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.game-options summary {
  cursor: pointer; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent);
}
.game-options label {
  display: block; margin: 8px 0 0; font-size: .88rem; cursor: pointer;
}
.game-options h4 {
  margin: 14px 0 2px; font-size: .74rem; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: .1em;
}
.game-options input { margin-right: 6px; }
.opt-hint { display: block; margin-left: 22px; font-size: .74rem; color: var(--ink-dim); }
.clock-row { display: flex !important; align-items: center; gap: 10px; }
.clock-row select {
  flex: 1; background: rgba(10, 14, 22, .8); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font-size: .85rem;
}
.custom-win { cursor: default !important; }
.custom-win input { margin: 5px 0 0; }
#win-summary { max-width: min(92vw, 760px); overflow-x: auto; margin: 4px 0 16px; }
.summary-table {
  border-collapse: collapse; font-size: .8rem; margin: 0 auto;
  color: var(--ink-dim); white-space: nowrap;
}
.summary-table th {
  text-transform: uppercase; letter-spacing: .08em; font-size: .66rem;
  color: var(--accent); padding: 4px 10px; border-bottom: 1px solid var(--line);
  text-align: right;
}
.summary-table th:first-child { text-align: left; }
.summary-table td { padding: 5px 10px; text-align: right; border-bottom: 1px solid rgba(44,55,80,.4); }
.summary-table .sum-name { text-align: left; color: var(--ink); font-weight: 600; }
.summary-table .winner-row td { color: var(--ink); background: rgba(233, 196, 106, .07); }
.sum-dim { color: var(--ink-dim); font-size: .72rem; }
.replay-bar {
  position: absolute; left: 16px; right: 16px; bottom: 14px; z-index: 14;
  display: flex; align-items: center; gap: 10px;
  background: rgba(14, 17, 26, .88); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 12px; backdrop-filter: blur(6px);
}
.replay-bar button { padding: 4px 10px; }
.rp-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.rp-fill { height: 100%; width: 0; background: var(--accent); transition: width .14s linear; }
.rp-caption { max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; color: var(--ink-dim); }
.btn-replay { margin-bottom: 10px; }
.catalog-btn.tint-on { border-color: var(--accent); color: var(--accent); }
.rr-group.owner-tinted .rr-edge { filter: url(#glow); }
.restart-btn { margin-top: 10px; font-size: .78rem; padding: 5px 10px; opacity: .75; }
.restart-btn:hover { opacity: 1; }
.btn-rematch { margin-bottom: 10px; margin-right: 8px; }
.invite-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.invite-facebook { color: #8ab4f8; border-color: rgba(138, 180, 248, .4); }
.invite-facebook:hover { color: #c2d7fc; border-color: rgba(138, 180, 248, .7); }
.seat-facebook { color: #8ab4f8; }
.record-line { font-size: .78rem; color: var(--ink-dim); margin: -6px 0 10px; min-height: 1em; }
.win-avatar {
  width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--accent); margin-bottom: 14px;
  filter: brightness(1.15) contrast(1.05);
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

/* ---------- geography (satellite) ---------- */
.geo-state {
  fill: rgba(255, 255, 255, 0.001); /* invisible fill keeps state-name hover tooltips */
  stroke: rgba(255, 255, 255, .45);
  stroke-width: .7;
  stroke-linejoin: round;
}
.geo-state:hover { stroke: rgba(255, 255, 255, .8); }
.grat-line {
  fill: none; stroke: rgba(190, 216, 245, .3); stroke-width: .55;
  stroke-dasharray: 3 3;
}
.grat-label {
  font-size: 8px; fill: rgba(200, 222, 248, .65);
  font-family: "Avenir Next", system-ui, sans-serif; letter-spacing: .06em;
  paint-order: stroke; stroke: rgba(4, 12, 26, .6); stroke-width: 2px;
}
.river {
  fill: none; stroke: rgba(120, 180, 235, .5); stroke-width: .8;
  stroke-linecap: round; stroke-linejoin: round; pointer-events: stroke;
}
.lake {
  fill: rgba(28, 74, 138, .55); stroke: rgba(140, 195, 245, .5); stroke-width: .5;
  stroke-linejoin: round;
}

/* ---------- hero screens ---------- */
/* Scroll-safe centering: `margin: auto` on the card centers it when it fits
 * and lets the screen scroll when it doesn't. A flex-centered child inside
 * `overflow: hidden` clips at BOTH ends once it outgrows the viewport —
 * expanded options + a full seat list used to make Start unreachable. */
#screen-home.active, #screen-lobby.active, #screen-hotseat.active {
  display: flex;
  position: relative; overflow-y: auto; overflow-x: hidden;
  padding: 18px 0;
}
#screen-home .hero-card, #screen-lobby .hero-card, #screen-hotseat .hero-card { margin: auto; }
.hero-bg { position: fixed; inset: 0; z-index: 0; }
.hero-bg video, .hero-bg img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: saturate(1.05);
}
.hero-bg.dim video, .hero-bg.dim img { filter: saturate(.7) brightness(.55); }
.hero-shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 85%, rgba(8, 10, 16, .88) 0%, rgba(8, 10, 16, .45) 45%, rgba(8, 10, 16, .35) 100%),
    linear-gradient(180deg, rgba(8, 10, 16, .35) 0%, rgba(8, 10, 16, .15) 40%, rgba(8, 10, 16, .8) 100%);
}

.home-card {
  width: min(460px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 38px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.hero-card {
  position: relative; z-index: 1;
  background: rgba(16, 20, 30, .78);
  border: 1px solid rgba(233, 196, 106, .28);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(233, 196, 106, .15);
}

.logo {
  font-family: "Didot", "Bodoni 72", Georgia, serif;
  font-size: 3.1rem;
  letter-spacing: .14em;
  text-align: center;
  margin: 0 0 6px;
  background: linear-gradient(180deg, #f7e3a4 0%, var(--accent) 45%, #a8781f 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 18px rgba(233, 196, 106, .25);
}
.tagline { color: var(--ink-dim); margin: 0 0 22px; text-align: center; }
.deco-rule {
  display: flex; align-items: center; gap: 10px;
  font-variant: small-caps; letter-spacing: .12em; font-size: .82rem;
}
.deco-rule::before, .deco-rule::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233,196,106,.5));
}
.deco-rule::after { background: linear-gradient(90deg, rgba(233,196,106,.5), transparent); }
h2 { margin: 0 0 6px; font-family: "Didot", Georgia, serif; letter-spacing: .05em; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: .8rem; color: var(--ink-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; }
input {
  width: 100%;
  background: rgba(10, 13, 20, .85);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 1rem;
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,196,106,.15); }

.home-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.home-more { margin-top: 4px; text-align: left; }
.home-more > summary {
  cursor: pointer; color: var(--ink-dim); font-size: .9rem; padding: 6px 0;
  list-style: none;
}
.home-more > summary::-webkit-details-marker { display: none; }
.home-more[open] > summary { color: var(--accent); }
.home-more .ghost { width: 100%; margin-top: 6px; }
button.ghost-strong {
  border-color: rgba(233,196,106,.45); color: var(--accent);
  background: rgba(233,196,106,.08);
}
.daily-streak { margin: 0; font-size: .85rem; color: var(--accent); }
.daily-board {
  text-align: left; font-size: .82rem; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  max-height: 140px; overflow: auto;
}
.daily-board ol { margin: 4px 0 0; padding-left: 1.2em; }
.daily-board li { margin: 2px 0; }
.home-host-hint { margin: 10px 0 0; font-size: .78rem; opacity: .85; }
.home-host-hint code { font-size: .75rem; color: var(--accent); }
.join-row { display: flex; gap: 10px; }
.join-row input { width: 110px; text-transform: uppercase; text-align: center; letter-spacing: .2em; font-weight: 700; }
.join-row button { flex: 1; }

button {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 1rem;
  cursor: pointer;
  transition: filter .12s, transform .08s, box-shadow .12s;
}
button:hover { filter: brightness(1.16); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primary {
  background: linear-gradient(180deg, #f2d488 0%, var(--accent) 55%, var(--accent-deep) 100%);
  color: #221a06; border-color: rgba(0,0,0,.25); font-weight: 700;
  box-shadow: 0 4px 16px rgba(233, 196, 106, .25), inset 0 1px 0 rgba(255,255,255,.4);
  text-shadow: 0 1px 0 rgba(255,255,255,.3);
}
button.ghost { background: transparent; }
button.danger { background: var(--danger); border-color: transparent; color: #fff; }

.error { color: var(--danger); min-height: 1.2em; margin: 14px 0 0; }
.room-code { color: var(--accent); letter-spacing: .25em; font-family: ui-monospace, monospace; }

.lobby-players { list-style: none; padding: 0; margin: 10px 0 20px; }
.lobby-players li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--line);
}
.dot { width: 13px; height: 13px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }
.lobby-players .host-tag, .disc-tag { font-size: .72rem; color: var(--ink-dim); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }
.lobby-players li.open-seat { opacity: .75; }
.lobby-players li.open-seat .avatar-chip { filter: grayscale(1); }

/* QR invite: dark modules on white with a quiet zone, or phones won't scan it. */
.qr-box { display: flex; justify-content: center; margin: 10px 0; }
.qr-box svg { width: min(220px, 60vw); height: auto; background: #fff; border-radius: 8px; }

.push-toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 60;
  background: var(--panel, #1c2230); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px; box-shadow: 0 6px 24px rgba(0,0,0,.45); max-width: min(92vw, 480px);
}
.push-toast span { font-size: .9rem; }
.push-toast button { flex: none; }

/* Event vignettes: brief cinematic clips over the map. */
.vignette {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  z-index: 30; border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.6); border: 1px solid var(--line);
  animation: vignette-in .35s ease-out;
  pointer-events: none;
}
.vignette video { display: block; width: min(46vw, 560px); height: auto; }
/* The game-start opener: bigger, centered, tap to skip. */
.vignette-grand { top: 50%; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; }
.vignette-grand video { width: min(78vw, 1100px); }
@keyframes vignette-in-grand { from { opacity: 0; transform: translate(-50%, -50%) scale(.94); } }
.vignette-grand { animation: vignette-in-grand .45s ease-out; }
.vignette-out { opacity: 0; transition: opacity .4s; }

/* Region-choice overlays on the board. */
.region-choice { cursor: pointer; }
.region-blob { fill-opacity: .16; stroke-opacity: .75; stroke-width: 2.5; stroke-linejoin: round; }
.region-choice:hover .region-blob { fill-opacity: .32; stroke-opacity: 1; stroke-width: 3.5; }
.region-label {
  font-family: "Didot", Georgia, serif; font-size: 26px; letter-spacing: .12em;
  fill: #fdfbf4; text-anchor: middle; dominant-baseline: middle;
  paint-order: stroke; stroke: rgba(2, 6, 15, .85); stroke-width: 5px;
  pointer-events: none;
}
.region-choice:hover .region-label { fill: #f7e3a4; }
.region-choice.region-top .region-blob { fill-opacity: .28; stroke-opacity: 1; stroke-width: 3.2; }
.region-choice.region-top .region-label { fill: #f7e3a4; }
@keyframes vignette-in { from { opacity: 0; transform: translateX(-50%) scale(.96); } }
@media (max-width: 700px) { .vignette video { width: 86vw; } }

/* Winner vignette replaces the hero art backdrop when it can play; same
 *  dimming as the still so the card stays readable. */
#win-overlay #win-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: brightness(.55) saturate(1.1);
}

#hotseat-names { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

/* ---------- game layout ---------- */
/* Column flex so the waiting strip consumes height INSTEAD of pushing the
 * board below the fold — .game-layout gets the remainder, keeping anything
 * anchored to the map's bottom edge (focus bar, threatboard) on screen. */
#screen-game.active { display: flex; flex-direction: column; position: relative; }
.game-layout { display: flex; flex: 1 1 0; min-height: 0; }
.map-pane { flex: 1; position: relative; background: #8ca4b2; min-width: 0; }
#board { width: 100%; height: 100%; display: block; touch-action: none; }
.side-pane {
  width: 344px; flex: none;
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px; background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  /* Content routinely exceeds a normal laptop window's height. The default
   * OS scrollbar auto-hides on macOS, so without this the pane looks cut
   * off rather than scrollable — make the scrollbar a visible, grabbable
   * affordance instead of relying on hover-to-reveal. */
  scrollbar-width: thin;
  scrollbar-color: var(--line) rgba(255,255,255,.04);
}
.side-pane::-webkit-scrollbar { width: 10px; }
.side-pane::-webkit-scrollbar-track { background: rgba(255,255,255,.04); }
.side-pane::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.side-pane::-webkit-scrollbar-thumb:hover { background: var(--accent-deep); }

/* Short-but-wide desktop windows (the 900px breakpoint below only reacts to
 * width, so a normal laptop window at reduced height got no relief). Trim
 * padding so fewer panels spill past the fold. */
@media (max-height: 820px) {
  .side-pane { gap: 6px; padding: 8px; }
  .panel { padding: 8px; }
  .player-row { padding: 6px; margin-bottom: 4px; }
  #turn-panel .prompt { margin-bottom: 6px; }
}
.panel {
  background: linear-gradient(180deg, var(--panel-2), #1b2434);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.panel h3 {
  margin: 0 0 8px; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .14em; color: var(--accent);
  font-family: "Didot", Georgia, serif;
}

.player-row { padding: 8px; border-radius: 8px; margin-bottom: 6px; background: rgba(10, 13, 20, .5); border: 1px solid transparent; transition: border-color .2s; }
.player-row.current { border-color: var(--accent); box-shadow: 0 0 14px rgba(233,196,106,.14) inset; }
.player-row.declared {
  border-color: var(--danger);
  box-shadow: 0 0 18px rgba(230,57,70,.18) inset;
}
.player-head { display: flex; align-items: center; gap: 8px; }
.player-head .name { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head .cash { font-family: ui-monospace, monospace; color: var(--accent); }
.player-head .cash.masked { color: var(--ink-dim); letter-spacing: .08em; }
.player-head .cash.askable { cursor: pointer; text-decoration: underline dotted rgba(233, 196, 106, .5); text-underline-offset: 3px; }
.player-head .cash.askable:hover { color: var(--accent); }
.player-head .odds {
  flex: none; font-family: ui-monospace, monospace; font-size: .82rem; font-weight: 700;
  color: var(--ink-dim); background: rgba(233, 196, 106, .08);
  border: 1px solid rgba(233, 196, 106, .22); border-radius: 999px;
  padding: 1px 7px; letter-spacing: .02em;
}
.player-head .odds.odds-high { color: var(--accent); border-color: rgba(233, 196, 106, .5); background: rgba(233, 196, 106, .16); }
.player-head .odds.odds-low { opacity: .72; }
.eye-btn {
  background: none; border: none; padding: 0 2px; font-size: .9rem;
  cursor: pointer; opacity: .55; line-height: 1; flex: none;
}
.eye-btn:hover { opacity: 1; }
.player-sub { font-size: .78rem; color: var(--ink-dim); margin-top: 3px; line-height: 1.5; }
.player-sub .rr-chip, .rr-chip { display: inline-block; padding: 0 5px; border-radius: 4px; margin: 1px 2px 1px 0; font-size: .72rem; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.6); }

#turn-panel .prompt { font-size: 1.02rem; margin-bottom: 10px; line-height: 1.45; }
#turn-panel .actions { display: flex; flex-wrap: wrap; gap: 8px; }
#turn-panel .actions button { font-size: .92rem; padding: 8px 12px; }
.dice { display: flex; gap: 6px; margin: 8px 0; perspective: 300px; }
.die {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(160deg, #fdfbf4, #d9d3c4);
  color: #171410;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 1px 0 #fff;
}
.die.bonus { background: linear-gradient(160deg, #f2d488, var(--accent-deep)); }
.dice.rolling .die { animation: die-roll .55s cubic-bezier(.3,1.6,.5,1); }
@keyframes die-roll {
  0% { transform: rotateX(140deg) rotateZ(-60deg) translateY(-16px); opacity: .2; }
  60% { transform: rotateX(-24deg) rotateZ(12deg); opacity: 1; }
  100% { transform: none; }
}

.log { flex: 1; min-height: 130px; overflow-y: auto; font-size: .84rem; }
.log .entry { padding: 3px 0; border-bottom: 1px dotted var(--line); color: var(--ink-dim); }
.log .entry b { color: var(--ink); }

.chat { max-height: 220px; display: flex; flex-direction: column; }
#chat-messages {
  flex: 1; overflow-y: auto; font-size: .84rem; margin-bottom: 6px;
  font-family: "Avenir Next", "Segoe UI", system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
#chat-messages div { padding: 2px 0; }
#chat-messages .chat-gif,
#chat-messages .chat-image {
  display: block; max-width: min(100%, 220px); max-height: 160px; width: auto; height: auto;
  margin: 4px 0 2px; border-radius: 8px; border: 1px solid var(--line);
}
#chat-messages .chat-note { color: var(--ink-dim); font-style: italic; }
.chat-form { display: flex; gap: 6px; align-items: center; }
.chat-form #chat-input { flex: 1; min-width: 0; }
.chat-gif-btn {
  flex: none; padding: 4px 8px; font-size: .72rem; font-weight: 800;
  letter-spacing: .06em; color: var(--accent);
}
#chat-input {
  font-family: "Avenir Next", "Segoe UI", system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.giphy-picker {
  margin: 0 0 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(10, 13, 20, .55);
}
.giphy-form { display: flex; gap: 6px; margin-bottom: 6px; }
.giphy-form input { flex: 1; min-width: 0; }
.giphy-note { margin: 0 0 6px; font-size: .78rem; }
.giphy-results {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  max-height: 180px; overflow-y: auto;
}
.giphy-hit {
  padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: #0b0e14; cursor: pointer; aspect-ratio: 1 / 1;
}
.giphy-hit:hover { border-color: var(--accent); }
.giphy-hit img { display: block; width: 100%; height: 100%; object-fit: cover; }
.giphy-attrib {
  margin: 6px 0 0; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-dim); text-align: right;
}
.hidden { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- banner ---------- */
.banner {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  background: rgba(16, 20, 30, .92);
  border: 1px solid var(--accent);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 1.05rem;
  box-shadow: 0 10px 40px rgba(0,0,0,.5), 0 0 24px rgba(233,196,106,.15);
  max-width: 80%;
  text-align: center;
  z-index: 5;
  animation: banner-in .25s ease-out;
}
@keyframes banner-in { from { opacity: 0; transform: translate(-50%, -8px); } }

/* Persistent trip/economy strip over the board. */
.trip-hud {
  position: absolute; z-index: 4; top: 54px; left: 16px;
  display: flex; align-items: stretch; gap: 1px;
  max-width: calc(100% - 32px); overflow-x: auto;
  border: 1px solid rgba(233,196,106,.38); border-radius: 10px;
  background: rgba(14,17,26,.88); backdrop-filter: blur(7px);
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
}
.trip-hud > div {
  min-width: 112px; padding: 7px 10px;
  border-left: 1px solid rgba(255,255,255,.08);
}
.trip-hud > div:first-child { border-left: 0; }
.trip-hud span, .trip-hud small {
  display: block; color: var(--ink-dim); font-size: .65rem; line-height: 1.25;
}
.trip-hud b { display: block; color: var(--ink); font-size: .82rem; white-space: nowrap; }
.trip-hud-title { min-width: 130px !important; }
.trip-declared { color: #ff8d96 !important; font-weight: 800; margin-top: 3px; }
.trip-fee-era { color: #e9c46a !important; font-weight: 700; margin-top: 3px; display: block; }
.trip-endgame b { white-space: normal; max-width: 200px; }
.trip-endgame-safe b { color: #7dcfb6; }
.trip-endgame-risk b { color: #ff8d96; }
.trip-endgame-near b { color: #e9c46a; }

/* Midgame board focus — one job at a glance */
.midgame-focus {
  position: absolute; z-index: 5; left: 16px; bottom: 14px;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 5px 7px; border-radius: 10px;
  border: 1px solid rgba(233,196,106,.35);
  background: rgba(14,17,26,.88); backdrop-filter: blur(7px);
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
  font-size: .68rem;
}
.midgame-focus .focus-label {
  font-family: "Didot", Georgia, serif; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); padding: 0 4px;
}
.midgame-focus .focus-btn {
  padding: 4px 8px; font-size: .68rem; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--ink-dim);
  cursor: pointer; text-transform: capitalize;
}
.midgame-focus .focus-btn:hover { color: var(--ink); border-color: var(--line); }
.midgame-focus .focus-btn.on {
  color: var(--ink); border-color: rgba(233,196,106,.55);
  background: rgba(233,196,106,.12);
}
body.midgame-focus-race .trip-hud:not(:has(.trip-endgame)) { opacity: .72; }
body.midgame-focus-race .threatboard { box-shadow: 0 0 0 1px rgba(255,141,150,.55), 0 8px 26px rgba(0,0,0,.35); }
body.midgame-focus-fees .trip-hud { box-shadow: 0 0 0 1px rgba(233,196,106,.55), 0 8px 26px rgba(0,0,0,.35); }
body.midgame-focus-ownership #rr-list { outline: 1px solid rgba(233,196,106,.35); }

.replay-coach {
  position: absolute; z-index: 7; left: 50%; bottom: 64px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(233,196,106,.45);
  background: rgba(14,17,26,.94); backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  font-size: .82rem; line-height: 1.35;
}
.replay-coach b { display: block; color: var(--accent); margin-bottom: 3px; }
.replay-coach span { color: var(--ink-dim); }

/* ---------- board svg ---------- */
.rr-casing { fill: none; stroke: #0c1220; stroke-width: 3.9; stroke-linecap: round; transition: stroke-width .3s; }
.rr-edge { fill: none; stroke-linecap: round; stroke-width: 2.4; transition: opacity .3s, stroke-width .3s; }
/* crosstie bars: short dashes on a thick stroke read as perpendicular ties */
.rr-ties {
  fill: none; stroke: rgba(8, 14, 26, .4); stroke-width: 2.4;
  stroke-dasharray: .9 4.6; stroke-linecap: butt;
  pointer-events: none; transition: opacity .3s;
}
.z-far .rr-ties { display: none; }
.rr-label {
  font-family: "Didot", Georgia, serif;
  font-size: 6.2px; font-weight: 700; letter-spacing: .18em;
  fill: #f4f7fb; opacity: .92;
  paint-order: stroke; stroke: rgba(6, 12, 24, .8); stroke-width: 1.6px;
  pointer-events: none;
}
.z-far .rr-label { display: none; }
.rr-group { opacity: 1; transition: opacity .25s; }
.rr-group.owned .rr-casing { stroke-width: 4.8; }
.rr-group.owned .rr-edge { stroke-width: 3.2; filter: url(#glow); }
.rr-group.owned .rr-ties { stroke-width: 3.2; }
.rr-group.focus .rr-casing { stroke-width: 5.4; }
.rr-group.focus .rr-edge { stroke-width: 3.8; filter: url(#glow); }
.rr-group.focus .rr-ties { stroke-width: 3.8; }
.rr-group.faded, .owner-stripes.faded { opacity: .14; }
.owner-stripes {
  fill: none; stroke-width: 1.5; stroke-linecap: round;
  stroke-dasharray: 6 5; pointer-events: none;
  transition: opacity .25s;
}

/* ---------- railroads ledger ---------- */
#rr-panel summary {
  cursor: pointer; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .14em; color: var(--accent);
  font-family: "Didot", Georgia, serif;
}
#rr-list { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.rr-row {
  display: flex; align-items: center; gap: 6px;
  font-size: .76rem; padding: 3px 4px; border-radius: 5px; cursor: default;
}
.rr-row:hover { background: rgba(233, 196, 106, .08); }
.rr-swatch { width: 14px; height: 5px; border-radius: 2px; flex: none; }
.rr-row .rr-abbr { font-weight: 700; min-width: 44px; }
.rr-row .rr-owner { flex: 1; text-align: right; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-row .rr-owner.mine { color: var(--accent); }
.rr-row .owner-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.milepost { fill: #f2f5f9; stroke: #0c1220; stroke-width: 1.25; }
.city-node { cursor: default; }
.city-halo { fill: rgba(255, 255, 255, .22); }
.city-dot { fill: #0c1220; stroke: var(--accent); stroke-width: 1.7; }
.city-label {
  font-size: 5.5px; fill: #f4f7fb;
  paint-order: stroke; stroke: rgba(6, 12, 24, .85); stroke-width: 2px;
  pointer-events: none;
  font-family: "Avenir Next", system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: .03em;
  transition: font-size .14s ease;
}
.city-label.crowded { font-size: 4.6px; }
/* Peek: hover with a mouse, or press-and-hold on touch, blows the label up. */
.city-node:hover .city-label,
.city-node.hot .city-label {
  font-size: 13px; stroke-width: 3.4px;
}
/* home-city pennants */
.home-pin { pointer-events: all; }
.home-pole { stroke: #0c1220; stroke-width: 1.1; }
.home-flag { stroke: #0c1220; stroke-width: .8; }
.home-label {
  font-family: "Didot", Georgia, serif; font-size: 9px; letter-spacing: .08em;
  text-anchor: middle; paint-order: stroke; stroke: rgba(2, 6, 15, .9); stroke-width: 3px;
  pointer-events: none;
}
.home-mine .home-pole { stroke-width: 1.6; }
.home-mine .home-flag { filter: url(#glow); }
.home-pin.homebound .home-flag { filter: url(#glow); }
.origin-mark { stroke-width: 1.6; stroke-dasharray: 3 2; opacity: .85; }
.origin-mine .origin-mark { stroke-width: 2.2; opacity: 1; }
.origin-label {
  font-family: "Didot", Georgia, serif; font-size: 8px; letter-spacing: .08em;
  text-anchor: middle; paint-order: stroke; stroke: rgba(2, 6, 15, .9); stroke-width: 3px;
  pointer-events: none;
}
.home-link {
  background: none; border: none; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-decoration: underline dotted rgba(233, 196, 106, .5);
  text-underline-offset: 2px;
}
.home-link:hover { color: var(--accent); }
.home-base { fill: #0c1220; }
.train { pointer-events: none; transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
body[data-bot-pace="fast"] .train { transition-duration: .12s; }
body[data-bot-pace="turbo"] .train { transition-duration: .04s; }
.train-ring { opacity: 0; }
.train.active .train-ring { opacity: .95; animation: train-pulse 1.6s ease-in-out infinite; }
.train.declared .train-ring {
  opacity: 1; stroke-width: 3.2; stroke-dasharray: 3 2;
  animation: rover-target 1s ease-in-out infinite;
}
.train-shadow { fill: rgba(4, 8, 16, .38); }
.train-body { stroke: #0b0e14; stroke-width: 1.1; }
.train-cab { fill: rgba(10, 14, 22, .55); }
.train-wheel { fill: #141a26; stroke: #d8dee9; stroke-width: .7; }
.train-cow { fill: #d8dee9; stroke: #0b0e14; stroke-width: .7; }
.train-lamp { fill: #fff8dc; }
.train.active .train-lamp { animation: lamp-glow 1.6s ease-in-out infinite; }
@keyframes lamp-glow { 50% { fill: #ffe27a; r: 1.6; } }
@keyframes train-pulse {
  0%, 100% { stroke-opacity: .9; r: 12; }
  50% { stroke-opacity: .3; r: 15; }
}
@keyframes rover-target {
  50% { r: 17; stroke-opacity: .45; }
}
.route-ghost {
  fill: none; stroke: rgba(255, 255, 255, .75); stroke-width: 2;
  stroke-dasharray: 3 6; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none; animation: ghost-march 1.2s linear infinite;
}
@keyframes ghost-march { to { stroke-dashoffset: -9; } }
.route-ghost-alt { stroke: rgba(244, 132, 95, .85); animation-duration: 1.6s; }
.route-ghost-hit {
  fill: none; stroke: rgba(0,0,0,0.001); stroke-width: 11;
  stroke-linecap: round; stroke-linejoin: round;
  pointer-events: stroke; cursor: pointer;
}
.fee-preview { margin-top: 4px; color: var(--accent); font-size: .8rem; }
.dest-ring { fill: none; stroke-width: 2.5; pointer-events: none; animation: dest-spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
.dest-ring.homebound { stroke-width: 4; filter: url(#glow); animation-duration: 5s; }
@keyframes dest-spin { to { transform: rotate(360deg); } }
.reach-hit { fill: transparent; stroke: none; cursor: pointer; }
.reach-halo { fill: rgba(233, 196, 106, .5); stroke: #0c1220; stroke-width: 1.8; cursor: pointer; transition: fill .15s; }
.reach-halo:hover { fill: rgba(233, 196, 106, .9); }
.reach-halo.suggested { fill: rgba(233, 196, 106, .8); animation: halo-breathe 1.4s ease-in-out infinite; }
.reach-halo.focused {
  stroke: #fff6d8; stroke-width: 3.2;
  filter: drop-shadow(0 0 6px rgba(233, 196, 106, .85));
}
.gallery-claim {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(138, 180, 248, .35); background: rgba(138, 180, 248, .08);
}
.gallery-claim .primary { width: 100%; margin-top: 6px; }
.gallery-claim-list {
  display: flex; flex-direction: column; gap: 6px; margin-top: 6px;
}
.gallery-claim-list .primary { width: 100%; }
.gallery-claim-reserved {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 6px; font-size: .88rem;
}
body.home-offline #btn-create,
body.home-offline #btn-join,
body.home-offline #btn-watch,
body.home-offline #btn-records,
body.home-offline #btn-practice-code {
  opacity: .45;
  pointer-events: none;
  cursor: not-allowed;
}
body.home-offline .practice-code-row.home-network-gated,
body.home-offline #home-code {
  opacity: .55;
}
body.home-offline #home-code { pointer-events: none; }
#gallery-claim-sheet,
#endturn-overlay,
#odds-why-overlay,
#declare-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 10, 16, .88); backdrop-filter: blur(6px);
  animation: win-fade .2s ease-out;
}
.step-key-list {
  display: flex; flex-direction: column; gap: 4px; margin-top: 8px;
}
.step-key-list button { text-align: left; font-size: .85rem; padding: 7px 10px; }
.daily-board-list { margin: 4px 0 12px; padding-left: 1.3em; color: var(--ink-dim); }
.reach-halo.fee-free { fill: rgba(72, 187, 120, .55); }
.reach-halo.fee-free.suggested { fill: rgba(72, 187, 120, .85); }
.reach-halo.fee-bank { fill: rgba(233, 196, 106, .5); }
.reach-halo.fee-rival { fill: rgba(230, 90, 110, .55); stroke-width: 2.2; }
.reach-halo.fee-rival.suggested { fill: rgba(230, 90, 110, .82); }
@keyframes halo-breathe { 50% { fill: rgba(250, 224, 154, 1); } }
.reach-halo.fee-free.suggested { animation-name: halo-breathe-free; }
@keyframes halo-breathe-free { 50% { fill: rgba(110, 220, 150, 1); } }

/* Economy layer: Bank track fades, owned lines punch through. */
#board.economy-layer .rr-group:not(.owned) { opacity: .28; }
#board.economy-layer .rr-group.owned { opacity: 1; }
#board.economy-layer .owner-stripes { stroke-width: 2.2; }
#board.all-sold-flash .rr-group {
  animation: all-sold-pulse 1.6s ease-out;
}
@keyframes all-sold-pulse {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.55) saturate(1.3); }
  100% { filter: brightness(1); }
}
body.fee-era .trip-fee-era { display: block; }

.trip-fee-era {
  display: none; color: #ffb4a2 !important; font-weight: 800; margin-top: 3px; letter-spacing: .04em;
}

/* Declared-race threatboard glance */
.threatboard {
  position: absolute; z-index: 4; top: 54px; right: 16px;
  max-width: min(280px, calc(100% - 32px));
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid rgba(255,141,150,.45);
  background: rgba(14,17,26,.9); backdrop-filter: blur(7px);
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
  font-size: .72rem;
}
.threat-head {
  font-family: "Didot", Georgia, serif; letter-spacing: .14em;
  text-transform: uppercase; color: #ff8d96; margin-bottom: 6px; font-size: .68rem;
}
.threat-row {
  display: grid; grid-template-columns: 10px 1fr; gap: 2px 8px;
  padding: 5px 0; border-top: 1px solid rgba(255,255,255,.06);
}
.threat-row:first-of-type { border-top: 0; }
.threat-swatch {
  grid-row: span 2; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px;
}
.threat-row b { color: var(--ink); font-size: .78rem; }
.threat-meta, .threat-rival { grid-column: 2; color: var(--ink-dim); line-height: 1.3; }
.threat-row.exposed .threat-rival { color: #ff8d96; }
.threat-row.safe .threat-rival { color: #7dcfb6; }

.game-story {
  margin-top: 14px; text-align: left;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid rgba(233,196,106,.35);
  background: rgba(14,17,26,.45);
}
.game-story-title {
  font-family: "Didot", Georgia, serif; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); font-size: .72rem; margin-bottom: 6px;
}
.game-story p {
  margin: 0 0 6px; color: var(--ink); font-size: .88rem; line-height: 1.4;
}
.game-story p:last-child { margin-bottom: 0; }


/* ---------- decision clock ---------- */
.turn-timer {
  position: absolute; top: 16px; left: 16px; z-index: 6;
  width: 150px; height: 26px; border-radius: 13px;
  background: rgba(14, 17, 26, .8); border: 1px solid var(--line);
  overflow: hidden; backdrop-filter: blur(4px);
}
.timer-fill {
  position: absolute; inset: 0; width: 100%;
  background: linear-gradient(90deg, rgba(42, 157, 143, .55), rgba(233, 196, 106, .55));
  transition: width .25s linear;
}
.timer-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, monospace; font-size: .8rem; color: var(--ink);
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.turn-timer.urgent { border-color: var(--danger); }
.turn-timer.urgent .timer-fill { background: linear-gradient(90deg, rgba(230, 57, 70, .7), rgba(230, 57, 70, .4)); }
.turn-timer.urgent .timer-label { animation: timer-blink 1s step-end infinite; }
@keyframes timer-blink { 50% { opacity: .45; } }

/* ---------- timed game clock ---------- */
.game-timer {
  position: absolute; top: 16px; left: 178px; z-index: 6;
  height: 26px; padding: 0 12px; border-radius: 13px;
  display: flex; align-items: center;
  background: rgba(14, 17, 26, .8); border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  font-family: ui-monospace, monospace; font-size: .8rem; color: var(--ink);
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
  white-space: nowrap;
}
.game-timer.urgent { border-color: var(--danger); animation: timer-blink 1s step-end infinite; }

/* ---------- deed catalog ---------- */
#store-overlay {
  position: absolute; inset: 0; z-index: 15;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 7, 12, .7);
  backdrop-filter: blur(3px);
  padding: 14px;
}
.store-modal {
  width: min(1160px, 100%); height: min(860px, 100%);
  display: flex; flex-direction: column;
  background: rgba(16, 20, 30, .97); border: 1px solid rgba(233, 196, 106, .35);
  border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,.7);
}
.store-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.store-hint { min-width: 180px; }
.store-head h3 {
  margin: 0; font-family: "Didot", Georgia, serif; color: var(--accent);
  letter-spacing: .05em; font-size: 1.4rem; white-space: nowrap;
}
.store-hint { flex: 1; font-size: .8rem; color: var(--ink-dim); margin: 0; }
.store-head .ghost { flex: none; }
.store-body { flex: 1; min-height: 0; display: flex; gap: 14px; position: relative; }
.store-grid {
  flex: 1; overflow-y: auto; padding-right: 6px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px; align-content: start;
}
.deed-card {
  display: flex; flex-direction: column; border-radius: 11px; overflow: hidden;
  cursor: pointer; background: rgba(10, 13, 20, .8);
  border: 1px solid var(--line);
  outline: 1px solid rgba(233, 196, 106, .12); outline-offset: -5px;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.deed-card:hover { border-color: rgba(233, 196, 106, .55); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.5); }
.deed-card.selected { border-color: var(--accent); box-shadow: 0 0 18px rgba(233,196,106,.25); }
.deed-card.owned { opacity: .6; }
.deed-band {
  padding: 7px 10px; display: flex; align-items: center;
}
.deed-band .deed-name {
  font-family: "Didot", Georgia, serif; font-size: .92rem; line-height: 1.15;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.85);
  letter-spacing: .02em;
}
.deed-band.tall { width: 10px; padding: 0; border-radius: 3px; align-self: stretch; }
.deed-thumb {
  position: relative; width: 100%;
  background-size: 100% 100%; background-repeat: no-repeat;
}
.deed-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.deed-foot { padding: 8px 10px 10px; }
.deed-sub { display: flex; justify-content: space-between; align-items: center; font-size: .84rem; }
.deed-abbr { color: var(--ink-dim); font-weight: 700; letter-spacing: .04em; }
.deed-price { color: var(--accent); font-family: ui-monospace, monospace; font-weight: 700; }
.deed-stats { font-size: .74rem; color: var(--ink-dim); margin-top: 4px; }
.deed-cities {
  font-size: .72rem; line-height: 1.5; margin-top: 6px;
  color: #cfc9b8; font-variant: small-caps; letter-spacing: .03em;
  border-top: 1px dashed rgba(233, 196, 106, .18); padding-top: 5px;
}
.deed-links {
  font-size: .74rem; margin-top: 6px; color: var(--ink-dim);
}
.deed-links.linked { color: #7bd389; font-weight: 600; }
.deed-owner { font-size: .78rem; color: var(--ink-dim); display: inline-flex; align-items: center; gap: 5px; }
.owner-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.catalog-btn { grid-column: 1 / -1; font-size: .82rem; padding: 7px; }
.assist-control {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  color: var(--ink-dim); font-size: .78rem;
}
.assist-control select {
  min-width: 0; flex: 1; color: var(--ink); background: rgba(10,13,20,.85);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px;
}

/* First-game contextual guidance. */
.coachmark {
  position: fixed; left: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 70; display: flex; align-items: center; gap: 8px;
  width: min(560px, calc(100vw - 36px));
  padding: 12px; border: 1px solid var(--accent); border-radius: 12px;
  background: rgba(20,26,38,.97); box-shadow: 0 18px 55px rgba(0,0,0,.58);
}
.coachmark > div { flex: 1; min-width: 0; }
.coachmark b, .coachmark span { display: block; }
.coachmark b { color: var(--accent); margin-bottom: 3px; }
.coachmark span { color: var(--ink-dim); font-size: .84rem; line-height: 1.4; }
.coachmark button { flex: none; padding: 7px 10px; font-size: .78rem; }

#mobile-sheet-toggle { display: none; }

.store-detail {
  width: 350px; flex: none;
  overflow-y: auto;
  background: rgba(12, 15, 23, .98); border: 1px solid rgba(233, 196, 106, .3);
  border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.detail-back { display: none; align-self: flex-start; padding: 5px 10px; font-size: .85rem; }
.detail-head { display: flex; gap: 10px; align-items: center; }
.detail-name { font-family: "Didot", Georgia, serif; font-size: 1.2rem; color: var(--ink); }
.detail-price { font-size: .88rem; color: var(--accent); }
.detail-map { border-radius: 10px; border: 1px solid var(--line); overflow: hidden; }

@media (max-width: 900px) {
  .store-detail {
    position: absolute; inset: 0; width: auto; z-index: 2;
    border-radius: 12px;
  }
  .detail-back { display: inline-block; }
}
.verdict {
  border-radius: 8px; padding: 8px 12px; font-weight: 700; text-align: center;
  letter-spacing: .04em; font-size: .9rem;
}
.tone-good { color: #7bd389; }
.tone-mid { color: var(--accent); }
.tone-bad { color: var(--danger); }
.verdict.tone-good { background: rgba(67, 170, 139, .15); border: 1px solid rgba(67, 170, 139, .4); }
.verdict.tone-mid { background: rgba(233, 196, 106, .12); border: 1px solid rgba(233, 196, 106, .35); }
.verdict.tone-bad { background: rgba(230, 57, 70, .12); border: 1px solid rgba(230, 57, 70, .4); }
.metric-list { display: flex; flex-direction: column; gap: 8px; }
.metric { font-size: .82rem; line-height: 1.45; }
.metric-label {
  display: block; text-transform: uppercase; letter-spacing: .08em;
  font-size: .68rem; color: var(--ink-dim);
}
.metric-value { color: var(--ink); }
.metric.tone-bad .metric-value { color: var(--danger); }

/* ---------- win overlay ---------- */
#win-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  animation: win-fade .6s ease-out;
}
@keyframes win-fade { from { opacity: 0; } }
#win-overlay > img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: brightness(.5) saturate(1.1);
}
.win-card {
  position: relative; z-index: 2; text-align: center;
  background: rgba(14, 17, 26, .82);
  border: 1px solid rgba(233, 196, 106, .5);
  border-radius: 16px;
  padding: 42px 60px;
  backdrop-filter: blur(8px);
  box-shadow: 0 30px 90px rgba(0,0,0,.7);
  max-height: 88vh; overflow-y: auto; max-width: 94vw;
}
.win-kicker { color: var(--ink-dim); letter-spacing: .3em; font-size: .8rem; margin-bottom: 8px; }
#win-title {
  font-family: "Didot", Georgia, serif; font-size: 2.4rem; margin: 0 0 22px;
  background: linear-gradient(180deg, #f7e3a4, var(--accent-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.win-confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.win-confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; display: block;
  animation: confetti-fall linear infinite;
}
@keyframes confetti-fall {
  to { transform: translateY(110vh) rotate(720deg); }
}

@media (max-width: 900px) {
  .game-layout { display: block; position: relative; }
  .map-pane { width: 100%; height: 100%; }
  .side-pane {
    position: absolute; z-index: 11; left: 0; right: 0; bottom: 0;
    width: 100%; border-left: none; border-top: 1px solid var(--line);
    max-height: 56%; padding: 8px; background: rgba(23,30,44,.96);
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px rgba(0,0,0,.45);
    transition: max-height .2s ease;
  }
  #mobile-sheet-toggle {
    display: block; order: -2; position: sticky; top: 0; z-index: 3;
    width: 100%; padding: 6px; font-size: .78rem;
    background: rgba(23,30,44,.98);
  }
  .side-pane.sheet-collapsed { max-height: 48px; overflow: hidden; }
  .side-pane.sheet-collapsed > :not(#mobile-sheet-toggle) { display: none !important; }
  .side-pane.replay-hidden { display: none; }
  /* On a phone the actions are what matter — put the turn panel first. */
  #turn-panel { order: -1; }
  .logo { font-size: 2.3rem; }
  .home-card { padding: 24px 22px; }
  .help-card { padding: 20px 18px; }
  .banner { font-size: .92rem; padding: 10px 16px; max-width: 92%; }
  .trip-hud {
    top: 48px; left: 6px; right: 6px; max-width: none;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0; padding: 0; overflow: hidden;
  }
  .trip-hud > div { min-width: 0; padding: 5px 7px; }
  .trip-hud-title { grid-column: 1 / -1; min-width: 0 !important; }
  .threatboard {
    top: auto; bottom: auto; right: 6px; left: 6px; max-width: none;
    position: relative; margin: 6px; order: 2;
    max-height: 28vh; overflow: auto;
  }
  #map-pane .threatboard { position: absolute; bottom: 56px; left: 6px; right: 6px; margin: 0; }
  .midgame-focus { left: 8px; right: 8px; bottom: 8px; }
  .coachmark { align-items: stretch; flex-wrap: wrap; }
  .coachmark > div { flex-basis: 100%; }
  .replay-coach { bottom: 96px; }
  .first-trip-board { left: 6px; right: 6px; bottom: auto; top: auto; }
  #turn-panel .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #turn-panel .actions button.primary { grid-column: 1 / -1; }
}

/* Touch devices: 16px inputs stop iOS Safari from zooming the page on focus. */
@media (pointer: coarse) {
  input { font-size: 16px; }
  #turn-panel .actions button { padding: 11px 14px; }
}

/* Short viewports (phone landscape). */
@media (max-height: 560px) {
  .logo { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .win-confetti, .vignette { display: none !important; }
}

/* ---------------------------------------------------------------- new-feature styles */
/* Hall of Records overlay shares the help-overlay treatment. */
#records-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 7, 12, .72);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
#records-overlay.hidden { display: none; }
#records-body h3 {
  font-family: "Didot", Georgia, serif; color: var(--ink);
  letter-spacing: .04em; margin: 18px 0 8px;
  border-bottom: 1px solid rgba(233, 196, 106, .25); padding-bottom: 6px;
}
.records-btn { margin: 0 auto 10px; display: block; font-size: .85rem; }
.record-game { font-size: .92rem; margin: 8px 0; color: var(--ink-dim); }
.record-game b { color: var(--ink); }
.record-replay-row { display: flex; gap: 6px; margin-top: 4px; }
.record-replay-row .record-replay { font-size: .82rem; padding: 2px 10px; }
.record-ach { margin-top: 3px; }
.ach-mini {
  display: inline-block; font-size: .78rem; color: var(--ink-dim);
  border: 1px solid rgba(233, 196, 106, .25); border-radius: 999px;
  padding: 1px 8px; margin: 2px 3px 0 0;
}

/* Win-screen extras: series score + achievement chips. */
.series-line { margin: 12px 0 4px; font-size: 1rem; color: var(--ink); }
.ach-chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.ach-chip {
  font-size: .82rem; color: var(--ink-dim);
  border: 1px solid rgba(233, 196, 106, .35); border-radius: 999px;
  padding: 3px 10px; background: rgba(233, 196, 106, .07);
}
.ach-chip b { color: var(--accent); }

/* Chess-clock bank chips in the players panel. */
.bank-clock {
  font-size: .78rem; color: var(--ink-dim); margin-left: 6px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.bank-clock.urgent { color: #e76f51; }
.bank-clock.overtime { color: #e63946; font-weight: 700; }

/* Conductor's pick. */
.pick-hint { margin-top: 8px; font-size: .88rem; text-align: left; }
.pick-hint b { color: var(--accent); }
.deed-card.pick { outline: 2px solid var(--accent); outline-offset: -2px; }
.pick-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: .68rem; background: var(--accent); color: #241a10;
  border-radius: 999px; padding: 2px 8px; font-weight: 700;
  white-space: nowrap;
}

/* Presence: who is at the table right now. */
.presence { margin-left: 5px; font-size: .62rem; vertical-align: 1px; }
.presence.on { color: #43aa8b; text-shadow: 0 0 5px rgba(67, 170, 139, .8); }
.presence.off { color: #5a6372; }

/* Take-backs + commentary in the log. */
.undo-btn { margin-top: 8px; }
.entry .remark { color: var(--accent); font-style: italic; }

/* Host proxy: acting for an offline player is explicit and clearly labeled. */
.proxy-note {
  margin: 8px 0; padding: 8px 10px; border-radius: 8px; font-size: .88rem;
  background: rgba(233, 196, 106, .12); border: 1px solid rgba(233, 196, 106, .4);
  display: flex; align-items: center; gap: 8px;
}
.proxy-note b { color: var(--accent); }
.proxy-note button { padding: 3px 10px; flex: none; margin-left: auto; }
.proxy-btn { margin-top: 8px; }
.god-desk-btn {
  width: 100%; margin: 0 0 8px; font-size: .82rem; letter-spacing: .04em;
  border-color: rgba(233, 196, 106, .35);
}
.god-desk-btn.on {
  color: #171410; background: linear-gradient(160deg, #f2d488, var(--accent-deep, #c9a227));
  border-color: transparent; font-weight: 700;
}
.god-desk-badge {
  margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; font-size: .78rem;
  color: var(--accent); background: rgba(233, 196, 106, .1);
  border: 1px solid rgba(233, 196, 106, .3);
}
.god-log-toggle {
  display: flex; align-items: center; gap: 6px; margin: -2px 0 10px;
  font-size: .78rem; color: var(--muted, #9aa3b5); cursor: pointer; user-select: none;
}
.god-log-toggle input { accent-color: var(--accent, #e9c46a); }
.god-bank-offer {
  margin: 0 0 10px; padding: 8px 10px; border-radius: 8px; font-size: .8rem;
  color: var(--ink, #e8ecf4); background: rgba(69, 123, 157, .15);
  border: 1px solid rgba(69, 123, 157, .4);
}
.god-bank-offer .actions { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.rr-chip-buy, .rr-chip-offer { cursor: pointer; outline: 1px dashed rgba(255,255,255,.35); }
.rr-chip-buy:hover, .rr-chip-offer:hover { outline-color: var(--accent, #e9c46a); }
.god-bank { display: inline-flex; gap: 2px; flex: none; }

/* Tap-to-spotlight a railroad: invisible fat hit strokes over every line. */
.rr-hit {
  stroke: transparent; stroke-width: 7; stroke-linecap: round;
  fill: none; pointer-events: stroke; cursor: pointer;
}

/* ---------- table life ---------- */
.waiting-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  /* Right padding clears the fixed corner buttons (⌂ ? 🔊 occupy ~156px)
   * so the clock's margin-left:auto never lands underneath them. */
  padding: 6px calc(160px + env(safe-area-inset-right, 0px)) 6px 12px;
  background: linear-gradient(90deg, rgba(14,17,26,.95), rgba(30,36,52,.9));
  border-bottom: 1px solid var(--line); font-size: .86rem; z-index: 8;
}
.waiting-strip .wait-name { font-weight: 700; }
.waiting-strip .wait-status { color: var(--ink-dim); }
.waiting-strip .wait-clock {
  font-family: ui-monospace, monospace; color: var(--accent); margin-left: auto;
}
.waiting-strip button { padding: 2px 8px; font-size: .75rem; }
.host-tools { padding: 8px 10px; }
.host-tools h3 { margin: 0 0 6px; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-dim); }
.host-tools button { margin: 3px 4px 3px 0; }
.host-transfer-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.host-transfer-row select { flex: 1; min-width: 0; }
.race-alert {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  z-index: 7; max-width: min(92%, 420px); padding: 8px 14px;
  background: rgba(90, 20, 28, .88); border: 1px solid rgba(230, 57, 70, .55);
  border-radius: 10px; color: #fce8ea; font-size: .88rem; text-align: center;
  backdrop-filter: blur(4px);
  animation: race-pulse 1.6s ease-in-out infinite;
}
.race-alert.hidden { display: none; }
@keyframes race-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(230, 57, 70, .25); }
  50% { box-shadow: 0 0 18px 2px rgba(230, 57, 70, .35); }
}
.threatboard.threatboard-live { border-color: rgba(230, 57, 70, .45); }
.threatboard.drama .threat-row.exposed {
  background: rgba(230, 57, 70, .12);
}
.catchup-banner {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 9; padding: 6px 14px; border-radius: 999px;
  background: rgba(14,17,26,.9); border: 1px solid var(--line);
  font-size: .8rem; color: var(--accent); letter-spacing: .06em;
}
.catchup-digest {
  position: absolute; left: 12px; right: 12px; bottom: 14px; z-index: 10;
  max-height: 42%; overflow: auto; padding: 12px 14px; border-radius: 12px;
  background: rgba(14,17,26,.94); border: 1px solid rgba(233,196,106,.4);
  box-shadow: 0 12px 32px rgba(0,0,0,.45); text-align: left;
}
.catchup-digest strong { display: block; color: var(--accent); margin-bottom: 6px; }
.catchup-digest ul { margin: 0 0 8px; padding-left: 1.2em; font-size: .85rem; color: var(--ink-dim); }
.catchup-digest li { margin: 2px 0; }
.city-finder { display: flex; gap: 6px; margin: 0 0 8px; }
.city-finder input { flex: 1; min-width: 0; font-size: .9rem; padding: 7px 9px; }
.bid-custom { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.bid-custom input { width: 7rem; }
.practice-code-row { margin-top: 6px; }
.practice-code-row input { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.social-rail { margin: 8px 0 12px; text-align: left; }
.social-rail .picker-label { margin-top: 8px; }
.lobby-schedule { color: var(--accent) !important; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lobby-table-card {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(233, 196, 106, .06);
  font-size: .88rem;
  color: var(--ink-dim);
}
.lobby-table-card strong { display: block; color: var(--accent); margin-bottom: 4px; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.lobby-table-extras { margin-top: 4px; font-size: .8rem; opacity: .85; }
.auction-advice { margin-top: 8px; }
.auction-advice.tone-good { color: var(--accent-2); }
.auction-advice.tone-bad { color: var(--danger); }
.auction-advice.tone-mid { color: var(--accent); }
.schedule-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.schedule-row input { flex: 1; min-width: 140px; }
.schedule-hint { margin: 0 0 8px; }
#win-story-overlay {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 7, 12, .78); backdrop-filter: blur(5px);
}
#win-story-overlay.hidden { display: none; }
.win-story-card {
  background: rgba(14, 17, 26, .92); border: 1px solid rgba(233, 196, 106, .45);
  border-radius: 14px; padding: 28px 32px; max-width: 420px; width: 92vw; text-align: center;
}
.first-trip-board {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 12;
  pointer-events: none;
}
.first-trip-board.hidden { display: none; }
.first-trip-board-inner {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(14, 17, 26, .92); border: 1px solid rgba(233, 196, 106, .45);
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}
.first-trip-board .first-trip-cue { font-size: 1.6rem; line-height: 1; margin: 0; flex-shrink: 0; }
.first-trip-board-copy { flex: 1; min-width: 0; text-align: left; }
.first-trip-board-copy strong { display: block; color: var(--accent); font-size: .92rem; }
.first-trip-board-copy p { margin: 2px 0 0; font-size: .8rem; color: var(--ink-dim); line-height: 1.35; }
#btn-first-trip-dismiss { padding: 4px 8px; flex-shrink: 0; }
.rematch-companions {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin: 8px 0 4px;
}
.trade-fair {
  margin: 8px 0 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(233,196,106,.08); border: 1px solid rgba(233,196,106,.28);
  font-size: .85rem; color: var(--accent);
}
.trade-fair-strategic {
  margin: 4px 0 0; padding: 6px 10px; border-radius: 8px;
  background: rgba(69, 123, 157, .12); border: 1px solid rgba(69, 123, 157, .35);
  font-size: .82rem; color: var(--ink-dim);
}
.declare-sheet-lines {
  margin: 8px 0 12px; padding: 0; list-style: none;
  font-size: .88rem; line-height: 1.55; color: var(--ink);
}
.declare-sheet-lines li { margin: 4px 0; }
.declare-sheet-verdict {
  margin: 0 0 12px; font-size: .9rem; color: var(--accent);
}
.win-story-beat {
  font-family: "Didot", Georgia, serif; font-size: 1.35rem; line-height: 1.35;
  color: var(--ink); min-height: 4.5em; display: flex; align-items: center; justify-content: center;
}
@media (max-width: 900px) {
  .waiting-strip { font-size: .8rem; padding: 5px calc(160px + env(safe-area-inset-right, 0px)) 5px 8px; gap: 6px; }
  .race-alert { top: 44px; font-size: .8rem; padding: 6px 10px; }
  .side-pane.sheet-collapsed #host-tools,
  .side-pane.sheet-collapsed #rr-panel,
  .side-pane.sheet-collapsed #log-panel,
  .side-pane.sheet-collapsed #chat-panel { display: none; }
  .side-pane #turn-panel { order: -1; }
  #map-pane .milepost,
  #board .node-hit { stroke-width: 14; }
}

.fast-mode-opt {
  display: block; margin: 0 0 10px; padding: 8px 10px;
  border: 1px solid rgba(233, 196, 106, .35); border-radius: 8px;
  background: rgba(233, 196, 106, .07);
}
.fast-mode-opt .opt-hint { display: inline; }
