:root {
  --ink: #06141b;
  --panel: rgba(22, 105, 130, .90);
  --panel-solid: #166982;
  --panel-dark: rgba(16, 78, 99, .90);
  --line: #06141b;
  --cream: #f3eee2;
  --gold: #f6c64a;
  --wet: rgba(0, 111, 179, .90);
  --dry: rgba(182, 0, 0, .90);
  --green: rgba(0, 184, 92, .94);
  --muted: #d8e3e8;
  --road: rgba(34, 43, 47, .16);
  --dev: rgba(255,255,255,.08);
  --grass: rgba(38,126,28,.10);
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
  --grid-scale-x: 1;
  --grid-scale-y: 1;
}

* { box-sizing: border-box; }

/* Ensure the settings / card modal stays hidden until JavaScript opens it. */
[hidden], .modal[hidden], .card-preview[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  background: #111 url("../assets/background/prohibition-background.png") center center / cover fixed no-repeat;
}

button, select, input { font: inherit; }
.screen { display: none; }
.screen.active { display: block; }

.load-card {
  max-width: 920px;
  margin: 36px auto;
  background: rgba(255,255,255,.93);
  border: 4px solid var(--line);
  box-shadow: 10px 10px 0 rgba(0,0,0,.34);
  padding: 28px;
}

.brand-block h1, .title-box h1 { margin: 0; font-size: 34px; line-height: .95; letter-spacing: -.04em; }
.brand-block p, .title-box p { margin: 6px 0 0; font-weight: 700; letter-spacing: -.02em; }
.load-card h2 { margin: 24px 0 6px; }
.muted { color: #50626a; }
.player-setup { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 12px; margin: 22px 0; }
.setup-slot { border: 2px solid var(--line); background: rgba(247,250,251,.93); padding: 12px; }
.setup-slot label { display: grid; gap: 8px; font-weight: 700; }
.setup-slot select { width: 100%; border: 2px solid var(--line); padding: 8px; background: rgba(255,255,255,.94); }
.check-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.load-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }

.btn {
  cursor: pointer;
  border: 3px solid var(--line);
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
  color: #fff;
  background: var(--green);
  box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.btn.primary { background: var(--green); }
.btn.secondary { background: var(--panel); }

.game-shell.active {
  display: grid;
  grid-template-columns: 250px minmax(760px, 1fr) 230px;
  gap: 14px;
  min-height: 100vh;
  padding: 10px 12px;
}

.left-rail { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.title-box { text-align: center; padding: 12px 0 6px; background: rgba(255,255,255,.80); border: 3px solid rgba(6,20,27,.75); }
.title-box h1 { font-size: 31px; }
.small-label { font-size: 10px; font-weight: 800; margin: 0 0 6px 4px; color: #fff; text-shadow: 0 1px 2px #000; }
.player-badges { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.player-badge {
  border: 3px solid var(--line);
  background: rgba(119,130,138,.90);
  color: #fff;
  font-size: 21px;
  font-weight: 900;
  height: 34px;
  display: grid;
  place-items: center;
  position: relative;
}
.player-badge.dry { background: var(--dry); }
.player-badge.wet { background: var(--wet); }
.player-badge.inactive { background: rgba(122,122,122,.85); opacity: .55; }
.player-badge.active-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,198,74,.55); }
.player-badge.computer::after { content: "CPU"; position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); color: #fff; text-shadow: 0 1px 2px #000; font-size: 8px; font-weight: 900; }

.money-display {
  min-height: 59px;
  border: 3px solid var(--line);
  background: var(--panel);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 31px;
  letter-spacing: .02em;
}
.dice-row { display: grid; grid-template-columns: 72px 1fr; gap: 8px; }
.dice-face {
  height: 74px;
  border: 3px solid var(--line);
  background: var(--panel);
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 900;
  font-size: 14px;
}
.dice-face.rolled { font-size: 48px; line-height: 1; background: rgba(255,255,255,.93); color: var(--ink); }
.roll-btn {
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
}
.roll-btn:disabled { opacity: .45; }

.turn-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.left-turn-buttons { margin-top: -2px; }
.btn.control { min-height: 54px; padding: 7px; font-size: 11px; line-height: 1.08; }

.active-card-panel {
  flex: 0 0 auto;
  min-height: 0;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}
.active-character-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  padding: 4px;
  border: 4px solid rgba(34,34,34,.88);
  background: rgba(34,34,34,.75);
  border-radius: 10px;
  box-shadow: 0 6px 12px rgba(0,0,0,.38);
}
.active-character-card.wet { border-color: rgba(0, 111, 179, .95); }
.active-character-card.dry { border-color: rgba(182, 0, 0, .95); }
.active-character-card.placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 22px;
  text-align: center;
  line-height: 1.2;
  min-height: 180px;
  width: 100%;
}
.active-character-card img { width: auto; max-width: 100%; height: auto; max-height: 360px; object-fit: contain; display: block; }

.right-area { display: grid; grid-template-rows: minmax(360px, 1fr) 215px; gap: 12px; min-width: 0; min-height: 0; }
.board-panel { border: 3px solid var(--line); background: var(--panel); padding: 8px; display: grid; min-height: 0; }
.board-wrap {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: 1672 / 941;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0d2229;
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
  --grid-scale-x: 1;
  --grid-scale-y: 1;
}
.board-wrap img { width: 100%; height: 100%; object-fit: fill; user-select: none; pointer-events: none; }
.piece-layer, .grid-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  pointer-events: none;
  transform: translate(var(--grid-offset-x), var(--grid-offset-y)) scale(var(--grid-scale-x), var(--grid-scale-y));
  transform-origin: top left;
}
.grid-overlay { display: grid; grid-template-columns: repeat(26, 1fr); grid-template-rows: repeat(15, 1fr); opacity: 0; }
.grid-overlay.show-grid { opacity: 1; }
.grid-cell { border: 1px solid transparent; background: transparent; }
.grid-overlay.show-grid .grid-cell { border-color: rgba(255,255,255,.42); }
.grid-overlay.show-grid .grid-cell.start { background: rgba(246,198,74,.18); }
.grid-overlay.show-grid .grid-cell.road { background: rgba(80,80,80,.10); }
.grid-overlay.show-grid .grid-cell.dev { background: rgba(255,255,255,.08); }
.grid-overlay.show-grid .grid-cell.grass { background: rgba(38,126,28,.08); }

.highlight { position: absolute; border: 3px solid var(--gold); background: rgba(246,198,74,.22); border-radius: 8px; pointer-events: auto; cursor: pointer; }
.highlight.invalid { border-color: #f34f4f; background: rgba(243,79,79,.18); }
.token {
  position: absolute;
  width: min(30px, 2.1vw);
  height: min(30px, 2.1vw);
  border: 3px solid #fff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 6px rgba(0,0,0,.55);
  pointer-events: none;
  z-index: 30;
}
.token.dry { background: var(--dry); }
.token.wet { background: var(--wet); }
.token.arrested { opacity: .25; filter: grayscale(1); }
.placed-building {
  position: absolute;
  z-index: 20;
  border: 2px solid rgba(8,16,21,.95);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(168,141,92,.94) 0%, rgba(93,74,48,.94) 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), 0 5px 10px rgba(0,0,0,.45);
  overflow: hidden;
  pointer-events: none;
}
.placed-building::before {
  content: "";
  position: absolute;
  inset: 7%;
  border: 2px solid rgba(255,255,255,.34);
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.18) 0 4px, transparent 4px 11px),
    radial-gradient(circle at 50% 50%, rgba(246,198,74,.28), transparent 45%);
}
.placed-building.has-image {
  background: transparent;
  box-shadow: 0 5px 10px rgba(0,0,0,.32);
}
.placed-building.has-image::before {
  display: none;
}
.placed-building.has-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  z-index: 1;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.28));
}
.placed-building.wet { outline: 4px solid rgba(0,111,179,.72); }
.placed-building.dry { outline: 4px solid rgba(182,0,0,.72); }
.placed-building.speakeasy { box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), 0 0 0 5px rgba(182,0,0,.42), 0 5px 10px rgba(0,0,0,.45); }
.placed-building .building-label {
  position: absolute;
  inset: auto 4px 4px 4px;
  background: rgba(6,20,27,.78);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fire-marker { position: absolute; top: 2px; right: 3px; font-size: 18px; z-index: 2; }

.action-hand-panel, .building-hand-panel {
  border: 3px solid var(--line);
  background: rgba(34,34,34,.75);
  color: #fff;
  padding: 10px;
  min-width: 0;
  overflow: visible;
}
.action-hand-panel header, .building-hand-panel header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.action-hand-panel h2, .building-hand-panel h2 { margin: 0; font-size: 12pt; font-weight: 700; text-align: left; flex: 1; line-height: 1.15; }
.left-card-deck { flex: 0 0 165px; display: grid; grid-template-rows: auto 1fr; }
.left-card-deck h2 { font-size: 12pt; line-height: 1.15; }
.pill { border: 2px solid #fff; border-radius: 999px; padding: 3px 8px; font-weight: 800; font-size: 12px; white-space: nowrap; }
.card-strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 8px; min-height: 118px; }
.action-strip { height: 165px; overflow-y: visible; align-items: flex-start; }
.building-strip { height: 126px; align-items: flex-start; }
.hand-card {
  flex: 0 0 66px;
  height: 96px;
  border: 2px solid #041015;
  border-radius: 6px;
  background: #f6efe4;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  box-shadow: 0 3px 5px rgba(0,0,0,.28);
}
.action-strip .hand-card { flex-basis: 104px; height: 150px; }
.building-strip .hand-card { flex-basis: 76px; height: 110px; }
.hand-card:hover { transform: translateY(-3px); }
.hand-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hand-card .fallback-title { display: grid; place-items: center; text-align: center; font-size: 9px; font-weight: 900; padding: 4px; height: 100%; }
.hand-card .mini-badge { position: absolute; left: 2px; right: 2px; bottom: 2px; background: rgba(6,20,27,.78); color: #fff; text-align: center; font-size: 8px; padding: 2px; font-weight: 900; }
.action-strip .hand-card .mini-badge { font-size: 9px; }

.card-preview {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  width: 416px;
  max-width: min(416px, 92vw);
  filter: drop-shadow(0 12px 22px rgba(0,0,0,.55));
}
.card-preview img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #f6efe4;
}

.log-panel { border: 3px solid var(--line); background: rgba(249,251,252,.90); min-width: 0; max-height: calc(100vh - 20px); overflow: hidden; display: flex; flex-direction: column; }
.log-title { background: var(--panel); color: #fff; padding: 10px; font-weight: 900; border-bottom: 3px solid var(--line); }
#game-log { padding: 10px; overflow-y: auto; font-size: 12px; line-height: 1.4; }
.log-entry { border-bottom: 1px solid #d9e1e4; padding: 6px 0; }
.log-entry strong { color: var(--panel-solid); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.48); display: grid; place-items: center; z-index: 999; padding: 22px; }
.modal-card { background: rgba(255,255,255,.96); border: 4px solid var(--line); max-width: 760px; width: min(760px, 100%); max-height: 88vh; overflow-y: auto; padding: 22px; position: relative; box-shadow: 12px 12px 0 rgba(0,0,0,.24); }
.modal-close { position: absolute; right: 10px; top: 8px; background: transparent; border: 0; font-size: 34px; cursor: pointer; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-card table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.modal-card td, .modal-card th { border: 1px solid #cbd5da; padding: 7px; text-align: left; vertical-align: top; }
.choice-list { display: grid; gap: 8px; margin-top: 10px; }
.choice-list button { text-align: left; border: 2px solid var(--line); background: #f7fafb; padding: 10px; cursor: pointer; }
.choice-list button:hover { background: #e8f2f5; }

.grid-settings { margin-top: 14px; padding: 12px; border: 2px solid var(--line); background: rgba(247,250,251,.92); }
.grid-settings h3 { margin: 0 0 10px; }
.grid-settings .check-row { margin: 8px 0 12px; }
.grid-controls { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.grid-controls label { display: grid; gap: 5px; font-weight: 700; }
.grid-controls input { border: 2px solid var(--line); padding: 7px; }
.grid-nudge { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.grid-nudge button { border: 2px solid var(--line); background: var(--panel); color: #fff; padding: 8px; font-weight: 900; cursor: pointer; }
.grid-nudge button:hover { filter: brightness(1.1); }

.rules-btn {
  margin: 10px;
  min-height: 42px;
  background: var(--green);
  color: #fff;
  border: 3px solid var(--line);
  font-weight: 900;
}
.rules-btn:hover { filter: brightness(1.06); }
.rules-content h3 { margin: 16px 0 6px; }
.rules-content ul { margin: 6px 0 10px 20px; padding: 0; }
.rules-content li { margin: 4px 0; line-height: 1.35; }
.card-modal-image {
  max-width: 190px;
  float: right;
  margin: 0 0 12px 12px;
  border: 2px solid #06141b;
  border-radius: 8px;
}
.recycle-warning {
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 4px solid var(--gold);
  background: rgba(246,198,74,.18);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .game-shell.active { grid-template-columns: 225px 1fr; }
  .log-panel { display: none; }
  .right-area { grid-template-rows: minmax(340px, 1fr) 205px; }
  .action-hand-panel h2 { font-size: 12pt; }
  .left-card-deck h2 { font-size: 12pt; }
  .action-strip .hand-card { flex-basis: 94px; height: 136px; }
  .card-preview { width: 376px; }
}

/* V6 asset polish */
.logo-block,
.logo-box {
  display: grid;
  place-items: center;
  overflow: visible;
}
.logo-block img {
  display: block;
  width: min(640px, 100%);
  height: auto;
  margin: 0 auto 4px;
}
.logo-box {
  padding: 6px 4px;
  background: rgba(255,255,255,.68);
}
.logo-box img {
  display: block;
  width: 100%;
  max-height: 74px;
  object-fit: contain;
}
.dice-face {
  padding: 0;
  overflow: hidden;
  background: transparent;
}
.dice-face img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.dice-face.rolled {
  background: transparent;
}
.image-button {
  font-size: 0;
  line-height: 0;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  min-width: 0;
}
.image-button span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.image-button:hover,
.image-button:active {
  transform: none;
  filter: brightness(1.03);
}
.roll-image-button {
  min-height: 74px;
  background-image: url('../assets/ui/Button_Roll_Dice.png');
}
.roll-image-button:hover,
.roll-image-button:active {
  background-image: url('../assets/ui/Button_Roll_Dice_Hover.png');
}
.turn-buttons {
  grid-template-columns: 1fr;
  gap: 6px;
}
.btn.control.image-button {
  min-height: 54px;
  width: 100%;
}
.end-image-button { background-image: url('../assets/ui/Button_End_Turn.png'); }
.end-image-button:hover,
.end-image-button:active { background-image: url('../assets/ui/Button_End_Turn_Hover.png'); }
.automate-image-button { background-image: url('../assets/ui/Button_Automate_Turn.png'); }
.automate-image-button:hover,
.automate-image-button:active { background-image: url('../assets/ui/Button_Automate_Turn_Hover.png'); }
.settings-image-button { background-image: url('../assets/ui/Button_Settings.png'); }
.settings-image-button:hover,
.settings-image-button:active { background-image: url('../assets/ui/Button_Settings_Hover.png'); }
.image-button:disabled {
  opacity: .45;
  filter: grayscale(.35);
}
.placed-building.town-hall {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  outline: 0;
  z-index: 18;
}
.placed-building.town-hall::before,
.placed-building.town-hall .building-label {
  display: none;
}
.placed-building.town-hall img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 132%;
  height: 160%;
  object-fit: contain;
  transform: translate(-50%, -58%);
  filter: drop-shadow(0 7px 10px rgba(0,0,0,.45));
}
.image-button { position: relative; }


/* V7 layout and alignment refinements */
.title-box.logo-box {
  background: transparent;
  border: 0;
  padding: 0;
}
.logo-box {
  background: transparent;
}
.logo-box img {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.45));
}

.left-turn-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px;
}
.btn.control.image-button {
  min-height: 46px;
  height: 46px;
  width: 100%;
  background-size: contain;
}

.board-panel {
  border: 0;
  background: transparent;
  padding: 0;
  display: block;
  align-self: start;
}
.board-wrap {
  border: 3px solid var(--line);
  background: var(--panel);
  width: 100%;
  height: auto;
  max-height: none;
}
.board-wrap img {
  display: block;
}

.grid-controls {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}
@media (max-width: 1180px) {
  .left-turn-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .btn.control.image-button {
    min-height: 42px;
    height: 42px;
  }
  .grid-controls {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}


/* V8 money, targeting, and purchase controls */
.money-display {
  min-height: 72px;
  padding: 4px 8px;
  overflow: hidden;
  background: rgba(34,34,34,.75);
  border-color: rgba(34,34,34,.75);
}
.money-display.frozen {
  box-shadow: inset 0 0 0 2px rgba(200,236,255,.35), 0 0 0 2px rgba(255,255,255,.08);
}
.money-glyphs {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: nowrap;
}
.money-glyph {
  height: 58px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.35));
}
.money-glyph.symbol, .money-glyph.comma {
  height: 52px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.deck-plus-button {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255,255,255,.92);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(246,198,74,.96), rgba(189,135,32,.96));
  color: #1d1003;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.deck-plus-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.deck-plus-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.token.selectable-target, .placed-building.selectable-target {
  pointer-events: auto;
  cursor: pointer;
}
.token.selectable-target {
  box-shadow: 0 0 0 4px rgba(246,198,74,.55), 0 2px 8px rgba(0,0,0,.55);
  animation: pulse-target 1s infinite alternate;
}
.placed-building.selectable-target {
  outline: 5px solid rgba(246,198,74,.85) !important;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.14), 0 0 0 6px rgba(246,198,74,.38), 0 5px 10px rgba(0,0,0,.45);
}
.target-help {
  margin-top: 8px;
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.speakeasy-marker {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 18px;
  z-index: 3;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
@keyframes pulse-target {
  from { transform: translate(-50%, -50%) scale(1); }
  to { transform: translate(-50%, -50%) scale(1.08); }
}
.purchase-card-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.purchase-card-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #cbd5da;
  background: #f8fbfc;
}
.purchase-card-option input {
  margin-top: 2px;
}
.purchase-card-option strong {
  display: block;
}
.purchase-card-option span {
  display: block;
  font-size: 12px;
  color: #34444b;
}
.purchase-help {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(246,198,74,.16);
  border-left: 4px solid var(--gold);
}
@media (max-width: 1180px) {
  .money-glyph { height: 48px; }
  .money-glyph.symbol, .money-glyph.comma { height: 42px; }
  .deck-plus-button { width: 30px; height: 30px; font-size: 21px; }
}

/* V10 save/resume, sorting, trade, and card availability polish */
.board-wrap {
  aspect-ratio: 1674 / 941;
}
.active-card-panel {
  align-items: center;
  justify-content: center;
}
.active-character-card {
  border-color: rgba(34,34,34,.75);
}
.active-character-card.wet { border-color: rgba(0, 111, 179, .75); }
.active-character-card.dry { border-color: rgba(182, 0, 0, .75); }
.action-hand-panel header {
  align-items: center;
}
.deck-sort {
  flex: 0 1 275px;
  max-width: 34vw;
  border: 2px solid rgba(255,255,255,.9);
  background: rgba(6,20,27,.78);
  color: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}
.hand-card.unplayable {
  background: rgba(34,34,34,.92);
  border-color: rgba(246,239,228,.30);
  filter: grayscale(.55) brightness(.72);
}
.hand-card.unplayable::after {
  content: "LOCKED";
  position: absolute;
  top: 6px;
  right: -24px;
  transform: rotate(34deg);
  background: rgba(34,34,34,.9);
  color: #f6efe4;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  padding: 3px 24px;
  border: 1px solid rgba(246,239,228,.35);
  z-index: 4;
}
.trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
.trade-column {
  border: 2px solid var(--line);
  background: rgba(247,250,251,.92);
  padding: 10px;
  max-height: 48vh;
  overflow-y: auto;
}
.trade-column h3 { margin: 0 0 8px; font-size: 16px; }
.trade-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid #cbd5da;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
  cursor: pointer;
}
.trade-option strong { display: block; }
.trade-option span { display: block; font-size: 12px; color: #41515a; }
.trade-offer-summary {
  background: rgba(246,198,74,.16);
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  margin-top: 12px;
}
.load-actions .btn[hidden] { display: none !important; }
.money-display.fire {
  box-shadow: inset 0 0 0 2px rgba(255,120,0,.45), 0 0 12px rgba(255,94,0,.28);
}
@media (max-width: 1180px) {
  .deck-sort { flex-basis: 210px; max-width: 42vw; }
  .trade-grid { grid-template-columns: 1fr; }
}
.btn.disabled-action {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}


/* V10.2 mobile responsive patch
   The previous tablet breakpoint still forced a fixed left rail plus board column,
   which made phones render a squeezed desktop layout. This breakpoint changes the
   game shell to a single-column mobile flow and keeps board/token controls usable. */
.token {
  width: clamp(20px, 2.1vw, 30px);
  height: clamp(20px, 2.1vw, 30px);
  font-size: clamp(10px, 1.15vw, 14px);
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 900px) {
  html, body {
    min-width: 0;
    overflow-x: hidden;
    background-attachment: scroll;
  }

  .load-card {
    width: calc(100vw - 20px);
    margin: 10px auto;
    padding: 14px;
    border-width: 2px;
    box-shadow: 5px 5px 0 rgba(0,0,0,.30);
  }

  .logo-block img {
    width: 100%;
    max-width: 520px;
  }

  .player-setup {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .load-actions {
    justify-content: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }

  .load-actions .btn {
    flex: 1 1 145px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .game-shell.active {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    width: 100%;
    padding: 8px;
    gap: 8px;
    overflow-x: hidden;
  }

  .left-rail,
  .right-area,
  .log-panel {
    width: 100%;
    min-width: 0;
  }

  .left-rail {
    order: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .title-box.logo-box {
    max-height: 78px;
    overflow: hidden;
  }

  .logo-box img {
    max-height: 72px;
    width: min(100%, 620px);
    margin: 0 auto;
  }

  .players-block {
    background: rgba(34,34,34,.75);
    border: 2px solid rgba(34,34,34,.75);
    padding: 6px;
  }

  .small-label {
    margin-left: 0;
    font-size: 10px;
  }

  .player-badges {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
  }

  .player-badge {
    height: 32px;
    font-size: 18px;
    border-width: 2px;
  }

  .player-badge.computer::after {
    display: none;
  }

  .money-display {
    min-height: 60px;
    padding: 4px 6px;
  }

  .money-glyph { height: 46px; }
  .money-glyph.symbol, .money-glyph.comma { height: 42px; }

  .dice-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 6px;
  }

  .dice-face {
    height: 64px;
  }

  .roll-image-button {
    min-height: 64px;
  }

  .left-turn-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px;
  }

  .btn.control.image-button {
    height: 40px;
    min-height: 40px;
  }

  .active-card-panel {
    display: none;
  }

  .left-card-deck {
    flex: none;
    min-height: 0;
    grid-template-rows: auto auto;
  }

  .building-hand-panel,
  .action-hand-panel {
    border-width: 2px;
    padding: 8px;
  }

  .building-hand-panel header,
  .action-hand-panel header {
    align-items: center;
    gap: 6px;
  }

  .building-hand-panel h2,
  .action-hand-panel h2 {
    font-size: 10pt;
  }

  .pill {
    padding: 2px 6px;
    font-size: 11px;
  }

  .deck-plus-button {
    width: 30px;
    height: 30px;
    font-size: 21px;
  }

  .building-strip {
    height: 116px;
    min-height: 116px;
    padding-top: 8px;
  }

  .building-strip .hand-card {
    flex-basis: 72px;
    height: 104px;
  }

  .right-area {
    order: 2;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .board-panel {
    width: 100%;
    overflow: visible;
  }

  .board-wrap {
    width: 100%;
    max-width: 100%;
    border-width: 2px;
    background: rgba(34,34,34,.75);
    touch-action: manipulation;
  }

  .board-wrap img {
    width: 100%;
    height: auto;
    aspect-ratio: 1674 / 941;
    object-fit: fill;
  }

  .token {
    width: 22px;
    height: 22px;
    font-size: 11px;
    border-width: 2px;
  }

  .placed-building {
    border-width: 1px;
    border-radius: 4px;
  }

  .placed-building.wet,
  .placed-building.dry {
    outline-width: 3px;
  }

  .speakeasy-marker,
  .fire-marker {
    font-size: 15px;
  }

  .full-action-deck {
    flex: none;
  }

  .deck-sort {
    flex: 1 1 120px;
    max-width: none;
    min-width: 118px;
    padding: 5px 6px;
    font-size: 11px;
  }

  .action-strip {
    height: 142px;
    min-height: 142px;
    padding-top: 8px;
  }

  .action-strip .hand-card {
    flex-basis: 88px;
    height: 128px;
  }

  .card-preview {
    display: none !important;
  }

  .log-panel {
    order: 3;
    display: flex;
    max-height: 190px;
    min-height: 150px;
    border-width: 2px;
  }

  .rules-btn {
    margin: 8px;
    min-height: 38px;
    padding: 8px 10px;
  }

  .log-title {
    padding: 7px 9px;
  }

  #game-log {
    font-size: 11px;
    padding: 8px;
  }

  .modal {
    padding: 8px;
    place-items: end center;
  }

  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 90svh;
    border-width: 2px;
    padding: 16px;
    box-shadow: 0 -4px 18px rgba(0,0,0,.35);
    border-radius: 14px 14px 0 0;
  }

  .modal-actions {
    gap: 8px;
  }

  .modal-actions .btn {
    flex: 1 1 140px;
    padding: 10px 12px;
  }

  .grid-controls {
    grid-template-columns: 1fr;
  }

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

@media (orientation: landscape) and (max-height: 520px) and (max-width: 960px) {
  .game-shell.active {
    padding: 6px;
    gap: 6px;
  }

  .title-box.logo-box,
  .active-card-panel {
    display: none;
  }

  .left-rail {
    grid-template-columns: 1.2fr .9fr 1fr;
    align-items: start;
  }

  .players-block,
  .money-display,
  .dice-row,
  .left-turn-buttons,
  .left-card-deck {
    min-width: 0;
  }

  .left-card-deck {
    grid-column: 1 / -1;
  }

  .right-area {
    gap: 6px;
  }

  .log-panel {
    display: none;
  }
}

/* V10.3 usability, presentation and UI polish */
.objective-panel {
  border: 2px solid rgba(246,198,74,.72);
  background: rgba(34,34,34,.78);
  color: #f6efe4;
  padding: 9px 10px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.objective-kicker {
  color: var(--gold);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
#objective-text {
  font-size: 12px;
  line-height: 1.35;
}
#objective-text strong { color: #fff; }

.log-entry {
  display: grid;
  grid-template-columns: 23px 1fr;
  gap: 5px;
  align-items: start;
  animation: log-pop .18s ease-out both;
}
.log-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(6,20,27,.08);
  font-size: 14px;
}
.turn-history {
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  border-bottom: 2px solid rgba(6,20,27,.18);
  max-height: 170px;
  overflow-y: auto;
  background: rgba(255,255,255,.70);
}
.history-chip {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  line-height: 1.2;
  color: #10232c;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(6,20,27,.15);
  border-radius: 8px;
  padding: 5px 6px;
}
.history-chip span { font-size: 15px; }
.history-chip b {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-empty {
  font-size: 11px;
  color: #50626a;
  font-style: italic;
}
.secondary-log-title { border-top: 0; }

.placed-building.has-image.wet::after,
.placed-building.has-image.dry::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .22;
}
.placed-building.has-image.wet::after { background: rgba(0,111,179,.9); }
.placed-building.has-image.dry::after { background: rgba(182,0,0,.9); }
.owner-marker {
  position: absolute;
  z-index: 5;
  right: 2px;
  bottom: 2px;
  min-width: 22px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.85);
  box-shadow: 0 2px 4px rgba(0,0,0,.45);
}
.owner-marker.wet { background: var(--wet); }
.owner-marker.dry { background: var(--dry); }
.placed-building.recent {
  animation: building-claim-pulse 1.1s ease-out both;
}
.fire-marker,
.speakeasy-marker { animation: marker-pop .22s ease-out both; }

.hand-card {
  animation: card-deal .16s ease-out both;
}
.hand-card .card-info-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 6;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(6,20,27,.78);
  color: #fff;
  border: 1px solid rgba(255,255,255,.75);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}
.hand-card .card-info-dot:hover { background: rgba(246,198,74,.95); color: #1d1003; }
.tier-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  z-index: 5;
  max-width: calc(100% - 28px);
  padding: 2px 4px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.65);
  color: #fff;
  background: rgba(6,20,27,.70);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hand-card.tier-uncommon { box-shadow: 0 3px 5px rgba(0,0,0,.28), inset 0 0 0 2px rgba(246,198,74,.55); }
.hand-card.tier-rare { box-shadow: 0 3px 5px rgba(0,0,0,.28), 0 0 0 2px rgba(246,198,74,.45), 0 0 12px rgba(246,198,74,.32); }
.hand-card.unplayable .tier-badge,
.hand-card.unplayable .card-info-dot { opacity: .72; }

.dice-face.rolled img { animation: dice-kick .28s ease-out both; }
.money-display.money-changed { animation: money-flash .48s ease-out both; }
.highlight {
  animation: legal-move-pulse .9s infinite alternate;
}
.inspect-hint,
.rules-no-match {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--gold);
  background: rgba(246,198,74,.16);
  font-weight: 700;
}
.rules-assistant { display: grid; gap: 10px; }
.rules-search-label { display: grid; gap: 6px; font-weight: 900; }
#rules-search {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  background: #fff;
}
.rule-filtered-out { display: none !important; }

@keyframes log-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes card-deal {
  from { opacity: .65; transform: translateY(5px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dice-kick {
  0% { transform: rotate(-7deg) scale(.92); }
  70% { transform: rotate(3deg) scale(1.06); }
  100% { transform: rotate(0) scale(1); }
}
@keyframes money-flash {
  0% { filter: brightness(1.28); transform: scale(1.015); }
  100% { filter: brightness(1); transform: scale(1); }
}
@keyframes building-claim-pulse {
  0% { transform: scale(.97); filter: brightness(1.18); }
  55% { transform: scale(1.04); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}
@keyframes marker-pop {
  from { opacity: 0; transform: scale(.65); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes legal-move-pulse {
  from { box-shadow: 0 0 0 0 rgba(246,198,74,.28); }
  to { box-shadow: 0 0 0 4px rgba(246,198,74,.16); }
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 900px) {
  .right-area { order: 1; }
  .left-rail { order: 2; }
  .log-panel { order: 3; }
  .objective-panel {
    padding: 8px;
  }
  #objective-text { font-size: 11px; }
  .turn-history {
    max-height: 88px;
    grid-template-columns: 1fr;
  }
  .history-chip { font-size: 10px; }
  .tier-badge { display: none; }
  .hand-card .card-info-dot {
    width: 19px;
    height: 19px;
    font-size: 12px;
  }
  .owner-marker {
    width: 18px;
    height: 17px;
    min-width: 18px;
    font-size: 8px;
    border-width: 1px;
  }
}

/* V11 interaction and ownership polish */
.player-badge.wet,
.player-badge.dry,
.token.wet,
.token.dry {
  background: var(--owner-colour, var(--wet));
}
.player-badge.dry,
.token.dry { background: var(--owner-colour, var(--dry)); }
.player-badge.active-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246,198,74,.55), 0 0 12px var(--owner-colour, rgba(246,198,74,.55)); }
.token { box-shadow: 0 2px 6px rgba(0,0,0,.55), 0 0 0 3px color-mix(in srgb, var(--owner-colour, #fff) 50%, transparent); }
.placed-building.wet,
.placed-building.dry {
  outline-color: color-mix(in srgb, var(--owner-colour, #fff) 82%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--owner-colour, #fff) 34%, transparent), 0 5px 10px rgba(0,0,0,.45);
}
.placed-building.has-image.wet::after,
.placed-building.has-image.dry::after {
  background: var(--owner-colour, rgba(0,111,179,.9));
  opacity: .26;
}
.owner-marker {
  background: color-mix(in srgb, var(--owner-colour, #111) 72%, rgba(0,0,0,.72));
  border-left-color: var(--owner-colour, var(--gold));
}
.fire-chief-token {
  background: linear-gradient(135deg, #ff8c22, #b20d00) !important;
  border-color: #fff3c4;
  color: #fff;
  font-size: clamp(8px, .9vw, 12px);
  box-shadow: 0 0 0 3px rgba(255,116,0,.45), 0 0 18px rgba(255,70,0,.65);
  z-index: 34;
}
.money-display { cursor: pointer; background: rgba(34,34,34,.75); border-color: rgba(34,34,34,.75); }
.money-display:hover { box-shadow: inset 0 0 0 2px rgba(246,198,74,.32), 0 0 10px rgba(246,198,74,.20); }
.balance-sheet td:nth-child(2) { white-space: nowrap; }
.active-character-card { border-color: rgba(34,34,34,.75); }
.active-character-card.wet { border-color: rgba(0, 111, 179, .75); }
.active-character-card.dry { border-color: rgba(182, 0, 0, .75); }
.active-card-panel { align-items: center; }
.left-turn-buttons {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.left-turn-buttons .btn.control.image-button {
  flex: 0 0 40%;
  min-height: 64px;
  height: 64px;
}
.settings-top-button {
  width: calc(100% - 20px);
  min-height: 52px;
  height: 52px;
  margin: 10px 10px 4px;
  background-size: contain;
}
.game-rules-image-button {
  width: calc(100% - 20px);
  min-height: 52px;
  height: 52px;
  margin: 4px 10px 10px;
  background-image: url('../assets/ui/Button_Game_Rules.png');
  background-size: contain;
}
.game-rules-image-button:hover,
.game-rules-image-button:active {
  background-image: url('../assets/ui/Button_Game_Rules_Hover.png');
}
.log-title.game-log-title {
  padding: 5px 10px;
  background: rgba(34,34,34,.88);
  display: grid;
  place-items: center;
}
.log-title.game-log-title img {
  width: 100%;
  max-height: 54px;
  object-fit: contain;
  display: block;
}
.right-area {
  grid-template-rows: minmax(360px, auto) 215px;
  gap: 6px;
  align-content: start;
}
.board-panel { margin-bottom: 0 !important; }
.action-hand-panel.full-action-deck { margin-top: 0 !important; }
#turn-history, .turn-history, .secondary-log-title { display: none !important; }
.modal-actions .btn { min-width: 120px; }

@supports not (color: color-mix(in srgb, white, black)) {
  .placed-building.wet, .placed-building.dry { outline-color: var(--owner-colour, #fff); box-shadow: 0 5px 10px rgba(0,0,0,.45); }
  .token { box-shadow: 0 2px 6px rgba(0,0,0,.55); }
  .owner-marker { background: rgba(6,20,27,.84); }
}

@media (max-width: 760px), (pointer: coarse) and (max-width: 900px) {
  .left-turn-buttons { display: flex !important; gap: 8px; }
  .left-turn-buttons .btn.control.image-button { flex: 0 0 calc(50% - 4px); min-height: 48px; height: 48px; }
  .settings-top-button, .game-rules-image-button { min-height: 42px; height: 42px; }
  .log-title.game-log-title img { max-height: 42px; }
  .right-area { gap: 4px; }
}
