/*
 * VPN BY SORRY — Mini App.
 * Тёмная тема с синим акцентом, неоновая заставка при запуске.
 * Шрифт системный: без сторонних серверов (Google Fonts и т. п.).
 */

:root {
  color-scheme: dark;
  --page: #0d1015;
  --card: #141920;
  --card-2: #1a2029;
  --line: #242b35;
  --hero: #18263a;
  --text: #e8ecf2;
  --muted: #8b95a4;
  --faint: #5b6575;
  --accent: #2d8cff;
  --accent-soft: rgba(45, 140, 255, 0.14);
  --accent-ink: #ffffff;
  --ok: #3ad38a;
  --ok-soft: rgba(58, 211, 138, 0.14);
  --warn: #ffb547;
  --warn-soft: rgba(255, 181, 71, 0.14);
  --bad: #ff6363;
  --bad-soft: rgba(255, 99, 99, 0.14);
  --toast: #232a35;
  --scrim: rgba(3, 5, 8, 0.6);
  --track: #2a3340;
  --neon: #9fd0ff;
  --neon-core: #eaf5ff;
  --neon-glow: #2d8cff;
  --qr-bg: #ffffff;
  --font: -apple-system, "SF Pro Text", "SF Pro Display", Roboto, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, "Roboto Mono", Consolas, monospace;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --nav-h: 76px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--page); color: var(--text); }
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 18px 12px;
}
.logo {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 17px;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; transition: text-shadow 1.4s ease, color 1.4s ease; }
.brand.glow { text-shadow: 0 0 6px var(--neon-glow), 0 0 18px var(--neon-glow); color: var(--neon-core); }
.tag { margin-left: auto; color: var(--muted); font-size: 13px; }

.screen { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
}
.section-title {
  font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin: 6px 4px -4px;
}
.label { color: var(--muted); font-size: 13.5px; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin: 10px 2px 0; }
.screen > .note { margin-top: 0; }
.note.err { color: var(--bad); }
.note.okc { color: var(--ok); }

/* ---------- кольцо дней ---------- */
.hero {
  display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 18px; align-items: center;
  background: linear-gradient(160deg, var(--hero) 0%, var(--card) 60%);
}
.ring { position: relative; width: 116px; height: 116px; }
.loading .ring { border-radius: 50%; border: 9px solid var(--track); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--track); }
.ring .bar { stroke: var(--accent); transition: stroke-dashoffset 1.3s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s; }
.ring-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-num b { font-size: 32px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-num span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hero-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pill {
  align-self: flex-start;
  padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.trial { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.hero-date { font-size: 21px; font-weight: 800; letter-spacing: -0.01em; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 13px; }
.hero-meta b { color: var(--text); font-weight: 700; }
.traffic-bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.traffic-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* ---------- подписка ---------- */
.sub-head { display: flex; align-items: center; gap: 10px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: var(--bad); }
.sub-title { font-weight: 700; font-size: 16px; }
.sub-link {
  font-family: var(--mono); font-size: 12.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin: 6px 0 16px 19px;
}

/* ---------- кнопки ---------- */
.btn {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  width: 100%; padding: 15px 16px; border-radius: var(--r-md);
  font-weight: 700; font-size: 16px; border: 1px solid transparent; text-decoration: none;
  transition: transform 0.08s ease, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); font-size: 15px; }
.btn.link { background: none; color: var(--accent); padding: 6px; font-size: 14.5px; font-weight: 600; }
.btn.small { width: auto; padding: 10px 18px; font-size: 15px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }

.promo-tile {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--accent-soft); border: 1px solid transparent; border-radius: var(--r-lg);
  padding: 16px 18px;
}
.promo-tile .emoji { font-size: 30px; line-height: 1; }
.promo-tile b { display: block; color: var(--accent); font-size: 16px; }
.promo-tile span { color: var(--muted); font-size: 13px; }

/* ---------- новый клиент ---------- */
.gate, .trial { display: flex; flex-direction: column; gap: 12px; }
.gate h2, .trial h3 { margin: 0; font-size: 21px; font-weight: 800; text-wrap: balance; }
.gate p, .trial p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.trial { text-align: center; align-items: center; }
.trial p { max-width: 30ch; }
.big-emoji { font-size: 40px; line-height: 1; }
.empty-hero { text-align: center; display: flex; flex-direction: column; gap: 6px; }
.empty-hero b { font-size: 18px; }
.empty-hero span { color: var(--muted); font-size: 13.5px; }
.checks { display: flex; flex-direction: column; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; line-height: 1.4; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 1px 0 0; flex: none; }

/* ---------- тарифы ---------- */
.tariff { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; }
.tariff.featured { border-color: var(--accent); }
.tariff-text { min-width: 0; }
.tariff-name { font-size: 19px; font-weight: 800; }
.tariff-price { color: var(--muted); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tariff-price s { color: var(--faint); margin-left: 6px; font-weight: 500; }
.tariff-month { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.badge {
  margin-left: auto; padding: 4px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; white-space: nowrap;
}
.tariff .btn { margin-left: auto; flex: none; }
.tariff .badge + .btn { margin-left: 0; }

.devices { display: flex; align-items: center; gap: 12px; }
.devices-text { min-width: 0; }
.devices-text b { display: block; font-size: 16px; }
.devices-text span { color: var(--muted); font-size: 13px; }
.stepper { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--card-2); font-size: 20px; font-weight: 700;
}
.stepper button[disabled] { opacity: 0.4; }
.stepper output { min-width: 30px; text-align: center; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

.field-row { display: flex; gap: 8px; }
.input {
  flex: 1; min-width: 0;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 12px 14px; font-size: 16px;
}
.input::placeholder { color: var(--faint); }
textarea.input { width: 100%; resize: none; min-height: 120px; line-height: 1.45; }

/* ---------- профиль ---------- */
.me { display: flex; align-items: center; gap: 16px; padding: 6px 2px; }
.avatar {
  width: 72px; height: 72px; border-radius: 22px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 30px; font-weight: 800; flex: none;
}
.me-text { min-width: 0; }
.me-text b { font-size: 22px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text span { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 16px 18px; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat b { display: block; font-size: 26px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.ref-link { font-family: var(--mono); font-size: 13px; margin-top: 8px; word-break: break-all; line-height: 1.5; }
.menu { padding: 6px; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 12px; background: none; border: 0; border-radius: var(--r-sm); text-align: left;
  font-size: 15.5px; font-weight: 600;
}
.menu-item .ic { width: 24px; text-align: center; }
.menu-item .chev { margin-left: auto; color: var(--faint); }
.menu-item + .menu-item { border-top: 1px solid var(--line); border-radius: 0; }

/* ---------- нижняя навигация ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  max-width: 520px; margin: 0 auto;
  padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: var(--page);
}
.nav button {
  background: none; border: 0; border-radius: var(--r-md);
  padding: 12px 4px; font-size: 15px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.nav button i { font-style: normal; }
.nav.four { grid-template-columns: repeat(4, 1fr); gap: 4px; padding-inline: 10px; }
.nav.four button { flex-direction: column; gap: 3px; padding: 9px 2px; font-size: 12px; }
.nav.four button i { font-size: 18px; }
.nav button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }

/* ---------- шторки ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--scrim); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease;
}
.sheet {
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  background: var(--page); border-top: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 14px;
  animation: rise 0.22s ease;
}
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; flex: none; }
.sheet h2 { margin: 0; font-size: 20px; font-weight: 800; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.kv { display: flex; flex-direction: column; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.kv div:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; text-align: right; }
.kv .total b { font-size: 18px; }
.qr-box {
  align-self: center; background: var(--qr-bg); padding: 14px; border-radius: 18px;
  width: 228px; height: 228px; display: grid; place-items: center;
}
.qr-box img, .qr-box canvas { display: block; max-width: 100%; }
.counter { text-align: right; color: var(--faint); font-size: 12px; margin-top: -8px; font-variant-numeric: tabular-nums; }
.pay {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.pay:last-child { border-bottom: 0; }
.pay b { display: block; font-size: 15px; }
.pay span { color: var(--muted); font-size: 12.5px; }
.pay .pill { align-self: center; font-size: 10.5px; flex: none; }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.device-grid .btn { font-size: 14.5px; padding: 13px 10px; }
.article { color: var(--text); font-size: 14.5px; line-height: 1.55; }
.article p { color: var(--text); margin: 0 0 10px; }

/* ---------- тост ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--toast); color: var(--text); border: 1px solid var(--line);
  padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 600;
  width: max-content; max-width: calc(100% - 32px); text-align: center; z-index: 40;
  animation: toastIn 0.2s ease;
}
.toast.err { border-color: var(--bad); }

/* ---------- неоновая заставка ---------- */
.splash {
  position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(120% 80% at 50% 42%, var(--hero) 0%, var(--page) 62%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  cursor: pointer; transition: opacity 0.55s ease;
}
.splash.out { opacity: 0; pointer-events: none; }
.neon-sign {
  width: min(88vw, 380px); height: auto; overflow: visible;
  filter: drop-shadow(0 0 3px var(--neon-glow)) drop-shadow(0 0 12px var(--neon-glow)) drop-shadow(0 0 28px var(--neon-glow));
}
.neon-sign text {
  font-family: var(--font); font-weight: 800;
  fill: transparent; stroke: var(--neon); stroke-width: 1.4;
  stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1000; stroke-dashoffset: 1000;
  animation: neon-draw 0.75s ease-out forwards, neon-fill 0.45s ease-out forwards;
  animation-delay: var(--d, 0s), calc(var(--d, 0s) + 0.6s);
}
.neon-sign.probe text { animation: none; stroke: none; }
.neon-sign.lit { animation: neon-flicker 0.9s steps(1, end) 1; }
.splash-sub {
  color: var(--muted); font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  opacity: 0; transition: opacity 0.6s ease;
}
.splash-sub.on { opacity: 1; }

/* ---------- Плитка анимации «Как подключить» (сама анимация — demo.css) ---------- */
.demo-tile {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--accent);
  background: var(--accent-soft); color: var(--text);
}
.demo-tile .demo-play {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-content: center;
  background: var(--accent); color: var(--accent-ink); font-size: 14px; box-shadow: 0 0 16px var(--accent-soft);
}
.demo-tile b { display: block; font-size: 15px; }
.demo-tile small { color: var(--muted); font-size: 12.5px; }

/* ---------- Заказ и оплата переводом (pay.js) ---------- */
.order-card { display: flex; flex-direction: column; gap: 10px; border-color: var(--warn-soft); animation: rise 0.3s ease; }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.order-code { color: var(--muted); font: 600 13px var(--mono); }
.order-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.order-main b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.order-main span { color: var(--muted); font-size: 13.5px; }
.order-note { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.order-card .row2 { margin-top: 0; }

.renew { display: flex; align-items: center; gap: 12px; border-color: var(--accent); }
.renew-text { min-width: 0; }
.renew-text b { display: block; font-size: 16px; }
.renew-text span { color: var(--muted); font-size: 13px; }
.renew .btn { margin-left: auto; flex: none; }
.renew + .btn.link { margin-top: -8px; }

.pay-alert { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.pay-alert span { color: var(--text); }
.pay-sum { display: grid; justify-items: center; gap: 2px; padding: 16px; border-radius: var(--r-md); background: var(--hero); }
.pay-sum span, .pay-sum small { color: var(--muted); font-size: 13px; }
.pay-sum b { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; text-shadow: 0 0 18px var(--accent-soft); }
.pay-steps { flex: none; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pay-step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; position: relative; padding-bottom: 18px; }
.pay-step:last-child { padding-bottom: 0; }
.pay-step:not(:last-child)::before { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 4px; width: 1px; background: var(--line); }
.pay-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }
.pay-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pay-body > b { font-size: 15.5px; line-height: 28px; }
.pay-hint { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.pay-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px; border-radius: var(--r-sm); border: 1px solid var(--accent);
  background: var(--card-2); box-shadow: 0 0 18px var(--accent-soft);
}
.pay-card span { font: 700 15px var(--mono); letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pay-card em { flex: none; }
.pay-card em { font-style: normal; color: var(--accent); font-size: 13.5px; font-weight: 600; }
.pay-card:active { transform: scale(0.98); }
.pay-drop {
  display: grid; place-items: center; min-height: 92px; border-radius: var(--r-sm);
  border: 1.5px dashed var(--line); background: var(--card-2); cursor: pointer; overflow: hidden;
  transition: border-color 0.2s;
}
.pay-drop:active { border-color: var(--accent); }
.pay-drop-empty { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: 15px; }
.pay-drop.filled { border-style: solid; border-color: var(--ok); min-height: 0; }
.pay-drop.filled .pay-drop-empty { display: none; }
.pay-drop img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #fff; animation: fade 0.25s ease; }
.pay-drop.busy { opacity: 0.6; pointer-events: none; }
.pay-banks { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-banks button {
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card-2); font-size: 13.5px; font-weight: 600; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pay-banks button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pay-done { display: grid; place-items: center; padding-top: 6px; }
.pay-done svg { width: 72px; height: 72px; fill: none; stroke: var(--ok); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 10px var(--ok-soft)); }
.pay-done circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.6s ease forwards; }
.pay-done path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw 0.35s 0.5s ease forwards; }
.pay-done-ic { font-size: 54px; line-height: 1; }
.sheet .pay-done + h2, .sheet .pay-done ~ p { text-align: center; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@keyframes neon-draw { to { stroke-dashoffset: 0; } }
@keyframes neon-fill { to { fill: var(--neon-core); stroke: var(--neon-core); } }
@keyframes neon-flicker {
  0% { opacity: 1; } 10% { opacity: 0.35; } 14% { opacity: 1; } 22% { opacity: 0.55; }
  26% { opacity: 1; } 60% { opacity: 0.85; } 64% { opacity: 1; } 100% { opacity: 1; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

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