/* Brass table UI: dark industrial redesign — dense dashboard, full map,
   bottom action rail. Imported from the "Dark industrial game board
   redesign" Claude Design project (Open Birmingham.dc.html). */

:root {
  --bg: #161310;
  --panel: #181410;
  --panel-2: #1d1811;
  --chip: #211c16;
  --deep: #100d0a;
  --panel-edge: #362f25;
  --edge-2: #3a3226;
  --table: #171614;
  --text: #ece4d6;
  --value: #e6dcc8;
  --muted: #8f8371;
  --muted-2: #a89a80;
  --faint: #6d6353;
  /* --brass / --legal drive the map's own highlight rules below — keep
     their values as-is so redesigning the chrome never recolors the map. */
  --brass: #d0a24a;
  --legal: #f4cf5d;
  --gold: #c9974d;
  --gold-strong: #d4a559;
  --rust: #c98a4f;
  --paper: #f2e8d6;
  --accent: var(--gold);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 14px/1.4 'Spectral', Georgia, serif;
  overflow: hidden;
}
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--edge-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- main menu ---------- */
#menu-screen {
  flex: 1; display: flex; align-items: center; justify-content: center;
  min-height: 0; padding: 24px;
  background:
    linear-gradient(180deg, rgba(208, 162, 74, 0.04), transparent 30%),
    radial-gradient(ellipse at 50% 42%, #20201d 0%, #11100e 74%);
}
.menu-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-edge); border-radius: 14px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; gap: 18px;
}
.menu-brand {
  color: var(--paper); font-weight: 700; font-size: 26px;
  letter-spacing: 0.3px; text-align: center;
}
.menu-sub {
  margin-top: -10px;
  color: var(--muted-2); font-size: 13px; text-align: center;
}
.menu-field { display: flex; flex-direction: column; gap: 8px; }
.menu-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.6px;
  color: var(--muted); text-transform: uppercase;
}
.menu-hint { text-transform: none; letter-spacing: 0; color: var(--faint); }
.menu-seats { display: flex; flex-wrap: wrap; gap: 10px; }
.menu-seat {
  display: flex; align-items: center; justify-content: center;
  background: var(--chip); border: 2px solid var(--edge-2); border-radius: 50%;
  width: 64px; height: 64px; padding: 3px; cursor: pointer; user-select: none;
}
.menu-seat:has(input:checked) {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent);
}
.menu-seat input {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap;
}
.menu-seat-pic {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  opacity: 0.45; filter: grayscale(60%);
}
.menu-seat:has(input:checked) .menu-seat-pic { opacity: 1; filter: none; }
.menu-start { padding: 11px 16px; font-size: 14.5px; text-align: center; }
.menu-dev-toggle {
  display: flex; align-items: center; gap: 7px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.4px;
  color: var(--muted); text-transform: uppercase; cursor: pointer;
  margin-top: -4px;
}
.menu-dev-toggle input { margin: 0; }
.menu-dev-options { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- header ---------- */
#topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px;
  min-height: 46px; padding: 10px 20px;
  background: linear-gradient(180deg, #1e1a15, #191510);
  border-bottom: 1px solid var(--panel-edge);
  flex: none; z-index: 5;
}
.brand-block { display: flex; align-items: baseline; gap: 10px; flex: none; }
#topbar .brand { color: var(--paper); font-weight: 700; font-size: 20px; letter-spacing: 0.3px; white-space: nowrap; }
.brand-sep { width: 1px; height: 16px; background: var(--edge-2); }
.era-label {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: 0.4px;
  color: var(--muted-2);
}

.round-pill {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--deep); border: 1px solid var(--panel-edge); border-radius: 999px;
  padding: 6px 16px;
}
.round-pill-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); }
.round-pill .dot-sep { color: #4a4032; }
#round-num { font-weight: 600; font-size: 13.5px; color: var(--paper); }
.action-status { font-size: 12.5px; color: var(--gold); font-weight: 600; }

#topbar .spacer { flex: 1 0 0; min-width: 8px; }
.top-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.control-group {
  display: flex; align-items: center; gap: 8px;
  background: var(--chip); border: 1px solid var(--edge-2); border-radius: 8px;
  padding: 6px 12px;
}
.control-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.5px; color: var(--muted); }
.chip-select, .chip-input {
  background: transparent; border: none; padding: 0; color: var(--value);
  font-weight: 600; font-size: 13px;
}
.chip-input { width: 3.5em; font-family: 'IBM Plex Mono', monospace; }

#seat-config { display: flex; gap: 6px; }
.seat-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--chip); border: 1px solid var(--edge-2); border-radius: 8px;
  padding: 5px 10px;
}
.seat-pic { width: 16px; height: 16px; vertical-align: -3px; }
.seat-chip select { background: transparent; border: none; padding: 0; font-size: 12.5px; color: var(--value); }

.chip-btn {
  background: var(--chip); border: 1px solid var(--edge-2); color: var(--value);
  font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-family: 'Spectral', serif;
}
.chip-btn:hover { background: #2a241c; }
.chip-btn.primary {
  background: linear-gradient(180deg, var(--gold-strong), #b9863c);
  border-color: #8a672c; color: #211a0f; font-weight: 700;
}
.chip-btn.primary:hover { background: linear-gradient(180deg, var(--gold-strong), #b9863c); filter: brightness(1.08); }

/* ---------- content: map + sidebar ---------- */
#content { display: flex; flex: 1; min-height: 0; }

#map-pane {
  position: relative; flex: 1; min-width: 0;
  background:
    linear-gradient(180deg, rgba(208, 162, 74, 0.04), transparent 30%),
    radial-gradient(ellipse at 50% 42%, rgba(32, 32, 29, 0.55) 0%, rgba(17, 16, 14, 0.86) 74%),
    url('../assets/pic/desk.png');
  background-size: auto, auto, cover;
  background-position: center, center, center;
}
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }

#zoom-hint {
  position: absolute; right: 12px; bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
  color: #695f50; font-size: 11px; pointer-events: none;
}

/* ---------- map elements (SVG) ---------- */
.city-box {
  fill: #24211c; stroke: #4b4438; stroke-width: 1.5;
}
.merchant-box {
  fill: #262111; stroke: #8d783d; stroke-width: 1.5;
}
.city-name { font: 600 15px system-ui, sans-serif; text-anchor: middle; }
.merch-bonus { font: 11px system-ui, sans-serif; text-anchor: middle; }
.slot-empty { fill: #171512; stroke: #413a31; stroke-width: 1.2; }
.slot-main { font: 700 12.5px system-ui, sans-serif; text-anchor: middle; }
.slot-abbrev { font: 700 11px system-ui, sans-serif; text-anchor: middle; }
.route-glyph { font: 800 12px system-ui, sans-serif; text-anchor: middle; }

/* highlight & dim states */
g.dim { opacity: 0.28; }
g.hl .slot-box, g.hl .route-badge {
  stroke: var(--legal); stroke-width: 3;
}
g.hl .route-path { stroke: var(--legal); stroke-opacity: 0.9; stroke-width: 5; }
g.hl-soft .slot-box, g.hl-soft .route-badge {
  stroke: var(--brass); stroke-width: 2.5;
}
g.city.hl-soft .city-box,
g.city.hl .city-box {
  stroke: var(--legal); stroke-width: 3;
}
g.city.hl-soft .city-name,
g.city.hl .city-name {
  fill: #fff;
}
g.pickable { cursor: pointer; }
g.pickable:hover .slot-box, g.pickable:hover .route-badge {
  stroke: #fff; stroke-width: 3.5;
}

/* ---------- bottom dock: hand strip centered at the bottom of the map ---------- */
#dock {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: min(1000px, calc(100% - 48px)); z-index: 4;
}

/* ---------- action panel: floating, draggable; defaults to the empty strip
   left of the map's hub cities, clear of every location node ---------- */
#prompt-bar {
  position: absolute; left: 12px; top: 26%; z-index: 6;
  width: min(184px, calc(100% - 16px));
  background: rgba(24, 20, 16, 0.96);
  border: 1px solid var(--panel-edge); border-radius: 8px;
  padding: 6px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  cursor: grab;
}
#prompt-bar.hidden { display: none; }
#prompt-bar.dragging { cursor: grabbing; user-select: none; }
.bar-crumb { font-family: 'IBM Plex Mono', monospace; color: var(--muted); font-size: 10px; }
.bar-title {
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.8px;
  font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase;
}
.bar-persona { color: var(--gold); cursor: help; }
.bar-note { color: var(--gold); font-size: 11.5px; }
.bar-options { display: flex; flex-wrap: wrap; gap: 4px; }
.bar-options.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.action-pass-link {
  background: none; border: none; padding: 2px 0; margin-top: 0;
  color: var(--muted); font-size: 10.5px; font-family: 'Spectral', serif; font-weight: 500;
  cursor: pointer; text-align: center;
}
.action-pass-link:hover { color: var(--muted-2); text-decoration: underline; }
.bar-preview {
  color: var(--muted); font-size: 11px; max-height: 90px; overflow-y: auto;
  border-left: 2px solid var(--panel-edge); padding-left: 8px;
}

.opt {
  background: var(--chip); color: var(--value);
  border: 1px solid var(--edge-2); border-radius: 7px;
  padding: 5px 10px; cursor: pointer; font: 600 12px 'Spectral', serif;
}
.opt:hover { filter: brightness(1.15); }
.opt.primary {
  background: linear-gradient(180deg, var(--gold-strong), #b9863c);
  border-color: #8a672c; color: #211a0f; font-weight: 700;
}
.opt.subtle { background: transparent; border-color: var(--panel-edge); color: var(--muted); font-weight: 500; }
.opt:disabled { opacity: 0.32; cursor: not-allowed; filter: none; }
.opt.pick {
  background: rgba(201, 162, 39, 0.16); border-color: var(--gold);
  color: var(--gold); padding: 4px 9px; font-size: 11.5px;
}
.bar-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 28px; }
.bar-empty { color: var(--muted); font-size: 12.5px; font-style: italic; }
.opt.action-opt { padding: 6px 8px; font-size: 12px; border-radius: 7px; }

/* ---------- hint reference ---------- */
.hint-overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(8, 7, 6, 0.8);
}
.hint-dialog {
  width: min(1120px, 100%);
  max-height: min(88vh, 860px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--edge-2);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.hint-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-edge);
}
.hint-head h2 { margin: 0; color: var(--paper); font-size: 15px; font-weight: 700; }
.icon-button { flex: none; background: var(--chip); border-color: var(--edge-2); }
.hint-image-wrap { min-height: 0; overflow: auto; padding: 10px; background: var(--deep); }
.hint-image-wrap img {
  display: block; width: 100%; height: auto;
  max-height: calc(88vh - 74px); object-fit: contain;
}

/* ---------- hand strip ---------- */
/* Always one row: cards shrink to fit rather than wrapping to a second
   row, which would grow the dock and eat into the map underneath. */
#hand-strip {
  display: flex; gap: 8px;
  width: 100%; flex-wrap: nowrap;
  justify-content: center;
}
.handcard {
  position: relative;
  flex: 1 1 0; min-width: 0; max-width: 108px;
  background: var(--chip); border: 1px solid var(--edge-2); border-radius: 9px;
  padding: 8px 10px; display: flex; flex-direction: column; justify-content: flex-end;
  color: var(--paper); font: 600 13px/1.25 'Spectral', serif;
  min-height: 54px; user-select: none;
  transition: transform 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.handcard-dot {
  position: absolute; top: 0; left: 0;
  width: 16px; height: 9px;
  border-radius: 8px 0 8px 0;
}
.handcard-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.handcard.wild { border-style: dashed; }
.handcard.clickable { border-color: var(--gold); cursor: pointer; }
.handcard.clickable:hover { transform: translateY(-5px); border-color: var(--gold-strong); }
.handcard.unusable { opacity: 0.35; }

/* ---------- sidebars ---------- */
#sidebar, #sidebar-right {
  flex: none; display: flex; flex-direction: column;
  background: var(--panel);
  min-height: 0;
}
#sidebar { width: 314px; border-right: 1px solid var(--panel-edge); }
#sidebar-right { width: 240px; border-left: 1px solid var(--panel-edge); }
#sidebar h3, #sidebar-right h3 {
  margin: 14px 14px 8px; font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px;
}
/* Left sidebar holds only player cards now, so it can use the full
   height and scroll on its own when seats don't all fit. */
#players-box { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
#market-box { flex: none; padding: 0 0 8px; border-bottom: 1px solid var(--panel-edge); overflow-y: auto; max-height: 50vh; }
#log-box { flex: 1; display: flex; flex-direction: column; min-height: 0; }
#log-scroll { overflow-y: auto; flex: 1; font-size: 12.5px; padding: 0 14px 10px; }
.log-turn { color: var(--gold); margin-top: 8px; font-weight: 650; }
.log-line { margin-left: 8px; color: var(--muted-2); }

/* player cards: all seats render at the same fixed size, regardless of
   whose turn it is — a color-tinted background, border and pulsing glow
   mark the current mover instead. */
.pcard {
  position: relative;
  margin: 5px 12px; padding: 9px;
  background: var(--chip); border: 1px solid var(--edge-2); border-radius: 12px;
  display: flex; gap: 10px;
}
.pcard.current {
  background: color-mix(in srgb, var(--player-color, var(--gold)) 16%, #241c1a);
  border-color: color-mix(in srgb, var(--player-color, var(--gold)) 45%, var(--edge-2));
}
.pcard-glow {
  position: absolute; inset: 0; border-radius: 12px;
  border: 1.5px solid var(--gold); pointer-events: none;
  animation: pulseGlow 2.4s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 151, 77, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(201, 151, 77, 0); }
}

/* Round portrait, full card height — the source images are square with a
   circular vignette baked in, so the whole circle stays visible. */
.pcard-pic {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  flex: none;
}

/* Inline portrait used where a seat's name would otherwise be spelled out. */
.pav {
  width: 18px; height: 18px; border-radius: 50%; object-fit: cover;
  vertical-align: -4px; flex: none; margin: 0 2px;
}
.pav-bar { width: 22px; height: 22px; vertical-align: -6px; }

.pcard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }

.pcard-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pcard-tag { font-size: 10.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.3px; flex: none; }
.pcard-badge-move {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 700;
  color: #161310; background: var(--gold); padding: 4px 8px; border-radius: 5px;
  letter-spacing: 0.5px; margin-left: auto; white-space: nowrap;
}
.pcard-badge-spent {
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--muted);
  margin-left: auto; white-space: nowrap;
}

.pcard-stats { display: flex; gap: 8px; }
.pcard-stat { flex: 1; background: var(--deep); border-radius: 7px; padding: 6px 0; text-align: center; }
.pcard-stat b { display: block; font-size: 15px; font-weight: 700; color: var(--value); }
.pcard-stat small { display: block; font-size: 9.5px; color: var(--faint); letter-spacing: 0.4px; }

.matrow { display: flex; gap: 4px; flex-wrap: wrap; }
.matchip {
  position: relative; display: flex; align-items: center; gap: 4px;
  background: var(--deep); border-radius: 6px; padding: 3px 7px 3px 5px;
}
.matchip-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.matchip-code { font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 600; color: var(--value); }
.matchip-count { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--faint); }
.matchip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 0;
  margin-bottom: 5px; padding: 4px 8px; border-radius: 4px;
  background: var(--deep); border: 1px solid var(--panel-edge);
  color: var(--value); font: 500 11px 'Spectral', serif;
  white-space: normal; max-width: 200px; z-index: 20; pointer-events: none;
}

/* market cards */
.market-card {
  margin: 6px 10px; padding: 10px;
  background: var(--panel-2); border: 1px solid var(--panel-edge); border-radius: 12px;
}
.market-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.market-head-left { display: flex; align-items: center; gap: 7px; }
.market-dot-sq { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.market-name { font-weight: 600; font-size: 14px; color: var(--paper); }
.market-head-right { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); white-space: nowrap; }
.market-cols { display: flex; gap: 5px; }
.market-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.market-col-dots { display: flex; flex-direction: column; gap: 3px; }
.market-cube {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--edge-2); box-sizing: border-box;
}
.market-cube.filled { background: var(--gold); border-color: var(--gold); }
.market-col-price { font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; color: var(--faint); }

/* ---------- end screen ---------- */
#end-screen {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background: rgba(10, 8, 6, 0.75); z-index: 6;
}
#end-screen.hidden { display: none; }
.end-card {
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 10px; padding: 20px 28px; min-width: 420px;
}
.end-card h2 { margin-top: 0; color: var(--paper); }
.end-card table { border-collapse: collapse; width: 100%; }
.end-card td, .end-card th { padding: 4px 10px; text-align: left; }
.end-card tr.winner { color: var(--accent); font-weight: 700; }

button, select, input {
  background: var(--chip); color: var(--text);
  border: 1px solid var(--edge-2); border-radius: 8px; padding: 4px 10px;
  font: inherit;
}
button { cursor: pointer; }
button:hover { border-color: var(--gold); }

@media (max-width: 980px) {
  #sidebar { width: 282px; }
  #sidebar-right { width: 220px; }
  .top-controls { gap: 5px; }
  .control-label { display: none; }
  #prompt-bar { min-width: 0; }
  .handcard { max-width: 100px; }
  .hint-overlay { padding: 10px; }
  .hint-dialog { max-height: 92vh; }
  .hint-image-wrap img { max-height: calc(92vh - 70px); }
}
