/* Final visual overrides loaded after the accumulated main stylesheet. */

.lobby-card {
  max-width: 470px;
  overflow: hidden;
  padding: 0;
}

.lobby-hero {
  --lobby-art: url('/assets/design-system/world-route-center.png');
  position: relative;
  min-height: 142px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  background: #173a31;
  color: #fff6e4;
  padding: 22px 24px 20px;
  isolation: isolate;
}

body[data-theme="beer"] .lobby-hero {
  --lobby-art: url('/assets/design-system/beer-route-center.png');
  background: #3d2c21;
}

.lobby-hero::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  background: linear-gradient(90deg, rgba(16, 48, 40, .98) 0 38%, rgba(16, 48, 40, .62)), var(--lobby-art) 72% 46% / cover no-repeat;
  filter: saturate(.65) contrast(.9);
}

body[data-theme="beer"] .lobby-hero::before {
  background: linear-gradient(90deg, rgba(55, 36, 24, .98) 0 38%, rgba(55, 36, 24, .56)), var(--lobby-art) 72% 48% / cover no-repeat;
}

.lobby-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8px;
  border: 1px solid rgba(255, 246, 228, .2);
  border-radius: 6px;
  pointer-events: none;
}

.lobby-hero-brand span {
  display: block;
  margin-bottom: 4px;
  color: #d9aa48;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: none;
}

.lobby-hero h2 {
  margin: 0;
  color: inherit;
  font-size: clamp(2rem, 8vw, 2.8rem);
  letter-spacing: -.055em;
  line-height: .9;
}

.lobby-hero-meta {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.lobby-route,
.lobby-count {
  display: grid;
  border: 1px solid rgba(255, 246, 228, .24);
  border-radius: 7px;
  background: rgba(9, 29, 24, .48);
  padding: 7px 9px;
  backdrop-filter: blur(6px);
}

.lobby-route small,
.lobby-count small {
  color: rgba(255, 246, 228, .6);
  font-size: .48rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lobby-route strong { max-width: 112px; overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.lobby-count { min-width: 54px; text-align: center; }
.lobby-count b { color: #efc360; font-size: 1rem; line-height: 1; }

.lobby-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 24px 24px;
}

.lobby-role {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(204, 157, 60, .55);
  border-radius: 12px;
  background: rgba(212, 164, 65, .12);
  padding: 12px 14px;
}

.lobby-role:empty { display: none; }
.lobby-role b { color: var(--ink, #173930); font-size: 13px; }
.lobby-role span { color: rgba(23, 57, 48, .66); font-size: 11px; line-height: 1.35; }

@media (max-width: 480px) {
  .lobby-hero { min-height: 132px; align-items: flex-start; padding: 20px 18px; }
  .lobby-hero-meta { align-items: stretch; gap: 5px; }
  .lobby-route { width: 104px; padding-inline: 7px; }
  .lobby-route strong { max-width: 90px; overflow: visible; font-size: .61rem; line-height: 1.05; text-overflow: clip; white-space: normal; }
  .lobby-count { min-width: 48px; padding-inline: 6px; }
  .lobby-content { padding: 18px; }
}

.game-header {
  align-items: stretch;
  grid-template-columns: 66px minmax(210px, .42fr) minmax(0, 1fr) 78px !important;
}

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

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

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

.game-header .turn-panel {
  min-width: 0;
  order: 4;
}

.game-header .game-brand {
  order: 1;
}

.game-header .game-status {
  order: 2;
}

.lobby-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.lobby-actions .btn {
  min-height: 44px;
}

.lobby-actions #start-btn[hidden] {
  display: none;
}

.lobby-actions #start-btn[hidden] + #change-name-btn {
  grid-column: 1 / -1;
}

.lobby-share {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(30, 37, 31, .12);
  border-bottom: 1px solid rgba(30, 37, 31, .12);
  padding: 8px 0;
}

.lobby-share span {
  display: block;
  color: #68756d;
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.lobby-share strong {
  display: block;
  max-width: 220px;
  overflow: hidden;
  color: #294438;
  font-size: .68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-share .btn {
  min-height: 34px;
  padding: 6px 9px;
  font-size: .72rem;
}

.games-directory {
  margin-top: 14px;
  border-top: 1px solid rgba(28, 46, 37, .12);
  padding-top: 11px;
}

.games-directory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.games-directory h2 {
  margin: 0;
  color: #253a30;
  font-size: .78rem;
  font-weight: 900;
}

.games-refresh {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(31, 72, 55, .08);
  color: #2a614d;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.games-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.games-empty {
  margin: 0;
  color: #758178;
  font-size: .72rem;
  line-height: 1.3;
}

.game-directory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(31, 72, 55, .11);
  border-radius: 7px;
  background: rgba(255, 255, 255, .7);
  padding: 9px 10px;
}

.game-directory-meta {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.game-directory-meta b {
  color: #243b30;
  font-size: .8rem;
  line-height: 1.05;
}

.game-directory-meta span,
.game-directory-meta small {
  overflow: hidden;
  color: #78847c;
  font-size: .67rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-directory-meta em {
  overflow: hidden;
  color: #a1783c;
  font-size: .65rem;
  font-style: normal;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-join-btn {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  background: #e0af50;
  color: #253026;
  padding: 5px 8px;
  font: inherit;
  font-size: .67rem;
  font-weight: 900;
  cursor: pointer;
}

.game-header .gs-copy::before,
.game-header .turn-info::before {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 242, 216, .56);
  font-size: .56rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.game-header .gs-copy::before {
  content: "Статус партии";
}

.game-header .turn-info::before {
  content: "Действие игрока";
}

.tile {
  overflow: visible !important;
}

.board .tile > .tile-detail.tile-detail {
  z-index: 260 !important;
  display: block;
  width: clamp(172px, 20vw, 228px);
  min-height: 134px;
  border: 1px solid rgba(30, 42, 35, .16);
  border-left: 7px solid var(--tile-accent, #d89a32);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .99), rgba(246, 241, 229, .98));
  color: #17241c;
  box-shadow: 0 20px 44px rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .86) inset;
  padding: 11px 12px 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  translate: var(--detail-nudge-x, 0px) var(--detail-nudge-y, 0px);
}

.tile:hover,
.tile:focus-visible,
.tile.is-peek {
  z-index: 240 !important;
}

.board .tile:hover > .tile-detail.tile-detail,
.board .tile:focus-visible > .tile-detail.tile-detail,
.board .tile.is-peek > .tile-detail.tile-detail {
  opacity: 1;
  visibility: visible;
}

.board .tile-side-bottom > .tile-detail.tile-detail {
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(8px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(.92);
  transform-origin: 50% 100%;
}

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

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

.board .tile-side-right > .tile-detail.tile-detail {
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(8px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) scale(.92);
  transform-origin: 100% 50%;
}

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

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

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

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

.tile-detail .td-kind {
  color: rgba(31, 45, 36, .62);
  font-size: .64rem;
  font-weight: 880;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tile-detail .td-name {
  margin-top: 5px;
  color: #14231a;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: 0;
}

.tile-detail .td-price {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(30, 42, 35, .08);
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: rgba(23, 36, 28, .88);
  padding: 3px 8px;
  font-size: .76rem;
  font-weight: 780;
  line-height: 1.1;
}

.tile-detail .td-owner {
  margin-top: 7px;
  color: #1b755f;
  font-size: .72rem;
  font-weight: 780;
  line-height: 1.16;
}

.tile-detail .td-build,
.tile-detail .td-rent {
  margin-top: 6px;
  color: rgba(23, 36, 28, .72);
  font-size: .68rem;
  font-weight: 720;
  line-height: 1.18;
}

.tile-detail .td-build {
  color: #725422;
}

.tile-detail p {
  margin-top: 8px;
  color: rgba(23, 36, 28, .82);
  font-size: .74rem;
  font-weight: 640;
  line-height: 1.28;
}

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

.board .tile.owned-tile:not(.active-tile) .tile-face {
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--owner-color, #ffd386) 62%, rgba(23, 36, 28, .18)),
    inset 0 -5px 0 var(--owner-color, #ffd386),
    0 3px 10px rgba(0, 0, 0, .12);
}

.board .tile .owner-dot {
  width: 10px;
  height: 10px;
  border-width: 2px;
  z-index: 4;
}

.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;
}

.board .tile .tokens .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 !important; bottom: 0 !important; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(2) { right: 12px !important; bottom: 0 !important; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(3) { right: 24px !important; bottom: 0 !important; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(4) { right: 6px !important; bottom: 14px !important; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(5) { right: 18px !important; bottom: 14px !important; }
.board .tile .tokens.has-many .ptoken-pin:nth-child(6) { right: 30px !important; bottom: 14px !important; }

.players-bar {
  gap: 10px !important;
  align-items: stretch;
}

.pchip {
  min-height: 108px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 0;
  border-left-width: 8px !important;
  border-radius: 8px;
  background: #e4e8e3 !important;
  color: #223229 !important;
  padding: 10px 11px 9px 12px !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .62) inset, 0 8px 18px rgba(0, 0, 0, .1);
}

.pchip.is-turn {
  border-left-width: 10px !important;
  background: #fff !important;
  color: #13231b !important;
  box-shadow: 0 0 0 1px rgba(255, 211, 134, .48), 0 12px 24px rgba(0, 0, 0, .16);
}

.pchip .pc-name {
  min-width: 0;
  color: inherit !important;
  font-size: .82rem !important;
  font-weight: 880 !important;
  line-height: 1.08 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pchip .pc-cash {
  margin-top: 5px !important;
  color: inherit !important;
  font-size: 1.42rem !important;
  font-weight: 900 !important;
  font-variant-numeric: tabular-nums;
  line-height: .92 !important;
  letter-spacing: 0;
}

.pchip .pc-place {
  margin-top: 7px !important;
  color: rgba(30, 42, 35, .82) !important;
  font-size: .7rem !important;
  font-weight: 780 !important;
  line-height: 1.16 !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pchip .pc-sub {
  margin-top: 2px !important;
  color: rgba(30, 42, 35, .68) !important;
  font-size: .66rem !important;
  font-weight: 680 !important;
  line-height: 1.14 !important;
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.build-btn.sell-btn {
  background: rgba(255, 255, 255, .82);
  border-color: rgba(114, 84, 34, .24);
}

.game-header .build-btn,
.game-header .build-empty {
  opacity: 1 !important;
  background: rgba(255, 255, 255, .92) !important;
  color: #17241c !important;
}

.game-header .build-btn b {
  color: #17241c !important;
}

.game-header .build-btn small {
  color: rgba(23, 36, 28, .7) !important;
}

.game-header .build-btn.sell-btn {
  background: rgba(255, 247, 232, .94) !important;
}

.build-btn.sell-btn .build-icon {
  color: #8a6428;
  font-size: 1.24rem;
  font-weight: 900;
}

.tile-sold-build .tile-face {
  animation: soldBuildPulse 1.05s ease-out;
}

.tile-move-to .tile-face {
  animation: redMoveToPulse 1.1s ease-out !important;
  box-shadow:
    inset 0 0 0 3px #ff3b30,
    0 0 0 3px rgba(255, 120, 108, .66),
    0 0 28px rgba(255, 59, 48, .92),
    0 0 44px rgba(255, 59, 48, .44) !important;
}

.tile-move-from::after,
.tile-move-to::after,
.tile-purchased::after,
.tile-built::after,
.tile-sold-build::after {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) !important;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  color: #17241c;
  padding: 3px 7px;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
  animation: tileEventLabel 1s ease-out both;
}

.tile-move-from::after { content: "ушёл"; }
.tile-move-to::after {
  content: "пришёл";
  background: rgba(255, 238, 234, .96);
  color: #9f1d18;
  box-shadow: 0 6px 16px rgba(159, 29, 24, .3);
}
.tile-purchased::after { content: "куплено"; }
.tile-built::after { content: "дом"; }
.tile-sold-build::after { content: "продано"; }

@keyframes soldBuildPulse {
  0% { box-shadow: inset 0 0 0 2px #c08b34, 0 0 24px rgba(192, 139, 52, .8); filter: brightness(1.08); }
  45% { transform: translateY(2px) scale(.99); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}

@keyframes redMoveToPulse {
  0% {
    transform: translateZ(0) scale(1);
    filter: brightness(1.08);
    box-shadow:
      inset 0 0 0 2px #ff5b4d,
      0 0 0 2px rgba(255, 113, 97, .58),
      0 0 24px rgba(255, 69, 58, .9);
  }
  36% {
    transform: translateZ(18px) scale(1.09);
    filter: brightness(1.12);
    box-shadow:
      inset 0 0 0 3px #ff3b30,
      0 0 0 3px rgba(255, 120, 108, .62),
      0 0 32px rgba(255, 59, 48, .92),
      0 0 48px rgba(255, 59, 48, .42);
  }
  100% {
    transform: translateZ(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes tileEventLabel {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(.9); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(.96); }
}

.board .tile-name-mini {
  font-size: var(--name-font, 9.4px) !important;
  line-height: 1.02;
}

@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;
  }

  .lobby-actions {
    grid-template-columns: 1fr;
  }

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

  .board .tile > .tile-detail.tile-detail {
    width: min(210px, calc(100vw - 34px));
    min-height: 122px;
    padding: 10px 11px 11px;
  }

  .tile-detail .td-name {
    font-size: .96rem;
  }

  .tile-detail p {
    font-size: .69rem;
  }

  .board-mode-scroll .board-rail {
    overscroll-behavior: none;
    touch-action: none;
  }

  .board .tile-name-mini {
    font-size: var(--name-font, 7.8px) !important;
  }

  .tile .tile-price-big {
    left: 0 !important;
    bottom: 0 !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;
  }

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

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

  .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 {
    max-width: var(--center-ui-width, 78%) !important;
    transform: translateX(var(--center-ui-shift-x, 0px)) !important;
  }

  .board-mode-scroll .board-center .state-guide,
  .board-mode-scroll .board-center .actions {
    width: min(var(--center-ui-width, 78%), 310px) !important;
  }

  .board-mode-scroll .board-log-toggle {
    transform: translateX(var(--center-log-shift-x, var(--center-ui-shift-x, 0px))) !important;
  }

  .board-mode-scroll .board-log {
    left: 0 !important;
    right: auto !important;
    width: min(var(--center-ui-width, calc(100vw - 32px)), 320px) !important;
    transform: translateX(var(--center-log-panel-shift-x, 0px)) !important;
  }

  .players-bar {
    gap: 8px !important;
  }

  .pchip {
    min-height: 82px;
    border-left-width: 6px !important;
    padding: 8px 8px 7px 9px !important;
  }

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

  .pchip .pc-name {
    font-size: .72rem !important;
  }

  .pchip .pc-cash {
    margin-top: 4px !important;
    font-size: 1.12rem !important;
  }

  .pchip .pc-place {
    margin-top: 5px !important;
    font-size: .61rem !important;
    -webkit-line-clamp: 1;
  }

  .pchip .pc-sub {
    font-size: .58rem !important;
  }
}

/* ---------- Закрытые комнаты ---------- */
.field-label small {
  color: var(--muted);
  font-size: .72em;
  font-weight: 650;
}

.game-directory-row.is-protected {
  border-color: rgba(164, 111, 28, .38);
}

.room-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #74521d;
  font-weight: 800;
}

.room-password-modal {
  width: min(420px, calc(100vw - 28px));
  border-radius: 18px;
  background: var(--paper, #fffaf0);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(8, 35, 28, .3);
}

.room-password-modal h2 {
  margin: 0 0 6px;
}

.room-password-modal > p {
  margin: 0 0 18px;
  color: var(--muted);
}

.room-password-modal input {
  width: 100%;
  box-sizing: border-box;
}

.room-password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- Replay ---------- */
.replay-controls {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto auto auto minmax(140px, 1fr) minmax(160px, auto);
  align-items: center;
  gap: 8px;
  width: min(900px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(246, 239, 224, .18);
  border-radius: 10px;
  background: rgba(5, 28, 23, .88);
  padding: 7px;
  color: #fff2d8;
}

.replay-controls[hidden] {
  display: none;
}

.replay-controls label,
#replay-caption {
  font-size: .76rem;
  font-weight: 780;
}

#replay-position {
  min-width: 0;
  accent-color: var(--ds-mustard, #f1bd58);
}

body.is-replay #leave-btn {
  display: none;
}

body.is-replay #build-panel,
body.is-replay #actions {
  pointer-events: none;
}

@media (max-width: 720px) {
  .replay-controls {
    grid-template-columns: auto auto 1fr;
  }

  .replay-controls label {
    display: none;
  }

  #replay-position,
  #replay-caption {
    grid-column: 1 / -1;
    width: 100%;
  }
}

/* ---------- History overlay must preserve turn context ---------- */
.board.is-log-open .center-turn,
.board.is-log-open .state-guide,
.board.is-log-open .dice,
.board.is-log-open .actions {
  opacity: 1 !important;
  transform: translateY(-84px) !important;
}

.board-log {
  height: min(34%, 190px) !important;
}

@media (max-width: 639px) {
  .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), -84px) !important;
  }

  .board-log {
    height: min(30%, 178px) !important;
  }
}

/* ---------- Compact game header pass ---------- */
.game-header {
  min-height: 46px !important;
  grid-template-columns: 52px minmax(174px, .36fr) minmax(0, 1fr) 64px !important;
  align-items: stretch !important;
  overflow: hidden;
}

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

.game-header .game-brand {
  min-width: 52px !important;
  padding: 5px 6px !important;
  gap: 0 !important;
}

.game-header .game-logo {
  font-size: 1.02rem !important;
  line-height: .9 !important;
}

.game-header .game-subtitle {
  margin-top: 1px !important;
  font-size: .52rem !important;
  line-height: 1 !important;
}

.game-header .game-status {
  min-width: 0;
  gap: 7px !important;
  padding: 5px 8px !important;
}

.game-header .gs-copy::before,
.game-header .turn-info::before {
  display: none !important;
}

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

.game-header .gs-title {
  overflow: hidden;
  color: #fff4de !important;
  font-size: .78rem !important;
  font-weight: 880 !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .gs-meta {
  margin-top: 2px !important;
  overflow: hidden;
  color: rgba(255, 244, 222, .66) !important;
  font-size: .61rem !important;
  font-weight: 720 !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .gs-badge {
  max-width: 88px;
  overflow: hidden;
  border-radius: 999px !important;
  padding: 3px 7px !important;
  font-size: .58rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .turn-panel {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(180px, .42fr) !important;
  align-content: stretch !important;
  align-items: center !important;
  gap: 2px !important;
  padding: 4px 6px !important;
  overflow: hidden;
}

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

.game-header .tile-panel {
  min-width: 0;
  height: auto !important;
}

.game-header .tile-card {
  min-height: 28px !important;
  height: auto !important;
  grid-template-columns: minmax(116px, .38fr) minmax(0, 1fr) !important;
  gap: 3px 7px !important;
  align-items: center !important;
  align-content: center !important;
  border-left-width: 3px !important;
  padding: 3px 6px !important;
}

.game-header .tile-card-head {
  min-width: 0;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px !important;
  align-items: center !important;
}

.game-header .tile-kind {
  overflow: hidden;
  color: rgba(255, 244, 222, .54) !important;
  font-size: .5rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .tile-title {
  margin-top: 1px !important;
  overflow: hidden;
  color: #fff4de !important;
  font-size: .75rem !important;
  font-weight: 900 !important;
  line-height: 1.02 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .tile-presence {
  min-width: 20px !important;
  max-width: 54px;
  overflow: hidden;
  color: #fff4de !important;
  font-size: .76rem !important;
  line-height: 1 !important;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .tile-facts {
  min-width: 0;
  max-height: 20px !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 3px !important;
  overflow: hidden !important;
}

.game-header .tile-facts span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  border-radius: 999px !important;
  padding: 2px 5px !important;
  font-size: .53rem !important;
  font-weight: 820 !important;
  line-height: 1 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .build-panel {
  grid-column: auto !important;
  min-width: 0;
  align-self: center;
  overflow: hidden;
}

.game-header .build-options {
  display: flex !important;
  gap: 4px !important;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.game-header .build-options::-webkit-scrollbar {
  display: none;
}

.game-header .build-empty,
.game-header .build-btn {
  flex: 0 0 auto;
  min-height: 22px !important;
  max-width: 180px;
  border-radius: 999px !important;
  padding: 3px 7px !important;
  font-size: .56rem !important;
  line-height: 1 !important;
}

.game-header .build-btn .build-icon {
  font-size: .78rem !important;
}

.game-header .build-btn b,
.game-header .build-btn small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-header .leave-btn {
  min-width: 64px !important;
  padding: 4px 6px !important;
  font-size: .62rem !important;
  line-height: 1 !important;
}

@media (min-width: 900px) {
  .game-layout {
    height: calc(100svh - 68px) !important;
  }
}

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

  .game-header .game-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .game-header .game-status {
    grid-column: 2;
    grid-row: 1;
  }

  .game-header .leave-btn {
    grid-column: 3;
    grid-row: 1;
    order: 3;
  }

  .game-header .turn-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 4;
    grid-template-columns: minmax(0, 1fr) minmax(120px, .38fr) !important;
    min-height: 34px !important;
    border-top: 1px solid rgba(246, 239, 224, .1);
  }

  .game-header .tile-card {
    grid-template-columns: minmax(96px, .34fr) minmax(0, 1fr) !important;
  }

  .game-header .tile-facts {
    display: none !important;
    max-height: 0 !important;
  }

  .game-header .build-btn small {
    display: none !important;
  }

  .game-header .build-empty,
  .game-header .build-btn {
    min-height: 24px !important;
  }
}

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

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

  .game-header .game-brand {
    min-width: 46px !important;
    padding: 4px 5px !important;
  }

  .game-header .game-logo {
    font-size: .92rem !important;
  }

  .game-header .game-subtitle {
    font-size: .48rem !important;
  }

  .game-header .game-status {
    padding: 4px 6px !important;
  }

  .game-header .gs-title {
    font-size: .7rem !important;
  }

  .game-header .gs-meta {
    font-size: .56rem !important;
  }

  .game-header .gs-badge {
    max-width: 68px;
    padding: 3px 5px !important;
    font-size: .52rem !important;
  }

  .game-header .leave-btn {
    min-width: 56px !important;
    padding: 4px 5px !important;
    font-size: .56rem !important;
  }

  .game-header .turn-panel {
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 26px !important;
    padding: 3px 4px !important;
  }

  .game-header .tile-card {
    min-height: 22px !important;
    grid-template-columns: minmax(92px, .48fr) minmax(0, 1fr) !important;
    gap: 2px 5px !important;
    border-left-width: 2px !important;
    padding: 2px 5px !important;
  }

  .game-header .tile-kind {
    display: none;
  }

  .game-header .tile-title {
    font-size: .68rem !important;
  }

  .game-header .tile-presence {
    font-size: .68rem !important;
  }

  .game-header .tile-facts {
    display: none !important;
    max-height: 0 !important;
  }

  .game-header .tile-facts span {
    padding: 2px 4px !important;
    font-size: .48rem !important;
  }

  .game-header .build-panel:not(:empty) {
    margin-top: 2px;
  }

  .game-header .build-empty,
  .game-header .build-btn {
    min-height: 22px !important;
    max-width: 150px;
    padding: 3px 6px !important;
    font-size: .52rem !important;
  }

  .game-header .build-btn small {
    display: none !important;
  }
}

/* ---------- Single-line command header ---------- */
.game-header {
  position: relative;
  z-index: 320;
  min-height: 44px !important;
  grid-template-columns: 52px minmax(184px, .34fr) minmax(0, 1fr) 58px !important;
  overflow: visible !important;
}

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

.game-header .game-brand {
  grid-column: 1;
  grid-row: 1;
}

.game-header .game-status {
  grid-column: 2;
  grid-row: 1;
}

.game-header .turn-panel {
  grid-column: 3;
  grid-row: 1;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 6px !important;
  border-top: 0 !important;
  border-left: 1px solid rgba(246, 239, 224, .12) !important;
  padding: 4px 7px !important;
  overflow: visible !important;
}

.game-header .leave-btn {
  grid-column: 4;
  grid-row: 1;
  order: 4;
  min-width: 58px !important;
}

.game-header .tile-panel {
  min-width: 0;
  overflow: hidden;
}

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

.game-header .tile-facts,
.game-header .tile-advice {
  display: none !important;
}

.game-header .build-panel {
  position: relative;
  overflow: visible;
  margin-top: 0 !important;
}

.game-header .build-panel:not(:empty) {
  margin-top: 0 !important;
}

.holdings-toggle {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 244, 222, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
  color: #fff4de;
  padding: 5px 8px;
  font: inherit;
  font-size: .62rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.holdings-toggle:hover,
.holdings-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, .18);
}

.holdings-toggle b,
.holdings-toggle em {
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 244, 222, .9);
  color: #17241c;
  padding: 0 5px;
  font-size: .58rem;
  font-style: normal;
  line-height: 1;
}

.holdings-toggle em {
  background: #e3ae48;
  color: #1f1606;
}

.holdings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 360;
  width: min(330px, calc(100vw - 24px));
  display: none;
  gap: 8px;
  border: 1px solid rgba(255, 244, 222, .22);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(42, 67, 53, .98), rgba(25, 49, 38, .98));
  color: #fff4de;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .38);
  padding: 10px;
}

.holdings-menu.is-open {
  display: grid;
}

.holdings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.holdings-head b {
  font-size: .78rem;
  font-weight: 950;
  line-height: 1;
}

.holdings-head span {
  color: rgba(255, 244, 222, .62);
  font-size: .6rem;
  font-weight: 780;
}

.holdings-list {
  max-height: 190px;
  display: grid;
  gap: 5px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.holding-row,
.holdings-empty {
  min-height: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-left: 4px solid var(--holding-color, #d9a33f);
  border-radius: 7px;
  background: rgba(255, 255, 255, .1);
  padding: 6px 8px;
}

.holding-name {
  overflow: hidden;
  font-size: .72rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-meta,
.holdings-empty {
  color: rgba(255, 244, 222, .68);
  font-size: .58rem;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.holdings-menu .build-title {
  display: block;
  color: rgba(255, 244, 222, .58);
  font-size: .56rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.holdings-menu .build-options {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 5px !important;
  max-height: 154px;
  overflow: auto;
}

.holdings-menu .build-empty,
.holdings-menu .build-btn {
  width: 100%;
  max-width: none;
  min-height: 34px !important;
  justify-content: flex-start;
  border-radius: 8px !important;
  padding: 7px 8px !important;
  font-size: .68rem !important;
}

.holdings-menu .build-btn small {
  display: block !important;
  margin-top: 2px;
}

@media (min-width: 900px) {
  .game-layout {
    height: calc(100svh - 62px) !important;
  }
}

@media (max-width: 899px) {
  .game-header {
    grid-template-columns: 46px minmax(118px, .45fr) minmax(0, 1fr) 54px !important;
  }

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

  .game-header .turn-panel {
    grid-column: 3;
    grid-row: 1;
    grid-template-columns: minmax(0, 1fr) auto !important;
    padding: 4px 5px !important;
  }

  .game-header .tile-card {
    min-height: 28px !important;
  }

  .game-header .tile-kind {
    display: none !important;
  }
}

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

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

  .game-header .game-brand {
    min-width: 42px !important;
    padding: 4px !important;
  }

  .game-header .game-status {
    padding: 4px 5px !important;
  }

  .game-header .gs-meta {
    display: none;
  }

  .game-header .gs-badge {
    display: none;
  }

  .game-header .turn-panel {
    padding: 4px !important;
  }

  .game-header .tile-card {
    min-height: 26px !important;
    padding: 3px 5px !important;
  }

  .game-header .tile-title {
    font-size: .64rem !important;
  }

  .game-header .tile-presence {
    display: none;
  }

  .holdings-toggle {
    min-height: 26px;
    gap: 3px;
    padding: 4px 5px;
    font-size: 0;
  }

  .holdings-toggle span::after {
    content: "Мои";
    font-size: .54rem;
  }

  .holdings-toggle b,
  .holdings-toggle em {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: .52rem;
  }

  .holdings-menu {
    right: -54px;
  }
}

/* Player markers use the player's color as their fill, not as an outline. */
.board .tile .tokens .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin,
.preview-grid .tile .tokens .ptoken-pin {
  border: 0 !important;
  background: var(--player-token-color, #2f80e8) !important;
  color: #fff !important;
  box-shadow: 0 3px 7px rgba(0, 0, 0, .34) !important;
}

.player-token-icon {
  display: block;
  width: 1.28em;
  height: 1.28em;
  object-fit: contain;
}

.player-token-icon--person {
  color: var(--player-token-color, #2f80e8);
  fill: currentColor;
}

.ptoken-player {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  overflow: hidden;
}

#lobby-players .player-token-icon {
  width: 26px;
  height: 26px;
  max-width: 26px;
  max-height: 26px;
  display: block;
}

.player-token-icon--pin {
  width: 112%;
  height: 112%;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .32));
}

.ptoken-pin .player-token-icon--person,
.token-motion-ghost .player-token-icon--person {
  color: #fff;
}

.pc-name {
  display: flex;
  align-items: center;
  gap: 5px;
}

.player-token-icon--name {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.tile-presence {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.player-token-icon--presence {
  width: 16px;
  height: 16px;
  margin-left: -4px;
}

/* Маршрут фишки рисуется поверх поля, а не заменяется телепортацией в конечную клетку. */
.board {
  position: relative;
}

.token-motion-layer {
  position: absolute;
  inset: 0;
  z-index: 280;
  pointer-events: none;
}

.board .ptoken-pin.is-in-motion {
  opacity: 0 !important;
}

.token-motion-ghost {
  position: absolute !important;
  z-index: 1;
  display: grid !important;
  place-items: center;
  width: 27px !important;
  height: 27px !important;
  margin: 0 !important;
  border: 2px solid rgba(255, 255, 255, .94) !important;
  border-radius: 50%;
  background: var(--player-token-color, #2f80e8) !important;
  color: #fff !important;
  font-size: 14px !important;
  line-height: 1;
  transform: translate(-50%, -50%);
  transition: left 135ms cubic-bezier(.22, .8, .28, 1), top 135ms cubic-bezier(.22, .8, .28, 1), transform 135ms ease;
  box-shadow: 0 6px 15px rgba(0, 0, 0, .36), 0 0 0 5px color-mix(in srgb, var(--player-token-color, #2f80e8) 30%, transparent) !important;
  will-change: left, top, transform;
}

.token-motion-ghost.is-landing {
  transform: translate(-50%, -50%) scale(1.16);
}

/* Всплывающее «−N» у клетки плательщика при списании ренты. */
.rent-float {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(207, 77, 69, .96);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  letter-spacing: .01em;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .32);
  pointer-events: none;
  animation: rent-float-rise 1.7s ease-out forwards;
}

@keyframes rent-float-rise {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  18%  { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  70%  { opacity: 1; transform: translate(-50%, -150%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(.96); }
}

@media (max-width: 639px) {
  .rent-float { font-size: 13px; padding: 2px 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .rent-float { animation: none; opacity: 0; }
}

/* Пинта дублируется фоном только в пивной теме: в остальных мирах это человек. */
body[data-theme="beer"] .board .tile .ptoken-pin,
body[data-theme="beer"] .board .tile .tokens.has-many .ptoken-pin,
body[data-theme="beer"] .token-motion-ghost {
  background: var(--player-token-color, #2f80e8) !important;
}

.tile-token-step .tile-face {
  box-shadow: inset 0 0 0 2px rgba(124, 208, 255, .88), 0 0 16px rgba(73, 178, 255, .68) !important;
}

@media (max-width: 639px) {
  .token-motion-ghost {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
  }
}

/* One illustration component is shared by each tile, its hover card and the turn scene. */
.tile-bg-icon .tile-illustration {
  width: 100%;
  height: 100%;
}

.tile-illustration {
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--illustration-accent) 82%, #1d3329);
}

.tile-illustration .tile-marker {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.tile-illustration .tile-marker svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

/* One raster hop cone keeps every beer-world cell legible until themed vectors arrive. */
/* Шишка занимает всю клетку и перевёрнута вверх ногами (запрос пользователя). */
body[data-theme="beer"] .tile-illustration .tile-marker-hop {
  width: 100%;
  height: 100%;
  opacity: .88;
  transform: rotate(180deg);
}

body[data-theme="beer"] .tile-illustration .tile-marker-hop img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-theme="beer"] .tile-bg-icon {
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  opacity: .4;
  transform: none;
}

body[data-theme="beer"] .tile-side-top .tile-bg-icon,
body[data-theme="beer"] .tile-side-left .tile-bg-icon,
body[data-theme="beer"] .tile-side-right .tile-bg-icon {
  inset: 0;
  left: 0;
  top: 0;
  transform: none;
}

body[data-theme="beer"] .tile-illustration--detail .tile-marker-hop {
  width: 52px;
  height: 52px;
  opacity: 1;
}

.tile-illustration--detail {
  width: calc(100% + 20px);
  height: 62px;
  margin: -10px -10px 9px;
  overflow: hidden;
  border-bottom: 1px solid color-mix(in srgb, var(--illustration-accent) 20%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--illustration-accent) 15%, #fffdf7), rgba(255, 255, 255, .96));
  color: color-mix(in srgb, var(--illustration-accent) 88%, #1a3328);
}

.tile-illustration--detail .tile-marker {
  width: 56px;
  height: 56px;
  opacity: .88;
}

.tile-illustration--detail .tile-marker svg {
  width: 46px;
  height: 46px;
}

.tile-detail .td-kind,
.tile-detail .td-name,
.tile-detail .td-price,
.tile-detail .td-owner,
.tile-detail .td-build,
.tile-detail .td-rent,
.tile-detail p {
  position: relative;
  z-index: 1;
}

.board-center .center-illustration {
  position: absolute;
  z-index: 0;
  width: min(46%, 188px);
  aspect-ratio: 1;
  top: 11%;
  left: 50%;
  pointer-events: none;
  opacity: .16;
  transform: translateX(-50%);
}

.board-center .center-illustration .tile-illustration,
.board-center .center-illustration .tile-marker {
  width: 100%;
  height: 100%;
}

.board-center .center-illustration .tile-marker svg {
  stroke-width: 1.4;
}

.board-center .center-turn,
.board-center .state-guide,
.board-center .dice,
.board-center .actions,
.board-center .board-log-toggle,
.board-center .board-log {
  position: relative;
  z-index: 1;
}

/* The active player's command is never allowed to collapse after a reconnect. */
.board-center .actions:not(:empty) {
  display: flex !important;
  min-height: 42px;
  opacity: 1 !important;
  visibility: visible !important;
  position: relative;
  z-index: 6;
}

@media (max-width: 639px) {
  .tile-illustration--detail {
    height: 52px;
  }

  .tile-illustration--detail .tile-marker {
    width: 46px;
    height: 46px;
  }

  .board-center .center-illustration {
    width: min(48%, 132px);
    top: 9%;
    opacity: .13;
  }
}

/* Generated placeholder scenes. A later theme can replace only the source mapping. */
.tile-illustration {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.tile-illustration-image {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.tile-illustration--tile .tile-illustration-image {
  opacity: .34;
  filter: saturate(.72) contrast(.92);
}

body[data-theme="world_cities"] .tile-illustration-image {
  object-fit: contain;
  mix-blend-mode: multiply;
}

.tile-illustration--detail {
  height: 78px;
  background: #eef0e8;
}

.tile-illustration--detail::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 252, 244, .18), rgba(255, 252, 244, .72));
}

.tile-illustration--detail .tile-illustration-image {
  opacity: .92;
}

.tile-illustration--detail .tile-marker {
  position: absolute;
  right: 9px;
  bottom: 8px;
  width: 35px;
  height: 35px;
  color: #fffdf5;
  filter: drop-shadow(0 2px 4px rgba(12, 31, 23, .36));
}

.board-center .center-illustration {
  inset: 0;
  width: auto;
  height: auto;
  aspect-ratio: auto;
  top: 0;
  left: 0;
  overflow: hidden;
  opacity: 1;
  transform: none;
}

.board-center .center-illustration .tile-illustration--center {
  width: 100%;
  height: 100%;
}

.board-center .center-illustration .tile-illustration-image {
  opacity: .56;
  filter: saturate(.8) contrast(.92) brightness(.82);
}

.board-center .center-illustration::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 31, 23, .22), rgba(3, 31, 23, .56));
}

.board-center .center-illustration .tile-marker {
  display: none;
}

@media (max-width: 639px) {
  .tile-illustration--detail {
    height: 62px;
  }

  .tile-illustration--detail .tile-marker {
    width: 30px;
    height: 30px;
    right: 7px;
    bottom: 7px;
  }

  .board-center .center-illustration {
    width: auto;
    height: auto;
    top: 0;
    opacity: 1;
  }
}

/* World selection is part of creating a room, not joining an existing one. */
.create-theme {
  display: grid;
  gap: 7px;
}

.create-theme-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(23, 48, 36, .16);
  border-radius: 7px;
  background: #fff9ec;
  color: #1d3327;
  font: inherit;
  font-size: .84rem;
  font-weight: 800;
  padding: 8px 34px 8px 10px;
  cursor: pointer;
}

.create-theme-select:focus {
  outline: 3px solid rgba(211, 139, 50, .2);
  border-color: #d38b32;
}

.beer-tank-level {
  width: 25px;
  height: 25px;
  display: block;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 5px;
  object-fit: cover;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .24);
}

.build-tank-thumb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
}

body[data-theme="beer"] .board-center::before {
  content: "";
}

body[data-theme="beer"] .board-center {
  background: linear-gradient(135deg, rgba(33, 55, 38, .98), rgba(14, 36, 25, .98));
}

body[data-theme="beer"] .tile-illustration--detail::after {
  background: linear-gradient(90deg, rgba(245, 241, 224, .14), rgba(245, 241, 224, .74));
}

@media (max-width: 639px) {
  .theme-option {
    min-height: 54px;
  }

  .beer-tank-level {
    width: 21px;
    height: 21px;
  }
}

/* ---------- Модалка игрока: владения, продажа, предложение ---------- */
#player-modal { z-index: 70; }

.player-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 84vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid rgba(246, 239, 224, .16);
  background: linear-gradient(180deg, rgba(28, 44, 34, .99), rgba(17, 32, 24, .99));
  color: var(--text, #f4efe4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  backdrop-filter: blur(14px);
}

.player-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.player-modal-close:hover { background: rgba(255, 255, 255, .16); }

.pm-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 34px;
}
.pm-token {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9);
  background: var(--player-token-color, #2f80e8);
  color: #fff;
}
.pm-token .player-token-icon { width: 20px; height: 20px; }
.pm-id { display: flex; flex-direction: column; line-height: 1.25; }
.pm-id b { font-size: 17px; }
.pm-id span { font-size: 13px; opacity: .78; }

.pm-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.pm-section-title { font-size: 13px; font-weight: 700; opacity: .82; }
.pm-empty, .pm-hint { font-size: 13px; opacity: .68; }

.pm-holdings { display: flex; flex-direction: column; gap: 6px; }
.pm-holding {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border-radius: 8px;
  border-left: 4px solid var(--holding-color, #888);
  background: rgba(255, 255, 255, .06);
}
.pm-holding b { font-size: 14px; }
.pm-holding small { font-size: 12px; opacity: .72; }

.pm-actions-list { display: flex; flex-direction: column; gap: 8px; }
.pm-sell-row, .pm-offer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  flex-wrap: wrap;
}
.pm-sell-name { display: flex; flex-direction: column; min-width: 0; }
.pm-sell-name b { font-size: 14px; }
.pm-lock { font-size: 11px; opacity: .6; }
.pm-sell-btns, .pm-offer-ctl { display: flex; align-items: center; gap: 6px; }
.pm-btn { padding: 6px 10px; font-size: 13px; }
.pm-price {
  width: 84px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(0, 0, 0, .25);
  color: inherit;
  font-size: 13px;
}

@media (max-width: 639px) {
  .player-modal { max-width: 100%; padding: 16px; }
  .pm-price { width: 72px; }
}

/* Переключатель «Фрагмент / Всё поле» теперь живёт под полем, вне скролла доски. */
@media (max-width: 639px) {
  .game-layout > .mobile-board-modes {
    position: static;
    left: auto;
    align-self: center;
    justify-content: center;
    margin: 4px auto 2px;
  }
}

/* ---------- Нижняя секция истории (3 события + стрелка раскрытия) ---------- */
.history-strip {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(246, 239, 224, .12);
  background: rgba(20, 34, 26, .55);
}

.history-recent {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
}

.history-recent .l-line {
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .92;
}
.history-recent .l-line.is-muted { opacity: .55; }

.history-expand {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, .08);
  color: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.history-expand:hover { background: rgba(255, 255, 255, .16); }

.history-caret { transition: transform .18s ease; }
.history-strip.is-open .history-caret { transform: rotate(180deg); }

@media (max-width: 639px) {
  .history-strip { padding: 6px 8px; }
  .history-recent .l-line { font-size: 11px; }
}

/* ---------- Карточка игрока: фишка слева-сверху, сумма справа-сверху, без цветной полосы ---------- */
.hud .players-bar .pchip {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line) !important;
  border-left-width: 1px !important;
  padding: 36px 12px 10px !important;
}

.hud .players-bar .pchip .pc-token {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .92);
  background: var(--player-token-color, #2f80e8);
  color: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
}
.hud .players-bar .pchip .pc-token .player-token-icon { width: 16px; height: 16px; }

.hud .players-bar .pchip .pc-cash {
  position: absolute;
  top: 7px;
  right: 11px;
  margin: 0 !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  font-variant-numeric: tabular-nums;
}

.hud .players-bar .pchip .pc-name {
  margin: 0 !important;
  padding-left: 2px;
  min-width: 0;
}

/* Активный игрок: заметно толще обводка, без сдвига раскладки */
.hud .players-bar .pchip.is-turn {
  border-width: 2px !important;
  border-left-width: 2px !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(242, 184, 75, .55), 0 12px 24px rgba(0, 0, 0, .16) !important;
}

@media (max-width: 639px) {
  .hud .players-bar .pchip {
    padding: 30px 9px 8px !important;
  }
  .hud .players-bar .pchip .pc-token {
    width: 22px;
    height: 22px;
    top: 6px;
    left: 6px;
  }
  .hud .players-bar .pchip .pc-token .player-token-icon { width: 13px; height: 13px; }
  .hud .players-bar .pchip .pc-cash { font-size: 1.05rem !important; top: 6px; right: 9px; }
}

/* Всплывающая карточка клетки: без цветной акцентной полосы слева. */
.board .tile > .tile-detail.tile-detail {
  border-left: 1px solid rgba(30, 42, 35, .16) !important;
}

/* Мгновенный тап по кнопкам на мобиле (без задержки double-tap-zoom). */
.btn,
#actions button,
.board-mode-btn,
.history-expand,
.pm-btn { touch-action: manipulation; }

/* ---------- Экран входа: стилизованный выбор мира + превью поля ---------- */
.create-theme-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.theme-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid rgba(23, 48, 36, .16);
  border-radius: 10px;
  background: #fff9ec;
  color: #1d3327;
  padding: 9px 10px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.theme-option:hover { border-color: #d38b32; }
.theme-option.is-selected {
  border-color: #d38b32;
  background: #fff3df;
  box-shadow: 0 0 0 3px rgba(211, 139, 50, .22);
}
.theme-option-emoji { font-size: 1.35rem; line-height: 1; }
.theme-option-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.theme-option-text b { font-size: .82rem; font-weight: 900; }
.theme-option-text small { font-size: .63rem; color: #6c7a70; }

.theme-preview-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 64px;
  border: 1.5px solid rgba(23, 48, 36, .16);
  border-radius: 10px;
  background: rgba(31, 72, 55, .06);
  color: #23614d;
  padding: 8px 10px;
  font: inherit;
  font-size: .68rem;
  font-weight: 850;
  cursor: pointer;
}
.theme-preview-btn:hover { border-color: #2a614d; background: rgba(31, 72, 55, .12); }
.theme-preview-btn .tpb-icon { font-size: 1.15rem; line-height: 1; }

/* ---------- Экран предпросмотра поля ---------- */
#screen-preview.active { padding: 12px; }
.preview-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.preview-header .btn { min-height: 40px; }
.preview-title {
  text-align: center;
  font-weight: 900;
  font-size: 1rem;
  color: var(--text, #f4efe4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-rail {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 10px 6px 24px;
}
.preview-board-modes {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 4px;
}
.preview-board-modes .board-mode-btn {
  min-height: 32px;
  border: 1px solid rgba(246, 239, 224, .16);
  border-radius: 6px;
  background: rgba(5, 28, 23, .7);
  color: var(--muted);
  padding: 5px 9px;
  font: inherit;
  font-size: .68rem;
  font-weight: 860;
}
.preview-board-modes .board-mode-btn.is-active {
  border-color: rgba(255, 211, 134, .42);
  background: rgba(255, 211, 134, .18);
  color: #fff2d8;
}
/* Двойной класс + !important, чтобы перебить мобильные правила игровой .board */
.preview-board.preview-board {
  width: min(92vw, 560px) !important;
  min-width: 0 !important;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto !important;
  overflow: visible;
}

@media (max-width: 639px) {
  .theme-option { padding: 8px; }
  .theme-option-emoji { font-size: 1.15rem; }
  .preview-rail { padding-left: 0; padding-right: 0; }
  #screen-preview[data-board-mode="fit"] .preview-rail { overflow: hidden; }
  .preview-board.preview-board { width: calc(100vw - 24px) !important; }
  #screen-preview[data-board-mode="scroll"] .preview-rail {
    height: min(640px, calc(100svh - 172px));
    place-items: start;
    overscroll-behavior: contain;
    padding: 8px 0 18px;
    overscroll-behavior: none;
    touch-action: none;
  }
  #screen-preview[data-board-mode="scroll"] .preview-board.preview-board {
    width: min(640px, calc(100svh - 118px)) !important;
    min-width: 560px !important;
    margin: 0 8px !important;
  }
  #screen-preview[data-board-mode="tall"] .preview-rail {
    height: min(660px, calc(100svh - 172px));
    align-content: start;
    padding: 8px 0 18px;
    overscroll-behavior: none;
    touch-action: none;
  }
  #screen-preview[data-board-mode="tall"] .preview-board.preview-board {
    width: calc(100vw - 24px) !important;
    min-width: 0 !important;
    margin: 0 auto !important;
  }
}

/* ---------- Board owns its viewport; player cards always follow below ---------- */
.game-layout {
  width: min(calc(100vw - 24px), 1180px) !important;
  height: auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  align-items: start !important;
  gap: 8px !important;
  margin: 0 auto !important;
}

.game-layout > .board-rail,
.game-layout > .hud {
  grid-column: 1;
}

.game-header > .mobile-board-modes {
  display: inline-flex !important;
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  justify-self: stretch;
  justify-content: center;
  gap: 3px;
  width: auto;
  margin: 0;
  border: 1px solid rgba(246, 239, 224, .16);
  border-radius: 7px;
  background: rgba(5, 28, 23, .82);
  padding: 2px;
}

.game-header > .mobile-board-modes .board-mode-btn {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  font: inherit;
  font-size: .7rem;
  font-weight: 860;
  cursor: pointer;
}

.game-header > .mobile-board-modes .board-mode-btn.is-active {
  background: var(--ds-mustard, #f1bd58);
  color: var(--ds-ink, #1e3d36);
}

.game-header {
  grid-template-columns: 52px minmax(150px, .28fr) minmax(210px, auto) minmax(0, 1fr) 58px !important;
}

.game-header .game-brand { grid-column: 1; }
.game-header .game-status { grid-column: 2; }
.game-header .turn-panel { grid-column: 4; }
.game-header .leave-btn { grid-column: 5; }

.board-rail,
.preview-rail {
  max-width: 100%;
  overscroll-behavior: none;
  scrollbar-width: none;
}

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

.game-layout > .hud {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.game-layout > .hud .players-bar {
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 8px !important;
  overflow: visible !important;
  padding: 0 0 8px !important;
}

@media (min-width: 900px) {
  .game-layout > .board-rail {
    justify-items: center !important;
  }

  .game-layout > .board-rail .board {
    width: min(100%, calc(100svh - 76px)) !important;
    max-width: 920px !important;
    margin: 0 auto !important;
  }

}

@media (min-width: 640px) {
  #screen-preview[data-board-mode="scroll"] .preview-rail {
    max-height: min(760px, calc(100svh - 150px));
    place-items: start center;
  }

  #screen-preview[data-board-mode="scroll"] .preview-board.preview-board {
    width: 920px !important;
    max-width: none;
  }

  #screen-preview[data-board-mode="tall"] .preview-board.preview-board {
    width: min(720px, calc(100vw - 36px)) !important;
  }

  .board-mode-scroll .game-layout > .board-rail {
    max-height: min(760px, calc(100svh - 150px));
    justify-items: start !important;
    overflow: auto;
  }

  .board-mode-scroll .game-layout > .board-rail .board {
    width: 1040px !important;
    max-width: none !important;
  }

  .board-mode-tall .game-layout > .board-rail .board {
    width: min(720px, 100%) !important;
  }
}

@media (min-width: 700px) and (max-width: 1366px) {
  .board-mode-fit .game-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .board-mode-fit .game-layout > .board-rail {
    grid-column: 1;
    grid-row: 1;
  }

  .board-mode-fit .game-layout > .hud {
    grid-column: 1;
    grid-row: 2;
    max-height: none;
    overflow: visible !important;
  }

  .board-mode-fit .game-layout > .hud .players-bar {
    padding-right: 0 !important;
  }
}

@media (min-width: 640px) {
  .game-layout > .hud .players-bar {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: stretch;
  }

  .game-layout > .hud .players-bar .pchip {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 899px) {
  .game-header {
    grid-template-columns: 46px minmax(118px, 1fr) minmax(190px, auto) 58px !important;
  }

  .game-header .game-brand { grid-column: 1; grid-row: 1; }
  .game-header .game-status { grid-column: 2; grid-row: 1; }
  .game-header > .mobile-board-modes { grid-column: 3; grid-row: 1; }
  .game-header .leave-btn { grid-column: 4; grid-row: 1; }
  .game-header .turn-panel {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Пивной маршрут: одна и та же крышка из ассетов в лобби, на поле, в HUD и в анимации. */
body[data-theme="beer"] .player-token-icon--beer {
  width: 118% !important;
  height: 118% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain;
  filter: contrast(1.08) drop-shadow(0 1px 1px rgba(0, 0, 0, .2));
}

@media (max-width: 639px) {
  .game-header {
    grid-template-columns: minmax(0, 1fr) 72px !important;
    grid-template-rows: auto auto auto !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin-inline: 0 !important;
    transform: none !important;
  }

  .game-header .game-brand {
    display: none !important;
  }

  .game-header .game-status { grid-column: 1; grid-row: 1; }
  .game-header .leave-btn {
    grid-column: 2;
    grid-row: 1;
    width: 72px !important;
    min-width: 72px !important;
    min-height: 38px;
    justify-self: end;
  }
  .game-header > .mobile-board-modes {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-width: 0;
  }
  .game-header .turn-panel { grid-column: 1 / -1; grid-row: 3; }

  .game-header > .mobile-board-modes .board-mode-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 28px;
    padding: 4px 6px;
    font-size: .58rem;
  }

  .game-layout > .hud .players-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .board-mode-scroll .board-rail,
  .board-mode-tall .board-rail {
    overscroll-behavior: none !important;
    touch-action: none !important;
  }
}

/* Фишки после завершения движения остаются в центре клетки. */
.board .tile .tokens,
.board .tile-side-bottom .tokens,
.board .tile-side-top .tokens,
.board .tile-side-left .tokens,
.board .tile-side-right .tokens {
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  width: 58px !important;
  height: 44px !important;
  display: grid !important;
  grid-template-columns: repeat(3, 18px);
  place-content: center;
  transform: translate(-50%, -50%) !important;
  pointer-events: none;
}

.board .tile .tokens .ptoken-pin,
.board .tile .tokens.has-many .ptoken-pin {
  position: relative !important;
  inset: auto !important;
  margin: -2px !important;
}

.token-motion-ghost {
  transition: transform 150ms cubic-bezier(.86, 0, .07, 1) !important;
}

/* ---------- История как нижняя секция внутри центра поля ---------- */
.board-center .board-history {
  width: min(82%, 320px);
  max-width: 88%;
  margin-top: auto;            /* прижать к низу центральной зоны */
  padding: 5px 7px;
  gap: 6px;
  border-color: rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .2);
}

.board-center .board-history .history-recent .l-line {
  color: rgba(248, 255, 249, .9);
  font-size: 11px;
}
.board-center .board-history .history-recent .l-line.is-muted { color: rgba(248, 255, 249, .5); }

.board-center .board-history .history-expand {
  background: rgba(255, 255, 255, .12);
  color: #fff2d8;
  padding: 0 10px;
  font-size: 11px;
}
.board-center .board-history .history-expand:hover { background: rgba(255, 255, 255, .2); }

/* История едет вместе с полем (в режиме фрагмента ширину ограничиваем центром) */
@media (max-width: 639px) {
  .board-mode-scroll .board-center .board-history {
    max-width: var(--center-ui-width, 82%) !important;
  }
}

/* ---------- Третий режим: «Высокое» портретное поле (мобильный) ---------- */
@media (max-width: 639px) {
  .board-mode-tall .board-rail {
    height: min(660px, calc(100svh - 150px));
    align-content: start;
    justify-items: center;
    overflow: auto;
    margin: 0;
    padding: 0 8px 10px;
  }
  .board-mode-tall .board {
    width: calc(100vw - 16px) !important;
    min-width: 0 !important;
    margin: 0 auto !important;
  }
}

/* ---------- Пристыкованная игровая шапка и компактный статус центра ---------- */
#screen-game.active {
  padding: 0 0 12px !important;
}

#screen-game .game-header {
  position: sticky;
  top: 0;
  z-index: 48;
  width: 100%;
  margin: 0 0 8px !important;
  border-width: 0 0 1px !important;
  border-radius: 0 0 14px 14px !important;
  background:
    radial-gradient(rgba(246, 240, 228, .035) .7px, transparent .8px) 0 0 / 5px 5px,
    linear-gradient(115deg, #173d34, #102c26) !important;
  box-shadow: 0 8px 24px rgba(12, 36, 29, .2);
}

.board-center .center-status-row {
  z-index: 2;
  order: 1;
  width: min(92%, 620px);
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr);
  align-items: start;
  gap: clamp(8px, 2vw, 20px);
  box-sizing: border-box;
  padding: 4px 0;
}

.board-center .center-turn,
.board-center .state-guide {
  width: 100%;
  min-width: 0;
  margin: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #1e3d36 !important;
  padding: 0;
  box-shadow: none;
}

.board-center .center-turn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 1px 7px;
  text-align: left;
}

.board-center .center-turn-label {
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.board-center .center-turn b {
  display: block;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #1e3d36 !important;
  font-size: clamp(.9rem, 2.4vw, 1.28rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-center .center-turn .center-place {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: .72rem;
  line-height: 1.12;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-center .state-guide {
  display: flex;
  align-items: baseline;
  gap: 7px;
  text-align: left;
}

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

.board-center .state-guide b {
  flex: 0 0 auto;
  color: #1e3d36 !important;
  white-space: nowrap;
}

.board-center .state-guide span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.18;
  text-overflow: ellipsis;
}

.board-center .state-guide small {
  display: none;
}

.board-center .actions:not(:empty) {
  width: min(92%, 620px);
  box-sizing: border-box;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.leave-confirm-modal {
  border: 1px solid rgba(30, 61, 54, .22);
  background:
    radial-gradient(rgba(54, 43, 26, .08) .55px, transparent .7px) 0 0 / 4px 4px,
    #fffaf0;
}

/* ---------- История пристыкована к низу и разворачивается внутри центра ---------- */
.board-center .board-history {
  position: relative !important;
  inset: auto !important;
  order: 30;
  flex: 0 0 auto;
  align-self: stretch;
  width: calc(100% + 26px);
  max-width: none !important;
  min-height: 48px;
  max-height: 50%;
  margin: auto -13px -13px;
  padding: 15px 9px 7px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  overflow: visible;
  border: 1px solid rgba(30, 61, 54, .22);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
  background:
    radial-gradient(rgba(54, 43, 26, .08) .55px, transparent .7px) 0 0 / 4px 4px,
    rgba(255, 250, 238, .96);
  color: #1e3d36;
  box-shadow: 0 -6px 18px rgba(33, 28, 18, .1);
  transition: height .22s ease, flex-basis .22s ease;
}

.board-center .board-history.is-open {
  flex-basis: 50%;
  height: 50%;
  min-height: 50%;
}

.board-center .board-history .history-expand {
  position: absolute;
  z-index: 2;
  top: -12px;
  left: 50%;
  width: 38px;
  height: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  transform: translateX(-50%);
  border: 1px solid rgba(30, 61, 54, .24);
  border-radius: 999px;
  background: #1e3d36 !important;
  color: #fff8e8 !important;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(22, 38, 31, .2);
}

.board-center .board-history .history-caret {
  transform: translateY(2px);
}

.board-center .board-history.is-open .history-caret {
  transform: translateY(-1px) rotate(180deg);
}

.board-center .board-history .history-recent .l-line,
.board-center .board-history .history-recent .l-line.is-muted {
  color: rgba(30, 61, 54, .78);
}

.board-center .board-history.is-open .history-recent {
  display: none;
}

.board-center .board-history .board-log {
  position: static !important;
  inset: auto !important;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 2px 4px;
  overflow: auto;
  border: 0;
  background: transparent;
  color: #1e3d36;
}

@media (max-width: 639px) {
  .board-mode-scroll .board-center .board-history {
    max-width: none !important;
  }
}

.board.is-log-open .center-turn,
.board.is-log-open .state-guide,
.board.is-log-open .dice,
.board.is-log-open .actions {
  opacity: 1 !important;
  transform: none !important;
}

@media (max-width: 899px) {
  #screen-game .game-header {
    border-radius: 0 0 10px 10px !important;
  }

  .board-center .center-status-row {
    width: min(94%, 620px);
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: 8px;
  }

  .board-center .center-turn-label,
  .board-center .state-guide,
  .board-center .center-turn .center-place {
    font-size: .62rem;
  }
}
