/* Стиль как в игре «Давай познакомимся»: светлые обои и матовое стекло iOS поверх них. */
:root {
  /* Без этого Chrome и Samsung Internet в тёмной теме сами затемняют светлый сайт. */
  color-scheme: only light;
  --ink: #1c1c1e;
  --muted: rgba(60, 60, 67, 0.72);
  --accent: #ea580c;
  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, 0.2);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, 0.16);
  --warn: #c93400;
  --warn-soft: rgba(255, 149, 0, 0.2);
  /* Края и тени тёмные, а не белые: стекло видно и на белом фоне компании, не только на обоях. */
  --line: rgba(60, 60, 67, 0.14);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-blur: blur(24px) saturate(180%);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 30px rgba(31, 38, 135, 0.14);
  /* Заливка полей как в iOS: серая, поэтому поле видно и на белом. */
  --fill: rgba(118, 118, 128, 0.12);
  --fill-line: rgba(60, 60, 67, 0.2);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  /* Обои меняет скрипт комнаты: готовые или своё фото ведущего. */
  --wallpaper: url("/static/wallpapers/ocean.svg");
  --wallpaper-color: #c4e4f7;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--wallpaper-color) var(--wallpaper) center / cover no-repeat fixed;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2 { letter-spacing: -0.02em; }

/* ---------- стекло ---------- */

.glass, .card, .stage, .player, .login {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius);
}

/* Кнопки как Liquid Glass в iOS 26: прозрачное стекло с размытым фоном под ним,
   ярким бликом сверху и светлой каймой. Тонкий тёмный контур и тень держат форму
   кнопки и на белом фоне компании, где одно стекло растворилось бы. */
button, .btn {
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  /* Прозрачная середина с лёгким тоном: сквозь кнопку видно фон, и она не белеет на светлом.
     Форму дают яркая кайма и блик у верхнего края. */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 38%, rgba(60, 60, 90, 0.06) 100%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.95),
    inset 0 -1px 1px rgba(255, 255, 255, 0.3),
    0 0 0 0.5px rgba(0, 0, 0, 0.14),
    0 6px 18px rgba(31, 38, 135, 0.12);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
button:hover, .btn:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.1) 38%, rgba(60, 60, 90, 0.1) 100%);
}
button:active, .btn:active {
  transform: scale(0.97);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.95), 0 0 0 0.5px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(31, 38, 135, 0.12);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
/* Внутри стеклянной карточки своё размытие кнопке вредно: Chrome даёт ей размывать только
   белую подложку карточки, без обоев, и кнопка белеет. Без него сквозь кнопку видно карточку. */
:is(.card, .stage, .player, .login, .glass) :is(button, .btn) {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
/* Главная кнопка: то же стекло, гуще и с жирной надписью, чтобы выделялась среди соседних. */
button.primary, .btn.primary {
  font-weight: 700;
  /* Главная: то же стекло, тон чуть гуще, чтобы выделялась среди соседних. */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.05) 38%, rgba(40, 40, 70, 0.12) 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 -1px 1px rgba(255, 255, 255, 0.4),
    0 0 0 0.5px rgba(0, 0, 0, 0.18),
    0 8px 22px rgba(31, 38, 135, 0.16);
}
button.primary:hover, .btn.primary:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.12) 38%, rgba(40, 40, 70, 0.16) 100%);
}
button.ok { color: var(--ok); }
button.bad { color: var(--bad); }
button.big, .btn.big { padding: 18px 24px; font-size: 19px; }

/* Поля как в iOS: серая заливка без рамки, скругление; при вводе становятся светлее. */
input, select {
  font: inherit;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--fill);
  color: var(--ink);
  width: 100%;
  transition: background 140ms ease, box-shadow 140ms ease;
}
input::placeholder { color: rgba(60, 60, 67, 0.5); }
input:focus, select:focus { outline: none; background: rgba(255, 255, 255, 0.92); box-shadow: 0 0 0 3px rgba(60, 60, 67, 0.18); }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }

.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.4em; margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.small-link { font-size: 14px; word-break: break-all; color: var(--muted); }


.card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { margin: 0; font-size: 20px; }

/* ---------- вход ---------- */

.login {
  width: calc(100% - 32px);
  max-width: 380px;
  margin: 28vh auto 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- игрок ---------- */

/* Страница игрока помещается в экран телефона целиком и не листается без нужды:
   отступ сверху и снизу внутри высоты экрана, а не сверх неё. */
body.player-page { padding: 16px 0; overscroll-behavior: none; }
.player {
  max-width: 480px;
  /* На телефоне по 16 px от краёв, на широком экране по центру. */
  margin: 0 max(16px, calc((100% - 480px) / 2));
  padding: 24px 20px 28px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.player h1 { font-size: 28px; margin: 4px 0 0; }
.player .item { font-size: 40px; font-weight: 800; color: var(--accent); word-break: break-word; margin: 0; }
.player .item-photo { width: 100%; max-height: 42vh; object-fit: contain; border-radius: 18px; background: rgba(255, 255, 255, 0.6); }
.player .timer { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.player .big-btn { width: 100%; padding: 20px; font-size: 21px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: 0.2em; text-transform: uppercase; }
.status { font-size: 19px; margin: 0; }
.big-label { font-size: 19px; color: var(--ink); margin-bottom: 8px; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.status.warn { color: var(--warn); }

/* ---------- список комнат ---------- */

.admin-page { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.admin-page > header { display: flex; align-items: center; gap: 8px; }
.admin-page > header h1 { flex: 1; margin: 0; font-size: 34px; }
/* Комнаты списком: строка на комнату, кнопки справа. Пустой список не показываем. */
.room-list { list-style: none; margin: 0; padding: 6px 18px; gap: 0; }
.room-list:empty { display: none; }
.room-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex-wrap: wrap; }
.room-row + .room-row { border-top: 1px solid rgba(60, 60, 67, 0.15); }
.room-title { flex: 1 1 200px; font-size: 18px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.room-title .muted { font-size: 14px; }
.room-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.room-actions .btn, .room-actions button { padding: 10px 16px; font-size: 15px; }

/* Окно создания комнаты поверх списка. */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.modal-card { width: 100%; max-width: 820px; background: var(--glass-strong); }
.modal-card > .row:first-child { justify-content: space-between; }
.modal-card > .row:first-child > * { flex: 0 0 auto; }
.modal-card .close { padding: 8px 14px; }


/* Стрелка «назад» к списку комнат: круглая стеклянная кнопка слева от названия. */
.back {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 4px 14px rgba(31, 38, 135, 0.1);
  color: var(--ink);
  text-decoration: none;
  font-size: 22px;
  font-weight: 700;
}
.back:hover { background: rgba(255, 255, 255, 0.85); }

.wallpapers { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-width: 620px; }
.wallpapers button {
  aspect-ratio: 4 / 3;
  padding: 0;
  border-radius: 14px;
  background-size: cover;
  background-position: center;
  border: 2px solid rgba(255, 255, 255, 0.6);
  font-size: 12px;
  align-items: flex-end;
  padding-bottom: 6px;
}
.wallpapers button[aria-pressed="true"] { border-color: var(--ink); }
/* «Своё фото»: пунктирная плитка с плюсом; с выбранным фото показывает его. */
.wallpapers .upload {
  background: rgba(255, 255, 255, 0.45) center / cover no-repeat;
  border-style: dashed;
  border-color: rgba(60, 60, 67, 0.35);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  color: var(--muted);
}
.wallpapers .upload::before { content: "+"; font-size: 26px; font-weight: 300; line-height: 1; }
.wallpapers .upload[aria-pressed="true"] { border-style: solid; border-color: var(--ink); justify-content: flex-end; color: var(--ink); }
.wallpapers .upload[aria-pressed="true"]::before { content: none; }


/* ================= Открой картинку ================= */

:root { --accent-soft: rgba(234, 88, 12, 0.12); }
.big-btn { width: 100%; padding: 18px 24px; font-size: 19px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: 0.2em; text-transform: uppercase; }
.net {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 40;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--bad);
  background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow);
}

/* Аватар: селфи или первая буква имени. */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; background: rgba(120, 120, 128, 0.3);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

/* ---------- телефон игрока ---------- */

.player .kicker { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.player h1 { font-size: 30px; }
.player .lead { font-size: 17px; margin: 0; }

/* Регистрация как в «Давай познакомимся»: круг для селфи, под ним кнопка, затем имя. */
.selfie { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 4px 0 0; cursor: pointer; color: var(--ink); font-size: 16px; }
.selfie-circle {
  position: relative; width: 168px; height: 168px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed var(--accent); background: var(--accent-soft); color: var(--accent);
}
.selfie-circle img { width: 100%; height: 100%; object-fit: cover; }
.selfie-circle svg { width: 56px; height: 56px; }
.selfie-circle.has { border-style: solid; }
.selfie .btn { pointer-events: none; }
.sr-only { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.field-label { display: flex; flex-direction: column; gap: 6px; text-align: left; margin: 0; }
.field-label span { font-size: 15px; font-weight: 600; color: var(--ink); }
.field-label input { font-size: 18px; min-height: 52px; }

.me-tag { display: inline-flex; align-items: center; gap: 10px; align-self: center; padding: 6px 18px 6px 6px; border-radius: 999px; background: var(--glass-strong); box-shadow: var(--glass-shadow); font-weight: 700; font-size: 18px; }
.me-tag .avatar { width: 44px; height: 44px; }

.giant { font-size: clamp(120px, 40vw, 200px); font-weight: 900; color: var(--accent); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }
.giant.pulse { animation: pulse 0.9s ease-out; }
@keyframes pulse { from { transform: scale(1.35); opacity: 0.3; } to { transform: scale(1); opacity: 1; } }

.live-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.live-head .timer { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; }
.live-head .muted { font-size: 15px; }

/* Кнопка тапа: большой стеклянный круг с оранжевой каймой. */
.tap {
  position: relative;
  width: min(74vw, 320px, 48svh); height: min(74vw, 320px, 48svh);
  margin: 8px auto; padding: 0; border-radius: 50%;
  flex-direction: column; gap: 4px;
  border: 3px solid rgba(234, 88, 12, 0.55);
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.55) 45%, rgba(255, 196, 160, 0.55) 100%);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 1),
    inset 0 -10px 30px rgba(234, 88, 12, 0.18),
    0 0 0 10px rgba(255, 255, 255, 0.35),
    0 18px 50px rgba(234, 88, 12, 0.28);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: transform 60ms ease;
}
.tap b { font-size: clamp(60px, 18vw, 88px); font-weight: 900; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.tap span { font-size: 15px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.tap svg { width: 40px; height: 40px; color: var(--accent); }
.tap.hit { transform: scale(0.95); }
.float {
  position: fixed; pointer-events: none; z-index: 5;
  font-weight: 900; font-size: 26px; color: var(--accent);
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.9);
  animation: float 0.7s ease-out forwards;
}
@keyframes float { to { transform: translate(var(--dx), -90px) scale(1.3); opacity: 0; } }

.result-place { font-size: 72px; font-weight: 900; color: var(--accent); line-height: 1; letter-spacing: -0.03em; }
.result-box { padding: 22px; border-radius: 22px; background: var(--fill); display: flex; flex-direction: column; gap: 6px; }
.result-box .score { font-size: 22px; font-weight: 700; }

/* ---------- комнаты ---------- */

.room-row img { width: 84px; height: 56px; object-fit: cover; border-radius: 12px; background: var(--fill); flex: 0 0 auto; }
.room-title .code, .code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.12em; font-weight: 700; color: var(--accent); }
.modal-card { max-width: 560px; }
.modal-card .stack { gap: 14px; }

/* ---------- пульт ---------- */

.host-page { padding: 16px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; max-width: 1200px; margin: 0 auto; align-items: start; }
@media (max-width: 860px) { .host-page { grid-template-columns: 1fr; } }
.host-page .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.room-head { display: flex; align-items: center; gap: 12px; }
.room-head h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.phase-pill { font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats div { padding: 12px; border-radius: 16px; background: var(--fill); }
.stats strong { display: block; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }
.host-image { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 16px; background: var(--fill); }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.player-list { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow: auto; }
.player-list li { display: grid; grid-template-columns: 24px 36px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; font-size: 15px; }
.player-list li + li { border-top: 1px solid rgba(60, 60, 67, 0.12); }
.player-list .avatar { width: 36px; height: 36px; font-size: 15px; }
.player-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-list .off { opacity: 0.45; }
.player-list button { padding: 6px 12px; font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: rgba(120, 120, 128, 0.4); margin-right: 4px; }
.dot.on { background: #34c759; }

/* ---------- экран для зала ---------- */

.screen-page { height: 100vh; height: 100dvh; overflow: hidden; }
.screen { position: relative; height: 100vh; height: 100dvh; padding: 2.4vh 2.4vw; display: flex; flex-direction: column; gap: 2vh; }
.screen-top { display: flex; align-items: center; gap: 1vw; position: relative; z-index: 4; }
.screen-top .pill { font-size: clamp(16px, 2.1vh, 30px); font-weight: 700; padding: 1vh 2vh; border-radius: 999px; }
.screen-top .grow { flex: 1; }
.screen-top button { padding: 1vh 2vh; font-size: clamp(13px, 1.6vh, 20px); background: var(--glass-strong); }
.screen-body { flex: 1; min-height: 0; position: relative; }
.stage { height: 100%; border-radius: 36px; padding: 4vh 3vw; }

/* Ожидание: QR слева, справа название, счётчик и имена. */
.lobby { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4vw; align-items: center; }
.lobby .qr-box { background: #fff; border-radius: 32px; padding: 2.4vh; box-shadow: 0 16px 50px rgba(31, 38, 135, 0.2); text-align: center; }
.lobby .qr-box img { width: min(56vh, 38vw); display: block; }
.lobby .qr-box .code { font-size: 4.4vh; margin-top: 1vh; }
.lobby .link { font-size: 2.2vh; font-weight: 700; color: var(--muted); margin-top: 0.4vh; }
.lobby h1 { font-size: clamp(40px, 8vh, 110px); font-weight: 800; margin: 0; line-height: 1.02; letter-spacing: -0.03em; }
.lobby h1 em { font-style: normal; color: var(--accent); }
.lobby .lead { font-size: 2.6vh; color: var(--muted); margin: 2vh 0 0; max-width: 34ch; font-weight: 500; }
.count-line { display: flex; align-items: baseline; gap: 1.4vh; margin-top: 3.4vh; }
.count-line strong { font-size: 11vh; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.count-line span { font-size: 2.6vh; font-weight: 600; color: var(--muted); }
.names { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 1vh; margin-top: 2.6vh; flex: 1; min-height: 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent); mask-image: linear-gradient(180deg, #000 70%, transparent); }
.chip { display: inline-flex; align-items: center; gap: 0.8vh; padding: 0.5vh 1.6vh 0.5vh 0.5vh; border-radius: 999px; background: rgba(255, 255, 255, 0.7); box-shadow: 0 2px 10px rgba(31, 38, 135, 0.1); font-size: 2.1vh; font-weight: 600; animation: chip-in 0.5s cubic-bezier(.3, .8, .3, 1.3); }
.chip .avatar { width: 3.6vh; height: 3.6vh; font-size: 1.7vh; box-shadow: none; }
@keyframes chip-in { from { transform: scale(0.4); opacity: 0; } }

/* Игра: сверху машина заливается цветом, под ней карточки игроков рядами. */
.arena { position: relative; display: block; padding: 0; overflow: hidden; transition: background 1s, box-shadow 1s, border-color 1s; }
.car-zone {
  position: absolute; left: 0; right: 0; top: 0; height: 46%;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3.2fr) minmax(0, 1fr); align-items: center; gap: 2vw;
  padding: 2.4vh 2.4vw 0; transition: opacity 0.8s, transform 0.9s cubic-bezier(.5, 0, .7, .4);
}
.car-side { display: flex; flex-direction: column; gap: 1.4vh; align-items: flex-start; }
.car-side.right { align-items: flex-end; text-align: right; }
.car-wrap { position: relative; height: 100%; min-height: 0; }
.car-canvas { width: 100%; height: 100%; display: block; }
.car-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, #fff 0%, rgba(255, 255, 255, 0.6) 35%, rgba(255, 255, 255, 0) 70%); }
.car-flash.go { animation: flash 1.4s ease-out; }
@keyframes flash { 0% { opacity: 1; transform: scale(0.8); } 100% { opacity: 0; transform: scale(1.4); } }
.meter { padding: 1.4vh 2.2vh; border-radius: 22px; background: rgba(255, 255, 255, 0.6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 20px rgba(31, 38, 135, 0.08); min-width: 18vh; }
.meter strong { display: block; font-size: 6.4vh; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.meter span { font-size: 1.8vh; font-weight: 600; color: var(--muted); }
.meter.timer strong { color: var(--accent); font-size: 8vh; }
.meter.timer.hurry strong { animation: hurry 0.5s infinite alternate; }
@keyframes hurry { to { color: var(--bad); transform: scale(1.06); } }
.countdown-overlay { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; }
.countdown-overlay .giant { font-size: 38vh; text-shadow: 0 10px 40px rgba(255, 255, 255, 0.9); }

/* Размер карточки анимируется вместе с шириной, иначе текст прыгает раньше рамки. */
@property --w { syntax: '<length>'; inherits: true; initial-value: 120px; }

/* Карточка игрока: фото, место, имя, счётчик-барабан. Размер шрифта от ширины карточки. */
.cards { position: absolute; inset: 0; pointer-events: none; }
.pc {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: calc(var(--w) * 0.04);
  padding: calc(var(--w) * 0.06); padding-bottom: calc(var(--w) * 0.05);
  border-radius: calc(var(--w) * 0.12);
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 1px 0 #fff, 0 8px 24px rgba(31, 38, 135, 0.14);
  transition: left 0.7s cubic-bezier(.3, .8, .3, 1), top 0.7s cubic-bezier(.3, .8, .3, 1), width 0.7s cubic-bezier(.3, .8, .3, 1), --w 0.7s cubic-bezier(.3, .8, .3, 1),
    transform 1.1s cubic-bezier(.5, 0, .7, .4), opacity 0.9s, filter 0.4s, background 0.4s;
  will-change: left, top, transform;
}
.pc.entering { opacity: 0; transform: scale(0.6); transition: none; }
.pc.leaving { opacity: 0; transform: scale(0.6); }
.pc-photo { position: relative; width: 100%; aspect-ratio: 1; border-radius: calc(var(--w) * 0.09); overflow: hidden; background: var(--fill); }
.pc-photo img, .pc-initial { width: 100%; height: 100%; object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: calc(var(--w) * 0.42); font-weight: 900; color: #fff; }
.pc-rank {
  position: absolute; top: calc(var(--w) * 0.04); left: calc(var(--w) * 0.04);
  min-width: calc(var(--w) * 0.2); height: calc(var(--w) * 0.2); padding: 0 calc(var(--w) * 0.04);
  display: flex; align-items: center; justify-content: center; border-radius: 999px;
  font-size: calc(var(--w) * 0.11); font-weight: 900; color: var(--ink);
  background: rgba(255, 255, 255, 0.88); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.pc-name { width: 100%; text-align: center; font-weight: 700; font-size: calc(var(--w) * 0.11); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.pc-score { font-weight: 900; font-size: calc(var(--w) * 0.2); line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.pc.leader { background: linear-gradient(180deg, rgba(255, 236, 160, 0.95), rgba(255, 255, 255, 0.8)); }
.pc.leader .pc-rank { background: #ffd36b; }
.pc.leader .pc-score { color: var(--accent); }
.pc.bump .pc-score { animation: bump 0.35s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--accent); } }

/* Финал: зал «гаснет», на тёмном фоне фейерверк, поверх стеклянные карточки и пьедестал. */
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 2; pointer-events: none; }
.night { position: fixed; inset: 0; z-index: 1; pointer-events: none; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.2s ease; }
.night::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 30%, rgba(30, 30, 70, 0.6), rgba(8, 10, 28, 0.9)); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.night.on { opacity: 1; }
.arena.final { z-index: 3; background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.arena.final .car-zone { opacity: 0; transform: translateY(-60%) scale(0.7); pointer-events: none; }
.final-title {
  position: absolute; left: 0; right: 0; top: 2vh; margin: 0; z-index: 2; text-align: center;
  font-size: 7vh; font-weight: 900; letter-spacing: -0.03em; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(-4vh); transition: opacity 0.7s, transform 0.7s cubic-bezier(.3, .8, .3, 1.2);
}
.final-title em { font-style: normal; color: #ffc46b; }
.arena.final .final-title { opacity: 1; transform: none; }
.pc.gray { filter: grayscale(1) brightness(0.85); background: rgba(190, 190, 200, 0.6); }
.pc.gray .pc-score, .pc.gray .pc-name { color: rgba(60, 60, 67, 0.65); }
/* Вылет: карточка приподнимается и плавно уплывает по дуге за ближний край, поворачиваясь и растворяясь. */
.pc.fly-left { animation: fly-left 1.4s cubic-bezier(.45, 0, .25, 1) forwards; }
.pc.fly-right { animation: fly-right 1.4s cubic-bezier(.45, 0, .25, 1) forwards; }
@keyframes fly-left {
  0% { transform: none; }
  18% { transform: translateY(-2.5vh) scale(1.06); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35); }
  100% { transform: translate(-115vw, -22vh) rotate(-20deg) scale(0.7); opacity: 0; }
}
@keyframes fly-right {
  0% { transform: none; }
  18% { transform: translateY(-2.5vh) scale(1.06); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35); }
  100% { transform: translate(115vw, -22vh) rotate(20deg) scale(0.7); opacity: 0; }
}

/* Пьедестал: ступени из цветного стекла, на них встают карточки троих лучших. */
.steps { position: absolute; inset: 0; pointer-events: none; }
.pstep {
  position: absolute; bottom: 0; display: flex; justify-content: center; align-items: center;
  border-radius: 24px 24px 0 0; border: 1px solid rgba(255, 255, 255, 0.6); border-bottom: 0;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -10px 40px rgba(0, 0, 0, 0.2);
  font-size: 6vh; line-height: 1; font-weight: 900; color: rgba(28, 28, 30, 0.75);
  transform-origin: bottom; animation: rise 0.9s backwards cubic-bezier(.3, .8, .3, 1);
}
@keyframes rise { from { transform: scaleY(0); } }
.pstep.p1 { background: linear-gradient(180deg, rgba(255, 228, 120, 0.92), rgba(245, 180, 0, 0.55)); }
.pstep.p2 { background: linear-gradient(180deg, rgba(240, 244, 250, 0.92), rgba(180, 192, 210, 0.6)); }
.pstep.p3 { background: linear-gradient(180deg, rgba(250, 210, 170, 0.92), rgba(205, 127, 50, 0.55)); }
.pc.on-podium { z-index: 2; box-shadow: inset 0 1px 0 #fff, 0 20px 50px rgba(0, 0, 0, 0.45); }
.pc.on-podium.p1 { background: linear-gradient(180deg, rgba(255, 236, 160, 0.97), rgba(255, 255, 255, 0.88)); }
.pc .crown { position: absolute; top: calc(var(--w) * -0.3); left: 50%; transform: translateX(-50%); font-size: calc(var(--w) * 0.3); line-height: 1; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); animation: crown 2.4s ease-in-out infinite; }
@keyframes crown { 50% { transform: translateX(-50%) translateY(-8%) rotate(-6deg); } }

@media (prefers-reduced-motion: reduce) {
  .pc { transition-duration: 0.01s; }
}

@media (max-width: 560px) {
  .admin-page > header { flex-wrap: wrap; }
  .admin-page > header h1 { flex: 1 1 100%; }
  .admin-page > header button { flex: 1 1 auto; }
}

/* Номер места на карточке не показываем: места видно по пьедесталу. */
.pc-rank { display: none; }

.pc.fly-left, .pc.fly-right { z-index: 3; }

/* Правая колонка лобби по высоте экрана: имена, которые не влезли, плавно гаснут внизу, а не уходят за край. */
.lobby { overflow: hidden; }
.lobby > div:last-child { height: 100%; min-height: 0; display: flex; flex-direction: column; justify-content: center; }
.lobby > div:last-child .names { max-height: 32vh; }

/* Кнопка «на весь экран» — круглая стеклянная иконка. */
.screen-top .icon-btn { width: 5vh; height: 5vh; min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.screen-top .icon-btn svg { width: 50%; height: 50%; }

/* Лобби: справа заголовок, три шага в стеклянных карточках, счётчик и имена. */
.lobby-info { min-width: 0; }
.lobby-kicker { margin: 0 0 1.2vh; font-size: 2vh; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.lobby-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.4vh; margin-top: 3vh; }
.lobby-step { display: flex; align-items: center; gap: 1.4vh; padding: 1.6vh 1.8vh; border-radius: 22px; background: rgba(255, 255, 255, 0.62); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 20px rgba(31, 38, 135, 0.08); }
.lobby-step-n { flex: 0 0 auto; width: 5vh; height: 5vh; border-radius: 50%; display: grid; place-items: center; font-size: 2.6vh; font-weight: 900; color: #fff; background: linear-gradient(180deg, #fb923c, #ea580c); box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35); }
.lobby-step strong { display: block; font-size: 2.3vh; font-weight: 800; line-height: 1.15; }
.lobby-step div span { display: block; font-size: 1.7vh; color: var(--muted); font-weight: 500; line-height: 1.25; margin-top: 0.3vh; }
.lobby .count-line { margin-top: 3vh; }

/* «ТАПАЙ!» на старте раунда на экране зала. */
.countdown-overlay .giant.go { font-size: 22vh; letter-spacing: -0.02em; animation: go-pop 1.4s cubic-bezier(.3, .8, .3, 1.2) forwards; }
@keyframes go-pop { 0% { transform: scale(0.4); opacity: 0; } 25% { transform: scale(1.08); opacity: 1; } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }

/* Победитель на телефоне: весь экран светится цветом места и мягко пульсирует. */
body.win-1 { --medal: 255, 196, 40; }
body.win-2 { --medal: 176, 190, 212; }
body.win-3 { --medal: 222, 128, 58; }
body.win::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 50% 38%, rgba(var(--medal), 0.95) 0%, rgba(var(--medal), 0.55) 40%, rgba(var(--medal), 0.25) 100%);
  animation: win-glow 1.6s ease-in-out infinite alternate;
}
@keyframes win-glow { from { opacity: 0.75; } to { opacity: 1; } }
body.win .player { position: relative; z-index: 1; box-shadow: 0 0 0 3px rgba(var(--medal), 0.9), 0 0 60px rgba(var(--medal), 0.9), var(--glass-shadow); }
body.win .result-box { background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 2px rgba(var(--medal), 0.9); }
body.win .result-place { color: rgb(var(--medal)); filter: brightness(0.8) saturate(1.4); }
.medal { font-size: 96px; line-height: 1; animation: medal-in 0.9s cubic-bezier(.3, .8, .3, 1.4), medal-swing 2.4s 0.9s ease-in-out infinite; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.25)); }
@keyframes medal-in { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } }
@keyframes medal-swing { 50% { transform: rotate(-8deg) translateY(-4px); } }

/* Телефон: фейерверк между светящимся фоном и карточкой; на победном экране только медаль и место. */
.player-page #fx { z-index: 0; }
.player-page .player { position: relative; z-index: 1; }
.player .result-place { font-size: 64px; }
body.win .player { background: rgba(255, 255, 255, 0.35); }
body.win .result-place { font-size: 72px; }
body.win .medal { font-size: 120px; }

/* Победный экран на телефоне — по центру по высоте. */
body.win .player { min-height: calc(100dvh - 32px); justify-content: center; }

/* Победители досчитали: карточка мягко пульсирует и светится золотом. */
.pc.pulse { animation: winner-pulse 1.1s ease-in-out infinite; }
@keyframes winner-pulse {
  0%, 100% { transform: scale(1); box-shadow: inset 0 1px 0 #fff, 0 10px 30px rgba(31, 38, 135, 0.2), 0 0 0 0 rgba(255, 200, 60, 0); }
  50% { transform: scale(1.06); box-shadow: inset 0 1px 0 #fff, 0 16px 44px rgba(0, 0, 0, 0.3), 0 0 36px 6px rgba(255, 200, 60, 0.75); }
}

/* Постепенный пьедестал. Ступень, которую просто перерисовали (ресайз, открыли на итогах), не растёт заново. */
.pstep.still { animation: none; }
/* «Бах»: карточка опускается на ступень, чуть сплющивается и отскакивает, потом пульсирует. */
.pc.landing { animation: land 0.7s cubic-bezier(.3, .8, .3, 1.4), winner-pulse 1.1s 0.7s ease-in-out infinite; }
@keyframes land {
  0% { transform: scale(1); }
  55% { transform: scale(1.12, 0.9); }
  100% { transform: scale(1); }
}
/* Золото опускается медленно и мягко. */
.pc.descend {
  transition: left 0.9s cubic-bezier(.3, .8, .3, 1), top 1.6s cubic-bezier(.2, .75, .25, 1), width 0.9s cubic-bezier(.3, .8, .3, 1), --w 0.9s cubic-bezier(.3, .8, .3, 1);
  box-shadow: inset 0 1px 0 #fff, 0 0 60px 12px rgba(255, 210, 80, 0.8), 0 24px 60px rgba(0, 0, 0, 0.45);
}

/* Свечение по цвету места и медленный, спокойный пульс. */
.pc { --glow: 255, 200, 60; }
.pc.on-podium.p1 { --glow: 255, 200, 60; }
.pc.on-podium.p2 { --glow: 205, 215, 232; background: linear-gradient(180deg, rgba(236, 241, 248, 0.97), rgba(255, 255, 255, 0.85)); }
.pc.on-podium.p3 { --glow: 230, 140, 70; background: linear-gradient(180deg, rgba(250, 218, 190, 0.97), rgba(255, 255, 255, 0.85)); }
.pc.pulse { animation: winner-pulse 2.4s ease-in-out infinite; }
.pc.landing { animation: land 0.7s cubic-bezier(.3, .8, .3, 1.4), winner-pulse 2.4s 0.7s ease-in-out infinite; }
@keyframes winner-pulse {
  0%, 100% { transform: scale(1); box-shadow: inset 0 1px 0 #fff, 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 18px 2px rgba(var(--glow), 0.45); }
  50% { transform: scale(1.04); box-shadow: inset 0 1px 0 #fff, 0 16px 44px rgba(0, 0, 0, 0.3), 0 0 46px 10px rgba(var(--glow), 0.85); }
}
.pc.descend { box-shadow: inset 0 1px 0 #fff, 0 0 60px 12px rgba(var(--glow), 0.85), 0 24px 60px rgba(0, 0, 0, 0.45); }

/* Во время финального счёта никого не выделяем цветом. */
.arena.final .pc:not(.on-podium) { background: rgba(255, 255, 255, 0.72); }
.arena.final .pc:not(.on-podium) .pc-score { color: var(--ink); }

/* Каждое прибавление цифры: карточка коротко «вздрагивает» и вспыхивает тёплым светом. */
.arena.final .pc.tick:not(.gray):not(.on-podium):not(.descend) { animation: tick 0.42s ease-out; }
@keyframes tick {
  0% { transform: scale(1); box-shadow: inset 0 1px 0 #fff, 0 8px 24px rgba(31, 38, 135, 0.14), 0 0 0 0 rgba(255, 210, 90, 0); }
  35% { transform: scale(1.05); box-shadow: inset 0 1px 0 #fff, 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 32px 6px rgba(255, 210, 90, 0.75); }
  100% { transform: scale(1); box-shadow: inset 0 1px 0 #fff, 0 8px 24px rgba(31, 38, 135, 0.14), 0 0 0 0 rgba(255, 210, 90, 0); }
}

/* В финале те, кто ещё считает, всегда поверх ступеней и уже вставших на пьедестал. */
.arena.final .pc:not(.on-podium) { z-index: 5; }
.arena.final .final-title { z-index: 6; }

/* ================= Сцена с машиной ================= */

/* Машина стоит в своей рамке: по ней расставлены инженеры. В обычных обоях рамка занимает всё место. */
.car-scene { position: relative; width: 100%; height: 100%; }
.car-scene .car-canvas { position: relative; z-index: 1; }
.crew, .repair-bar { display: none; }

/* ================= Оформление OMODA =================
   Включается обоями «OMODA» (html[data-look="omoda"]): тёмный гараж, графитовое стекло,
   красный акцент с кузова C5, шрифт Noto Sans, инженеры вокруг машины. */

@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/noto-sans-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Noto Sans"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("/static/fonts/noto-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html[data-look="omoda"] {
  color-scheme: only dark;
  --carbon: #0c0c0b;
  --graphite: #30363a;
  --glacier: #a6b7be;
  --mist: #f4f5f5;
  --crimson: #b3121f;
  --crimson-hi: #e0404b;
  --ink: #f4f5f5;
  --muted: #c3cfd4;
  --accent: #e0404b;
  --accent-soft: rgba(179, 18, 31, 0.22);
  --ok: #6fdc8c;
  --bad: #ff7b86;
  --warn: #ffb86b;
  --line: rgba(166, 183, 190, 0.3);
  --glass: linear-gradient(160deg, rgba(48, 54, 58, 0.82), rgba(12, 12, 11, 0.82));
  --glass-strong: rgba(21, 24, 26, 0.94);
  --glass-blur: blur(10px);
  --glass-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  --fill: rgba(166, 183, 190, 0.14);
  --fill-line: rgba(166, 183, 190, 0.3);
  --font: "Noto Sans", Arial, Helvetica, sans-serif;
  --dark-panel: rgba(48, 54, 58, 0.78);
  --dark-edge: rgba(166, 183, 190, 0.28);
  --on-light: #1c1c1e;
}
html[data-look="omoda"] :is(h1, h2) { letter-spacing: 0; }

/* Кнопки и поля: графит вместо белого стекла, главная кнопка красная. */
html[data-look="omoda"] :is(button, .btn) {
  border-color: var(--dark-edge);
  background: var(--dark-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.35);
}
html[data-look="omoda"] :is(button, .btn):hover { background: rgba(70, 78, 84, 0.85); }
html[data-look="omoda"] :is(button.primary, .btn.primary) {
  border-color: var(--crimson-hi);
  background: linear-gradient(160deg, var(--crimson-hi), var(--crimson));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 26px rgba(179, 18, 31, 0.5);
}
html[data-look="omoda"] :is(button.primary, .btn.primary):hover { background: linear-gradient(160deg, #ea5560, #c41a28); }
html[data-look="omoda"] input::placeholder { color: rgba(195, 207, 212, 0.6); }
html[data-look="omoda"] :is(input, select):focus { background: rgba(166, 183, 190, 0.22); box-shadow: 0 0 0 3px rgba(224, 64, 75, 0.45); }
html[data-look="omoda"] .back { background: var(--dark-panel); box-shadow: none; }
html[data-look="omoda"] .back:hover { background: rgba(70, 78, 84, 0.85); }
html[data-look="omoda"] .modal { background: rgba(12, 12, 11, 0.6); }
html[data-look="omoda"] .wallpapers button { color: var(--on-light); border-color: var(--dark-edge); background-color: transparent; }
html[data-look="omoda"] .wallpapers button:first-child { color: var(--mist); }
html[data-look="omoda"] .wallpapers button[aria-pressed="true"] { border-color: var(--crimson-hi); }
html[data-look="omoda"] :is(.room-row + .room-row, .player-list li + li) { border-top-color: var(--line); }
html[data-look="omoda"] .avatar { box-shadow: 0 0 0 2px var(--mist); }

/* Телефон игрока. */
/* :hover тоже: на телефоне он залипает после касания и иначе перекрасил бы кнопку в серый. */
html[data-look="omoda"] :is(.tap, .tap:hover) {
  border-color: var(--crimson-hi);
  background: radial-gradient(circle at 35% 28%, #f0626c, var(--crimson) 55%, #5a0810 100%);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.35), inset 0 -14px 34px rgba(0, 0, 0, 0.35),
    0 0 0 10px rgba(179, 18, 31, 0.22), 0 18px 60px rgba(224, 64, 75, 0.55);
}
html[data-look="omoda"] .tap :is(b, span, svg) { color: var(--mist); }
html[data-look="omoda"] .float { color: var(--mist); text-shadow: 0 2px 10px rgba(224, 64, 75, 0.9); }
html[data-look="omoda"] .player .item-photo { background: var(--fill); }
html[data-look="omoda"] body.win .player { background: rgba(12, 12, 11, 0.72); }
html[data-look="omoda"] body.win .result-box { background: var(--dark-panel); }
html[data-look="omoda"] body.win .result-place { filter: none; }

/* Экран зала: лобби. */
html[data-look="omoda"] .lobby h1 { font-weight: 300; letter-spacing: 0; }
html[data-look="omoda"] .lobby h1 em { font-weight: 700; color: var(--crimson-hi); }
html[data-look="omoda"] .lobby .qr-box { box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--dark-edge); }
html[data-look="omoda"] .lobby .link { color: var(--graphite); }
html[data-look="omoda"] .count-line strong { color: var(--mist); }
html[data-look="omoda"] :is(.chip, .lobby-step) { background: var(--dark-panel); border: 1px solid var(--dark-edge); box-shadow: none; }
html[data-look="omoda"] .lobby-step-n { background: linear-gradient(160deg, var(--crimson-hi), var(--crimson)); box-shadow: 0 4px 14px rgba(179, 18, 31, 0.5); }

/* Экран зала: игра. Плашки из графитового стекла, цифры белые, таймер без оранжевого. */
html[data-look="omoda"] .arena { background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-look="omoda"] .meter {
  background: var(--glass); border: 1px solid var(--dark-edge); box-shadow: none;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
html[data-look="omoda"] .meter strong { font-weight: 800; letter-spacing: 0; }
html[data-look="omoda"] .meter span { font-size: 2.1vh; font-weight: 700; }
html[data-look="omoda"] .meter.timer strong { color: var(--mist); }
html[data-look="omoda"] .repair-bar { display: block; position: relative; height: 1.4vh; margin-top: 1vh; border-radius: 1vh; overflow: hidden; background: rgba(166, 183, 190, 0.18); }
html[data-look="omoda"] .repair-bar i {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: inherit; transition: width 0.4s linear;
  background: linear-gradient(90deg, var(--crimson), var(--crimson-hi) 75%, #ff7b86); box-shadow: 0 0 1.4vh rgba(224, 64, 75, 0.8);
}
html[data-look="omoda"] .countdown-overlay .giant { color: var(--mist); text-shadow: 0 0 60px rgba(224, 64, 75, 0.95), 0 10px 40px rgba(0, 0, 0, 0.8); }
html[data-look="omoda"] .car-flash { background: radial-gradient(ellipse at center, #fff 0%, rgba(255, 123, 134, 0.6) 35%, rgba(224, 64, 75, 0) 70%); }

/* Машина по центру своей зоны, вокруг неё инженеры. Места заданы в долях рамки машины. */
html[data-look="omoda"] .car-wrap { display: grid; place-items: center; }
html[data-look="omoda"] .car-scene { width: auto; height: 78%; max-width: 100%; aspect-ratio: 1739 / 828; }
html[data-look="omoda"] .car-scene::before {
  content: ""; position: absolute; left: 4%; right: 4%; bottom: -9%; height: 22%; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(179, 18, 31, 0.5), rgba(179, 18, 31, 0) 70%);
}
html[data-look="omoda"] .crew { display: block; position: absolute; height: auto; pointer-events: none; z-index: 2; }
html[data-look="omoda"] .crew-creeper { left: 21%; bottom: -10%; width: 31%; z-index: 0; }
html[data-look="omoda"] .crew-wrench { left: -17%; bottom: -8%; width: 24%; }
html[data-look="omoda"] .crew-tyre { left: 93%; bottom: -8%; width: 20%; }
html[data-look="omoda"] .crew-tablet { left: 7%; bottom: 50%; width: 13%; }
html[data-look="omoda"] .crew-oil { left: 59%; bottom: 76%; width: 14%; }
/* До старта инженеры покачиваются. В раунде стучат по машине: двое по бокам бьют ключом и колесом,
   двое на капоте и крыше прыгают, механик под днищем ездит туда-сюда. В месте удара вспыхивает искра
   с тем же ритмом, что и у её инженера. */
html[data-look="omoda"] .crew { transform-origin: 50% 92%; --t: 0.7s; --d: 0s; }
html[data-look="omoda"] .crew-wrench { --t: 0.62s; --lean: 1; }
html[data-look="omoda"] .crew-tyre { --t: 0.78s; --d: 0.21s; --lean: -1; }
html[data-look="omoda"] .crew-tablet { --t: 0.7s; --d: 0.1s; }
html[data-look="omoda"] .crew-oil { --t: 0.86s; --d: 0.37s; }
html[data-look="omoda"] .crew-creeper { --t: 1.3s; }
html[data-look="omoda"] .spark {
  display: block; position: absolute; z-index: 3; width: 7%; aspect-ratio: 1; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, #fff 0 16%, #ffd27a 30%, rgba(224, 64, 75, 0.7) 48%, rgba(224, 64, 75, 0) 70%);
}
.spark { display: none; }
html[data-look="omoda"] .spark-wrench { left: 4%; bottom: 20%; --t: 0.62s; --d: 0s; }
html[data-look="omoda"] .spark-tyre { left: 89%; bottom: 14%; --t: 0.78s; --d: 0.21s; }
html[data-look="omoda"] .spark-tablet { left: 10%; bottom: 46%; --t: 0.7s; --d: 0.1s; }
html[data-look="omoda"] .spark-oil { left: 62.5%; bottom: 73%; --t: 0.86s; --d: 0.37s; }
@media (prefers-reduced-motion: no-preference) {
  html[data-look="omoda"] .crew { animation: crew-bob 2s ease-in-out infinite var(--d); }
  html[data-look="omoda"] .working :is(.crew-wrench, .crew-tyre) { animation: crew-knock var(--t) ease-in infinite var(--d); }
  html[data-look="omoda"] .working :is(.crew-tablet, .crew-oil) { animation: crew-stomp var(--t) ease-in infinite var(--d); }
  html[data-look="omoda"] .working .crew-creeper { animation: crew-slide var(--t) ease-in-out infinite; }
  html[data-look="omoda"] .working .spark { animation: crew-spark var(--t) linear infinite var(--d); }
  html[data-look="omoda"] .working .car-canvas { animation: car-shake 0.31s linear infinite; }
}
@keyframes crew-bob { 50% { transform: translateY(-4%); } }
/* Замах от машины, удар к машине, отдача. --lean: 1 — машина справа от инженера, -1 — слева. */
@keyframes crew-knock {
  0%, 100% { transform: rotate(0deg); }
  38% { transform: rotate(calc(var(--lean) * -13deg)) translateX(calc(var(--lean) * -4%)); }
  52% { transform: rotate(calc(var(--lean) * 15deg)) translateX(calc(var(--lean) * 9%)); }
  66% { transform: rotate(calc(var(--lean) * 4deg)); }
}
@keyframes crew-stomp {
  0%, 100% { transform: translateY(0) scale(1); }
  36% { transform: translateY(-22%) scale(1.03, 0.98); }
  52% { transform: translateY(2%) scale(1.08, 0.88); }
  68% { transform: translateY(-3%) scale(1); }
}
@keyframes crew-slide { 50% { transform: translateX(-9%); } }
@keyframes crew-spark {
  0%, 46% { opacity: 0; transform: scale(0.3); }
  52% { opacity: 1; transform: scale(1.25); }
  72%, 100% { opacity: 0; transform: scale(1.7); }
}
@keyframes car-shake { 25% { transform: translate(0.25%, -0.4%); } 75% { transform: translate(-0.25%, 0.3%); } }

/* Карточки игроков: графит, лидер подсвечен красным. */
html[data-look="omoda"] .pc { background: var(--dark-panel); border-color: var(--dark-edge); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
html[data-look="omoda"] .pc-score { font-weight: 800; }
html[data-look="omoda"] .pc.leader { background: linear-gradient(160deg, rgba(179, 18, 31, 0.9), rgba(90, 8, 16, 0.92)); border-color: var(--crimson-hi); box-shadow: 0 0 28px rgba(179, 18, 31, 0.6); }
html[data-look="omoda"] .pc.leader .pc-score { color: var(--mist); }
html[data-look="omoda"] .pc.bump .pc-score { animation-name: bump-omoda; }
@keyframes bump-omoda { 40% { transform: scale(1.18); color: #ff7b86; } }

/* Финал: считающие карточки остаются графитовыми, призёры на светлом металле с тёмным текстом. */
html[data-look="omoda"] .night::after { background: radial-gradient(ellipse at 50% 30%, rgba(48, 54, 58, 0.55), rgba(12, 12, 11, 0.94)); }
html[data-look="omoda"] .final-title { font-weight: 800; letter-spacing: 0; }
html[data-look="omoda"] .final-title em { color: var(--crimson-hi); }
html[data-look="omoda"] .arena.final .pc:not(.on-podium) { background: var(--dark-panel); }
html[data-look="omoda"] .arena.final .pc:not(.on-podium) .pc-score { color: var(--mist); }
html[data-look="omoda"] .pc.gray { background: rgba(48, 54, 58, 0.5); }
html[data-look="omoda"] .pc.gray :is(.pc-score, .pc-name) { color: rgba(195, 207, 212, 0.6); }
html[data-look="omoda"] .pc.on-podium :is(.pc-name, .pc-score) { color: var(--on-light); }

/* Детали от нажатий зала: летят от карточек игроков в машину. Место и путь задаёт скрипт. */
.part {
  position: absolute; left: 0; top: 0; z-index: 4; width: 3.4vh; height: 3.4vh; margin: -1.7vh 0 0 -1.7vh;
  pointer-events: none; color: var(--glacier, #a6b7be); filter: drop-shadow(0 0 0.8vh rgba(207, 244, 255, 0.75)); will-change: transform, opacity;
}
.part svg { width: 100%; height: 100%; display: block; }
