:root {
  --ink: #17211d;
  --muted: #6d7872;
  --paper: #f7f3e8;
  --board: #d7e6d5;
  --green: #173f32;
  --green-2: #235a47;
  --red: #cf3f37;
  --gold: #d5a532;
  --line: rgba(23, 33, 29, .18);
  --shadow: 0 18px 50px rgba(18, 30, 25, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #ebe7db; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(255,255,255,.9), transparent 28%),
    linear-gradient(135deg, #ece8dc 0%, #ddd9cc 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 28px);
  display: grid;
  grid-template-columns: minmax(650px, 1fr) minmax(300px, 380px);
  gap: clamp(14px, 2vw, 28px);
  align-items: start;
}

.game-wrap { min-width: 0; display: grid; place-items: center; }
.board {
  position: relative;
  container-type: inline-size;
  width: min(100%, calc(100vh - 56px));
  aspect-ratio: 1027 / 1026;
  display: grid;
  grid-template-columns: 1.58fr repeat(9, 1fr) 1.58fr;
  grid-template-rows: 1.58fr repeat(9, 1fr) 1.58fr;
  /* Совмещаем интерактивные клетки с полем внутри деревянной рамки. */
  padding: 0;
  background: var(--board);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--board) url("assets/monopoly-board-reference-ru.png") center / 100% 100% no-repeat;
  transform: none;
}

.board-center {
  position: relative;
  z-index: 1;
  grid-column: 2 / 11;
  grid-row: 2 / 11;
  display: block;
  padding: 0;
  background: transparent;
  text-align: center;
}
.classic-pieces {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1px, .35cqw, 4px);
  width: max-content;
  max-width: 92%;
  padding: 4px 6px;
  background: rgba(247,243,232,.68);
  border-radius: 8px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.classic-piece {
  position: relative;
  z-index: 1;
  width: clamp(24px, 4.8cqw, 48px);
  height: clamp(24px, 4.8cqw, 48px);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}
.classic-piece img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.classic-piece:hover { transform: translateY(-2px); }
.classic-piece.dragging { z-index: 30; cursor: grabbing; transform: scale(1.14); box-shadow: 0 8px 14px rgba(0,0,0,.35); }
.brand-mark, .modal-brand {
  width: clamp(42px, 5vw, 72px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink);
  font: 900 clamp(22px, 3vw, 40px)/1 Georgia, serif;
  transform: rotate(-3deg);
}
.eyebrow { margin: 12px 0 4px; color: var(--green-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.board-center h1 { margin: 0; font: 900 clamp(34px, 7vw, 92px)/.95 Georgia, serif; letter-spacing: -.06em; text-transform: uppercase; }
.tagline { margin: 10px 0 18px; color: var(--muted); font-size: clamp(11px, 1.2vw, 15px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dice-row { display: flex; gap: 10px; margin-bottom: 14px; }
.die {
  width: clamp(38px, 5vw, 58px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background-color: transparent;
  background-image: url("assets/dice-by-n4.png");
  background-repeat: no-repeat;
  background-size: 600% 100%;
  border: 0;
  border-radius: 9px;
  box-shadow: 2px 4px 7px rgba(23,33,29,.3);
}
.die[data-value="1"] { background-position: 0% 0; }
.die[data-value="2"] { background-position: 20% 0; }
.die[data-value="3"] { background-position: 40% 0; }
.die[data-value="4"] { background-position: 60% 0; }
.die[data-value="5"] { background-position: 80% 0; }
.die[data-value="6"] { background-position: 100% 0; }
.die.rolling { animation: tumble .18s linear infinite alternate; }
@keyframes tumble { to { transform: translateY(-4px) rotate(5deg); } }
.turn-hint { min-height: 1.4em; margin: 9px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; }

.space {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 3px;
  z-index: 2;
  background: transparent;
  border: 0;
  overflow: hidden;
  text-align: center;
}
.space.active-space { z-index: 2; }
.space > .space-name,
.space > .space-price,
.space > .space-icon,
.space > .color-bar { visibility: hidden; }
.space-name { margin: auto; font-size: clamp(5.5px, .62vw, 9px); font-weight: 800; line-height: 1.08; text-transform: uppercase; overflow-wrap: anywhere; }
.space-price { font-size: clamp(5px, .55vw, 8px); font-weight: 700; }
.color-bar { width: calc(100% + 6px); height: 25%; min-height: 9px; margin: -4px -3px 2px; border-bottom: 1px solid var(--ink); }
.space-icon { margin: auto; font-size: clamp(12px, 1.5vw, 24px); line-height: 1; }
.corner { justify-content: center; padding: 5px; }
.corner .space-name { margin: 4px 0; font-size: clamp(6px, .72vw, 10px); }
.corner .space-icon { margin: 0; font-size: clamp(18px, 2.3vw, 34px); }
.owner-dot {
  position: absolute;
  z-index: 10;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex: 0 0 16px;
  border: 0;
  box-sizing: border-box;
  border-radius: 0;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.65));
  pointer-events: none;
}
/* Один и тот же верхний левый угол относительно направления надписи клетки. */
.side-bottom .owner-dot { top: 2px; left: 2px; right: auto; bottom: auto; transform: none; }
.side-left .owner-dot { top: 2px; right: 2px; left: auto; bottom: auto; transform: rotate(90deg); }
.side-top .owner-dot { right: 2px; bottom: 2px; top: auto; left: auto; transform: rotate(180deg); }
.side-right .owner-dot { bottom: 2px; left: 2px; top: auto; right: auto; transform: rotate(270deg); }
.buildings {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1px, .25cqw, 3px);
  pointer-events: none;
}
/* Цветная полоса обращена к центру поля, поэтому её сторона зависит от края доски. */
.side-bottom .buildings { --building-rotation: 0deg; top: 0; left: 4%; right: 4%; height: 25%; }
.side-left .buildings { --building-rotation: 90deg; top: 4%; right: 0; bottom: 4%; width: 25%; flex-direction: column; }
.side-top .buildings { --building-rotation: 180deg; right: 4%; bottom: 0; left: 4%; height: 25%; }
.side-right .buildings { --building-rotation: 270deg; top: 4%; bottom: 4%; left: 0; width: 25%; flex-direction: column; }
.house {
  width: clamp(8px, 1.55cqw, 16px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  background: url("assets/house-monopoly.png") center / contain no-repeat;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.45));
  transform: rotate(var(--building-rotation, 0deg));
}
.hotel {
  width: clamp(16px, 2.6cqw, 28px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  background: url("assets/hotel-monopoly.png") center / contain no-repeat;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.45));
  transform: rotate(var(--building-rotation, 0deg));
}
.mortgaged::after {
  content: "";
  position: absolute;
  z-index: 7;
  width: clamp(18px, 2.35cqw, 28px);
  aspect-ratio: 100 / 124;
  background: url("assets/mortgage-lock-2d.svg") center / contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.42));
  pointer-events: none;
}
.side-bottom.mortgaged::after { left: 50%; top: 62%; transform: translate(-50%, -50%); }
.side-left.mortgaged::after { left: 38%; top: 50%; transform: translate(-50%, -50%) rotate(90deg); }
.side-top.mortgaged::after { left: 50%; top: 38%; transform: translate(-50%, -50%) rotate(180deg); }
.side-right.mortgaged::after { left: 62%; top: 50%; transform: translate(-50%, -50%) rotate(270deg); }
.tokens { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
.token { position: absolute; width: var(--game-token-size, clamp(28px, 4.5cqw, 50px)); height: var(--game-token-size, clamp(28px, 4.5cqw, 50px)); border: 0; border-radius: 0; box-shadow: none; object-fit: contain; translate: -50% -50%; rotate: var(--token-rotation, 0deg); transition: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.42)); pointer-events: auto; user-select: none; -webkit-user-drag: none; touch-action: none; }
.token.remote-token { z-index: 1; pointer-events: none; transition: left .1s linear, top .1s linear, rotate .12s ease-out; }
.token.draggable-token { z-index: 2; cursor: grab; }
.token.dragging { z-index: 20; cursor: grabbing; transition: none; filter: drop-shadow(0 5px 4px rgba(0,0,0,.5)); }
.token.street-dragging { animation: none !important; transition: none !important; }
.token.moving { animation: token-step .24s ease-out; }
@keyframes token-step {
  0% { transform: translateY(-8px) scale(.78); }
  65% { transform: translateY(2px) scale(1.12); }
  100% { transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .token.moving { animation: none; }
}
.space[data-index="10"] > .tokens { inset: 0; }
.space[data-index="10"] > .tokens .token { width: var(--jail-token-size, clamp(22px, 3.6cqw, 38px)); height: var(--jail-token-size, clamp(22px, 3.6cqw, 38px)); }
.jail-tokens { position: absolute; inset: 5% 5% 38% 38%; z-index: 9; pointer-events: none; }

.sidebar {
  height: calc(100vh - clamp(24px, 4vw, 56px));
  min-height: 620px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px; }
.sidebar-head .eyebrow { margin-top: 0; }
.sidebar h2 { margin: 0; font: 800 28px/1.1 Georgia, serif; }
.icon-btn { width: 42px; height: 42px; color: var(--green); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 22px; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.5); transform: rotate(-20deg); }
.players-panel { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.turn-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 14px; padding: 13px 14px; background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 15px; }
.turn-card .eyebrow { margin: 0 0 3px; }
.turn-card .turn-hint { margin: 0; min-height: 0; color: var(--ink); font-size: 12px; }
.turn-card .dice-row { grid-column: 2; grid-row: 1 / 3; margin: 0; }
.turn-card .die { width: 42px; }
.turn-card .primary-btn { grid-column: 1; }
.player-card { position: relative; padding: 11px 12px; background: rgba(255,255,255,.58); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.player-card.current { background: #fffdf7; border-color: var(--green); box-shadow: 0 5px 15px rgba(23,63,50,.1); }
.player-card.auction-turn { background: #fff4cf; border-color: var(--gold); box-shadow: 0 0 0 2px rgba(213,165,50,.2), 0 5px 15px rgba(23,63,50,.1); }
.player-card.bankrupt { opacity: .42; filter: grayscale(1); }
.player-top { display: flex; align-items: center; gap: 7px; }
.player-token { width: 13px; aspect-ratio: 1; border: 1px solid var(--ink); border-radius: 50%; }
.player-piece { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.player-name { min-width: 0; font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-money { margin-top: 5px; font: 800 17px/1 Georgia, serif; }
.player-assets { margin-top: 4px; color: var(--muted); font-size: 9px; font-weight: 650; }

.action-card, .log-card, .chat-card { background: rgba(255,255,255,.62); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 8px 24px rgba(32,40,36,.05); }
.action-card { padding: 14px; }
.property-info { min-height: 82px; }
.property-info.empty, .property-info:has(.empty-icon) { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.empty-icon { font-size: 30px; }
.property-head { display: flex; gap: 10px; align-items: flex-start; }
.property-swatch { width: 12px; height: 42px; flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 3px; }
.property-info h3 { margin: 0 0 3px; font: 800 17px/1.1 Georgia, serif; }
.property-meta { color: var(--muted); font-size: 10px; font-weight: 650; }
.rent-row { display: flex; justify-content: space-between; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 11px; }
.development-row { display: flex; justify-content: space-between; margin-top: 7px; color: var(--muted); font-size: 10px; }
.auction-status { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin-top: 10px; padding: 9px 10px; color: var(--ink); background: #f4dfad; border: 1px solid rgba(23,33,29,.28); border-radius: 8px; font-size: 10px; text-align: left; }
.auction-status > b { grid-row: 1 / 3; align-self: center; color: var(--red); font: 850 13px/1 Georgia, serif; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 11px; }
.actions:empty { margin: 0; }
.primary-btn, .secondary-btn, .danger-btn {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .03em;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.primary-btn { color: #fff; background: var(--green); box-shadow: 3px 3px 0 var(--ink); }
.secondary-btn { color: var(--ink); background: #fffdf7; }
.street-color-btn { background: var(--street-color); box-shadow: 2px 2px 0 var(--ink); }
.danger-btn { color: #fff; background: var(--red); }
.primary-btn:hover:not(:disabled), .secondary-btn:hover:not(:disabled), .danger-btn:hover:not(:disabled) { transform: translateY(-2px); }
button:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.wide { width: 100%; }

.log-card { min-height: 110px; flex: 1 1 0; display: flex; flex-direction: column; padding: 13px 14px; overflow: hidden; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-title h3 { margin: 0; font: 800 15px/1 Georgia, serif; }
.live-dot { width: 7px; height: 7px; background: #55a568; border-radius: 50%; box-shadow: 0 0 0 3px rgba(85,165,104,.15); }
.game-log { overflow-y: auto; scrollbar-width: thin; }
.log-item { display: grid; grid-template-columns: 7px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid rgba(23,33,29,.08); color: #4e5953; font-size: 10.5px; line-height: 1.35; }
.log-item:first-child { border-top: 0; }
.log-mark { width: 6px; height: 6px; margin-top: 4px; background: var(--log-color, var(--green)); border-radius: 50%; }
.chat-card { min-height: 170px; flex: 1.15 1 0; display: flex; flex-direction: column; padding: 13px 14px; overflow: hidden; }
.chat-card[hidden] { display: none; }
.chat-card .section-title { margin-bottom: 6px; }
.chat-status { color: #3a7a4b; font-size: 9px; font-weight: 800; }
.chat-status.error { color: var(--red); }
.chat-messages { flex: 1; min-height: 70px; padding: 2px 3px 6px; overflow-y: auto; scrollbar-width: thin; }
.chat-empty { margin: 16px 0; color: var(--muted); font-size: 10px; text-align: center; }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; margin: 7px 0; }
.chat-message.mine { align-items: flex-end; }
.chat-meta { display: flex; gap: 5px; margin: 0 4px 3px; color: var(--muted); font-size: 8px; }
.chat-name { max-width: 130px; font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bubble { max-width: 88%; padding: 6px 8px; color: var(--ink); background: #fffdf7; border: 1px solid rgba(23,33,29,.13); border-radius: 3px 9px 9px; font-size: 10.5px; line-height: 1.35; overflow-wrap: anywhere; }
.chat-message.mine .chat-bubble { color: #fff; background: var(--green); border-color: var(--green); border-radius: 9px 3px 9px 9px; }
.chat-form { display: grid; grid-template-columns: 1fr 34px; gap: 6px; margin-top: 4px; }
.chat-form input { min-width: 0; height: 34px; padding: 7px 9px; color: var(--ink); background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; outline: none; font: inherit; font-size: 10px; }
.chat-form input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(23,63,50,.1); }
.chat-form button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; color: #fff; background: var(--green); border: 1px solid var(--ink); border-radius: 8px; font-size: 15px; cursor: pointer; }
.chat-form button:disabled, .chat-form input:disabled { opacity: .5; cursor: not-allowed; }
.source-note { align-self: center; color: var(--muted); font-size: 9px; text-decoration: none; }
.source-note:hover { color: var(--green); text-decoration: underline; }

.modal { width: min(92vw, 430px); max-height: 92vh; padding: 30px; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 18px; box-shadow: 10px 12px 0 rgba(23,33,29,.3); overflow-y: auto; text-align: center; }
.modal::backdrop { background: rgba(14,27,22,.72); backdrop-filter: blur(5px); }
.modal-brand { width: 48px; margin: 0 auto 14px; }
.modal h2 { margin: 4px 0 8px; font: 850 32px/1 Georgia, serif; }
.modal-copy { margin: 0 auto 20px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.field-label { display: block; margin: 15px 0 7px; text-align: left; font-size: 11px; font-weight: 800; }
.network-room-setup { margin: 15px 0 4px; }
.room-mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.room-mode-picker button {
  min-height: 38px;
  padding: 8px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.room-mode-picker button.selected { color: #fff; background: var(--green); border-color: var(--green); }
.room-fields { padding: 2px 0; }
.setup-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fffdf7;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font: inherit;
  box-sizing: border-box;
}
.setup-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,63,50,.1); }
.setup-input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(207,63,55,.12); }
.room-name-meta { display: flex; justify-content: space-between; gap: 10px; min-height: 16px; margin-top: 4px; font-size: 10px; text-align: left; }
.field-error { color: var(--red); font-weight: 800; }
.field-counter { margin-left: auto; color: var(--muted); white-space: nowrap; }
.password-choice { display: flex; align-items: center; gap: 8px; margin: 11px 0 2px; font-size: 11px; font-weight: 800; cursor: pointer; }
.password-choice input { width: 16px; height: 16px; accent-color: var(--green); }
.room-list-head { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.room-refresh-btn { padding: 5px 8px; color: var(--green); background: transparent; border: 0; font-size: 10px; font-weight: 850; cursor: pointer; }
.room-list-status { min-height: 1.3em; margin: 7px 0 0; color: var(--muted); font-size: 10px; text-align: left; }
.room-select-control { position: relative; }
.room-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.room-select-button[aria-expanded="true"] {
  border-color: var(--green);
  border-radius: 8px 8px 0 0;
  box-shadow: 0 0 0 3px rgba(23,63,50,.1);
}
.room-select-button:disabled { color: var(--muted); background: #f2efe6; }
.room-select-arrow {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s;
}
.room-select-button[aria-expanded="true"] .room-select-arrow { transform: translateY(2px) rotate(225deg); }
.room-options {
  position: absolute;
  z-index: 30;
  top: calc(100% - 1px);
  right: 0;
  left: 0;
  padding: 4px;
  background: #fffdf7;
  border: 1px solid var(--green);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 14px rgba(23,33,29,.16), 0 0 0 3px rgba(23,63,50,.1);
}
.room-option {
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.room-option:hover, .room-option.selected { color: var(--green); background: #e2eee5; }
.count-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.count-picker button { padding: 9px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 8px; font-weight: 800; cursor: pointer; }
.count-picker button.selected { color: #fff; background: var(--green); border-color: var(--green); }
.name-fields { display: grid; gap: 7px; margin: 14px 0 18px; }
.piece-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 7px 0 20px; }
.piece-choice { position: relative; aspect-ratio: 1; padding: 4px; background: #fffdf7; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.piece-choice img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.piece-choice.selected { border: 2px solid var(--green); background: #e2eee5; box-shadow: 0 0 0 2px rgba(23,63,50,.15); }
.piece-choice:disabled { opacity: .25; filter: grayscale(1); cursor: not-allowed; }
.name-field { display: flex; align-items: center; gap: 8px; }
.name-color { width: 12px; height: 12px; flex: 0 0 auto; border: 1px solid var(--ink); border-radius: 50%; }
.name-field input { width: 100%; padding: 10px 11px; color: var(--ink); background: #fffdf7; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.name-field input::placeholder { color: var(--muted); opacity: .72; }
.name-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,63,50,.1); }
.card-modal { width: min(90vw, 360px); }
.chance-card { margin: -12px -12px 22px; padding: 26px 20px; border: 2px solid var(--ink); border-radius: 12px; }
.chance-card.community { background: #dbe9ef; }
.chance-card.chance { background: #f4dfad; }
.card-symbol { font-size: 46px; }
.chance-card h2 { font-size: 25px; }
.chance-card p { margin-bottom: 0; font-size: 13px; line-height: 1.5; }

.property-card-modal {
  width: min(92vw, 410px);
  max-height: 94vh;
  padding: 34px 22px 18px;
  overflow-y: auto;
  color: #111;
  background: #e8e4d7;
  border: 2px solid #111;
  border-radius: 12px;
  box-shadow: 9px 11px 0 rgba(18, 25, 21, .35);
}
.property-card-modal::backdrop { background: rgba(10, 19, 16, .76); backdrop-filter: blur(4px); }
.property-card-close {
  position: absolute;
  top: 7px;
  right: 9px;
  z-index: 2;
  width: 28px;
  height: 28px;
  padding: 0;
  color: #111;
  background: #fff;
  border: 1.5px solid #111;
  border-radius: 50%;
  font: 800 20px/24px Arial, sans-serif;
  cursor: pointer;
}
.deed-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #f7f4df;
  border: 3px double #111;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
  font-family: Arial, Helvetica, sans-serif;
}
.deed-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("assets/property-card-internet-reference.jpg") center / cover no-repeat;
  opacity: .025;
  filter: grayscale(1);
}
.deed-title-block {
  margin: 7px;
  padding: 12px 9px 13px;
  color: var(--deed-ink, #050505);
  background: var(--deed-color);
  border: 2px solid #111;
  text-align: center;
}
.deed-title-block::before {
  content: "";
  display: block;
  height: 5px;
  margin: -6px 14% 8px;
  background: rgba(255, 255, 255, .35);
  border-radius: 8px;
}
.deed-kicker { margin-bottom: 6px; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.deed-title-block h2 {
  margin: 0;
  font: 900 clamp(20px, 5vw, 28px)/1.05 Arial, Helvetica, sans-serif;
  text-transform: uppercase;
}
.deed-body { padding: 6px 20px 16px; }
.deed-rent-main,
.deed-rent-row,
.deed-mortgage {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.deed-rent-main { margin: 2px 0 7px; font-size: 14px; font-weight: 400; text-transform: uppercase; }
.deed-rent-row { padding: 3px 0; border-bottom: 1px dotted rgba(0, 0, 0, .35); font-size: 12px; }
.deed-rent-row b,
.deed-rent-main b,
.deed-mortgage b { white-space: nowrap; }
.deed-rent-row b,
.deed-rent-main b,
.deed-hotel-rent,
.deed-hotel-rent b,
.deed-utility-copy b { font-weight: 400; }
.deed-current-rent,
.deed-current-rent b { font-weight: 900; }
.deed-building-price {
  margin: 11px 0 10px;
  font-size: 10.5px;
  line-height: 1.45;
  text-align: center;
}
.deed-utility-copy { margin: 8px 0; font-size: 12px; line-height: 1.45; text-align: center; }
.deed-mortgage { padding: 9px 0; border-top: 2px solid #111; border-bottom: 1px solid #111; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.deed-status {
  margin: 12px 0 8px;
  padding: 8px;
  color: #fff;
  background: #164a3a;
  border: 1.5px solid #111;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .035em;
  text-align: center;
  text-transform: uppercase;
}
.deed-status.is-mortgaged { color: #111; background: #df4a41; }
.deed-rules { margin: 0; font-size: 8.5px; line-height: 1.35; text-align: center; }
.trophy { color: var(--gold); font-size: 65px; text-shadow: 2px 3px 0 var(--ink); }
.money-players { display: grid; gap: 9px; margin: 18px 0; }
.money-player-row { padding: 10px; background: #fffdf7; border: 1px solid var(--line); border-radius: 10px; text-align: left; }
.money-player-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 800; }
.money-player-head img { width: 28px; height: 28px; object-fit: contain; }
.money-player-balance { margin-left: auto; font: 800 14px/1 Georgia, serif; }
.money-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.money-buttons button { min-height: 32px; padding: 6px; color: #fff; background: var(--green); border: 1px solid var(--ink); border-radius: 7px; font-size: 11px; font-weight: 850; cursor: pointer; }
.money-buttons button[data-amount^="-"] { background: var(--red); }
.pause-symbol { width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center; color: #fff; background: var(--green); border: 2px solid var(--ink); border-radius: 50%; font-size: 24px; font-weight: 900; }
.pause-actions { display: grid; gap: 9px; margin-top: 22px; }
.pause-settings { margin-top: 12px; padding: 12px; background: #fffdf7; border: 1px solid var(--line); border-radius: 10px; }
.token-size-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pause-setting-title { font-size: 11px; font-weight: 850; text-align: left; }
.token-size-heading output { color: var(--green); font-size: 10px; font-weight: 850; }
.token-size-slider {
  width: 100%;
  height: 22px;
  margin: 7px 0 2px;
  accent-color: var(--green);
  cursor: pointer;
}
.token-size-labels { display: grid; grid-template-columns: repeat(3, 1fr); color: var(--muted); font-size: 8px; }
.token-size-labels span:first-child { text-align: left; }
.token-size-labels span:nth-child(2) { text-align: center; }
.token-size-labels span:last-child { text-align: right; }
.token-size-preview {
  min-height: 82px;
  margin-top: 9px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #d8e9d7;
  border: 1px solid rgba(23,33,29,.2);
  border-radius: 8px;
}
.token-size-preview img {
  width: var(--game-token-size, 40px);
  height: var(--game-token-size, 40px);
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.42));
  transition: width .05s linear, height .05s linear;
}
.pause-hint { margin: 16px 0 0; color: var(--muted); font-size: 10px; }
.mobile-menu-btn { display: none; position: fixed; right: 12px; bottom: 12px; z-index: 20; width: 44px; height: 44px; color: #fff; background: var(--green); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 3px 10px rgba(0,0,0,.3); font-size: 19px; cursor: pointer; }

@media (min-width: 681px) and (hover: hover) and (pointer: fine) {
  html.manual-street-move .board { outline: 3px dashed #cf3f37; outline-offset: 4px; }
  html.manual-street-move .token.manual-movable-token { pointer-events: auto; cursor: crosshair; }
  html.manual-street-move .space { cursor: crosshair; }
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; }
  .board { width: min(100%, 900px); }
  .sidebar { width: min(100%, 900px); height: auto; min-height: 0; margin: 0 auto; }
  .log-card { max-height: 240px; }
  .chat-card { min-height: 220px; max-height: 300px; }
}
@media (max-width: 680px) {
  #moneyDialog { display: none; }
  .app-shell { padding: 6px; gap: 10px; }
  .board { border-width: 2px; }
  .space { padding: 2px 1px; }
  .color-bar { width: calc(100% + 2px); margin: -2px -1px 1px; }
  .space-name { font-size: clamp(4px, 1.35vw, 7px); }
  .space-price { font-size: clamp(4px, 1.2vw, 6px); }
  .property-card-modal { width: min(94vw, 390px); padding: 32px 14px 14px; }
  .deed-body { padding-right: 14px; padding-left: 14px; }
  .deed-title-block h2 { font-size: 20px; }
  .deed-rent-row { font-size: 11px; }
  .corner .space-name { font-size: clamp(4.5px, 1.45vw, 7px); }
  .space[data-index="10"] > .tokens { inset: 0; }
  .board-center .primary-btn { min-height: 34px; padding: 7px 9px; }
  .board-center h1 { font-size: clamp(25px, 10vw, 64px); }
  .brand-mark { width: 35px; font-size: 20px; box-shadow: 3px 3px 0 var(--ink); }
  .tagline { margin: 5px 0 10px; }
  .turn-hint { max-width: 80%; margin-top: 6px; font-size: 9px; }
  .players-panel { grid-template-columns: 1fr 1fr; }
  .sidebar { padding: 6px; }
  .sidebar-head { display: none; }
  .mobile-menu-btn { display: grid; place-items: center; }
  .token-size-preview { min-height: 52px; }
  .classic-pieces { gap: 2px; padding: 4px 5px; }
  .classic-piece { width: 24px; height: 24px; }
  .token { width: var(--game-token-size, 21px); height: var(--game-token-size, 21px); }
  .space[data-index="10"] > .tokens .token { width: var(--jail-token-size, 18px); height: var(--jail-token-size, 18px); }
  .owner-dot {
    width: 7px;
    height: 7px;
    min-width: 7px;
    min-height: 7px;
    flex-basis: 7px;
  }
  .side-bottom .owner-dot { top: 1px; left: 1px; right: auto; bottom: auto; }
  .side-left .owner-dot { top: 1px; right: 1px; left: auto; bottom: auto; }
  .side-top .owner-dot { right: 1px; bottom: 1px; top: auto; left: auto; }
  .side-right .owner-dot { bottom: 1px; left: 1px; top: auto; right: auto; }
  .mortgaged::after { width: 8px; }
  .side-bottom.mortgaged::after { left: 50%; top: 60%; transform: translate(-50%, -50%); }
  .side-left.mortgaged::after { left: 40%; top: 50%; transform: translate(-50%, -50%) rotate(90deg); }
  .side-top.mortgaged::after { left: 50%; top: 40%; transform: translate(-50%, -50%) rotate(180deg); }
  .side-right.mortgaged::after { left: 60%; top: 50%; transform: translate(-50%, -50%) rotate(270deg); }
  .house { width: 5px; }
  .hotel { width: 9px; }
}
