/* Production application layer for the chtototam paper-and-ink design system. */
:root {
  --ds-ink: #1e3d36;
  --ds-ink-deep: #102c26;
  --ds-olive: #687d5a;
  --ds-paper: #e8dfca;
  --ds-paper-light: #f6f0e4;
  --ds-mustard: #d4a441;
  --ds-terra: #c7603a;
  --ds-indigo: #2f3e5e;
  --ds-teal: #278a83;
  --ds-line: rgba(30, 61, 54, .2);
  --ds-shadow: 0 18px 42px rgba(27, 36, 27, .18);
  --ds-radius: 12px;
}

html,
body {
  color: var(--ds-ink);
  background-color: #d8cfba;
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 420px 420px;
}

body {
  background-attachment: fixed;
  font-family: "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
}

button,
input { letter-spacing: 0; }

.paper-surface,
.join-card,
.lobby-card,
.card-modal,
.player-modal {
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius);
  background-color: var(--ds-paper-light);
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 420px 420px;
  box-shadow: var(--ds-shadow);
}

/* Creation and live-session catalogue */
#screen-join {
  min-height: 100svh;
  align-items: center;
  justify-content: center;
  background-color: #d8cfba;
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 420px 420px;
  padding: clamp(18px, 4vw, 64px);
  overflow-x: hidden;
}

.join-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
  gap: 16px;
  align-items: stretch;
}

.join-card {
  width: auto;
  max-width: none;
  /* overflow видимый: выпадающий список маршрутов не должен обрезаться краем карточки */
  overflow: visible;
  padding: 0;
}

.join-brand {
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border-radius: var(--ds-radius) var(--ds-radius) 0 0;
  background: var(--ds-ink);
  color: var(--ds-paper-light);
  padding: 28px 30px 25px;
  isolation: isolate;
}

.join-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 0 42%;
  background: url('/assets/design-system/world-route-center.png') center / cover no-repeat;
  opacity: .38;
  mix-blend-mode: luminosity;
  mask-image: linear-gradient(90deg, transparent, #000 34%);
}

.join-brand .brand-route { display: flex; gap: 4px; margin-bottom: 14px; }
.join-brand .brand-route i { width: 28px; height: 5px; background: var(--ds-mustard); }
.join-brand .brand-route i:nth-child(2) { background: var(--ds-terra); }
.join-brand .brand-route i:nth-child(3) { background: var(--ds-olive); }
.join-brand .brand-route i:nth-child(4) { background: var(--ds-indigo); }
.join-brand .logo { margin: 0; color: inherit; font-size: clamp(34px, 5vw, 58px); line-height: .88; }
.join-brand .tagline { margin: 10px 0 0; color: rgba(246, 240, 228, .7); font-size: 12px; }

.join-form { display: grid; gap: 12px; padding: 25px 30px 22px; }
.join-section-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.join-section-heading > span {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid var(--ds-ink);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
}
.join-section-heading small,
.field-label {
  color: rgba(30, 61, 54, .62);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.join-section-heading h2 { margin: 2px 0 0; font-size: 22px; line-height: 1; }
.join-form > input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: rgba(255, 253, 247, .76);
  color: var(--ds-ink);
  padding: 0 14px;
  font: inherit;
  font-size: 15px;
  font-weight: 750;
}
.join-form > input:focus-visible { outline: 3px solid rgba(47, 62, 94, .24); border-color: var(--ds-indigo); }

.create-theme { display: grid; gap: 7px; }
/* «Посмотреть поле» и выбор маршрута — в одну строку */
.create-theme-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }

/* Свёрнутый выбор маршрута: один ряд «арт + название + стрелка» высотой с кнопку превью */
.theme-dropdown { position: relative; min-width: 0; }
.theme-dropdown-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--ds-ink);
  padding: 5px 12px 5px 6px;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.theme-dropdown-toggle:hover { border-color: var(--ds-olive); }
.theme-dropdown-toggle .theme-option-art {
  position: static;
  flex: 0 0 auto;
  width: 52px;
  height: 34px;
  border: 1px solid var(--ds-line);
  border-radius: 7px;
  opacity: 1;
}
.theme-dropdown-toggle .theme-option-art::after { content: none; }
.theme-selected-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-caret { flex: 0 0 auto; color: rgba(30, 61, 54, .6); font-size: 11px; transition: transform .16s ease; }
.theme-dropdown-toggle.is-open .theme-caret { transform: rotate(180deg); }

/* Раскрытый список — карточки миров привычного размера поверх формы */
.theme-dropdown-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(30, 61, 54, .32);
  border-radius: 12px;
  background: var(--ds-paper-light);
  padding: 8px;
  box-shadow: 0 22px 48px rgba(35, 29, 20, .3);
}
.theme-dropdown-menu[hidden] { display: none; }
.theme-option {
  position: relative;
  min-width: 0;
  min-height: 92px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: #fffaf0;
  color: var(--ds-ink);
  padding: 10px;
  text-align: left;
  cursor: pointer;
}
.theme-option:hover { border-color: var(--ds-olive); }
.theme-option:focus-visible { outline: 3px solid rgba(47, 62, 94, .24); outline-offset: 2px; }
.theme-option.is-selected { border-color: var(--ds-ink); background: #fffaf0; box-shadow: inset 0 -5px var(--ds-mustard); }
.theme-option-art { position: absolute; inset: 0; background-position: center; background-size: cover; opacity: .92; filter: sepia(.28) saturate(.78); }
.theme-option-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 250, 240, .12) 0%, rgba(255, 250, 240, .5) 42%, rgba(255, 250, 240, .96) 88%); }
.theme-option-art--world { background-image: url('/assets/design-system/world-route-center.png'); }
.theme-option-art--beer { background-image: url('/assets/design-system/beer-route-center.png'); }
.theme-option-art--placeholder { background-image: url('/assets/themes/placeholders/route.svg'); }
.theme-option-text { position: relative; z-index: 1; display: grid; min-width: 0; line-height: 1.15; }
.theme-option-text b { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.theme-option-text small { min-height: 22px; color: rgba(30, 61, 54, .62); font-size: 8px; line-height: 1.3; }
.theme-option-check { position: absolute; z-index: 2; top: 7px; right: 7px; display: none; border-radius: 999px; background: var(--ds-mustard); padding: 3px 6px; font-size: 7px; font-weight: 900; text-transform: uppercase; }
.theme-option.is-selected .theme-option-check { display: block; }

/* Компактная «Посмотреть поле»: одна строка, той же высоты, что свёрнутый выбор маршрута */
.theme-preview-btn {
  min-width: 0;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ds-ink);
  border-radius: 10px;
  background: transparent;
  color: var(--ds-ink);
  padding: 0 14px;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.theme-preview-btn:hover { background: rgba(30, 61, 54, .08); }
.preview-grid-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; }

.join-form #join-btn { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border-color: var(--ds-ink); border-radius: 8px; background: var(--ds-mustard); color: var(--ds-ink); box-shadow: 0 4px 0 #9c752b; padding-inline: 16px; }
.join-form #join-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #9c752b; }
.join-form .error { min-height: 16px; margin: 0; }
.server-copy { margin: 0 30px 25px; border-color: var(--ds-line); border-radius: 8px; background: rgba(255, 253, 247, .56); }
.server-copy strong { color: var(--ds-ink); }

.games-directory { min-width: 0; min-height: 100%; display: grid; grid-template-rows: auto minmax(250px, 1fr) auto; align-content: start; margin: 0; padding: 25px; }
.games-directory-head { align-items: center; border-bottom: 1px solid var(--ds-line); padding-bottom: 18px; }
.games-directory h2 { margin: 2px 0 0; color: var(--ds-ink); font-size: 22px; }
.games-refresh { width: 38px; height: 38px; border: 1px solid var(--ds-ink); border-radius: 50%; background: transparent; color: var(--ds-ink); font-size: 20px; }
.games-refresh:hover { background: rgba(30, 61, 54, .08); }
.games-list { max-height: min(620px, 62svh); overflow: auto; padding: 14px 0; }
.games-empty { min-height: 230px; display: grid; place-items: center; margin: 0; border: 1px dashed var(--ds-line); border-radius: 8px; color: rgba(30, 61, 54, .58); padding: 28px; text-align: center; }
.game-directory-row { border-color: var(--ds-line); border-radius: 8px; background: rgba(255, 253, 247, .68); box-shadow: none; }
.game-directory-row:hover { border-color: var(--ds-olive); transform: none; }
.game-directory-meta b { color: var(--ds-ink); }
.game-directory-meta > span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-join-btn { border-color: var(--ds-ink); border-radius: 7px; background: var(--ds-ink); color: var(--ds-paper-light); }

/* Lobby follows the same route-card language. */
.lobby-card { max-width: 720px; border-radius: var(--ds-radius); }
.lobby-hero { min-height: 172px; background: var(--ds-ink); padding: 30px 34px 26px; }
.lobby-hero::after { inset: 10px; border-radius: 8px; }
.lobby-hero h2 { font-size: clamp(40px, 7vw, 64px); }
.lobby-content { padding: 24px 30px 30px; }
.lobby-role { border-color: var(--ds-line); border-radius: 8px; background: rgba(212, 164, 65, .15); }
.lobby-share { border-block: 1px solid var(--ds-line); border-inline: 0; border-radius: 0; background: transparent; }
.player-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.player-list li { min-width: 0; border: 1px solid var(--ds-line); border-radius: 8px; background: rgba(255, 253, 247, .7); }
.player-list .pname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .pbadge { margin-left: auto; border-radius: 999px; background: var(--ds-mustard); color: var(--ds-ink); padding: 4px 7px; font-size: 7px; text-transform: uppercase; }
.lobby-actions .btn { border-radius: 8px; }
.lobby-actions #start-btn { border-color: var(--ds-ink); background: var(--ds-mustard); color: var(--ds-ink); }

/* Event and ownership surfaces */
.modal-backdrop { background: rgba(16, 44, 38, .72); backdrop-filter: blur(5px); }
.modal-backdrop .card-modal { width: min(360px, calc(100vw - 28px)); overflow: hidden; border: 7px double rgba(30, 61, 54, .45); border-radius: 16px; background-color: var(--ds-paper-light); color: var(--ds-ink); padding: 26px; box-shadow: 0 24px 70px rgba(16, 30, 24, .42); }
.card-modal::before { content: ""; display: block; height: 145px; margin: -26px -26px 20px; background: var(--ds-card-art, url('/assets/design-system/world-route-center.png')) center / cover no-repeat; filter: sepia(.35) saturate(.65); }
body[data-theme="beer"] .card-modal { --ds-card-art: url('/assets/design-system/beer-route-center.png'); }
.card-deck { color: rgba(30, 61, 54, .6); font-size: 9px; letter-spacing: 0; text-transform: uppercase; }
.card-deck.chance { color: var(--ds-indigo); }
.card-modal #card-text { color: var(--ds-ink); font-size: 15px; line-height: 1.5; }
.card-modal .btn { border-color: var(--ds-ink); border-radius: 7px; background: var(--ds-ink); color: var(--ds-paper-light); }
.player-modal { border-radius: 16px; color: var(--ds-ink); }
.player-modal::before { background: var(--ds-ink); }
.player-modal-close { border-radius: 50%; }

/* Pre-session board preview is a complete route surface, not an empty frame. */
#screen-preview.active {
  background-color: #d8cfba;
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 420px 420px;
}
.preview-header {
  width: min(1180px, 100%);
  margin: 0 auto 10px;
  border: 1px solid rgba(246, 240, 228, .18);
  border-radius: 10px;
  background: var(--ds-ink-deep);
  color: var(--ds-paper-light);
  padding: 8px;
}
.preview-title { color: var(--ds-paper-light); }
.preview-header .btn { border-color: rgba(246, 240, 228, .26); border-radius: 7px; color: var(--ds-paper-light); }
.preview-header #preview-create { border-color: var(--ds-mustard); background: var(--ds-mustard); color: var(--ds-ink); }
.preview-board-modes .board-mode-btn { border-color: var(--ds-line); background: rgba(246, 240, 228, .8); color: var(--ds-ink); }
.preview-board-modes .board-mode-btn.is-active { border-color: var(--ds-ink); background: var(--ds-ink); color: var(--ds-paper-light); }
.preview-board-center {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-color: var(--ds-paper);
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 420px 420px;
  isolation: isolate;
}
.preview-center-art {
  position: absolute;
  z-index: -2;
  inset: 0;
  background: url('/assets/design-system/world-route-center.png') center / cover no-repeat;
  opacity: .5;
  filter: grayscale(.28) sepia(.18) saturate(.68) contrast(.9);
}
body[data-theme="beer"] .preview-center-art { background-image: url('/assets/design-system/beer-route-center.png'); }
.preview-board-center::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(246, 240, 228, .6);
}
body[data-theme="beer"] .preview-board-center::after { background: rgba(246, 240, 228, .58); }
.preview-center-copy {
  width: min(76%, 620px);
  color: var(--ds-ink);
  text-align: center;
  transform: rotate(-5deg);
}
.preview-center-copy small { display: block; color: var(--ds-ink); font-size: clamp(6px, 1vw, 11px); font-weight: 900; letter-spacing: 0; text-transform: uppercase; }
.preview-center-copy strong { display: block; margin-top: 6px; font-size: clamp(24px, 7vw, 90px); font-weight: 800; line-height: .86; }
.preview-center-copy span { display: block; margin: 8px auto 0; font-size: clamp(6px, 1vw, 11px); font-weight: 800; letter-spacing: 0; line-height: 1.2; text-transform: uppercase; }

/* Keep game controls in the same palette without changing their layout. */
.game-header { border-color: rgba(246, 240, 228, .18); background: var(--ds-ink-deep); }
.game-header .leave-btn { border-left-color: rgba(246, 240, 228, .18); }
.board-mode-btn.is-active { background: var(--ds-mustard); color: var(--ds-ink); }
.pchip {
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  background: rgba(246, 240, 228, .9);
  color: var(--ds-ink);
  box-shadow: 0 6px 14px rgba(30, 45, 34, .1);
}
.pchip.is-turn { background: #fffdf7; box-shadow: inset 5px 0 var(--player-color, var(--ds-mustard)), 0 8px 18px rgba(30, 45, 34, .14); }
.pchip:focus-visible { outline: 3px solid rgba(47, 62, 94, .28); outline-offset: 2px; }

/* Full production board language: paper, engraved art and square cells. */
.board {
  gap: 1px !important;
  overflow: hidden;
  border: 8px double var(--ds-ink) !important;
  border-radius: 24px !important;
  background: var(--ds-ink) !important;
  box-shadow: 0 20px 48px rgba(45, 37, 25, .2) !important;
}

.board .tile {
  container-type: inline-size;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--ds-paper-light);
  color: var(--ds-ink);
}

.board .tile-face {
  position: absolute;
  inset: 0;
  display: block !important;
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  background-color: var(--ds-paper-light) !important;
  background-image: url('/assets/design-system/paper-texture.png') !important;
  background-size: 260px 260px !important;
  color: var(--ds-ink);
  box-shadow: inset 0 0 0 1px rgba(30, 61, 54, .12) !important;
}

.board .tile-face::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 11% 3% 3%;
  border-radius: 3px;
  background: repeating-linear-gradient(122deg, transparent 0 7px, rgba(30, 61, 54, .035) 8px 9px);
  pointer-events: none;
}

.board .tile-plate {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  width: 100%;
  min-height: 0;
  height: 11%;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(30, 61, 54, .18);
}

.board .tile.special .tile-plate { display: none; }

.board .tile-name-mini {
  position: absolute;
  z-index: 4;
  top: 15%;
  left: 6%;
  right: 5%;
  width: auto;
  max-height: 2.25em;
  display: -webkit-box;
  overflow: hidden;
  color: var(--ds-ink) !important;
  font-family: "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  font-size: clamp(7px, 17cqw, 11px) !important;
  font-weight: 800;
  line-height: 1.05;
  text-align: left;
  text-overflow: ellipsis;
  white-space: normal;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.board .tile.special .tile-name-mini {
  top: 6%;
  left: 7%;
  right: 7%;
  font-size: clamp(6px, 15cqw, 10px) !important;
}

.board .tile-bg-icon,
.board .tile-side-top .tile-bg-icon,
.board .tile-side-bottom .tile-bg-icon,
.board .tile-side-left .tile-bg-icon,
.board .tile-side-right .tile-bg-icon {
  position: absolute;
  z-index: 1;
  inset: 28% 4% 10% !important;
  width: auto !important;
  height: auto !important;
  opacity: 1 !important;
  transform: none !important;
}

.board .tile.special .tile-bg-icon { inset: 18% 5% 8% !important; }
.board .tile-illustration,
.board .tile-illustration--tile { width: 100%; height: 100%; }
.board .tile-illustration--tile .tile-illustration-image {
  opacity: .82 !important;
  object-fit: contain !important;
  object-position: center bottom;
  filter: grayscale(.18) sepia(.22) saturate(.75) contrast(.9);
  mix-blend-mode: multiply;
}
body[data-theme="beer"] .board .tile-illustration--tile .tile-illustration-image {
  opacity: .76 !important;
  filter: grayscale(.08) sepia(.18) saturate(.8) contrast(.92);
}

.board .tile .tile-price-big {
  position: absolute !important;
  z-index: 6;
  left: auto !important;
  right: 4px !important;
  bottom: 3px !important;
  min-width: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(30, 61, 54, .18);
  border-radius: 999px;
  background: rgba(255, 253, 247, .9);
  color: var(--ds-ink) !important;
  padding: 2px 5px;
  font-family: "Avenir Next", "Helvetica Neue", system-ui, sans-serif;
  font-size: clamp(7px, 15cqw, 10px) !important;
  font-weight: 750 !important;
  line-height: 1;
  box-shadow: none;
}
.board .tile.owned-tile .tile-price-big { opacity: .42; }

.board .tile:focus-visible { outline: 3px solid var(--ds-indigo); outline-offset: -3px; }
.board .tile.active-tile .tile-face { box-shadow: inset 0 0 0 3px var(--ds-indigo), 0 0 14px rgba(47, 62, 94, .58) !important; }
.board .tile.landed-tile .tile-face,
.board .tile.tile-move-to .tile-face { box-shadow: inset 0 0 0 3px var(--ds-terra), 0 0 15px rgba(199, 96, 58, .62) !important; }
.board .tile.owned-tile:not(.active-tile) .tile-face {
  box-shadow: inset 0 -6px var(--owner-color, var(--ds-olive)), inset 0 0 0 1px rgba(30, 61, 54, .16) !important;
}
/* Печать владельца с инициалом (легенда «владелец + инициалы»).
   [hidden] обязан побеждать display:grid — иначе пустые печати видны на всех клетках. */
.board .tile .owner-dot[hidden] { display: none !important; }
.board .tile .owner-dot {
  top: 3px;
  right: 3px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 253, 247, .92);
  border-radius: 50%;
  color: #fff;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(30, 61, 54, .45);
  z-index: 6;
}

/* Hover/focus card follows the cell-detail specimen. */
.board .tile > .tile-detail.tile-detail {
  width: clamp(238px, 24vw, 304px);
  min-height: 250px;
  overflow: hidden;
  border: 1px solid rgba(30, 61, 54, .4);
  border-radius: 13px;
  background-color: #fff8e9;
  background-image: url('/assets/design-system/paper-texture.png');
  background-size: 300px 300px;
  color: var(--ds-ink);
  box-shadow: 0 24px 50px rgba(35, 29, 20, .34);
  padding: 0 16px 16px;
}
/* Тёплая подложка арт-блока — как в эталоне cell-detail (гравюра поверх, multiply) */
.board .tile-detail .tile-illustration--detail {
  width: calc(100% + 32px);
  height: 118px;
  margin: 0 -16px 14px;
  border-bottom: 1px solid var(--ds-line);
  background: color-mix(in srgb, var(--tile-accent, #e9c979) 34%, #e9c979);
}
.board .tile-detail .tile-illustration--detail .tile-illustration-image {
  opacity: .9;
  object-fit: contain;
  filter: grayscale(.25) sepia(.25) saturate(.7) contrast(.92);
  mix-blend-mode: multiply;
}
.board .tile-detail .td-kind { color: rgba(30, 61, 54, .58); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.board .tile-detail .td-name { color: var(--ds-ink); font-size: 23px; font-weight: 800; line-height: 1; }
/* Цена и рента — тёплые плашки в две колонки, как dl в эталоне */
.board .tile-detail .td-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.board .tile-detail .td-stats .td-price,
.board .tile-detail .td-stats .td-rent {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: var(--ds-warm, var(--ds-terra)) !important;
  color: #fff8ef !important;
  padding: 7px 9px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.25;
}
.board .tile-detail .td-stats [hidden] { display: none !important; }
body[data-theme="beer"] .board .tile-detail .td-stats .td-price,
body[data-theme="beer"] .board .tile-detail .td-stats .td-rent { background: #d29a32 !important; }
.board .tile-detail .td-owner { color: var(--ds-olive); }
.board .tile-detail .td-build { color: #74531f; }
.board .tile-detail p { color: rgba(30, 61, 54, .76); }

/* The actual playfield center uses the route-map surface from the design system. */
.board > .board-center:not(.preview-board-center) {
  color: var(--ds-ink);
  background-color: var(--ds-paper) !important;
  background-image: url('/assets/design-system/paper-texture.png') !important;
  background-size: 420px 420px !important;
  box-shadow: inset 0 0 0 1px rgba(30, 61, 54, .14) !important;
  isolation: isolate;
}
.board > .board-center:not(.preview-board-center)::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 3%;
  background: url('/assets/design-system/world-route-center.png') center / cover no-repeat;
  opacity: .22;
  filter: grayscale(.35) sepia(.2) saturate(.65);
  transform: none;
}
body[data-theme="beer"] .board > .board-center:not(.preview-board-center)::before {
  background-image: url('/assets/design-system/beer-route-center.png');
  opacity: .27;
}
.board > .board-center:not(.preview-board-center)::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgba(246, 240, 228, .64);
  pointer-events: none;
}
.board-center .center-illustration { opacity: .12 !important; filter: grayscale(1) sepia(.2); mix-blend-mode: multiply; }
.board-center .center-turn,
.board-center .center-turn b,
.board-center .state-guide,
.board-center .state-guide b { color: var(--ds-ink) !important; text-shadow: none !important; }
.board-center .center-place { color: #9b641d !important; }
.board-center .state-guide {
  border-color: rgba(30, 61, 54, .28) !important;
  background: rgba(246, 240, 228, .78) !important;
}
.board-center .actions .btn,
.board-center .actions .btn-primary,
.board-center .actions .btn-ok {
  border-color: var(--ds-ink) !important;
  border-radius: 7px !important;
  background: var(--ds-mustard) !important;
  color: var(--ds-ink) !important;
  box-shadow: 0 3px 0 #987326 !important;
}
.board-center .actions .btn-ghost { background: rgba(246, 240, 228, .9) !important; box-shadow: none !important; }
.board-center .board-history {
  border-color: rgba(30, 61, 54, .25) !important;
  background: rgba(246, 240, 228, .88) !important;
}
.board-center .board-history .history-recent .l-line,
.board-center .board-history .history-recent .l-line.is-muted { color: rgba(30, 61, 54, .78) !important; }
.board-center .board-history .history-expand { background: var(--ds-ink) !important; color: var(--ds-paper-light) !important; }

.btn,
#actions button,
.game-join-btn,
.theme-preview-btn { font-family: "Avenir Next", "Helvetica Neue", system-ui, sans-serif; }
.btn-primary,
.btn-ok { border-color: var(--ds-ink) !important; background: var(--ds-mustard) !important; color: var(--ds-ink) !important; }
/* «Печатный» объём у главных CTA */
.btn-primary,
.lobby-actions #start-btn,
.preview-header #preview-create { box-shadow: 0 4px 0 #987326; }
.btn-primary:active,
.lobby-actions #start-btn:active,
.preview-header #preview-create:active { transform: translateY(2px); box-shadow: 0 2px 0 #987326; }
/* Danger-вариант (отказ/отклонение) — терракота */
.btn-danger { border-color: #923f28 !important; background: var(--ds-terra) !important; color: #fff5ef !important; }
.board-center .actions .btn-danger {
  border-color: #923f28 !important;
  border-radius: 7px !important;
  background: var(--ds-terra) !important;
  color: #fff5ef !important;
  box-shadow: 0 3px 0 #7c3420 !important;
}
.board-center .actions .btn-danger:active { transform: translateY(2px); box-shadow: 0 1px 0 #7c3420 !important; }

@media (min-width: 640px) {
  .preview-board.preview-board {
    width: min(calc(100vw - 32px), calc(100svh - 154px), 1120px) !important;
    max-width: none;
  }
}

@media (max-width: 639px) {
  .board { border-width: 5px !important; border-radius: 14px !important; }
  .board .tile-name-mini { font-size: clamp(6px, 17cqw, 9px) !important; }
  .board .tile.special .tile-name-mini { font-size: clamp(5.5px, 15cqw, 8px) !important; }
  .board .tile .tile-price-big { right: 2px !important; bottom: 2px !important; min-width: 21px; padding: 1px 4px; }
  .board .tile > .tile-detail.tile-detail { width: min(252px, calc(100vw - 28px)); min-height: 224px; }
  .board .tile-detail .tile-illustration--detail { height: 92px; }
  .board .tile-detail .td-name { font-size: 19px; }
  .preview-grid-icon { width: 21px; height: 21px; }
}

@media (max-width: 800px) {
  #screen-join { align-items: flex-start; padding: 12px; }
  .join-shell { grid-template-columns: minmax(0, 1fr); }
  .games-directory { min-height: 390px; }
  .games-list { max-height: none; }
}

@media (max-width: 520px) {
  .join-brand { min-height: 128px; padding: 22px 20px 20px; }
  .join-form { padding: 21px 18px 18px; }
  .server-copy { margin: 0 18px 20px; }
  .create-theme-row { grid-template-columns: minmax(0, 1fr) auto; }
  .theme-preview-btn { min-height: 44px; padding: 0 10px; }
  .theme-preview-btn span { display: none; }
  .preview-grid-icon { width: 21px; height: 21px; }
  .games-directory { padding: 20px 18px; }
  .game-directory-row { grid-template-columns: minmax(0, 1fr); }
  .game-join-btn { min-height: 40px; width: 100%; }
  .lobby-hero { min-height: 150px; align-items: flex-start; flex-direction: column; padding: 25px 22px 22px; }
  .lobby-hero-meta { width: 100%; }
  .lobby-route { flex: 1; }
  .lobby-route strong { max-width: none; }
  .lobby-content { padding: 20px 18px 24px; }
  .player-list { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
