/*
 * Домино — вид игры. Общий игровой язык (фон, кнопки, меню, окно) — в kit/kit.css,
 * сетевой экран (режимы, комната, таблички, реакции) — в kit/lobby.css.
 * Здесь своё: зелёное сукно в деревянном борту, костяные кости с гравированными точками и латунным
 * гвоздиком, рубашки, базар, рука, места для хода, летящие кости, «рыба».
 *
 * Все размеры кости заданы в em: размер кости — это её font-size (единица = половина кости).
 */

/* ---------- Оттенок: карточный стол ---------- */

:root {
  --bg-top: #1da667;
  --bg-mid: #0f8559;
  --bg-bottom: #06523f;
  --glow-a: rgba(255, 236, 150, 0.42);
  --glow-b: rgba(40, 205, 215, 0.34);
  --frame: #c98b49;
  --frame-lip: #5f3411;
  --pit: #0b5d40;
  --shade-rgb: 2, 36, 25;
  --deep-rgb: 3, 49, 34;
  --title-hi: #e6fbe4;

  /* Кость: слоновая кость, точки, латунь. */
  --ivory-hi: #fffdf6;
  --ivory: #f6eedb;
  --ivory-lo: #e2d4b4;
  --ivory-side: #b59c6a;
  --ivory-edge: #8d7646;
  --pip: #1d1f29;
  --brass-hi: #fff2ae;
  --brass: #e2a52c;
  --brass-lo: #8c5b0c;

  /* Рубашка: вишнёвый лак. */
  --back-hi: #f06a6f;
  --back: #c7283f;
  --back-lo: #8e1730;
  --back-side: #5e0d20;

  /* Стол: полоса сверху (базар и кости соперника напротив) и поля по бокам (кости соседей слева и справа). */
  --band: 42px;
  --side: 0px;
  --fu: 16px; /* половина кости в веере соперника */
  --hand-h: 96px;
}

@media (max-height: 620px) {
  :root {
    --band: 35px;
    --fu: 15px;
  }
}

.app[data-players="3"],
.app[data-players="4"] {
  --side: 27px;
}

/* Низкий экран, за столом трое-четверо: таблички игроков в два ряда — кости в веерах чуть меньше. */
@media (max-height: 620px) {
  .app.many {
    --fu: 14.5px;
  }

  .app.many .foot.bar {
    height: 47px;
  }

  .app.many .cta {
    margin-bottom: 3px;
  }
}

/* Широкий стол (настольное окно): всё на борту крупнее. */
@media (min-width: 700px) and (min-height: 700px) {
  :root {
    --band: 52px;
    --fu: 20px;
  }

  .app[data-players="3"],
  .app[data-players="4"] {
    --side: 34px;
  }

  .bone .pile {
    font-size: 22px;
  }
}

/* ---------- Фон: плывущие кости ---------- */

.sky i {
  height: calc(var(--s) * 1.9);
  border-radius: 18%;
  background:
    linear-gradient(180deg, transparent 48.4%, rgba(70, 56, 30, 0.55) 48.4%, rgba(70, 56, 30, 0.55) 51%, transparent 51%),
    radial-gradient(circle calc(var(--s) * 0.085) at 28% 13%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 72% 37%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 50% 25%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 28% 63%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 72% 63%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 28% 87%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 72% 87%, var(--pip) 96%, transparent),
    linear-gradient(160deg, #fffdf6 0%, #efe4c8 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -4px 0 rgba(120, 96, 50, 0.35);
  opacity: 0.17;
}

.sky i:nth-child(even) {
  background:
    linear-gradient(180deg, transparent 48.4%, rgba(70, 56, 30, 0.55) 48.4%, rgba(70, 56, 30, 0.55) 51%, transparent 51%),
    radial-gradient(circle calc(var(--s) * 0.085) at 50% 25%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 28% 63%, var(--pip) 96%, transparent),
    radial-gradient(circle calc(var(--s) * 0.085) at 72% 87%, var(--pip) 96%, transparent),
    linear-gradient(160deg, #fffdf6 0%, #efe4c8 100%);
}

/* ---------- Кость ---------- */

.dom {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 1em;
  height: 2em;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--u, 40px);
  line-height: 1;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.dom.h {
  width: 2em;
  height: 1em;
}

/* Тело кости: блик слева сверху, тёмная кромка-толщина снизу, тень на сукне. */
.dom .face {
  position: absolute;
  left: 0.035em;
  right: 0.035em;
  top: 0.025em;
  bottom: 0.135em;
  display: flex;
  flex-direction: column;
  border-radius: 0.17em;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(125% 85% at 16% 0%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 56%),
    linear-gradient(158deg, var(--ivory-hi) 0%, var(--ivory) 52%, var(--ivory-lo) 100%);
  /* Тонкий тёмный контур: кости, лежащие вплотную в цепочке, не сливаются в одну. */
  box-shadow:
    inset 0 0.03em 0 #ffffff,
    inset 0 -0.045em 0.05em rgba(150, 120, 60, 0.38),
    0 0 0 0.02em rgba(120, 96, 50, 0.45),
    0 0.075em 0 var(--ivory-side),
    0 0.1em 0 var(--ivory-edge),
    0 0.2em 0.13em rgba(0, 28, 17, 0.55);
}

.dom.h .face {
  flex-direction: row;
}

.dom .half {
  position: relative;
  flex: 1 1 0;
}

.dom .pips {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.64em;
  height: 0.64em;
  margin: -0.32em 0 0 -0.32em;
}

/* Точка — гравировка: тёмное дно, тень у верхнего края лунки, светлая кромка снизу. */
.dom .p {
  position: absolute;
  width: 0.16em;
  height: 0.16em;
  margin: -0.08em 0 0 -0.08em;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #000000 0%, var(--pip) 55%, #4a4d5c 100%);
  box-shadow: inset 0 0.035em 0.03em #000000, 0 0.022em 0 rgba(255, 255, 255, 0.92);
}

.dom .p0, .dom .p3, .dom .p6 { left: 14%; }
.dom .p1, .dom .p4, .dom .p7 { left: 50%; }
.dom .p2, .dom .p5, .dom .p8 { left: 86%; }
.dom .p0, .dom .p1, .dom .p2 { top: 14%; }
.dom .p3, .dom .p4, .dom .p5 { top: 50%; }
.dom .p6, .dom .p7, .dom .p8 { top: 86%; }

/* Черта между половинами — желобок. */
.dom .groove {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 50%;
  height: 0.034em;
  margin-top: -0.017em;
  border-radius: 0.02em;
  background: #a8966e;
  box-shadow: inset 0 0.012em 0 rgba(90, 70, 30, 0.7), 0 0.014em 0 rgba(255, 255, 255, 0.9);
}

.dom.h .groove {
  left: 50%;
  right: auto;
  top: 13%;
  bottom: 13%;
  width: 0.034em;
  height: auto;
  margin: 0 0 0 -0.017em;
  box-shadow: inset 0.012em 0 0 rgba(90, 70, 30, 0.7), 0.014em 0 0 rgba(255, 255, 255, 0.9);
}

/* Латунный гвоздик в центре. */
.dom .pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.11em;
  height: 0.11em;
  margin: -0.055em 0 0 -0.055em;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, var(--brass-hi) 0%, var(--brass) 52%, var(--brass-lo) 100%);
  box-shadow: 0 0.012em 0.02em rgba(60, 40, 0, 0.7), 0 0 0 0.015em rgba(96, 60, 6, 0.75);
}

/* Рубашка: вишнёвый лак, латунная нитка по краю, два ромба — большой и маленький внутри. */
.dom.back .face {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(125% 85% at 16% 0%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 56%),
    linear-gradient(158deg, var(--back-hi) 0%, var(--back) 50%, var(--back-lo) 100%);
  box-shadow:
    inset 0 0.03em 0 rgba(255, 255, 255, 0.55),
    inset 0 -0.045em 0.05em rgba(60, 0, 14, 0.5),
    0 0 0 0.02em rgba(60, 6, 19, 0.6),
    0 0.075em 0 var(--back-side),
    0 0.1em 0 #3d0613,
    0 0.2em 0.13em rgba(0, 28, 17, 0.55);
}

.dom.back .face::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.4em;
  height: 0.4em;
  margin: -0.2em 0 0 -0.2em;
  border: 0.05em solid var(--brass);
  border-radius: 0.07em;
  background: radial-gradient(circle, var(--brass-hi) 0, var(--brass) 0.07em, transparent 0.085em);
  box-shadow: 0 0.012em 0 rgba(60, 0, 14, 0.6), inset 0 0.012em 0 rgba(60, 0, 14, 0.5);
  transform: rotate(45deg);
}

.dom.back .face::after {
  content: "";
  position: absolute;
  left: 0.1em;
  right: 0.1em;
  top: 0.1em;
  bottom: 0.1em;
  border: 0.035em solid rgba(240, 190, 80, 0.8);
  border-radius: 0.1em;
  box-shadow: 0 0.01em 0 rgba(60, 0, 14, 0.45);
}

/* ---------- Значок в меню: 5-6, дубль 6-6 поперёк, 6-2 — крайние кости чуть развёрнуты ---------- */

.logo.dlogo {
  display: block;
  position: relative;
  width: 5em;
  height: 2em;
  font-size: 46px;
  grid-template-columns: none;
}

.dlogo .dom {
  font-size: 1em;
  animation: logo-in 0.5s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}

.dlogo .dom:nth-child(1) { left: 0.03em; top: 0.44em; --r: -6deg; }
.dlogo .dom:nth-child(2) { left: 2em; top: 0; --r: 0deg; animation-delay: 90ms; }
.dlogo .dom:nth-child(3) { left: 2.98em; top: 0.58em; --r: 5deg; animation-delay: 180ms; }

@keyframes logo-in {
  from { transform: rotate(var(--r, 0deg)) scale(0.3); opacity: 0; }
  to { transform: rotate(var(--r, 0deg)); }
}

/* Правая кость время от времени «пристукивает» к дублю. */
.dlogo .dom:nth-child(3) .face {
  animation: logo-clack 3.4s 1.2s ease-in-out infinite;
}

@keyframes logo-clack {
  0%, 78%, 100% { transform: none; }
  86% { transform: translate(0.2em, -0.1em) rotate(7deg); }
  92% { transform: translate(-0.02em, 0) rotate(0deg); }
  95% { transform: translate(0.03em, 0); }
}

.dlogo .dom .face {
  box-shadow:
    inset 0 0.03em 0 #ffffff,
    inset 0 -0.045em 0.05em rgba(150, 120, 60, 0.38),
    0 0.075em 0 var(--ivory-side),
    0 0.1em 0 var(--ivory-edge),
    0 0.28em 0.3em rgba(var(--shade-rgb), 0.5);
}

/* Название: кромка в тон сукна. */
.title {
  text-shadow:
    0 2px 0 var(--title-hi),
    0 7px 0 #04452f,
    0 14px 24px rgba(var(--shade-rgb), 0.55);
}

/* ---------- Меню: число игроков ---------- */

.seats-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.seats-label {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 16px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 0 rgba(var(--shade-rgb), 0.5);
}

/* На фишке выбора — столько маленьких костей, сколько игроков. */
.seats-pick .pick > button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 19px;
}

.seats-pick .pick > button i {
  display: flex;
  gap: 2px;
}

.seats-pick .pick > button i b {
  display: block;
  width: 6px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(160deg, #fffdf6, #e2d4b4);
  box-shadow: 0 1.5px 0 rgba(var(--shade-rgb), 0.45);
}

.seats-pick .pick > button[aria-checked="true"] i b {
  box-shadow: 0 1.5px 0 #c97b00;
}

.menu-actions {
  gap: 14px;
  margin-top: 26px;
}

.menu-best {
  margin-top: 16px;
}

@media (max-height: 620px) {
  .logo.dlogo {
    font-size: 34px;
  }

  .title {
    margin-top: 9px;
    font-size: min(44px, 15vw);
  }

  .menu-best {
    height: 28px;
    margin-top: 9px;
    font-size: 16px;
  }

  .menu-actions {
    gap: 9px;
    margin-top: 12px;
  }

  .seats-pick {
    gap: 4px;
  }

  .seats-label {
    font-size: 12.5px;
    line-height: 14px;
  }

  .seats-pick .pick > button {
    height: 38px;
  }
}

/* ---------- Стол: деревянный борт и сукно ---------- */

.well.table {
  --shard: 7px;
  --well-pad: 11px;
  padding: 11px;
  border-radius: 28px;
  background:
    radial-gradient(circle 3.4px at 15px 15px, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 96%, transparent),
    radial-gradient(circle 3.4px at calc(100% - 15px) 15px, var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 96%, transparent),
    radial-gradient(circle 3.4px at 15px calc(100% - 15px), var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 96%, transparent),
    radial-gradient(circle 3.4px at calc(100% - 15px) calc(100% - 15px), var(--brass-hi) 0%, var(--brass) 55%, var(--brass-lo) 96%, transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 16%),
    repeating-linear-gradient(91deg, rgba(92, 46, 10, 0) 0, rgba(92, 46, 10, 0) 9px, rgba(92, 46, 10, 0.16) 10px, rgba(92, 46, 10, 0) 12px, rgba(255, 226, 170, 0.1) 17px, rgba(255, 226, 170, 0) 21px),
    linear-gradient(180deg, #dba05c 0%, #c07c3b 50%, #a15f28 100%);
  box-shadow:
    inset 0 1.5px 0 rgba(255, 238, 205, 0.75),
    inset 0 -2px 0 rgba(66, 30, 6, 0.5),
    0 7px 0 #6e3d16,
    0 9px 0 #4c2809,
    0 20px 28px rgba(var(--shade-rgb), 0.55);
  margin: 5px 3px 16px;
}

.board.felt {
  width: var(--fit-w, 300px);
  height: var(--fit-h, 300px);
  border-radius: 18px;
  /* Сукно: свет лампы по центру, переплетение ниток, затемнение к бортам. */
  background:
    radial-gradient(60% 45% at 50% 45%, rgba(210, 255, 200, 0.22) 0%, rgba(210, 255, 200, 0) 100%),
    radial-gradient(120% 105% at 50% 46%, rgba(0, 22, 13, 0) 55%, rgba(0, 22, 13, 0.34) 100%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.045) 0, rgba(255, 255, 255, 0.045) 1.5px, rgba(0, 0, 0, 0.045) 1.5px, rgba(0, 0, 0, 0.045) 3px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.04) 0, rgba(255, 255, 255, 0.04) 1.5px, rgba(0, 0, 0, 0.04) 1.5px, rgba(0, 0, 0, 0.04) 3px),
    linear-gradient(180deg, #17895c 0%, #0d6c48 100%);
  /* Сукно лежит ниже борта: тень по всем четырём сторонам, тёмный шов и светлая фаска у дерева. */
  box-shadow:
    inset 0 0 14px rgba(0, 26, 16, 0.55),
    inset 0 6px 10px rgba(0, 26, 16, 0.6),
    inset 0 0 0 1.5px rgba(40, 16, 2, 0.6),
    0 0 0 1px rgba(255, 236, 196, 0.55),
    0 1.5px 0 1px rgba(255, 236, 196, 0.3);
}

/* Печатный знак в центре стола: кольцо и две кости накрест. Цепочка, вырастая, закрывает его. */
.emblem {
  position: absolute;
  left: 50%;
  top: calc(50% + var(--band) / 2);
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border: 2px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.022);
  pointer-events: none;
}

.emblem::before,
.emblem::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 68px;
  margin: -34px 0 0 -17px;
  border: 2px solid rgba(255, 255, 255, 0.075);
  border-radius: 8px;
  background:
    linear-gradient(180deg, transparent 48.5%, rgba(255, 255, 255, 0.075) 48.5%, rgba(255, 255, 255, 0.075) 51.5%, transparent 51.5%),
    radial-gradient(circle 3px at 50% 25%, rgba(255, 255, 255, 0.085) 96%, transparent),
    radial-gradient(circle 3px at 30% 64%, rgba(255, 255, 255, 0.085) 96%, transparent),
    radial-gradient(circle 3px at 70% 86%, rgba(255, 255, 255, 0.085) 96%, transparent);
  transform: rotate(-24deg) translateX(-15px);
}

.emblem::after {
  transform: rotate(24deg) translateX(15px);
}

@media (max-height: 620px) {
  .emblem {
    width: 96px;
    height: 96px;
    margin: -48px 0 0 -48px;
  }

  .emblem::before,
  .emblem::after {
    width: 26px;
    height: 52px;
    margin: -26px 0 0 -13px;
    border-radius: 6px;
  }
}

@media (min-width: 700px) and (min-height: 700px) {
  .emblem {
    width: 190px;
    height: 190px;
    margin: -95px 0 0 -95px;
  }

  .emblem::before,
  .emblem::after {
    width: 52px;
    height: 104px;
    margin: -52px 0 0 -26px;
    border-radius: 11px;
  }
}

/* ---------- Базар: стопка рубашек в углу стола, число рядом ---------- */

.bone {
  position: absolute;
  z-index: 2;
  left: 7px;
  top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  height: calc(var(--band) - 3px);
  padding: 0;
  border: 0;
  background: none;
}

/* Удобная зона нажатия — больше видимой стопки. */
.bone::before {
  content: "";
  position: absolute;
  left: -7px;
  right: -8px;
  top: -2px;
  bottom: -10px;
}

.pile {
  position: relative;
  flex: none;
  width: 2.25em;
  height: 1.56em;
  font-size: 17px;
  transition: transform 0.12s ease-out;
}

/* Пустой базар — лунка. */
.pile.empty::before {
  content: "";
  position: absolute;
  left: 0.1em;
  right: 0.1em;
  top: 0.3em;
  bottom: 0.14em;
  border-radius: 0.24em;
  background: rgba(0, 30, 18, 0.35);
  box-shadow: inset 0 2px 3px rgba(0, 20, 12, 0.6), 0 1px 0 rgba(255, 255, 255, 0.08);
}

.pile .dom {
  font-size: 1em;
}

/* Кости в стопке лежат вразнобой — настоящая куча, а не значок. */
.pile .dom:nth-child(1) { transform: translate(0.02em, 0.5em) rotate(-7deg); }
.pile .dom:nth-child(2) { transform: translate(0.2em, 0.34em) rotate(6deg); }
.pile .dom:nth-child(3) { transform: translate(0.04em, 0.19em) rotate(-3deg); }
.pile .dom:nth-child(4) { transform: translate(0.16em, 0.03em) rotate(3deg); }

.bone:active .pile {
  transform: translateY(2px);
}

.badge {
  position: relative;
  display: inline-block;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: linear-gradient(180deg, #ffffff, #e6ead9);
  box-shadow: inset 0 -1.5px 0 rgba(var(--shade-rgb), 0.18), 0 2px 0 rgba(var(--shade-rgb), 0.6);
  color: rgb(var(--shade-rgb));
  font-size: 14px;
  font-weight: 900;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Ходить нечем — базар зовёт: стопка подпрыгивает, вокруг золотое свечение. */
.bone.call .pile {
  animation: bone-call 0.8s ease-in-out infinite alternate;
}

.bone.call::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -5px;
  top: 0;
  bottom: -2px;
  border-radius: 13px;
  box-shadow: 0 0 0 2.5px #ffd24a, 0 0 14px 3px rgba(255, 210, 74, 0.7);
  animation: glow-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes bone-call {
  from { transform: translateY(1px); }
  to { transform: translateY(-3px) rotate(-4deg); }
}

@keyframes glow-pulse {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.bone.nope .pile {
  animation: k-shake 0.3s ease-in-out;
}

/* ---------- Кости соперников: веера рубашек выглядывают из-под борта ---------- */
/* Напротив — сверху, соседи — слева и справа (ход идёт по часовой стрелке). Половина кости спрятана
   под бортом; в свой ход веер выдвигается, в конце партии кости открываются лицом. */

.fans {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 2;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.fan {
  position: absolute;
  display: flex;
  gap: 5px;
}

.fan .cards {
  position: relative;
  flex: none;
  display: flex;
  font-size: var(--fu);
  transition: transform 0.26s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.fan .cards .dom {
  position: relative;
  flex: none;
  font-size: 1em;
}

/* Напротив. */
.fan.pos-top {
  left: 50%;
  top: 0;
  align-items: flex-start;
  transform: translateX(-50%);
}

.fan.pos-top .cards {
  height: 2em;
  margin-top: -0.66em;
}

.fan.pos-top .cards .dom + .dom {
  margin-left: -0.55em;
}

.fan.pos-top .badge {
  margin-top: 6px;
}

.fan.pos-top.turn .cards {
  transform: translateY(0.28em);
}

/* Слева и справа: кости лежат вдоль борта. */
.fan.pos-left,
.fan.pos-right {
  top: calc(50% + var(--band) / 2);
  flex-direction: column;
  transform: translateY(-50%);
}

.fan.pos-left {
  left: 0;
  align-items: flex-start;
}

.fan.pos-right {
  right: 0;
  align-items: flex-end;
}

.fan.pos-left .cards,
.fan.pos-right .cards {
  flex-direction: column;
  width: 2em;
}

.fan.pos-left .cards {
  margin-left: -0.66em;
}

.fan.pos-right .cards {
  margin-right: -0.66em;
}

.fan.pos-left .cards .dom + .dom,
.fan.pos-right .cards .dom + .dom {
  margin-top: -0.55em;
}

.fan.pos-left.turn .cards {
  transform: translateX(0.28em);
}

.fan.pos-right.turn .cards {
  transform: translateX(-0.28em);
}

.fan.pos-left .badge {
  margin-left: 3px;
}

.fan.pos-right .badge {
  margin-right: 3px;
}

/* Метка места: две буквы имени на цвете места и число костей. */
.badge.tag {
  display: flex;
  min-width: 0;
  padding: 0;
  background: none;
  box-shadow: 0 2px 0 rgba(var(--shade-rgb), 0.6);
}

.tag .who,
.tag .n {
  display: block;
  height: 22px;
  line-height: 22px;
  font-style: normal;
  white-space: nowrap;
}

.tag .who {
  padding: 0 5px 0 7px;
  border-radius: 11px 0 0 11px;
  background: linear-gradient(180deg, var(--tile-hi), var(--tile));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.45), inset 0 -1.5px 0 var(--tile-lo);
  color: #fff;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.fan.c4 .who {
  color: #5a3100;
  text-shadow: none;
}

.tag .n {
  min-width: 20px;
  padding: 0 7px 0 5px;
  border-radius: 0 11px 11px 0;
  background: linear-gradient(180deg, #ffffff, #e6ead9);
  box-shadow: inset 0 -1.5px 0 rgba(var(--shade-rgb), 0.18);
}

/* У боковых вееров метка стоит столбиком: под веером, в поле у борта. */
.fan.pos-left .tag,
.fan.pos-right .tag {
  flex-direction: column;
  width: 23px;
  height: auto;
  border-radius: 9px;
}

.fan.pos-left .tag .who,
.fan.pos-right .tag .who {
  height: 17px;
  padding: 0;
  border-radius: 9px 9px 0 0;
  font-size: 10.5px;
  line-height: 17px;
}

.fan.pos-left .tag .n,
.fan.pos-right .tag .n {
  min-width: 0;
  height: 19px;
  padding: 0;
  border-radius: 0 0 9px 9px;
  font-size: 13px;
  line-height: 19px;
}

/* Чей ход: золотой ободок вокруг метки (мигает только прозрачность). */
.fan .tag::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: -3px;
  bottom: -3px;
  border-radius: 13px;
  box-shadow: 0 0 0 2.5px #ffd24a, 0 0 12px 3px rgba(255, 210, 74, 0.75);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.fan.turn .tag::after {
  opacity: 1;
  animation: glow-pulse 0.9s ease-in-out infinite alternate;
}

.fan.winner .tag::after {
  opacity: 1;
}

.fan.winner .tag {
  animation: winner-pulse 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 3;
}

@keyframes winner-pulse {
  50% { transform: scale(1.12); }
}

/* «Тук-тук» — пас: веер дважды вздрагивает. */
.fan.knock .cards,
.fan.knock .badge {
  animation: knock-y 0.38s ease-in-out;
}

.fan.pos-left.knock .cards,
.fan.pos-left.knock .badge,
.fan.pos-right.knock .cards,
.fan.pos-right.knock .badge {
  animation-name: knock-x;
}

.fan.pos-right.knock .cards,
.fan.pos-right.knock .badge {
  animation-direction: reverse;
}

@keyframes knock-y {
  0%, 50%, 100% { transform: none; }
  25%, 75% { transform: translateY(3px); }
}

@keyframes knock-x {
  0%, 50%, 100% { transform: none; }
  25%, 75% { transform: translateX(3px); }
}

.hand.knock {
  animation: knock-y 0.38s ease-in-out;
}

/* Конец партии: кости выдвинуты из-под борта и открыты, лежат в ряд без нахлёста. */
.fan.open .cards {
  margin: 0;
}

.fan.pos-top.open {
  left: auto;
  right: 8px;
  transform: none;
}

.fan.pos-top.open .cards {
  margin-top: 2px;
}

.fan.pos-top.open .cards .dom + .dom {
  margin-left: 0.08em;
}

.fan.pos-left.open .cards {
  margin-left: 2px;
}

.fan.pos-right.open .cards {
  margin-right: 2px;
}

.fan.pos-left.open .cards .dom + .dom,
.fan.pos-right.open .cards .dom + .dom {
  margin-top: 0.02em;
}

.fan.open .cards .dom {
  animation: fan-flip 0.3s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes fan-flip {
  from { transform: scaleX(0.05); opacity: 0.2; }
}

/* Значок места на табличке игрока: маленькая рубашка с камнем цвета места. */
.mk {
  position: relative;
  display: block;
  width: 62%;
  height: 100%;
  font-size: 17px;
}

.lob-many .mk {
  font-size: 13px;
}

.mk .dom {
  left: 50%;
  top: 50%;
  margin: -1em 0 0 -0.5em;
  font-size: 1em;
  transform: rotate(-9deg);
}

.mk .dom.back .face::before {
  border: 0;
  border-radius: 50%;
  width: 0.46em;
  height: 0.46em;
  margin: -0.23em 0 0 -0.23em;
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, var(--tile-hi) 30%, var(--tile) 62%, var(--tile-lo) 100%);
  box-shadow: 0 0 0 0.05em rgba(255, 255, 255, 0.85), 0 0.03em 0.05em rgba(0, 0, 0, 0.5);
  transform: none;
}

.mk .dom.back .face::after {
  display: none;
}

/* Победитель виден на столе до окна итога: табличка вспыхивает золотом. */
.lob-plate.dom-winner {
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.22),
    0 0 0 3px #ffd24a,
    0 5px 0 3px rgba(var(--shade-rgb), 0.45),
    0 0 18px 3px rgba(255, 210, 74, 0.5);
  animation: winner-pulse 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 3;
}

.crown-pop {
  position: absolute;
  z-index: 6;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  color: #ffd24a;
  pointer-events: none;
  filter: drop-shadow(0 2px 0 #a35a00) drop-shadow(0 5px 6px rgba(var(--shade-rgb), 0.6));
  animation: crown-pop 1.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.crown-pop svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes crown-pop {
  0% { opacity: 0; transform: scale(0.2) rotate(-25deg); }
  16% { opacity: 1; transform: scale(1.35) rotate(8deg); }
  28% { transform: scale(1) rotate(0deg); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1) translateY(-8px); }
}

/* ---------- Цепочка ---------- */

.chainbox {
  position: absolute;
  left: var(--side);
  right: var(--side);
  top: var(--band);
  bottom: 0;
}

/* Тонкая «печатная» линия по сукну — как разметка на игровом столе. */
.chainbox::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 3px;
  bottom: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.075);
  border-radius: 11px;
  pointer-events: none;
}

.chain {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  --u: 40px;
  transform-origin: 0 0;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chain.snap,
.chain.snap .dom,
.hand.snap .dom {
  transition: none;
}

.chain .dom {
  transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dom.incoming {
  visibility: hidden;
}

/* Кость ударилась о стол: сплющилась, отыграла и легла. */
.dom.land .face {
  animation: tile-land 0.18s ease-out;
}

@keyframes tile-land {
  0% { transform: scale(1); }
  35% { transform: scale(0.92); }
  70% { transform: scale(1.04); }
  100% { transform: none; }
}

/* Соседи по цепочке на миг отодвигаются от удара. */
.dom.nudge .face {
  animation: tile-nudge 0.14s ease-out;
}

@keyframes tile-nudge {
  40% { transform: translate(var(--nx, 0), var(--ny, 0)); }
}

/* Волна по цепочке — победа. */
.dom.hop .face {
  animation: tile-hop 0.46s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--i) * 38ms);
}

@keyframes tile-hop {
  0% { transform: none; }
  40% { transform: translateY(-0.34em) scale(1.08); }
  100% { transform: none; }
}

/* Рыба: кости вздрагивают. */
.dom.shiver .face {
  animation: tile-shiver 0.5s ease-in-out both;
  animation-delay: calc(var(--i) * 22ms);
}

@keyframes tile-shiver {
  20% { transform: rotate(-5deg); }
  50% { transform: rotate(4deg); }
  80% { transform: rotate(-2deg); }
}

/* Открытый конец цепочки в свой ход: половина кости светится. */
.endmark {
  position: absolute;
  left: 0;
  top: 0;
  width: 1em;
  height: 1em;
  font-size: var(--u);
  border-radius: 0.2em;
  pointer-events: none;
  box-shadow: 0 0 0 0.05em rgba(255, 221, 100, 0.95), 0 0 0.4em 0.08em rgba(255, 210, 74, 0.7);
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.lob-myturn .endmark.on {
  opacity: 1;
  animation: glow-pulse 0.9s ease-in-out infinite alternate;
}

/* Место для хода: лунка с золотым пунктиром и призраком кости. */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 1em;
  height: 2em;
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--u);
  cursor: pointer;
  animation: ghost-in 0.2s cubic-bezier(0.3, 1.5, 0.5, 1) both;
}

.ghost.h {
  width: 2em;
  height: 1em;
}

.ghost::before {
  content: "";
  position: absolute;
  left: 0.04em;
  right: 0.04em;
  top: 0.04em;
  bottom: 0.04em;
  border-radius: 0.18em;
  background: rgba(255, 221, 100, 0.2);
  box-shadow: inset 0 0.06em 0.1em rgba(0, 24, 14, 0.55), 0 0 0 0.05em #ffd24a, 0 0 0.5em 0.1em rgba(255, 210, 74, 0.65);
  animation: glow-pulse 0.7s ease-in-out infinite alternate;
}

.ghost .dom {
  font-size: 1em;
  opacity: 0.55;
}

.ghost.near::before,
.ghost:hover::before,
.ghost:focus-visible::before {
  background: rgba(255, 233, 150, 0.5);
  animation: none;
}

.ghost.near .dom,
.ghost:hover .dom,
.ghost:focus-visible .dom {
  opacity: 0.9;
}

/* Зона нажатия шире самой лунки: не меньше 44 px даже при мелкой цепочке. */
.ghost::after {
  content: "";
  position: absolute;
  left: -0.7em;
  right: -0.7em;
  top: -0.7em;
  bottom: -0.7em;
}

.ghost:focus-visible {
  outline: none;
}

/* Фокус с клавиатуры — то же кольцо, что у костей в руке. */
.ghost:focus-visible::before {
  box-shadow: inset 0 0.06em 0.1em rgba(0, 24, 14, 0.55), 0 0 0 0.07em #ffffff, 0 0 0 0.15em rgba(0, 60, 40, 0.95), 0 0 0.5em 0.2em rgba(255, 210, 74, 0.8);
}

.ghost.passive {
  pointer-events: none;
}

@keyframes ghost-in {
  from { transform: scale(0.6); opacity: 0; }
}

/* Пустой стол: лунка в центре ждёт первую кость. */
.seed {
  position: absolute;
  left: -1em;
  top: -1em;
  width: 2em;
  height: 2em;
  font-size: var(--u);
  border-radius: 0.3em;
  background: rgba(0, 30, 18, 0.28);
  box-shadow: inset 0 0.07em 0.12em rgba(0, 20, 12, 0.6), 0 0.03em 0 rgba(255, 255, 255, 0.09);
  pointer-events: none;
}

.seed::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.3em;
  height: 0.3em;
  margin: -0.15em 0 0 -0.15em;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- Отклики на столе ---------- */

.ring {
  position: absolute;
  z-index: 3;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  pointer-events: none;
  animation: ring-out 0.42s ease-out both;
}

.ring.gold {
  border-color: #ffd24a;
}

@keyframes ring-out {
  from { transform: scale(0.3); opacity: 1; }
  to { transform: scale(1.5); opacity: 0; }
}

/* Слово у места игрока («Пас», «+3»): плашка с хвостиком в сторону того, кто это сказал. */
.say {
  position: absolute;
  z-index: 5;
  height: 30px;
  padding: 0 13px;
  border-radius: 15px;
  background: linear-gradient(180deg, #ffffff, #f1e9d2);
  box-shadow: inset 0 -2px 0 rgba(150, 120, 60, 0.3), 0 2.5px 0 rgba(var(--shade-rgb), 0.6), 0 7px 12px rgba(var(--shade-rgb), 0.4);
  color: #3b2a12;
  font-size: 18px;
  font-weight: 900;
  line-height: 30px;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: say-pop 1.45s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.say::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 3px;
  background: #ffffff;
  transform: rotate(45deg);
}

.say.tail-down::before {
  top: auto;
  bottom: -5px;
  background: #f1e9d2;
  box-shadow: 2px 2px 0 rgba(var(--shade-rgb), 0.55);
}

.say.tail-left::before {
  left: -5px;
  top: 50%;
  margin: -6px 0 0;
  background: #f8f2e2;
}

.say.tail-right::before {
  left: auto;
  right: -5px;
  top: 50%;
  margin: -6px 0 0;
  background: #f8f2e2;
}

@keyframes say-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(3deg); }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* Подсказка «Выберите конец цепочки»: встаёт под столом на место строки хода. */
.bar.tipped .bar-status {
  display: none;
}

.tip {
  flex: none;
  padding: 3px 12px;
  border-radius: 13px;
  background: linear-gradient(180deg, #ffe066, #ffbf1f);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.6), 0 2px 0 #c97b00, 0 6px 10px rgba(var(--shade-rgb), 0.4);
  color: #5a3100;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 20px;
  white-space: nowrap;
  pointer-events: none;
  animation: tip-in 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

@keyframes tip-in {
  from { transform: scale(0.5); opacity: 0; }
}

/* Блик по сукну — победа. */
.sweep {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.sweep::before {
  content: "";
  position: absolute;
  left: -45%;
  top: -30%;
  width: 45%;
  height: 160%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 255, 255, 0) 100%);
  transform: rotate(14deg);
  animation: sweep-go 0.9s ease-in-out both;
}

@keyframes sweep-go {
  to { transform: translateX(440%) rotate(14deg); }
}

/* Рыба плывёт через стол. */
.fish {
  position: absolute;
  z-index: 5;
  left: 0;
  top: 44%;
  width: 96px;
  height: 56px;
  margin: -28px 0 0 -96px;
  pointer-events: none;
  animation: fish-swim 1.7s cubic-bezier(0.3, 0.1, 0.4, 1) both;
}

.fish svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 5px 4px rgba(0, 28, 17, 0.45));
  animation: fish-wag 0.34s ease-in-out infinite alternate;
}

@keyframes fish-swim {
  0% { transform: translate(0, 14px) rotate(-8deg); opacity: 0; }
  10% { opacity: 1; }
  45% { transform: translate(calc(var(--span) * 0.5), -16px) rotate(6deg); }
  88% { opacity: 1; }
  100% { transform: translate(calc(var(--span) + 110px), 8px) rotate(-6deg); opacity: 0; }
}

@keyframes fish-wag {
  from { transform: rotate(-5deg) scaleY(0.96); }
  to { transform: rotate(5deg); }
}

.bubble {
  position: absolute;
  z-index: 4;
  width: var(--d, 10px);
  height: var(--d, 10px);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.95) 0%, rgba(160, 235, 255, 0.5) 45%, rgba(120, 220, 255, 0.18) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: bubble-up 1.1s ease-out both;
  animation-delay: var(--t, 0ms);
}

@keyframes bubble-up {
  0% { transform: translateY(0) scale(0.3); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-70px) scale(1); opacity: 0; }
}

/* Похвала на сукне — крупнее и поверх костей. */
.table .praise {
  top: 50%;
}

/* Кости выложил соперник: слово белое, без золота. */
.table .praise.plain {
  color: #ffffff;
  text-shadow:
    0 2px 0 #d8efe0,
    0 5px 0 #04452f,
    0 10px 18px rgba(var(--shade-rgb), 0.6);
}

/* «Дубль!» — слово над столом: всплывает невысоко, чтобы не закрывать кости и метки соперников. */
.table .gain {
  animation-name: word-pop;
  font-size: 24px;
  text-shadow:
    0 2px 0 #04452f,
    0 0 10px rgba(var(--shade-rgb), 0.7);
}

@keyframes word-pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.4); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  30% { transform: translate(-50%, -50%) scale(1); }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -100%) scale(1); }
}

@media (max-width: 380px) {
  .table .gain {
    font-size: 20px;
  }
}

/* ---------- Строка под столом: чей ход и кнопка «взять / пас» ---------- */

.foot.bar {
  gap: 9px;
  height: 50px;
}

.bar-status {
  display: inline-flex;
  min-width: 0;
}

.cta {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin-bottom: 4px;
  padding: 0 18px 0 12px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe066 0%, #ffbf1f 100%);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.65), 0 4px 0 #c97b00, 0 8px 12px rgba(var(--shade-rgb), 0.35);
  color: #5a3100;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.06s ease-out, box-shadow 0.06s ease-out;
  animation: cta-in 0.36s cubic-bezier(0.3, 1.7, 0.5, 1) both, cta-beat 0.9s 0.4s ease-in-out infinite alternate;
}

/* Зона нажатия — с запасом над и под кнопкой. */
.cta::before {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: -4px;
  bottom: -6px;
}

.cta:active {
  transform: translateY(3px);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.65), 0 1px 0 #c97b00;
}

@keyframes cta-in {
  from { transform: scale(0.4); opacity: 0; }
}

@keyframes cta-beat {
  from { transform: none; }
  to { transform: scale(1.06); }
}

/* Маленькая рубашка на кнопке «Взять». */
.cta-ico {
  position: relative;
  display: block;
  width: 13px;
  height: 23px;
  border-radius: 3.5px;
  background: linear-gradient(158deg, var(--back-hi), var(--back) 50%, var(--back-lo));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 0 var(--back-side);
  transform: rotate(-10deg);
}

.cta-ico::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--brass-hi);
}

.cta.is-pass .cta-ico {
  display: none;
}

.cta.is-pass {
  padding-left: 18px;
}

/* ---------- Рука ---------- */

.hand {
  position: relative;
  flex: none;
  width: 100%;
  max-width: var(--col, 460px);
  height: var(--hand-h);
}

.hand .dom {
  cursor: pointer;
  touch-action: none;
  transition: transform 0.3s cubic-bezier(0.25, 0.9, 0.3, 1.15);
}

.hand .dom .face {
  transition: transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1);
}

/* Свечение под костью, которой можно ходить (отдельный слой: мигает только прозрачность).
   Сердцевина белая: на зелёном сукне чисто жёлтое свечение уходило в оливковый. */
.hand .dom::before {
  content: "";
  position: absolute;
  left: 0.035em;
  right: 0.035em;
  top: 0.025em;
  bottom: 0.06em;
  border-radius: 0.19em;
  box-shadow: 0 0 0 0.05em #fff6c8, 0 0 0 0.11em #ffc928, 0 0 0.5em 0.14em rgba(255, 214, 90, 0.9);
  opacity: 0;
  transition: opacity 0.18s ease-out, transform 0.18s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.hand .dom.can::before {
  opacity: 1;
  transform: translateY(-0.28em);
  animation: hand-glow 0.9s ease-in-out infinite alternate;
}

/* Свечение дышит неглубоко: в нижней точке оно всё ещё золотое, а не оливковое на зелёном. */
@keyframes hand-glow {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

.hand .dom.can .face {
  transform: translateY(-0.28em);
}

.hand .dom.can:hover .face,
.hand .dom.can:hover::before {
  transform: translateY(-0.36em);
}

.hand .dom.sel .face,
.hand .dom.sel::before {
  transform: translateY(-0.46em) scale(1.06);
}

.hand .dom.sel::before {
  animation: none;
  opacity: 1;
}

/* Не подходит в свой ход — «отдыхает»: лежит ниже, в зелёной тени стола; кость остаётся костяной. */
.hand .dom .face::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  border-radius: inherit;
  background: rgba(20, 60, 45, 0.17);
  opacity: 0;
  transition: opacity 0.18s ease-out;
  pointer-events: none;
}

.hand .dom.dim .face::after {
  opacity: 1;
}

.hand .dom.dim .face {
  transform: translateY(0.08em);
}

.hand .dom:active .face {
  transition-duration: 0.06s;
}

.hand .dom.nope {
  animation: tile-nope 0.3s ease-in-out;
}

@keyframes tile-nope {
  20% { margin-left: -5px; }
  45% { margin-left: 4px; }
  70% { margin-left: -3px; }
  90% { margin-left: 1px; }
}

.hand .dom:focus-visible {
  outline: none;
}

.hand .dom:focus-visible .face {
  box-shadow:
    inset 0 0.03em 0 #ffffff,
    0 0 0 0.07em #ffffff,
    0 0 0 0.13em rgba(0, 60, 40, 0.9),
    0 0.2em 0.13em rgba(0, 28, 17, 0.55);
}

/* Кость тащат: над всем, крупнее, без переходов. */
.hand .dom.drag {
  z-index: 9;
  transition: none;
  cursor: grabbing;
}

.hand .dom.drag .face,
.hand .dom.drag::before {
  transform: scale(1.14);
  transition-duration: 0.1s;
}

.hand .dom.drag .face {
  box-shadow:
    inset 0 0.03em 0 #ffffff,
    inset 0 -0.045em 0.05em rgba(150, 120, 60, 0.38),
    0 0.075em 0 var(--ivory-side),
    0 0.1em 0 var(--ivory-edge),
    0 0.5em 0.4em rgba(0, 28, 17, 0.45);
}

.hand .dom.drag::before {
  animation: none;
}

.lob-over .hand .dom {
  cursor: default;
}

/* ---------- Летящие кости, указатель ---------- */

.fly {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.in-menu .fly {
  display: none;
}

.fly .dom {
  will-change: transform;
}

/* В воздухе тень большая и мягкая; на столе кость получает обычную, плотную — «прилипает». */
.fly .dom .face {
  box-shadow:
    inset 0 0.03em 0 #ffffff,
    inset 0 -0.045em 0.05em rgba(150, 120, 60, 0.38),
    0 0.075em 0 var(--ivory-side),
    0 0.1em 0 var(--ivory-edge),
    0 0.42em 0.5em rgba(0, 28, 17, 0.42);
}

.fly .dom.back .face {
  box-shadow:
    inset 0 0.03em 0 rgba(255, 255, 255, 0.55),
    0 0.075em 0 var(--back-side),
    0 0.1em 0 #3d0613,
    0 0.42em 0.5em rgba(0, 28, 17, 0.42);
}

/* Летящая кость с двумя сторонами: рубашка гаснет, лицо проявляется. */
.fly .dom .side {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  font-size: 1em;
}

.pointer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 40px;
  height: 40px;
  margin: -4px 0 0 -8px;
  filter: drop-shadow(0 4px 3px rgba(var(--shade-rgb), 0.5));
  animation: pointer-tap 0.9s ease-in-out infinite;
}

.pointer svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes pointer-tap {
  0%, 100% { transform: translate(6px, 14px) rotate(-18deg); }
  45% { transform: translate(0, 0) rotate(-18deg) scale(0.92); }
  60% { transform: translate(0, 0) rotate(-18deg) scale(0.92); }
}

/* ---------- Окно итога ---------- */

/* Окна над столом (итог, «Выйти из партии?») — всегда отдельной карточкой на весь экран, одного вида
   для победы, поражения и ничьей: набор уводит окно из стола, если оно в нём не помещается. */
.well.table > .over > .card {
  min-height: 4000px;
}

.lob-result .over-title.solo {
  font-size: 34px;
  line-height: 38px;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 0 #d8efe0, 0 6px 0 rgba(var(--shade-rgb), 0.7);
}

/* Победа — с золотой кромкой. */
.lob-result.lob-win .over-title.solo {
  font-size: 38px;
  line-height: 42px;
  text-shadow: 0 2px 0 #fff3b8, 0 6px 0 #b86a00, 0 12px 18px rgba(var(--shade-rgb), 0.5);
}

/* Очки победителя: золотая плашка с подписью — «+18 очков». */
.card .res-gain {
  display: inline-flex;
  align-items: center;
  height: 32px;
  margin-top: 9px;
  padding: 0 15px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffe066, #ffbf1f);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.65), 0 3px 0 #c97b00;
  color: #5a3100;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  animation: tip-in 0.4s 0.25s cubic-bezier(0.3, 1.7, 0.5, 1) both;
}

.lob-result .over-text {
  margin-top: 9px;
}

.res-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-top: 11px;
  --ru: 16px; /* половина кости в ряду */
}

.res-row {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 44px;
  padding: 0 6px 0 9px;
  border-radius: 13px;
  background: rgba(var(--shade-rgb), 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 18px;
  white-space: nowrap;
  animation: res-in 0.34s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(var(--i) * 70ms + 120ms);
}

.res-rows.tight {
  gap: 4px;
  --ru: 14px;
}

.res-rows.tight .res-row {
  height: 38px;
}

@keyframes res-in {
  from { transform: translateX(-14px); opacity: 0; }
}

/* Победитель: светлая строка с золотой рамкой и короной — не только цветом. */
.res-row.win {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  box-shadow: inset 0 0 0 2px #ffd24a, 0 0 12px rgba(255, 210, 74, 0.35);
}

.res-row .gem {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, var(--tile-hi) 30%, var(--tile) 62%, var(--tile-lo) 100%);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85), 0 1.5px 2px rgba(0, 0, 0, 0.4);
}

.res-row .crown {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0 -3px;
  color: #ffd24a;
  filter: drop-shadow(0 1.5px 0 #a35a00);
}

.res-row .crown svg {
  display: block;
  width: 100%;
  height: 100%;
}

.res-row .who {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.res-row .left {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: calc(var(--ru) * 2);
  font-size: var(--ru);
}

.res-row .left .dom {
  position: relative;
  flex: none;
  font-size: 1em;
  margin-left: 0.14em;
}

.res-row .more {
  margin-left: 4px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--ink-2);
}

.res-row .sum {
  flex: none;
  min-width: 34px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 15px;
  font-weight: 900;
  line-height: 24px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.res-row .sum.count {
  color: var(--ink-2);
}

.res-row.win .sum {
  background: linear-gradient(180deg, #ffe066, #ffbf1f);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.6), 0 2px 0 #c97b00;
  color: #5a3100;
}

@media (max-height: 620px) {
  .lob-result .over-title.solo,
  .lob-result.lob-win .over-title.solo {
    font-size: 30px;
    line-height: 32px;
  }

  .card .res-gain {
    height: 28px;
    margin-top: 6px;
    font-size: 16px;
  }

  .lob-result .over-text {
    margin-top: 6px;
    font-size: 14.5px;
    line-height: 19px;
  }

  .lob-result.over-full .card {
    padding: 16px 16px 18px;
  }

  .lob-result.over-full .over-actions {
    margin-top: 12px;
    gap: 8px;
  }

  .lob-result .over-actions .btn-gold {
    height: 50px;
  }

  .res-rows {
    margin-top: 8px;
  }
}

/* Справка — на весь экран, текст слева; сверху — три кости: стык чисел и дубль поперёк. */
.help-art {
  position: relative;
  display: block;
  width: 5em;
  height: 2em;
  margin: 12px 0 6px;
  font-size: 26px;
}

.help-art .dom {
  font-size: 1em;
}

.help-art .dom:nth-child(1) { left: 0; top: 0.5em; }
.help-art .dom:nth-child(2) { left: 2em; top: 0; }
.help-art .dom:nth-child(3) { left: 3em; top: 0.5em; }

@media (max-height: 620px) {
  .help-art {
    margin: 6px 0 2px;
    font-size: 20px;
  }
}


.over.help-sheet .over-text {
  max-width: 320px;
  text-align: left;
  font-size: 14.5px;
  line-height: 20px;
}

/* ---------- Экраны лобби в тон стола ---------- */
/* Сами экраны рисует набор; здесь только их оттенок под эту игру. */

/* Заголовки («Уровень», «Ваше имя»): кромка зелёная, как у названия в меню, а не цвета дерева. */
.lob-h {
  text-shadow:
    0 1.5px 0 var(--title-hi),
    0 4.5px 0 #04452f,
    0 10px 18px rgba(var(--shade-rgb), 0.5);
}

/* Ожидание соперника: прыгают три кости домино, а не цветные плитки. */
.lob-loader i.tile {
  width: 19px;
  height: 36px;
  border-radius: 5px;
  background:
    linear-gradient(180deg, transparent 47%, rgba(120, 100, 60, 0.75) 47%, rgba(120, 100, 60, 0.75) 51.5%, transparent 51.5%),
    radial-gradient(circle var(--pr, 2.2px) at 50% 24%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 30% 64%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 70% 86%, var(--pip) 92%, transparent),
    linear-gradient(158deg, var(--ivory-hi) 0%, var(--ivory) 52%, var(--ivory-lo) 100%);
  box-shadow: inset 0 1.5px 0 #ffffff, 0 3px 0 var(--ivory-side), 0 4px 0 var(--ivory-edge), 0 7px 6px rgba(var(--shade-rgb), 0.45);
}

.lob-loader i.tile:nth-child(2) {
  background:
    linear-gradient(180deg, transparent 47%, rgba(120, 100, 60, 0.75) 47%, rgba(120, 100, 60, 0.75) 51.5%, transparent 51.5%),
    radial-gradient(circle var(--pr, 2.2px) at 30% 14%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 70% 34%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 30% 66%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 70% 66%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 30% 86%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 70% 86%, var(--pip) 92%, transparent),
    linear-gradient(158deg, var(--ivory-hi) 0%, var(--ivory) 52%, var(--ivory-lo) 100%);
}

.lob-loader i.tile:nth-child(3) {
  background:
    linear-gradient(180deg, transparent 47%, rgba(120, 100, 60, 0.75) 47%, rgba(120, 100, 60, 0.75) 51.5%, transparent 51.5%),
    radial-gradient(circle var(--pr, 2.2px) at 50% 24%, var(--pip) 92%, transparent),
    radial-gradient(circle var(--pr, 2.2px) at 50% 75%, var(--pip) 92%, transparent),
    linear-gradient(158deg, var(--ivory-hi) 0%, var(--ivory) 52%, var(--ivory-lo) 100%);
}

.lob-loader-small i.tile {
  width: 12px;
  height: 23px;
  border-radius: 3.5px;
  --pr: 1.4px;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 0 var(--ivory-side), 0 4px 4px rgba(var(--shade-rgb), 0.45);
}

/* Вторые кнопки («Отмена», «В меню», «Выйти») и реакции: зона нажатия не меньше 44 px. */
.lob-body .btn-ghost,
.over-actions .btn-ghost {
  height: 44px;
}

.lob-emotes button {
  position: relative;
}

.lob-emotes button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  bottom: -3px;
}

/* ---------- Меньше движения ---------- */

@media (prefers-reduced-motion: reduce) {
  .chain,
  .chain .dom,
  .hand .dom,
  .hand .dom .face {
    transition: none;
  }

  .fish,
  .sweep,
  .bubble,
  .ring {
    display: none;
  }

  .fan .cards,
  .fan.open .cards .dom,
  .fan.winner .tag,
  .lob-plate.dom-winner {
    transition: none;
    animation: none;
  }

  .dlogo .dom:nth-child(3) .face,
  .bone.call .pile,
  .cta,
  .pointer {
    animation: none;
  }
}
