:root {
  --bg: #0d1017;
  --surface: #151a24;
  --surface-2: #1c2230;
  --line: #2a3242;
  --text: #e8ecf3;
  --muted: #8a94a8;
  --accent: #f5b942;
  --accent-ink: #1a1306;
  --good: #3ddc84;
  --bad: #ff6b6b;
  --deal: #7cc4ff;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 30% 20%, #1a2030 0%, var(--bg) 60%);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
button { font: inherit; }
input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.btn {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 9px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: transform .06s, background .15s;
}
.btn:hover:not(:disabled) { background: #253045; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn.primary:hover:not(:disabled) { background: #ffc95e; }
.btn.danger { border-color: #6b2b2b; color: #ffb3b3; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }

/* ---------- лобби ---------- */
#lobby { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.lobby-card {
  width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: 0 20px 60px #0008;
}
.brand { margin: 0; font-size: 40px; letter-spacing: .18em; color: var(--accent); text-align: center; line-height: 0; }
/* логотип — скруглённая «иконка приложения»: у картинки свой светлый фон */
.brand-logo { display: block; width: min(240px, 70%); height: auto; margin: 0 auto 6px; border-radius: 22%; box-shadow: 0 0 0 2px #f5b94255, 0 14px 40px #000a; }
.sub { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.auth-panel { text-align: center; }
.auth-panel .btn { display: inline-block; text-decoration: none; }
.auth-panel p { margin: 8px 0 0; font-size: 13px; }
.account { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.account span { min-width: 0; overflow-wrap: anywhere; }
.account button { flex-shrink: 0; }
label { display: block; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
label input { margin-top: 4px; }
.room-code { font-size: 18px; text-align: center; margin-bottom: 10px; }
.room-code b { color: var(--accent); letter-spacing: .2em; font-size: 26px; }
.invite { display: flex; gap: 6px; margin-bottom: 14px; }
#lobbyPlayers { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
#lobbyPlayers li { display: flex; align-items: center; gap: 8px; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
.rules { margin-top: 18px; color: var(--muted); font-size: 13px; }
.rules summary { cursor: pointer; color: var(--text); }
.rules ol { padding-left: 20px; }
.rules li { margin: 4px 0; }

/* ---------- игра ---------- */
#game { display: flex; gap: 14px; padding: 12px; height: 100vh; }
#boardWrap { flex: 1; display: grid; place-items: center; min-width: 0; }
#board {
  --size: min(calc(100vh - 24px), calc(100vw - 400px));
  /* поле шире, чем высота окна: занимает свободное место до боковой панели, но не больше +30% */
  --board-w: min(calc(100vw - 400px), calc(var(--size) * 1.3));
  width: var(--board-w); height: var(--size);
  display: grid; gap: 2px;
  /* углы квадратные: боковые колонки той же ширины, что верхний/нижний ряд по высоте;
     вся лишняя ширина поля уходит в клетки верхнего и нижнего ряда.
     28px = рамка 2×2 + отступ 2×2 + 10 промежутков по 2px */
  --edge: calc((var(--size) - 28px) * 1.55 / 12.1);
  grid-template-columns: var(--edge) repeat(9, 1fr) var(--edge);
  grid-template-rows: var(--edge) repeat(9, 1fr) var(--edge);
  background: #070a10; border: 2px solid var(--line); border-radius: 12px; padding: 2px;
  font-size: calc(var(--size) / 78);
}
#side { width: 370px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.panel h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
/* журнал: по высоте содержимого, прижат к низу боковой колонки; при нехватке места сжимается и листается */
.panel.grow { flex: 0 1 auto; margin-top: auto; display: flex; flex-direction: column; min-height: 140px; }

/* клетки */
.cell {
  position: relative; background: var(--surface); border-radius: 4px; overflow: hidden;
  display: flex; cursor: pointer; transition: filter .15s;
}
.cell:hover { filter: brightness(1.25); }
/* полоса цвета улицы; толщина округляется до чётного числа пикселей, чтобы половина цвета владельца
   и половина цвета улицы были ровно одинаковыми (без round() — просто 7.33%) */
.cell .band { flex: 0 0 7.33%; flex-basis: max(2px, round(nearest, 7.33%, 2px)); position: relative; border-radius: 999px; }
.cell .band i { position: absolute; border-radius: 999px; }
.cell.s-bottom .band i { inset: 0 0 50% 0; }  /* полоска сверху клетки — внутренняя половина верхняя */
.cell.s-top .band i { inset: 50% 0 0 0; }
.cell.s-left .band i { inset: 0 0 0 50%; }    /* полоска справа — внутренняя половина правая */
.cell.s-right .band i { inset: 0 50% 0 0; }
.cell .body { flex: 1; padding: 3px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.cell .nm { font-weight: 600; line-height: 1.1; hyphens: auto; overflow-wrap: break-word; }
.cell .pr { color: var(--muted); }
.cell.s-bottom { flex-direction: column; }
.cell.s-top { flex-direction: column-reverse; }
.cell.s-left { flex-direction: row-reverse; }
.cell.s-right { flex-direction: row; }
.cell.s-left .band, .cell.s-right .band { flex-basis: 5.33%; flex-basis: max(2px, round(nearest, 5.33%, 2px)); }
.cell.corner { background: var(--surface-2); align-items: center; justify-content: center; text-align: center; }
.cell.corner .body { align-items: center; justify-content: center; }
.cell .ico { font-size: 2.2em; line-height: 1; }
.cell.corner .ico { font-size: 3.2em; }
.cell.owned { box-shadow: inset 0 0 0 2px var(--own); }
.cell.owned .pr { color: var(--own); font-weight: 700; }
.cell.biz { box-shadow: inset 0 0 0 2px var(--own); background-image: repeating-linear-gradient(45deg, transparent 0 6px, #ffffff08 6px 12px); }
.cell.mort { opacity: .45; }
.cell.mort::after { content: "ЗАЛОГ"; position: absolute; inset: auto 0 40% 0; text-align: center; font-weight: 800; color: var(--bad); letter-spacing: .1em; transform: rotate(-18deg); }
.cell.here { outline: 2px solid var(--accent); outline-offset: -2px; z-index: 1; }
/* застройка: силуэт квартала у нижнего края клетки (дома цвета группы, отель — башня) */
.cell .body { position: relative; }
.cell .sky {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; height: 3em; padding-bottom: .28em;
  display: flex; align-items: flex-end; justify-content: center; gap: .12em; pointer-events: none;
  background: linear-gradient(to top, rgba(9, 11, 17, .92) 0%, rgba(9, 11, 17, .6) 55%, transparent 100%);
}
.cell .sky svg { flex: none; fill: var(--gc); stroke: #0b0e15; stroke-width: 1; filter: drop-shadow(0 0 3px #000c); }
.cell .sky rect { fill: #0b0e15; stroke: none; }
.cell .sky .tw g rect { fill: #f5d77a; }
.cell .sky .h { width: 1.15em; height: 1.15em; }
.cell .sky .tw { width: 1.35em; height: 2.2em; }
/* боковые клетки низкие — квартал пониже */
.cell.s-left .sky, .cell.s-right .sky { height: 2.4em; }
.cell.s-left .sky .tw, .cell.s-right .sky .tw { width: 1.1em; height: 1.8em; }
.tokens { position: absolute; inset: auto 2px 2px auto; display: flex; flex-wrap: wrap-reverse; gap: 2px; justify-content: flex-end; max-width: 90%; }
.token {
  width: 1.9em; height: 1.9em; border-radius: 50%; border: 2px solid #000a;
  display: grid; place-items: center; font-weight: 800; font-size: .95em; color: #0b0b0b;
  box-shadow: 0 2px 6px #000a; animation: pop .3s ease;
}
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }

/* центр поля */
#center {
  grid-area: 2 / 2 / 11 / 11; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2em; padding: 2em; text-align: center; font-size: 13px;
  background: radial-gradient(closest-side, #1b2333, #0d1118);
  border-radius: 6px;
}
#center .logo { display: block; width: calc(var(--size) / 5.5); height: auto; border-radius: 22%; box-shadow: 0 0 0 2px #f5b94244, 0 10px 30px #0009; }
#center .status { font-size: 16px; }
#center .status b { color: var(--accent); }
#center .hint { color: var(--muted); max-width: 440px; }
#center .warn { color: var(--bad); font-weight: 600; }
/* баннер выкупа после банкротства партнёра: только до броска; «Бросить кубики» сначала спрашивает плашкой */
.redeem-banner {
  display: grid; gap: 8px; max-width: 460px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--bad) 16%, #151a24); border: 1px solid var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 18%, transparent);
}
.redeem-banner .rb-t { color: var(--bad); font-weight: 800; font-size: 15px; }
.redeem-banner .rb-s { color: var(--text); line-height: 1.4; }
.redeem-banner .rb-b { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.redeem-banner .rb-ask { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed color-mix(in srgb, var(--bad) 50%, transparent); }
.deed .dnote.warn { color: var(--bad); }
.dice { display: flex; gap: 10px; min-height: 54px; }
.die {
  width: 54px; height: 54px; background: #f4f1ea; border-radius: 10px; box-shadow: 0 4px 0 #b9b2a3, 0 8px 18px #0008;
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px;
}
.die.extra { background: var(--accent); box-shadow: 0 4px 0 #a87a1e, 0 8px 18px #0008; }
.die i { width: 9px; height: 9px; border-radius: 50%; background: #1a1a1a; align-self: center; justify-self: center; visibility: hidden; }
.die i.on { visibility: visible; }
.die.rolling { animation: shake .12s infinite; }
@keyframes shake { 0% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } 100% { transform: rotate(-8deg); } }
.die-tag { font-size: 12px; color: var(--muted); }
/* особый третий кубик: не похож на обычные — тёмный, золотая рамка, грани без точек */
.die.special {
  display: grid; grid-template: 1fr / 1fr; place-items: center; padding: 0; margin-left: 6px;
  background: radial-gradient(circle at 30% 25%, #3a2c10, #15110a 70%); color: var(--accent);
  border: 2px solid var(--accent); border-radius: 14px;
  box-shadow: 0 4px 0 #6b4c12, 0 0 16px #f5b94255, 0 8px 18px #0008;
  font-size: 30px; line-height: 1; font-weight: 900;
}
.die.special.num { font-size: 24px; letter-spacing: -.02em; }
/* после броска кубики уезжают в левый верхний угол центра поля — за подложки цветовых групп (4.6em поля) */
#center { position: relative; }
#center .dice.docked {
  position: absolute; z-index: 3; gap: 8px; min-height: 0;
  top: calc(var(--size) / 78 * 4.6 + 22px); left: calc(var(--size) / 78 * 4.6 + 22px);
}
#center .dice.docked .die { width: 36px; height: 36px; padding: 5px; border-radius: 7px; box-shadow: 0 3px 0 #b9b2a3, 0 6px 12px #0008; }
#center .dice.docked .die i { width: 6px; height: 6px; }
#center .dice.docked .die.special { padding: 0; margin-left: 6px; border-radius: 9px; font-size: 19px; box-shadow: 0 3px 0 #6b4c12, 0 0 10px #f5b94244; }
#center .dice.docked .die.special.num { font-size: 15px; }
@media (max-width: 900px) {
  #center .dice.docked { top: calc(var(--size) / 78 * 1.4 + 12px); left: calc(var(--size) / 78 * 1.4 + 12px); gap: 6px; }
  #center .dice.docked .die { width: 24px; height: 24px; padding: 3px; border-radius: 5px; }
  #center .dice.docked .die i { width: 4px; height: 4px; }
  #center .dice.docked .die.special { font-size: 13px; }
  #center .dice.docked .die.special.num { font-size: 11px; }
}
.cell.peek { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 2; box-shadow: 0 0 18px #f5b94299; }

/* игроки */
.pl { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; }
.pl.cur { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.pl.dead { opacity: .4; text-decoration: line-through; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.pl .money { font-variant-numeric: tabular-nums; font-weight: 650; }
.pl .money.neg { color: var(--bad); }
.pl .tags { font-size: 12px; color: var(--muted); }
.pl .money small.share { margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pl .sharebar { grid-column: 2 / -1; height: 3px; margin-top: -4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.pl .sharebar i { display: block; height: 100%; border-radius: 2px; }
.pl-total { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding: 8px 6px 2px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pl-total b { color: var(--text); font-variant-numeric: tabular-nums; }
.pot-note { margin-top: 6px; padding: 8px 6px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* имущество */
#assets { display: flex; flex-wrap: wrap; gap: 4px; max-height: 120px; overflow: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-size: 12px; }
.chip.mort { opacity: .5; text-decoration: line-through; }

/* соглашения */
.prop { background: var(--surface-2); border-radius: 8px; padding: 8px; margin-bottom: 6px; border-left: 3px solid var(--deal); }
.prop.review { border-left-color: var(--accent); }
.prop .meta { font-size: 12px; color: var(--muted); margin: 4px 0; }
#proposals { max-height: 220px; overflow: auto; }

/* журнал */
#log { flex: 0 1 auto; overflow: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; padding-right: 4px; min-height: 80px; }
#log .e { color: #c3cad8; }
#log .e.turn { color: var(--accent); margin-top: 6px; font-weight: 600; }
#log .e.good { color: var(--good); }
#log .e.bad { color: var(--bad); }
#log .e.deal { color: var(--deal); }
#log .e.auction { color: #ffcf7a; }
#log .e.system { color: #c9a7ff; }
#log .e.chat { color: var(--text); background: #ffffff0a; padding: 2px 6px; border-radius: 6px; }
#log .e.card { color: #f4e3b5; }
#chatForm { display: flex; gap: 6px; margin-top: 8px; }

/* аукцион */
#auction {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 40;
  width: min(460px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--accent);
  border-radius: 14px; padding: 14px 16px; box-shadow: 0 20px 60px #000c;
}
#auction .ttl { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#auction .lot { font-size: 18px; font-weight: 700; }
#auction .high { font-size: 28px; font-weight: 800; color: var(--accent); margin: 6px 0; }
#auction .timer { font-size: 22px; font-variant-numeric: tabular-nums; font-weight: 800; }
#auction .who { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; font-size: 12px; }
#auction .who span { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
#auction .who span.out { opacity: .35; text-decoration: line-through; }

/* модалки */
#modalBack { position: fixed; inset: 0; background: #000a; z-index: 45; display: grid; place-items: center; padding: 16px; }
#modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
}
#modal h2 { margin: 0 0 4px; font-size: 20px; }
#modal .mhead { display: flex; justify-content: space-between; gap: 10px; align-items: start; margin-bottom: 10px; }
#modal .gbar { height: 8px; border-radius: 4px; margin: -4px 0 12px; }
#modal table { width: 100%; border-collapse: collapse; margin: 8px 0; }
#modal td { padding: 4px 0; border-bottom: 1px solid var(--line); }
#modal td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#modal tr.cur td { color: var(--accent); font-weight: 700; }
#modal .actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* казино */
.jackpot { text-align: center; font-size: 15px; color: var(--muted); }
.jackpot b { color: var(--accent); font-size: 22px; }
.reels { display: flex; gap: 10px; justify-content: center; margin: 12px 0 8px; }
.reel {
  width: 96px; height: 112px; border-radius: 14px; background: linear-gradient(#f7f3ea, #e3dccb);
  box-shadow: inset 0 -6px 0 #c9bfa8, 0 8px 24px #0009; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #1a1a1a;
}
.reel .sym { font-size: 52px; line-height: 1; }
.reel .rdie { font-size: 12px; color: #6b5f45; margin-top: 6px; }
.reel.spin .sym { animation: reelblur .08s linear infinite; }
@keyframes reelblur { 0% { transform: translateY(-6px); opacity: .6; } 100% { transform: translateY(6px); opacity: 1; } }
.seven { display: inline-grid; place-items: center; width: 1em; height: 1em; border-radius: 50%; background: #29a8f0; color: #fff; font-weight: 900; font-size: .8em; }
.cres { text-align: center; min-height: 22px; font-weight: 700; }
@keyframes bigwin-text { 50% { transform: scale(1.08); } }
/* итог: барабаны с комбинацией — в рамке, остальные приглушены */
.reel.hit { box-shadow: inset 0 -6px 0 #c9bfa8, 0 0 0 3px var(--good), 0 8px 24px #0009; }
.reel.off { opacity: .4; }
/* итог казино вместо барабанов: крупно сколько выиграл или проиграл, под ним выпавшая комбинация */
.cwin { --tone: var(--good); display: grid; gap: 12px; justify-items: center; text-align: center; margin: 12px auto 6px; padding: 18px 16px 16px; border-radius: 16px; max-width: 460px;
  background: color-mix(in srgb, var(--tone) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent); }
.cwin.lose { --tone: var(--bad); }
.cwin.big { --tone: var(--accent); }
.cw-delta { font-size: 46px; line-height: 1; font-weight: 900; color: var(--tone); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.cwin.big .cw-delta { animation: bigwin-text .6s ease-in-out 3; }
.cw-combo { display: flex; gap: 8px; }
.cw-combo span { display: grid; justify-items: center; gap: 2px; width: 62px; padding: 8px 0 6px; border-radius: 12px; font-size: 30px; line-height: 1;
  background: linear-gradient(#f7f3ea, #e3dccb); color: #1a1a1a; opacity: .45; }
.cw-combo span.hit { opacity: 1; box-shadow: 0 0 0 3px var(--tone); }
.cwin.lose .cw-combo span { opacity: .8; }
.cw-combo small { font-size: 10px; color: #6b5f45; }
.cw-label { font-size: 14px; color: var(--text); max-width: 380px; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .cwin.big .cw-delta { animation: none; } }

/* таблица выигрышей казино */
.pttitle { font-weight: 700; margin-top: 14px; }
.ptwrap { display: grid; gap: 2px; margin-top: 6px; }
.pthead, .ptrow { display: grid; grid-template-columns: minmax(0, 1fr) 4.2em 5.2em 4.4em; gap: 10px; align-items: center; padding: 5px 10px; }
.pthead { font-size: 12px; color: var(--muted); }
.pthead span:not(:first-child), .ptrow span:not(:first-child) { text-align: right; }
.ptrow { border-radius: 8px; font-size: 14px; cursor: pointer; font-variant-numeric: tabular-nums; transition: opacity .2s, background .2s; }
.ptrow:hover { background: var(--surface-2); }
.ptrow .pti { white-space: nowrap; }
.ptrow .ptm { font-weight: 700; }
.ptrow .ptp { white-space: nowrap; }
.ptrow .ptc { color: var(--muted); }
.ptrow.big { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.ptrow.big .ptm, .ptrow.big .ptp { color: var(--accent); }
.ptrow.miss { cursor: default; color: var(--muted); }
.ptrow.miss .ptp { color: var(--bad); }
.ptrow.focus { box-shadow: inset 0 0 0 1px var(--accent); }
.ptrow.dim { opacity: .22; }
.ptrow.hit { background: color-mix(in srgb, var(--good) 18%, transparent); box-shadow: inset 3px 0 0 var(--good); }
.ptrow.hit .ptm, .ptrow.hit .ptp { color: var(--good); }
.ptrow.miss.hit { background: color-mix(in srgb, var(--bad) 14%, transparent); box-shadow: inset 3px 0 0 var(--bad); }
.ptrow.big.hit { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: inset 3px 0 0 var(--accent); animation: bigwin .9s ease-in-out 3; }
.ptrow.big.hit .ptm, .ptrow.big.hit .ptp { color: var(--accent); }
@keyframes bigwin { 50% { background: color-mix(in srgb, var(--accent) 42%, transparent); } }
.ptnote { font-size: 12px; margin: 6px 0 10px; }
.reelgrid { display: grid; gap: 4px; }
.rrow { display: grid; grid-template-columns: 5.2em repeat(6, minmax(0, 1fr)); gap: 4px; align-items: center; font-size: 12px; color: var(--muted); }
.rf { position: relative; display: grid; place-items: center; height: 34px; border-radius: 7px; background: var(--surface-2); color: var(--text); font-size: 18px; border: 1px solid transparent; transition: opacity .15s; }
.rf small { position: absolute; top: 1px; left: 4px; font-size: 10px; color: var(--muted); }
.rf.sev { background: color-mix(in srgb, var(--accent) 16%, var(--surface-2)); }
.reelgrid:has(.rf.on, .rf.hov) .rf:not(.on):not(.hov) { opacity: .3; }
.rf.on, .rf.hov { border-color: var(--accent); }
.rf.got { border-color: var(--good); box-shadow: 0 0 0 2px color-mix(in srgb, var(--good) 40%, transparent); }
@media (prefers-reduced-motion: reduce) { .ptrow.big.hit { animation: none; } }
.amount { display: flex; align-items: center; gap: 6px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.amount b { min-width: 90px; text-align: center; font-size: 18px; }

/* тосты */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { background: #222b3b; border: 1px solid var(--line); padding: 9px 14px; border-radius: 10px; box-shadow: 0 10px 30px #0009; animation: pop .2s; max-width: calc(100vw - 32px); }
.toast.err { border-color: #7a2d2d; color: #ffc4c4; }

/* телефоны */
@media (max-width: 900px) {
  #game { flex-direction: column; height: auto; padding: 8px; }
  #board { --size: calc(100vw - 16px); --board-w: var(--size); }
  #side { width: 100%; }
  #center { padding: .6em; gap: .5em; font-size: 11px; }
  #center .status { font-size: 13px; }
  .die { width: 34px; height: 34px; padding: 4px; border-radius: 7px; }
  .die i { width: 6px; height: 6px; }
  .die.special { font-size: 20px; margin-left: 3px; }
  .die.special.num { font-size: 16px; }
  .dice { min-height: 34px; }
  .btn.big { padding: 8px 12px; font-size: 13px; }
  #center .logo { display: none; }
  .cols { grid-template-columns: 1fr; }
}

/* ---------- картинки клеток ---------- */
.cell.has-art .body { position: relative; padding: 0; overflow: hidden; background: #0b0e15; }
.cell.has-art .pic {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 45%;
  transform: scale(1.12); transition: transform .35s ease; pointer-events: none; user-select: none;
}
.cell.has-art:hover .pic { transform: scale(1.28); }
.cell.has-art .body::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 35%, rgba(9, 11, 17, .55) 60%, rgba(9, 11, 17, .94) 100%);
}
.cell.has-art .cap { position: relative; z-index: 1; margin-top: auto; padding: 3px 4px; text-shadow: 0 1px 2px #000, 0 0 6px #000; }
.cell.has-art .body { display: flex; flex-direction: column; }
.cell.has-art .tokens { z-index: 2; }
/* в боковых колонках клетка широкая и низкая — картинку показываем чуть выше центра */
.cell.s-left.has-art .pic, .cell.s-right.has-art .pic { object-position: center 40%; transform: scale(1.02); }
.cell.s-left.has-art:hover .pic, .cell.s-right.has-art:hover .pic { transform: scale(1.15); }
.cell.owned.has-art .body { box-shadow: inset 0 0 0 2px var(--own); }
.cell.biz.has-art .body { box-shadow: inset 0 0 0 2px var(--own); }
.cell.owned.has-art .pr, .cell.biz.has-art .pr { color: var(--own); }

#modal .hero {
  display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: center 45%;
  border-radius: 10px; margin: 0 0 12px; background: #0b0e15;
}
#modal .hero.short { aspect-ratio: 5 / 2; }

/* ---------- что выпадает в «Шансе» / «Сейфе» ---------- */
.deck-list { display: grid; gap: 12px; }
.deck-list .dk-note { font-size: 12px; }
.dk-group { display: grid; gap: 2px; }
.dk-title { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 8px 2px; }
.dk-title span { opacity: .7; }
.dk-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: baseline; padding: 6px 8px; border-radius: 8px; font-size: 13px; box-shadow: inset 3px 0 0 var(--k); background: color-mix(in srgb, var(--k) 7%, transparent); }
.dk-row b { color: var(--k); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.dk-row.good { --k: var(--good); }
.dk-row.bad { --k: var(--bad); }
.dk-row.move { --k: var(--deal); }
.dk-row.special { --k: var(--accent); }
@media (max-width: 480px) { .dk-row { grid-template-columns: 1fr; gap: 2px; } .dk-row b { text-align: left; } }

/* ---------- карточка собственности ---------- */
/* карточка во всю модалку: шапка цвета группы упирается в верхний край, без второй рамки */
#modal .deed { margin: -18px -18px 0; background: var(--surface); }
.deed .dband { background: var(--gc); color: var(--gi); padding: 10px 12px 12px 14px; display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.deed .dband small { display: block; font-size: 12px; font-weight: 600; opacity: .75; }
#modal .deed .dband h2 { margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -.01em; }
.deed .dband .btn { background: color-mix(in srgb, var(--gi) 12%, transparent); border-color: color-mix(in srgb, var(--gi) 28%, transparent); color: var(--gi); flex: none; }
.deed .dart { position: relative; margin: 14px 14px 0; border-radius: 10px; overflow: hidden; aspect-ratio: 2 / 1; background: #0b0e15; }
.deed .dart img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; display: block; }
.deed .stamp {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg);
  border: 3px solid var(--bad); color: var(--bad); background: #0d1017a0; border-radius: 8px;
  padding: 4px 14px; font-size: 22px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.deed.mort .dart img { filter: grayscale(1) brightness(.55); }
/* итог в одну строку: «вы заплатите / вам заплатят» — сумма по центру — кому (у своей клетки — залог) */
.deed .dnow { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 14px 14px 8px; }
.deed .dnow .dlbl { font-size: 14px; color: var(--muted); }
.deed .dnow .big { display: flex; align-items: center; justify-content: center; font-size: 32px; line-height: 1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deed .dnow .downer span { display: block; font-size: 12px; color: var(--muted); }
.deed .downer { text-align: right; font-size: 13px; display: grid; }
.deed .downer b { font-size: 15px; }
.deed .ladder { display: grid; gap: 2px; padding: 4px 6px; }
/* в окне клетки лесенка стоит сразу под шапкой, над картинкой */
.deed .dband + .ladder { padding-top: 12px; }
.deed .dband + .ladder + .dart { margin-top: 8px; }
.deed .lrow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 6px 8px; border-radius: 8px; font-size: 14px; }
.deed .lrow .ll { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deed .lrow .bb { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.deed .lrow .bb i { display: block; height: 100%; background: color-mix(in srgb, var(--gc) 50%, var(--surface-2)); }
.deed .lrow b { min-width: 4.5em; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deed .lrow.cur { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.deed .lrow.cur b, .deed .lrow.cur .ll { color: var(--accent); font-weight: 700; }
.deed .lrow.cur .bb i { background: var(--accent); }
.deed.mort .ladder { opacity: .4; }
/* дома и отель в лесенке аренды — как в силуэте квартала на клетке: цвет группы, башня с окнами */
.deed .ll svg, .deed .pi svg { fill: var(--gc); stroke: #0b0e15; stroke-width: 1; margin-left: 1px; }
.deed .ll rect, .deed .pi rect { fill: #0b0e15; stroke: none; }
.deed .ll .tw g rect, .deed .pi .tw g rect { fill: #f5d77a; }
.deed .ll .h, .deed .pi .h { width: 13px; height: 13px; vertical-align: -1px; }
.deed .ll .tw, .deed .pi .tw { width: 11px; height: 17px; vertical-align: -3px; }
/* квадратики: сколько клеток группы у владельца (■□□ — одна улица, ■■■ — вся группа) */
.deed .plots { display: inline-flex; gap: 2px; vertical-align: middle; }
.deed .plots i { width: 9px; height: 9px; box-sizing: border-box; border-radius: 2px; border: 1.5px solid var(--gc); }
.deed .plots i.on { background: var(--gc); }

/* шапка лесенки и переключатель «путь / полоски» */
.deed .lhead { display: flex; justify-content: space-between; align-items: center; padding: 0 2px 4px; font-size: 12px; color: var(--muted); }
.deed .ltog {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 12px;
}
.deed .ltog:hover { border-color: var(--accent); color: var(--accent); }
.deed .ltog svg { width: 13px; height: 11px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* путь застройки: значки сверху, точки на дорожке, суммы снизу; пройденное — цветом группы, текущее светится */
.deed .lpath { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 2px 0 4px; }
.deed .lpath .ptrack, .deed .lpath .pfill { position: absolute; left: calc(50% / var(--n)); top: 34px; height: 2px; border-radius: 2px; background: var(--line); }
.deed .lpath .ptrack { right: calc(50% / var(--n)); }
.deed .lpath .pfill { top: 33px; height: 4px; background: var(--gc); width: calc((100% - 100% / var(--n)) * var(--f)); }
.deed .pst { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0; border-radius: 8px; outline: none; cursor: default; }
.deed .pst .pi { height: 18px; display: flex; align-items: center; }
.deed .pst .pi .h { width: 11px; height: 11px; margin-left: 0; }
.deed .pst .pd { height: 18px; display: grid; place-items: center; position: relative; z-index: 1; }
.deed .pst .pd i { width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; border: 2px solid #3a4356; background: var(--surface); }
.deed .pst b { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.deed .pst.past .pd i { background: var(--gc); border-color: var(--gc); }
.deed .pst.cur .pd i { width: 16px; height: 16px; background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.deed .pst.cur b { color: var(--accent); }
.deed .pst.next .pi, .deed .pst.next b { opacity: .55; }
.deed .pst:hover, .deed .pst:focus-visible { background: var(--surface-2); }
.deed .pst:hover .pi, .deed .pst:hover b, .deed .pst:focus .pi, .deed .pst:focus b { opacity: 1; }
/* подсказка: сколько стоит дойти до этапа — под дорожкой, у крайних точек прижата к краю */
.deed .ptip {
  position: absolute; z-index: 5; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: max-content; max-width: 260px;
  display: none; gap: 3px; padding: 9px 11px; border-radius: 10px; background: #0b0e15; border: 1px solid var(--line);
  box-shadow: 0 10px 30px #000c; font-size: 12px; text-align: left; pointer-events: none;
}
.deed .pst.l .ptip { left: 0; transform: none; }
.deed .pst.r .ptip { left: auto; right: 0; transform: none; }
.deed .pst:hover .ptip, .deed .pst:focus .ptip { display: grid; }
.deed .ptip em { font-style: normal; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.deed .ptip span { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); }
.deed .ptip span i { font-style: normal; }
.deed .ptip span b { color: var(--text); font-size: 12px; }
.deed .ptip .done { color: var(--good); }
.deed .dnote { margin: 4px 14px 0; font-size: 13px; color: var(--bad); }
.deed .dfine { margin: 6px 14px 0; padding: 8px 0 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 480px) { .deed .lrow { grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; } .deed .dnow .big { font-size: 26px; } }
#auction .lot-pic { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; background: #0b0e15; }

/* ---------- фишки ---------- */
#boardWrap { position: relative; }
#tokens { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.ptok {
  position: absolute; left: 0; top: 0; width: var(--tok); height: var(--tok);
  transition: transform .15s ease-out; will-change: transform;
}
.ptok.leap { transition: transform .65s ease-in-out; }
.ptok .hop {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  font-size: calc(var(--tok) * .6); line-height: 1;
  background: radial-gradient(circle at 35% 30%, #ffffff70, transparent 55%), var(--c);
  border: 2px solid #000b; box-shadow: 0 4px 10px #000c;
}
.ptok.cur { z-index: 2; }
.ptok.cur .hop { box-shadow: 0 0 0 3px var(--accent), 0 0 16px 3px #f5b942aa, 0 4px 12px #000c; }
/* чей ход: кольцо пульсирует вокруг фишки, при передаче хода — яркая вспышка */
.ptok.cur::before, .ptok.turnstart::after { content: ""; position: absolute; inset: -18%; border-radius: 50%; pointer-events: none; }
.ptok.cur::before { border: 3px solid var(--accent); animation: turnring 1.6s ease-out infinite; }
.ptok.turnstart::after { background: radial-gradient(circle, #f5b942cc, #f5b94200 70%); animation: turnflash 1.6s ease-out 1; }
@keyframes turnring { from { transform: scale(.9); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }
@keyframes turnflash { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ptok.cur::before { animation: none; opacity: .8; } .ptok.turnstart::after { animation: none; opacity: 0; } }
.ptok.jailed .hop { filter: grayscale(.6) brightness(.8); }
.hop.h { animation: hop .17s ease-out; }
.hop.l { animation: leap .65s ease-in-out; }
@keyframes hop {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(-60%) scale(1.1, .95); }
  85% { transform: translateY(0) scale(1.08, .9); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes leap {
  0% { transform: translateY(0) scale(1) rotate(0); }
  50% { transform: translateY(-220%) scale(1.35) rotate(180deg); }
  100% { transform: translateY(0) scale(1) rotate(360deg); }
}
.pdot {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-size: 14px; line-height: 1; border: 2px solid #000a;
}
.pick-title { color: var(--muted); font-size: 13px; margin: 4px 0 6px; }
.pieces { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
.piece {
  font-size: 24px; line-height: 1; padding: 8px 0; border-radius: 10px; cursor: pointer;
  background: var(--surface-2); border: 2px solid var(--line); transition: transform .1s, border-color .15s;
}
.piece:hover:not(:disabled) { transform: translateY(-2px); border-color: #3a4560; }
.piece.on { border-color: var(--accent); background: #2a2414; }
.piece:disabled { opacity: .25; cursor: not-allowed; }

/* картинки фишек */
.ptok .hop.art, .pdot.art, .piece.art { overflow: hidden; }
.ptok .hop img, .pdot img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ptok .hop.art { border: 3px solid var(--c); }
.piece img { width: 34px; height: 34px; object-fit: cover; border-radius: 50%; display: block; margin: 0 auto; }

/* подсветка клеток при ходе */
.cellfx { position: absolute; border-radius: 6px; pointer-events: none; }
.cellfx:not(.land) {
  background: color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--c);
  animation: stepfx .5s ease-out forwards;
}
.cellfx.land {
  background: color-mix(in srgb, var(--c) 24%, transparent);
  box-shadow: inset 0 0 0 3px var(--c), 0 0 22px var(--c);
  animation: landfx 2.2s ease-out forwards;
}
@keyframes stepfx { from { opacity: .9; } to { opacity: 0; } }
@keyframes landfx {
  0% { opacity: 0; transform: scale(1.18); }
  12% { opacity: 1; transform: scale(1); }
  30% { box-shadow: inset 0 0 0 4px var(--c), 0 0 36px var(--c); }
  50% { box-shadow: inset 0 0 0 3px var(--c), 0 0 16px var(--c); }
  70% { opacity: 1; box-shadow: inset 0 0 0 4px var(--c), 0 0 30px var(--c); }
  100% { opacity: 0; }
}

/* угловые клетки с картинкой: растянуть на всю клетку */
.cell.corner.has-art { align-items: stretch; justify-content: stretch; text-align: left; }
.cell.corner.has-art .body { width: 100%; align-items: stretch; justify-content: flex-start; }
.cell.corner.has-art .pic { transform: scale(1.05); object-position: center 50%; }
.cell.corner.has-art:hover .pic { transform: scale(1.15); }
.cell.corner.has-art .cap { text-align: center; }

/* фигурки на фото с запасом по краям — приближаем внутри кружка */
.ptok .hop img, .pdot img { transform: scale(1.22); transform-origin: 50% 45%; }
.piece img { width: 46px; height: 46px; transform: scale(1.18); }

/* аукцион — по центру поля, клетки по краям остаются видны */
#auction {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(440px, 68%); z-index: 40;
  animation: auctionIn .2s ease-out;
}
@keyframes auctionIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.96); } }
/* центр поля под аукционом приглушаем */
#boardWrap:has(#auction:not([hidden]):not(.mini)) #center > * { opacity: .12; pointer-events: none; }
@media (max-width: 900px) {
  /* на телефоне центр поля маленький — окно прижато к низу экрана */
  #auction { position: fixed; top: auto; bottom: 12px; left: 50%; transform: translateX(-50%); width: calc(100vw - 24px); animation: none; }
}

/* ---------- вытянутая карта ---------- */
#cardShow {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 45; perspective: 1200px; cursor: pointer; transition: opacity .3s;
}
#cardShow.out { opacity: 0; }
.flipcard {
  position: relative; width: 230px; height: 330px;
  transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .3, 1.15), opacity .35s;
  transform: translateY(40px) scale(.55) rotateY(0deg) rotateZ(-8deg); opacity: 0;
}
.flipcard.in { transform: translateY(0) scale(1) rotateY(0deg) rotateZ(0deg); opacity: 1; }
.flipcard.in.flip { transform: translateY(0) scale(1) rotateY(180deg); }
.flipcard .face {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden; backface-visibility: hidden;
  box-shadow: 0 24px 60px #000d, 0 0 0 1px #0006;
}
.flipcard .back img { width: 100%; height: 100%; object-fit: cover; }
.back-art {
  width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  border: 8px solid transparent; border-radius: 16px;
  background:
    radial-gradient(circle at 50% 42%, #ffffff22, transparent 45%),
    repeating-linear-gradient(45deg, #ffffff0d 0 6px, transparent 6px 14px),
    var(--deck-bg);
  box-shadow: inset 0 0 0 2px #f5b942, inset 0 0 0 7px var(--deck-bg), inset 0 0 0 8px #f5b94299;
}
.deck-chance { --deck-bg: #3b1d6e; --deck-ink: #6a3fb8; }
.deck-chest { --deck-bg: #0f4d4a; --deck-ink: #1f7a6f; }
.back-icon {
  width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center;
  font: 900 64px/1 Georgia, serif; color: #f5b942;
  border: 3px solid #f5b942; background: #0005; box-shadow: 0 0 30px #f5b94266;
}
.back-title { font-weight: 800; letter-spacing: .25em; text-transform: uppercase; color: #f5b942; }
.flipcard .front {
  transform: rotateY(180deg); background: linear-gradient(#fbf7ee, #efe6d2); color: #1d1a14;
  display: flex; flex-direction: column; align-items: center; padding: 14px; text-align: center;
  border: 6px solid var(--deck-bg);
}
.front-head { font-weight: 900; letter-spacing: .2em; text-transform: uppercase; color: var(--deck-ink); font-size: 15px; }
.front-art { width: 118px; height: 118px; object-fit: cover; border-radius: 12px; margin: 8px 0; box-shadow: 0 4px 12px #0004; }
.front-text { flex: 1; display: grid; place-items: center; font-size: 17px; font-weight: 650; line-height: 1.3; }
.front-who { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.front-who .pdot { width: 22px; height: 22px; }
@media (max-width: 900px) {
  #cardShow { position: fixed; }
  .flipcard { width: 200px; height: 290px; }
  .front-art { width: 90px; height: 90px; }
  .front-text { font-size: 15px; }
}

/* значок владельца — снаружи клетки, у её внутреннего края, с «ножкой» к полоске цвета (см. ownerBadge) */
.own-badge {
  --ob: max(14.5px, calc(var(--size) * .595 / 17)); --gap: 5px;
  position: relative; z-index: 2; pointer-events: auto; cursor: pointer;
  width: var(--ob); height: var(--ob);
  transform: translate(calc(var(--sx, 0) * var(--ob) * .55), calc(var(--sy, 0) * var(--ob) * .55));
}
.own-badge::after { content: ''; position: absolute; background: var(--own); border-radius: 1px; }
/* ножка = отступ + промежуток сетки (2px) до клетки */
.own-badge.s-bottom { align-self: end; justify-self: center; margin-bottom: var(--gap); }
.own-badge.s-bottom::after { left: calc(50% - 1px); width: 2px; top: 100%; height: calc(var(--gap) + 2px); }
.own-badge.s-top { align-self: start; justify-self: center; margin-top: var(--gap); }
.own-badge.s-top::after { left: calc(50% - 1px); width: 2px; bottom: 100%; height: calc(var(--gap) + 2px); }
.own-badge.s-left { justify-self: start; align-self: center; margin-left: var(--gap); }
.own-badge.s-left::after { top: calc(50% - 1px); height: 2px; right: 100%; width: calc(var(--gap) + 2px); }
.own-badge.s-right { justify-self: end; align-self: center; margin-right: var(--gap); }
.own-badge.s-right::after { top: calc(50% - 1px); height: 2px; left: 100%; width: calc(var(--gap) + 2px); }
/* квадратный маркер владельца: скруглён только внутренний угол, внешние совпадают с краями клетки */
.own-badge .pdot {
  width: 100%; height: 100%; border: 2px solid var(--own); border-radius: 22%;
  box-shadow: 0 0 0 1px #000c, 0 2px 6px #000c; font-size: calc(var(--size) * .595 / 30);
}
.own-badge .pdot img { border-radius: 16%; }

/* подписи клеток — по центру */
.cell .body { text-align: center; }
.cell.has-art .cap { text-align: center; }
/* у купленной клетки суммы нет — значок владельца встаёт в её строку, название остаётся по центру на всю ширину */
.cell.has-own .cap, .cell.has-own:not(.has-art) .nm { padding-left: 0 !important; padding-right: 0 !important; }

/* подписи по центру и по вертикали, и по горизонтали */
.cell .body { justify-content: center; align-items: center; }
.cell.has-art .cap { margin: auto 0; width: 100%; }
.cell.has-own .pr:empty { display: none; }
/* затемнение — полосой через середину, чтобы текст читался поверх картинки */
.cell.has-art .body::after {
  background: linear-gradient(to bottom, rgba(9, 11, 17, .15) 0%, rgba(9, 11, 17, .72) 38%, rgba(9, 11, 17, .72) 62%, rgba(9, 11, 17, .15) 100%);
}
/* купленная клетка: название видно всегда (как у свободной), без цветной рамки — владельца показывает значок в углу */
.cell.has-own.has-art .body { box-shadow: none; }

/* ---------- кнопка и окно правил ---------- */
.rules-btn {
  position: fixed; z-index: 40; top: calc(10px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px));
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 18px; font-weight: 800; cursor: pointer; box-shadow: 0 4px 14px #0008;
}
.rules-btn:hover { border-color: var(--accent); color: var(--accent); }
/* обучение ещё не открывали — кнопка мягко зовёт */
.rules-btn.fresh { border-color: var(--accent); color: var(--accent); animation: helpPulse 1.8s ease-in-out infinite; }
@keyframes helpPulse { 50% { box-shadow: 0 4px 14px #0008, 0 0 0 8px #f5b94233; } }
@media (prefers-reduced-motion: reduce) { .rules-btn.fresh { animation: none; } }

/* шпаргалка «Как играть»: оглавление слева, темы справа (текст + картинка) */
.ltop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ltop h2 { margin: 0 auto 0 0 !important; }
.lex { margin: 0; padding-left: 12px; border-left: 3px solid var(--deal); line-height: 1.5; }
.lex b { color: var(--deal); }
.ltip { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.lsr { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; }
.deed.lladder { width: 100%; margin: 0 !important; background: none !important; }
#modal.m-learn { width: min(1100px, 100%); height: calc(100vh - 32px); display: flex; flex-direction: column; gap: 14px; overflow: hidden; padding: 20px 24px; }
.sh { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px 1fr; gap: 24px; }
.sh-toc { display: grid; align-content: start; gap: 2px; overflow: auto; }
.sh-toc button { text-align: left; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.sh-toc button:hover { background: var(--surface-2); color: var(--text); }
.sh-body { overflow: auto; padding-right: 8px; }
.sh-body section { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 24px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 4px; }
.sh-body section:first-child { padding-top: 0; }
.sh-body section:last-child { border-bottom: 0; }
.sh-text { display: grid; gap: 8px; }
.sh-text h3 { margin: 0; font-size: 18px; color: var(--accent); }
.sh-text p { margin: 0; line-height: 1.55; }
.sh-pic { display: flex; flex-direction: column; align-items: center; gap: 10px; }
@media (max-width: 860px) {
  .sh { grid-template-columns: 1fr; gap: 10px; }
  .sh-toc { display: flex; flex-wrap: nowrap; overflow-x: auto; }
  .sh-toc button { white-space: nowrap; }
  .sh-body section { grid-template-columns: 1fr; gap: 12px; }
  .sh-pic { order: -1; }
}

/* мини-клетка поля */
.lcell { width: 92px; display: grid; gap: 4px; justify-items: center; text-align: center; font-size: 11px; line-height: 1.2; }
.lcell .lci {
  position: relative; width: 92px; height: 72px; overflow: hidden; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: inset 0 4px 0 var(--gc);
  font-size: 30px;
}
.lcell[style*="--own"] .lci { border-color: var(--own); box-shadow: inset 0 4px 0 var(--gc), 0 0 0 2px var(--own); }
.lcell .lci img { width: 100%; height: 100%; object-fit: cover; }
.lcell b { font-weight: 600; }
.lcell small { color: var(--accent); font-weight: 700; font-size: 12px; }
.lcell.dim .lci { opacity: .45; }
.lcell .sky { position: absolute; left: 0; right: 0; bottom: 0; height: 2.6em; padding-bottom: .25em; display: flex; align-items: flex-end; justify-content: center; gap: .12em; font-size: 14px;
  background: linear-gradient(to top, rgba(9, 11, 17, .92), transparent); }
.lcell .sky svg { flex: none; fill: var(--gc); stroke: #0b0e15; stroke-width: 1; }
.lcell .sky rect { fill: #0b0e15; stroke: none; }
.lcell .sky .h { width: 1.15em; height: 1.15em; }
.larr { display: grid; justify-items: center; color: var(--muted); font-size: 22px; line-height: 1; }
.larr small { font-size: 11px; }
.lbig { font-size: 20px; font-weight: 800; color: var(--accent); }
.lvs { color: var(--muted); font-size: 12px; max-width: 70px; text-align: center; }
.lswap { font-size: 24px; color: var(--deal); }
.lmoney { font-weight: 800; color: var(--accent); }
.lchip { display: grid; gap: 2px; padding: 8px 14px; border-radius: 10px; text-align: center; font-weight: 700; color: var(--c); background: var(--surface-2); border: 1px solid var(--c); }
.lchip small { color: var(--text); font-weight: 600; }
.lbids { display: grid; gap: 6px; font-size: 13px; }
.lbids span { padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--c); }
.lbids span:last-child { color: var(--accent); font-weight: 700; }
.lreels .reel { width: 64px; height: 74px; }
.lreels .reel .sym { font-size: 36px; }
.lshares { width: min(300px, 100%); gap: 0; flex-wrap: nowrap; border-radius: 8px; overflow: hidden; font-size: 12px; font-weight: 700; }
.lshares span { padding: 4px 8px; text-align: center; background: color-mix(in srgb, var(--c) 30%, var(--surface-2)); border-bottom: 3px solid var(--c); }
@media (max-width: 520px) {
  .lcell, .lcell .lci { width: 74px; } .lcell .lci { height: 58px; }
}
.rules-body { display: grid; gap: 14px; }
.rules-body h3 { margin: 0 0 4px; font-size: 15px; color: var(--accent); }
.rules-body ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.rules-body li { line-height: 1.45; }

/* обратный отсчёт автозавершения хода на кнопке */
.btn .autoend { font-size: .8em; font-weight: 600; opacity: .75; font-variant-numeric: tabular-nums; }

/* ---------- уведомления банка: зачисление / списание ---------- */
#bank { position: fixed; z-index: 55; top: calc(56px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 8px; width: min(320px, calc(100vw - 24px)); pointer-events: none; }
.bank-note {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 14px; background: #1b2130f2; border: 1px solid var(--line);
  box-shadow: 0 10px 30px #000a; animation: bankin .3s ease-out; transition: opacity .3s, transform .3s;
}
.bank-note.gone { opacity: 0; transform: translateX(20px); }
.bank-note .bico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 17px; }
.bank-note.in .bico { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.bank-note.out .bico { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.bank-note .btxt { display: grid; min-width: 0; }
.bank-note .btxt b { font-size: 14px; }
.bank-note .btxt span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-note .bsum { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-note.in .bsum { color: var(--good); }
.bank-note.out .bsum { color: var(--text); }
@keyframes bankin { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- покупка: событие на всё поле ---------- */
#buyShow { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; transition: opacity .3s; }
#buyShow.out { opacity: 0; }
.buy-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; max-width: min(440px, 90%);
  padding: 12px 18px 12px 12px; border-radius: 16px; background: #151a24f5; border: 2px solid var(--pc);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 25%, transparent), 0 20px 50px #000c; animation: buyin .45s cubic-bezier(.2, 1.4, .4, 1);
}
.buy-card img, .buy-card .buy-ico { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; box-shadow: inset 0 -6px 0 var(--gc); display: grid; place-items: center; font-size: 40px; background: #0b0e15; }
.buy-card img { border-bottom: 6px solid var(--gc); }
.buy-who { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.buy-who .pdot { width: 22px; height: 22px; }
.buy-name { font-size: 22px; font-weight: 800; line-height: 1.15; margin-top: 2px; }
.buy-price { font-size: 15px; color: var(--accent); font-weight: 700; }
@keyframes buyin { from { opacity: 0; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .buy-card, .bank-note { animation: none; } }

/* заголовок панели с кнопкой справа */
.panel h3.ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel h3.ph .btn { font-weight: 600; }

/* партнёрство на поле: фишки участников стопкой в углу, золотая рамка */
.own-badge.biz { width: auto; display: flex; }
.own-badge.biz .pdot {
  width: var(--ob); height: var(--ob); flex: none;
  border-color: var(--accent); border-radius: 18%;
}

.own-badge.biz .pdot + .pdot { margin-left: calc(var(--ob) * -.45); }
.own-badge.biz .pdot img { border-radius: 14%; }

/* партнёрство в окне клетки: кто участвует и в каких долях */
#modal .partners { margin-top: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 6%, transparent); display: grid; gap: 6px; }
.partners .ptitle { font-weight: 700; }
.partners .prow { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.partners .pname { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.partners .pname .pdot { width: 22px; height: 22px; }
.partners .ptag { font-size: 12px; color: var(--muted); }
.partners .pbar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.partners .pbar i { display: block; height: 100%; }
.partners .pshare { font-variant-numeric: tabular-nums; min-width: 3em; text-align: right; }
.partners .pnote { font-size: 12px; color: var(--muted); }

/* настройки комнаты в лобби */
.settings { display: grid; gap: 8px; margin-bottom: 14px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); }
.set-row span { display: grid; font-size: 14px; }
.set-row small { font-size: 12px; color: var(--muted); }
.set-row select { width: auto; flex: none; }

/* салют на поле при выигрыше в казино */
.fireworks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 8; }
.reel.done .sym { animation: reelstop .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes reelstop { from { transform: scale(.6); } }

/* вход по ссылке-приглашению */
.invite-head { text-align: center; font-size: 16px; margin-bottom: 10px; }
.invite-head b { color: var(--accent); letter-spacing: .15em; }
.join-note { margin: 8px 0 0; color: var(--bad); font-size: 13px; text-align: center; }
.own-room { display: block; margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted); }
#joinBtn.big { flex: 1; }

/* аукцион: торги слева, карточка лота справа */
#boardWrap #auction { width: min(780px, 82%); }
#auction .au-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#auction .au-info { border-left: 1px solid var(--line); padding-left: 16px; display: grid; gap: 8px; align-content: start; }
#auction .au-h { font-size: 13px; font-weight: 700; color: var(--muted); }
#auction .au-info .ladder { padding: 0; gap: 0; }
#auction .au-info .lrow { padding: 3px 4px; font-size: 13px; gap: 8px; }
#auction .au-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5em, 1fr)); gap: 6px; }
#auction .au-nums div { background: var(--surface-2); border-radius: 8px; padding: 5px 8px; display: grid; }
#auction .au-nums span { font-size: 11px; color: var(--muted); }
#auction .au-nums b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#auction .au-group { display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
#auction .au-g { display: flex; align-items: center; gap: 6px; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#auction .au-g i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
#auction .au-tip { font-size: 13px; font-weight: 600; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
#auction .au-tip.mine { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
/* вышел из торгов (пас) или продаёт сам: компактное окно в правом верхнем углу центра поля —
   таймер, текущая сумма и участники; лидер торгов в рамке */
#boardWrap #auction.mini {
  left: auto; top: var(--am-top, 12px); right: var(--am-right, 12px); transform: none; animation: none;
  width: auto; min-width: 190px; max-width: 260px; padding: 10px 12px; border-color: var(--line);
}
#auction.mini .am-row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
#auction.mini .high { font-size: 20px; margin: 0; white-space: nowrap; }
#auction.mini .timer { font-size: 18px; }
#auction.mini .who { margin: 6px 0 0; }
#auction .who span.lead { box-shadow: inset 0 0 0 1.5px currentColor; font-weight: 700; }
/* на телефоне окно аукциона прижато к низу экрана, свёрнутое — к верхнему правому углу */
@media (max-width: 900px) { #boardWrap #auction.mini { position: fixed; top: 12px; right: 12px; bottom: auto; left: auto; transform: none; width: auto; } }
@media (max-width: 900px) {
  #auction { max-height: 78vh; overflow: auto; }
  #auction .au-grid { grid-template-columns: 1fr; gap: 10px; }
  #auction .au-info { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 10px; }
}

/* дороги по своему транспорту */
#routes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; overflow: visible; }
#routes .road-bed { fill: none; stroke: #0d1017; stroke-width: 9; stroke-linecap: round; opacity: .7; }
#routes .road { fill: none; stroke: var(--rc); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 10 8; animation: roadflow .8s linear infinite; }
#routes .road-end { fill: var(--rc); stroke: #0d1017; stroke-width: 3; }
#routes .road-start { fill: #0d1017; stroke: var(--rc); stroke-width: 3; }
@keyframes roadflow { to { stroke-dashoffset: -18; } }
.cell.route-to { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 2; cursor: pointer; animation: routepulse 1.2s ease-in-out infinite; }
@keyframes routepulse { 50% { box-shadow: 0 0 22px #f5b942aa; } }
@media (prefers-reduced-motion: reduce) { #routes .road, .cell.route-to { animation: none; } }

/* предложения в центре поля */
.offer { position: relative; text-align: left; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--deal); border-radius: 12px; padding: 10px 12px; box-shadow: 0 10px 30px #0009; }
.offer.forme { border-color: var(--deal); box-shadow: 0 0 0 2px #7cc4ff44, 0 10px 30px #0009; animation: offerin .3s ease-out; }
.offer.review { border-left-color: var(--accent); }
.offer-m { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.offer .row { justify-content: flex-start; }
.offer-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.offer-x:hover { border-color: var(--bad); color: var(--bad); }
/* предложение — вертикальная карта-контракт: картинка главной клетки, вид сделки, стороны, цена или условия;
   в истории — штамп с итогом. Тон рамки: входящее — голубой, обсуждение/моё — золото, итог — по исходу */
.offers { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 12px; width: 100%; }
.offer.ocard {
  --tc: var(--deal);
  width: min(280px, 100%); padding: 0; overflow: hidden; border: 2px solid var(--line); border-radius: 16px;
  background: var(--surface); box-shadow: 0 16px 36px #0009; text-align: left;
}
.offer.ocard.t-accent { --tc: var(--accent); }
.offer.ocard.t-good { --tc: var(--good); }
.offer.ocard.t-bad { --tc: var(--bad); }
.offer.ocard.t-muted { --tc: var(--muted); }
.offer.ocard.forme, .offer.ocard.t-accent:not(.hist) { border-color: var(--tc); }
.offer.ocard.hist { opacity: .9; box-shadow: none; }
.oc-hero { position: relative; height: 140px; background: #0b0e15; overflow: hidden; }
.oc-pics { position: absolute; inset: 0; display: flex; }
.oc-pics img { flex: 1; min-width: 0; height: 100%; object-fit: cover; object-position: center 42%; }
.oc-pics img + img { border-left: 2px solid #0b0e15; }
.oc-pics img:only-child { transform: scale(1.2); }
.oc-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, #090b11f2 0%, #090b1133 55%, #090b111a 100%); pointer-events: none; }
.oc-kind { position: absolute; z-index: 1; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: #0d1017e0; color: var(--tc); font-size: 12px; font-weight: 800; }
.oc-id { position: absolute; z-index: 1; top: 12px; right: 12px; font-size: 12px; color: #c5ccd9; }
.ocard .offer-x { z-index: 2; top: 8px; right: 8px; background: #0d1017e0; }
.ocard.forme .oc-id { right: 44px; }
.oc-title { position: absolute; z-index: 1; left: 12px; right: 12px; bottom: 10px; display: grid; gap: 4px; }
.oc-title b { font-size: 17px; line-height: 1.15; }
.oc-title i { display: block; width: 48px; height: 4px; border-radius: 2px; }
.oc-stamp {
  position: absolute; z-index: 1; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-14deg); white-space: nowrap;
  padding: 3px 14px; border: 3px solid var(--tc); border-radius: 8px; color: var(--tc); background: #0d1017a6;
  font-size: 19px; font-weight: 900; letter-spacing: .1em;
}
.oc-body { display: grid; gap: 9px; padding: 12px 14px 14px; font-size: 13px; }
.oc-who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.oc-who .pdot { width: 22px; height: 22px; }
.oprice { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.oprice span { color: var(--muted); }
.oprice b { display: inline-flex; align-items: center; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.oline { color: #c5ccd9; line-height: 1.4; }
.ogive { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.ogive .ow { color: var(--muted); }
.ochip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 2px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--gc, var(--accent)); white-space: nowrap; }
.ochip img, .ochip > i { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; font-style: normal; display: grid; place-items: center; font-size: 13px; }
.ochip em { font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: var(--bad); border-radius: 4px; padding: 0 4px; }
.ochip.money { padding: 3px 10px; font-weight: 800; }
.oshare { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.oshare i { display: block; }
.olegend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.oterms { display: grid; gap: 3px; font-size: 12px; color: #c5ccd9; }
.ostar { padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 12px; font-weight: 700; }
.onote { font-size: 12px; color: var(--muted); line-height: 1.4; }
.oc-btns { display: flex; gap: 8px; }
.oc-btns .btn { flex: 1; }
.offer.ocard:hover { border-color: var(--tc); }
/* клетки, которые затрагивает предложение под курсором, — в рамке цвета будущего владельца */
.cell.offer-hl { outline: 3px solid var(--hl); outline-offset: -3px; z-index: 2; box-shadow: 0 0 18px var(--hl); }
@keyframes offerin { from { opacity: 0; transform: translateY(-8px); } }

/* уведомления банка — внутри поля, в правом нижнем углу */
#boardWrap > #bank { position: absolute; top: auto; z-index: 9; width: 300px; }
@media (max-width: 900px) { #boardWrap > #bank { position: fixed; right: 12px; bottom: 70px; max-width: calc(100vw - 24px); } }

/* крестик у вытянутой карты */
.card-x { position: absolute; top: -12px; right: -12px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; cursor: pointer; box-shadow: 0 4px 12px #0009; }
.card-x:hover { border-color: var(--accent); color: var(--accent); }

/* игроки: наличные / капитал */
.pl-mode { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.pl-mode button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.pl-mode button.on { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.pl-hint { font-size: 11px; color: var(--muted); padding: 4px 6px 0; }
.pl .money[title] { cursor: help; }

/* история игры в окне */
.hist-tabs { margin-bottom: 8px; }
.hist { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.hist .e { color: #c3cad8; }
.hist .e.turn { color: var(--accent); margin-top: 6px; font-weight: 600; }
.hist .e.good { color: var(--good); }
.hist .e.bad { color: var(--bad); }
.hist .e.deal { color: var(--deal); }
.hist .e.auction { color: #ffcf7a; }
.hist .e.system { color: #c9a7ff; }
.hist .e.chat { color: var(--text); background: #ffffff0a; padding: 2px 6px; border-radius: 6px; }
.hist .e.card { color: #f4e3b5; }

/* в панели только 5 последних событий — прижимаем их к полю чата */
#log { justify-content: flex-end; }

/* возврат на своё место */

/* пауза: поле затемнено, карточка с причиной по центру */
#pauseShow { position: absolute; inset: 0; z-index: 42; display: grid; place-items: center; background: #070a10cc; backdrop-filter: blur(2px); }
.pause-card { text-align: center; background: var(--surface); border: 1px solid var(--accent); border-radius: 16px; padding: 20px 24px; width: min(380px, 86%); box-shadow: 0 20px 60px #000c; }
.pause-card h2 { margin: 4px 0 6px; font-size: 26px; }
.pause-card p { margin: 6px 0; }
.pause-ico { font-size: 40px; line-height: 1; }

/* стрелка к клетке аукциона */
#auArrow { position: absolute; width: 34px; height: 34px; z-index: 41; pointer-events: none; transform: rotate(var(--rot)); }
#auArrow svg { width: 100%; height: 100%; fill: var(--accent); stroke: #0d1017; stroke-width: 2; filter: drop-shadow(0 3px 6px #000c); animation: arrowbob .8s ease-in-out infinite; }
@keyframes arrowbob { 50% { transform: translateY(6px); } }
.cell.au-cell { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 2; box-shadow: 0 0 20px #f5b942aa; }
@media (prefers-reduced-motion: reduce) { #auArrow svg { animation: none; } }
@media (max-width: 900px) { #pauseShow { position: fixed; } }

/* менеджер предложений */
.otabs { margin-bottom: 10px; flex-wrap: wrap; }
.olist { width: 100%; }
.olist .offer { box-shadow: none; }
.obadge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--deal); color: #0d1017; font-size: 11px; font-weight: 800; }
.chk-line { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; margin-bottom: 8px; }
.chk-line input { width: auto; }
.osum { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.osum b { color: var(--text); }
.osum b.hot { color: var(--deal); }

/* монетка — значок валюты */
.coin { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -.17em; margin-right: .18em; filter: drop-shadow(0 1px 1px #0008); }

/* финал партии */
.final-banner { display: flex; flex-direction: column; align-items: center; gap: .7em; }
.final-banner .fb-cup { font-size: 4.2em; line-height: 1; filter: drop-shadow(0 6px 18px #f5b94266); animation: cup-in .6s cubic-bezier(.2, 1.6, .4, 1); }
.final-banner .pdot { width: 3.4em; height: 3.4em; font-size: 1.9em; box-shadow: 0 0 0 3px var(--accent), 0 8px 24px #0009; }
.final-banner .fb-title { font-size: 2em; font-weight: 800; letter-spacing: -.01em; }
.final-banner.me .fb-title { color: var(--accent); text-shadow: 0 0 24px #f5b94255; }
.final-banner .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@keyframes cup-in { from { transform: scale(.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }

#modal:has(.final) { width: min(480px, 100%); }
.final { text-align: center; }
.final-cup { font-size: 64px; line-height: 1; margin: 4px 0 8px; animation: cup-in .6s cubic-bezier(.2, 1.6, .4, 1); filter: drop-shadow(0 6px 18px #f5b94266); }
#modal .final h2 { font-size: 28px; margin: 0; }
.final.won h2 { color: var(--accent); }
.final-sub { color: var(--muted); margin: 6px 0 16px; font-size: 15px; }
.final-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin-bottom: 16px; }
.final-stats .fs { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 6px; display: flex; flex-direction: column; gap: 2px; }
.final-stats .fs b { font-size: 18px; font-variant-numeric: tabular-nums; }
.final-stats .fs span { color: var(--muted); font-size: 12px; }
.final-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.final-places li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.final-places li.win { border-color: var(--accent); background: #2a2414; }
.final-places li.me { box-shadow: inset 3px 0 0 var(--deal); }
.final-places .fp-place { width: 26px; text-align: center; font-size: 18px; font-weight: 700; color: var(--muted); }
.final-places .fp-name { flex: 1; font-weight: 600; }
.final-places .fp-note { color: var(--muted); font-size: 12px; }
.final-places li.win .fp-note { color: var(--accent); font-weight: 600; }
.final .actions { justify-content: center; margin-top: 16px; }
@media (prefers-reduced-motion: reduce) { .final-cup, .final-banner .fb-cup { animation: none; } }

/* график капитала после игры */
#modal:has(.cap-chart) { width: min(680px, 100%); }
.cap-chart { margin: 0 0 16px; text-align: left; }
.cc-title { font-weight: 650; margin-bottom: 6px; }
.cc-plot { position: relative; }
.cc-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.cc-grid line { stroke: var(--line); stroke-width: 1; }
.cc-grid line.g { stroke-dasharray: 2 4; }
.cc-grid line.base { stroke: #3a4560; }
.cap-chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.cc-lines polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.cc-lines polyline.out { opacity: .75; }
.cc-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; visibility: hidden; }
.cc-cross.on { visibility: visible; }
.cc-mark { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.cc-mark .pdot { width: 22px; height: 22px; font-size: 12px; box-shadow: 0 0 0 2px var(--surface), 0 2px 8px #000a; }
.cc-mark.out .pdot { filter: grayscale(.6); opacity: .8; }
.cc-axis { color: var(--muted); font-size: 11px; text-align: center; margin-top: -2px; }
.cc-tip {
  position: absolute; top: 4px; min-width: 150px; padding: 8px 10px; border-radius: 8px; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 6px 20px #000a; font-size: 12px; z-index: 2;
}
.cc-tip .ct-h { color: var(--muted); margin-bottom: 4px; }
.cc-tip .ct-r { display: flex; align-items: center; gap: 6px; }
.cc-tip .ct-r i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cc-tip .ct-r span { flex: 1; }
.cc-tip .ct-r b { font-variant-numeric: tabular-nums; }

/* подсказка клавиши на кнопке */
.btn kbd.key {
  font: 600 10px/1 system-ui, sans-serif; margin-left: 6px; padding: 2px 5px; border-radius: 4px; vertical-align: 1px;
  background: #0002; border: 1px solid #0003; color: inherit; opacity: .7; text-transform: lowercase;
}
@media (hover: none) { .btn kbd.key { display: none; } }

/* ---------- кнопки действий — карты веером ---------- */
.afan { display: flex; justify-content: center; align-items: flex-end; padding: 10px 0 6px; }
.acard {
  --cw: clamp(92px, calc(var(--size, 900px) * .155), 148px);
  position: relative; flex: none; width: var(--cw); aspect-ratio: 148 / 206; margin: 0 -3px; padding: 0;
  border-radius: 14px; overflow: hidden; cursor: pointer; font: inherit; color: var(--text); text-align: center;
  background: #10151f; border: 1px solid var(--line); box-shadow: 0 14px 30px #0009;
  transform: rotate(var(--r, 0deg)) translateY(var(--l, 0px)); transform-origin: 50% 120%;
  transition: transform .18s ease, box-shadow .18s ease;
}
.acard:hover:not(:disabled), .acard:focus-visible { transform: translateY(-12px) scale(1.04); z-index: 2; box-shadow: 0 22px 40px #000b; outline: none; }
.acard:active:not(:disabled) { transform: translateY(-8px) scale(1.02); }
.acard:disabled { opacity: .55; filter: grayscale(1); cursor: not-allowed; }
.acard:disabled .ac-art.line, .acard:disabled .ac-art.build { stroke: var(--muted); fill: var(--muted); }
.acard.primary { border: 2px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent), 0 18px 40px #000b; z-index: 1; }
.acard.muted { opacity: .65; }
.acard.muted:hover:not(:disabled) { opacity: 1; }
.acard .ac-pic { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #1d2638, #0d1118); }
.acard .ac-pic img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; transform: scale(1.3); }
.acard .ac-pic img.icon { width: 56%; height: auto; object-fit: contain; transform: translateY(-22%); }
.acard .ac-art { width: 80%; transform: translateY(-34%); }
.acard .ac-art circle { fill: #1a1a1a; }
.acard .ac-art.line { width: 44%; fill: none; stroke: var(--deal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acard .ac-art.build { width: 62%; fill: var(--accent); stroke: #0b0e15; stroke-width: 1; }
.acard .ac-art.end { width: 46%; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.acard .ac-glyph { font-size: calc(var(--cw) * .38); transform: translateY(-30%); }
.acard .ac-frame { position: absolute; inset: 6px; border-radius: 10px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; }
.acard .ac-cap {
  position: absolute; left: 0; right: 0; bottom: 0; display: grid; gap: 2px; padding: 28% 8px 12%;
  background: linear-gradient(to top, #090b11f5 0%, #090b11d9 55%, transparent 100%);
}
.acard .ac-cap b { font-size: calc(var(--cw) * .1); line-height: 1.2; }
.acard .ac-cap small { font-size: calc(var(--cw) * .08); color: #c5ccd9; line-height: 1.25; }
.acard.primary .ac-cap b { color: var(--accent); }
.acard kbd.key {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%); padding: 2px 7px; border-radius: 6px;
  font: 700 10px/1.3 system-ui, sans-serif; background: #0d1017d9; color: var(--accent); border: 0; text-transform: lowercase;
}
@media (hover: none) { .acard kbd.key { display: none; } }
@media (prefers-reduced-motion: reduce) { .acard { transition: none; } }
/* окно стройки */
.bgroup { display: grid; gap: 4px; margin-bottom: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); box-shadow: inset 3px 0 0 var(--gc); }
.bgroup .bg-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.bgroup .bg-h i { width: 10px; height: 10px; border-radius: 50%; background: var(--gc); }
.bgroup .brow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; font-size: 14px; }
.bgroup .bn { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bgroup .bh { display: inline-flex; gap: 2px; align-items: center; min-width: 64px; justify-content: flex-end; font-size: 12px; }
.bgroup .bh svg { fill: var(--gc); stroke: #0b0e15; stroke-width: 1; }
.bgroup .bh rect { fill: #0b0e15; stroke: none; }
.bgroup .bh .tw g rect { fill: #f5d77a; }
.bgroup .bh .h { width: 13px; height: 13px; }
.bgroup .bh .tw { width: 11px; height: 17px; }
/* на телефоне веер выпрямляем: ровный ряд карт */
@media (max-width: 900px) { .acard { --r: 0deg !important; --l: 0px !important; margin: 0 3px; } }

/* бездействие и автопилот */
.idle-warn {
  color: var(--accent); font-weight: 650; font-size: 15px; padding: 6px 14px; border-radius: 999px;
  background: #f5b9421a; border: 1px solid #f5b94255; animation: idle-pulse 1s ease-in-out infinite alternate;
}
.idle-warn b { font-variant-numeric: tabular-nums; }
@keyframes idle-pulse { from { box-shadow: 0 0 0 0 #f5b94200; } to { box-shadow: 0 0 0 6px #f5b94222; } }
.autopilot {
  display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 420px;
  padding: 14px 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--deal);
  box-shadow: 0 0 0 4px #7cc4ff1a, 0 10px 30px #0008;
}
.autopilot .ap-t { font-size: 18px; font-weight: 750; }
.autopilot .ap-s { color: var(--muted); }
.ap-tag { color: var(--deal); font-size: 11px; }
@media (prefers-reduced-motion: reduce) { .idle-warn { animation: none; } }

/* меню в шапке блока игроков */
.menu-wrap { position: relative; }
#menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 270px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #000b;
  display: flex; flex-direction: column; gap: 2px; text-transform: none; letter-spacing: normal;
}
#menu .mi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
}
#menu .mi small { color: var(--muted); font-size: 12px; font-weight: 400; }
#menu .mi:hover:not(:disabled) { background: var(--surface-2); }
#menu .mi:disabled { cursor: not-allowed; color: var(--muted); }

/* голосование за конец игры */
.vote-box {
  display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 460px;
  padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--accent);
  box-shadow: 0 0 0 4px #f5b9421a, 0 10px 30px #0008;
}
.vote-box .vb-t { font-size: 16px; font-weight: 750; }
.vote-box .vb-s { color: var(--muted); }
.vote-box .vb-n { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-size: 12px; }
.vote-box .vb-n .yes { color: var(--good); }
.vote-box .vb-n .wait { color: var(--muted); }

/* зоны цветовых групп у внутреннего края клеток */
.gzone {
  --gz-a: 34%; /* насыщенность у края клеток */
  position: relative; z-index: 1; pointer-events: none; display: flex; align-items: center; justify-content: center;
  border-radius: 4px; color: #fff; font-weight: 700; font-size: 1.25em; letter-spacing: .01em; white-space: nowrap;
  text-shadow: 0 1px 3px #000c;
}
.gzone.full { --gz-a: 60%; }
.gzone span { opacity: .9; }
.gzone.full span { opacity: 1; }
.gzone.s-bottom { align-self: end; height: 4.6em; align-items: flex-start; padding-top: .35em; background: linear-gradient(to top, color-mix(in srgb, var(--gc) var(--gz-a), transparent), transparent); }
.gzone.s-top { align-self: start; height: 4.6em; align-items: flex-end; padding-bottom: .35em; background: linear-gradient(to bottom, color-mix(in srgb, var(--gc) var(--gz-a), transparent), transparent); }
.gzone.s-left { justify-self: start; width: 4.6em; justify-content: flex-end; padding-right: .35em; background: linear-gradient(to right, color-mix(in srgb, var(--gc) var(--gz-a), transparent), transparent); }
.gzone.s-right { justify-self: end; width: 4.6em; justify-content: flex-start; padding-left: .35em; background: linear-gradient(to left, color-mix(in srgb, var(--gc) var(--gz-a), transparent), transparent); }
.gzone.s-left span, .gzone.s-right span { writing-mode: vertical-rl; }
.gzone.s-left span { transform: rotate(180deg); } /* слева читается снизу вверх, справа — сверху вниз */
/* на узком экране центр без отступов: подписи зон налезали бы на кнопки — оставляем только узкую подложку */
@media (max-width: 900px) {
  .gzone span { display: none; }
  .gzone.s-bottom, .gzone.s-top { height: 1.4em; }
  .gzone.s-left, .gzone.s-right { width: 1.4em; }
}
/* узкий экран: значки владельцев у краёв центра — компактнее, а содержимое центра отодвигаем от них */
@media (max-width: 900px) {
  .own-badge { --ob: max(12px, calc(var(--size) * .595 / 17)); --gap: 3px; }
  #center { padding: .8em 2.3em; }
}

/* ---------- быстрые предложения: вход в менеджере — четыре карты ---------- */
.qdeal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.qcard {
  --tc: var(--deal); display: grid; padding: 0; overflow: hidden; border-radius: 14px; cursor: pointer; text-align: left;
  font: inherit; color: var(--text); background: var(--surface); border: 2px solid var(--tc); transition: transform .15s, box-shadow .15s;
}
.qcard.t-good { --tc: var(--good); } .qcard.t-bad { --tc: #ff8a8a; } .qcard.t-accent { --tc: var(--accent); }
.qcard:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 12px 26px #0009; }
.qcard:disabled { opacity: .5; filter: grayscale(1); cursor: not-allowed; }
.qc-pics { position: relative; display: flex; height: 78px; background: radial-gradient(circle at 50% 40%, #1d2638, #0d1118); }
.qc-pics img { flex: 1; min-width: 0; height: 100%; object-fit: cover; }
.qc-pics img + img { border-left: 2px solid #0b0e15; }
.qc-coin { position: absolute; right: 6px; bottom: 6px; font-size: 26px; }
.qc-coin .coin { margin: 0; }
.qc-cap { display: grid; gap: 1px; padding: 8px 11px 10px; }
.qc-cap b { color: var(--tc); font-size: 15px; }
.qc-cap small { color: var(--muted); font-size: 12px; }

/* ---------- купить / продать клетку ---------- */
.dwrap { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 560px) { .dwrap { grid-template-columns: 1fr; } }
.dtarget { border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 2px solid var(--good); }
.dt-pic { position: relative; height: 130px; background: #0b0e15; display: grid; place-items: center; }
.dt-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); }
.dt-pic::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, #090b11e6, transparent 55%); }
.dt-pic b { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 8px; font-size: 16px; }
.dt-info { display: grid; gap: 4px; padding: 9px 11px 11px; font-size: 12px; color: var(--muted); box-shadow: inset 0 3px 0 var(--gc); }
.dt-info b { color: var(--text); }
.dside { display: grid; gap: 8px; min-width: 0; }
.dlabel { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.dpicks { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; }
.dpick {
  position: relative; width: 84px; display: grid; padding: 0; overflow: hidden; border-radius: 9px; cursor: pointer;
  font: inherit; font-size: 11px; line-height: 1.15; color: var(--text); background: #0b0e15; border: 2px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--gc); opacity: .8;
}
.dpick img, .dpick .dg { width: 100%; height: 50px; object-fit: cover; display: grid; place-items: center; font-size: 20px; }
.dpick > span { padding: 3px 4px 7px; text-align: center; }
.dpick > i { position: absolute; top: 4px; right: 4px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0b0e15; }
.dpick > em { position: absolute; top: 4px; left: 4px; font-style: normal; font-size: 9px; font-weight: 800; color: #fff; background: var(--bad); border-radius: 4px; padding: 0 4px; }
.dpick.on { opacity: 1; border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--gc), 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.dwho { display: flex; flex-wrap: wrap; gap: 6px; }
.dto {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px 4px 4px; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
}
.dto .pdot { width: 24px; height: 24px; }
.dto.on { border: 2px solid var(--pc); background: color-mix(in srgb, var(--pc) 14%, transparent); font-weight: 700; }
.dprice { display: flex; align-items: center; gap: 8px; }
.dprice .coin { font-size: 30px; margin: 0; }
.dprice b { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dprice small { color: var(--muted); font-size: 12px; }
#dPrice { width: 100%; padding: 0; accent-color: var(--good); border: 0; background: none; }
.dchips { display: flex; flex-wrap: wrap; gap: 6px; }
#modal .ostar { margin-top: 12px; }

/* ---------- партнёрство: группа, доли ползунком, управляющий, правила ---------- */
.bgroups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.bgchip { padding: 5px 12px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); box-shadow: inset 0 -2px 0 var(--gc); }
.bgchip.on { border: 2px solid var(--accent); font-weight: 700; }
.bstrip { display: flex; height: 86px; border-radius: 12px; overflow: hidden; border: 2px solid var(--accent); box-shadow: inset 0 -3px 0 var(--gc); }
.bstrip > span { position: relative; flex: 1; min-width: 0; background: #0b0e15; display: grid; place-items: center; }
.bstrip > span + span { border-left: 2px solid #0b0e15; }
.bstrip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bstrip em { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 800; color: #0d1017; box-shadow: 0 0 0 2px #0b0e15; }
.bnames { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin: 12px 0 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.bbar { position: relative; display: flex; height: 16px; border-radius: 8px; overflow: visible; margin: 6px 0; touch-action: none; }
.bbar > i { display: block; height: 100%; }
.bbar > i:first-child { border-radius: 8px 0 0 8px; } .bbar > i:last-of-type { border-radius: 0 8px 8px 0; }
.bh {
  position: absolute; top: 50%; width: 20px; height: 30px; transform: translate(-50%, -50%); border-radius: 10px; cursor: ew-resize;
  background: var(--text); box-shadow: 0 2px 8px #000a, 0 0 0 2px #0d1017; touch-action: none;
}
.bh:hover, .bh:focus-visible { background: #fff; outline: 2px solid var(--accent); outline-offset: 2px; }
.btoggles { display: grid; gap: 8px; margin-top: 12px; }
.bswitch {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; text-align: left;
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
}
.bswitch i { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: var(--line); }
.bswitch i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.bswitch.on { border-color: var(--good); }
.bswitch.on i { background: var(--good); }
.bswitch.on i::after { left: 16px; background: #0d1017; }

/* ---------- обмен карточками ---------- */
.tsides { display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr); gap: 10px; align-items: start; margin-top: 10px; }
@media (max-width: 640px) { .tsides { grid-template-columns: 1fr; } .tswap { transform: rotate(90deg); } }
.tside { display: grid; gap: 8px; min-width: 0; padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.tswap { align-self: center; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); }
.tswap svg { width: 18px; height: 18px; fill: none; stroke: var(--deal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tmoney { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 2px dashed var(--line); }
.tmoney.on { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tmoney .coin { font-size: 20px; margin: 0; }
.tmoney b { font-size: 17px; font-variant-numeric: tabular-nums; min-width: 3.5em; }
.tmoney span { display: flex; gap: 4px; margin-left: auto; }
.tjail { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tjail small { color: var(--muted); }

/* ---------- рейтинг друзей ---------- */
.lb-open { display: block; width: 100%; margin-top: 14px; }
#modal.m-leaders { width: min(980px, 100%); }
.lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; font-size: 13px; }
.lb-per { margin: 0; }
.lb-season { font-size: 16px; color: var(--accent); }
.lb-empty { display: grid; gap: 6px; padding: 28px 8px; text-align: center; color: var(--muted); }
.lb-empty b { color: var(--text); font-size: 16px; }
.lb-pad { padding: 12px 16px; margin: 0; }
.lb-ava { width: var(--s); height: var(--s); flex: none; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c); color: #0d1017; font-weight: 800; font-size: calc(var(--s) * .44); line-height: 1; }
.lb-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lb-who > span:not(.lb-ava) { display: grid; min-width: 0; }
.lb-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-who small { color: var(--muted); font-size: 12px; }
.lb-pl { width: 22px; height: 22px; flex: none; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; }
.lb-pl.p1 { background: #f5b942; color: #1a1306; }
.lb-pl.p2 { background: #c9d1dc; color: #141821; }
.lb-pl.p3 { background: #c98a55; color: #1a1006; }
.lb-pl.p4 { background: #3a4356; color: var(--text); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num.strong { font-weight: 800; }

/* таблица */
.lb-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.lb-table { min-width: 720px; }
.lb-row { display: grid; grid-template-columns: 36px minmax(150px, 1.6fr) repeat(5, minmax(64px, 1fr)) 150px; gap: 10px; align-items: center; padding: 11px 16px; border-bottom: 1px solid #1f2633; }
.lb-row:last-child { border-bottom: 0; }
.lb-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-row.me { background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.lb-rank { font-weight: 800; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-rank.top { color: var(--accent); }
.lb-form { display: flex; justify-content: flex-end; gap: 4px; }
.lb-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.lb-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.lb-legend .lb-pl { width: 16px; height: 16px; font-size: 9px; }

/* сезон */
.lb-season-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; }
.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; min-height: 330px; }
.lb-pod { display: grid; justify-items: center; gap: 6px; text-align: center; min-width: 0; }
.lb-pod > b { font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-pod > small { color: var(--muted); }
.lb-pod .lb-ava { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px color-mix(in srgb, var(--c) 40%, transparent); }
.lb-step { --m: #f5b942; width: 100%; display: grid; justify-items: center; align-content: start; gap: 2px; padding-top: 14px; border-radius: 14px 14px 4px 4px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--m) 24%, transparent), color-mix(in srgb, var(--m) 6%, transparent)); border: 1px solid color-mix(in srgb, var(--m) 40%, transparent); border-bottom: 0; }
.lb-pod.p1 .lb-step { height: 200px; }
.lb-pod.p2 .lb-step { --m: #c9d1dc; height: 150px; }
.lb-pod.p3 .lb-step { --m: #c98a55; height: 112px; }
.lb-step .lb-pl { width: 28px; height: 28px; font-size: 14px; margin-bottom: 4px; }
.lb-step strong { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-step small { color: #c4cbd8; font-size: 12px; }
.lb-side { display: grid; gap: 12px; align-content: start; }
.lb-list { border-radius: 12px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.lb-srow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #1f2633; }
.lb-srow:last-child { border-bottom: 0; }
.lb-srow.me { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.lb-srow .lb-rank { width: 20px; font-size: 14px; }
.lb-sbar { flex: 1; display: grid; gap: 5px; min-width: 0; }
.lb-sbar > span { display: flex; justify-content: space-between; gap: 8px; }
.lb-sbar > span b:first-child { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sbar i { display: block; height: 6px; border-radius: 3px; background: #232a38; overflow: hidden; }
.lb-sbar em { display: block; height: 100%; border-radius: 3px; }
.lb-mv { width: 30px; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-mv.up { color: var(--good); }
.lb-mv.down { color: var(--bad); }
.lb-pts { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.lb-pts > b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-pts > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.lb-pts > div span { display: grid; padding: 6px 0; border-radius: 8px; background: var(--surface-2); }
.lb-pts strong { font-size: 18px; }
.lb-pts strong.p1 { color: #f5b942; } .lb-pts strong.p2 { color: #c9d1dc; } .lb-pts strong.p3 { color: #c98a55; }
.lb-pts small { color: var(--muted); font-size: 11px; }
.lb-champ { margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.lb-champ b { color: var(--accent); }

/* рекорды */
.lb-rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; }
.lb-recs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lb-rec { display: grid; gap: 8px; align-content: space-between; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.lb-rec-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-ic { width: 28px; height: 28px; flex: none; border-radius: 8px; display: grid; place-items: center; background: #f5b9421f; color: var(--accent); }
.lb-ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-rec strong { font-size: 24px; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.lb-recent { display: grid; gap: 0; align-content: start; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.lb-sub { padding: 12px 14px 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lb-game { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid #1f2633; }
.lb-game > span:not(.lb-ava) { flex: 1; display: grid; min-width: 0; }
.lb-game small { font-size: 12px; color: var(--muted); }

@media (max-width: 600px) {
  /* телефон: без прокрутки вбок — место, игрок, победы, ср. место и последние партии */
  .lb-table { min-width: 0; }
  .lb-row { grid-template-columns: 18px minmax(0, 1fr) 34px 40px 83px; gap: 6px; padding: 10px 12px; }
  .lb-row > :nth-child(3), .lb-row > :nth-child(5), .lb-row > :nth-child(7) { display: none; }
  .lb-head { font-size: 10px; letter-spacing: .02em; }
  .lb-form { gap: 2px; }
  .lb-form .lb-pl { width: 15px; height: 15px; font-size: 9px; }
  .lb-row .lb-ava { display: none; }
}
@media (max-width: 760px) {
  .lb-season-grid, .lb-rec-grid { grid-template-columns: 1fr; }
  .lb-podium { min-height: 0; }
  .lb-pod.p1 .lb-step { height: 150px; } .lb-pod.p2 .lb-step { height: 115px; } .lb-pod.p3 .lb-step { height: 90px; }
  .lb-recs { grid-template-columns: 1fr; }
}
