/* Пропуск: бумажный билет с перфорацией и одной краской. Шрифтов извне нет (CSP), берём системные с характером. */
:root {
  color-scheme: light dark;
  --paper: oklch(97% 0.012 85);
  --sheet: oklch(99.2% 0.006 85);
  --ink: oklch(24% 0.03 160);
  --ink-soft: oklch(45% 0.025 160);
  --line: oklch(86% 0.02 85);
  --accent: oklch(46% 0.11 160);
  --accent-ink: oklch(98% 0.01 160);
  --warn: oklch(50% 0.14 45);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", ui-serif, Georgia, serif;
  --text: ui-sans-serif, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
/* Тема: data-theme ставит переключатель (light/dark), без него — как в системе. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: oklch(19% 0.012 160);
  --sheet: oklch(23% 0.014 160);
  --ink: oklch(93% 0.012 85);
  --ink-soft: oklch(72% 0.02 85);
  --line: oklch(34% 0.015 160);
  --accent: oklch(74% 0.12 160);
  --accent-ink: oklch(20% 0.03 160);
  --warn: oklch(76% 0.13 55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: oklch(19% 0.012 160);
    --sheet: oklch(23% 0.014 160);
    --ink: oklch(93% 0.012 85);
    --ink-soft: oklch(72% 0.02 85);
    --line: oklch(34% 0.015 160);
    --accent: oklch(74% 0.12 160);
    --accent-ink: oklch(20% 0.03 160);
    --warn: oklch(76% 0.13 55);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.5 var(--text);
  display: grid;
  place-items: start center;
  padding: clamp(16px, 6vh, 72px) 16px 40px;
  -webkit-font-smoothing: antialiased;
}

.pass {
  width: min(100%, 440px);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--r);
  position: relative;
  animation: rise 0.6s var(--ease) both;
}
/* Перфорация между корешком и телом билета — вырезы по краям и пунктир. */
.stub {
  padding: 22px 24px 20px;
  border-bottom: 2px dashed var(--line);
  position: relative;
}
.stub::before, .stub::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
}
.stub::before { left: -11px; clip-path: inset(0 0 0 50%); }
.stub::after { right: -11px; clip-path: inset(0 50% 0 0); }

/* Переключатель темы: полукруг — как в системе, солнце — светлая, полумесяц — тёмная. */
.theme {
  position: absolute;
  top: 14px; right: 14px;
  width: 44px; height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid; place-items: center;
}
.theme::before {
  content: "";
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  background: linear-gradient(90deg, var(--ink-soft) 50%, transparent 50%);
}
.theme[data-mode="light"]::before { width: 10px; height: 10px; border: 0; background: var(--ink-soft); outline: 2px dotted var(--ink-soft); outline-offset: 3px; }
.theme[data-mode="dark"]::before { border-color: transparent; background: none; box-shadow: inset -6px -3px 0 0 var(--ink-soft); }
.theme:hover::before { border-color: var(--ink); }

.eyebrow {
  font: 600 12px/1 var(--text);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.steps {
  list-style: none;
  display: flex;
  gap: 18px;
  margin: 14px 0 0;
  padding: 0;
  counter-reset: s;
  font-size: 14px;
  color: var(--ink-soft);
}
.steps li { counter-increment: s; }
.steps li::before { content: counter(s) " "; font-family: var(--mono); font-size: 12px; opacity: 0.7; }
.steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.steps li[aria-current="step"]::before { color: var(--accent); opacity: 1; }

.screen { padding: 26px 24px 28px; }
.screen:not([hidden]) { animation: fade 0.45s var(--ease) both; }

h1 {
  font: 600 clamp(26px, 6.4vw, 31px)/1.15 var(--display);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  text-wrap: balance;
}
h2 { font: 600 13px/1 var(--text); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 10px; }
.lead { margin: 0 0 24px; color: var(--ink-soft); }
.lead.warn { color: var(--warn); font-weight: 500; }

label { display: block; font-size: 14px; font-weight: 600; margin: 18px 0 6px; }
label:first-child { margin-top: 0; }
input, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 22%, transparent); }

/* Четыре места под цифры — черта под каждой, сам ввод один: подсказки клавиатуры и вставка работают как обычно.
   Интервал браузер ставит и после последней цифры, поэтому слева отступ на целый интервал — иначе поле
   прокрутится и первая цифра уедет. */
.digits {
  --gap: 1.6ch;
  --cell: calc(1ch + var(--gap));
  font: 600 30px/1 var(--mono);
  letter-spacing: var(--gap);
  padding: 14px 0 18px var(--gap);
  width: calc(var(--cell) * 4 + var(--gap) + 2px);
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1ch, transparent 1ch var(--cell)) var(--gap) calc(100% - 12px) / 100% 2px no-repeat,
    var(--paper);
  caret-color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.digits:focus { background-image: repeating-linear-gradient(90deg, var(--accent) 0 1ch, transparent 1ch var(--cell)); }
.hint { font-size: 14px; color: var(--ink-soft); margin: 8px 0 0; }

button { font: inherit; cursor: pointer; border-radius: 10px; transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s; }
button:active { transform: scale(0.98); }
button:focus-visible { outline: 3px solid color-mix(in oklch, var(--accent) 45%, transparent); outline-offset: 2px; }
button[disabled] { opacity: 0.55; cursor: progress; }
.primary {
  display: block; width: 100%;
  margin-top: 26px;
  padding: 14px 18px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.ghost { padding: 13px 18px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 500; }
.link { margin-top: 22px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: grid; justify-items: start; grid-template-rows: 34px auto; gap: 18px;
  padding: 18px 16px 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
}
.choice:hover { border-color: var(--accent); }
.glyph { display: block; align-self: end; border: 2px solid currentColor; color: var(--accent); }
.glyph.phone { width: 18px; height: 30px; border-radius: 5px; }
.glyph.computer { width: 34px; height: 22px; border-radius: 3px; box-shadow: 0 6px 0 -4px currentColor; }

.mine { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.mine ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 15px; }
.mine li { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 12px; }
.mine .hint { margin-top: 12px; font-size: 13px; }
.link.small { margin: 0; font-size: 13px; text-decoration-thickness: 1px; }
.link.small[data-sure="1"] { color: var(--warn); }

/* Статус логина — внутри поля справа: точка + слово, без рамок и иконок. */
.field { position: relative; }
.field input { padding-right: 104px; }
.status {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: var(--ink-soft); pointer-events: none;
  opacity: 0; transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1);
}
.status[data-state="ok"], .status[data-state="bad"] { opacity: 1; }
.status::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px; background: currentColor;
}
.status[data-state="ok"] { color: var(--accent); }
.status[data-state="bad"] { color: var(--warn); }
.field:has(.status[data-state="bad"]) input { border-color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .status { transition: none; } }
.mine b { font-family: var(--mono); font-weight: 600; }
.mine span { color: var(--ink-soft); }
.account { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line); }
.account h2 { margin-bottom: 0; }
.account .ghost { margin-top: 14px; }
#account-done { margin-top: 28px; }

textarea { font: 13px/1.45 var(--mono); resize: none; word-break: break-all; }
.row { display: grid; gap: 10px; margin-top: 4px; }
.row .primary { margin-top: 14px; }
.howto { margin: 26px 0 0; padding-left: 22px; display: grid; gap: 8px; font-size: 15px; }
.howto li::marker { font-family: var(--mono); color: var(--accent); }

.msg {
  margin: 0 24px 24px;
  padding: 12px 14px;
  border-radius: 10px;
  background: color-mix(in oklch, var(--warn) 12%, var(--sheet));
  color: var(--ink);
  font-size: 15px;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 520px) { .row { grid-template-columns: 1fr 1fr; align-items: end; } .row .primary { margin-top: 0; } }
