/* css/game.css — все стили страницы игры (Mandava.html); вынесены из <style> 29.10.2026. Адреса url() — от папки css/ */
/* ===== скрытое 2D-поле: по нему 3D берёт позиции фишек и анимации (переходы .piece задают плавность ходов) ===== */
#board {
  box-shadow:
    0 0 0 3px #3b2412,
    inset 0 0 26px rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  display: grid;
  grid-template-columns: repeat(21, 1fr);
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 45%, #3f8765, #2a5e45 70%, #1f4a36),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 5px);
}
.cell {
  position: relative;
  font-size: clamp(5px, 1.1vw, 10px);
  color: #6b6250;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  line-height: 1;
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 24%;
  box-shadow:
    inset 0 -3px 0 rgba(0, 0, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  min-width: 0;
}
.cell.deco {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.cell.ring {
  background: #ece6d6;
}
.cell.safe {
  background: #000;
}
.hide-n .cell {
  font-size: 0;
}
#board,
#layer {
  visibility: hidden;
}
.cell.tgt {
  cursor: pointer;
}
.cell.tgt::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 229, 255, 0.5);
  border: 2px solid #00e5ff;
  z-index: 4;
  pointer-events: none;
}
#layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  container-type: inline-size;
}
.av {
  position: absolute;
  width: calc(100% / 21 * 1.9);
  height: calc(100% / 21 * 1.9);
  border-radius: 16%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(100cqw / 21 * 1.15);
  line-height: 1;
  background: linear-gradient(160deg, #fffdf5, #e9dfc8);
  border: 5px solid var(--c);
  box-shadow:
    inset 0 0 0 3px #fffaf0,
    inset 0 0 0 5px rgba(0, 0, 0, 0.15),
    0 3px 8px rgba(0, 0, 0, 0.5);
  z-index: 2;
}
.av.turn {
  animation: avp 1s ease-in-out infinite;
}
@keyframes avp {
  50% {
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--c) 55%, transparent),
      0 3px 8px rgba(0, 0, 0, 0.5);
    transform: scale(1.08);
  }
}
.piece {
  position: absolute;
  width: calc(100% / 21 * 0.76);
  height: calc(100% / 21 * 0.76);
  border-radius: 50%;
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  border: 3px solid #fff;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(255, 255, 255, 0.6),
    var(--c) 55%,
    color-mix(in srgb, var(--c) 65%, #000)
  );
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.55),
    0 4px 8px rgba(0, 0, 0, 0.5);
  transition-property: left, top, transform;
  transition-timing-function: ease-in-out;
  transition-duration: 0.14s;
}
.piece.pass {
  pointer-events: none !important;
}
.piece::after {
  content: '';
  position: absolute;
  inset: 26%;
  background: var(--sym, #fff);
}
.s0::after {
  border-radius: 50%;
}
.s1::after {
  border-radius: 3px;
}
.s2::after {
  clip-path: polygon(50% 6%, 94% 92%, 6% 92%);
}
.s3::after {
  clip-path: polygon(50% 4%, 96% 50%, 50% 96%, 4% 50%);
}
.piece.mv {
  z-index: 12;
  transform: scale(1.18);
}
.piece.can {
  animation: glow 1.3s ease-in-out infinite;
}
@keyframes glow {
  50% {
    box-shadow:
      0 0 0 2px rgba(0, 0, 0, 0.55),
      0 0 0 6px rgba(255, 255, 255, 0.45),
      0 4px 10px rgba(0, 0, 0, 0.5);
  }
}
.piece.sel {
  transform: scale(1.2);
  z-index: 11;
  animation: pulse 1s infinite;
}
#emb {
  position: absolute;
  left: calc(100% / 21 * 9.65);
  top: calc(100% / 21 * 9.65);
  width: calc(100% / 21 * 1.7);
  height: calc(100% / 21 * 1.7);
  border-radius: 50%;
  background: conic-gradient(#f5b82e, #43a870, #7a5cc7, #ee6c9b, #f5b82e);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.4),
    0 0 14px rgba(0, 0, 0, 0.5);
  animation: spin 14s linear infinite;
}
#emb::after {
  content: '';
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.4);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  50% {
    box-shadow:
      0 0 0 2px rgba(0, 0, 0, 0.55),
      0 0 0 7px rgba(255, 255, 255, 0.55);
  }
}
.piece.hit {
  animation: hit 0.4s ease-in forwards;
  z-index: 14;
}
@keyframes hit {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  35% {
    transform: scale(1.8) rotate(30deg);
    box-shadow:
      0 0 0 6px rgba(255, 70, 70, 0.75),
      0 0 24px #ff4d4d;
  }
  100% {
    transform: scale(0.3) rotate(200deg);
    opacity: 0.2;
  }
}
/* ===== дизайн-система: цвета, шрифты, размеры ===== */
:root {
  --ink: #f6efe1; /* основной текст */
  --ink-2: #cbbfa9; /* вторичный текст */
  --ink-3: #93887a; /* подписи, неактивное */
  --glass: rgba(22, 18, 15, 0.8); /* панели */
  --glass-2: rgba(34, 28, 23, 0.92); /* диалоги */
  --fill: rgba(255, 244, 222, 0.06); /* подложка строк и кнопок */
  --fill-2: rgba(255, 244, 222, 0.11);
  --line: rgba(255, 226, 170, 0.13);
  --line-2: rgba(255, 226, 170, 0.26);
  --gold: #f3c252;
  --gold-hi: #ffdc85;
  --gold-lo: #e19c35;
  --gold-ink: #2e1c03;
  --red: #ec6a5f;
  --green: #63d48f;
  --r-lg: 20px;
  --r: 13px;
  --r-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --font: 'Nunito', system-ui, 'Segoe UI', Roboto, Arial, sans-serif;
  --display: 'Lilita One', 'Nunito', system-ui, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #12100d;
  color: var(--ink);
  font: 500 15px/1.4 var(--font);
  -webkit-tap-highlight-color: transparent;
}
#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  touch-action: none;
  z-index: 1;
}
#hid {
  position: fixed;
  left: 0;
  top: 0;
  width: 600px;
  height: 600px;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
}
#build {
  position: fixed;
  right: 8px;
  bottom: 4px;
  font-size: 11px;
  color: var(--ink-3);
  z-index: 5;
  pointer-events: none;
}

/* ===== кнопки и поля ===== */
button {
  font: 700 15px/1 var(--font);
  color: var(--ink);
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--fill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.08s,
    filter 0.15s;
}
button:hover {
  background: var(--fill-2);
  border-color: rgba(255, 226, 170, 0.4);
}
button:active {
  transform: translateY(1px) scale(0.99);
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button.main {
  color: var(--gold-ink);
  border: 0;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.18),
    0 6px 18px rgba(243, 194, 82, 0.22);
}
button.main:hover {
  filter: brightness(1.06);
}
button.danger {
  color: #ffc2bc;
  border-color: rgba(236, 106, 95, 0.5);
  background: rgba(236, 106, 95, 0.12);
}
button.ghost {
  border-color: transparent;
  background: transparent;
}
button.block {
  width: 100%;
}
/* вход через VK ID (окно входа): фирменный синий VK */
button.vkid {
  color: #fff;
  border: 0;
  background: #0077ff;
}
button.vkid:hover {
  background: #0071f2;
}
/* вход через Одноклассники и Mail — та же страница VK ID (js/account.js), кнопки вдвое уже */
.auth-alt {
  display: flex;
  gap: 8px;
}
.auth-alt button {
  flex: 1 1 0;
  min-width: 0;
  color: #fff;
  border: 0;
  white-space: nowrap;
}
button.ok {
  background: #ee8208;
}
button.ok:hover {
  background: #e07a06;
}
button.ok .vk-mark {
  color: #ee8208;
}
button.mailru {
  background: #005ff9;
}
button.mailru:hover {
  background: #0058e6;
}
button.mailru .vk-mark {
  color: #005ff9;
}
.vk-mark {
  font: 800 12px/1 var(--font);
  letter-spacing: 0.02em;
  padding: 4px 5px;
  border-radius: 6px;
  color: #0077ff;
  background: #fff;
}
.ibtn {
  width: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: var(--r);
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ibtn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
input,
select {
  font: 600 15px var(--font);
  color: var(--ink);
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.3);
}
input::placeholder {
  color: var(--ink-3);
}
select {
  color-scheme: dark; /* выпадающий список браузер рисует в тёмной теме */
}
select option {
  background: #221c17;
  color: var(--ink);
}
/* выбранный пункт: без этого Chrome рисовал его тёмно-серым по тёмному фону (не прочитать) */
select option:checked {
  background: #4a3a24;
  color: var(--gold-hi);
}
input[type='range'] {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: none;
  accent-color: var(--gold);
}
.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 48px;
  min-height: 0;
  height: 28px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink-2);
  transition: transform 0.2s;
}
.switch input:checked {
  background: var(--gold);
  border-color: var(--gold);
}
.switch input:checked::after {
  transform: translateX(20px);
  background: var(--gold-ink);
}
.err {
  color: #ffb0a8;
  font-size: 13px;
  min-height: 18px;
}
.hint {
  color: var(--ink-2);
  font-size: 13px;
}
.sec {
  font: 800 12px var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 6px 0 -2px;
}
.card {
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 14px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.row .grow {
  flex: 1;
  min-width: 0;
}
.row .t {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .s {
  font-size: 13px;
  color: var(--ink-2);
}
.row button {
  min-height: 40px;
  padding: 0 14px;
}
.initials {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 14px var(--font);
  color: var(--gold-ink);
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
}

/* ===== окна: боковая шторка (разделы) и диалог (вопросы, итоги) ===== */
.win,
.pop {
  -webkit-user-select: none;
  user-select: none;
}
.win input,
.win textarea,
.pop input,
.pop textarea {
  -webkit-user-select: text;
  user-select: text;
}
.win {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  background: rgba(8, 6, 4, 0.5);
}
.win.show {
  display: flex;
}
.sheet {
  margin-left: auto;
  width: min(440px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: sheetIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dlg {
  margin: auto;
  width: min(420px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  display: flex;
  flex-direction: column;
  background: var(--glass-2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  animation: dlgIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes sheetIn {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
@keyframes dlgIn {
  from {
    transform: scale(0.94);
    opacity: 0;
  }
}
.mh {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font: 400 24px/1.1 var(--display);
  letter-spacing: 0.02em;
  color: var(--gold-hi);
}
.mh .title {
  flex: 1;
  min-width: 0;
}
.mh .hb {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 11px;
  font-size: 20px;
}
.dlg .mh {
  justify-content: center;
  text-align: center;
}
.wb {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.mf {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}
@media (max-width: 560px) {
  .sheet {
    width: 100%;
    border-left: 0;
  }
}

/* ===== фон главного меню (статичный кадр комнаты вместо 3D, с 28.10.2026) =====
   .mb-in — блок с пропорциями кадра, растянутый «по cover»: лампа и пылинки стоят в процентах кадра */
#menuBg {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #1d1611;
  display: none;
}
html.static-menu.preview #menuBg {
  display: block;
}
html.static-menu.preview #stage {
  visibility: hidden;
}
#menuBg .mb-in {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100vw, 177.78vh);
  height: max(100vh, 56.25vw);
  transform: translate(-50%, -50%);
  animation: mbBreath 46s ease-in-out infinite alternate;
  --lx: 76.8%;
  --ly: 9.5%;
}
#menuBg .mb-img {
  position: absolute;
  inset: 0;
  background: url(../textures/ui/menu_bg.webp) center/100% 100% no-repeat;
}
@media (orientation: portrait) {
  #menuBg .mb-in {
    width: max(100vw, 56.25vh);
    height: max(100vh, 177.78vw);
    --lx: 68%;
    --ly: 7.3%;
  }
  #menuBg .mb-img {
    background-image: url(../textures/ui/menu_bg_portrait.webp);
  }
}
@keyframes mbBreath {
  from {
    transform: translate(-50%, -50%) scale(1);
  }
  to {
    transform: translate(-50%, -50%) scale(1.06);
  }
}
/* тёплый свет масляной лампы: неровное мерцание */
#menuBg .mb-lamp {
  position: absolute;
  left: var(--lx);
  top: var(--ly);
  width: 34%;
  aspect-ratio: 1;
  transform: translate(-50%, -45%);
  background: radial-gradient(
    circle,
    rgba(255, 196, 120, 0.42),
    rgba(255, 170, 90, 0.16) 30%,
    rgba(255, 150, 70, 0.05) 52%,
    transparent 68%
  );
  mix-blend-mode: screen;
  pointer-events: none;
  animation: lampFlicker 4.3s infinite;
}
@keyframes lampFlicker {
  0%,
  100% {
    opacity: 0.86;
  }
  9% {
    opacity: 0.72;
  }
  17% {
    opacity: 0.95;
  }
  31% {
    opacity: 0.8;
  }
  44% {
    opacity: 1;
  }
  58% {
    opacity: 0.78;
  }
  71% {
    opacity: 0.93;
  }
  86% {
    opacity: 0.74;
  }
}
/* пылинки в свете лампы: медленно всплывают и гаснут */
#menuBg .mb-dust {
  position: absolute;
  left: calc(var(--lx) - 14%);
  top: var(--ly);
  width: 28%;
  height: 32%;
  pointer-events: none;
}
#menuBg .mb-dust i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 232, 190, 0.85);
  box-shadow: 0 0 6px rgba(255, 210, 150, 0.7);
  opacity: 0;
  animation: dust var(--t) linear infinite;
  animation-delay: var(--d);
}
@keyframes dust {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  80% {
    opacity: 0.5;
  }
  100% {
    transform: translate(var(--dx), -140px);
    opacity: 0;
  }
}
/* «Готовим стол…»: партию начали раньше, чем загрузился стол */
#prepScr {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(18, 14, 11, 0.82);
}
#prepScr.show {
  display: grid;
}
#prepScr .ps-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-radius: var(--r-lg);
  background: var(--glass-2);
  border: 1px solid var(--line);
  font-weight: 800;
}
#prepScr .ps-spin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid rgba(243, 194, 82, 0.25);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== главное меню ===== */
#mainMenu {
  background: linear-gradient(90deg, rgba(12, 9, 7, 0.62), rgba(12, 9, 7, 0.18) 38%, transparent 55%);
}
.mm-wrap {
  margin: auto auto auto max(32px, 6vw);
  width: min(360px, calc(100% - 32px));
  display: grid;
  gap: 10px;
  animation: sheetIn 0.4s ease;
}
.logo {
  font: 400 clamp(54px, 9vw, 86px) / 0.95 var(--display);
  letter-spacing: 0.04em;
  text-align: center;
  /* блик: светлая полоса пробегает по золотым буквам раз в ~7 с (первый слой фона) */
  background:
    linear-gradient(105deg, transparent 42%, rgba(255, 255, 240, 0.95) 50%, transparent 58%) -60% 0 / 250% 100%
      no-repeat,
    linear-gradient(180deg, #fff3c8, var(--gold) 55%, var(--gold-lo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #5c3507) drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
  margin-bottom: 2px;
  animation: logoSheen 7s ease-in-out 1.5s infinite;
}
@keyframes logoSheen {
  0%,
  62% {
    background-position:
      160% 0,
      0 0;
  }
  86%,
  100% {
    background-position:
      -60% 0,
      0 0;
  }
}
.tagline {
  text-align: center;
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 14px;
}
.mm-wrap button {
  min-height: 54px;
  font-size: 17px;
  border-radius: 15px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mm-wrap button.main {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo));
  min-height: 60px;
  font-size: 19px;
  position: relative;
  overflow: hidden;
}
/* блик по кнопке «Играть» — вслед за бликом логотипа */
.mm-wrap button.main::after {
  content: '';
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -45%;
  width: 32%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: btnSheen 7s ease-in-out 2.4s infinite;
}
@keyframes btnSheen {
  0%,
  68% {
    left: -45%;
  }
  88%,
  100% {
    left: 125%;
  }
}
.mm-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mm-acc {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 15px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.mm-acc #mmWho {
  flex: 1;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mm-acc button {
  min-height: 40px;
  font-size: 14px;
}
@media (max-width: 760px) {
  #mainMenu {
    background: linear-gradient(0deg, rgba(12, 9, 7, 0.86), rgba(12, 9, 7, 0.3) 60%, transparent);
  }
  .mm-wrap {
    margin: auto auto 28px;
  }
}
/* телефон горизонтально (низкий экран): колонка слева, всё компактнее — помещаются все кнопки и строка аккаунта */
@media (orientation: landscape) and (max-height: 500px) {
  #mainMenu {
    background: linear-gradient(90deg, rgba(12, 9, 7, 0.72), rgba(12, 9, 7, 0.25) 45%, transparent 62%);
  }
  .mm-wrap {
    margin: auto auto auto max(16px, 4vw, env(safe-area-inset-left));
    width: min(340px, 46vw);
    gap: 6px;
  }
  .logo {
    font-size: 38px;
  }
  .tagline {
    font-size: 12px;
    margin-bottom: 4px;
  }
  .mm-pair {
    gap: 6px;
  }
  .mm-wrap button {
    min-height: 38px;
    font-size: 14px;
    border-radius: 12px;
  }
  .mm-wrap button.main {
    min-height: 42px;
    font-size: 16px;
  }
  .mm-acc {
    margin-top: 2px;
    padding: 3px 4px 3px 12px;
  }
  .mm-acc button {
    min-height: 32px;
  }
  .mm-link {
    min-height: 28px !important;
  }
}

/* ===== экран партии ===== */
.hud-tr {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 20;
  display: flex;
  gap: 8px;
}
#roll {
  position: fixed;
  left: calc(50% + var(--board-shift, 0px));
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 15;
  min-width: min(62vw, 240px);
  min-height: 60px;
  font-size: 20px;
  border-radius: 18px;
}
#roll:disabled {
  opacity: 0;
  pointer-events: none;
}
#roll svg {
  width: 26px;
  height: 26px;
}
#resumeBtn {
  position: fixed;
  left: calc(50% + var(--board-shift, 0px));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 72px);
  transform: translateX(-50%);
  z-index: 15;
  display: none;
  border-radius: 999px;
  background: var(--glass-2);
  border-color: var(--gold);
  color: var(--gold-hi);
}
#cur,
#turnBar,
#dhud {
  display: none !important;
}
html.preview #roll,
html.preview #resumeBtn,
html.preview #logBtn,
html.preview #players {
  display: none !important;
}
body.panel-open .hud-tr,
body.panel-open #roll,
body.panel-open #resumeBtn {
  visibility: hidden;
}

@media (max-height: 500px) {
  #roll {
    min-height: 48px;
    min-width: 170px;
    font-size: 17px;
    bottom: 10px;
  }
  #resumeBtn {
    bottom: 66px;
  }
}
/* ===== табличка игроков ===== */
#players {
  position: fixed;
  z-index: 12;
  left: max(10px, env(safe-area-inset-left));
  top: max(10px, env(safe-area-inset-top));
  width: 236px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pl {
  position: relative;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 4px 11px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  transition:
    border-color 0.25s,
    box-shadow 0.25s,
    transform 0.25s;
}
.pl.click {
  cursor: pointer;
}
.pl.click:hover {
  border-color: var(--line-2);
}
.pl.turn {
  border-color: var(--c);
  box-shadow:
    0 0 0 1px var(--c),
    0 8px 26px color-mix(in srgb, var(--c) 35%, transparent);
  transform: translateX(4px);
}
.pl .pa {
  grid-row: span 3;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  padding: 3px;
  background: var(--c);
  position: relative;
}
.pl .pa > * {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #1b1511;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #2a221c;
}
.pl .pa img {
  width: 100%;
  height: 100%;
  display: block;
}
.pl .pn {
  font-weight: 800;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pl .ps {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
  white-space: nowrap;
  overflow: hidden;
}
.pl .stars {
  display: flex;
  gap: 2px;
  font-size: 15px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.18);
}
.pl .stars .on {
  color: var(--c);
  text-shadow: 0 0 8px color-mix(in srgb, var(--c) 60%, transparent);
}
.pl .tm {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: none;
}
.pl .tm i {
  display: block;
  height: 100%;
  background: var(--green);
  transform-origin: left;
  transition: transform 0.25s linear;
}
.pl.timed .tm {
  display: block;
}
.pl .badge {
  font: 800 10px var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--fill-2);
  color: var(--ink-2);
}
.pl .badge.me {
  background: color-mix(in srgb, var(--c) 30%, transparent);
  color: var(--ink);
}
.pop {
  position: fixed;
  z-index: 40;
  width: 220px;
  padding: 12px;
  display: none;
  gap: 8px;
  border-radius: 16px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: dlgIn 0.18s ease;
}
.pop.show {
  display: grid;
}
.pop .t {
  font-weight: 800;
}
/* быстрые фразы: кнопка в верхнем ряду (только в онлайн-партии с живыми соперниками) и список под ней */
#sayBtn {
  display: none;
  font-size: 20px;
}
body.can-say #sayBtn {
  display: inline-flex;
}
#sayPop {
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  right: 10px;
  width: min(300px, calc(100vw - 20px));
  grid-template-columns: 1fr 1fr;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}
#sayPop button {
  min-height: 40px;
  padding: 0 10px;
  font-size: 14px;
}
/* фраза игрока — пузырь справа от его карточки (полоса сверху на узком экране — под карточкой) */
.pl .bub {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  max-width: 220px;
  width: max-content;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--glass-2);
  border: 1px solid var(--c);
  box-shadow: var(--shadow);
  font: 700 14px var(--font);
  color: var(--ink);
  pointer-events: none;
  animation: dlgIn 0.18s ease;
  transition: opacity 0.3s;
}
.pl.muted .pn::after {
  content: ' 🔇';
}
.pl .bub.out {
  opacity: 0;
}
@media (orientation: portrait) and (max-width: 759px) {
  .pl .bub {
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    max-width: 46vw;
  }
}
.pop button {
  min-height: 42px;
  justify-content: flex-start;
}
/* узкий экран в ландшафте: только портреты и звёзды */
@media (max-width: 999px) and (orientation: landscape) {
  #players {
    width: 78px;
  }
  .pl {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px 6px;
  }
  .pl .pa {
    grid-row: auto;
    width: 48px;
    height: 48px;
  }
  .pl .pn,
  .pl .ps {
    display: none;
  }
  .pl .stars {
    font-size: 10px;
    gap: 1px;
  }
  .pl.turn {
    transform: none;
  }
}
/* портрет (телефон): полоса сверху */
@media (orientation: portrait) {
  #players {
    top: max(64px, calc(env(safe-area-inset-top) + 64px));
    left: 8px;
    right: 8px;
    width: auto;
    transform: none;
    flex-direction: row;
    gap: 6px;
  }
  .pl {
    flex: 1;
    min-width: 0;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 8px 4px 7px;
    gap: 4px;
  }
  .pl .pa {
    grid-row: auto;
    width: 44px;
    height: 44px;
  }
  .pl .pn {
    font-size: 12px;
    max-width: 100%;
  }
  .pl .ps {
    display: none;
  }
  .pl .stars {
    font-size: 10px;
    gap: 1px;
  }
  .pl.turn {
    transform: translateY(3px);
  }
}

.online-badge {
  position: fixed;
  z-index: 55;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: none;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  pointer-events: none;
}
.online-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
/* ===== подсказки ===== */
#toasts {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: max(14px, env(safe-area-inset-top));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
.toast {
  max-width: calc(100vw - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: toastIn 0.25s ease;
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.toast.big {
  font: 400 22px var(--display);
  color: var(--gold-hi);
  padding: 12px 26px;
  border-color: var(--gold);
}
.toast.out {
  opacity: 0;
  transform: translateY(-8px);
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ===== обучение (js/tutorial.js): карточка подсказки над кнопкой «Бросить» ===== */
.tutor {
  position: fixed;
  z-index: 40;
  left: calc(50% + var(--board-shift, 0px));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 74px);
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  padding: 12px 16px 12px;
  border-radius: var(--r-lg);
  background: var(--glass-2);
  border: 1px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  display: none;
}
.tutor.show {
  display: block;
}
.tutor.pop {
  animation: tutorIn 0.25s ease-out;
}
.tutor-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 400 15px var(--display);
  color: var(--gold-hi);
  margin-bottom: 4px;
  cursor: pointer;
}
.tutor-r {
  display: flex;
  align-items: center;
  gap: 6px;
}
#tutorN {
  color: var(--ink-3);
  font: 700 13px var(--body, inherit);
}
.tutor-min {
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.tutor-min svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s;
}
/* свёрнута: только строка «Обучение N / 8» со стрелкой вверх */
.tutor.min {
  width: auto;
  padding: 6px 8px 6px 14px;
  border-radius: 999px;
}
.tutor.min .tutor-h {
  margin: 0;
  gap: 10px;
}
.tutor.min .tutor-t,
.tutor.min .tutor-b {
  display: none;
}
.tutor.min .tutor-min svg {
  transform: rotate(180deg);
}
.tutor.min.new {
  animation: tutorPulse 1.2s ease-in-out 4;
}
.tutor-t {
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink);
}
.tutor-b {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.tutor-b button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}
.tutor-b .main {
  margin-left: auto;
}
#roll.tutor-pulse {
  animation: tutorPulse 1.2s ease-in-out infinite;
}
@keyframes tutorIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
}
@keyframes tutorPulse {
  50% {
    box-shadow: 0 0 0 8px rgba(243, 194, 82, 0.35);
  }
}
/* большая карточка шага обучения (js/tutor-cards.js) — по образцу владельца: тёмная плашка с золотым заголовком,
   светлый подзаголовок, схема доски, пункты на светлых карточках с золотыми номерами */
.tcard {
  width: min(640px, calc(100% - 20px));
  padding: 14px;
  gap: 12px;
  overflow-y: auto;
  background: linear-gradient(180deg, #3a2a1b, #241910);
  border: 2px solid var(--gold);
}
.tc-head {
  text-align: center;
}
.tc-title {
  display: inline-block;
  padding: 6px 22px 8px;
  border-radius: 14px;
  background: linear-gradient(180deg, #2a1d12, #150e08);
  border: 2px solid var(--gold-lo);
  box-shadow: inset 0 1px 0 rgba(255, 220, 133, 0.35);
  font: 400 clamp(24px, 5.4vw, 34px) / 1.1 var(--display);
  color: var(--gold-hi);
  text-shadow: 0 2px 0 #6b4310;
}
.tc-sub {
  width: fit-content;
  margin: -4px auto 0;
  padding: 3px 16px 4px;
  border-radius: 10px;
  background: #f4ead6;
  border: 2px solid #c79a4a;
  color: #2b1d0f;
  font-weight: 800;
  font-size: 15px;
}
.tc-pic svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: var(--body, 'Nunito', sans-serif);
}
.tc-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.tc-steps li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 10px 11px;
  border-radius: 12px;
  background: #f4ead6;
  border: 2px solid #c79a4a;
  color: #2b1d0f;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.25;
}
.tc-steps b {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe28a, #f3b524 60%, #c27e0e);
  border: 2px solid #6b4310;
  color: #2b1d0f;
  font: 400 18px var(--display);
}
.tc-b {
  display: flex;
  justify-content: center;
}
.tc-b .main {
  min-width: 200px;
  font-size: 18px;
}
@media (max-width: 560px) {
  .tcard {
    padding: 10px;
    gap: 9px;
  }
  .tc-steps {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tc-steps li {
    padding: 8px 10px;
    align-items: center;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .tcard {
    width: min(900px, calc(100% - 20px));
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-content: start;
  }
  .tc-head,
  .tc-b {
    grid-column: 1 / -1;
  }
  .tc-steps {
    grid-template-columns: 1fr;
    align-content: start;
  }
}

/* компьютер: карточка слева внизу, под табличками игроков — середина стола и «Бросить» остаются открытыми */
@media (min-width: 1000px) and (min-height: 600px) {
  .tutor {
    left: max(16px, env(safe-area-inset-left));
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: none;
    width: min(380px, calc(50vw - 260px));
  }
  .tutor.pop {
    animation: tutorInSide 0.25s ease-out;
  }
}
@keyframes tutorInSide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@media (max-height: 520px), (max-width: 560px) {
  .tutor {
    bottom: 66px;
    padding: 10px 12px;
  }
  .tutor-t {
    font-size: 14px;
  }
}
/* телефон горизонтально: карточка в правом нижнем углу, уже и ниже — поле в центре остаётся открытым */
@media (max-height: 520px) and (orientation: landscape) {
  .tutor {
    left: auto;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
    width: min(300px, 34vw);
  }
  .tutor.pop {
    animation: none;
  }
  .tutor-t {
    font-size: 13px;
    line-height: 1.3;
  }
  .tutor-b {
    margin-top: 6px;
  }
  .tutor-b button {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 13px;
  }
  .tutor.min {
    width: auto;
  }
}

/* ===== новая игра ===== */
#seats {
  display: grid;
  gap: 10px;
}
.seat {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r);
  background: var(--fill);
  border: 1px solid var(--line);
}
.seat .sh {
  display: flex;
  align-items: center;
  gap: 10px;
}
.seat .sh b {
  flex: none;
  font-weight: 800;
}
.seat select,
.seat input {
  min-height: 42px;
}
.av-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.avp {
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  line-height: 0;
}
.avp.on {
  border-color: var(--gold);
}
.bot-av {
  font-size: 13px;
  color: var(--ink-2);
}

/* ===== профиль ===== */
.pfhero {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 6px 0 4px;
}
.pfavimg {
  width: 116px;
  height: 116px;
  border-radius: 50%;
  overflow: hidden;
  padding: 4px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-lo));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.pfavimg img,
.pfavimg span {
  border-radius: 50%;
}
.pfnickrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pfnick {
  font: 400 26px var(--display);
  text-align: center;
}
.pfsub {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
}
.pfbox {
  display: grid;
  gap: 8px;
}
.pfrow {
  display: flex;
  gap: 8px;
}
.pfrow button {
  flex: 1;
}
.pferr {
  color: #ffb0a8;
  font-size: 13px;
  min-height: 16px;
}
.pfgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  justify-items: center;
}
.pfcell {
  width: 68px;
  min-height: 68px;
  height: 68px;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--fill);
}
.pfcell.sel {
  border-color: var(--gold);
}
.pfinv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  font-size: 14px;
}
.pfinv span:last-child {
  color: var(--ink-3);
}
/* инвентарь: образцы предметов; закрытые — бледные с замком */
.pfitems {
  flex-wrap: wrap;
}
.pfitems small {
  display: block;
  color: var(--ink-3);
  font-size: 12px;
}
.pfinv .pfopts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: inherit;
}
.sw {
  position: relative;
  width: 34px;
  min-height: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--line-2);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.sw.sel {
  border-color: var(--gold-hi);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 45%, transparent);
}
.sw.lock {
  opacity: 0.5;
}
.sw.lock::after {
  content: '🔒';
  position: absolute;
  right: -6px;
  bottom: -6px;
  font-size: 12px;
}
.sw-frame {
  background: #2a221c;
  box-shadow: inset 0 0 0 4px #2a221c;
}
.sw-frame-base {
  background: var(--green);
}
.sw-frame-wood,
.fr-wood {
  background: repeating-linear-gradient(135deg, #5d3519 0 3px, #8b5a32 3px 7px, #6e4122 7px 10px);
}
.sw-frame-bronze,
.fr-bronze {
  background: linear-gradient(145deg, #f2b67e, #8c4f22 45%, #d58e52 70%, #5e3415);
}
.sw-frame-silver,
.fr-silver {
  background: linear-gradient(145deg, #ffffff, #9aa3ad 45%, #e6ebf0 70%, #5d6670);
}
.sw-frame-gold,
.fr-gold {
  background: linear-gradient(145deg, #fff3b0, #c8961e 45%, #ffe08a 70%, #7a5410);
}
.sw-frame-ornate,
.fr-ornate {
  background: repeating-conic-gradient(#ffd36b 0 12deg, #9b6a1e 12deg 24deg, #2bc0d9 24deg 30deg);
}
.sw-shape {
  display: grid;
  place-items: center;
  background: var(--fill-2);
  color: var(--ink);
}
.sw-shape svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.sw-pieces-steel {
  background: radial-gradient(circle at 35% 30%, #f3a0a0, #b8332f 55%, #6e2a26 75%, #9aa0a6 78%);
}
.sw-pieces-enamel {
  background: radial-gradient(circle at 35% 30%, #ffd4d4, #d23a35 50%, #7a1612);
}
.sw-pieces-brass {
  background: radial-gradient(circle at 35% 30%, #fff1b8, #d9ad52 45%, #7d5a1c);
}
.sw-pieces-wood {
  background: repeating-linear-gradient(100deg, #b07a4a 0 3px, #8a5530 3px 6px);
}
.sw-pieces-marble {
  background:
    linear-gradient(120deg, transparent 45%, rgba(80, 70, 66, 0.45) 48%, transparent 52%),
    radial-gradient(circle at 35% 30%, #ffffff, #e7e2da 60%, #b9b2a8);
}
.sw-board {
  border-radius: 8px;
  border-width: 4px;
  border-color: #8a5a34;
}
.sw-board.sel {
  outline: 2px solid var(--gold-hi);
}
.sw-board-classic {
  background: #d9cbb6;
}
.sw-board-green {
  background: #7aa27f;
}
.sw-board-wine {
  background: #a86f6a;
}
.sw-board-navy {
  background: #7d8db5;
}
.sw-board-dark {
  background: #d4c8b5;
  border-color: #4a3a2e;
}
/* рамка портрета из инвентаря: своя карточка в табличке (цвет игрока — тонким кольцом внутри) и профиль */
.pl .pa.fr > * {
  border-color: var(--c);
}
.pfdbs {
  display: flex;
  gap: 6px;
}
.pfdb {
  width: 46px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--r-sm);
}
.pfdb.sel {
  border-color: var(--gold);
  color: var(--gold-hi);
}

/* ===== правила ===== */
.rl ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: r;
  display: grid;
  gap: 10px;
}
.rl-goal {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: rgba(243, 194, 82, 0.1);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.45;
}
.rl li {
  counter-increment: r;
  position: relative;
  padding: 12px 14px 12px 50px;
  border-radius: var(--r);
  background: var(--fill);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.rl li::before {
  content: counter(r);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 800 13px var(--font);
  color: var(--gold-ink);
  background: var(--gold);
}
.rl li b {
  color: var(--ink);
}

/* ===== настройки ===== */
.setgrp {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--fill);
  border: 1px solid var(--line);
}
.rng {
  display: grid;
  gap: 6px;
}
.rng .rh {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
.rng .rh span {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* ===== журнал ===== */
#log {
  display: grid;
  gap: 2px;
  font-size: 14px;
  color: var(--ink-2);
}
#log div {
  padding: 6px 10px;
  border-radius: 8px;
}
#log div:nth-child(odd) {
  background: var(--fill);
}

/* ===== мультиплеер ===== */
.tile {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 2px 14px;
  align-items: center;
  text-align: left;
  min-height: 76px;
  padding: 12px 16px;
  border-radius: 16px;
  justify-content: stretch;
}
.tile .ti {
  grid-row: span 2;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: rgba(0, 0, 0, 0.22);
}
.tile.main .ti {
  background: rgba(255, 255, 255, 0.35);
}
.tile b {
  font-size: 17px;
}
.tile small {
  font: 600 13px var(--font);
  opacity: 0.75;
}
.room .seats4 {
  display: flex;
  gap: 4px;
}
.room .seats4 i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.room .seats4 i.on {
  background: var(--gold);
}
.room .lk {
  color: var(--ink-3);
  font-size: 15px;
}
.room .pwbox {
  display: flex;
  gap: 8px;
  width: 100%;
}
.room.open {
  flex-wrap: wrap;
}
.slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.slot {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--r);
  background: var(--fill);
  border: 1px dashed var(--line-2);
  text-align: center;
}
.slot.full {
  border-style: solid;
  border-color: var(--line);
}
.slot .sa {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-3);
  font-size: 24px;
}
.slot .sn {
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slot .ss {
  font-size: 12px;
  color: var(--ink-3);
}
.search {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 18px 0 8px;
  text-align: center;
}
.radar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  position: relative;
  display: grid;
  place-items: center;
  font: 400 30px var(--display);
  color: var(--gold-hi);
}
.radar::before,
.radar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  animation: radar 2s ease-out infinite;
}
.radar::after {
  animation-delay: 1s;
}
@keyframes radar {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.6);
    opacity: 0;
  }
}
.lead .rk {
  width: 30px;
  text-align: center;
  font: 800 15px var(--font);
  color: var(--ink-3);
}
.lead.top1 .rk {
  color: #ffd36b;
}
.lead.top2 .rk {
  color: #dfe4ea;
}
.lead.top3 .rk {
  color: #e2a36b;
}
/* достижения в профиле: полученные — цветные, остальные — бледные с условием */
.secn {
  color: var(--gold-hi);
  letter-spacing: 0;
}
.achgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
}
.ach {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 3px;
  padding: 10px 6px;
  border-radius: var(--r-sm);
  background: var(--fill);
  border: 1px solid var(--line);
  text-align: center;
  opacity: 0.45;
  filter: grayscale(1);
}
.ach.got {
  opacity: 1;
  filter: none;
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
}
.ach .ai {
  font-size: 26px;
  line-height: 1.1;
}
.ach .at {
  font: 800 12px var(--font);
}
.ach .as {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.25;
}
/* статистика сервера (окно администратора, js/stats.js) */
.sheet.wide {
  width: min(720px, 100%);
}
.st-upd {
  font: 600 12px var(--font);
  color: var(--ink-3);
  letter-spacing: 0;
}
.st-errline {
  padding: 0 16px 8px;
}
.st-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 16px;
}
.st-hn {
  font: 700 52px/1 var(--font);
  color: var(--ink);
}
.st-hs {
  color: var(--ink-2);
  font-size: 13px;
  padding-bottom: 4px;
}
.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.st-tile {
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  min-width: 0;
}
.st-l {
  font-size: 12px;
  color: var(--ink-3);
}
.st-v {
  font: 700 22px/1.25 var(--font);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-s {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 2px;
}
.st-meter {
  height: 4px;
  border-radius: 2px;
  background: rgba(243, 194, 82, 0.18);
  margin-top: 6px;
  overflow: hidden;
}
.st-meter i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
}
.st-meter.warn i {
  background: #f08a3c;
}
.st-meter.bad i {
  background: var(--red);
}
.st-chart {
  background: var(--fill);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 8px 6px;
}
.st-ch {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 0 4px 4px;
}
.st-ch span,
.st-empty {
  font-size: 12px;
  color: var(--ink-3);
}
.st-empty {
  padding: 18px 4px;
}
.st-plot {
  position: relative;
  touch-action: pan-y;
}
.st-plot svg {
  display: block;
}
.st-grid-l {
  stroke: rgba(255, 226, 170, 0.12);
  stroke-width: 1;
}
.st-ax {
  fill: var(--ink-3);
  font: 600 10px var(--font);
  font-variant-numeric: tabular-nums;
}
.st-bar {
  fill: var(--gold);
}
.st-line {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.st-area {
  fill: var(--gold);
  opacity: 0.1;
}
.st-dot {
  fill: var(--gold);
  stroke: #1d1813;
  stroke-width: 2;
}
.st-cross {
  stroke: var(--ink-2);
  stroke-width: 1;
}
.st-tip {
  display: none;
  position: absolute;
  top: -6px;
  pointer-events: none;
  background: var(--glass-2);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.st-tip b {
  color: var(--ink);
  margin-right: 6px;
}
.st-seg {
  display: inline-flex;
  justify-self: start;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: var(--fill);
  border: 1px solid var(--line);
}
.st-seg button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  background: transparent;
}
.st-seg button.on {
  background: var(--fill-2);
  color: var(--gold-hi);
}
.st-table summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-3);
}
.st-table table {
  width: 100%;
  max-width: 280px;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.st-table td + td,
.st-table th {
  text-align: right;
  color: var(--ink);
}
.st-table th {
  font-weight: 600;
  font-size: 11px;
  color: var(--ink-3);
}
.st-note {
  display: grid;
  gap: 2px;
  font-size: 13px;
  color: var(--ink-2);
}
.st-err .t {
  font-weight: 600;
  font-size: 13px;
}
.st-fb .grow {
  display: grid;
  gap: 4px;
}
.st-fb-t {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
/* друзья и история партий в профиле */
.pflist {
  display: grid;
  gap: 8px;
}
.row.friend button {
  min-height: 38px;
  padding: 0 12px;
}
.hist .rk {
  width: 30px;
  text-align: center;
  font: 800 18px var(--font);
  color: var(--ink-3);
}
.hist .delta {
  font: 800 14px var(--font);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hist .delta.up {
  color: var(--green);
}
.hist .delta.down {
  color: var(--red);
}
/* комната ожидания: кнопки и ссылка-приглашение */
.mpacts {
  display: grid;
  gap: 8px;
}
.invlink {
  font-size: 13px;
  color: var(--ink-2);
}
.lead .rt {
  font: 800 16px var(--font);
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}

/* ===== розыгрыш первого хода ===== */
.orow {
  display: grid;
  grid-template-columns: 1fr 48px 30px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--fill);
  border: 1px solid var(--line);
}
#openRows {
  display: grid;
  gap: 8px;
}
.oname {
  font-weight: 800;
}
.odie {
  font-size: 36px;
  line-height: 1;
  text-align: center;
}
.ores {
  font: 800 18px var(--font);
  text-align: right;
  color: var(--gold-hi);
}
#openStatus {
  text-align: center;
  font-weight: 800;
  min-height: 20px;
}

/* ===== победа ===== */
.winner {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}
.winner .wa {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  padding: 4px;
  background: var(--c, var(--gold));
  box-shadow: 0 0 40px color-mix(in srgb, var(--c, var(--gold)) 60%, transparent);
}
.winner .wa > * {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}
#wt {
  margin: 4px 0 0;
  font: 400 28px var(--display);
  color: var(--gold-hi);
}
.podium {
  display: grid;
  gap: 6px;
}
.podium .row {
  padding: 8px 12px;
}
.podium .place {
  width: 22px;
  font-weight: 800;
  color: var(--ink-3);
  text-align: center;
}
.podium .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c);
}
.podium .stars {
  color: rgba(255, 255, 255, 0.18);
  letter-spacing: 1px;
}
.podium .stars .on {
  color: var(--c);
}

/* ===== пауза: шторка с плитками, как «Мультиплеер» ===== */
#gameMenu .tile {
  min-height: 66px;
  padding: 10px 14px;
}

/* ===== друзья ===== */
.nbadge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  display: inline-grid;
  place-items: center;
  font: 800 12px var(--font);
  color: #fff;
  background: var(--red);
}
.nbadge:empty {
  display: none;
}
.st-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--ink-3);
}
.st-dot.on {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.st-dot.wait {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold);
}
.st-dot.play {
  background: #7fb2ff;
}
.tag {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-3);
}
.row.friend .ghost {
  width: 40px;
  padding: 0;
  color: var(--ink-3);
}
#frBody > input {
  position: sticky;
  top: -16px;
  z-index: 1;
}
/* приглашение в комнату: карточка сверху по центру, поверх всего */
.inv-card {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  width: min(440px, calc(100% - 24px));
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--r-lg);
  background: var(--glass-2);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: dlgIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.inv-card.show {
  display: flex;
}
.inv-card .ic {
  font-size: 26px;
}
.inv-card .t {
  font-weight: 800;
}
.inv-card .s {
  font-size: 12px;
  color: var(--ink-2);
}
.inv-card button {
  min-height: 40px;
}
.inv-card .ghost {
  width: 40px;
  padding: 0;
}

/* ===== общие части окон ===== */
textarea {
  font: 600 15px/1.45 var(--font);
  color: var(--ink);
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.3);
  resize: vertical;
}
textarea::placeholder {
  color: var(--ink-3);
}
textarea:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.hint.small {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0;
}
.wb > p {
  margin: 0;
}
.dlg-text {
  margin: 0;
  text-align: center;
  color: var(--ink-2);
}
.ok-msg {
  color: var(--green);
}
/* переключатель из нескольких кнопок (тема сообщения) */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
}
.seg button {
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 14px;
  color: var(--ink-2);
}
.seg button[aria-checked='true'] {
  background: var(--fill-2);
  color: var(--gold-hi);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.switch select {
  width: auto;
  min-width: 150px;
}
/* тонкая прокрутка в окнах */
.wb {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 226, 170, 0.25) transparent;
}
.wb::-webkit-scrollbar {
  width: 8px;
}
.wb::-webkit-scrollbar-thumb {
  background: rgba(255, 226, 170, 0.22);
  border-radius: 4px;
}
/* у шторки заголовок чуть темнее тела — окна читаются одинаково */
.sheet > .mh {
  background: rgba(0, 0, 0, 0.18);
}
.mf button.ghost,
.mf button.danger {
  min-height: 44px;
}
.mm-link {
  justify-self: center;
  min-height: 36px !important;
  font-size: 14px !important;
  color: var(--ink-2);
  background: transparent !important;
  border-color: transparent !important;
  backdrop-filter: none !important;
}
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 14px;
}
.links a,
.legal a {
  color: var(--gold);
}
.legal {
  text-align: center;
}
.del-link {
  justify-self: start;
  min-height: 36px;
  padding: 0;
  font-size: 14px;
  color: var(--ink-3);
}
.del-link:hover {
  color: #ffb0a8;
  background: transparent;
}
#pfDanger {
  display: grid;
  gap: 8px;
}
.mm-link:hover {
  color: var(--gold-hi);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
#fsTop .fs-out,
#fsTop.on .fs-in {
  display: none;
}
#fsTop.on .fs-out {
  display: block;
}
/* экран загрузки: поверх всего, пока качаются модели комнаты; фон — маленький кадр комнаты, размыт и затемнён CSS. Прячет game.js (LOAD) */
#loadScr {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #1d1611;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity 0.7s ease;
}
#loadScr.hide {
  opacity: 0;
  pointer-events: none;
}
#loadScr .ls-bg {
  position: absolute;
  inset: -40px;
  background: #1d1611 url(../textures/ui/menu_bg.webp) center/cover no-repeat;
  filter: blur(14px) brightness(0.5) saturate(1.1);
}
#loadScr .ls-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  width: min(92vw, 420px);
}
#loadScr .ls-logo {
  font-family: 'Lilita One', system-ui, sans-serif;
  font-size: clamp(46px, 12vw, 72px);
  letter-spacing: 4px;
  line-height: 1;
  background: linear-gradient(180deg, #fff7d1 0%, #ffc94d 50%, #e8901f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 0 #6b3d0a) drop-shadow(0 0 18px rgba(255, 201, 77, 0.55));
}
#loadScr .ls-bar {
  width: 100%;
  height: 14px;
  border-radius: 9px;
  border: 2px solid #ffc94d;
  background: rgba(20, 16, 12, 0.65);
  overflow: hidden;
  box-shadow: 0 0 14px rgba(255, 201, 77, 0.25);
}
#loadScr .ls-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e8901f, #ffc94d 60%, #fff2b8);
  border-radius: 6px;
  transition: width 0.3s ease;
}
#loadScr .ls-txt {
  color: #f3e6cc;
  font:
    600 15px system-ui,
    -apple-system,
    sans-serif;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
