/* Pilikun — лэндинг.
   Язык самой игры: жёлтый экран на всю страницу (фон её роликов, #ffd400),
   почти чёрные чернила #080202, кнопки как в меню — чёрная «Start» и жёлтая
   потемнее (#efb506) для остальных, шрифт Golos Text, как в приложении: Black
   для отсчёта и заголовков. Красный — только падение, как экран игры.
   При загрузке страница один раз встряхивается, как телефон в руке; при
   «уменьшении движения» — нет. Прокрутку страница не перехватывает. */

:root {
  --yellow: #ffd400;
  --ink: #080202;
  --ink-2: rgb(8 2 2 / 72%);
  --ink-3: rgb(8 2 2 / 52%);
  --button: #efb506;
  --line: rgb(8 2 2 / 16%);
  --red: #f01a0a;
  --pad: clamp(20px, 4.4vw, 72px);
  --max: 1320px;
  --sans: "Golos Text", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .7, .15, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--yellow); color: var(--ink); font: 400 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img, video, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
figure { margin: 0; }
::selection { background: var(--ink); color: var(--yellow); }

.wrap { max-width: calc(var(--max) + 2 * var(--pad)); margin: 0 auto; padding: 0 var(--pad); }
.h1 { margin: 0; font: 900 clamp(44px, 6vw, 96px)/.98 var(--sans); letter-spacing: -.035em; text-wrap: balance; }
.h2 { margin: 0; font: 900 clamp(32px, 3.8vw, 58px)/1.02 var(--sans); letter-spacing: -.03em; text-wrap: balance; max-width: 16ch; }
.lead { margin: 0; max-width: 46ch; font: 500 clamp(17px, 1.35vw, 20px)/1.5 var(--sans); color: var(--ink-2); text-wrap: pretty; }
.note { margin: 14px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-3); max-width: 60ch; }
.sec { padding: clamp(72px, 8vw, 128px) 0 0; }
/* Заметка автора: почему сделано так — абзац с чёрной чертой */
.why { margin: 28px 0 0; padding-left: 16px; border-left: 3px solid var(--ink); max-width: 62ch; font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 56px; align-items: end; margin-bottom: clamp(28px, 3.2vw, 48px); }

/* ── Кнопки: как в меню игры ───────────────────────────────────────────── */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 50px; padding: 0 22px;
  border: 0; border-radius: 12px; background: rgb(239 181 6 / 90%);
  font: 700 17px/1 var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .15s var(--ease), background .2s;
}
.btn:hover { background: var(--button); }
.btn:active { transform: scale(.94); } /* как нажатие кнопок в игре: сжатие до 0.9 */
.btn--ink { background: rgb(8 2 2 / 92%); color: #fff; }
.btn--ink:hover { background: var(--ink); }
.btn__icon { width: 19px; height: 19px; flex: none; }
.btn:focus-visible, .top a:focus-visible, video:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  height: 64px; padding: 0 max(var(--pad), calc((100vw - var(--max)) / 2));
  background: rgb(255 212 0 / 90%); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.top.is-scrolled { border-bottom-color: var(--line); }
.top__brand { display: inline-flex; align-items: center; gap: 10px; font: 900 20px/1 var(--sans); letter-spacing: -.02em; text-decoration: none; }
.top__brand img { border-radius: 8px; }
.top__home { font: 700 15px/1 var(--sans); text-decoration: none; padding: 11px 16px; border-radius: 10px; background: rgb(239 181 6 / 90%); }
.top__home:hover { background: var(--button); }

/* ── Встряска при загрузке: затухающий сдвиг, как телефон в руке ───────── */
.is-shaking { animation: shake .72s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10% { transform: translate3d(-7px, 2px, 0) rotate(-.4deg); }
  22% { transform: translate3d(8px, -2px, 0) rotate(.45deg); }
  34% { transform: translate3d(-6px, 1px, 0) rotate(-.3deg); }
  46% { transform: translate3d(5px, -1px, 0) rotate(.25deg); }
  60% { transform: translate3d(-3px, 0, 0); }
  74% { transform: translate3d(2px, 0, 0); }
  88% { transform: translate3d(-1px, 0, 0); }
  100% { transform: none; }
}

/* ── Устройства ────────────────────────────────────────────────────────── */
/* iPhone 8: запись с телефона 750 × 1334 и анимации игры 9 : 16 */
.phone8 { position: relative; aspect-ratio: 67.3 / 138.4; border-radius: 15% / 7.2%; background: var(--ink); }
.phone8::before { content: ""; position: absolute; left: 42%; right: 42%; top: 5.9%; height: .7%; border-radius: 99px; background: #3a3434; }
.phone8::after { content: ""; position: absolute; left: 41.85%; width: 16.3%; aspect-ratio: 1; bottom: 2.2%; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #3a3434; }
.phone8__screen { position: absolute; left: 6.55%; right: 6.55%; top: 12.4%; bottom: 12.4%; overflow: hidden; background: var(--yellow); }
.phone8__screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Симулятор iPhone 17 Pro, версия 2.2: экран 402 × 874 точек со строкой статуса */
.phone { padding: 3.4%; border-radius: 15% / 7%; background: var(--ink); }
.phone__screen { position: relative; aspect-ratio: 540 / 1174; border-radius: 12% / 5.6%; overflow: hidden; background: #000; }
.phone__screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.is-mirror { transform: scaleX(-1); }

/* ── Первый экран ──────────────────────────────────────────────────────── */
/* сцена шире колонки: взмах руки режется по краю самого раздела, а не прокруткой страницы */
.hero { padding: clamp(24px, 3vw, 48px) 0 0; overflow-x: clip; }
.hero__grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: 24px clamp(24px, 4vw, 64px); align-items: center; }
.hero__copy { display: grid; gap: 26px; align-content: center; }
/* Живая сцена Spline на том же жёлтом (фон сцены — #ffd400), без рамки.
   Холст у сцены фиксированный, 800 × 800: он лежит в квадрате такого размера и
   уменьшается трансформацией под ширину колонки, поэтому рука не уходит за край.
   Пока сцена грузится, на её месте кадр из неё же; смена — растворением, без вспышки. */
/* Рука с телефоном почти всю петлю держится в левой части холста 800 × 800:
   x 60–560, y 116–684 (замер по кадрам сцены), и только на короткий взмах
   уходит вправо до 776. Колонка показывает именно эту область — x 80–520,
   y 100–700 — в полную свою ширину, поэтому рука вдвое крупнее, чем при целом
   квадрате. Взмах вправо заходит на поле страницы и за край окна. Жёлтое на
   жёлтом не видно, сцена не ловит указатель — текст и кнопки слева живые. */
.hero__scene { --fx: 80; --fy: 100; --fw: 440; --fh: 600; position: relative; z-index: 0; width: 100%; aspect-ratio: 440 / 600; container-type: inline-size; pointer-events: none; }
.hero__copy { position: relative; z-index: 1; }
/* холст целиком, сдвинутый так, что нужная область ложится в колонку: доли от ширины колонки */
.hero__stage { position: absolute; left: calc(-100cqi * 80 / 440); top: calc(-100cqi * 100 / 440); width: calc(100cqi * 800 / 440); aspect-ratio: 1; }
.hero__poster { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .6s var(--ease); }
.hero__live { position: absolute; left: 0; top: 0; width: 800px; height: 800px; transform-origin: 0 0; transform: scale(var(--k, .5)); opacity: 0; transition: opacity .6s var(--ease); }
.hero__scene.is-live .hero__live { opacity: 1; }
.hero__scene.is-live .hero__poster { opacity: 0; }
/* реплика из промо-ролика: трясётся вместе с рукой — поворот берётся из сцены */
.hero__cue {
  position: absolute; left: 0; right: 0; top: 2%; margin: 0; text-align: center; pointer-events: none;
  font: 900 clamp(17px, 4.4cqi, 28px)/1.1 var(--sans); letter-spacing: -.01em; text-wrap: balance; padding: 0 12%;
  transform: translate3d(var(--cx, 0), 0, 0) rotate(var(--cr, -4deg)); transition: opacity .25s var(--ease);
}
.hero__cue.is-swap { opacity: 0; }

/* ── Фильм с iPhone ────────────────────────────────────────────────────── */
.film { display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 21vw, 300px); gap: clamp(28px, 5vw, 96px); align-items: center; }
.film__text { display: grid; gap: 22px; }
.film__text .note { margin-top: 0; }
.film__phone video { cursor: pointer; }
/* Кнопка на экране телефона: круглая чёрная, как «Start», с подписью — без неё
   неясно, что запись можно запустить. После первого нажатия уходит, дальше родные контролы. */
.play {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px;
  border: 0; padding: 0; background: rgb(255 212 0 / 22%); cursor: pointer; transition: opacity .25s var(--ease);
}
.play__icon { position: relative; width: 76px; height: 76px; border-radius: 50%; background: var(--ink); box-shadow: 0 10px 30px rgb(8 2 2 / 28%); transition: transform .15s var(--ease); }
.play__icon::after { content: ""; position: absolute; left: 31px; top: 23px; border-style: solid; border-width: 15px 0 15px 24px; border-color: transparent transparent transparent var(--yellow); }
.play__label { padding: 8px 14px; border-radius: 10px; background: var(--ink); color: #fff; font: 700 15px/1 var(--sans); white-space: nowrap; }
.play:hover .play__icon { transform: scale(1.06); }
.play:active .play__icon { transform: scale(.92); }
.play:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.play.is-gone { opacity: 0; pointer-events: none; }

/* ── Правила: лестница и три состояния ─────────────────────────────────── */
.ladder { margin: 0 0 clamp(36px, 4vw, 56px); }
.lad { width: 100%; height: auto; overflow: visible; }
.lad--phone { display: none; }
.lad__grid line { stroke: var(--line); stroke-width: 1; }
.lad__line { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linejoin: round; }
.lad__dots circle { fill: var(--ink); }
.lad__g { font: 700 15px/1 var(--sans); text-anchor: end; fill: var(--ink); }
.lad__s { font: 500 13px/1 var(--sans); text-anchor: middle; fill: var(--ink-3); }
.states { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 48px); }
.state { display: grid; grid-template-columns: clamp(110px, 10vw, 150px) minmax(0, 1fr); gap: 18px; align-items: center; }
.state figcaption { font-size: 16px; color: var(--ink-2); }
.state figcaption b { display: block; margin-bottom: 6px; font: 900 22px/1.1 var(--sans); color: var(--ink); }
.state:nth-child(2) figcaption b { color: var(--red); }
.rules__foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 56px; align-items: start; margin-top: clamp(36px, 4vw, 56px); }
.rules__foot .why { margin-top: 0; }

/* ── Beep-Boop: синтезатор на странице ─────────────────────────────────── */
.beep { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 4vw, 64px); align-items: start; }
.synth { display: grid; gap: 16px; justify-items: start; }
/* цвет площадки ведёт ускорение — тем же правилом, что фон Beep-Boop в игре */
.synth__pad {
  width: 100%; aspect-ratio: 1; display: grid; align-content: center; justify-items: center; gap: 8px; padding: 8%;
  border: 3px solid var(--ink); border-radius: 28px; background: var(--pad-bg, #fff05e);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.synth__g { margin: 0; font: 900 clamp(56px, 7vw, 104px)/1 var(--sans); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.synth__g span { display: inline-block; min-width: 3.2ch; text-align: right; }
.synth__hz { margin: 0 0 18px; font: 700 20px/1 var(--sans); font-variant-numeric: tabular-nums; }
.synth__meter { position: relative; width: 100%; height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: rgb(255 255 255 / 45%); }
.synth__gate { position: absolute; top: -8px; bottom: -8px; left: calc(var(--at) * 100%); width: 2px; background: var(--ink); }
.synth__needle { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(var(--level, 0) * (100% - 4px)); border-radius: 99px; background: var(--ink); transition: width .06s linear; }
.synth__scale { position: relative; width: 100%; height: 16px; margin: 4px 0 0; font: 500 13px/1 var(--sans); }
.synth__scale span { position: absolute; top: 0; }
.synth__scale span:first-child { left: 0; }
.synth__scale span:nth-child(2) { left: calc(var(--at) * 100%); transform: translateX(-50%); }
.synth__scale span:last-child { right: 0; }
.synth__hint { margin: 0; font: 500 16px/1.4 var(--sans); }
.synth .note { margin-top: 0; }
.slides { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.slide figcaption { margin-top: 12px; font: 500 14px/1.35 var(--sans); color: var(--ink-2); text-align: center; }

/* ── Мультиплеер: монтаж двух телефонов ────────────────────────────────── */
.duel { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 5vw, 88px); align-items: center; }
.duel__text { display: grid; gap: 22px; }
.facts { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.facts li { padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--ink-2); }
.duel__stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); justify-items: center; }
.duel__side { position: relative; width: min(100%, 250px); }
.duel__fall { opacity: 0; transition: opacity .35s var(--ease); }
.duel__stage.is-fall .duel__fall { opacity: 1; }
.duel__verdict { margin: 16px 0 0; text-align: center; font: 900 clamp(22px, 2.4vw, 32px)/1 var(--sans); letter-spacing: -.02em; opacity: 0; transition: opacity .4s var(--ease); }
.duel__stage.is-over .duel__verdict { opacity: 1; }
.duel__verdict--lost { color: var(--red); }
.duel__stage .note { grid-column: 1 / -1; text-align: center; }

/* ── Птица из Spline ───────────────────────────────────────────────────── */
.spline-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 28px; border: 3px solid var(--ink); overflow: hidden; }
.spline-frame::after { content: attr(data-idle); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 15px/1 var(--sans); color: var(--ink-3); }
.spline-frame.is-live::after { content: none; }
.spline-frame.is-failed::after { content: attr(data-failed); }

/* ── Конец ─────────────────────────────────────────────────────────────── */
.end { padding: clamp(96px, 11vw, 168px) 0 clamp(72px, 8vw, 120px); text-align: center; }
.end .wrap { display: grid; justify-items: center; gap: 24px; }
.end__icon { border-radius: 26px; }
.end .h2 { max-width: 14ch; }
.end .actions { justify-content: center; }
.foot { border-top: 1px solid var(--line); padding: 22px 0; font: 500 14px/1.4 var(--sans); color: var(--ink-3); }
.foot__row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ── Ширины ────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .head, .rules__foot { grid-template-columns: 1fr; gap: 16px; }
  /* три состояния остаются рядом: телефон сверху, подпись под ним */
  .state { grid-template-columns: 1fr; justify-items: start; align-items: start; }
  .state .phone8 { width: min(150px, 100%); }
  .beep { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .slides { grid-template-columns: repeat(3, minmax(0, 1fr)); align-self: center; }
  .duel { grid-template-columns: 1fr; }
  .duel__stage { max-width: 620px; }
}
@media (max-width: 860px) {
  .beep { grid-template-columns: 1fr; }
  .synth { max-width: 460px; }
  .slides { max-width: 620px; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__scene { justify-self: center; width: min(100%, 460px); }
  .film { grid-template-columns: 1fr; }
  .film__phone { width: min(300px, 78%); justify-self: center; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top__home { padding: 10px 13px; font-size: 14px; }
  .btn { height: 46px; padding: 0 18px; font-size: 16px; }
  .slides { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .slide figcaption { font-size: 12px; }
  .lad { display: none; }
  .lad--phone { display: block; }
  .states { grid-template-columns: 1fr; }
  .state { grid-template-columns: 110px minmax(0, 1fr); justify-items: stretch; }
  .state .phone8 { width: 100%; }
  .spline-frame { aspect-ratio: 4 / 5; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
