/* «Реверси» — оформление. Лобби и разделы — тёмный стиль Games (общие классы style.css),
   партия — яркая сцена: терраса у лагуны, мраморный стол, поле из лагунного камня, обсидиан и жемчуг (img/reversi/).
   Из reversi-экран.js идут только классы и data-атрибуты. Фишки и поле имеют запасную отрисовку на случай, если картинка не загрузилась. */

body.реверси {
  --кнопка-фон: var(--сб-акцент);
  --кнопка-текст: var(--сб-акцент-текст);
  --акцент: var(--сб-акцент);
  --золото-светлое: #FFE08A;
  --золото: #F4C54A;
  --стекло: rgba(11, 30, 40, .62);
  --стекло-край: rgba(255, 255, 255, .22);
  --текст-на-сцене: #f4fbff;
  --лагуна: #0e7f7a;
}
.без-скриптов { padding: 24px; text-align: center; }

/* ---------- Лобби ---------- */
.плашка-возврата {
  min-height: 46px; margin: 6px 0; padding: 10px 16px; border-radius: 14px; border: 1px solid rgba(190, 255, 80, .5);
  background: rgba(190, 255, 80, .12); color: inherit; font: inherit; font-weight: 700; cursor: pointer;
}
.страница-реверси .лобби__картинка { aspect-ratio: 16 / 8.2; }
.страница-реверси .лобби__подпись {
  font-family: var(--шрифт); font-weight: 700; font-size: clamp(16px, 4.6vw, 20px);
  line-height: 1.25; color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .7);
}
.значок-бот { display: block; width: 100%; height: 100%; object-fit: contain; }
body.реверси .карточка-входа__значок:has(.значок-бот) { padding: 0; }

/* ---------- Разделы: правила, рекорды, профиль ---------- */
.раздел { overflow-y: auto; gap: 10px; width: 100%; max-width: 520px; margin: 0 auto; }
/* Нижняя полоса вкладок на «Рекордах» и «Профиле» (разметку ставит общий нижние-вкладки.js).
   Нижний отступ = высота полосы + запас + безопасная зона: последняя строка при прокрутке до конца целиком над полосой. */
.раздел:has(> .нижние-вкладки) {
  --вт-панель-низ: clamp(52px, 14.36vw, 64px);
  --вт-поверхность: var(--сб-поверхность);
  --вт-текст: var(--сб-текст);
  --вт-текст-тихий: var(--сб-текст-тихий);
  --вт-акцент: var(--сб-акцент);
  padding-bottom: calc(var(--вт-панель-низ) + 24px + var(--отступ-снизу));
  scroll-padding-bottom: calc(var(--вт-панель-низ) + 24px + var(--отступ-снизу));
}
.раздел > :not(.нижние-вкладки) { flex-shrink: 0; }
/* «‹» в разделах — кнопка 44×44 у левого края: общий style.css растягивает #кнопка-рекорды-назад на всю ширину (правило для витрины Games). */
:is(#кнопка-рекорды-назад, #кнопка-профиль-назад).верх-игры__кнопка { width: 44px; min-width: 44px; flex: 0 0 44px; margin: 0; }
.раздел__заголовок { margin: 4px 0; font-size: 26px; line-height: 1.15; }
.раздел__пояснение { margin: 0; opacity: .8; line-height: 1.35; }
.правила__карточки { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.карточка-правила {
  padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1);
}
.карточка-правила__заголовок { margin: 6px 0 4px; font-size: 17px; }
.карточка-правила__текст { margin: 0; font-size: 15px; line-height: 1.35; opacity: .88; }
.схема { display: flex; align-items: center; justify-content: center; gap: 6px; height: 64px; }
.схема__надпись { font-weight: 800; font-size: 15px; padding: 0 8px; opacity: .9; }
.схема__фишка {
  display: block; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.схема__фишка[data-цвет="1"] {
  background-image: url("../../img/reversi/фишка-обсидиан.png"), radial-gradient(circle closest-side, #1b2a55 0 80%, transparent 82%);
}
.схема__фишка[data-цвет="2"] {
  background-image: url("../../img/reversi/фишка-жемчуг.png"), radial-gradient(circle closest-side, #f1e6f0 0 80%, transparent 82%);
}
.схема__фишка--пусто { border: 2px dashed rgba(210, 247, 107, .75); width: 44px; height: 44px; margin: 0 4px; background: none; }
.схема--угол .схема__фишка:first-child { box-shadow: 0 0 0 3px var(--золото); }

.рекорды { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.рекорды__строка, .сводка__строка {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px;
  padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06);
}
.рекорды__название { font-weight: 700; }
.рекорды__значение, .сводка__значение { margin: 0; text-align: right; font-size: 14px; line-height: 1.3; }
.сводка__значение { font-weight: 700; font-size: 16px; }
body.реверси dl.сводка { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 0; padding: 0; margin: 0; }
.сводка__название { margin: 0; }
.профиль-игрока { display: flex; align-items: center; gap: 14px; }
.профиль-игрока__имя { margin: 0; }
.профиль-игрока__аватар { width: 64px; height: 64px; flex: 0 0 auto; }

/* ---------- Листы ---------- */
.лист-выбора__пояснение { margin: 0; text-align: center; line-height: 1.35; opacity: .9; }
.лист-бот__сейчас { font-weight: 800; opacity: 1; color: var(--сб-акцент); }
.лист-бот__группа { margin: 6px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; opacity: .7; }
.лист-бот__кнопки { display: flex; flex-direction: column; gap: 8px; }
.лист-бот__кнопки--ряд { flex-direction: row; }
.лист-бот__кнопки .кнопка.кнопка--выбор {
  flex: 0 0 auto; height: auto; min-height: 52px; padding: 8px 14px; text-align: left; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  color: var(--сб-текст, #fff); background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22); box-shadow: none;
}
.лист-бот__кнопки--ряд .кнопка.кнопка--выбор { flex: 1 1 0; align-items: center; text-align: center; font-size: 14px; }
/* Низ листа «Против бота»: «Играть» и «Закрыть» липнут к низу вместе, как одна полоса.
   Общая «Закрыть» липнет сама по себе и на низком экране (320×568) налезала на «Играть» — здесь она в потоке обёртки. */
.лист-бот__низ {
  position: sticky; bottom: 0; z-index: 1; flex-shrink: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 6px;
  background: var(--вт-поверхность);
  box-shadow: 0 -14px 14px -4px var(--вт-поверхность), 0 calc(14px + var(--отступ-снизу)) 0 0 var(--вт-поверхность);
}
.лист-бот__низ .лист-ещё__закрыть { position: static; margin-top: 0; box-shadow: none; }
.кнопка--выбор__название { font-size: 16px; font-weight: 800; }
.кнопка--выбор__описание { font-size: 13px; font-weight: 500; opacity: .85; line-height: 1.25; }
.лист-бот__кнопки .кнопка.кнопка--выбор[aria-pressed="true"] {
  color: var(--сб-акцент-текст); background: var(--сб-акцент); border-color: var(--сб-акцент);
}
.лист-бот__кнопки .кнопка.кнопка--выбор[aria-pressed="true"] .кнопка--выбор__описание { opacity: .9; }
.лист-ещё__строка[aria-pressed="true"] .лист-ещё__значение { color: var(--сб-акцент); font-weight: 800; }
.итог__кнопки { display: flex; gap: 10px; }
.итог__кнопки .кнопка { flex: 1 1 0; min-width: 0; }
.кнопка[aria-disabled="true"] { opacity: .55; }

/* ---------- Партия: сцена ---------- */
.партия {
  gap: 6px; user-select: none; -webkit-user-select: none; overflow: hidden;
  background: #cdbfb6 url("../../img/reversi/сцена.jpg") center / cover no-repeat;
  color: var(--текст-на-сцене); touch-action: none;
}
.партия__верх { display: flex; align-items: center; gap: 8px; min-height: 44px; flex: 0 0 auto; }
.партия__кнопка {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; flex: 0 0 auto;
  color: var(--текст-на-сцене); background: var(--стекло); border: 1px solid var(--стекло-край); border-radius: 14px; cursor: pointer;
}
.партия__кнопка svg { width: 22px; height: 22px; }
.партия__режим {
  flex: 1 1 auto; margin: 0; padding: 0 12px; min-height: 36px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 15px; font-weight: 800; border-radius: 18px; background: var(--стекло); border: 1px solid var(--стекло-край);
}

.партия__счёт {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 auto; min-height: 48px;
  margin-top: auto; /* свободное место делится поровну над счётом и под строкой состояния: поле по центру, не «пустота под доской» */
}
.счёт__сторона {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 4px 14px 4px 8px; border-radius: 24px;
  background: var(--стекло); border: 2px solid var(--стекло-край); font-weight: 800;
}
.счёт__сторона--вправо { padding: 4px 8px 4px 14px; }
.счёт__сторона[data-активна="да"] { border-color: var(--сб-акцент); box-shadow: 0 0 0 3px rgba(210, 247, 107, .28); }
.счёт__имя { font-size: 15px; }
.счёт__число { font-size: 24px; line-height: 1; min-width: 1.4ch; text-align: center; font-variant-numeric: tabular-nums; }
.счёт__фишка { width: 34px; height: 34px; flex: 0 0 auto; background-size: contain; background-repeat: no-repeat; background-position: center; }
.счёт__сторона[data-цвет="1"] .счёт__фишка { background-image: url("../../img/reversi/фишка-обсидиан.png"), radial-gradient(circle closest-side, #1b2a55 0 80%, transparent 82%); }
.счёт__сторона[data-цвет="2"] .счёт__фишка { background-image: url("../../img/reversi/фишка-жемчуг.png"), radial-gradient(circle closest-side, #f1e6f0 0 80%, transparent 82%); }
.счёт__думает { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 5px; }
.счёт__думает i { width: 8px; height: 8px; border-radius: 50%; background: var(--сб-акцент); animation: думает 1s infinite ease-in-out; }
.счёт__думает i:nth-child(2) { animation-delay: .15s; }
.счёт__думает i:nth-child(3) { animation-delay: .3s; }
@keyframes думает { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }

/* ---------- Поле ---------- */
.партия__поле { flex: 0 0 auto; display: flex; justify-content: center; }
.поле {
  /* Высота поля учитывает верхний/нижний отступ экрана (полный экран Telegram: +70 px сверху, 78 с полем): иначе панели не помещаются */
  position: relative; width: min(100%, calc(100dvh - 268px - var(--отступ-сверху) - var(--отступ-снизу))); max-width: 560px; aspect-ratio: 1; border-radius: 10px;
  background:
    url("../../img/reversi/доска.jpg") center / 100% 100% no-repeat,
    linear-gradient(135deg, var(--лагуна), #0a5f63);
  box-shadow: 0 0 0 3px var(--золото), 0 12px 22px rgba(10, 30, 40, .4);
  touch-action: none;
}
/* Пока открыто окно итога, поле уменьшается так, чтобы окно с кнопками целиком влезло в видимую высоту.
   --итог-запас = всё, что занимает экран кроме поля: шапка, счёт, зазоры, окно итога (по высоте экрана — ниже) и отступы. */
.партия { --итог-запас: 340px; }
.партия--итог .поле { width: min(100%, calc(100dvh - var(--итог-запас) - var(--отступ-сверху) - var(--отступ-снизу))); }
@media (min-height: 700px) { .партия { --итог-запас: 400px; } }
@media (max-height: 640px) { .партия { --итог-запас: 268px; } }
.поле__сетка { position: absolute; inset: 2.17%; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.клетка {
  position: relative; min-width: 0; min-height: 0; touch-action: none; -webkit-tap-highlight-color: transparent;
  outline: 1px solid rgba(255, 255, 255, .12); outline-offset: -1px;
}
.клетка--нажата { background: rgba(255, 255, 255, .16); }
.клетка--качнуть { animation: качнуть .2s linear; }
@keyframes качнуть { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* точка легального хода */
.клетка[data-ход]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--сб-акцент); box-shadow: 0 0 8px 2px rgba(210, 247, 107, .7);
}
.поле[data-подсветка="нет"] .клетка[data-ход]::after { display: none; }

/* призрачная фишка: подсказка и нажатие */
.клетка[data-призрак]::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: .6; background-size: contain; background-repeat: no-repeat; background-position: center;
}
.клетка[data-призрак="1"]::before { background-image: url("../../img/reversi/фишка-обсидиан.png"); }
.клетка[data-призрак="2"]::before { background-image: url("../../img/reversi/фишка-жемчуг.png"); }
.клетка[data-призрак="подсказка"]::after { display: none; }
.клетка[data-подсказка]::after {
  content: ""; position: absolute; inset: 4%; border-radius: 50%; border: 3px solid var(--сб-акцент); background: none; box-shadow: 0 0 10px 2px rgba(210, 247, 107, .7);
  width: auto; transform: none; left: 4%; top: 4%; animation: кольцо 1s infinite ease-in-out;
}
@keyframes кольцо { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
.клетка[data-вспышка] .фишка { filter: drop-shadow(0 0 6px var(--сб-акцент)); }

/* фишка: два лица на вращающейся основе, переворот меняет data-цвет */
.фишка { position: absolute; inset: 0; perspective: 300px; filter: drop-shadow(2px 4px 2px rgba(0, 20, 30, .45)); pointer-events: none; }
.фишка__вращ { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .26s ease-in-out; }
.фишка[data-цвет="2"] .фишка__вращ { transform: rotateY(180deg); }
.фишка__лицо {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.фишка__лицо--1 { background-image: url("../../img/reversi/фишка-обсидиан.png"), radial-gradient(circle closest-side, #1b2a55 0 80%, transparent 82%); }
.фишка__лицо--2 { background-image: url("../../img/reversi/фишка-жемчуг.png"), radial-gradient(circle closest-side, #f1e6f0 0 80%, transparent 82%); transform: rotateY(180deg); }
.фишка[data-пор="1"] .фишка__вращ { transition-delay: 60ms; }
.фишка[data-пор="2"] .фишка__вращ { transition-delay: 120ms; }
.фишка[data-пор="3"] .фишка__вращ { transition-delay: 180ms; }
.фишка[data-пор="4"] .фишка__вращ { transition-delay: 240ms; }
.фишка[data-пор="5"] .фишка__вращ { transition-delay: 300ms; }
.фишка[data-пор="6"] .фишка__вращ { transition-delay: 360ms; }
.фишка[data-пор="7"] .фишка__вращ { transition-delay: 420ms; }
.фишка--новая { animation: упала .18s ease-out; }
@keyframes упала { from { transform: translateY(-6px) scale(1.08); } to { transform: none; } }
/* метка последнего хода: тонкое светлое кольцо внутри фишки */
.клетка[data-последний] .фишка::after {
  content: ""; position: absolute; inset: 30%; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 0 4px rgba(0, 0, 0, .4);
}
.поле[data-метка="нет"] .клетка[data-последний] .фишка::after { display: none; }

/* рука-подсказка обучения */
.клетка[data-рука]::before {
  content: ""; position: absolute; inset: 6%; border-radius: 50%; border: 3px solid var(--сб-акцент); animation: кольцо 1s infinite ease-in-out;
}
.рука {
  position: absolute; left: 46%; top: 44%; width: 62%; aspect-ratio: 1; pointer-events: none; z-index: 2; animation: тап 1.1s infinite ease-in-out;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 3a2 2 0 0 1 4 0v7l2-.4a2 2 0 0 1 2.2 1.1l1.2-.3a2 2 0 0 1 2 .9 2 2 0 0 1 1.3 2.3l-.9 5.2A4 4 0 0 1 16.9 22H12a4 4 0 0 1-3.2-1.6L4.5 14.7a1.8 1.8 0 0 1 2.7-2.3L9 14Z' fill='%23fff' stroke='%23123' stroke-width='1.1' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .5));
}
@keyframes тап { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-6px, -6px); } }

/* ---------- Строка состояния и плашка пропуска ---------- */
.партия__низ { position: relative; flex: 0 0 auto; min-height: 44px; display: flex; margin-bottom: auto; }
.партия__статус {
  flex: 1 1 auto; margin: 0; padding: 6px 14px; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 15px; font-weight: 700; line-height: 1.25; border-radius: 14px; background: var(--стекло); border: 1px solid var(--стекло-край);
}
.партия__статус[data-вид="отказ"] { border-color: #ff8a7a; color: #ffd9d3; }
.партия__пропуск {
  position: absolute; inset: 0; margin: 0; padding: 6px 12px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 16px; font-weight: 800; line-height: 1.2; border-radius: 14px; color: #2a1c00;
  background: linear-gradient(180deg, var(--золото-светлое), var(--золото)); box-shadow: 0 4px 14px rgba(0, 0, 0, .35); z-index: 3;
}

/* ---------- Нижняя панель действий ---------- */
.партия__действия { margin-top: 0; flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-bottom: 8px; }
.действие {
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 6px;
  font: inherit; color: var(--текст-на-сцене); background: var(--стекло); border: 1px solid var(--стекло-край); border-radius: 16px; cursor: pointer;
}
.действие svg { width: 22px; height: 22px; }
.действие__подпись { font-size: 13px; font-weight: 800; }
.действие:active { transform: translateY(2px); }
.действие[aria-disabled="true"] { opacity: .5; }

/* ---------- Окно итога: стоит в потоке под полем, поле видно целиком ---------- */
.окно-итог {
  flex: 1 1 auto; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 6px; padding: 8px 10px 10px;
  border-radius: 18px; text-align: center; background: var(--стекло); border: 1px solid var(--стекло-край);
}
.окно-итог__заголовок { margin: 0; font-size: 20px; line-height: 1.1; }
.окно-итог__счёт { margin: 0; font-size: 28px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--золото-светлое); }
.окно-итог__строка { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.2; opacity: .95; }
.окно-итог .итог__кнопки { margin-top: 6px; gap: 6px; }
.окно-итог .кнопка { min-width: 0; min-height: 48px; padding: 6px 8px; font-size: 14px; line-height: 1.15; }
.окно-итог .кнопка--главная { flex: 1.3 1 0; font-size: 16px; min-height: 48px; }
.партия--итог .партия__низ, .партия--итог .партия__действия { display: none; }
.партия--итог .окно-итог { margin-bottom: 8px; }
/* Низкие экраны: лист «Против бота» сжат, чтобы выбор цвета был виден над «Играть» без прокрутки */
@media (max-height: 640px) {
  /* зазор между кнопками 8 px сохранён; воздух вокруг подписей и у краёв листа сжат, чтобы лист на 320×568 остался без прокрутки */
  #лист-бот .лист-ещё__лист { gap: 2px; padding-top: 8px; padding-bottom: calc(8px + var(--отступ-снизу)); }
  #лист-бот .лист-ещё__заголовок { line-height: 1.15; }
  #лист-бот .лист-бот__группа { margin-top: 0; font-size: 12px; }
  #лист-бот .лист-бот__кнопки { gap: 8px; }
  /* лист «⋯» на низком экране: общий css ставит зазор 6 px, кнопки должны быть не ближе 8 px */
  #лист-игры .лист-ещё__лист { gap: 8px; }
  #лист-бот .лист-бот__кнопки .кнопка.кнопка--выбор { min-height: 44px; padding: 4px 12px; gap: 0; }
  #лист-бот .кнопка--выбор__название { font-size: 15px; }
  #лист-бот .кнопка--выбор__описание { font-size: 12px; line-height: 1.15; }
  #лист-бот .лист-бот__низ { gap: 8px; margin-top: 6px; }
  #лист-бот .лист-бот__низ { box-shadow: 0 calc(14px + var(--отступ-снизу)) 0 0 var(--вт-поверхность); }
  #лист-бот .лист-бот__сейчас { font-size: 14px; line-height: 1.1; }
  #лист-бот .лист-бот__кнопки--ряд .кнопка.кнопка--выбор { padding: 2px 4px; font-size: 12px; line-height: 1.1; }
}
/* Высокие экраны: окно итога заполнено крупнее, пустоты между счётом и кнопками нет */
@media (min-height: 700px) {
  .окно-итог { gap: 12px; padding: 14px 12px; }
  .окно-итог__заголовок { font-size: 26px; }
  .окно-итог__счёт { font-size: 44px; }
  .окно-итог__строка { font-size: 16px; }
  .окно-итог .итог__кнопки { margin-top: 10px; gap: 8px; }
  .окно-итог .кнопка { min-height: 56px; font-size: 15px; }
  .окно-итог .кнопка--главная { min-height: 56px; font-size: 17px; }
}
/* Низкие экраны (320×568): компактнее, «Отменить последний ход» — в две строки, снизу воздух */
@media (max-height: 640px) {
  .окно-итог { gap: 4px; padding: 6px 8px 8px; }
  .окно-итог__заголовок { font-size: 18px; }
  .окно-итог__счёт { font-size: 24px; }
  .окно-итог__строка { font-size: 13px; }
  .окно-итог .итог__кнопки { margin-top: 4px; gap: 8px; }
  .окно-итог .кнопка { min-height: 44px; padding: 4px 4px; font-size: 12px; line-height: 1.1; }
  .окно-итог .кнопка--главная { min-height: 44px; font-size: 14px; }
  .партия--итог .окно-итог { margin-bottom: 14px; }
}

/* ---------- Конфетти ---------- */
.конфетти { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.конфетти i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: конфетти 1.8s ease-in forwards; }
.конфетти i:nth-child(5n+1) { background: var(--сб-акцент); }
.конфетти i:nth-child(5n+2) { background: var(--золото); }
.конфетти i:nth-child(5n+3) { background: #5fd4e3; }
.конфетти i:nth-child(5n+4) { background: #fff; }
.конфетти i:nth-child(5n) { background: #ff8fb8; }
@keyframes конфетти { to { transform: translate(var(--дрейф, 0), 110vh) rotate(540deg); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  .партия *, .партия *::before, .партия *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}

/* ---------- Итог: «Ещё раз» — главная (салатовая), остальные — контурные ---------- */
.окно-итог__причина { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.25; opacity: .85; }
.окно-итог .кнопка:not(.кнопка--главная) {
  background: transparent; background-image: none; box-shadow: none; font-weight: 700;
  color: var(--текст-на-сцене); border: 2px solid rgba(255, 255, 255, .5);
}
.окно-итог .кнопка.кнопка--главная {
  background: var(--сб-акцент); background-image: none; color: var(--сб-акцент-текст); font-weight: 900;
  border: 2px solid var(--сб-акцент); box-shadow: 0 0 0 3px rgba(210, 247, 107, .28);
}
@media (max-height: 640px) { .окно-итог__причина { font-size: 12px; line-height: 1.15; } }

/* ---------- Альбом (телефон на боку): поле слева во всю высоту, панель счёта и кнопок справа ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .партия.экран--виден {
    display: grid; gap: 6px 12px; align-content: stretch;
    grid-template-columns: min(calc(100dvh - 16px - var(--отступ-сверху) - var(--отступ-снизу)), 62%) minmax(0, 1fr);
    grid-template-rows: repeat(5, auto);
  }
  .партия__поле { grid-column: 1; grid-row: 1 / span 5; align-self: center; }
  .партия__верх, .партия__счёт, .партия__низ, .партия__действия, .окно-итог { grid-column: 2; align-self: center; }
  .партия__верх { grid-row: 1; }
  .партия__счёт { grid-row: 2; margin-top: 0; }
  .партия__низ { grid-row: 3; margin-bottom: 0; }
  .партия__действия { grid-row: 4; padding-bottom: 0; }
  .окно-итог { grid-row: 5; margin-bottom: 0; flex: none; padding: 6px 8px 8px; gap: 4px; }
  .партия .поле { width: 100%; max-width: none; }
  .партия--итог .окно-итог { margin-bottom: 0; }
  .окно-итог .итог__кнопки { margin-top: 4px; gap: 8px; }
  .окно-итог__заголовок { font-size: 20px; }
  .окно-итог__счёт { font-size: 28px; }
  .окно-итог__строка { font-size: 14px; }
  .окно-итог .кнопка { min-height: 44px; font-size: 13px; line-height: 1.1; padding: 4px 6px; }
  .окно-итог .кнопка--главная { min-height: 44px; font-size: 15px; }
}
/* 320×568: окно итога с причиной «рекорд не засчитан» помещается над нижним краем (кнопки не обрезаются) */
@media (max-height: 640px) and (orientation: portrait) {
  .окно-итог { gap: 2px; padding: 5px 8px 6px; }
  .окно-итог__заголовок { font-size: 17px; }
  .окно-итог__счёт { font-size: 22px; }
  .окно-итог__строка { font-size: 12px; }
  .окно-итог__причина { font-size: 11px; line-height: 1.1; }
  .окно-итог .итог__кнопки { margin-top: 3px; gap: 8px; }
  .окно-итог .кнопка:not(.кнопка--главная) { font-size: 11px; padding: 2px 2px; }
  .окно-итог .кнопка--главная { flex: 1.1 1 0; }
  .партия--итог .окно-итог { margin-bottom: 4px; }
}
