/* Киоск: планшет в зале, палец вместо мыши.
   Все кнопки от 64 px, ничего не выделяется, ничего не масштабируется. */

:root {
  --bg: #0f1115;
  --card: #181b22;
  --card-2: #1f232c;
  --line: #2b3038;
  --text: #f2f4f8;
  --muted: #9aa3b2;
  --accent: #ff7a2f;
  --accent-2: #ff9a5c;
  --ok: #3ddc84;
  --err: #ff5f57;
  --radius: 22px;
}

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

/* Фон-переливание под всеми экранами; считается в пониженном разрешении и растягивается */
.bg-shader {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* Запасной фон без WebGL: два кадра того же шейдера медленно перетекают друг
   в друга. Пока WebGL работает, блок скрыт и картинки даже не грузятся */
.bg-fallback { display: none; position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.no-webgl .bg-fallback { display: block; }
.bg-fallback i { position: absolute; inset: 0; background: center / cover no-repeat; }
.bg-fallback i:first-child { background-image: url(/bg/frame-1.jpg); }
.bg-fallback i:last-child { background-image: url(/bg/frame-2.jpg); animation: bg-blend 14s ease-in-out infinite alternate; }
@keyframes bg-blend { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bg-fallback i:last-child { animation: none; opacity: 0; } }

/* Эмодзи картинкой — размером с окружающий текст */
.emoji { width: 1em; height: 1em; vertical-align: -0.15em; }

/* display:flex/grid перебивает штатное скрытие, поэтому усиливаем */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 400 20px/1.4 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
}

body { overflow: hidden; }

/* ---------- Экраны ---------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  /* экраны без своего фона (билеты) почти глухие — видео за формой мешает */
  background: rgba(15, 17, 21, .94);
  display: none;
  flex-direction: column;
  animation: fade .25s ease;
}
.screen.is-active { display: flex; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
}
.bar__back {
  width: 64px; height: 64px;
  border: 0; border-radius: 50%;
  background: var(--card-2);
  color: var(--text);
  font-size: 30px;
  cursor: pointer;
}
.bar__back:active { background: var(--line); }
.bar__steps { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); }
.bar__steps b, .bar__steps i {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-style: normal; font-size: 17px; font-weight: 600;
  background: var(--card-2); color: var(--muted);
}
.bar__steps b { background: var(--accent); color: #111; }
.bar__steps span { width: 28px; height: 2px; background: var(--line); }

.pane { flex: 1; overflow-y: auto; padding: 32px 28px 24px; -webkit-overflow-scrolling: touch; }
.pane--center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.pane--form { padding-bottom: 8px; }
.pane__title { font-size: 40px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 8px; }
.pane__hint { color: var(--muted); font-size: 19px; margin-bottom: 24px; }

/* ---------- Заставка ---------- */

.screen--attract { background: radial-gradient(55% 45% at 50% 50%, rgba(15, 17, 21, .35) 0%, rgba(15, 17, 21, 0) 100%); }
.attract__title, .attract__sub { text-shadow: 0 2px 18px rgba(0, 0, 0, .6); }
.attract__sub { color: #d6dbe4; }
.attract { margin: auto; text-align: center; padding: 40px; }
.attract__mark { font-size: 96px; margin-bottom: 20px; }
.attract__title { font-size: 64px; font-weight: 800; letter-spacing: -1.5px; }
.attract__sub { color: var(--muted); font-size: 23px; margin: 14px 0 48px; }

/* ---------- Билеты ---------- */

.tickets { display: grid; gap: 16px; }
.ticket {
  display: flex; align-items: center; gap: 20px;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: border-color .15s, background .15s;
}
.ticket.is-picked { border-color: var(--accent); background: var(--card-2); }
.ticket__info { flex: 1; min-width: 0; }
.ticket__title { font-size: 25px; font-weight: 650; }
.ticket__note { color: var(--muted); font-size: 17px; margin-top: 4px; }
.ticket__price { font-size: 26px; font-weight: 700; white-space: nowrap; }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper__btn {
  width: 64px; height: 64px;
  border: 0; border-radius: 18px;
  background: var(--card-2);
  color: var(--text);
  font-size: 30px; font-weight: 500;
  cursor: pointer;
}
.stepper__btn:active { background: var(--accent); color: #111; }
.stepper__btn:disabled { opacity: .3; }
.stepper__qty { width: 52px; text-align: center; font-size: 26px; font-weight: 700; }

/* ---------- Нижняя панель ---------- */

.dock {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 28px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--card);
}
.dock__sum { display: flex; flex-direction: column; }
.dock__sum span { color: var(--muted); font-size: 16px; }
.dock__sum b { font-size: 32px; font-weight: 750; }

.btn {
  border: 0; border-radius: 18px;
  padding: 0 40px; height: 76px;
  font-size: 23px; font-weight: 650;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #17110b; margin-left: auto; }
.btn--huge { height: 92px; font-size: 27px; padding: 0 60px; margin: 0; }
.btn--ghost { background: var(--card-2); color: var(--text); margin-top: 28px; }
.btn:disabled { opacity: .4; }

/* ---------- Форма ---------- */

.fields { display: grid; gap: 14px; }
.field {
  display: block;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 14px 22px;
}
.field.is-active { border-color: var(--accent); }
.field.is-bad { border-color: var(--err); }
.field__label { display: block; color: var(--muted); font-size: 15px; }
.field__label em { font-style: normal; opacity: .6; }
.field__input {
  width: 100%;
  background: none; border: 0; outline: 0;
  color: var(--text);
  font: 600 27px/1.5 inherit;
  user-select: text;
}
.field__input::placeholder { color: #4d5563; font-weight: 500; }

.suggest { display: flex; flex-wrap: wrap; gap: 10px; }
.suggest button {
  border: 0; border-radius: 14px;
  background: var(--card-2); color: var(--muted);
  padding: 12px 18px; font-size: 18px;
  cursor: pointer;
}
.suggest button:active { background: var(--accent); color: #111; }

.consent { display: flex; gap: 16px; align-items: flex-start; margin-top: 22px; cursor: pointer; }
.consent input { position: absolute; opacity: 0; pointer-events: none; }
.consent__box {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--card);
  position: relative;
}
.consent input:checked + .consent__box { background: var(--accent); border-color: var(--accent); }
.consent input:checked + .consent__box::after {
  content: '✓'; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #111; font-size: 24px; font-weight: 700;
}
.consent__text { color: var(--muted); font-size: 17px; line-height: 1.45; }
.consent__text a { color: var(--accent); }
.consent.is-bad .consent__box { border-color: var(--err); }

.error { color: var(--err); font-size: 18px; margin-top: 16px; }

/* ---------- Клавиатура ---------- */

.keypad {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 12px 28px calc(12px + env(safe-area-inset-bottom));
}
.keypad.is-open { display: grid; }
.key {
  height: 66px;
  border: 0; border-radius: 16px;
  background: var(--card-2); color: var(--text);
  font-size: 30px; font-weight: 600;
  cursor: pointer;
}
.key:active { background: var(--accent); color: #111; }
.key--ghost { background: var(--card); font-size: 19px; color: var(--muted); }

/* ---------- Оплата ---------- */

.qr {
  width: 340px; height: 340px;
  background: #fff;
  border-radius: 26px;
  padding: 18px;
  display: grid; place-items: center;
}
.qr svg, .qr img { width: 100%; height: 100%; object-fit: contain; }
.pay__amount { font-size: 46px; font-weight: 750; margin: 26px 0 10px; }
.pay__status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 19px; }
.pay__timer { color: var(--text); font-variant-numeric: tabular-nums; }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Готово ---------- */

.screen--done { background: radial-gradient(120% 90% at 50% 0%, rgba(18, 39, 27, .92) 0%, rgba(15, 17, 21, .94) 60%); }
.done { margin: auto; text-align: center; padding: 40px; }
.done__check {
  width: 128px; height: 128px; margin: 0 auto 28px;
  border-radius: 50%;
  background: var(--ok); color: #06210f;
  font-size: 68px; display: grid; place-items: center;
}
.done__title { font-size: 52px; font-weight: 800; }
.done__sub { color: var(--muted); font-size: 20px; margin: 14px 0 20px; }
.done__number {
  font-size: 92px; font-weight: 850;
  letter-spacing: 4px;
  margin-bottom: 44px;
}

/* ---------- Заставка: две кнопки ---------- */

.attract__actions { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.btn--gift {
  background: linear-gradient(180deg, #ffd23f, #ffb020);
  animation: pulse 2.4s ease-in-out infinite;
}
.btn--gift + .btn { background: var(--card-2); color: var(--text); }
/* жёлто-красный подарок на жёлтой кнопке сливается — даём ему тёмную подложку */
.btn--gift .emoji {
  width: 1.5em; height: 1.5em;
  padding: .2em; margin-right: .25em;
  background: #17110b; border-radius: 50%;
  vertical-align: -.45em;
}
@keyframes pulse { 50% { transform: scale(1.04); box-shadow: 0 0 0 14px rgba(255, 210, 63, .12); } }

/* ---------- Квиз ---------- */

.screen--quiz { background: rgba(10, 11, 14, .55); }
.quiz-progress { flex: 1; height: 12px; border-radius: 6px; background: var(--card-2); overflow: hidden; }
.quiz-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), #ffd23f);
  border-radius: 6px;
  transition: width .4s ease;
}
.quiz-count { color: var(--muted); font-size: 19px; font-weight: 600; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

.pane--quiz { display: flex; flex-direction: column; justify-content: center; max-width: 1100px; width: 100%; margin: 0 auto; }
.quiz__kicker { color: #ffd23f; font-size: 19px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 6px; }
.quiz__text { margin-bottom: 28px; }

.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.answer {
  display: flex; align-items: center; gap: 18px;
  min-height: 96px;
  padding: 18px 24px;
  border: 2px solid transparent; border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  font: inherit; font-size: 23px; font-weight: 600; text-align: left;
  cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s, opacity .2s;
}
.answer:active { transform: scale(.97); }
.answer.is-picked { border-color: var(--accent); background: var(--card-2); }
.answer.is-dim { opacity: .35; }
.answer__emoji { font-size: 44px; line-height: 1; flex: 0 0 auto; }

/* Финальный выбор подарка — крупно, в ряд */
.answers--chest { grid-template-columns: repeat(3, 1fr); }
.answers--chest .answer { flex-direction: column; justify-content: center; text-align: center; min-height: 220px; gap: 10px; font-size: 20px; color: var(--muted); }
.answers--chest .answer__emoji { font-size: 96px; }
.answer.is-opening .answer__emoji { animation: shake .45s ease-in-out 2; }
@keyframes shake {
  25% { transform: rotate(-12deg) scale(1.08); }
  75% { transform: rotate(12deg) scale(1.08); }
}

.quiz__reply {
  min-height: 40px; margin-top: 24px;
  text-align: center; font-size: 28px; font-weight: 700; color: #ffd23f;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.quiz__reply.is-shown { opacity: 1; transform: none; }
.quiz__fail { text-align: center; }

/* Шаг с почтой: форма сверху, чтобы системная клавиатура её не закрыла */
.pane--quiz.pane--top { justify-content: flex-start; padding-top: 28px; }
.quiz-email { display: grid; gap: 14px; max-width: 760px; }
.quiz-email .pane__hint { margin-bottom: 4px; }
.quiz-email .consent { margin-top: 4px; }
.quiz-email .error { margin-top: 0; }
.quiz-email__actions { display: flex; gap: 14px; margin-top: 8px; }
.quiz-email__actions .btn--ghost { margin-top: 0; }

/* ---------- Награда ---------- */

.screen--prize { background: radial-gradient(120% 90% at 50% 0%, rgba(46, 36, 16, .5) 0%, rgba(10, 11, 14, .45) 60%); overflow: hidden; }
.prize { margin: auto; text-align: center; padding: 40px; position: relative; z-index: 1; }
.prize__badge { font-size: 110px; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0); } }
.prize__title { font-size: 56px; font-weight: 850; letter-spacing: -1px; }
.prize__sub { color: var(--muted); font-size: 22px; margin: 10px 0 16px; }
.prize__code {
  display: inline-block;
  padding: 18px 40px;
  border: 3px dashed #ffd23f; border-radius: 26px;
  font-size: 96px; font-weight: 850; letter-spacing: 6px;
  font-variant-numeric: tabular-nums;
  color: #ffd23f;
}
.prize__terms { color: var(--muted); font-size: 18px; max-width: 620px; margin: 22px auto 6px; }
.prize__hint { font-size: 19px; margin-bottom: 30px; }
.prize .btn--primary { margin: 0; }

.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i {
  position: absolute; top: -20px;
  width: 12px; height: 18px; border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall { to { top: 110%; transform: translateX(60px) rotate(720deg); } }

/* ---------- Текст согласия поверх экрана ---------- */

.doc {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(5, 6, 8, .72);
}
.doc__box {
  width: 100%; max-width: 820px; height: 100%; max-height: 900px;
  display: flex; flex-direction: column; gap: 16px;
  padding: 16px;
  background: var(--card); border-radius: var(--radius);
}
.doc__frame { flex: 1; width: 100%; border: 0; border-radius: 14px; background: #0f1115; }
.doc__box .btn { margin: 0; align-self: stretch; }

/* Телефон в портрете — тот же киоск, но плотнее */
@media (max-width: 640px) {
  .pane__title { font-size: 31px; }
  .attract__title { font-size: 44px; }
  .ticket { flex-wrap: wrap; }
  .qr { width: 280px; height: 280px; }
  .done__number { font-size: 68px; }
  .btn--huge { height: auto; min-height: 84px; padding: 16px 28px; font-size: 22px; }
  .answers { grid-template-columns: 1fr; gap: 12px; }
  .answer { min-height: 76px; font-size: 20px; }
  .answers--chest .answer { min-height: 150px; }
  .answers--chest .answer__emoji { font-size: 64px; }
  .prize__title { font-size: 40px; }
  .prize__code { font-size: 60px; padding: 14px 24px; }
}


/* Планшет в альбомной ориентации: форма слева, клавиатура справа —
   иначе цифры занимают половину экрана и прячут почту с согласием. */
@media (min-width: 900px) and (min-height: 600px) {
  #screen-contacts.is-active {
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto 1fr auto;
  }
  #screen-contacts .bar,
  #screen-contacts .dock { grid-column: 1 / -1; }
  #screen-contacts .pane { grid-column: 1; }
  #screen-contacts .keypad {
    display: grid;
    grid-column: 2;
    grid-row: 2;
    align-content: center;
    border-left: 1px solid var(--line);
    padding: 24px 28px;
  }
  #screen-contacts .key { height: 84px; }
  /* места по вертикали мало — форма должна помещаться вместе с согласием */
  #screen-contacts .pane { padding-top: 22px; }
  #screen-contacts .pane__title { font-size: 34px; }
  #screen-contacts .pane__hint { font-size: 17px; margin-bottom: 16px; }
  #screen-contacts .field { padding: 10px 20px; }
  #screen-contacts .field__input { font-size: 24px; }
  #screen-contacts .consent { margin-top: 16px; }
}
