/* Токены, база и общие компоненты. Тёмная тема с красным неоном — по макетам из папки «Дизайн». */

@font-face {
  font-family: 'Onest';
  src: url('/assets/fonts/onest-cyrillic-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  src: url('/assets/fonts/onest-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215;
}
@font-face {
  font-family: 'Unbounded';
  src: url('/assets/fonts/unbounded-latin-900-normal.woff2') format('woff2');
  font-weight: 900;
  font-display: swap;
  unicode-range: U+0000-00FF;
}
@font-face {
  font-family: 'Unbounded';
  src: url('/assets/fonts/unbounded-cyrillic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0400-045F;
}
@font-face {
  font-family: 'Unbounded';
  src: url('/assets/fonts/unbounded-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
  unicode-range: U+0000-00FF;
}

:root {
  --bg: #050506;
  --surface: rgba(11, 11, 13, 0.78);
  --surface-solid: #0b0b0d;
  --surface-2: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.2);
  --line-soft: rgba(255, 255, 255, 0.1);
  --text: #f5f5f6;
  --text-2: #b4b4bb;
  --text-3: #7d7d86;
  --red: #ff2a33;
  --red-deep: #c4121b;
  --red-soft: rgba(255, 42, 51, 0.16);
  --red-glow: rgba(255, 42, 51, 0.5);
  --tg: #2aabee;
  --green: #35d07f;
  --amber: #ffb547;

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --pad: 16px;

  --neon: 0 0 0 1px rgba(255, 42, 51, 0.22), 0 0 16px rgba(255, 42, 51, 0.38), inset 0 0 14px rgba(255, 42, 51, 0.14);
  --neon-strong: 0 0 0 1px rgba(255, 42, 51, 0.4), 0 0 22px rgba(255, 42, 51, 0.6), inset 0 0 18px rgba(255, 42, 51, 0.22);
  --glass: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 40px -18px rgba(0, 0, 0, 0.9);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-ui: cubic-bezier(0.2, 0, 0, 1);

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Unbounded', 'Onest', system-ui, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color-scheme: dark;
}
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
img, svg, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 6px; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(5, 5, 6, 0.25), rgba(5, 5, 6, 0.86) 70%),
    url('/assets/img/bg.jpg') center bottom / cover no-repeat,
    var(--bg);
}

.app {
  width: min(100%, 560px);
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(14px + var(--safe-top)) var(--pad) calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  outline: none;
}
.app[data-wide='true'] { width: min(100%, 760px); }

/* ---------- Появление экрана: один раз, группами ---------- */
.screen { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.screen > * { animation: fade-in 300ms ease-out both; }
@media (prefers-reduced-motion: no-preference) {
  .screen > * { animation-name: fade-in-up; }
}
.screen > :nth-child(2) { animation-delay: 60ms; }
.screen > :nth-child(3) { animation-delay: 120ms; }
.screen > :nth-child(4) { animation-delay: 180ms; }
.screen > :nth-child(n + 5) { animation-delay: 240ms; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-in-up { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } }

/* ---------- Поверхности ---------- */
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(22, 22, 25, 0.72), rgba(8, 8, 9, 0.86));
  box-shadow: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 16px;
}
.neon {
  position: relative;
  border: 1px solid rgba(255, 70, 80, 0.92);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(10, 10, 11, 0.9), rgba(4, 4, 5, 0.94));
  box-shadow: var(--neon);
  padding: 16px;
}
.frame {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--r-xl);
  padding: 12px;
  background: rgba(5, 5, 6, 0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.divider { height: 1px; background: var(--line-soft); margin: 12px 0; }

/* ---------- Кнопки ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(34, 34, 38, 0.72), rgba(10, 10, 12, 0.9));
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  user-select: none;
  transition-property: scale, border-color, box-shadow, background-color, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.btn:not(:disabled):active { scale: 0.96; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--white { border-color: rgba(255, 255, 255, 0.92); }
.btn--red { border-color: rgba(255, 70, 80, 0.95); box-shadow: var(--neon); background: linear-gradient(180deg, rgba(18, 8, 9, 0.9), rgba(6, 4, 4, 0.94)); }
.btn--solid { border-color: transparent; background: linear-gradient(180deg, #ff3b44, #c4121b); box-shadow: 0 0 22px rgba(255, 42, 51, 0.45); }
.btn--ghost { border-color: transparent; background: none; color: var(--text-2); min-height: 44px; }
.btn--block { width: 100%; }
.btn--sm { min-height: 44px; font-size: 14px; padding: 0 16px; border-radius: 14px; }
.btn--lg { min-height: 64px; font-size: 18px; border-radius: 20px; }
.btn--arrow { justify-content: space-between; padding-inline: 22px 18px; }
.btn--arrow > span:first-child { flex: 1; text-align: center; }
.btn .icon { flex: none; }
@media (hover: hover) {
  .btn:not(:disabled):hover { border-color: #fff; }
  .btn--red:not(:disabled):hover { border-color: #ff6a72; box-shadow: var(--neon-strong); }
  .btn--solid:not(:disabled):hover { border-color: transparent; box-shadow: 0 0 30px rgba(255, 42, 51, 0.65); }
}
.btn[aria-busy='true'] { pointer-events: none; opacity: 0.7; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.7);
  color: var(--text);
  position: relative;
  transition-property: scale, border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
}
.icon-btn:active { scale: 0.96; }
.icon-btn--red { border-color: rgba(255, 70, 80, 0.95); box-shadow: var(--neon); }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px var(--red); }
@media (hover: hover) { .icon-btn:hover { border-color: #fff; } }

.link-red {
  color: var(--red);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }

/* ---------- Шапка экрана ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.topbar__spacer { flex: 1; }
.topbar--center { display: grid; grid-template-columns: 1fr auto 1fr; }
.topbar--center > :first-child { justify-self: start; }
.topbar--center { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; }
.topbar--center .topbar__title { flex: none; }
.topbar--center .back-btn { padding: 0 14px 0 12px; gap: 8px; }
.topbar__title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(15px, 4.4vw, 20px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e9e9ec;
  padding-bottom: 8px;
  background: linear-gradient(90deg, transparent, var(--red), transparent) center bottom / 70% 2px no-repeat;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.back-btn { min-height: 48px; padding: 0 18px 0 14px; gap: 12px; font-size: 15px; font-weight: 500; border-radius: 14px; }
.back-btn--red { border-color: rgba(255, 70, 80, 0.95); box-shadow: var(--neon); }
.back-btn--red .icon { color: var(--red); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 10, 12, 0.7);
  font-size: 15px;
  white-space: nowrap;
}
.pill b { color: var(--red); font-weight: 700; }
.pill--red { border-color: rgba(255, 70, 80, 0.95); box-shadow: var(--neon); }

.section-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.section-title::before { content: ''; width: 4px; height: 18px; border-radius: 2px; background: var(--red); box-shadow: 0 0 10px var(--red); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .label { font-size: 13px; color: var(--text-2); }
.input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  border: 1px solid rgba(255, 70, 80, 0.92);
  border-radius: var(--r-md);
  background: rgba(4, 4, 5, 0.9);
  box-shadow: var(--neon);
  font-size: clamp(14.5px, 4.2vw, 17px);
  outline: none;
  transition: box-shadow 150ms ease-out, border-color 150ms ease-out;
}
.input--plain { border-color: var(--line); box-shadow: none; }
.input::placeholder { color: var(--text-3); font-size: clamp(13px, 3.7vw, 16px); }
.input:focus-visible { border-color: #ff7a81; box-shadow: var(--neon-strong); outline: none; }
.input--plain:focus-visible { border-color: #fff; box-shadow: none; }
textarea.input { padding: 14px 18px; min-height: 110px; resize: vertical; line-height: 1.45; }
.input[aria-invalid='true'] { border-color: var(--amber); }
.hint { font-size: 13px; color: var(--text-3); }
.error { font-size: 13px; color: var(--amber); }

/* Переключатель блайндов: ← 15/25  25/50  50/100 → */
.stepper {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 8, 9, 0.82);
}
.stepper--red { border-color: rgba(255, 70, 80, 0.92); box-shadow: var(--neon); min-height: 58px; }
.stepper__arrow { display: grid; place-items: center; height: 100%; color: var(--text); border-radius: 14px; }
.stepper__arrow:disabled { opacity: 0.25; cursor: default; }
.stepper__arrow:not(:disabled):active { scale: 0.92; }
.stepper__track { touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; text-align: center; font-size: clamp(14px, 4.2vw, 16px); }
.stepper__opt { color: var(--text-3); padding: 12px 0; min-height: 44px; white-space: nowrap; font-size: clamp(12px, 3.5vw, 15px); }
.stepper__opt--current { font-size: clamp(14px, 4.2vw, 17px); }
.stepper__opt:disabled { cursor: default; }
.stepper__opt--current { color: #fff; font-weight: 600; }

.tabs { display: flex; gap: 10px; }
.tab {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--text-3);
  font-size: clamp(12px, 3.4vw, 13.5px);
  font-weight: 500;
  background: rgba(12, 12, 14, 0.7);
  transition: border-color 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out;
}
.tab[aria-selected='true'] { color: #fff; border-color: rgba(255, 70, 80, 0.95); box-shadow: var(--neon); }

.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); transition: background-color 150ms ease-out, border-color 150ms ease-out; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: translate 200ms var(--ease-out); }
.switch input:checked + span { background: var(--red-soft); border-color: var(--red); }
.switch input:checked + span::after { translate: 20px 0; background: var(--red); }
.switch input:focus-visible + span { outline: 2px solid #fff; outline-offset: 3px; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.badge--live::before { background: var(--red); box-shadow: 0 0 8px var(--red); }
.badge--ok::before { background: var(--green); }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-soft); font-size: 12px; color: var(--text-2); }
.tag--red { border-color: var(--red); color: #ffb3b7; }

.list { display: flex; flex-direction: column; }
.list__item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.list__item:last-child { border-bottom: 0; }
.amount-plus { color: var(--green); }
.amount-minus { color: #ff8087; }

.empty { padding: 28px 12px; text-align: center; color: var(--text-3); }
.skeleton { border-radius: var(--r-md); background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; min-height: 64px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Логотип и иллюстрации ---------- */
/* Логотип — файл logo.webp (2000×667, поля прозрачные): рамка обрезает поля до самого знака */
.logo-img { position: relative; display: block; flex: none; width: calc(var(--logo-size, 56px) * 4.3); max-width: 100%; aspect-ratio: 1846 / 420; overflow: hidden; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.8)); }
.logo-img img { position: absolute; max-width: none; width: 108.34%; left: -4.23%; top: -33.33%; height: auto; user-select: none; }
.avatar { position: relative; width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: #0c0c0e; }
.avatar img { width: 100%; height: 100%; object-fit: cover; outline: 1px solid rgba(255, 255, 255, 0.1); outline-offset: -1px; border-radius: 50%; }
/* Фишка по умолчанию — avatar-chip.webp (1254×1254): круг фишки растянут на весь аватар */
.chip-img { background: #0b0b0d; }
.avatar img.avatar__chip { position: absolute; max-width: none; width: 134%; height: auto; left: -16.56%; top: -14.3%; outline: 0; border-radius: 0; object-fit: fill; }

/* ---------- Оверлеи: модальные окна и листы ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 12px calc(12px + var(--safe-bottom));
  background: rgba(0, 0, 0, 0.68);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.overlay[data-open='true'] { opacity: 1; }
.sheet {
  width: min(100%, 520px);
  max-height: min(86dvh, 760px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 70, 80, 0.9);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, #0e0e10, #060607);
  box-shadow: var(--neon), 0 30px 80px rgba(0, 0, 0, 0.8);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transition: opacity 180ms ease-out;
}
.overlay[data-open='true'] .sheet { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .sheet { translate: 0 24px; transition: opacity 180ms ease-out, translate 320ms var(--ease-out); }
  .overlay[data-open='true'] .sheet { translate: 0 0; }
}
@media (min-width: 620px) { .overlay { align-items: center; } }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet__title { font-size: 19px; font-weight: 700; }
.sheet__actions { display: flex; gap: 10px; }
.sheet__actions > * { flex: 1; }

.fullscreen-alert {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(80% 60% at 50% 40%, rgba(120, 8, 14, 0.55), rgba(0, 0, 0, 0.94));
  animation: fade-in 250ms ease-out both;
}
.fullscreen-alert__inner { display: flex; flex-direction: column; gap: 16px; align-items: center; max-width: 420px; }
.fullscreen-alert h2 { font-family: var(--font-display); font-size: 24px; letter-spacing: 0.04em; text-transform: uppercase; }
.fullscreen-alert .count { font-family: var(--font-display); font-size: 64px; color: var(--red); text-shadow: 0 0 30px var(--red-glow); font-variant-numeric: tabular-nums; }

.toasts { position: fixed; z-index: 90; left: 0; right: 0; top: calc(10px + var(--safe-top)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto;
  max-width: 460px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(14, 14, 16, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  font-size: 14px;
  opacity: 0;
  translate: 0 -12px;
  transition: opacity 200ms ease-out, translate 300ms var(--ease-out);
}
.toast[data-open='true'] { opacity: 1; translate: 0 0; }
.toast--error { border-color: var(--red); }
.toast--ok { border-color: var(--green); }
.toast b { display: block; }

/* ---------- Заставка ---------- */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: url('/assets/img/bg.jpg') center bottom / cover no-repeat, var(--bg); transition: opacity 500ms ease-out, visibility 0s 500ms; }
.splash[data-done='true'] { opacity: 0; visibility: hidden; pointer-events: none; }
.splash__video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(110vw, 196vh * 0.5625);
  max-width: none;
  aspect-ratio: 16 / 9;
  translate: -50% -50%;
  mix-blend-mode: screen;
  opacity: 0.9;
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 96%);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 96%);
}
.splash__logo { position: relative; --logo-size: clamp(52px, 15vw, 92px); width: min(86vw, calc(var(--logo-size) * 4.3)); animation: fade-in 700ms 200ms ease-out both; }
.splash__bar { position: absolute; bottom: calc(18% + var(--safe-bottom)); width: 140px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.splash__bar span { display: block; width: 40%; height: 100%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: splash-bar 1.1s ease-in-out infinite; }
@keyframes splash-bar { from { translate: -110% 0; } to { translate: 260% 0; } }

.conn { position: fixed; z-index: 60; left: 50%; translate: -50% 0; bottom: calc(10px + var(--safe-bottom)); padding: 8px 14px; border-radius: 999px; font-size: 13px; background: rgba(14, 14, 16, 0.96); border: 1px solid var(--amber); color: var(--amber); display: flex; gap: 8px; align-items: center; }

@media (prefers-reduced-motion: reduce) {
  .splash__video { display: none; }
  .skeleton, .splash__bar span { animation: none; }
}
@media (forced-colors: active) {
  .panel, .neon, .btn, .input { border: 1px solid CanvasText; }
}
