:root {
  --bg: #edf2ee;
  --bg2: #dfe8e4;
  --panel: #ffffff;
  --panel2: #f5f8f4;
  --line: #c8d5ce;
  --line-strong: #253a30;
  --text: #18251f;
  --muted: #65746c;
  --accent: #f2b84b;
  --accent2: #168f8b;
  --danger: #cf4d45;
  --ok: #178657;
  --board-felt: #2f7358;
  --board-felt-dark: #1e4e3c;
  --tile: #fffdf8;
  --tile-soft: #f2f7f1;
  --shadow: 0 16px 48px rgba(24, 37, 31, .14);
  /* Единая шкала шрифтов (дизайн-система) */
  --fs-1: 11px;   /* подпись/мелкое */
  --fs-2: 13px;   /* основной текст */
  --fs-3: 16px;   /* акцент */
  --fs-4: 20px;   /* заголовок */
  --fs-5: 27px;   /* дисплей */
  --lh-tight: 1.1;
  --lh-base: 1.3;
  font-size: 16px;
}

/* ---------- Final gameplay UX pass ---------- */
.leave-btn {
  align-self: center;
  min-height: 32px;
  border: 1px solid rgba(246, 239, 224, .16);
  border-radius: 7px;
  background: rgba(247, 241, 228, .08);
  color: #fff1d3;
  padding: 6px 10px;
  font: inherit;
  font-size: .7rem;
  font-weight: 900;
  cursor: pointer;
}

.leave-btn[hidden] {
  display: none;
}

.leave-btn:hover {
  background: rgba(247, 241, 228, .14);
}

.game-header .turn-panel {
  padding: 0;
  border-left: 1px solid rgba(246, 239, 224, .13);
}

.game-header .tile-panel {
  height: 100%;
}

.game-header .tile-card {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 10px;
}

.game-header .tile-card-head {
  min-width: 0;
}

.game-header .tile-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .tile-facts {
  grid-column: 1 / -1;
  overflow: hidden;
  max-height: 20px;
}

.tile-face {
  grid-template-rows: minmax(15px, var(--tile-plate-h, 16px)) minmax(19px, auto);
}

.tile-plate {
  min-height: 15px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1px 4px;
}

.tile-name-mini {
  width: 100%;
  min-width: 0;
  color: var(--name-ink, #1e251f);
  font-size: var(--name-font, 7.2px);
  line-height: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile.is-name-hidden .tile-name-mini {
  opacity: 1;
  visibility: visible;
}

.tile-bg-icon,
.tile-side-top .tile-bg-icon,
.tile-side-left .tile-bg-icon,
.tile-side-right .tile-bg-icon {
  left: 50%;
  top: auto;
  right: auto;
  bottom: 2px;
  width: 68%;
  opacity: .22;
  transform: translateX(-50%) rotate(0deg);
}

.tile:hover .tile-bg-icon,
.tile:focus-visible .tile-bg-icon,
.tile.is-peek .tile-bg-icon,
.tile.active-tile .tile-bg-icon {
  opacity: .32;
}

.tile.owned-tile .tile-price-big {
  opacity: .34;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  left: auto;
  right: -2px;
  bottom: -2px;
  justify-content: end;
}

.board-log-toggle {
  top: 14px;
  right: 14px;
  bottom: auto;
}

.board.is-log-open .center-turn,
.board.is-log-open .state-guide,
.board.is-log-open .dice,
.board.is-log-open .actions {
  opacity: 1;
  transform: translateY(-18%);
}

.board-log {
  inset: auto 14px 14px;
  height: min(42%, 250px);
}

.tile-move-from .tile-face {
  animation: moveFromPulse .9s ease-out;
}

.tile-move-to .tile-face {
  animation: moveToPulse 1.05s ease-out;
}

.tile-purchased .tile-face {
  animation: purchasedPress 1.15s cubic-bezier(.2, .8, .2, 1);
}

.tile-built .tile-face {
  animation: builtPulse 1.1s ease-out;
}

.ptoken-pin.is-arriving {
  animation: tokenArrive .72s cubic-bezier(.2, .9, .2, 1);
}

@keyframes moveFromPulse {
  0% { filter: brightness(1.2); box-shadow: inset 0 0 0 2px rgba(255, 211, 134, .9), 0 0 16px rgba(255, 211, 134, .65); }
  100% { filter: brightness(1); }
}

@keyframes moveToPulse {
  0% { transform: translateZ(0) scale(1); }
  35% { transform: translateZ(18px) scale(1.09); box-shadow: inset 0 0 0 2px #58c7ff, 0 0 24px rgba(54, 164, 255, .9); }
  100% { transform: translateZ(0) scale(1); }
}

@keyframes purchasedPress {
  0% { transform: translateY(0) scale(1); box-shadow: inset 0 0 0 2px var(--owner-color, #ffd386), 0 0 28px color-mix(in srgb, var(--owner-color, #ffd386) 72%, transparent); }
  45% { transform: translateY(3px) scale(.985); filter: brightness(.96); }
  78% { transform: translateY(1px) scale(.998); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes builtPulse {
  0% { box-shadow: inset 0 0 0 2px #79c765, 0 0 24px rgba(121, 199, 101, .9); }
  45% { transform: translateZ(14px) scale(1.06); }
  100% { transform: translateZ(0) scale(1); }
}

@keyframes tokenArrive {
  0% { transform: translateY(-18px) scale(.65); opacity: .15; }
  55% { transform: translateY(-4px) scale(1.2); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

@media (min-width: 900px) {
  #screen-game.active {
    height: 100svh;
    overflow: hidden;
  }

  .game-header {
    grid-template-columns: 66px minmax(230px, .54fr) auto minmax(360px, 1fr);
    width: calc(100vw - 44px);
  }

  .game-layout {
    width: calc(100vw - 44px);
    height: calc(100svh - 104px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 34vw);
    align-items: stretch;
    gap: 16px;
  }

  .board-rail {
    height: 100%;
    align-content: start;
  }

  .board {
    width: min(100%, calc(100svh - 104px));
    max-width: none;
    height: auto;
    margin: 0;
  }

  .hud {
    width: auto;
    min-width: 0;
  }

  .players-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .pchip {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: 50px 1fr auto;
  }

  .leave-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: .64rem;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(246, 239, 224, .13);
  }

  .tile-face {
    grid-template-rows: minmax(12px, var(--tile-plate-h, 13px)) minmax(16px, auto);
  }

  .tile-plate {
    min-height: 12px;
    padding: 1px 3px;
  }

  .tile-name-mini {
    font-size: var(--name-font, 5.8px);
  }

  .tile-bg-icon,
  .tile-side-top .tile-bg-icon,
  .tile-side-left .tile-bg-icon,
  .tile-side-right .tile-bg-icon {
    bottom: 1px;
    width: 72%;
    opacity: .24;
    transform: translateX(-50%) rotate(0deg);
  }

  .board.is-log-open .center-turn,
  .board.is-log-open .state-guide,
  .board.is-log-open .dice,
  .board.is-log-open .actions {
    transform: translateY(-22%);
  }

  .board-log {
    inset: auto 10px 10px;
    height: min(42%, 230px);
  }
}

/* ---------- True final pass: header, bottom-left price, smaller tokens, light player chips ---------- */
.game-header {
  align-items: stretch;
  grid-template-columns: 66px minmax(210px, .55fr) auto minmax(0, 1fr) !important;
}

.game-header .game-brand,
.game-header .game-status,
.game-header .leave-btn,
.game-header .turn-panel {
  min-height: 58px;
}

.game-header .leave-btn {
  display: block;
  align-self: stretch;
  min-width: 76px;
  border-width: 0 1px 0 0;
  border-color: rgba(246, 239, 224, .13);
  border-radius: 0;
  background: rgba(255, 255, 255, .06);
  color: #fff2d8;
}

.game-header .game-status {
  border-right: 1px solid rgba(246, 239, 224, .13);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.tile .tile-price-big {
  position: absolute !important;
  left: 3px !important;
  right: auto !important;
  top: auto !important;
  bottom: 3px !important;
  margin: 0 !important;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  top: auto !important;
  left: auto !important;
  right: -6px !important;
  bottom: -6px !important;
  width: 52px !important;
  height: 40px !important;
}

.tile .ptoken-pin,
.tile .tokens.has-many .ptoken-pin,
.board .tile .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin {
  width: 23px !important;
  height: 23px !important;
  font-size: 13px !important;
}

.tile .tokens.has-many .ptoken-pin:nth-child(1),
.board .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(2),
.board .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 12px !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(3),
.board .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 24px !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(4),
.board .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 6px !important; bottom: 14px !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(5),
.board .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 18px !important; bottom: 14px !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(6),
.board .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 30px !important; bottom: 14px !important; }

.pchip {
  border-left-width: 7px !important;
  background: #e4e8e3 !important;
  color: #223229 !important;
}

.pchip.is-turn {
  border-left-width: 9px !important;
  background: #ffffff !important;
  color: #13231b !important;
  box-shadow: 0 0 0 1px rgba(255, 211, 134, .42), 0 10px 22px rgba(0, 0, 0, .14);
}

.pchip .pc-name,
.pchip .pc-cash {
  color: inherit !important;
}

.pchip .pc-place,
.pchip .pc-sub {
  color: rgba(30, 42, 35, .76) !important;
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: 50px minmax(0, 1fr) 62px !important;
  }

  .game-header .game-brand,
  .game-header .game-status,
  .game-header .leave-btn {
    min-height: 40px;
  }

  .game-header .leave-btn {
    min-width: 62px;
    padding: 5px 7px;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  .tile .tile-price-big {
    left: 2px !important;
    bottom: 2px !important;
  }

  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    right: -5px !important;
    bottom: -5px !important;
    width: 48px !important;
    height: 36px !important;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin,
  .board .tile .ptoken-pin,
  .board .tile .tokens.has-many .ptoken-pin {
    width: 21px !important;
    height: 21px !important;
    font-size: 12px !important;
  }

  .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 11px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 22px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 5px !important; bottom: 13px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 16px !important; bottom: 13px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 27px !important; bottom: 13px !important; }

  .pchip {
    border-left-width: 6px !important;
  }

  .pchip.is-turn {
    border-left-width: 8px !important;
  }
}

/* ---------- Softer board tile corners ---------- */
.board .tile {
  border-radius: 6px;
  overflow: hidden;
}

.board .tile-face {
  border-radius: inherit;
}

.board .tile-plate {
  border-radius: 5px 5px 2px 2px;
}

@media (max-width: 639px) {
  .board .tile {
    border-radius: 5px;
  }

  .board .tile-plate {
    border-radius: 4px 4px 2px 2px;
  }
}

/* ---------- Mobile visible-center board controls ---------- */
@media (max-width: 639px) {
  .board-mode-scroll .board-center .center-turn,
  .board-mode-scroll .board-center .state-guide,
  .board-mode-scroll .board-center .dice,
  .board-mode-scroll .board-center .actions {
    transform: translateX(var(--center-ui-shift-x, 0px));
  }

  .board-mode-scroll .board.is-log-open .center-turn,
  .board-mode-scroll .board.is-log-open .state-guide,
  .board-mode-scroll .board.is-log-open .dice,
  .board-mode-scroll .board.is-log-open .actions {
    transform: translate(var(--center-ui-shift-x, 0px), -22%);
  }
}

/* ---------- Final header, price, tokens and player chips pass ---------- */
.game-header {
  align-items: stretch;
  grid-template-columns: 66px minmax(210px, .55fr) auto minmax(0, 1fr) !important;
  gap: 0;
}

.game-header .game-brand,
.game-header .game-status,
.game-header .leave-btn,
.game-header .turn-panel {
  min-height: 58px;
}

.game-header .game-status {
  border-left: 1px solid rgba(246, 239, 224, .13);
  border-right: 1px solid rgba(246, 239, 224, .13);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.game-header .leave-btn {
  align-self: stretch;
  min-width: 76px;
  border-width: 0 1px 0 0;
  border-color: rgba(246, 239, 224, .13);
  border-radius: 0;
  background: rgba(255, 255, 255, .06);
  color: #fff2d8;
}

.game-header .leave-btn:hover {
  background: rgba(255, 255, 255, .11);
}

.tile .tile-price-big {
  position: absolute !important;
  left: 3px !important;
  right: auto !important;
  top: auto !important;
  bottom: 3px !important;
  margin: 0 !important;
  z-index: 3;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  right: -6px !important;
  bottom: -6px !important;
  width: 52px !important;
  height: 40px !important;
}

.tile .ptoken-pin,
.tile .tokens.has-many .ptoken-pin,
.board .tile .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin {
  width: 23px !important;
  height: 23px !important;
  font-size: 13px !important;
}

.tile .tokens.has-many .ptoken-pin:nth-child(1),
.board .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(2),
.board .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 12px !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(3),
.board .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 24px !important; bottom: 0 !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(4),
.board .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 6px !important; bottom: 14px !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(5),
.board .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 18px !important; bottom: 14px !important; }
.tile .tokens.has-many .ptoken-pin:nth-child(6),
.board .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 30px !important; bottom: 14px !important; }

.pchip {
  border-left-width: 7px;
  background: rgba(226, 230, 225, .86);
  color: #213028;
}

.pchip.is-turn {
  border-left-width: 9px;
  background: rgba(255, 255, 255, .96);
  color: #16251e;
  box-shadow: 0 0 0 1px rgba(255, 211, 134, .38), 0 10px 22px rgba(0, 0, 0, .14);
}

.pchip .pc-cash,
.pchip .pc-name {
  color: inherit;
}

.pchip .pc-place,
.pchip .pc-sub {
  color: rgba(30, 42, 35, .76);
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: 50px minmax(0, 1fr) 62px !important;
  }

  .game-header .game-brand,
  .game-header .game-status,
  .game-header .leave-btn {
    min-height: 40px;
  }

  .game-header .leave-btn {
    min-width: 62px;
    padding: 5px 7px;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  .tile .tile-price-big {
    left: 2px !important;
    bottom: 2px !important;
  }

  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    right: -5px !important;
    bottom: -5px !important;
    width: 48px !important;
    height: 36px !important;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin,
  .board .tile .ptoken-pin,
  .board .tile .tokens.has-many .ptoken-pin {
    width: 21px !important;
    height: 21px !important;
    font-size: 12px !important;
  }

  .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 11px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 22px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 5px !important; bottom: 13px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 16px !important; bottom: 13px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 27px !important; bottom: 13px !important; }

  .pchip {
    border-left-width: 6px;
  }

  .pchip.is-turn {
    border-left-width: 8px;
  }
}

/* ---------- Player stack layering: tokens stay behind tile labels ---------- */
.tile .tile-face {
  isolation: isolate;
  overflow: hidden;
}

.tile .tile-bg-icon {
  z-index: 0;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  z-index: 1 !important;
  top: auto !important;
  left: auto !important;
  right: -8px !important;
  bottom: -7px !important;
  width: 60px !important;
  height: 45px !important;
  display: block !important;
  overflow: visible !important;
  pointer-events: none;
  transform: none !important;
}

.tile .tile-plate,
.tile .tile-price-big,
.tile .owner-dot,
.tile .houses {
  position: relative;
  z-index: 3;
}

.tile .ptoken-pin,
.tile .tokens.has-many .ptoken-pin,
.board .tile .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin,
.preview-grid .tile .ptoken-pin,
.preview-grid .tile .tokens.has-many .ptoken-pin {
  position: absolute !important;
  width: 28px !important;
  height: 28px !important;
  margin: 0 !important;
  border-width: 2px !important;
  background: #fffaf0;
  box-shadow: 0 5px 11px rgba(0, 0, 0, .32), 0 0 0 1px rgba(255, 247, 232, .9);
  font-size: 15px !important;
  line-height: 1 !important;
}

.tile .tokens.has-many .ptoken-pin:nth-child(1),
.board .tile .tokens.has-many .ptoken-pin:nth-child(1),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; z-index: 6; }
.tile .tokens.has-many .ptoken-pin:nth-child(2),
.board .tile .tokens.has-many .ptoken-pin:nth-child(2),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 14px !important; bottom: 0 !important; z-index: 5; }
.tile .tokens.has-many .ptoken-pin:nth-child(3),
.board .tile .tokens.has-many .ptoken-pin:nth-child(3),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 28px !important; bottom: 0 !important; z-index: 4; }
.tile .tokens.has-many .ptoken-pin:nth-child(4),
.board .tile .tokens.has-many .ptoken-pin:nth-child(4),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 7px !important; bottom: 16px !important; z-index: 3; }
.tile .tokens.has-many .ptoken-pin:nth-child(5),
.board .tile .tokens.has-many .ptoken-pin:nth-child(5),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 21px !important; bottom: 16px !important; z-index: 2; }
.tile .tokens.has-many .ptoken-pin:nth-child(6),
.board .tile .tokens.has-many .ptoken-pin:nth-child(6),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 35px !important; bottom: 16px !important; z-index: 1; }

.tile .tokens.token-count-1 .ptoken-pin {
  right: 0 !important;
  bottom: 0 !important;
}

@media (max-width: 639px) {
  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    top: auto !important;
    right: -7px !important;
    bottom: -6px !important;
    width: 52px !important;
    height: 40px !important;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin,
  .board .tile .ptoken-pin,
  .board .tile .tokens.has-many .ptoken-pin {
    width: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
  }

  .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0 !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 12px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 24px !important; bottom: 0 !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 6px !important; bottom: 14px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 18px !important; bottom: 14px !important; }
  .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 30px !important; bottom: 14px !important; }
}

/* ---------- Price pill ---------- */
.tile .tile-price-big {
  align-self: start !important;
  justify-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  min-width: 0;
  margin: 2px 0 0 3px !important;
  border: 1px solid rgba(35, 48, 40, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #26352d;
  padding: 1px 5px 2px !important;
  font-size: clamp(8px, .82vw, 10.5px) !important;
  font-weight: 760 !important;
  line-height: 1 !important;
  box-shadow: 0 1px 2px rgba(20, 30, 25, .1);
  transform: translateZ(12px);
}

.tile .tile-price-big .price-number {
  color: inherit;
  font-weight: 760 !important;
  line-height: 1;
}

.tile.owned-tile .tile-price-big {
  border-color: rgba(66, 72, 68, .1);
  background: rgba(244, 246, 242, .58);
  color: rgba(71, 79, 73, .58);
  opacity: .7;
}

@media (max-width: 639px) {
  .tile .tile-price-big {
    margin: 1px 0 0 2px !important;
    padding: 1px 4px 2px !important;
    font-size: clamp(7px, 2.1vw, 9px) !important;
  }
}

/* ---------- Player token stack sizing ---------- */
.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  right: -3px;
  bottom: -3px;
  left: auto;
  width: 52px;
  height: 38px;
  display: block;
  overflow: visible;
}

.tile .ptoken-pin,
.tile .tokens.has-many .ptoken-pin {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  margin: 0;
  border-width: 2px;
  font-size: 14px;
  box-shadow: 0 7px 16px rgba(0, 0, 0, .34), 0 0 0 2px rgba(255, 247, 232, .92);
}

.tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0; bottom: 0; z-index: 16; }
.tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 14px; bottom: 0; z-index: 15; }
.tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 28px; bottom: 0; z-index: 14; }
.tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 7px; bottom: 15px; z-index: 13; }
.tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 21px; bottom: 15px; z-index: 12; }
.tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 35px; bottom: 15px; z-index: 11; }

.tile .tokens.token-count-1 {
  width: 27px;
  height: 27px;
}

.tile .tokens.token-count-2,
.tile .tokens.token-count-3 {
  width: 54px;
  height: 27px;
}

.tile .tokens.token-count-4,
.tile .tokens.token-count-5,
.tile .tokens.token-count-6 {
  width: 64px;
  height: 42px;
}

@media (max-width: 639px) {
  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    right: -3px;
    bottom: -3px;
    width: 48px;
    height: 36px;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin {
    width: 21px;
    height: 21px;
    font-size: 12px;
  }

  .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0; bottom: 0; }
  .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 12px; bottom: 0; }
  .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 24px; bottom: 0; }
  .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 6px; bottom: 13px; }
  .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 18px; bottom: 13px; }
  .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 30px; bottom: 13px; }

  .tile .tokens.token-count-1 {
    width: 24px;
    height: 24px;
  }

  .tile .tokens.token-count-2,
  .tile .tokens.token-count-3 {
    width: 48px;
    height: 24px;
  }

  .tile .tokens.token-count-4,
  .tile .tokens.token-count-5,
  .tile .tokens.token-count-6 {
    width: 56px;
    height: 38px;
  }
}

/* ---------- Player token stack final override ---------- */
.board .tile .tokens,
.board .tile-side-bottom .tokens,
.board .tile-side-top .tokens,
.board .tile-side-left .tokens,
.board .tile-side-right .tokens,
.preview-grid .tile .tokens {
  left: auto !important;
  right: -4px !important;
  bottom: -4px !important;
  width: 66px !important;
  height: 48px !important;
  max-width: none !important;
  max-height: none !important;
  display: block !important;
  overflow: visible !important;
  transform: none !important;
}

.board .tile .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin,
.preview-grid .tile .ptoken-pin,
.preview-grid .tile .tokens.has-many .ptoken-pin {
  position: absolute !important;
  right: 0;
  bottom: 0;
  width: 26px !important;
  height: 26px !important;
  margin: 0 !important;
  border-width: 2px !important;
  font-size: 15px !important;
}

.board .tile .tokens.has-many .ptoken-pin:nth-child(1),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0; bottom: 0; z-index: 16; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(2),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 15px; bottom: 0; z-index: 15; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(3),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 30px; bottom: 0; z-index: 14; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(4),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 8px; bottom: 17px; z-index: 13; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(5),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 23px; bottom: 17px; z-index: 12; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(6),
.preview-grid .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 38px; bottom: 17px; z-index: 11; }

@media (max-width: 639px) {
  .board .tile .tokens,
  .board .tile-side-bottom .tokens,
  .board .tile-side-top .tokens,
  .board .tile-side-left .tokens,
  .board .tile-side-right .tokens {
    right: -4px !important;
    bottom: -4px !important;
    width: 58px !important;
    height: 42px !important;
  }

  .board .tile .ptoken-pin,
  .board .tile .tokens.has-many .ptoken-pin {
    width: 23px !important;
    height: 23px !important;
    font-size: 13px !important;
  }

  .board .tile .tokens.has-many .ptoken-pin:nth-child(1) { right: 0; bottom: 0; }
  .board .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 13px; bottom: 0; }
  .board .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 26px; bottom: 0; }
  .board .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 7px; bottom: 15px; }
  .board .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 20px; bottom: 15px; }
  .board .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 33px; bottom: 15px; }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  background:
    linear-gradient(135deg, #e7f0ea 0%, #f7f8f2 48%, #dcebf0 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* ---------- Кнопки / инпуты ---------- */
.btn {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--panel2);
  color: var(--text);
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .06s ease, box-shadow .15s ease, filter .15s ease;
}

.btn:hover {
  box-shadow: 0 8px 18px rgba(24, 37, 31, .12);
}

.btn:active {
  transform: translateY(1px) scale(.99);
}

.btn:disabled {
  cursor: default;
  opacity: .45;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e78d35);
  color: #231707;
}

.btn-ok {
  background: linear-gradient(135deg, #1ea96a, var(--ok));
  color: #ffffff;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
}

input[type="text"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 12px 14px;
  font-size: 1rem;
}

input[type="text"]:focus {
  outline: 3px solid rgba(22, 143, 139, .2);
  border-color: var(--accent2);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: .82rem;
}

.error {
  min-height: 1.2em;
  color: var(--danger);
  font-size: .9rem;
}

/* ---------- Экран входа / лобби ---------- */
#screen-join,
#screen-lobby {
  min-height: 100vh;
  min-height: 100svh;
  display: none;
  place-items: center;
  padding: 24px;
}

#screen-join.active,
#screen-lobby.active {
  display: grid;
}

.join-card,
.lobby-card {
  width: 100%;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid rgba(37, 58, 48, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.logo {
  color: var(--board-felt-dark);
  font-size: clamp(2.05rem, 8vw, 2.7rem);
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.05;
  text-align: center;
}

.tagline {
  margin-bottom: 8px;
  color: var(--muted);
  text-align: center;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.player-list li {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  padding: 9px 12px;
}

.player-list .ptoken {
  font-size: 1.35rem;
}

.player-list .pname {
  flex: 1;
  font-weight: 800;
}

.player-list .pbadge {
  border-radius: 6px;
  background: var(--accent);
  color: #231707;
  padding: 2px 7px;
  font-size: .68rem;
  font-weight: 900;
}

.lobby-log {
  max-height: 178px;
  display: grid;
  gap: 6px;
  overflow: auto;
  border: 1px solid rgba(37, 58, 48, .12);
  border-radius: 8px;
  background: rgba(245, 248, 244, .82);
  padding: 8px;
}

.lobby-log:empty {
  display: none;
}

/* ---------- Игра ---------- */
#screen-game {
  min-height: 100vh;
  min-height: 100svh;
  padding: 10px;
}

#screen-game.active {
  display: block;
}

.game-status {
  max-width: 1100px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 10px;
  border: 1px solid rgba(37, 58, 48, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 28px rgba(24, 37, 31, .1);
  padding: 10px 12px;
}

.gs-copy {
  min-width: 0;
}

.gs-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.15;
}

.gs-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.gs-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(22, 143, 139, .22);
  border-radius: 8px;
  background: rgba(22, 143, 139, .1);
  color: var(--accent2);
  padding: 7px 9px;
  font-size: .76rem;
  font-weight: 950;
  text-align: center;
}

.game-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.board-rail {
  width: 100%;
  display: grid;
  justify-items: center;
  overflow: visible;
}

.board {
  width: min(96vw, 620px);
  max-width: 96vw;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  grid-template-rows: repeat(11, 1fr);
  gap: 2px;
  margin: 0 auto;
  overflow: hidden;
  border: 5px solid var(--line-strong);
  border-radius: 8px;
  background: var(--line-strong);
  box-shadow: 0 18px 42px rgba(24, 37, 31, .22);
}

.tile {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--tile);
  color: #20342a;
  font-size: 6px;
  line-height: 1.08;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.tile .colorbar {
  width: 100%;
  height: 21%;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(32, 52, 42, .16);
}

.tile .colorbar,
.tile .tname,
.tile .tprice,
.tile .ticon,
.tile > div:not(.owner-dot):not(.houses):not(.tokens) {
  position: relative;
  z-index: 1;
}

.tile .tname {
  padding: 2px 2px 1px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tile .tprice {
  margin-top: auto;
  padding: 0 2px 2px;
  color: #62746a;
  font-weight: 700;
}

.tile.corner,
.tile.special {
  align-items: center;
  justify-content: center;
  padding: 2px;
  text-align: center;
}

.tile.corner {
  background: #e7f2ea;
  color: var(--board-felt-dark);
  font-size: 7px;
  font-weight: 900;
}

.tile-special,
.tile-railroad,
.tile-utility,
.tile-tax,
.tile-chance,
.tile-chest {
  background: var(--tile-soft);
}

.tile .ticon {
  margin-bottom: 1px;
  font-size: 14px;
  line-height: 1;
}

.tile .owner-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(24, 37, 31, .5);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .75);
  z-index: 2;
}

.tile.mortgaged {
  filter: grayscale(.65) brightness(.82);
}

.tile .houses {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: flex;
  gap: 1px;
  z-index: 2;
}

.tile .houses .h {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--ok);
}

.tile .houses .hotel {
  width: 7px;
  height: 5px;
  border-radius: 1px;
  background: var(--danger);
}

.tile .tokens {
  position: absolute;
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 2px;
  pointer-events: none;
}

.tile .ptoken-pin {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--accent2);
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(24, 37, 31, .36), 0 0 0 2px rgba(255, 255, 255, .9);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.tile.has-token {
  z-index: 12;
}

.tile-side-bottom .tokens {
  top: 1px;
  left: 50%;
  transform: translateX(-50%);
}

.tile-side-top .tokens {
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
}

.tile-side-left .tokens {
  top: 50%;
  right: 1px;
  flex-direction: column;
  transform: translateY(-50%);
}

.tile-side-right .tokens {
  top: 50%;
  left: 1px;
  flex-direction: column;
  transform: translateY(-50%);
}

.tile.active-tile {
  z-index: 14;
  box-shadow: inset 0 0 0 3px var(--accent);
}

.board-center {
  grid-column: 2 / 11;
  grid-row: 2 / 11;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(47, 115, 88, .98), rgba(30, 78, 60, .98));
  color: #f8fff9;
  text-align: center;
}

.board-center .center-logo {
  color: var(--accent);
  font-size: 28px;
  font-weight: 950;
  letter-spacing: 3px;
  transform: rotate(-9deg);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .18);
}

.board-center .center-sub {
  border-top: 1px solid rgba(255, 255, 255, .22);
  border-bottom: 1px solid rgba(255, 255, 255, .22);
  padding: 4px 10px;
  color: rgba(248, 255, 249, .82);
  font-size: .72rem;
  font-weight: 800;
}

.board-center .center-turn {
  color: rgba(248, 255, 249, .72);
  font-size: var(--fs-1);
  font-weight: 800;
  line-height: var(--lh-tight);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.board-center .center-turn b {
  display: block;
  margin: 3px 0 1px;
  color: #ffffff;
  font-size: var(--fs-4);
  font-weight: 950;
  letter-spacing: 0;
  text-transform: none;
}

.center-place {
  display: block;
  margin-top: 1px;
  color: var(--accent);
  font-size: var(--fs-2);
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.players-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
}

.pchip {
  min-width: 132px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-left: 5px solid;
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 20px rgba(24, 37, 31, .08);
  padding: 8px 10px;
}

.pchip.is-turn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(242, 184, 75, .4), 0 10px 22px rgba(24, 37, 31, .12);
}

.pchip.is-bankrupt {
  opacity: .5;
}

.pchip .pc-name {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-size: .82rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.pchip .pc-cash {
  margin-top: 2px;
  color: var(--board-felt-dark);
  font-size: 1rem;
  font-weight: 900;
}

.pchip .pc-place {
  margin-top: 2px;
  color: var(--text);
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.pchip .pc-sub {
  min-height: 1.1em;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pchip .offline {
  color: var(--danger);
}

.turn-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 24px rgba(24, 37, 31, .1);
  padding: 12px;
}

.turn-info {
  min-height: 1.2em;
  color: var(--text);
  font-size: .98rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.turn-info .hl {
  color: var(--accent2);
}

.turn-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}

.tile-panel {
  min-height: 96px;
}

.tile-card {
  --tile-accent: var(--accent2);
  border: 1px solid rgba(37, 58, 48, .12);
  border-left: 5px solid var(--tile-accent);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8faf6 100%);
  padding: 10px;
}

.tile-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.tile-kind {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tile-title {
  margin-top: 1px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 950;
  line-height: 1.1;
}

.tile-presence {
  min-width: 36px;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 900;
  text-align: right;
}

.tile-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tile-facts span {
  border-radius: 6px;
  background: rgba(37, 58, 48, .07);
  color: var(--muted);
  padding: 4px 6px;
  font-size: .68rem;
  font-weight: 850;
}

.tile-advice {
  margin-top: 8px;
  color: var(--text);
  font-size: .78rem;
  font-weight: 760;
  line-height: 1.28;
}

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

.die {
  width: 42px;
  height: 42px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border: 1px solid rgba(24, 37, 31, .18);
  border-radius: 8px;
  background: #ffffff;
  color: #111a15;
  box-shadow: 0 4px 12px rgba(24, 37, 31, .18);
  padding: 7px;
}

.die.empty {
  display: none;
}

.die .pip {
  width: 7px;
  height: 7px;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: #111a15;
  opacity: 0;
}

.die[data-value="1"] .pip:nth-child(5),
.die[data-value="2"] .pip:nth-child(1),
.die[data-value="2"] .pip:nth-child(9),
.die[data-value="3"] .pip:nth-child(1),
.die[data-value="3"] .pip:nth-child(5),
.die[data-value="3"] .pip:nth-child(9),
.die[data-value="4"] .pip:nth-child(1),
.die[data-value="4"] .pip:nth-child(3),
.die[data-value="4"] .pip:nth-child(7),
.die[data-value="4"] .pip:nth-child(9),
.die[data-value="5"] .pip:nth-child(1),
.die[data-value="5"] .pip:nth-child(3),
.die[data-value="5"] .pip:nth-child(5),
.die[data-value="5"] .pip:nth-child(7),
.die[data-value="5"] .pip:nth-child(9),
.die[data-value="6"] .pip:nth-child(1),
.die[data-value="6"] .pip:nth-child(3),
.die[data-value="6"] .pip:nth-child(4),
.die[data-value="6"] .pip:nth-child(6),
.die[data-value="6"] .pip:nth-child(7),
.die[data-value="6"] .pip:nth-child(9) {
  opacity: 1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.actions .btn {
  min-width: 128px;
  flex: 1 1 auto;
}

.build-panel {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.build-title {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.build-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 7px;
}

.build-btn {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(37, 58, 48, .12);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(24, 37, 31, .08);
}

.build-btn b {
  display: block;
  font-size: .78rem;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.build-btn small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
}

.build-icon {
  width: 26px;
  flex: 0 0 26px;
  font-size: 1.1rem;
  text-align: center;
}

.log {
  max-height: 142px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  color: var(--muted);
  padding: 10px 12px;
  font-size: .82rem;
  line-height: 1.3;
}

.log .l-line:first-child {
  color: var(--text);
  font-weight: 800;
}

.l-line {
  position: relative;
  padding-left: 12px;
}

.l-line::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
}

.l-line.is-cost::before {
  background: var(--danger);
}

.l-line.is-gain::before {
  background: var(--ok);
}

.l-line.is-auction::before {
  background: var(--accent);
}

.l-line.is-market-event::before {
  background: #cf4d45;
}

.l-line.is-turn-event::before {
  background: var(--accent2);
}

.l-line.is-card-event::before {
  background: #8e44ad;
}

/* ---------- Тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  max-width: 90vw;
  border-radius: 8px;
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(207, 77, 69, .35);
  padding: 12px 18px;
  font-size: .9rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateX(-50%) translateY(28px);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Модалка карты ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(24, 37, 31, .58);
  padding: 24px;
}

.modal-backdrop.show {
  display: grid;
}

.card-modal {
  width: 100%;
  max-width: 370px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid rgba(37, 58, 48, .14);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.card-deck {
  color: var(--board-felt-dark);
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: 1px;
}

.card-deck.chance {
  color: var(--accent2);
}

.card-deck.chest {
  color: #bb7a16;
}

#card-text {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.45;
}

.card-sequence {
  display: block;
  border: 1px solid rgba(37, 58, 48, .1);
  border-radius: 8px;
  background: #f8faf6;
  padding: 10px;
  text-align: left;
}

.card-sequence + .card-sequence {
  margin-top: 8px;
}

.card-sequence b,
.card-sequence span {
  display: block;
}

.card-sequence b {
  margin-bottom: 4px;
  color: var(--accent2);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.card-sequence.chest b {
  color: #bb7a16;
}

@media (min-width: 480px) {
  .tile {
    font-size: 7px;
  }
}

@media (max-width: 639px) {
  .players-bar {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 0;
  }

  .pchip {
    min-width: 0;
    width: 100%;
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .players-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding: 0;
  }

  .pchip {
    min-width: 0;
    width: 100%;
  }
}

@media (min-width: 900px) {
  #screen-game.active {
    min-height: 100vh;
    padding: 18px;
  }

  .game-layout {
    max-width: 1100px;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    margin: 0 auto;
  }

  .board {
    width: min(70vh, 680px);
    margin: 0;
  }

  .tile {
    font-size: 8px;
  }

  .hud {
    width: 390px;
    flex-shrink: 0;
  }

  .players-bar {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .pchip {
    min-width: 182px;
    flex: 1 1 calc(50% - 8px);
  }

  .log {
    max-height: 240px;
  }
}

@media (max-width: 360px) {
  #screen-game {
    padding: 6px;
  }

  .board {
    border-width: 4px;
    gap: 1px;
  }

  .tile {
    font-size: 5px;
  }

  .tile .ticon {
    font-size: 12px;
  }

  .board-center .center-logo {
    font-size: 22px;
  }

  .actions .btn {
    min-width: 100%;
  }
}

/* ---------- UI polish pass: copy link, icon board, floating tiles ---------- */
.server-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(37, 58, 48, .12);
  border-radius: 8px;
  background: #f8faf6;
  padding: 10px;
}

.server-label {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}

#server-address {
  display: block;
  margin-top: 2px;
  color: var(--board-felt-dark);
  font-size: .9rem;
  font-weight: 900;
  cursor: copy;
  overflow-wrap: anywhere;
  user-select: all;
}

.server-copy .btn {
  min-height: 38px;
  padding: 8px 10px;
  font-size: .78rem;
}

.game-header {
  max-width: 1120px;
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 0 auto 10px;
}

.game-brand {
  width: 178px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  border: 1px solid rgba(37, 58, 48, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(24, 37, 31, .1);
  padding: 9px 12px;
}

.game-logo {
  color: var(--board-felt-dark);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 950;
  letter-spacing: .04em;
  line-height: 1;
}

.game-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 850;
  text-align: center;
}

.game-header .game-status {
  max-width: none;
  flex: 1 1 auto;
  margin: 0;
}

.board {
  position: relative;
  width: min(calc(100vw - 82px), 620px);
  overflow: visible;
  isolation: isolate;
  perspective: 900px;
}

.tile {
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  overflow: visible;
  background: transparent;
  color: var(--tile-accent);
  outline: none;
  transform-style: preserve-3d;
}

.tile-face {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(37, 58, 48, .1);
  background: linear-gradient(180deg, #fffef9 0%, #f4f8f2 100%);
  color: var(--tile-accent);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transform-style: preserve-3d;
}

.tile > .tile-face {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.board .tile > div.tile-face.tile-face {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.tile .colorbar {
  width: 100%;
  height: 100%;
  border: 0;
}

.tile-icon {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  display: grid;
  width: clamp(11px, 1.6vw, 14px);
  height: clamp(11px, 1.6vw, 14px);
  place-items: center;
  color: #fffaf1;
  transform: translateZ(10px);
}

.tile-marker {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tile-accent) 50%, #0c1713);
  border-radius: 50%;
  background: color-mix(in srgb, var(--tile-accent) 88%, #11201a);
  box-shadow: 0 1px 2px rgba(24, 37, 31, .2);
  font-size: clamp(6px, .92vw, 9px);
  font-weight: 950;
  line-height: 1;
}

.tile-marker svg {
  width: 72%;
  height: 72%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile-marker-text {
  position: absolute;
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  color: currentColor;
  font-size: .58em;
  font-weight: 950;
  line-height: 1;
}

.tile-marker-railroad,
.tile-marker-utility,
.tile-marker-tax,
.tile-marker-chance,
.tile-marker-chest,
.tile-marker-jail,
.tile-marker-go,
.tile-marker-parking,
.tile-marker-gotojail {
  border-radius: 50%;
}

.tile-marker-jail {
  font-size: clamp(8px, 1.1vw, 11px);
}

.tile-plate {
  min-width: 0;
  display: grid;
  place-items: center;
  align-self: stretch;
  padding: 1px 3px;
  color: var(--name-ink, #1a231d);
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid rgba(0, 0, 0, .16);
  transform: translateZ(10px);
}

.tile-name-mini {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  color: var(--name-ink, #1e251f);
  font-size: var(--name-font, 8px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.01em;
}

.tile-kind-mini {
  display: none;
  max-width: 100%;
  color: #6b5d46;
  font-size: clamp(5px, .6vw, 7px);
  font-weight: 820;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-price-big {
  align-self: center;
  justify-self: center;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  margin: 1px 0 2px;
  color: #22352c;
  font-size: clamp(9px, 1.18vw, 13px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
  transform: translateZ(12px);
  transition: color .18s ease, opacity .18s ease, transform .18s ease;
}

.tile-price-big .price-number {
  color: inherit;
  font-weight: 950;
  line-height: 1;
}

.tile.owned-tile .tile-price-big {
  color: #9aa8a1;
  opacity: .62;
  transform: translateZ(12px) scale(.82);
}

.tile.owned-tile .tile-face {
  filter: saturate(.85) brightness(.97);
  box-shadow: inset 0 -3px 0 var(--owner-color, transparent);
}

.tile .tname,
.tile .tprice,
.tile .ticon {
  display: none;
}

.tile-detail {
  position: absolute;
  z-index: 80;
  display: none;
  width: clamp(138px, 18vw, 190px);
  min-height: 118px;
  pointer-events: none;
  border: 1px solid rgba(37, 58, 48, .14);
  border-left: 5px solid var(--tile-accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, .98);
  color: var(--text);
  box-shadow: 0 18px 38px rgba(24, 37, 31, .2);
  padding: 10px;
  opacity: 0;
  transform-style: preserve-3d;
  transition: opacity .16s ease, transform .2s cubic-bezier(.2, .8, .2, 1);
}

.tile > .tile-detail {
  position: absolute;
  z-index: 80;
}

.board .tile > div.tile-detail.tile-detail {
  position: absolute;
  z-index: 80;
}

.td-kind {
  color: var(--muted);
  font-size: .62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.td-name {
  margin-top: 2px;
  color: var(--text);
  font-size: .95rem;
  font-weight: 950;
  line-height: 1.08;
}

.td-price {
  display: inline-flex;
  margin-top: 6px;
  border-radius: 6px;
  background: rgba(37, 58, 48, .08);
  color: var(--board-felt-dark);
  padding: 3px 6px;
  font-size: .75rem;
  font-weight: 950;
}

.td-owner {
  margin-top: 6px;
  color: var(--accent2);
  font-size: .7rem;
  font-weight: 850;
}

.tile-detail p {
  margin-top: 7px;
  color: var(--text);
  font-size: .72rem;
  font-weight: 720;
  line-height: 1.25;
}

.tile-side-bottom .tile-detail {
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%) translateY(8px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(.86);
  transform-origin: 50% 100%;
}

.tile-side-top .tile-detail {
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-8px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(.86);
  transform-origin: 50% 0;
}

.tile-side-left .tile-detail {
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-8px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(.86);
  transform-origin: 0 50%;
}

.tile-side-right .tile-detail {
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(8px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(.86);
  transform-origin: 100% 50%;
}

.tile:hover,
.tile:focus-visible,
.tile.is-peek {
  z-index: 90;
}

.tile:hover .tile-face,
.tile:focus-visible .tile-face,
.tile.is-peek .tile-face {
  box-shadow: 0 10px 22px rgba(24, 37, 31, .22);
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateZ(16px) scale(1.06);
}

.tile:hover .tile-detail,
.tile:focus-visible .tile-detail,
.tile.is-peek .tile-detail {
  display: block;
  opacity: 1;
}

.tile-side-bottom:hover .tile-detail,
.tile-side-bottom:focus-visible .tile-detail,
.tile-side-bottom.is-peek .tile-detail {
  transform: translateX(-50%) translateY(0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
}

.tile-side-top:hover .tile-detail,
.tile-side-top:focus-visible .tile-detail,
.tile-side-top.is-peek .tile-detail {
  transform: translateX(-50%) translateY(0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
}

.tile-side-left:hover .tile-detail,
.tile-side-left:focus-visible .tile-detail,
.tile-side-left.is-peek .tile-detail {
  transform: translateY(-50%) translateX(0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
}

.tile-side-right:hover .tile-detail,
.tile-side-right:focus-visible .tile-detail,
.tile-side-right.is-peek .tile-detail {
  transform: translateY(-50%) translateX(0) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(1);
}

.tile .tokens {
  z-index: 75;
  left: 3px;
  bottom: 3px;
  max-width: calc(100% - 8px);
  max-height: 26px;
  transform: none;
}

.tile .ptoken-pin {
  width: clamp(17px, 2.8vw, 23px);
  height: clamp(17px, 2.8vw, 23px);
  background: linear-gradient(180deg, #fffdf8, #e9ddc9);
  font-size: clamp(10px, 1.65vw, 14px);
}

.tile .tokens.has-many {
  gap: 0;
}

.tile .tokens.has-many .ptoken-pin {
  width: clamp(16px, 2.55vw, 21px);
  height: clamp(16px, 2.55vw, 21px);
  margin: -2px;
  font-size: clamp(9px, 1.45vw, 12px);
}

.tile .tokens.has-many::after {
  content: attr(data-count);
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  align-self: center;
  justify-self: center;
  border: 1px solid rgba(36, 30, 20, .22);
  border-radius: 50%;
  background: #f0b85d;
  color: #261706;
  font-size: 10px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}

.tile-side-left .tokens,
.tile-side-right .tokens {
  max-height: 92px;
}

.board-center {
  position: relative;
  z-index: 2;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .12);
}

.board-center .center-turn {
  max-width: 72%;
  color: rgba(248, 255, 249, .9);
  font-size: clamp(.78rem, 1.1vw, .95rem);
  font-weight: 800;
}

.board-center .center-turn b {
  font-size: 1.16em;
}

.board-center .dice {
  min-height: 44px;
}

.board-center .actions {
  width: min(78%, 360px);
}

.board-center .actions .btn {
  min-width: min(100%, 150px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .16);
}

.board-log-toggle {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 18;
  min-height: 32px;
  border: 1px solid rgba(157, 227, 207, .34);
  border-radius: 7px;
  background: rgba(9, 51, 40, .74);
  color: #d9fff4;
  padding: 6px 10px;
  font: inherit;
  font-size: .72rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .18);
  backdrop-filter: blur(10px);
}

.board-log-toggle[aria-expanded="true"] {
  border-color: rgba(92, 184, 255, .72);
  background: rgba(20, 83, 116, .82);
  color: #ffffff;
}

.board-log {
  position: absolute;
  inset: 46px 14px 56px;
  z-index: 17;
  max-height: none;
  display: flex;
  border-color: rgba(92, 184, 255, .35);
  background:
    linear-gradient(180deg, rgba(12, 48, 42, .94), rgba(6, 31, 26, .96));
  color: rgba(237, 249, 245, .78);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .35);
  backdrop-filter: blur(14px);
}

.board-log[hidden] {
  display: none;
}

.board.is-log-open .center-turn,
.board.is-log-open .dice,
.board.is-log-open .actions {
  opacity: .18;
}

@media (min-width: 900px) {
  .board {
    width: min(68vh, 640px);
  }
}

@media (max-width: 639px) {
  .game-header {
    flex-direction: column;
  }

  .board {
    width: min(calc(100vw - 92px), 620px);
  }

  .game-brand {
    width: 100%;
    min-height: 54px;
    grid-template-columns: auto auto;
    place-content: center;
    gap: 10px;
  }

  .game-subtitle {
    margin-top: 2px;
    text-align: left;
  }

  .tile-detail {
    width: min(170px, 48vw);
  }

  .tile-price-big {
    font-size: 9px;
  }

  .board-center .actions {
    width: 86%;
  }

  .board-center .actions .btn {
    min-height: 38px;
    padding: 8px 10px;
    font-size: .76rem;
  }
}

@media (max-width: 420px) {
  .server-copy {
    grid-template-columns: 1fr;
  }

  .server-copy .btn {
    width: 100%;
  }

  .tile .ptoken-pin {
    width: 21px;
    height: 21px;
    font-size: 12px;
  }

  .tile-detail {
    width: 156px;
    padding: 8px;
  }
}

/* ---------- Professional visual system pass ---------- */
:root {
  --bg: #082a22;
  --bg2: #0d3a2f;
  --panel: #f7f1e4;
  --panel2: #efe6d4;
  --line: rgba(246, 239, 224, .18);
  --line-strong: #c79b55;
  --text: #f9f1df;
  --text-dark: #1e251f;
  --muted: #b8c7bd;
  --muted-dark: #69746c;
  --accent: #d89a32;
  --accent-strong: #f0b85d;
  --accent2: #4fb59c;
  --danger: #d95d54;
  --ok: #79c765;
  --board-felt: #0f4b35;
  --board-felt-dark: #082a20;
  --tile: #f9f2df;
  --tile-soft: #efe3cc;
  --shadow: 0 18px 50px rgba(2, 14, 10, .36);
  --shadow-soft: 0 10px 26px rgba(2, 14, 10, .22);
  --radius: 8px;
  --control-radius: 8px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  font-size: 16px;
}

html {
  background: var(--bg);
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(79, 181, 156, .16), transparent 30%),
    radial-gradient(circle at 86% 20%, rgba(216, 154, 50, .14), transparent 24%),
    linear-gradient(135deg, #061f1a 0%, #0b3329 48%, #071b17 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body,
button,
input,
.logo,
.game-logo,
.card-deck {
  letter-spacing: 0;
}

.screen.active {
  animation: surfaceFade .18s ease-out;
}

@keyframes surfaceFade {
  from { opacity: .96; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  border-radius: var(--control-radius);
  font-size: .9rem;
  font-weight: 820;
  letter-spacing: 0;
  box-shadow: none;
}

.btn:hover {
  filter: brightness(1.03);
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent-strong), var(--accent));
  color: #261706;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 10px 20px rgba(216, 154, 50, .22);
}

.btn-ok {
  background: linear-gradient(180deg, #60c89f, #25946c);
}

.btn-ghost {
  border-color: rgba(246, 239, 224, .18);
  background: rgba(247, 241, 228, .08);
  color: var(--text);
}

input[type="text"] {
  border-color: rgba(30, 37, 31, .14);
  background: #fffaf0;
  color: var(--text-dark);
  font-weight: 740;
}

input[type="text"]:focus {
  outline: 3px solid rgba(79, 181, 156, .22);
  border-color: var(--accent2);
}

.join-card,
.lobby-card {
  border-color: rgba(246, 239, 224, .18);
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .97), rgba(238, 228, 209, .96));
  color: var(--text-dark);
  box-shadow: var(--shadow);
}

.logo {
  color: #123829;
  font-weight: 920;
}

.tagline,
.muted,
.small {
  color: #607067;
}

.server-copy,
.player-list li {
  border-color: rgba(30, 37, 31, .12);
  background: #fff7e9;
}

#server-address {
  color: #123829;
}

.join-card .btn-ghost,
.lobby-card .btn-ghost {
  border-color: rgba(30, 37, 31, .14);
  background: #fffaf0;
  color: var(--text-dark);
}

.join-card .btn-ghost:hover,
.lobby-card .btn-ghost:hover {
  box-shadow: 0 8px 18px rgba(30, 37, 31, .12);
}

.game-header {
  max-width: 1180px;
  align-items: stretch;
  gap: var(--space-3);
}

.game-brand,
.game-status,
.turn-panel,
.log,
.pchip,
.tile-card,
.modal-backdrop .card-modal {
  border: 1px solid rgba(246, 239, 224, .14);
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .1), rgba(247, 241, 228, .055));
  color: var(--text);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.game-brand {
  min-height: 64px;
  padding: 10px 14px;
}

.game-logo {
  color: #fff1d3;
  font-weight: 920;
}

.game-subtitle {
  color: var(--muted);
}

.game-status {
  min-height: 64px;
  padding: 12px 14px;
}

.gs-title {
  color: var(--text);
  font-weight: 880;
}

.gs-meta {
  color: var(--muted);
  font-weight: 680;
}

.gs-badge {
  border-color: rgba(79, 181, 156, .28);
  background: rgba(79, 181, 156, .12);
  color: #a7ead8;
}

.game-layout {
  max-width: 1180px;
  gap: var(--space-4);
}

.board {
  border: 6px solid #9c7439;
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .12), transparent 28%),
    var(--board-felt-dark);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, .38),
    inset 0 0 0 2px rgba(255, 231, 180, .22);
}

.board-center {
  background:
    radial-gradient(circle at 50% 34%, rgba(216, 154, 50, .12), transparent 28%),
    linear-gradient(135deg, rgba(17, 86, 60, .98), rgba(7, 43, 32, .98));
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, .18),
    inset 0 0 0 1px rgba(246, 239, 224, .08);
}

.board-center::before {
  content: "♦";
  position: absolute;
  top: 9%;
  left: 50%;
  color: rgba(249, 241, 223, .1);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  line-height: 1;
  pointer-events: none;
  transform: translateX(-50%);
}

.board-center .center-turn {
  max-width: 78%;
  color: rgba(249, 241, 223, .86);
  font-weight: 760;
}

.board-center .center-turn b {
  color: #fff9ed;
  font-weight: 920;
}

.center-place {
  color: #ffd386;
}

.tile-face {
  border-color: rgba(58, 43, 23, .22);
  background:
    linear-gradient(180deg, #fff7e8 0%, #f1e2c7 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .5),
    inset 0 -1px 0 rgba(92, 63, 26, .18);
}

.tile-icon {
  color: #fffaf1;
}

.tile-price-big {
  color: #2d332d;
  font-weight: 920;
}

.tile.owned-tile .tile-price-big {
  color: #9b9384;
  opacity: .58;
}

.tile.active-tile {
  box-shadow: none;
}

.tile.active-tile .tile-face {
  box-shadow:
    inset 0 0 0 2px #4ab7ff,
    0 0 0 1px rgba(82, 190, 255, .66),
    0 0 18px rgba(37, 145, 255, .86),
    0 0 34px rgba(37, 145, 255, .42);
}

.tile-detail {
  border-color: rgba(58, 43, 23, .18);
  background: rgba(255, 248, 235, .98);
  color: var(--text-dark);
  box-shadow: 0 20px 42px rgba(3, 16, 12, .34);
}

.td-kind {
  color: #716653;
}

.td-name,
.tile-detail p {
  color: var(--text-dark);
}

.td-price {
  background: rgba(216, 154, 50, .14);
  color: #34240f;
}

.td-owner {
  color: #177b65;
}

.tile .ptoken-pin {
  border-width: 2px;
  background: linear-gradient(180deg, #fffaf0, #eadfca);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .32), 0 0 0 2px rgba(255, 247, 232, .9);
}

.pchip {
  min-width: 176px;
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .1), rgba(247, 241, 228, .055));
}

.pchip.is-turn {
  border-color: #ffd386;
  background:
    linear-gradient(180deg, rgba(216, 154, 50, .18), rgba(247, 241, 228, .07));
  box-shadow: 0 0 0 1px rgba(255, 211, 134, .28), var(--shadow-soft);
}

.pchip .pc-name,
.pchip .pc-place {
  color: var(--text);
}

.pchip .pc-cash {
  color: #ffe0a4;
}

.pchip .pc-sub,
.turn-meta,
.tile-kind,
.tile-advice,
.log {
  color: var(--muted);
}

.turn-panel,
.tile-card,
.log {
  border-radius: var(--radius);
}

.turn-info {
  color: var(--text);
  font-weight: 840;
}

.turn-info .hl {
  color: #9de3cf;
}

.tile-card {
  border-left-color: var(--tile-accent);
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .12), rgba(247, 241, 228, .06));
}

.tile-title {
  color: var(--text);
  font-weight: 900;
}

.tile-facts span {
  background: rgba(247, 241, 228, .09);
  color: #d8e4dc;
}

.die {
  border-color: rgba(58, 43, 23, .2);
  background: linear-gradient(180deg, #fff9ee, #eadcc5);
  box-shadow: 0 10px 20px rgba(0, 0, 0, .24);
}

.die .pip {
  background: #1e251f;
}

.log {
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .1), rgba(247, 241, 228, .045));
  font-size: .8rem;
}

.log .l-line:first-child {
  color: #fff4dd;
}

.modal-backdrop {
  background: rgba(2, 12, 9, .68);
}

.card-modal {
  background:
    linear-gradient(180deg, #fff8eb, #efe1c9);
  color: var(--text-dark);
}

.card-deck,
#card-text {
  color: var(--text-dark);
}

.card-sequence {
  border-color: rgba(58, 43, 23, .12);
  background: rgba(255, 255, 255, .38);
}

.toast {
  background: #28342d;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .3);
}

@media (min-width: 900px) {
  #screen-game.active {
    padding: 18px 22px;
  }

  .game-layout {
    margin: 0 auto;
  }

  .board {
    width: min(70vh, 660px);
  }

  .hud {
    width: 410px;
  }

  .pchip {
    min-width: 194px;
  }
}

@media (max-width: 639px) {
  body {
    background:
      radial-gradient(circle at 20% 4%, rgba(79, 181, 156, .16), transparent 28%),
      linear-gradient(180deg, #061f1a, #0b3329 55%, #071b17);
  }

  .game-header {
    gap: var(--space-2);
  }

  .game-status,
  .game-brand {
    min-height: 56px;
  }

  .board {
    border-width: 5px;
    width: min(calc(100vw - 20px), 620px);
  }

  .tile-icon {
    top: 2px;
    left: 2px;
    width: 11px;
    height: 11px;
  }

  .tile-marker {
    font-size: 7px;
  }

  .tile-copy {
    gap: 1px;
    padding: 2px 2px 1px;
  }

  .tile-name-mini {
    line-height: 1.05;
    white-space: nowrap;
  }

  .tile-kind-mini {
    display: none;
  }

  .tile-price-big {
    margin: 0 2px 2px 0;
    font-size: 8px;
  }

  .tile .tokens {
    left: 2px;
    bottom: 2px;
    max-height: 19px;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin {
    width: 16px;
    height: 16px;
    border-width: 2px;
    font-size: 9px;
  }
}

/* ---------- Final board/header composition pass ---------- */
.game-header {
  max-width: 1180px;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(156px, auto) 1fr;
  align-items: stretch;
  gap: 0;
  margin: 0 auto 8px;
  border: 1px solid rgba(246, 239, 224, .14);
  border-radius: var(--radius, 8px);
  background:
    linear-gradient(180deg, rgba(247, 241, 228, .1), rgba(247, 241, 228, .055));
  box-shadow: var(--shadow-soft, 0 16px 48px rgba(0, 0, 0, .18));
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.game-header .game-brand,
.game-header .game-status {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-header .game-brand {
  width: auto;
  min-width: 142px;
  display: grid;
  place-content: center;
  padding: 6px 12px;
  border-right: 1px solid rgba(246, 239, 224, .13);
}

.game-header .game-status {
  max-width: none;
  margin: 0;
  padding: 7px 12px;
}

.game-header .game-logo {
  font-size: clamp(.92rem, 1.55vw, 1.15rem);
  line-height: .95;
}

.game-header .game-subtitle {
  margin-top: 2px;
  font-size: .62rem;
  line-height: 1;
}

.game-header .gs-title {
  font-size: .92rem;
  line-height: 1.05;
}

.game-header .gs-meta {
  margin-top: 2px;
  font-size: .72rem;
  line-height: 1.12;
}

.game-header .gs-badge {
  padding: 5px 8px;
  font-size: .7rem;
  border-radius: 7px;
}

.tile-face {
  grid-template-rows: minmax(15px, var(--tile-plate-h, 18px)) minmax(14px, auto);
  background:
    linear-gradient(180deg, #fffaf0 0%, #efe0c4 100%);
}

.tile-plate {
  min-height: 15px;
  padding: 2px 3px 1px;
  border-bottom: 1px solid rgba(30, 25, 18, .2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .34),
    inset 0 -1px 0 rgba(30, 25, 18, .1);
}

.tile-name-mini {
  font-size: var(--name-font, 8.5px);
  font-weight: 920;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
  transition: opacity .12s ease;
}

.tile.is-name-hidden .tile-face {
  grid-template-rows: 9px minmax(16px, auto);
}

.tile.is-name-hidden .tile-plate {
  min-height: 9px;
  padding: 0;
}

.tile.is-name-hidden .tile-name-mini {
  opacity: 0;
  visibility: hidden;
}

.tile-price-big {
  align-self: end;
  justify-self: start;
  justify-content: flex-start;
  align-items: flex-end;
  padding: 0 0 3px 4px;
  margin: 0;
  background: transparent;
  color: #202920;
  font-variant-numeric: tabular-nums;
  font-size: clamp(7px, .76vw, 9.5px);
  letter-spacing: 0;
}

.tile.owned-tile .tile-price-big {
  color: #8b928a;
  opacity: .62;
  transform: translateZ(12px) scale(.84);
  transform-origin: left bottom;
}

@media (min-width: 900px) {
  .game-header {
    grid-template-columns: 164px 1fr;
  }

  .board {
    width: min(calc(100vh - 100px), 660px, calc(100vw - 560px));
  }
}

@media (max-width: 639px) {
  #screen-game.active {
    padding: 8px;
    overflow-x: hidden;
  }

  .game-header {
    grid-template-columns: 1fr;
    gap: 0;
    width: 100%;
  }

  .board-rail {
    justify-items: start;
    overflow-x: auto;
    overflow-y: visible;
    margin: 0 -8px;
    padding: 0 8px 8px;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .game-header .game-brand {
    min-height: 32px;
    min-width: 0;
    grid-template-columns: auto auto;
    gap: 7px;
    border-right: 0;
    border-bottom: 1px solid rgba(246, 239, 224, .12);
    padding: 5px 8px;
  }

  .game-header .game-status {
    min-height: 38px;
    padding: 6px 8px;
  }

  .game-header .game-logo {
    font-size: 1rem;
  }

  .game-header .game-subtitle {
    margin-top: 0;
    font-size: .58rem;
  }

  .game-header .gs-title {
    font-size: .88rem;
  }

  .game-header .gs-meta {
    font-size: .66rem;
  }

  .game-header .gs-badge {
    padding: 5px 7px;
    font-size: .66rem;
  }

  .board {
    width: min(560px, calc(100svh - 168px));
    min-width: 500px;
    max-width: none;
  }

  .tile-face {
    grid-template-rows: minmax(13px, var(--tile-plate-h, 15px)) minmax(13px, auto);
  }

  .tile-plate {
    min-height: 13px;
    padding: 1px 2px 1px;
  }

  .tile-name-mini {
    font-size: var(--name-font, 6.2px);
  }

  .tile-price-big {
    padding: 0 0 2px 3px;
    font-size: 6.8px;
  }

  .tile.is-name-hidden .tile-face {
    grid-template-rows: 7px minmax(15px, auto);
  }

  .tile.is-name-hidden .tile-plate {
    min-height: 7px;
  }
}

/* ---------- Board density, responsive modes, and tile icon pass ---------- */
.mobile-board-modes {
  display: none;
}

.tile-face {
  grid-template-rows: minmax(10px, var(--tile-plate-h, 11px)) minmax(14px, auto);
  overflow: hidden;
}

.board {
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

.tile-bg-icon {
  position: absolute;
  right: -12%;
  bottom: -18%;
  z-index: 0;
  width: 74%;
  aspect-ratio: 1;
  color: color-mix(in srgb, var(--tile-accent) 72%, #2a1f12);
  opacity: .22;
  pointer-events: none;
  transform: rotate(-8deg);
}

.tile-side-top .tile-bg-icon {
  right: auto;
  left: -14%;
  bottom: -18%;
  transform: rotate(8deg);
}

.tile-side-left .tile-bg-icon {
  right: -20%;
  bottom: auto;
  top: -12%;
  transform: rotate(-14deg);
}

.tile-side-right .tile-bg-icon {
  right: auto;
  left: -20%;
  bottom: auto;
  top: -12%;
  transform: rotate(14deg);
}

.tile-bg-icon .tile-marker {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
}

.tile-bg-icon .tile-marker svg {
  width: 100%;
  height: 100%;
  stroke-width: 2;
}

.tile-bg-icon .tile-marker-text {
  display: none;
}

.tile-plate {
  min-height: 10px;
  padding: 0 2px;
  border: 0;
  box-shadow: none;
  position: relative;
  z-index: 2;
}

.tile-name-mini {
  font-size: var(--name-font, 7.4px);
  line-height: 1;
  text-shadow: none;
}

.tile-price-big {
  position: relative;
  z-index: 2;
  padding: 0 0 3px 4px;
  font-size: clamp(10px, .98vw, 12.5px);
  font-weight: 950;
}

.tile .owner-dot,
.tile .houses,
.tile .tokens {
  z-index: 4;
}

.tile .tokens {
  top: auto;
  right: auto;
  left: -5px;
  bottom: -5px;
  width: 34px;
  max-width: none;
  max-height: none;
  display: grid;
  grid-template-columns: repeat(2, 16px);
  grid-auto-rows: 16px;
  gap: 0;
  align-content: end;
  justify-content: start;
  overflow: visible;
  transform: none;
}

.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  top: auto;
  right: auto;
  left: -5px;
  bottom: -5px;
  transform: none;
  flex-direction: initial;
}

.tile .ptoken-pin,
.tile .tokens.has-many .ptoken-pin {
  width: 17px;
  height: 17px;
  margin: 0;
  border-width: 2px;
  font-size: 9px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 247, 232, .9);
}

.tile .tokens.has-many {
  gap: 0;
}

.tile .tokens.has-many::after {
  display: none;
}

.tile .tokens.token-count-1 {
  width: 24px;
  grid-template-columns: 17px;
}

.tile .tokens.token-count-2 {
  width: 33px;
  grid-template-columns: repeat(2, 16px);
}

.tile .tokens.token-count-3,
.tile .tokens.token-count-4 {
  width: 34px;
  grid-template-columns: repeat(2, 16px);
  grid-template-rows: repeat(2, 16px);
}

.build-empty {
  width: 100%;
  border: 1px dashed rgba(246, 239, 224, .2);
  border-radius: 7px;
  padding: 8px 9px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 760;
  line-height: 1.22;
}

@media (min-width: 900px) {
  .game-header,
  .game-layout {
    width: calc(100vw - 44px);
    max-width: none;
  }

  .game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 370px;
    align-items: start;
    gap: 16px;
    margin: 0;
  }

  .board-rail {
    justify-items: start;
    min-width: 0;
  }

  .board {
    width: calc(100vw - 44px - 370px - 16px);
    max-width: none;
    margin: 0;
  }

  .hud {
    width: 370px;
  }
}

@media (max-width: 639px) {
  .mobile-board-modes {
    position: sticky;
    left: 8px;
    z-index: 120;
    display: inline-flex;
    gap: 2px;
    width: max-content;
    margin: 0 0 6px;
    border: 1px solid rgba(246, 239, 224, .16);
    border-radius: 7px;
    background: rgba(5, 28, 23, .82);
    padding: 2px;
    backdrop-filter: blur(10px);
  }

  .board-mode-btn {
    min-height: 26px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    padding: 4px 8px;
    font: inherit;
    font-size: .68rem;
    font-weight: 860;
  }

  .board-mode-btn.is-active {
    background: rgba(255, 211, 134, .18);
    color: #fff2d8;
  }

  .board-rail {
    height: min(620px, calc(100svh - 196px));
    align-content: start;
    overflow: auto;
    overflow-x: auto;
    overflow-y: auto;
    margin: 0 -8px 10px;
    padding: 0 8px 8px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .board-rail::-webkit-scrollbar {
    display: none;
  }

  .board {
    width: min(640px, calc(100svh - 128px));
    min-width: 560px;
  }

  .board-mode-scroll .board {
    margin: 8px;
  }

  .board-mode-fit .board-rail {
    height: auto;
    justify-items: center;
    overflow: hidden;
    margin: 0;
    padding: 0 0 8px;
  }

  .board-mode-fit .board {
    width: min(calc(100vw - 16px), calc(100svh - 170px));
    min-width: 0;
    margin: 0;
  }

  .tile-face {
    grid-template-rows: minmax(8px, var(--tile-plate-h, 9px)) minmax(13px, auto);
  }

  .tile-plate {
    min-height: 8px;
    padding: 0 1px;
  }

  .tile-name-mini {
    font-size: var(--name-font, 5.8px);
  }

  .tile-price-big {
    padding: 0 0 2px 3px;
    font-size: 7.4px;
  }

  .tile .tokens {
    top: auto;
    right: auto;
    left: -4px;
    bottom: -4px;
    width: 29px;
    grid-template-columns: repeat(2, 14px);
    grid-auto-rows: 14px;
  }

  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    top: auto;
    right: auto;
    left: -4px;
    bottom: -4px;
    transform: none;
    flex-direction: initial;
  }

  .tile .ptoken-pin,
  .tile .tokens.has-many .ptoken-pin {
    width: 15px;
    height: 15px;
    font-size: 8px;
  }

  .tile .tokens.token-count-1 {
    width: 20px;
    grid-template-columns: 15px;
  }

  .tile .tokens.token-count-2,
  .tile .tokens.token-count-3,
  .tile .tokens.token-count-4 {
    width: 30px;
    grid-template-columns: repeat(2, 14px);
    grid-template-rows: repeat(2, 14px);
  }
}

/* ---------- Header carries turn context ---------- */
.game-header {
  min-height: 84px;
}

.game-header .game-brand {
  min-width: 68px;
  padding: 8px 10px;
}

.game-header .game-logo {
  font-size: clamp(1.15rem, 2.1vw, 1.55rem);
  line-height: .88;
  letter-spacing: 0;
}

.game-header .game-subtitle {
  margin-top: 4px;
  font-size: .64rem;
  text-transform: lowercase;
}

.game-header .turn-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(132px, .55fr) minmax(230px, 1fr);
  align-items: stretch;
  gap: 8px;
  border: 0;
  border-left: 1px solid rgba(246, 239, 224, .13);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 10px;
}

.game-header .turn-info {
  min-height: 0;
  display: grid;
  align-content: center;
  text-align: left;
  color: var(--text);
  font-size: .82rem;
  line-height: 1.12;
}

.game-header .turn-meta {
  margin-top: 3px;
  font-size: .66rem;
  line-height: 1.12;
}

.game-header .tile-panel {
  min-height: 0;
}

.game-header .tile-card {
  height: 100%;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(122px, .58fr) minmax(150px, 1fr);
  gap: 8px 10px;
  align-content: center;
  border-width: 1px;
  border-left-width: 4px;
  padding: 8px 9px;
}

.game-header .tile-card-head {
  align-items: center;
  gap: 7px;
}

.game-header .tile-kind {
  font-size: .6rem;
}

.game-header .tile-title {
  font-size: .92rem;
  line-height: 1.04;
}

.game-header .tile-presence {
  min-width: 26px;
  font-size: 1rem;
}

.game-header .tile-facts {
  align-content: center;
  gap: 4px;
}

.game-header .tile-facts span {
  padding: 3px 5px;
  font-size: .62rem;
  line-height: 1;
}

.game-header .tile-advice {
  grid-column: 1 / -1;
  margin: 0;
  font-size: .66rem;
  line-height: 1.14;
}

.game-header .build-panel {
  grid-column: 1 / -1;
}

.game-header .build-title {
  display: none;
}

.game-header .build-options {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.game-header .build-empty,
.game-header .build-btn {
  min-height: 34px;
  padding: 6px 8px;
  font-size: .68rem;
}

@media (min-width: 900px) {
  .game-header {
    grid-template-columns: 74px minmax(220px, .62fr) minmax(390px, 1fr);
    width: calc(100vw - 44px);
    max-width: none;
  }
}

@media (max-width: 899px) {
  .game-header {
    grid-template-columns: 68px 1fr;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(246, 239, 224, .13);
  }
}

@media (max-width: 639px) {
  .game-header {
    min-height: 0;
    grid-template-columns: 54px 1fr;
  }

  .game-header .game-brand {
    min-height: 42px;
    min-width: 0;
    grid-template-columns: 1fr;
    gap: 0;
    border-right: 1px solid rgba(246, 239, 224, .12);
    border-bottom: 0;
    padding: 6px 7px;
  }

  .game-header .game-logo {
    font-size: 1.08rem;
  }

  .game-header .game-subtitle {
    margin-top: 2px;
    text-align: center;
    font-size: .56rem;
  }

  .game-header .game-status {
    min-height: 42px;
  }

  .game-header .turn-panel {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 7px;
  }

  .game-header .turn-info {
    display: none;
  }

  .game-header .tile-card {
    min-height: 0;
    grid-template-columns: 1fr auto;
    padding: 7px;
  }

  .game-header .tile-facts,
  .game-header .tile-advice {
    grid-column: 1 / -1;
  }

  .game-header .tile-advice {
    font-size: .62rem;
    line-height: 1.12;
  }
}

/* ---------- Header deduplication pass ---------- */
.game-header {
  min-height: 58px;
}

.game-header .turn-panel {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 6px 8px;
}

.game-header .turn-info,
.game-header .tile-advice {
  display: none;
}

.game-header .tile-card {
  min-height: 50px;
  grid-template-columns: minmax(118px, .5fr) minmax(170px, 1fr);
  gap: 5px 8px;
  align-content: center;
  padding: 6px 8px;
}

.game-header .tile-kind {
  font-size: .56rem;
  line-height: 1;
}

.game-header .tile-title {
  margin-top: 1px;
  font-size: .86rem;
  line-height: 1.02;
}

.game-header .tile-presence {
  min-width: 24px;
  font-size: .92rem;
  line-height: 1;
}

.game-header .tile-facts {
  margin-top: 0;
  align-content: center;
  gap: 3px;
}

.game-header .tile-facts span {
  padding: 2px 5px;
  font-size: .58rem;
}

.game-header .build-panel {
  gap: 5px;
}

.game-header .build-options {
  gap: 5px;
}

.game-header .build-empty,
.game-header .build-btn {
  min-height: 30px;
  padding: 5px 7px;
}

@media (min-width: 900px) {
  .game-header {
    grid-template-columns: 66px minmax(230px, .55fr) minmax(360px, 1fr);
  }
}

@media (max-width: 899px) {
  .game-header .turn-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: 50px 1fr;
  }

  .game-header .game-brand,
  .game-header .game-status {
    min-height: 38px;
  }

  .game-header .turn-panel {
    padding: 5px;
  }

  .game-header .tile-card {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 42px;
    padding: 5px 6px;
  }

  .game-header .tile-facts {
    grid-column: 1 / -1;
    overflow: hidden;
    max-height: 18px;
  }
}

/* ---------- Centered tile background icons ---------- */
.tile-bg-icon {
  left: 50%;
  top: 54%;
  right: auto;
  bottom: auto;
  width: 66%;
  color: color-mix(in srgb, var(--tile-accent) 80%, #2a1f12);
  opacity: .34;
  transform: translate(-50%, -50%) rotate(-6deg);
}

.tile-side-top .tile-bg-icon,
.tile-side-left .tile-bg-icon,
.tile-side-right .tile-bg-icon {
  left: 50%;
  top: 54%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%) rotate(-6deg);
}

.tile-bg-icon .tile-marker svg {
  stroke-width: 2.25;
}

.tile:hover .tile-bg-icon,
.tile:focus-visible .tile-bg-icon,
.tile.is-peek .tile-bg-icon,
.tile.active-tile .tile-bg-icon {
  opacity: .43;
}

.tile .tokens {
  z-index: 6;
}

@media (max-width: 639px) {
  .tile-bg-icon {
    top: 55%;
    width: 70%;
    opacity: .38;
  }
}

/* ---------- Player token visibility ---------- */
.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  left: -2px;
  bottom: -2px;
}

@media (max-width: 639px) {
  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    left: -2px;
    bottom: -2px;
  }
}

/* ---------- Mobile players: two per row ---------- */
@media (max-width: 639px) {
  .hud {
    width: 100%;
  }

  .players-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding: 0 0 8px;
  }

  .pchip {
    min-width: 0;
    width: 100%;
    padding: 7px 8px;
    border-left-width: 4px;
  }

  .pchip .pc-name {
    min-width: 0;
    font-size: .75rem;
    line-height: 1.05;
  }

  .pchip .pc-cash {
    margin-top: 3px;
    font-size: .95rem;
    line-height: 1;
  }

  .pchip .pc-place {
    font-size: .64rem;
    line-height: 1.1;
  }

  .pchip .pc-sub {
    font-size: .6rem;
    line-height: 1.1;
  }
}

/* ---------- Board clarity and action surface pass ---------- */
.tile-face {
  grid-template-rows: minmax(14px, var(--tile-plate-h, 15px)) minmax(18px, auto);
}

.tile-plate {
  min-height: 14px;
  padding: 1px 3px;
}

.tile-name-mini {
  font-size: var(--name-font, 7px);
  line-height: .98;
  white-space: nowrap;
}

.tile.is-name-hidden .tile-face {
  grid-template-rows: 10px minmax(18px, auto);
}

.tile.is-name-hidden .tile-plate {
  min-height: 10px;
}

.tile-bg-icon,
.tile-side-top .tile-bg-icon,
.tile-side-left .tile-bg-icon,
.tile-side-right .tile-bg-icon {
  left: 50%;
  top: 55%;
  right: auto;
  bottom: auto;
  width: 72%;
  opacity: .5;
  transform: translate(-50%, -50%) rotate(0deg);
}

.tile-bg-icon .tile-marker svg {
  stroke-width: 2.35;
}

.tile:hover .tile-bg-icon,
.tile:focus-visible .tile-bg-icon,
.tile.is-peek .tile-bg-icon,
.tile.active-tile .tile-bg-icon {
  opacity: .62;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  left: auto;
  right: -2px;
  bottom: -2px;
  justify-content: end;
}

.tile .tokens.token-count-1 {
  width: 20px;
  grid-template-columns: 17px;
}

.tile .tokens.token-count-2 {
  width: 33px;
  grid-template-columns: repeat(2, 16px);
}

.tile .tokens.token-count-3,
.tile .tokens.token-count-4 {
  width: 34px;
  grid-template-columns: repeat(2, 16px);
  grid-template-rows: repeat(2, 16px);
}

.board-log-toggle {
  top: 14px;
  right: 14px;
  bottom: auto;
}

.board-log {
  inset: 56px 14px 46px;
}

.state-guide {
  width: min(78%, 360px);
  display: grid;
  gap: 3px;
  border: 1px solid rgba(157, 227, 207, .22);
  border-radius: 8px;
  background: rgba(6, 38, 30, .38);
  color: rgba(249, 241, 223, .86);
  padding: 8px 10px;
  font-size: .72rem;
  font-weight: 760;
  line-height: 1.16;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.state-guide:empty {
  display: none;
}

.state-guide b {
  color: #fff4d8;
  font-size: .76rem;
  font-weight: 920;
}

.state-guide span,
.state-guide small {
  display: block;
}

.state-guide small {
  color: #9de3cf;
  font-size: .66rem;
  font-weight: 780;
}

.build-preview {
  cursor: default;
}

@media (max-width: 639px) {
  .tile-face {
    grid-template-rows: minmax(11px, var(--tile-plate-h, 12px)) minmax(15px, auto);
  }

  .tile-plate {
    min-height: 11px;
    padding: 1px 2px;
  }

  .tile-name-mini {
    font-size: var(--name-font, 5.4px);
  }

  .tile.is-name-hidden .tile-face {
    grid-template-rows: 8px minmax(15px, auto);
  }

  .tile.is-name-hidden .tile-plate {
    min-height: 8px;
  }

  .tile-bg-icon,
  .tile-side-top .tile-bg-icon,
  .tile-side-left .tile-bg-icon,
  .tile-side-right .tile-bg-icon {
    top: 55%;
    width: 76%;
    opacity: .56;
    transform: translate(-50%, -50%) rotate(0deg);
  }

  .tile:hover .tile-bg-icon,
  .tile:focus-visible .tile-bg-icon,
  .tile.is-peek .tile-bg-icon,
  .tile.active-tile .tile-bg-icon {
    opacity: .66;
  }

  .tile .tokens,
  .tile-side-bottom .tokens,
  .tile-side-top .tokens,
  .tile-side-left .tokens,
  .tile-side-right .tokens {
    left: auto;
    right: -2px;
    bottom: -2px;
  }

  .tile .tokens.token-count-1 {
    width: 18px;
    grid-template-columns: 15px;
  }

  .tile .tokens.token-count-2,
  .tile .tokens.token-count-3,
  .tile .tokens.token-count-4 {
    width: 30px;
    grid-template-columns: repeat(2, 14px);
    grid-template-rows: repeat(2, 14px);
  }

  .board-log-toggle {
    top: 10px;
    right: 10px;
    min-height: 30px;
    padding: 5px 9px;
  }

  .board-log {
    inset: 48px 10px 46px;
  }

  .state-guide {
    width: min(84%, 310px);
    padding: 7px 9px;
    font-size: .66rem;
  }

  .state-guide b {
    font-size: .7rem;
  }
}

/* ---------- Final gameplay UX pass: cascade winner ---------- */
.leave-btn {
  align-self: center;
  min-height: 32px;
  border: 1px solid rgba(246, 239, 224, .16);
  border-radius: 7px;
  background: rgba(247, 241, 228, .08);
  color: #fff1d3;
  padding: 6px 10px;
  font: inherit;
  font-size: .7rem;
  font-weight: 900;
  cursor: pointer;
}

.leave-btn[hidden] {
  display: none;
}

.leave-btn:hover {
  background: rgba(247, 241, 228, .14);
}

.game-header .turn-panel {
  padding: 0;
  border-left: 1px solid rgba(246, 239, 224, .13);
}

.game-header .tile-panel {
  height: 100%;
}

.game-header .tile-card {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-content: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 10px;
}

.game-header .tile-card-head {
  min-width: 0;
}

.game-header .tile-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .tile-facts {
  grid-column: 1 / -1;
  overflow: hidden;
  max-height: 20px;
}

.tile-face {
  grid-template-rows: minmax(15px, var(--tile-plate-h, 16px)) minmax(19px, auto);
}

.tile-plate {
  min-height: 15px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1px 4px;
}

.tile-name-mini {
  width: 100%;
  min-width: 0;
  color: var(--name-ink, #1e251f);
  font-size: var(--name-font, 7.2px);
  line-height: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile.is-name-hidden .tile-name-mini {
  opacity: 1;
  visibility: visible;
}

.tile-bg-icon,
.tile-side-top .tile-bg-icon,
.tile-side-left .tile-bg-icon,
.tile-side-right .tile-bg-icon {
  left: 50%;
  top: auto;
  right: auto;
  bottom: 2px;
  width: 68%;
  opacity: .22;
  transform: translateX(-50%) rotate(0deg);
}

.tile:hover .tile-bg-icon,
.tile:focus-visible .tile-bg-icon,
.tile.is-peek .tile-bg-icon,
.tile.active-tile .tile-bg-icon {
  opacity: .32;
}

.tile.owned-tile .tile-price-big {
  opacity: .34;
}

.tile .tokens,
.tile-side-bottom .tokens,
.tile-side-top .tokens,
.tile-side-left .tokens,
.tile-side-right .tokens {
  left: auto;
  right: -2px;
  bottom: -2px;
  justify-content: end;
}

.board-log-toggle {
  top: 14px;
  right: 14px;
  bottom: auto;
}

.board.is-log-open .center-turn,
.board.is-log-open .state-guide,
.board.is-log-open .dice,
.board.is-log-open .actions {
  opacity: 1;
  transform: translateY(-18%);
}

.board-log {
  inset: auto 14px 14px;
  height: min(42%, 250px);
}

.tile-move-from .tile-face {
  animation: moveFromPulse .9s ease-out;
}

.tile-move-to .tile-face {
  animation: moveToPulse 1.05s ease-out;
}

.tile-purchased .tile-face {
  animation: purchasedPress 1.15s cubic-bezier(.2, .8, .2, 1);
}

.tile-built .tile-face {
  animation: builtPulse 1.1s ease-out;
}

.ptoken-pin.is-arriving {
  animation: tokenArrive .72s cubic-bezier(.2, .9, .2, 1);
}

@keyframes moveFromPulse {
  0% { filter: brightness(1.2); box-shadow: inset 0 0 0 2px rgba(255, 211, 134, .9), 0 0 16px rgba(255, 211, 134, .65); }
  100% { filter: brightness(1); }
}

@keyframes moveToPulse {
  0% { transform: translateZ(0) scale(1); }
  35% { transform: translateZ(18px) scale(1.09); box-shadow: inset 0 0 0 2px #58c7ff, 0 0 24px rgba(54, 164, 255, .9); }
  100% { transform: translateZ(0) scale(1); }
}

@keyframes purchasedPress {
  0% { transform: translateY(0) scale(1); box-shadow: inset 0 0 0 2px var(--owner-color, #ffd386), 0 0 28px color-mix(in srgb, var(--owner-color, #ffd386) 72%, transparent); }
  45% { transform: translateY(3px) scale(.985); filter: brightness(.96); }
  78% { transform: translateY(1px) scale(.998); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes builtPulse {
  0% { box-shadow: inset 0 0 0 2px #79c765, 0 0 24px rgba(121, 199, 101, .9); }
  45% { transform: translateZ(14px) scale(1.06); }
  100% { transform: translateZ(0) scale(1); }
}

@keyframes tokenArrive {
  0% { transform: translateY(-18px) scale(.65); opacity: .15; }
  55% { transform: translateY(-4px) scale(1.2); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

@media (min-width: 900px) {
  #screen-game.active {
    height: 100svh;
    overflow: hidden;
  }

  .game-header {
    grid-template-columns: 66px minmax(230px, .54fr) auto minmax(360px, 1fr);
    width: calc(100vw - 44px);
  }

  .game-layout {
    width: calc(100vw - 44px);
    height: calc(100svh - 104px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 34vw);
    align-items: stretch;
    gap: 16px;
  }

  .board-rail {
    height: 100%;
    align-content: start;
  }

  .board {
    width: min(100%, calc(100svh - 104px));
    max-width: none;
    height: auto;
    margin: 0;
  }

  .hud {
    width: auto;
    min-width: 0;
  }

  .players-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .pchip {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: 50px 1fr auto;
  }

  .leave-btn {
    min-height: 28px;
    padding: 5px 8px;
    font-size: .64rem;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(246, 239, 224, .13);
  }

  .tile-face {
    grid-template-rows: minmax(12px, var(--tile-plate-h, 13px)) minmax(16px, auto);
  }

  .tile-plate {
    min-height: 12px;
    padding: 1px 3px;
  }

  .tile-name-mini {
    font-size: var(--name-font, 5.8px);
  }

  .tile-bg-icon,
  .tile-side-top .tile-bg-icon,
  .tile-side-left .tile-bg-icon,
  .tile-side-right .tile-bg-icon {
    bottom: 1px;
    width: 72%;
    opacity: .24;
    transform: translateX(-50%) rotate(0deg);
  }

  .board.is-log-open .center-turn,
  .board.is-log-open .state-guide,
  .board.is-log-open .dice,
  .board.is-log-open .actions {
    transform: translateY(-22%);
  }

  .board-log {
    inset: auto 10px 10px;
    height: min(42%, 230px);
  }
}
