/* Стенд на форуме: айпад в руках, свет в зале яркий, читать надо с полуметра.
   Отсюда крупный кегль, тёмный фон и одна акцентная краска. */
:root {
  /* Палитра один в один из detect (frontend/src/app/globals.css, тёмная тема):
     стенд и рабочий инструмент должны выглядеть одним продуктом. */
  --bg: oklch(0.21 0.006 285.885);
  --panel: oklch(0.22 0.006 285.885);
  --panel-2: oklch(0.274 0.006 286.033);
  --sidebar: oklch(0.18 0.01 285.823);
  --line: oklch(1 0 0 / 12%);
  --text: oklch(0.985 0 0);
  --muted: oklch(0.705 0.015 286.067);
  --brand: oklch(0.73 0.22 136.75);
  --brand-ink: oklch(0.985 0 0);
  --brand-dim: color-mix(in oklab, oklch(0.73 0.22 136.75), black 35%);
  --warn: oklch(0.8 0.16 82);
  --bad: oklch(0.704 0.191 22.216);
  --radius: 0.65rem;
}

/* Safari до 15.4 не знает oklch — там подставляем ближайшие значения, чтобы
   киоск не остался без цветов на старом айпаде. */
@supports not (color: oklch(0.5 0.1 120)) {
  :root {
    --bg: #27272b;
    --panel: #2a2a2e;
    --panel-2: #37373d;
    --sidebar: #212126;
    --line: rgba(255, 255, 255, 0.12);
    --text: #fafafa;
    --muted: #a8a8b3;
    --brand: #3ac13c;
    --brand-ink: #fafafa;
    --brand-dim: #247a25;
    --warn: #d8a23a;
    --bad: #e8635f;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--sidebar);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Текст на киоске выделять незачем — только мешает попадать по кнопкам. */
  user-select: none;
  overscroll-behavior: none;
}

.app { height: 100%; display: flex; flex-direction: column; }

/* ---------- общее ---------- */

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 18px 22px; gap: 16px; }
.row { display: flex; align-items: center; gap: 14px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.center { align-items: center; justify-content: center; text-align: center; }

h1 { margin: 0; font-size: 40px; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.lead { margin: 0; font-size: 19px; color: var(--muted); max-width: 46ch; }

.btn {
  appearance: none; border: 0; border-radius: 14px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 19px;
  padding: 18px 26px; min-height: 62px;
  background: var(--brand); color: var(--brand-ink);
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
}

/* ---------- главная ---------- */

.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; flex: 1; min-height: 0; }
.game-card { display: flex; flex-direction: column; gap: 14px; }
.game-card .tag {
  align-self: flex-start; font-size: 13px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand);
  background: color-mix(in oklab, var(--brand), transparent 88%);
  border-radius: 999px; padding: 6px 12px;
}
.game-card .actions { display: flex; gap: 12px; margin-top: auto; }
.game-card .actions .btn { flex: 1; }

/* ---------- игра ---------- */

.stage { flex: 1; display: grid; grid-template-columns: 1fr 320px; gap: 20px; min-height: 0; }
/* Ролик хромоты: корова в кадре маленькая и не одна, рамки подписаны мелким
   номером. Поэтому под видео отдаём почти весь экран, а шкалу кладём внизу. */
.stage.tall { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
.stage.tall .scale { flex-direction: row; gap: 10px; }
.stage.tall .opt { flex: 1; flex-direction: column; align-items: flex-start; min-height: 86px; }
.stage.tall .opt .num { flex: 0 0 auto; width: 38px; height: 38px; font-size: 19px; }
.stage.tall .opt .name { font-size: 15px; }
.stage.tall .opt .hint { display: none; }
.stage.tall .side { flex-direction: column; }
.media { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; display: flex; }
.media video, .media img { width: 100%; height: 100%; object-fit: contain; }
.media .controls {
  position: absolute; right: 14px; bottom: 14px; display: flex; gap: 8px;
}
.media .controls button {
  appearance: none; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(0, 0, 0, .65); color: var(--text); font: inherit; font-size: 15px;
  font-weight: 600; padding: 12px 18px; min-height: 48px;
}
.media .controls button.on { background: var(--brand); color: var(--brand-ink); }
.media .badge {
  position: absolute; left: 14px; top: 14px; background: rgba(0,0,0,.72);
  border-radius: 999px; padding: 9px 16px; font-size: 17px; font-weight: 700;
}
.side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.scale { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 16px; padding: 14px 16px; min-height: 68px; cursor: pointer;
  font: inherit; transition: border-color .12s ease, background .12s ease;
}
.opt:active { background: var(--panel-2); }
.opt .num {
  flex: 0 0 44px; height: 44px; border-radius: 12px; background: var(--panel-2);
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
}
.opt .name { font-weight: 600; font-size: 17px; }
.opt .hint { font-size: 13px; color: var(--muted); }
.opt.picked { border-color: var(--brand); background: color-mix(in oklab, var(--brand), transparent 90%); }
.opt.picked .num { background: var(--brand); color: var(--brand-ink); }
.opt.expert { border-color: var(--warn); }
.opt.expert .num { background: var(--warn); color: oklch(0.2 0.04 82); }

.progress { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); transition: width .25s ease; }

/* ---------- разбор ---------- */

.reveal { display: flex; flex-direction: column; gap: 12px; }
.verdicts { display: flex; gap: 10px; }
.verdict-box { flex: 1; text-align: center; border-radius: 14px; padding: 12px 8px; background: var(--panel-2); }
.verdict-box .who { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.verdict-box .val { font-size: 32px; font-weight: 800; line-height: 1.1; }
.verdict-box.me .val { color: var(--brand); }
.verdict-box.expert .val { color: var(--warn); }

/* ---------- итог ---------- */

.result-score { font-size: 92px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.result-score small { font-size: 28px; color: var(--muted); font-weight: 600; }
.headline { font-size: 34px; font-weight: 800; }
.headline.win { color: var(--brand); }
.headline.lose { color: var(--warn); }

.nick {
  font: inherit; font-size: 24px; padding: 16px 18px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  width: 260px; text-align: center;
}

table.board { width: 100%; border-collapse: collapse; font-size: 18px; }
table.board td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.board td:first-child { color: var(--muted); width: 44px; }
table.board td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
table.board tr.me td { color: var(--brand); }

/* ---------- табло ---------- */

.board-screen { display: grid; grid-template-columns: 1.1fr .9fr; gap: 20px; flex: 1; min-height: 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { text-align: center; padding: 18px; }
.tile .big { font-size: 54px; font-weight: 800; line-height: 1; }
.duel-live { display: flex; flex-direction: column; gap: 10px; }
.duel-live .who { display: flex; justify-content: space-between; font-size: 20px; font-weight: 600; }

.wait-dots::after {
  content: ""; display: inline-block; width: 1.2em; text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.fade { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Айпад в портрете: раскладку в две колонки сжимаем в одну. */
@media (max-aspect-ratio: 1/1) {
  .stage, .games, .board-screen { grid-template-columns: 1fr; }
  .media { min-height: 38vh; }
}

/* ---------- стартовый экран ---------- */

.hero {
  position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel);
  padding: 22px 26px; display: flex; flex-direction: column; gap: 10px;
  flex: 0 0 auto;
}
/* Живой фон из настоящего клипа: стенд должен цеплять с трёх метров, а не
   объяснять себя буквами. Видео приглушено, поверх — затемнение под текст. */
.hero video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: .5; filter: saturate(.85);
}
/* Затемнение сильное слева, где текст, и мягкое справа, где видно коровник:
   иначе заголовок спорит с движением на фоне и читается плохо. */
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg,
    color-mix(in oklab, var(--sidebar), transparent 2%) 0%,
    color-mix(in oklab, var(--sidebar), transparent 6%) 38%,
    color-mix(in oklab, var(--sidebar), transparent 45%) 72%,
    color-mix(in oklab, var(--sidebar), transparent 68%) 100%);
}
.hero > * { position: relative; z-index: 1; }
.hero .brand {
  display: inline-flex; align-items: center; gap: 10px; font-size: 15px;
  font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand);
}
.hero .brand::before {
  content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--brand);
  box-shadow: 0 0 0 5px color-mix(in oklab, var(--brand), transparent 82%);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  50% { box-shadow: 0 0 0 11px color-mix(in oklab, var(--brand), transparent 92%); }
}
.hero h1 { font-size: 40px; }
.hero .lead { max-width: 40ch; }
.hero .board-link { position: absolute; top: 18px; right: 20px; z-index: 2; }

.stats { display: flex; gap: 26px; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 13px; color: var(--muted); }

.game-card { position: relative; overflow: hidden; padding: 0; min-height: 0; }
.game-card .shot {
  height: clamp(88px, 15vh, 150px); background: #000; position: relative; display: flex;
}
.game-card .shot video, .game-card .shot img {
  width: 100%; height: 100%; object-fit: cover; opacity: .9;
}
.game-card .shot::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, var(--panel) 100%);
}
.game-card .body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
/* Плашка наезжает на кадр только если кадр есть: иначе она уезжала за
   верхний край карточки и обрезалась. */
.game-card .tag.floating { margin-top: -34px; z-index: 1; }
.game-card .lead {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- смена за 60 секунд ---------- */

.timer { display: flex; align-items: center; gap: 12px; }
.timer .left {
  font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 74px;
}
.timer .bar { flex: 1; height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.timer .bar > div { height: 100%; background: var(--brand); transition: width .95s linear; }
.timer.hurry .left { color: var(--bad); }
.timer.hurry .bar > div { background: var(--bad); }

/* Два больших ответа: на бегу по минуте попасть надо не глядя. */
.shift-answers { display: flex; gap: 14px; }
.shift-answers .btn { flex: 1; min-height: 92px; font-size: 24px; }
.shift-answers .btn.lame { background: var(--warn); color: oklch(0.2 0.04 82); }

/* Вспышка вместо разбора: на таймере читать некогда, нужен мгновенный сигнал. */
.flash {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 92px; font-weight: 800; pointer-events: none;
  animation: flash .45s ease forwards;
}
.flash.ok { background: color-mix(in oklab, var(--brand), transparent 55%); }
.flash.no { background: color-mix(in oklab, var(--bad), transparent 45%); }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.money { display: flex; gap: 24px; flex-wrap: wrap; }
.money div { display: flex; flex-direction: column; }
.money b { font-size: 40px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.money b.bad { color: var(--bad); }
.money span { font-size: 13px; color: var(--muted); }

/* Айпад в альбомной 1024x768 — экран невысокий, и всё должно поместиться без
   прокрутки: киоск, прокручивать никто не станет. Ужимаем по высоте окна. */
@media (max-height: 830px) {
  .screen { padding: 14px 16px; gap: 12px; }
  .hero { padding: 16px 20px; gap: 6px; }
  .hero h1 { font-size: 30px; }
  .hero .lead { display: none; }
  .hero .brand { font-size: 13px; }
  .stats { gap: 18px; }
  .stats b { font-size: 20px; }
  .game-card .shot { height: 78px; }
  .game-card .body { padding: 12px 16px 16px; gap: 8px; }
  .game-card h2 { font-size: 20px; }
  .game-card .lead { font-size: 14px; }
  .btn { min-height: 54px; padding: 14px 18px; font-size: 17px; }
  .opt { min-height: 58px; padding: 10px 14px; }
  .opt .num { flex-basis: 38px; height: 38px; font-size: 19px; }
}
