/* ═══════════════════════════════════════════════════════
   HEXLAND — BGA-exact visual style
   Top bar: white · Left: parchment · Ocean: sky blue · Right: near-black
═══════════════════════════════════════════════════════ */

/* ── DSEG7 Classic — 7-segment digital font ─────────── */
@font-face {
  font-family: 'DSEG7';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://cdn.jsdelivr.net/fontsource/fonts/dseg7-classic@latest/latin-400-normal.woff2) format('woff2'),
    url(https://cdn.jsdelivr.net/fontsource/fonts/dseg7-classic@latest/latin-400-normal.woff) format('woff');
}

/* ── Reset ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Top bar */
  --tb-bg: #f2f0eb;
  --tb-border: #ccc9c0;
  --tb-text: #333333;
  /* Left column (parchment) */
  --lc-bg: #ede8df;
  --lc-border: #ccc8be;
  --lc-text: #3a3020;
  --lc-muted: #000000;
  /* Ocean */
  --ocean: #42b4f0;
  --ocean-deep: #2898d8;
  /* Right column (near-black) */
  --rc-bg: #888888;
  /*#525252;*/
  --rc-bg2: #5e5e5e;
  --rc-border: #6a6a6a;
  --rc-text: #000000;
  --rc-muted: #000000;
  --rc-hd-col: #000000;
  /* Accents */
  --gold: #d4a430;
  --gold-dim: rgba(212, 164, 48, .28);
  --green-btn: #4a9c30;
  /* Resources */
  --wood: #2d6e00;
  --brick: #b83a18;
  --sheep: #58b018;
  --wheat: #d09800;
  --ore: #6080a0;
  --desert: #c0a858;
}

html,
body,
#app {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--lc-bg);
  color: var(--lc-text);
  font-size: 13px;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ══ TOP BAR (white / light gray) ══════════════════════ */
.topbar-wrap {
  flex-shrink: 0;
  background: var(--tb-bg);
  border-bottom: 1px solid var(--tb-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
  z-index: 100;
}

.topbar {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px 14px;
  /* Lock the bar to the height it has when a button is inside, so an empty bar
     (e.g. during SETUP) is exactly the same height. Tied to the same metrics:
     button line-height (.82rem * 1.2) + button padding (5+5) + bar padding (5+5) + border (1). */
  min-height: calc(0.82rem * 1.2 + 21px);
  border-top: 1px solid var(--tb-border);
  background: #f8f6f0;
}

.ab-btn {
  padding: 5px 18px;
  border-radius: 6px;
  border: none;
  font-size: .82rem;
  line-height: 1.2;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: opacity .15s, transform .15s;
}

.ab-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.ab-btn:not(:disabled):hover {
  opacity: .85;
  transform: translateY(-1px);
}

.ab-roll {
  background: #1e70c0;
}

.ab-build {
  background: #257838;
}

.ab-dev {
  background: #7828b0;
}

.ab-trade-bank {
  background: #b07020;
}

.ab-trade-player {
  background: #206080;
}

.ab-undo {
  background: #555f6b;
}

.ab-confirm-setup {
  background: #2f9e44;
}

.ab-end {
  background: #a02020;
}

.ab-back-lobby {
  background: #257838;
}

.ab-end-confirm {
  background: #c0392b;
  outline: 2px solid #ff6b6b;
  outline-offset: 2px;
  animation: pulse-confirm .6s ease-in-out infinite alternate;
}

@keyframes pulse-confirm {
  from {
    background: #c0392b;
  }

  to {
    background: #e74c3c;
  }
}

.ab-skip-disc {
  background: #7a4a00;
  color: #f5c842;
  font-weight: 600;
  letter-spacing: .01em;
}

.ab-skip-disc:disabled {
  background: #4a3000;
  color: #b08030;
  opacity: .7;
}

.ab-dev-confirm {
  background: #257838;
  font-weight: 700;
}

.ab-dev-cancel {
  background: #606060;
}

/* ── Victim picker (inline in action bar) ── */
.ab-victim-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ab-victim-label {
  font-size: .82rem;
  font-weight: 700;
  color: #c02020;
  white-space: nowrap;
}

#ab-victim-btns {
  display: flex;
  gap: 8px;
}

.ab-victim-btn {
  border: 2px solid rgba(255, 255, 255, .45) !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 14px;
}

.ab-victim-cards {
  font-size: .68rem;
  font-weight: 500;
  opacity: .85;
}

.tb-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: .95rem;
  color: var(--lc-text);
  letter-spacing: .05em;
  flex-shrink: 0;
}

.tb-logo {
  font-size: 1.1rem;
}

.tb-logo-img {
  height: 150px;
  width: auto;
  object-fit: contain;
  display: block;
  margin-top: 95px;
  margin-left: -30px;
  /*margin-bottom: 10;*/
  /* The logo overhangs down into the left column on top of the zoom buttons;
     make it click-through so it doesn't swallow their hover/clicks. */
  pointer-events: none;
}

.tb-title {
  color: #5a3010;
}

.tb-phase {
  flex: 1;
  text-align: center;
  font-size: .88rem;
  color: var(--tb-text);
  font-weight: 500;
}

.tb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.timer-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, .07);
  border: 1px solid var(--tb-border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: .82rem;
  color: var(--tb-text);
}

#timer-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}

#timer-val.timer-urgent {
  color: #cc2020;
  animation: blink .6s infinite alternate;
}

@keyframes blink {
  from {
    opacity: 1;
  }

  to {
    opacity: .3;
  }
}

.btn-newgame {
  background: var(--green-btn);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s;
}

.btn-newgame:hover {
  background: #3a8020;
}

.btn-hamburger {
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 4px 10px;
  color: var(--tb-text, #333);
  line-height: 1;
  border-radius: 6px;
  transition: background .15s;
}

.btn-hamburger:hover {
  background: rgba(0, 0, 0, .07);
}

/* ── Hamburger dropdown menu ── */
.hamburger-menu {
  position: fixed;
  top: 44px;
  right: 10px;
  width: 230px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .16);
  z-index: 500;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}

.hm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: none;
  border: none;
  font-size: .95rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: #222;
  transition: background .12s;
}

.hm-item:hover {
  background: #f4f4f4;
}

.hm-item--new {
  color: #257838;
  font-weight: 600;
}

.hm-divider {
  height: 1px;
  background: #e8e8e8;
  margin: 5px 0;
}

.hm-about {
  padding: 10px 18px 8px;
}

.hm-item--leave {
  color: #c0392b;
  font-weight: 600;
}

.hm-item--leave:hover {
  background: #fdecea;
}

/* ── Settings modal ── */
.modal-settings {
  text-align: left;
  min-width: 320px;
  max-width: 400px;
  max-height: 86vh;
  overflow-y: auto;
}

.settings-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 4px;
  cursor: pointer;
  border-top: 1px solid #ececec;
}

.set-row:first-child {
  border-top: none;
}

.set-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.set-name {
  font-size: .98rem;
  font-weight: 600;
  color: #222;
}

.set-desc {
  font-size: .78rem;
  color: #888;
}

.set-switch {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 26px;
}

.set-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.set-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 26px;
  transition: background .18s;
}

.set-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .18s;
}

.set-switch input:checked+.set-slider {
  background: var(--green-btn, #4a9e29);
}

.set-switch input:checked+.set-slider::before {
  transform: translateX(20px);
}

/* segmented control (animation speed, language) */
.set-seg {
  display: inline-flex;
  flex-shrink: 0;
  gap: 0;
  border: 1px solid #d6d1c6;
  border-radius: 8px;
  overflow: hidden;
}

.set-seg-btn {
  background: #fbfaf7;
  color: #444;
  border: none;
  border-left: 1px solid #e6e1d6;
  padding: 6px 11px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.set-seg-btn:first-child {
  border-left: none;
}

.set-seg-btn:hover {
  background: #f0ece2;
}

.set-seg-btn.active {
  background: var(--green-btn, #4a9e29);
  color: #fff;
}

/* ── Game Log modal ── */
.modal-gamelog {
  width: min(540px, 92vw);
  max-width: 540px;
}

.gamelog-modal-body {
  margin-top: 12px;
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
  background: #f6f4ef;
  border: 1px solid #e2ddd3;
  border-radius: 8px;
  padding: 8px 10px;
}

.gamelog-modal-body:empty::before {
  content: "No log entries yet.";
  color: #999;
  font-size: .85rem;
  font-style: italic;
}

/* Re-color the cloned log for a light background (source styles target the dark panel) */
.gamelog-modal-body .game-log {
  gap: 3px;
}

.gamelog-modal-body .log-line {
  color: #444;
  border-left-color: #d8d2c6;
  font-size: .78rem;
}

.gamelog-modal-body .log-line.hi {
  border-left-color: #c0a030;
  color: #1d1d1d;
}

.gamelog-modal-body .log-time {
  opacity: .6;
  color: #777;
}

/* ── Settings: volume row ── */
.set-row-vol {
  cursor: default;
}

.set-vol-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

#set-volume {
  width: 130px;
  accent-color: var(--green-btn, #4a9e29);
  cursor: pointer;
}

.set-vol-val {
  font-size: .82rem;
  font-weight: 600;
  color: #555;
  min-width: 38px;
  text-align: right;
}

/* ── Report a Bug modal ── */
.modal-report {
  text-align: left;
  width: min(460px, 94vw);
  max-width: 460px;
}

.report-form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rf-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rf-label {
  font-size: .82rem;
  font-weight: 600;
  color: #333;
}

.rf-req {
  color: #c0392b;
}

.rf-opt {
  color: #999;
  font-weight: 400;
}

.rf-field select,
.rf-field input,
.rf-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid #d6d1c6;
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  background: #fcfbf8;
  color: #222;
}

.rf-field textarea {
  resize: vertical;
  min-height: 56px;
}

.rf-field select:focus,
.rf-field input:focus,
.rf-field textarea:focus {
  outline: none;
  border-color: var(--green-btn, #4a9e29);
  background: #fff;
}

.rf-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .8rem;
  color: #555;
  line-height: 1.35;
  cursor: pointer;
}

.rf-check input {
  margin-top: 2px;
  flex-shrink: 0;
}

.rf-status {
  min-height: 18px;
  font-size: .83rem;
  font-weight: 600;
}

.rf-status.ok {
  color: #257838;
}

.rf-status.err {
  color: #c0392b;
}

.hm-about-title {
  font-weight: 700;
  font-size: .88rem;
  color: #444;
  margin-bottom: 6px;
}

.hm-about-body {
  font-size: .8rem;
  color: #666;
  line-height: 1.55;
}

.btn-help {
  background: rgba(0, 0, 0, .08);
  border: 1px solid var(--tb-border);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: .82rem;
  cursor: pointer;
  color: var(--tb-text);
}

.btn-help:hover {
  background: rgba(0, 0, 0, .15);
}

/* ══ INSTRUCTION STRIPE ═════════════════════════════════ */
.instr-bar {
  height: 30px;
  overflow: hidden;
  background: #f5f2ea;
  border-bottom: 1px solid #d4d0c8;
  color: #333;
  font-size: .86rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  /* content fades in/out instead of height animating */
  transition: opacity .2s;
  opacity: 0;
}

.instr-bar.visible {
  opacity: 1;
}

.instr-bar--end {
  height: auto;
  min-height: 50px;
  overflow: visible;
  gap: 10px;
  padding: 8px 20px;
}

.instr-end-result {
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1;
}

.instr-end-medal {
  font-size: 1.45rem;
  line-height: 1;
}

.instr-end-vp {
  font-size: 1rem;
  font-weight: 600;
  color: #666;
}

.instr-btn {
  margin-left: 8px;
  padding: 2px 10px;
  font-size: .82rem;
  font-weight: 700;
  background: #5b8dd9;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.instr-btn:hover {
  background: #4272c4;
}

/* ══ 3-COLUMN LAYOUT ════════════════════════════════════ */
.game-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* ── LEFT FLOAT (content extracted from left column) ────── */
.left-float {
  position: fixed;
  top: 80px;
  left: 0;
  width: 165px;
  height: calc(100vh - 80px);
  background: none;
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 8px;
  overflow-y: auto;
  z-index: 50;
  pointer-events: none;
}

.left-float>* {
  pointer-events: all;
}

/* ── LEFT COLUMN (parchment / BGA left sidebar) ────────── */
.col-player {
  width: 165px;
  flex-shrink: 0;
  background: none;
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 8px;
  overflow-y: auto;
}

/* Active player header */
/* Dev deck widget (replaces active player header) */
/* Dev-deck widget — same model as .building-costs-float: position:absolute sibling of #board
   inside .col-ocean. Board transform never touches it. top/left anchors to ocean top-left,
   which always coincides with the land frame top-left (frame top = ocean top; frame left ≤ 0 at zoom ≥ 1). */
.dev-deck-widget {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 70px;
  /* overridden on mobile by JS: 70 × _boardZoom */
  z-index: 20;
  /* Decorative count display — its overhang sits on top of the zoom buttons,
     so make it click-through (no click handler; only read for animations). */
  pointer-events: none;
}

/* Desktop only: nudge the dev-deck widget a bit lower (mobile keeps top:8px). */
@media (min-width: 541px) {
  .dev-deck-widget {
    top: 85px;
  }
}

.dev-deck-img {
  width: 100%;
  border-radius: 8px;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.dev-deck-count {
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  font-weight: 900;
  color: #000000;
  text-shadow: 0 0 3px #000000, 0 0 6px #000000;
  background: none;
  padding: 1px 5px;
}

.ap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, .06);
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--lc-border);
}

.ap-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 900;
  color: rgba(0, 0, 0, .5);
  border: 2px solid rgba(255, 255, 255, .4);
}

.ap-info {
  flex: 1;
  min-width: 0;
}

.ap-name {
  font-weight: 700;
  font-size: .82rem;
  color: var(--lc-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-vp {
  font-size: 1rem;
  font-weight: 900;
  color: var(--gold);
}

.ap-vp span {
  font-size: .65rem;
  font-weight: 600;
  color: var(--lc-muted);
}

/* Resource hand in left column */
.hand-heading {
  display: none;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--lc-muted);
  padding-bottom: 4px;
  margin-top: 15px;
  border-bottom: 1px solid var(--lc-border);
}

.hand-cards {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 180px;
}

/* Resource rows — vertical icon + count */
.res-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  height: 52px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
}

.res-row:last-child {
  border-bottom: none;
}

.res-row-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

/* Per-resource scale — change transform: scale() for each independently */
.res-row-icon--wood {
  transform: scale(1.2);
}

.res-row-icon--brick {
  transform: scale(1.5);
}

.res-row-icon--sheep {
  transform: scale(1.8);
}

.res-row-icon--wheat {
  transform: scale(1.4);
}

.res-row-icon--ore {
  transform: scale(1);
}

.res-icon-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.res-row-count {
  position: absolute;
  font-size: .75rem;
  font-weight: 900;
  color: var(--lc-text);
  line-height: 1;
  pointer-events: none;
}

/* Per-resource count position — adjust each independently */
.res-row-icon--wood~.res-row-count {
  top: -4px;
  right: -4px;
}

.res-row-icon--brick~.res-row-count {
  top: -2px;
  right: -4px;
}

.res-row-icon--sheep~.res-row-count {
  top: -8px;
  right: -4px;
}

.res-row-icon--wheat~.res-row-count {
  top: -10px;
  right: -4px;
}

.res-row-icon--ore~.res-row-count {
  top: -8px;
  right: -4px;
}

/* Action buttons in left column */
.action-stack {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.astk-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: none;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .18s, transform .18s;
  text-align: left;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.astk-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.astk-btn:not(:disabled):hover {
  opacity: .88;
  transform: translateX(2px);
}

.astk-btn.roll {
  background: #1e70c0;
}

.astk-btn.build {
  background: #257838;
}

.astk-btn.trade {
  background: #6030a0;
}

.astk-btn.dev {
  background: #7828b0;
}

.astk-btn.end {
  background: #a02020;
}

/* ── CENTER COLUMN (ocean blue) ────────────────────────── */
.col-ocean {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #5ac8fc 0%, #42b4f0 45%, #2898d8 100%);
  overflow: hidden;
  position: relative;
  min-width: 300px;
}

/* Subtle wave texture */
.col-ocean::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(135deg,
      transparent,
      transparent 28px,
      rgba(255, 255, 255, .03) 28px,
      rgba(255, 255, 255, .03) 30px);
  pointer-events: none;
}

/* Hexagonal background layer — colour set by JS, clipped to inner hex boundary */
#board-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  clip-path: polygon(
    1.06% 43.96%,  1.06% 56.04%,
    10.68% 61.60%, 10.68% 72.71%,
    20.31% 78.26%, 20.31% 89.38%,
    30.75% 95.40%, 40.38% 89.85%,
    50.00% 95.40%, 59.63% 89.85%,
    69.25% 95.40%, 79.71% 89.38%,
    79.71% 78.26%, 89.32% 72.71%,
    89.32% 61.60%, 98.94% 56.04%,
    98.94% 43.96%, 89.32% 38.40%,
    89.32% 27.29%, 79.71% 21.74%,
    79.71% 10.63%, 69.25%  4.60%,
    59.63% 10.15%, 50.00%  4.60%,
    40.38% 10.15%, 30.75%  4.60%,
    20.31% 10.63%, 20.31% 21.74%,
    10.68% 27.29%, 10.68% 38.40%
  );
}

/* Board container */
.board {
  position: relative;
  width: 720px;
  height: 720px;
  flex-shrink: 0;
  z-index: 1;
  margin-left: 300px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .35));
}

/* While actively dragging the zoomed land, show the grabbing cursor, block
   native touch-scroll so the browser doesn't fight our JS pan, and kill the
   tile transition so panning stays snappy. */
.board.board-panning {
  cursor: grabbing;
  touch-action: none;
}

.board.board-panning .hex-tile {
  transition: none;
}

/* ── Land-zoom controls (board + tiles only) ──────────────── */
/* Desktop: a compact horizontal row in-flow at the top of the left column,
   centred above the dev-deck card. */
.board-zoom-ctrl {
  align-self: center;
  flex-shrink: 0;
  z-index: 30;
  display: flex;
  flex-direction: row;
  gap: 5px;
  /* clear the HEXLAND logo, which overhangs the top of the left column (~y126) */
  margin-top: 40px;
  /*margin-bottom: 4px;*/
  margin-left: -30px;
}

.bz-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(20, 28, 40, .72);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  backdrop-filter: blur(3px);
  transition: background .15s, transform .08s;
  user-select: none;
}

.bz-btn:hover {
  background: rgba(30, 42, 60, .92);
}

.bz-btn:active {
  transform: scale(.92);
}

.bz-btn:disabled {
  opacity: .4;
  cursor: default;
  transform: none;
}

.bz-reset {
  font-size: .95rem;
}

/* Frame image: 90px top/bottom, 140px left/right — matches SVG viewBox "-50 0 1000 900" */
.frame-img {
  position: absolute;
  inset: -90px -140px;
  z-index: 1;
  pointer-events: none;
}

.tile-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
}

/* ── Hex Tiles ──────────────────────────────────────────── */
.hex-tile {
  position: absolute;
  /* scale(0.957) = 6px gap between tiles (half of 12px road width). Formula: 1 - gap/HW */
  transform: translate(-50%, -50%) scale(0.957);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  z-index: 3;
  cursor: default;
  transition: filter .15s;
  animation: tile-in .35s ease both;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .3));
}

.hex-tile:hover {
  filter: brightness(1.1) drop-shadow(0 3px 8px rgba(0, 0, 0, .4));
  z-index: 4;
}

.hex-tile.tile-roll-active {
  filter: brightness(1.45) drop-shadow(0 0 18px rgba(255, 220, 80, 0.85));
  z-index: 5;
  transition: filter .35s ease;
}

@keyframes tile-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.88);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.957);
  }
}

.tile-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

/* Number tokens */
.num-token {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%);
  width: 42px;
  height: 42px;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5));
  transition: transform .35s ease;
}

.num-token.robber-here {
  transform: translate(-50%, 20px);
}

/* CSS-rendered number tokens (replaces PNG images) */
.num-token.css-num {
  background: #f4eacc;
  border-radius: 50%;
  border: 2px solid #a08028;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .4);
}

.num-val {
  font-family: 'Aptos', 'Segoe UI', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #2c1800;
  line-height: 1;
}

.num-token.num-hot .num-val {
  color: #cc0000;
}

.num-dots {
  display: flex;
  gap: 1.5px;
  align-items: center;
  justify-content: center;
}

.num-dot {
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: #2c1800;
  flex-shrink: 0;
}

.num-token.num-hot .num-dot {
  background: #cc0000;
}

.desert-num {
  background: #f4eacc;
  border-radius: 50%;
  border: 2px solid #a08028;
  font-size: 1.1rem;
  font-weight: 900;
  color: #2c1800;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .4);
}

/* Issue 2: Robber token — bigger, dark pill background so visible on ANY tile */
.robber-token {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 13;
  pointer-events: none;
  /*background: rgba(2, 0, 0, .42);*/
  /*border: 1px solid #ff4400;
  border-radius: 45%;*/
  filter: drop-shadow(0 20px 20px rgba(0, 0, 0, .9));
  width: 75px;
  height: 75px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 1.05s cubic-bezier(.4, 0, .2, 1), top 1.05s cubic-bezier(.4, 0, .2, 1);
  /* +ANIM_EXTRA_MS */
}

/* Robber overlay (tile click target) */
.robber-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  cursor: crosshair;
  border-radius: 4px;
}

.robber-token.robber-active {
  animation: rob-token-pulse .65s ease-in-out infinite alternate;
}

@keyframes rob-token-pulse {
  from {
    transform: translate(-50%, -50%) scale(0.82);
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, .3));
  }

  to {
    transform: translate(-50%, -50%) scale(1.0);
    filter: drop-shadow(0 0 25px rgba(255, 0, 0, 1));
  }
}

/* Played while sliding left/top to new tile — creates an arc jump effect */
.robber-token.robber-moving {
  animation: robber-arc 1.05s ease-out forwards;
  /* +ANIM_EXTRA_MS */
}

@keyframes robber-arc {
  0% {
    transform: translate(-50%, -50%) scale(1);
    filter: none;
  }

  25% {
    transform: translate(-50%, -95%) scale(1.28);
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
  }

  70% {
    transform: translate(-50%, -30%) scale(0.90);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .3));
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    filter: none;
  }
}

/* Robber highlighted when a 7 is rolled — brighten the image only, not the container */
.robber-token.robber-seven-glow img {
  filter: brightness(1.85);
  transition: filter .35s ease;
}

/* One-shot jump when 7 lands */
.robber-token.robber-seven-jump {
  animation: robber-seven-jump 1.05s ease-in-out;
  /* +ANIM_EXTRA_MS */
}

/* Brightness pulse on the image, in sync with the jump */
.robber-token.robber-seven-jump img {
  animation: robber-seven-jump-brightness 1.05s ease-in-out;
  /* +ANIM_EXTRA_MS */
}

@keyframes robber-seven-jump {
  0% {
    transform: translate(-50%, -50%);
  }

  28% {
    transform: translate(-50%, calc(-50% - 26px)) rotate(-7deg);
  }

  58% {
    transform: translate(-50%, calc(-50% - 18px)) rotate(6deg);
  }

  80% {
    transform: translate(-50%, calc(-50% - 5px));
  }

  100% {
    transform: translate(-50%, -50%);
  }
}

@keyframes robber-seven-jump-brightness {
  0% {
    filter: brightness(1);
  }

  28% {
    filter: brightness(2.6);
  }

  58% {
    filter: brightness(2.1);
  }

  80% {
    filter: brightness(1.9);
  }

  100% {
    filter: brightness(1.85);
  }
}

/* Piece rendering */
.piece-bg {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 14;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-radius: 3px;
}

.piece-bg img {
  display: block;
  mix-blend-mode: multiply;
  object-fit: contain;
}

.piece-settlement {
  width: 50px;
  height: 50px;
  background: transparent;
  border-radius: 0;
}

.piece-city {
  width: 60px;
  height: 60px;
  transform: translate(-30px, -35px);
  background: transparent;
  border-radius: 0;
}

.piece-bg.city-upgradeable {
  overflow: visible;
  animation: city-upgrade-pulse .7s ease-in-out infinite alternate;
}

@keyframes city-upgrade-pulse {
  from {
    transform: translate(-50%, -50%) scale(0.9);
    filter: drop-shadow(0 0 5px rgba(80, 180, 255, .6));
  }

  to {
    transform: translate(-50%, -50%) scale(1.1);
    filter: drop-shadow(0 0 14px rgba(80, 180, 255, 1));
  }
}

/* Player-colour flag mounted above each settlement/city piece */
.piece-flag {
  position: absolute;
  transform: translateX(-50%);
  width: 4px;
  height: 28px;
  background: #999;
  pointer-events: none;
}
.piece-flag::after {
  content: '';
  position: absolute;
  top: 0;
  left: 4px;
  width: 22px;
  height: 16px;
  background: var(--fc, #fff);
  border-radius: 2px 4px 4px 0;
}

/* Roads: a single SVG overlay drawn as round-capped strokes. Round line caps
   mean two of a player's roads meeting at a vertex fuse into a smooth bend,
   instead of leaving a wedge gap between two straight rectangles. */
.road-svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}

.pc-0 {
  background: rgba(216, 52, 52, .88);
}

.pc-1 {
  background: rgba(48, 112, 224, .88);
}

.pc-2 {
  background: rgba(32, 168, 80, .88);
}

.pc-3 {
  background: rgba(224, 144, 24, .88);
}

/* Interactive board markers */
.vertex-spot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  pointer-events: none;
  border: 2px solid transparent;
  background: transparent;
  transition: .15s;
}

.vertex-spot.valid-spot {
  pointer-events: all;
  cursor: pointer;
  background: rgba(255, 255, 255, .55);
  border-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, .8);
  animation: v-pulse .7s ease-in-out infinite alternate;
}

@keyframes v-pulse {
  from {
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 6px rgba(255, 255, 255, .6);
  }

  to {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 14px rgba(255, 255, 255, 1);
  }
}

.vertex-spot.valid-settlement {
  width: 44px;
  height: 44px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  z-index: 16;
  animation: settle-preview-pulse .7s ease-in-out infinite alternate;
}

.valid-settle-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.75;
  display: block;
  pointer-events: none;
}

@keyframes settle-preview-pulse {
  from {
    transform: translate(-50%, -50%) scale(0.88);
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, .5));
  }

  to {
    transform: translate(-50%, -50%) scale(1.05);
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, .95));
  }
}

.vertex-spot.city-target {
  pointer-events: all;
  cursor: pointer;
  background: rgba(80, 180, 255, .3);
  border-color: #50b4ff;
  animation: c-pulse .7s ease-in-out infinite alternate;
}

@keyframes c-pulse {
  from {
    box-shadow: 0 0 8px rgba(80, 180, 255, .5);
  }

  to {
    box-shadow: 0 0 18px rgba(80, 180, 255, .9);
  }
}

.edge-spot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 11;
  pointer-events: none;
  border-radius: 4px;
  background: transparent;
}

.edge-spot.road-up {
  width: 18px;
  height: 70px;
}

.edge-spot.road-left {
  width: 18px;
  height: 70px;
  transform: translate(-50%, -50%) rotate(-60deg);
}

.edge-spot.road-right {
  width: 18px;
  height: 70px;
  transform: translate(-50%, -50%) rotate(60deg);
}

.edge-spot.valid-spot {
  pointer-events: all;
  cursor: pointer;
  border: 2px solid var(--player-color, #fff);
  box-shadow: 0 0 10px var(--player-color, rgba(255, 220, 0, .5));
  animation: e-pulse .7s ease-in-out infinite alternate;
}

@keyframes e-pulse {
  from {
    background: rgba(255, 255, 255, .25);
    box-shadow: 0 0 5px var(--player-color, rgba(255, 220, 0, .4));
    border-color: color-mix(in srgb, var(--player-color, #fff) 60%, transparent);
  }

  to {
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 0 16px var(--player-color, rgba(255, 220, 0, .85));
    border-color: var(--player-color, #fff);
  }
}

/* Port ship icons */
.port-icon {
  position: absolute;
  width: 58px;
  height: 58px;
  transform: translate(-50%, -50%);
  z-index: 13;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .5));
}


/* Debug marker — exact port vertex position */
.port-sign {
  position: absolute;
  width: 22px;
  /* native 356x592 → keep aspect ratio */
  height: auto;
  transform: translate(-50%, -50%);
  transform-origin: center;
  z-index: 20;
  pointer-events: none;
}

/* Fallback dots for ports without a ship image (brick, 3:1) */
.port-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 13;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, .85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}

.port-dot.port-3_1 {
  background: #888;
}

.port-dot.port-brick {
  background: var(--brick);
}

/* ── RIGHT COLUMN — Issue 6: scrollable ──────────────── */
.col-info {
  width: 320px;
  flex-shrink: 0;
  background: var(--rc-bg);
  border-left: 1px solid var(--rc-border);
  color: var(--rc-text);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.rc-players-wrap {
  padding: 8px 10px;
}

.rc-log-block {
  flex-shrink: 0;
  padding: 6px 10px;
  border-top: 1px solid var(--rc-border);
}

.game-log {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.rc-block {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rc-border);
  flex-shrink: 0;
}

.rc-hd {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--rc-hd-col);
  padding-bottom: 5px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--rc-border);
}

.rc-hd-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.log-search-wrap {
  position: relative;
  flex: 1;
  max-width: 140px;
}

#log-search {
  width: 100%;
  padding: 3px 18px 3px 7px;
  font-size: .62rem;
  font-family: inherit;
  background: rgba(0, 0, 0, .18);
  border: 1px solid var(--rc-border);
  border-radius: 4px;
  color: var(--rc-text);
  outline: none;
  transition: border-color .15s;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

#log-search:focus {
  border-color: rgba(212, 164, 48, .7);
}

#log-search::placeholder {
  opacity: .45;
}

#log-search-clear {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--rc-text);
  font-size: 9px;
  padding: 2px 4px;
  cursor: pointer;
  line-height: 1;
  opacity: .5;
  font-family: inherit;
}

#log-search-clear:hover {
  opacity: 1;
}

/* Right panel player cards (dark, compact) */
.player-card {
  min-height: 150px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .06);
  margin-bottom: 6px;
  background: #a0522d;
  /* rgba(0,0,0,.28);*/
  transition: .2s;
}

.player-card:last-child {
  margin-bottom: 0;
}

.player-card.active {
  border: 2px solid #f0c040;
  background: #a0522d;
  animation: pc-flash 1s ease-in-out infinite;
}

@keyframes pc-flash {

  0%,
  100% {
    box-shadow: 0 0 6px 1px rgba(240, 192, 64, .45);
  }

  50% {
    box-shadow: 0 0 18px 5px rgba(240, 192, 64, .8);
  }
}

.player-card.pc-disconnected {
  opacity: .55;
  filter: saturate(0.3);
}

/* Played DV cards strip — shown on desktop and mobile */
.pc-played-dv {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  margin-top: 5px;
}

.pc-pdv-card {
  width: 28px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .25);
  background: rgba(0, 0, 0, .1);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}

.pc-pdv-card img {
  width: 100%;
  display: block;
}

.pc-right-col {
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-top: 15px;
}

.pc-reconn-badge {
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 4px;
  padding: 1px 5px;
  animation: reconn-pulse 1.4s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes reconn-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .35;
  }
}

.pc-mode-badge {
  font-size: .55rem;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  white-space: nowrap;
  line-height: 1.5;
  align-self: flex-start;
  margin-left: -3px;
  margin-top: 1px
}

.pc-mode-ai {
  background: rgba(120, 100, 255, .22);
  color: #b8aaff;
  border: 1px solid rgba(120, 100, 255, .4);
}

.pc-mode-mobile {
  background: rgba(60, 190, 80, .18);
  color: #74de82;
  border: 1px solid rgba(60, 190, 80, .35);
}

.pc-mode-desktop {
  background: rgba(60, 140, 255, .18);
  color: #84beff;
  border: 1px solid rgba(60, 140, 255, .32);
}

.pc-vp-row {
  display: flex;
  align-items: center;
  gap: 0px;
}

/* ── Desktop: VP★ and mode badge inline within their row ─── */
@media (min-width: 541px) {
  .pc-vp-row {
    gap: 5px;
  }

  .pc-mode-badge {
    align-self: center;
    margin-left: -4px;
    margin-top: 4px
  }
}

/* ── Header ── */
.pc-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.pc-av-col {
  flex-shrink: 0;
  margin-left: 4px;
  width: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Ring wrapper — SVG ring + avatar centered together */
.pc-av-ring-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pc-hourglass {
  width: 36px;
  height: 36px;
  object-fit: contain;
  position: relative;
  z-index: 1;
  border-radius: 50%;
}

.pc-av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 900;
  color: rgba(0, 0, 0, .55);
  border: 2px solid rgba(255, 255, 255, .35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .4);
  background-size: cover;
  background-position: center;
}

.pc-name-vp-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pc-name {
  min-width: 0;
  font-size: 1.2rem;
  font-weight: 500;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-timer {
  font-family: 'DSEG7', monospace;
  font-size: .9rem;
  font-weight: 400;
  color: #fff;
  /*background: rgba(0,0,0,.35);*/
  border-radius: 10px;
  padding: 2px 8px;
  margin-top: -30px;
  margin-right: -10px;
  flex-shrink: 0;
  letter-spacing: .05em;
}

.pc-timer-urgent {
  color: #ff4444;
  animation: blink .6s infinite alternate;
}

.pc-vp {
  display: flex;
  gap: 1px;
  border-radius: 8px;
  padding: 1px 5px;
  white-space: nowrap;
}

.pc-vp-n {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--white);
}

.pc-vp-hidden {
  font-size: .8rem;
  font-weight: 700;
  color: inherit;
  position: relative;
  top: -0.45em;
  margin-left: 1px;
}

.pc-star {
  font-size: 1.2rem;
  color: var(--gold);
}

/* ── Footer ── */
.pc-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 1px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

/* Left — 4 stat counters */
.pc-counters {
  display: flex;
  gap: 0px;
  flex: 1;
}

/* Gap before each counter — adjust individually */
.pc-counters .pc-ctr:nth-child(2) {
  margin-left: -15px;
}

.pc-counters .pc-ctr:nth-child(3) {
  margin-left: -16px;
}

.pc-counters .pc-ctr:nth-child(4) {
  margin-left: -16px;
}

.pc-ctr {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0px;
  padding: 4px 2px;
}

.pc-ctr-n {
  font-size: 1.7rem;
  font-weight: 600;
  color: #000000;
  line-height: 1.2;
  min-height: 1.2em;
}

.pc-ctr--zero .pc-ctr-icon {
  filter: grayscale(1) opacity(0.32);
}

.pc-piece--zero img {
  filter: grayscale(1) opacity(0.32);
}

.pc-ctr-icon {
  width: 40px;
  height: 40px;
  display: block;
}

/* Per-icon size — change each independently */
/*
.pc-counters .pc-ctr:nth-child(1) .pc-ctr-icon { width: 60px; height: 60px; }
.pc-counters .pc-ctr:nth-child(2) .pc-ctr-icon { width: 60px; height: 60px; }
.pc-counters .pc-ctr:nth-child(3) .pc-ctr-icon { width: 60px; height: 60px; }
.pc-counters .pc-ctr:nth-child(4) .pc-ctr-icon { width: 60px; height: 60px; }
*/
/* Right — remaining pieces */
.pc-pieces {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  margin-top: -20px;
}

.pc-piece {
  display: flex;
  align-items: center;
  gap: 0px;
}

.pc-piece-img {
  width: 45px;
  height: 38px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pc-piece-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.pc-piece-n {
  font-size: 1.1rem;
  font-weight: 600;
  color: #000000;
  min-width: 0px;
  text-align: right;
}

/* Floating dev card hand — bottom-left of board */
.dev-cards-float {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 20;
  display: flex;
  flex-direction: row;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 360px;
}

.dcf-card {
  position: relative;
  cursor: pointer;
  transition: transform .15s;
  flex-shrink: 0;
}

.dcf-card:not(.dcf-disabled):hover {
  transform: translateY(-6px);
}

.dcf-card img {
  width: 100px;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .55);
  display: block;
}

.dcf-card.dcf-new::after {
  content: 'NEW';
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c03030;
  color: #fff;
  font-size: .48rem;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 5px;
}

.dcf-card.dcf-disabled {
  cursor: not-allowed;
}

.dcf-card.dcf-disabled img {
  filter: brightness(.55) saturate(.5);
}

/* ── Card detail overlay ─────────────────────────────────── */
#card-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.card-detail-box {
  background: #1e1508;
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 22px 20px 18px;
  text-align: center;
  width: 220px;
  cursor: default;
  animation: cardDetailPop .25s ease forwards;
  pointer-events: all;
}

.cd-img {
  width: 150px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .6);
  display: block;
  margin: 0 auto 12px;
}

.cd-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
  letter-spacing: .04em;
}

.cd-desc {
  font-size: .82rem;
  color: rgba(255, 255, 255, .8);
  line-height: 1.5;
  margin-bottom: 14px;
}

.cd-footer {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cd-btn-play {
  background: linear-gradient(135deg, #28b060, #166038);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s;
}

.cd-btn-play:hover {
  filter: brightness(1.12);
}

.cd-btn-close {
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .2);
  color: rgba(255, 255, 255, .6);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: .82rem;
  cursor: pointer;
  transition: background .15s;
}

.cd-btn-close:hover {
  background: rgba(255, 255, 255, .18);
}

@keyframes cardDetailPop {
  from {
    opacity: 0;
    transform: scale(.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Special cards row (Longest Road / Largest Army) held by this player */
.special-cards-row {
  display: none;
  position: fixed;
  top: 140px;
  /* ↕ move up(-) / down(+) */
  left: 150px;
  /* ↔ move left(-) / right(+) */
  z-index: 60;
  flex-wrap: wrap;
  gap: 8px;
}

.special-card-img {
  width: 100px;
  /* ← card size */
  border-radius: 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .5);
  transition: transform .15s;
  cursor: default;
}

.special-card-img:hover {
  transform: scale(1.06);
}

/* Card purchase notification */
.dev-buy-notify {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  background: transparent;
  border: none;
  /*border: 2px solid var(--gold);*/
  border-radius: 14px;
  padding: 18px 22px;
  text-align: center;
  color: #fff;
  pointer-events: none;
}

.dev-buy-notify img {
  width: 110px;
  border-radius: 10px;
  display: block;
  margin: 0 auto 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .6);
}

.dev-buy-notify div {
  font-size: .95rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .05em;
}

@keyframes devBuyPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.7);
  }

  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }

  25% {
    transform: translate(-50%, -50%) scale(1);
  }

  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.9);
  }
}

/* Floating building costs image */
.building-costs-float {
  position: absolute;
  bottom: 18px;
  right: 18px;
  z-index: 20;
  width: 150px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
  pointer-events: none;
}

/* ══ 3D DICE (from Dice rolling/) ══════════════════════ */
#wec-dice-roll-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  --dice-size: 52px;
  --dice-perspective: calc(var(--dice-size) * 2);
  --dice-half: calc(var(--dice-size) / 2);
  --dice-half-small: calc(var(--dice-half) - 2px);
  --dice-border-radius: calc(var(--dice-size) * 0.12);
  --dice-color-h: 40;
  --dice-color-s: 90%;
  --dice-color-l: 55%;
  --dice-shadow-intensity: 18%;
  --dice-color: hsl(var(--dice-color-h), var(--dice-color-s), var(--dice-color-l));
  --dice-shadow-l: calc(var(--dice-color-l) - var(--dice-shadow-intensity));
  --dice-shadow-color: hsl(var(--dice-color-h), var(--dice-color-s), var(--dice-shadow-l));
  --dice-inner-l: calc(var(--dice-color-l) - calc(var(--dice-shadow-intensity) / 1.5));
  --dice-inner-color: hsl(var(--dice-color-h), var(--dice-color-s), var(--dice-inner-l));
  --dice-disable-color: hsl(var(--dice-color-h), 80%, 40%);
  --dice-disable-shadow-color: hsl(var(--dice-color-h), 80%, 30%);
  --dice-disable-inner-color: hsl(var(--dice-color-h), 80%, 40%);
}

.dice-wrapper {
  width: var(--dice-size);
  height: var(--dice-size);
  perspective: var(--dice-perspective);
  margin: calc(var(--dice-half) / 1.75);
  display: inline-block;
}

.dice {
  cursor: default;
  width: 100%;
  height: 100%;
  position: relative;
  transform: translateZ(calc(var(--dice-half) * -1));
  transform-style: preserve-3d;
  transition: transform 1400ms cubic-bezier(.25, .46, .45, .94);
  /* +ANIM_EXTRA_MS */
}

.dice.disable .face {
  background: var(--dice-disable-color);
  box-shadow: inset 0 0 var(--dice-border-radius) var(--dice-disable-shadow-color);
}

.dice.disable .face.face-inner {
  background-color: var(--dice-disable-inner-color);
  box-shadow: none;
}

.face {
  position: absolute;
  width: var(--dice-size);
  height: var(--dice-size);
  background: var(--dice-color);
  box-shadow: inset 0 0 var(--dice-border-radius) var(--dice-shadow-color);
  border-radius: var(--dice-border-radius);
  text-align: center;
  opacity: 1;
  color: #1a0a00;
  font-size: var(--dice-half);
  font-family: 'Aptos', 'Segoe UI', sans-serif;
  font-weight: 700;
}

.face.face-inner {
  background-color: var(--dice-inner-color);
  box-shadow: none;
}

.face-content {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.face-1 {
  transform: rotateX(-90deg) translateZ(var(--dice-half));
}

.face-2 {
  transform: rotateY(90deg) translateZ(var(--dice-half));
}

.face-3 {
  transform: rotateY(0deg) translateZ(var(--dice-half));
}

.face-4 {
  transform: rotateY(180deg) translateZ(var(--dice-half));
}

.face-5 {
  transform: rotateY(-90deg) translateZ(var(--dice-half));
}

.face-6 {
  transform: rotateX(90deg) translateZ(var(--dice-half));
}

.face-inner-1 {
  transform: rotateX(-90deg) translateZ(var(--dice-half-small));
}

.face-inner-2 {
  transform: rotateY(90deg) translateZ(var(--dice-half-small));
}

.face-inner-3 {
  transform: rotateY(0deg) translateZ(var(--dice-half-small));
}

.face-inner-4 {
  transform: rotateY(180deg) translateZ(var(--dice-half-small));
}

.face-inner-5 {
  transform: rotateY(-90deg) translateZ(var(--dice-half-small));
}

.face-inner-6 {
  transform: rotateX(90deg) translateZ(var(--dice-half-small));
}

/* Floating dice panel on board */
.played-dev-slot {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.played-dev-slot img {
  width: 62px;
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.65);
  display: block;
}

.dice-float {
  position: absolute;
  top: 18px;
  right: -140px;
  z-index: 20;
  background: none;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: none;
  box-shadow: none;
}

.dice-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0;
}

.die {
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  border-radius: 9px;
  border: 1px solid rgba(0, 0, 0, .2);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4.8rem;
  font-weight: 200;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .7);
  user-select: none;
}

.die.rolling {
  animation: die-shake .44s ease;
}

@keyframes die-shake {

  0%,
  100% {
    transform: rotate(0) scale(1);
  }

  25% {
    transform: rotate(-13deg) scale(1.1);
  }

  75% {
    transform: rotate(13deg) scale(1.1);
  }
}

.dice-sum {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  color: #060606;
  margin-bottom: 4px;
}

/* Issue 4: robber bar hidden — message shown in instruction stripe instead */
.robber-tag {
  display: none !important;
}

/* Building costs in right panel */
.costs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ci {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .04);
  border-radius: 5px;
  padding: 4px 7px;
  border: 1px solid var(--rc-border);
}

.ci-name {
  font-size: .72rem;
  color: var(--rc-text);
}

.ci-res {
  display: flex;
  gap: 3px;
  align-items: center;
}

/* Resource color squares */
.rc {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, .4);
  position: relative;
}

.rc[data-n]::after {
  content: attr(data-n);
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c0a030;
  color: #1a0800;
  font-size: .48rem;
  font-weight: 900;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc.wood {
  background: var(--wood);
}

.rc.brick {
  background: var(--brick);
}

.rc.sheep {
  background: var(--sheep);
}

.rc.wheat {
  background: var(--wheat);
}

.rc.ore {
  background: var(--ore);
}

/* Special cards */
.sp-cards {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 5px;
}

.sp-card {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--rc-border);
  border-radius: 5px;
  padding: 4px 7px;
}

.sp-label {
  font-size: .7rem;
  color: var(--rc-muted);
  flex: 1;
}

.sp-val {
  font-size: .72rem;
  font-weight: 700;
  color: var(--rc-text);
}

.sp-vp {
  font-size: .65rem;
  color: #c0a030;
}

.deck-info {
  font-size: .7rem;
  color: var(--rc-muted);
  padding: 2px 0;
}

#deck-count {
  color: #c0a030;
  font-weight: 700;
}

/* Game log */
.game-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .1) transparent;
}

.log-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 4px;
  font-size: .7rem;
  color: var(--rc-muted);
  padding: 2px 5px;
  border-left: 2px solid var(--rc-border);
  border-radius: 2px;
  line-height: 1.45;
}

.log-line.hi {
  border-left-color: #c0a030;
  color: var(--rc-text);
}

.log-body {
  min-width: 0;
  line-height: 1.45;
}

.log-name {
  font-weight: 700;
  white-space: nowrap;
}

.log-time {
  font-size: .65rem;
  opacity: .5;
  white-space: nowrap;
  padding-top: 1px;
}

/* ══ BUILD MENU (floating near left panel bottom) ═══════ */
.build-menu {
  position: fixed;
  bottom: 20px;
  left: 175px;
  background: #f5f2eb;
  border: 1px solid #ccc8be;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
  min-width: 210px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, .25);
}

.bm-title {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: #807060;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--lc-border);
}

.bm-btn {
  background: rgba(0, 0, 0, .04);
  border: 1px solid var(--lc-border);
  border-radius: 6px;
  color: var(--lc-text);
  padding: 7px 10px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  text-align: left;
  transition: .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.bm-btn:hover:not(:disabled) {
  background: rgba(0, 120, 0, .08);
  border-color: #28a030;
  color: #186028;
}

.bm-btn:disabled {
  opacity: .32;
  cursor: not-allowed;
}

.bm-cost {
  font-size: .64rem;
  color: #8a7860;
  margin-left: auto;
}

.bm-close {
  background: none;
  border: none;
  color: #8a7860;
  cursor: pointer;
  font-size: .78rem;
  padding: 3px;
  text-align: center;
}

.bm-close:hover {
  color: #333;
}

/* ══ DISCARD PANEL ══════════════════════════════════════ */
.discard-panel {
  position: fixed;
  top: 320px;
  left: 80px;
  width: 165px;
  z-index: 200;
  flex-direction: column;
  gap: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.dp-subtitle {
  font-size: .72rem;
  font-weight: 700;
  color: var(--lc-text);
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--lc-border);
  margin-bottom: 4px;
}

/* ══ MONOPOLY PANEL ═════════════════════════════════════ */
.monopoly-panel {
  position: fixed;
  top: 285px;
  left: 80px;
  width: 165px;
  z-index: 200;
  flex-direction: column;
  gap: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.monopoly-panel .tp-arrow {
  color: transparent;
}

/* Flex row layout for monopoly: icon left, arrow right */
#monopoly-grid .tp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 52px;
}

#monopoly-grid .tp-arrow {
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.yop-panel {
  position: fixed;
  top: 285px;
  left: 80px;
  width: 165px;
  z-index: 200;
  flex-direction: column;
  gap: 0;
  background: none;
  border: none;
  box-shadow: none;
}

.yop-panel .tp-arrow {
  color: transparent;
}

.yop-panel .tp-trash {
  font-size: .6rem;
}

/* ══ TRADE PROPOSAL PANEL — hidden on all viewports; #trade-panel is unified ══ */
#proposal-panel {
  display: none !important;
}

.proposal-panel {
  position: fixed;
  top: 304px;
  left: 90px;
  width: auto;
  min-width: 200px;
  max-width: 440px;
  z-index: 200;
  flex-direction: column;
  gap: 0;
  background: rgba(237, 232, 223, 0.72);
  border: 1px solid rgba(180, 165, 140, 0.55);
  border-radius: 10px;
  padding: 8px;
  box-shadow: none;
}

.prop-panel-header {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0 3px;
  border-bottom: 1px solid var(--lc-border);
}

.prop-from {
  font-size: .78rem;
  font-weight: 700;
  color: var(--lc-text);
}

.prop-panel-body {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: flex-start;
}

.prop-half {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  gap: 0px;
  align-items: flex-start;
}

.prop-vsep {
  width: 2px;
  align-self: stretch;
  background: var(--gold);
  margin: 0 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.prop-half-col {
  display: flex;
  flex-direction: column;
}

.prop-col-hd {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--lc-muted);
  text-align: center;
  padding: 2px 0 3px;
  border-bottom: 1px solid var(--lc-border);
  margin-bottom: 2px;
  white-space: nowrap;
}

.prop-inner-sep {
  font-size: .85rem;
  color: var(--lc-muted);
  align-self: flex-start;
  padding-top: 2px;
  flex-shrink: 0;
}

/* Read-only resource rows (proposal offer display) */
.prop-ro-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  height: 52px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
}

.prop-ro-row:last-child {
  border-bottom: none;
}

.prop-ro-row.prop-ro-inactive {
  opacity: 0.2;
}

.prop-ro-icon-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.prop-ro-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.prop-ro-qty {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: .65rem;
  font-weight: 900;
  color: var(--lc-text);
  line-height: 1;
  pointer-events: none;
}

.prop-panel-footer {
  display: flex;
  gap: 4px;
  padding-top: 4px;
  flex-wrap: wrap;
}

/* Counter offer columns — collapse separator and row placeholder so icons sit flush */

/* Counter offer button */
.tp-btn-counter {
  flex: 1;
  min-width: 60px;
  padding: 6px 4px;
  border-radius: 6px;
  border: 1.5px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: .5rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.tp-btn-counter:hover {
  background: var(--gold);
  color: #fff;
}


.monopoly-panel .tp-row-active .tp-arrow {
  color: var(--gold);
}

.mp-res-name {
  flex: 1;
  font-size: .8rem;
  font-weight: 600;
  color: var(--lc-text);
}

/* ══ TRADE PANEL — seamless with inventory list ═════════ */
.trade-panel {
  position: fixed;
  top: 300px;
  left: 90px;
  width: 250px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  z-index: 200;
  flex-direction: column;
  gap: 0;
  background: rgba(237, 232, 223, 0.72);
  border: 1px solid rgba(180, 165, 140, 0.55);
  border-radius: 10px;
  box-shadow: none;
  padding: 8px;
}

.tp-header {
  display: none;
}

.tp-title {
  display: none;
}

.tp-close {
  display: none;
}

.tp-body {
  display: flex;
  align-items: stretch;
  padding: 0;
  gap: 0;
}

.tp-half {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
}

.tp-half-col {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tp-vsep {
  width: 2px;
  align-self: stretch;
  background: var(--gold);
  margin: 0 6px;
  border-radius: 2px;
  flex-shrink: 0;
}

.tp-col-hd {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--lc-muted);
  text-align: center;
  padding: 2px 0 3px;
  border-bottom: 1px solid var(--lc-border);
  margin-bottom: 2px;
}

.tp-inner-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  width: 10px;
  padding-top: 2px;
  color: var(--lc-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

.tp-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.trade-panel .tp-col {
  align-items: flex-start;
}

.tp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  height: 52px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  cursor: pointer;
  background: none;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: opacity .1s;
}

.tp-row:last-child {
  border-bottom: none;
}

.tp-row:hover {
  opacity: .75;
}

.tp-row-active {
  border-bottom-color: var(--gold);
}

.tp-arrow {
  font-size: 1rem;
  color: var(--lc-muted);
  flex-shrink: 0;
}

/* Get column: stack trash above arrow on the right, icon on the left */
#tp-left-get .tp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#tp-left-get .tp-trash,
#tp-left-get .tp-trash-ph {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

#tp-left-get .tp-icon-wrap {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
}

#tp-left-get .tp-arrow {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  margin-left: 0;
}

/* Qty badge on the left side for Get column */
#tp-left-get .tp-qty {
  right: auto;
  left: 4px;
}

/* Give column: stack trash above arrow on the left, icon spans both rows */
#tp-left-give .tp-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#tp-left-give .tp-arrow {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  align-self: center;
}

#tp-left-give .tp-icon-wrap {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: start;
}

#tp-left-give .tp-trash,
#tp-left-give .tp-trash-ph {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

/* Right half Give column: identical layout to left Give */
#tp-right-give .tp-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#tp-right-give .tp-arrow {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  align-self: center;
}

#tp-right-give .tp-icon-wrap {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: start;
}

#tp-right-give .tp-trash,
#tp-right-give .tp-trash-ph {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

/* Right half Get column: identical layout to left Get */
#tp-right-get .tp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#tp-right-get .tp-trash,
#tp-right-get .tp-trash-ph {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

#tp-right-get .tp-icon-wrap {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
}

#tp-right-get .tp-arrow {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  margin-left: 0;
}

#tp-right-get .tp-qty {
  right: auto;
  left: 4px;
}

/* Ore size — right Give */
#tp-right-give .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore size — right Get */
#tp-right-get .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore arrow — right Get */
#tp-right-get .tp-row:nth-child(5) .tp-arrow {
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore trash — right Get */
#tp-right-get .tp-row:nth-child(5) .tp-trash,
#tp-right-get .tp-row:nth-child(5) .tp-trash-ph {
  position: relative;
  top: 0px;
  left: 0px;
}

/* ── Proposal panel (opposing player) — identical to trade panel ── */

/* Give column */
#counter-give-col .tp-row {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#counter-give-col .tp-arrow {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
  align-self: center;
}

#counter-give-col .tp-icon-wrap {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: start;
}

#counter-give-col .tp-trash,
#counter-give-col .tp-trash-ph {
  grid-column: 1;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

/* Recv column */
#counter-recv-col .tp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr 1fr;
  gap: 0 8px;
  height: 52px;
}

#counter-recv-col .tp-trash,
#counter-recv-col .tp-trash-ph {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  align-self: center;
}

#counter-recv-col .tp-icon-wrap {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
}

#counter-recv-col .tp-arrow {
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  margin-left: 0;
}

#counter-recv-col .tp-qty {
  right: auto;
  left: 4px;
}

/* Ore size — proposal Give */
#counter-give-col .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore size — proposal Recv */
#counter-recv-col .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore arrow — proposal Recv */
#counter-recv-col .tp-row:nth-child(5) .tp-arrow {
  position: relative;
  top: 0px;
  left: 0px;
}

/* Ore trash — proposal Recv */
#counter-recv-col .tp-row:nth-child(5) .tp-trash,
#counter-recv-col .tp-row:nth-child(5) .tp-trash-ph {
  position: relative;
  top: 0px;
  left: 0px;
}

.tp-res-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

/* Per-resource scale in trade panel */
.tp-col .tp-row:nth-child(1) .tp-res-icon {
  width: 36px;
  height: 36px;
}

/* wood  */
.tp-col .tp-row:nth-child(2) .tp-res-icon {
  width: 36px;
  height: 36px;
}

/* brick */
.tp-col .tp-row:nth-child(3) .tp-res-icon {
  width: 36px;
  height: 36px;
}

/* sheep */
.tp-col .tp-row:nth-child(4) .tp-res-icon {
  width: 36px;
  height: 36px;
}

/* wheat */
.tp-col .tp-row:nth-child(5) .tp-res-icon {
  width: 36px;
  height: 36px;
}

/* ore — left Give column */
#tp-left-give .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 6px;
}

/* ore — left Get column */
#tp-left-get .tp-row:nth-child(5) .tp-res-icon {
  width: 25px;
  height: 25px;
  position: relative;
  top: 0px;
  left: 6px;
}

/* ore arrow — left Get column */
#tp-left-get .tp-row:nth-child(5) .tp-arrow {
  position: relative;
  top: 0px;
  left: 10px;
}

/* ore trash — left Get column */
#tp-left-get .tp-row:nth-child(5) .tp-trash,
#tp-left-get .tp-row:nth-child(5) .tp-trash-ph {
  position: relative;
  top: 0px;
  left: 10px;
}

/* ore   */
.tp-icon-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.tp-qty {
  /*Give column*/
  position: absolute;
  top: -4px;
  right: 4px;
  font-size: .65rem;
  font-weight: 900;
  color: var(--lc-text);
  line-height: 1;
  pointer-events: none;
}

.tp-trash {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 90;
  color: #000000;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

.tp-trash:hover {
  opacity: 1;
}

.tp-trash-ph {
  width: 0px;
  flex-shrink: 0;
}

.tp-status {
  font-size: .62rem;
  font-weight: 600;
  color: var(--lc-muted);
  padding: 3px 2px;
  background: none;
  border: none;
}

.tp-status:empty {
  display: none;
}

.tp-title-inline-status {
  display: none;
}

.tp-status-ok {
  color: #257838;
}

.tp-valid {
  color: #2a7030;
}

.tp-invalid {
  color: #a03030;
}

/* Trade panel — waiting-for-response state */
.trade-panel.tp-waiting .tp-row {
  pointer-events: none;
  opacity: 0.6;
}

.trade-panel.tp-waiting .tp-close {
  visibility: hidden;
}

/* Counter offer received — widen panel and show title (desktop only) */
@media (min-width: 541px) {
  .trade-panel.tp-counter-received {
    width: 490px;
  }

  .trade-panel.tp-counter-received .tp-header {
    display: flex;
    align-items: center;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--lc-border);
    margin-bottom: 4px;
  }

  .trade-panel.tp-counter-received .tp-title {
    display: block;
    flex: 1;
    font-size: 0.88rem;
    font-weight: 700;
  }
}

/* Trade confirm footer — acceptor list */
.tp-footer-confirm {
  flex-direction: column;
  gap: 6px;
  padding: 6px 2px 2px;
}

/* Unified response list — shared by accepted and declined players */
.tp-acceptors-list,
.tp-declined-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 0 2px 2px;
}

.tp-acceptors-list:empty,
.tp-declined-list:empty {
  display: none;
}

.tp-response-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.88rem;
  font-weight: 700;
}

.tp-response-name {
  flex: 1;
  font-weight: 700;
}

.tp-response-declined {
  color: #c0392b;
  font-style: italic;
  font-size: 0.82rem;
  font-weight: 400;
}

.tp-response-accepted {
  color: #27ae60;
  font-style: italic;
  font-size: 0.82rem;
  font-weight: 400;
}

.tp-response-counter {
  color: var(--gold, #c8901a);
  font-style: italic;
  font-size: 0.82rem;
  font-weight: 400;
}

.tp-response-btn {
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.tp-response-btn.tp-response-accept {
  color: #27ae60;
  border-color: rgba(39, 174, 96, 0.45);
}

.tp-response-btn.tp-response-accept:hover {
  background: rgba(39, 174, 96, 0.15);
  border-color: rgba(39, 174, 96, 0.7);
}

.tp-response-btn.tp-response-reject {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.45);
}

.tp-response-btn.tp-response-reject:hover {
  background: rgba(192, 57, 43, 0.15);
  border-color: rgba(192, 57, 43, 0.7);
}

@media (max-width: 540px) {
  .tp-response-entry {
    padding: 10px 12px;
    font-size: 0.92rem;
  }
}

.tp-status-urgent {
  color: #c0392b;
  font-weight: 700;
}

/* Declined list — layout defined with .tp-acceptors-list above */

.tp-footer {
  display: flex;
  gap: 4px;
  padding: 6px 2px 2px;
}

.tp-btn-cancel {
  flex: 1;
  padding: 4px;
  border-radius: 4px;
  border: 1px solid var(--lc-border);
  background: none;
  color: var(--lc-muted);
  font-size: .5rem;
  font-weight: 600;
  cursor: pointer;
}

.tp-btn-cancel:hover {
  background: rgba(0, 0, 0, .06);
}

.tp-btn-confirm {
  flex: 2;
  padding: 4px;
  border-radius: 4px;
  border: none;
  background: #3a7830;
  color: #fff;
  font-size: .5rem;
  font-weight: 700;
  cursor: pointer;
}

.tp-btn-confirm:hover:not(:disabled) {
  background: #4a9840;
}

.tp-btn-confirm:disabled {
  opacity: .3;
  cursor: not-allowed;
}

.tp-btn-edit-proposal {
  flex: 1.5;
  padding: 4px;
  border-radius: 4px;
  border: 1.5px solid #4477bb;
  background: transparent;
  color: #4477bb;
  font-size: .5rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.tp-btn-edit-proposal:hover {
  background: #4477bb;
  color: #fff;
}

/* ══ DEV HAND PANEL ════════════════════════════════════ */
.dev-hand-panel {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #f5f2eb;
  border: 1px solid #ccc8be;
  border-radius: 12px;
  padding: 12px 14px;
  z-index: 200;
  min-width: 320px;
  max-width: 520px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, .25);
}

.dhp-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.dhp-hd span {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #5a4830;
}

.dhp-hd button {
  background: none;
  border: none;
  color: #8a7860;
  cursor: pointer;
  font-size: .95rem;
}

.dhp-note {
  font-size: .67rem;
  color: #8a7860;
  margin-bottom: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--lc-border);
}

.dhp-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.dev-card-item {
  width: 82px;
  border-radius: 9px;
  border: 2px solid var(--lc-border);
  padding: 8px 6px 6px;
  text-align: center;
  cursor: pointer;
  transition: .16s;
  background: #fff;
  position: relative;
}

.dev-card-item:not(.disabled):hover {
  border-color: #28a030;
  background: #f0faf0;
  transform: translateY(-2px);
}

.dev-card-item.disabled {
  opacity: .38;
  cursor: not-allowed;
}

.dev-card-img {
  width: 70px;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin: 0 auto 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.dev-card-label {
  font-size: .6rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #5a4830;
  line-height: 1.3;
}

.dev-card-vp-hint {
  display: block;
  font-size: .55rem;
  color: #888;
  margin-top: 2px;
}

.dev-card-new {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #c03030;
  color: #fff;
  font-size: .5rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 7px;
  text-transform: uppercase;
}

/* ══ OVERLAYS + MODALS ══════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal {
  background: #f5f2eb;
  border: 1px solid #c8c4b8;
  border-radius: 14px;
  padding: 22px;
  max-width: 420px;
  width: 92%;
  box-shadow: 0 16px 50px rgba(0, 0, 0, .35);
  color: var(--lc-text);
}

.modal-wide {
  max-width: 480px;
}

.modal-win {
  text-align: center;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #3a2800;
  margin-bottom: 10px;
}

.modal-sub {
  font-size: .8rem;
  color: #6a5840;
  margin-bottom: 6px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: .86rem;
  color: var(--lc-text);
  line-height: 1.55;
}

.modal-body hr {
  border: none;
  border-top: 1px solid var(--lc-border);
}

.modal-btns {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.mbtn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 7px;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .18s;
}

.mbtn:disabled {
  opacity: .28;
  cursor: not-allowed;
}

.mbtn:not(:disabled):hover {
  opacity: .85;
}

.mbtn.primary {
  background: #257838;
  color: #fff;
}

.mbtn.secondary {
  background: rgba(0, 0, 0, .08);
  color: var(--lc-text);
  border: 1px solid var(--lc-border);
}

.mbtn.danger {
  background: #b83030;
  color: #fff;
}

/* ── About modal ── */
.modal-about {
  text-align: center;
  max-width: 340px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
}

.about-logo-wrap {
  margin-bottom: 4px;
}

.about-logo {
  height: 150px;
  width: auto;
  object-fit: contain;
  margin-bottom: -30px;
  margin-top: -20px;
}

.about-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold, #c0902a);
  margin-bottom: 2px;
}

.about-subtitle {
  font-size: .78rem;
  color: #888;
  margin-bottom: 12px;
}

.about-divider {
  height: 1px;
  background: rgba(255, 255, 255, .1);
  margin: 10px 0;
}

.about-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
}

.about-row {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  padding: 3px 0;
}

.about-label {
  color: #999;
}

.about-val {
  font-weight: 600;
  color: #ddd;
}

.about-note {
  font-size: .78rem;
  color: #888;
  line-height: 1.55;
  margin-top: 4px;
}

.about-credit {
  font-size: .82rem;
  color: #ccc;
  margin-top: 2px;
}

.about-credit b {
  color: #f0c040;
}

.about-contact {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .76rem;
  font-weight: 600;
  text-decoration: none;
  color: #e6e6e6;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 5px 12px;
  transition: background .14s, border-color .14s;
}

.about-link:hover {
  background: rgba(240, 192, 64, .18);
  border-color: rgba(240, 192, 64, .5);
  color: #fff;
}

.about-disclaimer {
  font-size: .68rem;
  color: #777;
  line-height: 1.5;
  margin-top: 14px;
  font-style: italic;
}

/* ── Language switcher (Rules / Manual) ── */
.lang-switch {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 10px;
}

.lang-switch--manual {
  position: absolute;
  top: 12px;
  left: 14px;
  margin-bottom: 0;
  z-index: 4;
}

.lang-btn {
  border: 1px solid var(--lc-border, #c9c2b4);
  background: rgba(150, 150, 150, .14);
  color: inherit;
  font-size: .74rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
  transition: background .14s, border-color .14s, color .14s;
}

.lang-btn:hover {
  border-color: #c0a030;
}

.lang-btn.active {
  background: #c0a030;
  border-color: #c0a030;
  color: #1a1a1a;
}

/* ── RTL (Persian) overrides ── */
.modal.lang-fa,
.modal-manual.lang-fa {
  /* Vazirmatn (loaded from Google Fonts in index.html); Tahoma is the Windows fallback when offline */
  font-family: "Vazirmatn", Tahoma, "Segoe UI", "Iranian Sans", sans-serif;
}

.modal[dir="rtl"],
.modal-manual[dir="rtl"] {
  text-align: right;
}

.modal-manual[dir="rtl"] .man-cover,
.modal-manual[dir="rtl"] .man-toc {
  text-align: center;
}

.modal-manual[dir="rtl"] .man-ol,
.modal-manual[dir="rtl"] .man-ul {
  padding-right: 22px;
  padding-left: 0;
}

.modal-manual[dir="rtl"] .man-flow-step {
  flex-direction: row-reverse;
}

.modal-manual[dir="rtl"] .man-robber-head {
  flex-direction: row-reverse;
}

.modal[dir="rtl"] .man-cost-txt,
.modal-manual[dir="rtl"] .man-vp td,
.modal-manual[dir="rtl"] .man-cost-name {
  text-align: right;
}


.modal-warn-icon {
  font-size: 2.4rem;
  margin-bottom: 6px;
}

.modal-confirm-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* ══════════════════════════════════════════════════════════
   Manual modal (full illustrated guide)
   ══════════════════════════════════════════════════════════ */
.modal-manual {
  max-width: 680px;
  width: 94%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.man-x {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
}

.man-x:hover {
  background: rgba(0, 0, 0, .5);
}

/* Cover */
.man-cover {
  text-align: center;
  padding: 18px 22px 14px;
  background: linear-gradient(140deg, #f3d27a 0%, #e6b347 45%, #c98f2c 100%);
  border-bottom: 1px solid #b8893a;
  flex-shrink: 0;
}

.man-cover-logo {
  height: 86px;
  width: auto;
  object-fit: contain;
  margin: -8px 0 -10px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .25));
}

.man-cover-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: #4a3206;
  letter-spacing: .5px;
}

.man-cover-sub {
  font-size: .82rem;
  color: #5a4310;
  max-width: 460px;
  margin: 4px auto 0;
  line-height: 1.5;
}

/* Table of contents */
.man-toc {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  padding: 12px 22px;
  background: #efe9dc;
  border-bottom: 1px solid #d8d1c0;
}

.man-toc a {
  font-size: .74rem;
  text-decoration: none;
  color: #5a4a2e;
  background: #fff;
  border: 1px solid #d8cfb8;
  border-radius: 14px;
  padding: 3px 10px;
}

@media (hover: hover) {
  .man-toc a {
    transition: background .12s, color .12s;
  }

  .man-toc a:hover {
    background: #c98f2c;
    color: #fff;
    border-color: #c98f2c;
  }
}

.man-toc a.toc-active {
  background: #c98f2c;
  color: #fff;
  border-color: #c98f2c;
}

/* Scrolling body */
.man-body {
  overflow-y: auto;
  padding: 6px 22px 8px;
  scroll-behavior: smooth;
}

.man-sec {
  padding: 16px 0;
  border-bottom: 1px solid #e4ddcd;
}

.man-sec:last-child {
  border-bottom: none;
}

.man-sec p {
  margin: 6px 0;
  font-size: .87rem;
  line-height: 1.6;
  color: #3f3220;
}

.man-h {
  font-size: 1.06rem;
  font-weight: 800;
  color: #3a2800;
  margin: 0 0 4px;
  scroll-margin-top: 8px;
}

.man-note {
  font-size: .8rem !important;
  color: #6a5840 !important;
  background: #f3eee2;
  border-left: 3px solid #c98f2c;
  border-radius: 0 6px 6px 0;
  padding: 7px 11px;
  margin-top: 8px !important;
}

.man-callout {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f3eee2;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 10px 0;
  font-size: .88rem;
  line-height: 1.5;
  color: #3f3220;
}

.man-callout--gold {
  background: linear-gradient(120deg, #fbf1d4, #f3e0a8);
  border: 1px solid #e2c374;
}

.man-callout-big {
  font-size: 1.7rem;
  font-weight: 800;
  color: #b07d1e;
  flex-shrink: 0;
}

/* Ordered / unordered lists */
.man-ol,
.man-ul {
  margin: 8px 0;
  padding-left: 22px;
}

.man-ol li,
.man-ul li {
  font-size: .86rem;
  line-height: 1.55;
  color: #3f3220;
  margin: 5px 0;
}

/* Tiles grid */
.man-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.man-tile {
  margin: 0;
  text-align: center;
}

.man-hex {
  display: inline-block;
  width: 74px;
  height: 82px;
}

.man-hex img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25));
}

.man-tile figcaption {
  font-size: .76rem;
  line-height: 1.4;
  color: #3f3220;
  margin-top: 4px;
}

.man-count {
  font-size: .72rem;
  color: #8a7550;
}

/* Resource cards */
.man-res-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 12px 0;
}

.man-res {
  margin: 0;
  text-align: center;
}

.man-res img {
  width: 100%;
  max-width: 80px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
}

.man-res figcaption {
  font-size: .76rem;
  color: #3f3220;
  margin-top: 5px;
}

/* Pieces */
.man-piece-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
  align-items: end;
}

.man-piece {
  margin: 0;
  text-align: center;
}

.man-piece img {
  height: 64px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .25));
}

.man-piece figcaption {
  font-size: .78rem;
  line-height: 1.4;
  color: #3f3220;
  margin-top: 6px;
}

.man-road-demo {
  display: inline-block;
  width: 14px;
  height: 56px;
  border-radius: 5px;
  background: #d84040;
  box-shadow: 0 3px 5px rgba(0, 0, 0, .25);
  transform: rotate(-18deg);
}

/* Dice (CSS pips) */
.man-dice-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0;
}

.man-die {
  width: 52px;
  height: 52px;
  background: #fdfbf4;
  border: 1px solid #cdbf9a;
  border-radius: 11px;
  box-shadow: 0 3px 7px rgba(0, 0, 0, .2), inset 0 -3px 6px rgba(0, 0, 0, .06);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 8px;
  gap: 2px;
}

.man-die i {
  width: 9px;
  height: 9px;
  background: #2a2118;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
}

/* 5-pip die: corners + center */
.man-die:first-child i:nth-child(1) {
  grid-area: 1 / 1;
}

.man-die:first-child i:nth-child(2) {
  grid-area: 1 / 3;
}

.man-die:first-child i:nth-child(3) {
  grid-area: 2 / 2;
}

.man-die:first-child i:nth-child(4) {
  grid-area: 3 / 1;
}

.man-die:first-child i:nth-child(5) {
  grid-area: 3 / 3;
}

/* 3-pip die: diagonal */
.man-die:nth-child(2) i:nth-child(1) {
  grid-area: 1 / 1;
}

.man-die:nth-child(2) i:nth-child(2) {
  grid-area: 2 / 2;
}

.man-die:nth-child(2) i:nth-child(3) {
  grid-area: 3 / 3;
}

.man-dice-eq {
  font-size: 1.4rem;
  font-weight: 800;
  color: #b07d1e;
}

.man-hot {
  color: #d83030;
}

/* Snake-draft strip */
.man-snake {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.man-snake span {
  background: #efe7d3;
  border: 1px solid #d8cfb8;
  border-radius: 6px;
  padding: 5px 11px;
  font-size: .82rem;
  font-weight: 700;
  color: #5a4a2e;
}

.man-snake-turn {
  background: #c98f2c !important;
  color: #fff !important;
  border-color: #c98f2c !important;
}

/* Turn flow */
.man-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.man-flow-step {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: #f6f2e8;
  border: 1px solid #e4ddcd;
  border-radius: 9px;
  padding: 9px 12px;
}

.man-flow-step div {
  font-size: .85rem;
  line-height: 1.5;
  color: #3f3220;
}

.man-flow-n {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c98f2c;
  color: #fff;
  font-weight: 800;
  font-size: .82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Build cost table */
.man-cost {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.man-cost td {
  padding: 9px 8px;
  border-bottom: 1px solid #e4ddcd;
  vertical-align: middle;
}

.man-cost tr:last-child td {
  border-bottom: none;
}

.man-cost-name {
  font-size: .85rem;
  width: 32%;
}

.man-cost-name .man-count {
  display: block;
  font-weight: 400;
}

.man-cost-ico {
  white-space: nowrap;
  width: 30%;
}

.man-cost-ico img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-right: 1px;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .2));
}

.man-cost-txt {
  font-size: .82rem;
  color: #5a4a2e;
}

/* Ports */
.man-port-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

.man-port {
  margin: 0;
  text-align: center;
  background: #f6f2e8;
  border: 1px solid #e4ddcd;
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.man-port>img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.man-port-imgs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
}

.man-port-imgs img {
  height: 30px;
  width: auto;
  object-fit: contain;
}

.man-rate {
  font-size: 1.2rem;
  font-weight: 800;
  color: #b07d1e;
}

.man-port figcaption {
  font-size: .76rem;
  line-height: 1.45;
  color: #3f3220;
}

/* Dev card grid */
.man-dev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.man-dev {
  margin: 0;
  display: flex;
  gap: 11px;
  align-items: center;
  background: #f6f2e8;
  border: 1px solid #e4ddcd;
  border-radius: 10px;
  padding: 9px 11px;
}

.man-dev img {
  width: 52px;
  flex-shrink: 0;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .22);
}

.man-dev figcaption {
  font-size: .8rem;
  line-height: 1.45;
  color: #3f3220;
}

/* Robber */
.man-robber-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 10px 0;
}

.man-robber-img {
  height: 70px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .3));
}

/* Special cards */
.man-special-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.man-special {
  margin: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  background: #f6f2e8;
  border: 1px solid #e4ddcd;
  border-radius: 10px;
  padding: 11px;
}

.man-special img {
  width: 64px;
  flex-shrink: 0;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.man-special figcaption {
  font-size: .8rem;
  line-height: 1.45;
  color: #3f3220;
}

/* VP table */
.man-vp {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}

.man-vp td {
  padding: 8px 10px;
  border-bottom: 1px solid #e4ddcd;
  font-size: .87rem;
  color: #3f3220;
}

.man-vp tr:last-child td {
  border-bottom: none;
}

.man-vp-n {
  text-align: right;
  font-weight: 800;
  color: #b07d1e;
  white-space: nowrap;
}

#btn-manual-close {
  margin: 0 22px 16px;
  width: calc(100% - 44px);
  flex-shrink: 0;
}

@media (max-width: 540px) {
  .modal-manual {
    width: 96%;
    max-height: 92vh;
  }

  .man-cover {
    padding: 14px 14px 12px;
  }

  .man-cover-logo {
    height: 64px;
  }

  .man-cover-title {
    font-size: 1.2rem;
  }

  .man-toc {
    padding: 8px 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .man-toc a {
    flex-shrink: 0;
  }

  .man-body {
    padding: 4px 14px 6px;
  }

  .man-tile-grid,
  .man-piece-grid,
  .man-port-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .man-res-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .man-dev-grid {
    grid-template-columns: 1fr;
  }

  .man-special-grid {
    grid-template-columns: 1fr;
  }

  .man-cost-name {
    width: auto;
  }

  .man-cost-ico img {
    width: 19px;
    height: 19px;
  }

  #btn-manual-close {
    margin: 0 14px 12px;
    width: calc(100% - 28px);
  }
}

.win-trophy {
  font-size: 3.6rem;
  margin-bottom: 10px;
}

/* Discard modal */
.discard-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 10px 0;
}

.discard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border-radius: 0;
  padding: 8px 2px;
  border-bottom: 1px solid rgba(0, 0, 0, .07);
  border-top: none;
  border-left: none;
  border-right: none;
}

.discard-res-icon {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

.discard-res-icon.wood {
  background: var(--wood);
}

.discard-res-icon.brick {
  background: var(--brick);
}

.discard-res-icon.sheep {
  background: var(--sheep);
}

.discard-res-icon.wheat {
  background: var(--wheat);
}

.discard-res-icon.ore {
  background: var(--ore);
}

.discard-res-name {
  flex: 1;
  font-size: .82rem;
}

.discard-available {
  font-size: .7rem;
  color: #6a5840;
}

.discard-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.discard-stepper button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--lc-border);
  background: rgba(0, 0, 0, .06);
  color: var(--lc-text);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.discard-stepper button:hover:not(:disabled) {
  background: rgba(0, 100, 0, .1);
  border-color: #28a030;
}

.discard-stepper button:disabled {
  opacity: .28;
  cursor: not-allowed;
}

.discard-amount {
  min-width: 20px;
  text-align: center;
  font-weight: 700;
}

.discard-total {
  text-align: center;
  font-size: .82rem;
  color: #6a5840;
  padding: 5px 0;
  border-top: 1px solid var(--lc-border);
}

.discard-total #discard-current,
.discard-total #yop-current {
  color: #257838;
  font-weight: 700;
}

/* Victim picker */
.victim-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.victim-btn {
  background: rgba(0, 0, 0, .04);
  border: 1px solid var(--lc-border);
  border-radius: 7px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .84rem;
  color: var(--lc-text);
  transition: .16s;
}

.victim-btn:hover {
  border-color: #28a030;
  background: #f0faf0;
}

.victim-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.victim-cards {
  margin-left: auto;
  font-size: .7rem;
  color: #6a5840;
}

/* Resource pickers (Monopoly / YoP) */
.res-picker,
.yop-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 12px 0;
}

.res-pick-btn,
.yop-btn {
  width: 72px;
  padding: 10px 4px;
  border-radius: 9px;
  border: 2px solid var(--lc-border);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: .16s;
  color: var(--lc-text);
  position: relative;
}

.res-pick-btn:hover:not(:disabled),
.yop-btn:hover {
  border-color: #28a030;
  background: #f0faf0;
}

.rpb-swatch {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  margin: 0 auto 5px;
  border: 1px solid rgba(0, 0, 0, .25);
}

.rpb-label {
  font-size: .68rem;
  font-weight: 600;
}

.yop-count-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: #257838;
  color: #fff;
  font-size: .65rem;
  font-weight: 900;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Trade modal */
.t-section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6a5840;
  margin: 10px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--lc-border);
}

.trade-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.trade-res-btn {
  flex: 1;
  min-width: 64px;
  padding: 7px 4px;
  border-radius: 7px;
  border: 2px solid var(--lc-border);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: .16s;
  color: var(--lc-text);
  font-size: .74rem;
}

.trade-res-btn.selected {
  border-color: #257838;
  background: #f0faf0;
  color: #186028;
}

.trade-res-btn:hover:not(:disabled):not(.selected) {
  border-color: rgba(40, 160, 48, .4);
}

.trade-res-btn:disabled {
  opacity: .28;
  cursor: not-allowed;
}

.trb-swatch {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  margin: 0 auto 4px;
  border: 1px solid rgba(0, 0, 0, .25);
}

.trb-rate {
  font-size: .6rem;
  color: #6a5840;
  margin-top: 1px;
}

.trade-info {
  font-size: .74rem;
  color: #6a5840;
  text-align: center;
  padding: 6px;
  background: rgba(0, 0, 0, .05);
  border-radius: 5px;
  margin-top: 8px;
  border: 1px solid var(--lc-border);
}

.trade-res-stepper {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}

.trade-res-stepper button {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--lc-border);
  background: rgba(0, 0, 0, .06);
  color: var(--lc-text);
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trade-res-stepper button:hover:not(:disabled) {
  border-color: #28a030;
}

.trade-res-stepper button:disabled {
  opacity: .28;
  cursor: not-allowed;
}

.trade-amount-val {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
  font-size: .8rem;
}

.proposal-box {
  background: rgba(0, 0, 0, .05);
  border-radius: 7px;
  padding: 10px;
  margin: 10px 0;
  font-size: .84rem;
  text-align: center;
  line-height: 1.7;
  border: 1px solid var(--lc-border);
}

.prop-give {
  color: #b03020;
}

.prop-want {
  color: #257838;
}

/* ══ PLAYER CARD RESOURCE ROW ══════════════════════════ */
/* Row of 5 resource icons shown inside each player card in the right panel */
/* .pc-res-row removed from right-panel cards — resources shown in left panel only */
.pc-res-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1;
  background: rgba(255, 255, 255, .04);
  border-radius: 4px;
  padding: 3px 2px;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}

.pc-res-item.has-res {
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .1);
}

.pc-res-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3));
}

.pc-res-n {
  font-size: .62rem;
  font-weight: 700;
  color: var(--rc-muted);
  line-height: 1;
}

.pc-res-item.has-res .pc-res-n {
  color: #e8e8e8;
}

/* ══ RESOURCE ICON IMAGES (Assets-Icon/*.png) ══════════ */

/* Hand cards — icon in left panel resource card */
.rc-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35));
}

/* Modal pickers — Monopoly, Year of Plenty */
.res-modal-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
  margin: 0 auto 5px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .2));
}

/* Trade modal resource buttons */
.trb-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}

/* Building costs in right panel */
.ci-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25));
}

.ci-grp {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: .68rem;
  color: var(--rc-muted);
}

/* Discard modal */
.discard-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}

/* Scrollbars */
.col-player::-webkit-scrollbar,
.game-log::-webkit-scrollbar,
.col-info::-webkit-scrollbar {
  width: 4px;
}

.col-player::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 4px;
}

.game-log::-webkit-scrollbar-thumb,
.col-info::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .1);
  border-radius: 4px;
}

/* ══ LONGEST ROAD / LARGEST ARMY NUMBER ANIMATION ═══════ */
.achieve-number-anim {
  font-family: 'MedievalSharp', serif;
  line-height: 1;
  will-change: left, top, transform, opacity;
}

@media (max-width: 540px) {
  .achieve-number-anim {
    font-size: 2rem !important;
  }
}

/* ══ FLYING RESOURCE CARDS ══════════════════════════════ */
.flying-card {
  position: fixed;
  width: 44px;
  height: 62px;
  border-radius: 5px;
  object-fit: contain;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .6);
  z-index: 9999;
  pointer-events: none;
  /* initial state set by JS; transition also set by JS per phase */
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.15);
}

/* ══ TOAST NOTIFICATIONS ════════════════════════════════ */
#toast-box {
  position: fixed;
  top: 82px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .4);
  opacity: 0;
  transform: translateX(50px);
  transition: opacity .28s ease, transform .28s ease;
}

.toast.toast-in {
  opacity: 1;
  transform: translateX(0);
}

.toast-collect {
  background: rgba(34, 120, 55, .92);
}

.toast-warn {
  background: rgba(170, 45, 45, .92);
}

.toast-success {
  background: rgba(150, 105, 15, .92);
}

.toast-info {
  background: rgba(40, 80, 160, .88);
}

/* ══ RESPONSIVE LAYOUT ══════════════════════════════════ */

/* Narrow desktop / large tablet — compress right panel */
@media (max-width: 1200px) {
  .col-info {
    width: 290px;
  }

  .pc-ctr-icon {
    width: 40px;
    height: 40px;
  }

  .pc-ctr-n {
    font-size: 1.4rem;
  }

  .pc-piece-img {
    width: 36px;
    height: 30px;
  }
}

/* Small desktop / tablet landscape — hide right panel, board takes full width */
@media (max-width: 960px) {
  .col-info {
    display: none;
  }

  .left-float {
    width: 140px;
  }
}

/* Tablet portrait */
@media (max-width: 720px) {
  .left-float {
    width: 120px;
    top: 70px;
  }

  .tb-title {
    display: none;
  }

  .action-bar {
    flex-wrap: wrap;
    gap: 4px;
    /* smaller button font here (.72rem); keep empty bar same height as button-present */
    min-height: calc(0.72rem * 1.2 + 21px);
  }

  .ab-btn {
    font-size: .72rem;
    padding: 5px 10px;
  }

  .ab-skip-disc {
    width: 100%;
    text-align: center;
    font-size: .6rem;
    padding: 3px 8px;
  }
}

/* Mobile — JS moves DOM into: players → action-bar → game-layout → log */
@media (max-width: 540px) {

  /* ── mobile header: logo left, timer + new game right ── */
  .mob-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 10px 10px;
    background: var(--tb-bg);
    border-bottom: 10px solid var(--tb-border);
    gap: 8px;
  }

  .mob-header .tb-brand {
    display: flex;
    align-items: center;
  }

  .tb-logo-img {
    height: 40px;
    width: auto;
    margin-top: -10px;
    margin-bottom: -20px;
    margin-left: 0;
  }

  .mob-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* ── instruction bar: auto-height so long text wraps ── */
  .instr-bar {
    height: auto;
    min-height: 30px;
    padding: 6px 12px;
    overflow: visible;
    text-align: center;
    border-top: 1px solid var(--tb-border);
  }

  .instr-btn {
    display: block;
    margin: 4px auto 0;
    width: fit-content;
  }

  /* ── unlock html/body so the native page scroll works ── */
  html,
  body {
    height: auto;
    overflow-x: hidden;
    /* no sideways drift at default zoom */
    overflow-y: visible;
  }

  /* ── #app: full-page scrollable flex column ── */
  #app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  /* ── 1. Player status bar — 2-column wrap grid ── */
  .rc-players-wrap {
    flex-shrink: 0;
    background: var(--rc-bg);
    height: auto;
    padding: 6px 8px;
    overflow: hidden;
  }

  #player-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* player cards — 2 per row */
  .player-card {
    min-height: 90px;
    padding: 6px 8px;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
    width: calc(50% - 4px);
  }

  .pc-right-col {
    gap: 2px;
  }

  .pc-reconn-badge {
    font-size: .5rem;
    padding: 1px 3px;
  }

  .pc-mode-badge {
    font-size: .48rem;
    padding: 1px 3px;
  }

  /* header: avatar + name + VP */
  .pc-header {
    margin-bottom: 5px;
    gap: 6px;
  }

  .pc-hourglass {
    /* ← hourglass size */
    width: 20px;
    height: 20px;
    margin-top: 0px;
    margin-left: -2px;
  }

  .pc-av-col {
    align-self: flex-start;
    margin-top: -1px;
    margin-left: -10px;
  }

  .pc-av {
    /* ← circle size */
    width: 20px;
    height: 20px;
  }

  .pc-av-ring-wrap {
    /* ← ring size (keep ~2px larger than circle) */
    width: 22px;
    height: 22px;
  }

  .pc-name {
    font-size: .68rem;
    /* ← name text size */
    margin-top: 0px;
    margin-left: -10px;
  }

  .pc-vp {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-top: -2px;
    margin-left: -15px;
  }

  .pc-vp-n {
    font-size: .75rem;
    color: black;
    /* ← VP number size */
  }

  .pc-star {
    font-size: .75rem;
    /* ← star size (keep same as pc-vp-n) */
  }

  .pc-vp-hidden {
    font-size: .5rem;
    top: -0.4em;
    margin-left: 0;
    color: black;
    font-weight: 700;
  }

  .pc-timer {
    font-family: 'DSEG7', monospace;
    font-weight: 400;
    position: absolute;
    font-size: .6rem;
    top: 35px;
    right: 10px;
  }

  /* counters — show all 4, no overlapping negative margins */
  .pc-counters {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: nowrap;
    margin: 0;
  }

  .pc-counters .pc-ctr:nth-child(2),
  .pc-counters .pc-ctr:nth-child(3),
  .pc-counters .pc-ctr:nth-child(4) {
    margin-left: 0;
  }

  .pc-ctr {
    flex: 1;
    padding: 2px 0;
    align-items: center;
  }

  /* counter number (above each icon in the 2×2 grid) */
  .pc-ctr-n {
    font-size: .82rem;
    /* ← text size */
    margin-top: 0px;
    /* ↕ up(-) / down(+) */
    margin-left: 0px;
    /* ↔ left(-) / right(+) */
  }

  /* counter icon (below each number in the 2×2 grid) */
  .pc-ctr-icon {
    width: 20px;
    /* ← icon width  */
    height: 20px;
    /* ← icon height */
    margin-top: 0px;
    /* ↕ up(-) / down(+) */
    margin-left: 0px;
    /* ↔ left(-) / right(+) */
  }

  /* piece counts (remaining roads/settlements/cities) — stacked vertically */
  .pc-pieces {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: -10px;
  }

  .pc-piece {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 3px;
  }

  /* piece image (road / settlement / city remaining) */
  .pc-piece-img {
    width: 18px;
    height: 12px;
    margin-top: -2px;
    margin-left: 0px;
  }

  /* piece count number */
  .pc-piece-n {
    font-size: .6rem;
    margin-top: 0px;
    margin-left: -5px;
  }

  /* Played DV cards strip (panel style, scaled to fit 5-6 cards per row) */
  .pc-played-dv {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
    margin-top: 5px;
  }

  .pc-pdv-card {
    width: 24px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, .25);
    background: rgba(0, 0, 0, .1);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  }

  .pc-pdv-card img {
    width: 100%;
    display: block;
  }

  /* ── 2. Action bar ── */
  .action-bar {
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
    /* button .72rem + button padding (5+5) + bar padding (4+4) + border (1) */
    min-height: calc(0.72rem * 1.2 + 19px);
    border-top: 1px solid var(--tb-border);
  }

  .ab-btn {
    font-size: .72rem;
    padding: 5px 10px;
  }

  .ab-skip-disc {
    padding: 3px 7px;
    width: auto;
  }

  /* ── 3. Board ── */
  .game-layout {
    flex-direction: column;
    flex: 0 0 auto;
    overflow: visible;
  }

  .col-ocean {
    flex: 0 0 auto;
    position: relative;
    overflow: visible;
    /* must be visible — overflow:hidden clips tiles during pinch-zoom */
    width: 100%;
    order: 1;
    padding: 0;
    /* height set by scaleBoardToFit() so mob-bottom-wrap sits below the board */
  }

  .board {
    position: absolute;
    top: 0;
    left: 0;
    width: 720px;
    height: 720px;
    margin: 0;
    transform-origin: 0 0;
    /* pan-y pinch-zoom: browser handles vertical scroll and 2-finger pinch;
       horizontal drag goes to JS for board panning (mobile pan is horizontal-only). */
    touch-action: pan-y pinch-zoom;
    /* no will-change: transform on mobile — it creates a GPU compositing layer that
       conflicts with native pinch-to-zoom compositing, causing tiles to disappear */
  }

  /* Zoom buttons: same model as the Building Costs float — position:absolute,
     anchored to an ocean corner, so they stay put (don't scale) when the land
     is zoomed and scroll with the board, exactly like Building Costs. */
  .board-zoom-ctrl {
    position: absolute;
    left: 10px;
    bottom: 10px;
    right: auto;
    top: auto;
    transform: none;
    flex-direction: column;
    margin: 0;
    z-index: 20;
  }

  .bz-btn {
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
  }

  /* ── Game log + trade/discard/monopoly panels — in-flow below inventory, page scrolls ── */
  .mob-bottom-wrap {
    flex-shrink: 0;
    background: #f5f2ea;
  }

  /* frame inside the board */
  .frame-img {
    inset: -90px -140px;
    /* top/bottom -90px, left/right -140px — same as desktop */
    width: auto;
    height: auto;
  }

  /* dice: move inside the visible board area */
  .dice-float {
    right: 10px;
    top: 10px;
  }

  .dice-wrapper {
    margin: 5px;
    /* ← reduce to shrink the gap */
  }

  #wec-dice-roll-container {
    --dice-size: 40px;
    /* ← default is larger, reduce to shrink dice */
  }

  /* ── 4. Inventory — fixed strip directly below the board, never scrolls with the log ── */
  .left-float {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    /* ← inventory bar width */
    height: 70px;
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 8px;
    gap: 6px;
    background: var(--lc-bg);
    border-top: 1px solid var(--lc-border);
  }

  .hand-heading {
    display: none;
  }

  .hand-cards {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    margin-top: 0;
    flex: 1;
  }

  .res-row {
    height: auto;
    padding: 4px 6px;
    flex-direction: row;
    gap: 4px;
  }

  /* ── 5. Log ── */
  .rc-log-block {
    flex-shrink: 0;
    min-height: 80px;
    max-height: none;
    overflow-y: visible;
    background: #f5f2ea;
    border-top: 2px solid var(--lc-border);
    padding: 6px 10px;
  }

  .rc-log-block .rc-hd {
    color: var(--lc-text);
    font-size: .75rem;
    border-bottom: 1px solid var(--lc-border);
    margin-bottom: 4px;
    padding-bottom: 3px;
  }

  .rc-log-block #log-search {
    background: rgba(0, 0, 0, .08);
    border-color: var(--lc-border);
    color: var(--lc-text);
  }

  .rc-log-block #log-search-clear {
    color: var(--lc-text);
  }

  .log-search-wrap {
    max-width: 120px;
  }

  .game-log {
    max-height: none;
    min-height: 0;
  }

  .log-msg {
    color: var(--lc-text) !important;
    font-size: .72rem;
  }

  /* ── Proposal panel — in-flow under inventory, same style as trade panel ── */
  .proposal-panel {
    position: static !important;
    width: 100% !important;
    max-width: none;
    min-width: 0;
    z-index: auto;
    background: #f5f0e8;
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    border-left: none;
    border-right: none;
    border-radius: 0;
    padding: 8px 10px;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  }

  .prop-panel-header {
    position: static;
    bottom: auto;
    border-bottom: 1px solid var(--lc-border);
    padding-bottom: 4px;
    margin-bottom: 2px;
  }

  .prop-panel-body {
    gap: 2px;
  }

  .prop-col-hd {
    font-size: .58rem;
    letter-spacing: .08em;
    padding: 0 0 2px;
    border-bottom: none;
  }

  #tp-cr-give,
  #tp-cr-recv {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  #prop-give-col,
  #prop-recv-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .prop-ro-row {
    height: 28px;
    padding: 4px 2px;
    gap: 3px;
  }

  .prop-ro-icon {
    width: 18px;
    height: 18px;
  }

  .proposal-panel .tp-row {
    padding: 4px 2px;
    height: 28px;
    gap: 3px;
  }

  .proposal-panel .tp-res-icon {
    width: 16px;
    height: 16px;
  }

  /* ── Discard — in-flow between inventory and log, scrollable within panel ── */
  .discard-panel {
    position: static !important;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    background: #f5f0e8;
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    gap: 6px;
    max-height: 55vh;
    overflow-y: auto;
  }

  /* ── Monopoly — in-flow below inventory, same as YoP / discard panels ── */
  .monopoly-panel {
    position: static !important;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    background: #f5f0e8;
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    gap: 6px;
    max-height: 55vh;
    overflow-y: auto;
  }

  .discard-panel .dp-subtitle,
  .monopoly-panel .tp-col-hd {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--lc-text);
    border-bottom: 1px solid var(--lc-border);
    padding-bottom: 4px;
  }

  /* resource rows full width inside panels */
  .discard-panel .tp-col,
  .monopoly-panel .tp-col {
    width: 100%;
  }

  /* proposal-panel hidden on mobile — unified trade-panel handles all trade types */
  #proposal-panel {
    display: none !important;
  }

  /* trade panel — in-flow between inventory and log */
  .trade-panel {
    position: static !important;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    max-height: none;
    overflow-y: visible;
    z-index: auto;
    background: #f5f0e8;
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    padding: 8px 10px;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  }

  /* yop panel — in-flow like discard panel */
  .yop-panel {
    position: static !important;
    display: flex;
    flex-direction: column;
    width: 100% !important;
    background: #f5f0e8;
    border-top: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    gap: 6px;
    max-height: 55vh;
    overflow-y: auto;
  }

  .yop-panel .dp-subtitle {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--lc-text);
    border-bottom: 1px solid var(--lc-border);
    padding-bottom: 4px;
  }

  .yop-panel .tp-col {
    width: 100%;
  }

  /* status shown inline in panel title on mobile — standalone hidden */
  .trade-panel .tp-status,
  .discard-panel .tp-status,
  .monopoly-panel .tp-status,
  .yop-panel .tp-status {
    display: none;
  }

  /* inline status span appended to title text */
  .tp-title-inline-status {
    display: inline;
    font-weight: 600;
    font-size: inherit;
  }

  .tp-title-inline-status.tp-valid,
  .tp-title-inline-status.tp-status-ok {
    color: #257838;
  }

  .tp-title-inline-status.tp-invalid {
    color: #a03030;
  }

  /* show header with title + timer + close on mobile */
  .trade-panel .tp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    height: 18px;
    line-height: 1;
    border-bottom: 1px solid var(--lc-border);
  }

  .trade-panel .tp-title {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    color: var(--lc-text);
  }

  .trade-panel .tp-close {
    display: block;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--lc-muted);
    padding: 2px 6px;
  }

  /* halves side by side inside .tp-body */
  .trade-panel .tp-body {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-start;
  }

  .trade-panel .tp-half {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0;
  }

  .trade-panel .tp-half-col {
    flex: 0 0 auto;
    min-width: 0;
  }

  /* ⇄ sits in the header row — same border + margin as tp-col-hd */
  .trade-panel .tp-inner-sep {
    display: flex;
    align-items: center;
    align-self: flex-start;
    padding: 0 3px 3px;
    border-bottom: 1px solid var(--lc-border);
    margin-bottom: 3px;
    font-size: .8rem;
    line-height: 1;
    color: var(--lc-muted);
    flex-shrink: 0;
  }

  #tp-vsep {
    margin: 0 4px;
  }

  /* hidden globally on mobile — trade panel overrides below */
  .tp-col-hd {
    display: none;
  }

  /* Give / Get column headers visible inside the unified trade panel */
  .trade-panel .tp-col-hd {
    display: block;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--lc-muted);
    text-align: center;
    padding: 0 2px 3px;
    border-bottom: 1px solid var(--lc-border);
    margin-bottom: 3px;
    white-space: nowrap;
  }

  .tp-col {
    gap: 2px;
  }

  .trade-panel .tp-col {
    gap: 1px;
  }

  .tp-row {
    padding: 6px 2px 2px;
    height: 38px;
    gap: 3px;
    align-items: flex-end;
  }

  /* override ID-specific desktop grid rules that set height: 52px */
  /* taller rows so each 1fr sub-row (trash / arrow) has comfortable space */
  #tp-left-give .tp-row,
  #tp-left-get .tp-row,
  #tp-right-give .tp-row,
  #tp-right-get .tp-row,
  #monopoly-grid .tp-row {
    height: 38px !important;
  }

  /* On mobile the panel is full-width, so space-between pushes the arrow to the
     far edge. Keep icon and arrow together so the arrow reads as "selected". */
  #monopoly-grid .tp-row {
    justify-content: flex-start;
  }

  /* Trash overlaid on arrow: both sit in grid-row 2 (the arrow's cell).
     Trash stretches to fill the cell and uses a solid background to cover the arrow.
     z-index: 1 ensures trash renders above the arrow regardless of DOM order
     (Get columns have arrow after trash in the DOM, so z-index is required).
     Trash-ph is an empty transparent span — arrow shows through it. */
  .trade-panel #tp-left-give .tp-trash,
  .trade-panel #tp-left-get .tp-trash,
  .trade-panel #tp-right-give .tp-trash,
  .trade-panel #tp-right-get .tp-trash {
    grid-row: 2 !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f0e8;
    z-index: 1;
  }

  .trade-panel #tp-left-give .tp-trash-ph,
  .trade-panel #tp-left-get .tp-trash-ph,
  .trade-panel #tp-right-give .tp-trash-ph,
  .trade-panel #tp-right-get .tp-trash-ph {
    grid-row: 2 !important;
  }

  /* Pin icon-wrap to bottom of its grid area — position depends only on fixed row height */
  .trade-panel .tp-icon-wrap {
    align-self: end !important;
  }

  /* desktop proposal-panel counter columns — height override kept for desktop */
  #counter-give-col .tp-row,
  #counter-recv-col .tp-row {
    height: 28px !important;
  }

  .trade-panel .tp-res-icon {
    width: 10px;
    height: 10px;
  }

  .trade-panel .tp-col .tp-row:nth-child(n) .tp-res-icon {
    width: 28px;
    height: 28px;
  }

  .trade-panel .tp-arrow {
    font-size: 1.1rem;
  }

  .trade-panel .tp-trash {
    font-size: .6rem;
  }

  .trade-panel .tp-footer {
    display: flex;
    gap: 6px;
    padding-top: 4px;
  }

  /* read-only offer rows inside the unified trade panel — match tp-row exactly */
  .trade-panel .prop-ro-row {
    height: 38px;
    padding: 6px 2px 2px;
    gap: 3px;
    align-items: flex-end;
  }

  .trade-panel .prop-ro-icon {
    width: 28px;
    height: 28px;
  }

  .trade-panel .prop-ro-icon-wrap {
    align-self: end;
  }

  /* ── Hide desktop-only floats ── */

  .building-costs-float {
    display: block;
    width: 70px;
    bottom: 10px;
    right: 10px;
  }

  /* dev cards float — in-flow strip between panels and log */
  .dev-cards-float {
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    pointer-events: auto;
    z-index: auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    max-width: none;
    padding: 15px 18px 25px 20px;
    background: var(--lc-bg);
    border-top: 1px solid var(--lc-border);
    overflow: visible;
    /*margin-top: 15px;
    margin-bottom: 15px;*/
  }

  /* card size — adjust here to resize all slots at once */
  .dcf-card img {
    width: 80px;
    /* card width on mobile  ← adjust */
  }

  /* each card is in-flow within the dev cards strip */
  .dcf-card {
    position: relative;
    pointer-events: auto;
  }

  /* dev card buy notification — bottom-left on mobile */
  .dev-buy-notify {
    position: fixed;
    bottom: 80px;
    /* ↕ move up(-) / down(+) */
    left: 10px;
    /* ↔ move left(-) / right(+) */
    top: auto;
    transform: none;
    z-index: 300;
    text-align: left;
  }

  .dev-buy-notify img {
    width: 70px;
    /* ← card image size */
    margin: 0 0 6px;
  }

  /* special cards — in-flow below the DV hand panel, same look */
  .special-cards-row {
    position: relative;
    inset: auto;
    z-index: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 18px 25px 20px;
    background: var(--lc-bg);
    border-top: 1px solid var(--lc-border);
  }

  .special-card-img {
    width: 80px;
    margin: 0;
  }

  /* trade proposal panel — same in-flow style handled by the main @media (max-width: 540px) block */

  .prop-res-img {
    width: 22px;
    height: 22px;
  }



  /* ── About modal ── */
  .modal-about {
    max-width: 96%;
    padding: 16px;
  }

  .about-logo {
    height: 150px;
    margin-top: 0;
    margin-bottom: -30px;
  }

  .about-title {
    font-size: 1.05rem;
  }

  .about-subtitle {
    font-size: .72rem;
  }

  .about-row {
    font-size: .76rem;
  }

  .about-note {
    font-size: .72rem;
  }

  /* ── Confirm new-game modal ── */
  .modal-confirm {
    padding: 18px 16px;
  }

  .modal-warn-icon {
    font-size: 1.9rem;
  }

  .modal-confirm-btns {
    flex-direction: column;
    gap: 8px;
  }

}

/* ── Admin Spectate / Inspector mode ───────────────────────────── */

/* Hide inventory + special cards — inspector has no player seat */
.spectate-mode .hand-heading,
.spectate-mode #hand-cards,
.spectate-mode #special-cards-row {
  display: none !important;
}

/* Resource + dev-card row appended to each player card in spectate mode */
.pc-spec-res {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 10px 6px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: rgba(0, 0, 0, .15);
}

.psr-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 4px;
  padding: 1px 5px;
}

.psr-pill.psr-has {
  color: #e4d8b8;
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
}

.psr-pill strong {
  font-weight: 700;
}

.psr-sep {
  font-size: 11px;
  color: rgba(255, 255, 255, .3);
  padding: 0 2px;
}

.psr-card {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.psr-card-knight {
  background: rgba(56, 120, 224, .22);
  color: #84b8ff;
  border-color: rgba(56, 120, 224, .4);
}

.psr-card-road_building {
  background: rgba(40, 176, 96, .22);
  color: #74ee99;
  border-color: rgba(40, 176, 96, .38);
}

.psr-card-year_of_plenty {
  background: rgba(212, 164, 48, .22);
  color: #e8c454;
  border-color: rgba(212, 164, 48, .4);
}

.psr-card-monopoly {
  background: rgba(224, 82, 82, .22);
  color: #ff9090;
  border-color: rgba(224, 82, 82, .38);
}

.psr-card-vp {
  background: rgba(160, 90, 255, .22);
  color: #cc9aff;
  border-color: rgba(160, 90, 255, .38);
}

.psr-card.psr-new {
  opacity: .42;
}

@media (max-width: 540px) {
  .pc-spec-res {
    display: none;
  }
}