/* ShadowVPN — личный кабинет. Один и тот же интерфейс работает:
   - как Telegram Mini App (цвета берутся из темы Telegram, см. applyTheme в app.js),
   - как обычный сайт в браузере (своя палитра, светлая/тёмная по системе).
   Mobile-first: на телефоне — нижняя панель вкладок, от 900px — боковое меню. */

:root {
  --bg: #f2f2f7;
  --bg-2: #ffffff;
  --bg-3: #f2f2f7;
  --text: #0b0b0f;
  --hint: #8a8a8e;
  --sep: rgba(60, 60, 67, .14);
  --accent: #3478f6;
  --accent-text: #ffffff;
  --accent-soft: rgba(52, 120, 246, .12);
  --green: #1fae5b;
  --green-soft: rgba(31, 174, 91, .13);
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, .12);
  --amber: #d98a00;
  --amber-soft: rgba(217, 138, 0, .13);
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 24px -12px rgba(0, 0, 0, .18);
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-2: #1c1c1e;
    --bg-3: #2c2c2e;
    --text: #f5f5f7;
    --hint: #8d8d93;
    --sep: rgba(84, 84, 88, .45);
    --accent: #4f8cff;
    --accent-soft: rgba(79, 140, 255, .16);
    --green: #32d174;
    --green-soft: rgba(50, 209, 116, .15);
    --red: #ff6369;
    --red-soft: rgba(255, 99, 105, .15);
    --amber: #ffb224;
    --amber-soft: rgba(255, 178, 36, .15);
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #1c1c1e; --bg-3: #2c2c2e; --text: #f5f5f7; --hint: #8d8d93;
  --sep: rgba(84, 84, 88, .45); --accent: #4f8cff; --accent-soft: rgba(79, 140, 255, .16);
  --green: #32d174; --green-soft: rgba(50, 209, 116, .15); --red: #ff6369; --red-soft: rgba(255, 99, 105, .15);
  --amber: #ffb224; --amber-soft: rgba(255, 178, 36, .15); --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.35; min-height: 100vh; overflow-x: hidden;
  -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
svg.i { width: 22px; height: 22px; flex: none; }
/* Стрелка «→» в строках/карточках — размер задаём глобально, а не только
   внутри .item: иначе в других контейнерах SVG растягивался на всю ширину. */
svg.chev { width: 18px; height: 18px; flex: none; color: var(--hint); opacity: .55; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--hint); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Каркас ─────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 12px 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); max-width: 720px; margin: 0 auto; width: 100%; }
.screen { animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .sheet, .toast { animation: none !important; transition: none !important; } }

.topbar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.topbar .back { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-size: 17px; background: none; border: none; padding: 8px 8px 8px 0; cursor: pointer; }
.topbar .back svg { width: 22px; height: 22px; }
.page-title { font-size: 28px; font-weight: 750; letter-spacing: -.4px; margin: 4px 0 14px; }
.page-sub { color: var(--hint); font-size: 14px; margin: -8px 0 16px; }
body.tg .topbar .back { display: none; } /* в Telegram — системная кнопка «Назад» */
/* Полноэкранный Telegram: сверху поверх контента лежат статус-бар и кнопки
   Telegram (закрыть/меню) — SDK отдаёт их высоту CSS-переменными. */
body.tg { --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)); }
body.tg-fullscreen .main { padding-top: calc(12px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
body.tg-fullscreen .toast-wrap { top: calc(10px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
body.tg-fullscreen .login, body.tg-fullscreen .boot { padding-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }

/* Нижняя панель (телефон) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg-2) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: .5px solid var(--sep);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; color: var(--hint); font-size: 10.5px; font-weight: 600; cursor: pointer; padding: 6px 0 0; }
.tab svg { width: 25px; height: 25px; }
.tab.active { color: var(--accent); }

/* Боковое меню (десктоп) */
.sidebar { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .main { padding: 28px 32px 48px; }
  .sidebar {
    display: flex; flex-direction: column; width: 260px; flex: none; position: sticky; top: 0; height: 100vh;
    padding: 20px 14px; background: var(--bg-2); border-right: .5px solid var(--sep);
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 750; font-size: 17px; }
  .sidebar .nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
  .sidebar .nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: none; border: none;
    color: var(--text); font-size: 15px; font-weight: 550; cursor: pointer; text-align: left; }
  .sidebar .nav-item svg { width: 21px; height: 21px; color: var(--hint); }
  .sidebar .nav-item:hover { background: var(--bg-3); }
  .sidebar .nav-item.active { background: var(--accent-soft); color: var(--accent); }
  .sidebar .nav-item.active svg { color: var(--accent); }
  .sidebar .nav-sep { height: .5px; background: var(--sep); margin: 10px 8px; }
  .sidebar .side-balance { margin: 0 4px 16px; padding: 14px; border-radius: var(--radius); background: var(--bg-3); }
}
.logo { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #5b8cff, #3452d6); }
.logo svg { width: 18px; height: 18px; }

/* ─── Карточки и сгруппированные списки ─────────────────────────────── */
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); font-weight: 600; margin: 22px 16px 7px; }
.section-title:first-child { margin-top: 4px; }
.section-foot { font-size: 13px; color: var(--hint); margin: 7px 16px 0; line-height: 1.4; }
.card { background: var(--bg-2); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.list { background: var(--bg-2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 52px; position: relative;
  background: none; border: none; width: 100%; text-align: left; color: var(--text); font-size: 16px;
}
.item + .item::before { content: ""; pointer-events: none; position: absolute; top: 0; right: 0; left: 16px; height: .5px; background: var(--sep); }
.item.with-icon + .item::before, .item.with-icon + .item.with-icon::before { left: 58px; }
button.item, a.item, .item.tap { cursor: pointer; }
button.item:active, a.item:active, .item.tap:active { background: var(--bg-3); }
.item .title { font-weight: 500; }
.item .sub { color: var(--hint); font-size: 13.5px; margin-top: 2px; }
.item .value { color: var(--hint); font-size: 15px; white-space: nowrap; }
.item .chev { color: var(--hint); opacity: .55; width: 18px; height: 18px; flex: none; }
.item.danger .title { color: var(--red); }
.item.accent .title { color: var(--accent); }
.ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; background: var(--accent); }
.ico svg { width: 19px; height: 19px; }
.ico.green { background: #34c759; } .ico.orange { background: #ff9500; } .ico.red { background: #ff3b30; }
.ico.purple { background: #af52de; } .ico.teal { background: #30b0c7; } .ico.gray { background: #8e8e93; }
.ico.indigo { background: #5856d6; } .ico.pink { background: #ff2d55; }
.ico.soft { background: var(--accent-soft); color: var(--accent); }

/* ─── Кнопки ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 600; padding: 13px 18px; border-radius: 16px; min-height: 50px;
  background: var(--accent); color: var(--accent-text); transition: opacity .15s, transform .1s; text-decoration: none;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.plain { background: var(--bg-3); color: var(--text); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 20px; height: 20px; }
.btn-row { display: flex; gap: 10px; }
/* min-width: 0 — иначе кнопки не сжимаются меньше ширины текста и на узком
   экране последняя уезжает за край карточки. */
.btn-row > .btn { flex: 1 1 0; min-width: 0; padding-left: 10px; padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Главная: баланс ────────────────────────────────────────────────── */
.hero {
  border-radius: 22px; padding: 18px 18px 16px; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #6d8bff 0%, #3b5bdb 45%, #26379c 100%);
  box-shadow: 0 12px 32px -16px rgba(40, 70, 200, .6);
}
/* Декоративный круг — под содержимым и «прозрачен» для нажатий: раньше он
   лежал поверх кнопки «Купить ключ» и съедал клики по её правой части. */
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; right: -70px; bottom: -110px; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none; z-index: 0; }
.hero > * { position: relative; z-index: 1; }
.hero > .user { position: absolute; }
.hero .label { opacity: .8; font-size: 14px; font-weight: 500; }
.hero .amount { font-size: clamp(28px, 9vw, 40px); font-weight: 750; letter-spacing: -1px; margin: 2px 0 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .btn-row .btn { white-space: nowrap; font-size: 15px; padding: 12px 10px; }
.hero .amount small { font-size: 22px; font-weight: 600; opacity: .8; margin-left: 4px; }
.hero .btn { background: rgba(255,255,255,.95); color: #2442b8; }
.hero .btn.ghost { background: rgba(255,255,255,.16); color: #fff; }
.hero .user { position: absolute; top: 16px; right: 16px; font-size: 13px; opacity: .85; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { background: var(--bg-2); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); cursor: pointer; border: none; text-align: left; color: var(--text); }
.stat .n { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12.5px; color: var(--hint); margin-top: 2px; }

/* ─── Баннеры / плашки ───────────────────────────────────────────────── */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: var(--radius); font-size: 14.5px; line-height: 1.4; }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner.info { background: var(--accent-soft); color: var(--text); } .banner.info svg { color: var(--accent); }
.banner.warn { background: var(--amber-soft); } .banner.warn svg { color: var(--amber); }
.banner.danger { background: var(--red-soft); } .banner.danger svg { color: var(--red); }
.banner.success { background: var(--green-soft); } .banner.success svg { color: var(--green); }
.banner .actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.gray { background: var(--bg-3); color: var(--hint); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }

/* ─── Сегменты, чипы ─────────────────────────────────────────────────── */
.segmented { display: flex; background: var(--bg-3); border-radius: 14px; padding: 4px; gap: 2px; position: relative; }
.segmented button { flex: 1; border: none; background: none; color: var(--text); font-size: 14px; font-weight: 600; padding: 9px 6px; border-radius: 11px; cursor: pointer; position: relative; z-index: 1; transition: color .2s; }
.segmented button.active { background: var(--bg-2); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="dark"] .segmented button.active { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button.active { background: #636366; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--sep); background: var(--bg-2); color: var(--text); padding: 9px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Выбор варианта (тариф, сервер, способ оплаты) */
.options { display: grid; gap: 10px; }
.options.two { grid-template-columns: 1fr 1fr; }
.option { border: 2px solid transparent; background: var(--bg-2); border-radius: var(--radius); padding: 14px; cursor: pointer; text-align: left; color: var(--text); box-shadow: var(--shadow); position: relative; }
.option.active { border-color: var(--accent); }
.option .o-title { font-weight: 650; }
.option .o-sub { color: var(--hint); font-size: 13.5px; margin-top: 3px; }
.option .o-price { font-size: 20px; font-weight: 700; margin-top: 6px; }
.option .badge-corner { position: absolute; top: -8px; right: 10px; }
.option:disabled { opacity: .45; cursor: default; }

/* ─── Поля ввода ─────────────────────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: 12px; }
.field .lbl { display: block; font-size: 13px; color: var(--hint); margin: 0 4px 6px; font-weight: 500; }
.input, textarea.input, select.input {
  width: 100%; border: 1.5px solid transparent; background: var(--bg-3); color: var(--text);
  font-size: 16px; font-family: inherit; padding: 12px 14px; border-radius: 12px; outline: none;
}
.card .input { background: var(--bg-3); }
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }
.input-amount { font-size: 30px; font-weight: 700; text-align: center; padding: 14px; }
.input-row { display: flex; gap: 8px; }
.input-row .input { flex: 1; min-width: 0; }
.hint-err { color: var(--red); font-size: 13.5px; margin: 8px 4px 0; min-height: 0; }
.hint-ok { color: var(--green); font-size: 13.5px; margin: 8px 4px 0; }

/* Переключатель (iOS switch) */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: var(--bg-3); border-radius: 999px; transition: background .2s; cursor: pointer; box-shadow: inset 0 0 0 1px var(--sep); }
.switch .track::after { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 2px 5px rgba(0,0,0,.25); }
.switch input:checked + .track { background: #34c759; box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:disabled + .track { opacity: .5; cursor: default; }

/* ─── Ключ доступа ───────────────────────────────────────────────────── */
.keybox { background: var(--bg-3); border-radius: 12px; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; line-height: 1.45; max-height: 120px; overflow: auto; user-select: all; }
.qr { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 16px; width: fit-content; margin: 0 auto; }
.qr { padding: 10px; }
.qr canvas, .qr img { display: block; width: min(300px, 76vw); height: auto; image-rendering: pixelated; }

.key-head { display: flex; align-items: center; gap: 14px; }
.key-head .big-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; flex: none; }
.key-head .big-ico svg { width: 28px; height: 28px; }
.progress { height: 6px; background: var(--bg-3); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress.warn > div { background: var(--amber); } .progress.bad > div { background: var(--red); }

/* ─── Bottom sheet ───────────────────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; opacity: 0; transition: opacity .2s; }
.backdrop.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--bg); color: var(--text);
  border-radius: 18px 18px 0 0; padding: 8px 16px calc(18px + var(--safe-b)); max-height: 88vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.sheet.show { transform: none; }
.sheet .grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 2px auto 12px; }
.sheet h3 { font-size: 20px; font-weight: 700; margin-bottom: 6px; text-align: center; }
.sheet .sheet-text { color: var(--hint); text-align: center; font-size: 15px; margin-bottom: 16px; line-height: 1.45; }
@media (min-width: 640px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: 440px; border-radius: 20px; transform: translate(-50%, 60%); opacity: 0; transition: transform .2s, opacity .2s; padding-bottom: 20px; }
  .sheet.show { transform: translate(-50%, 50%); opacity: 1; }
  .sheet .grabber { display: none; }
}

/* ─── Тосты ──────────────────────────────────────────────────────────── */
.toast-wrap { position: fixed; left: 0; right: 0; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: rgba(30, 30, 32, .94); color: #fff; padding: 11px 16px; border-radius: 14px; font-size: 14.5px; font-weight: 500; max-width: 440px;
  display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 28px rgba(0,0,0,.25); animation: toast-in .22s ease-out; }
.toast svg { width: 19px; height: 19px; flex: none; }
.toast.ok svg { color: #32d174; } .toast.err svg { color: #ff6369; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ─── Скелетоны / пустые состояния ───────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-2) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 52px; margin-bottom: 1px; }
.empty-state { text-align: center; padding: 34px 20px; color: var(--hint); }
.empty-state .e-ico { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-state .e-ico svg { width: 32px; height: 32px; }
.empty-state .e-title { color: var(--text); font-weight: 650; font-size: 17px; margin-bottom: 4px; }

/* ─── Шаги (установка, оплата) ───────────────────────────────────────── */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--hint); }
.step .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-3); flex: none; }
.step.done { color: var(--text); } .step.done .dot { background: var(--green); color: #fff; }
.step.now { color: var(--text); font-weight: 600; } .step.now .dot { background: var(--accent-soft); color: var(--accent); }
.step .dot svg { width: 14px; height: 14px; }

/* ─── Вход ───────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 20px; }
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-box .logo { width: 76px; height: 76px; border-radius: 22px; margin: 0 auto 18px; }
.login-box .logo svg { width: 40px; height: 40px; }
.login-box h1 { font-size: 26px; font-weight: 750; margin-bottom: 8px; }
.login-box p { color: var(--hint); font-size: 15px; line-height: 1.45; margin-bottom: 22px; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--hint); }

/* ─── Мелочи ─────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 15px; }
.kv .k { color: var(--hint); } .kv .v { text-align: right; font-weight: 500; word-break: break-word; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 90px; margin-top: 12px; }
.chart .bar { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; position: relative; }
.chart .bar:hover { opacity: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric { background: var(--bg-2); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.metric .n { font-size: 22px; font-weight: 700; } .metric .l { font-size: 12.5px; color: var(--hint); margin-top: 2px; }
.metric.tap { cursor: pointer; border: none; text-align: left; color: var(--text); font: inherit; }
.html-block { font-size: 14.5px; line-height: 1.5; }
.html-block blockquote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.html-block code, code { font-family: var(--mono); font-size: 13px; background: var(--bg-3); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
pre.code { font-family: var(--mono); font-size: 12.5px; background: var(--bg-3); padding: 12px; border-radius: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.load-more { margin-top: 10px; }
.admin-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; margin-left: auto; }

/* ═══ Анимации и «живые» компоненты ═══════════════════════════════════ */
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes shine { 0% { transform: translateX(-120%) skewX(-20deg); } 55%, 100% { transform: translateX(260%) skewX(-20deg); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-4deg); } }
@keyframes fill { from { width: 0; } }
.stagger > * { animation: rise .42s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms); }

/* Отклик на нажатие — лёгкое «вдавливание», как у нативных кнопок. */
.item, .option, .key-tile, .cta, .stat, .metric.tap { transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .2s, border-color .2s, background .2s; }
button.item:active, .option:active, .key-tile:active, .cta:active, .stat:active { transform: scale(.975); }

/* Сегменты со скользящей подложкой */
.segmented .thumb { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 11px; background: var(--bg-2);
  box-shadow: 0 2px 8px rgba(0,0,0,.14); transition: transform .32s cubic-bezier(.3,1.3,.5,1), width .32s cubic-bezier(.2,.8,.2,1); z-index: 0; }
.segmented.has-thumb button.active { background: transparent; box-shadow: none; }
.segmented.big { border-radius: 16px; }
.segmented.big button { padding: 11px 8px; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.segmented.big button svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .segmented .thumb { background: #3a3a3c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented .thumb { background: #3a3a3c; } }

/* CTA «Новый ключ» */
.cta { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; width: 100%; border: none; cursor: pointer;
  text-align: left; color: #fff; padding: 18px; border-radius: var(--radius-lg); margin-bottom: 18px;
  background: linear-gradient(135deg, var(--c1, #6d5dfc), var(--c2, #3b5bdb)); box-shadow: 0 14px 30px -16px var(--c2, #3b5bdb); }
.cta.awg { --c1: #22c3b6; --c2: #1479d6; }
.cta.outline { --c1: #7b61ff; --c2: #3b4fd8; }
.cta::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent); animation: shine 3.6s ease-in-out infinite; }
.cta .plus { width: 48px; height: 48px; border-radius: 16px; background: rgba(255,255,255,.22); display: grid; place-items: center; flex: none;
  backdrop-filter: blur(4px); animation: float 3s ease-in-out infinite; }
.cta .plus svg { width: 26px; height: 26px; stroke-width: 2.4; }
.cta .t1 { font-size: 18px; font-weight: 750; letter-spacing: -.2px; }
.cta .t2 { font-size: 13.5px; opacity: .88; margin-top: 3px; }
.cta .arrow { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
.cta .arrow svg { width: 18px; height: 18px; }

/* Карточка ключа в списке */
.key-list { display: flex; flex-direction: column; gap: 10px; }
.key-tile { display: block; width: 100%; border: none; cursor: pointer; text-align: left; color: var(--text); background: var(--bg-2);
  border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.key-tile .top { display: flex; align-items: center; gap: 12px; }
.key-tile .kicon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; font-size: 22px; }
.key-tile .kicon svg { width: 22px; height: 22px; }
.key-tile .name { font-weight: 650; font-size: 16px; }
.key-tile .meta { color: var(--hint); font-size: 13px; margin-top: 2px; }
.key-tile .bar { height: 5px; border-radius: 999px; background: var(--bg-3); margin-top: 12px; overflow: hidden; }
.key-tile .bar > div { height: 100%; border-radius: 999px; background: var(--green); animation: fill .9s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 45ms + 150ms); }
.key-tile .bar.warn > div { background: var(--amber); } .key-tile .bar.bad > div { background: var(--red); }
.key-tile.dim { opacity: .62; }

/* Выбор сервера/срока при покупке */
.srv-card { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px; }
.srv-card .flag { width: 46px; height: 46px; border-radius: 15px; background: var(--bg-3); display: grid; place-items: center; font-size: 26px; flex: none; }
.srv-card .info { flex: 1; min-width: 0; }
.chip-ping { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; }
.chip-ping::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ping.good { color: var(--green); background: var(--green-soft); } .chip-ping.mid { color: var(--amber); background: var(--amber-soft); }
.chip-ping.bad { color: var(--red); background: var(--red-soft); } .chip-ping.none { color: var(--hint); background: var(--bg-3); }
.load { height: 4px; border-radius: 999px; background: var(--bg-3); margin-top: 8px; overflow: hidden; }
.load > div { height: 100%; border-radius: 999px; background: var(--accent); animation: fill 1s cubic-bezier(.2,.8,.2,1) both; }
.option .tick { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff;
  display: none; place-items: center; }
.option .tick svg { width: 15px; height: 15px; stroke-width: 3; }
.option.active .tick { display: grid; animation: pop .35s cubic-bezier(.2,.8,.2,1); }
.option.active { box-shadow: 0 0 0 1px var(--accent), 0 10px 26px -14px var(--accent); }
.term { padding: 18px 14px; text-align: center; }
.term .o-title { font-size: 15px; }
.term .o-price { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 6px; }
.term .per { color: var(--hint); font-size: 12.5px; margin-top: 2px; }
.term .badge-corner { top: -10px; right: 50%; transform: translateX(50%); }

/* Нижняя панель оплаты (над таб-баром) */
.paybar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); z-index: 20; margin-top: 22px;
  background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg); padding: 14px; box-shadow: 0 12px 34px -12px rgba(0,0,0,.35); animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.paybar .sum { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.paybar .sum .v { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
@media (min-width: 900px) { .paybar { bottom: 16px; } }

/* Логотипы приложений */
.app-ico { width: 100%; height: 100%; border-radius: 28%; display: block; object-fit: cover; }
.seg-ico { width: 20px; height: 20px; border-radius: 6px; flex: none; }
.key-tile .kicon { background: none; box-shadow: 0 4px 12px -4px rgba(0,0,0,.35); border-radius: 14px; overflow: hidden; }
.key-head .big-ico { overflow: hidden; border-radius: 15px; box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); }
.flag-inline { margin-right: 6px; }
.cta .plus { background: none; position: relative; backdrop-filter: none; }
.cta .plus .app-ico { box-shadow: 0 6px 16px -4px rgba(0,0,0,.35); }
.cta .plus-badge { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--c2);
  display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.cta .plus-badge svg { width: 14px; height: 14px; stroke-width: 3; }
.guide-link { display: flex; align-items: center; gap: 12px; width: 100%; border: none; background: var(--bg-2); color: var(--text); text-align: left;
  border-radius: var(--radius); padding: 12px 14px; margin: -6px 0 18px; cursor: pointer; box-shadow: var(--shadow); }
.guide-link .gi { width: 36px; height: 36px; flex: none; }
.guide-link .grow { min-width: 0; }
.guide-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }
.guide-step + .guide-step { border-top: .5px solid var(--sep); }
.guide-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 750; display: grid; place-items: center; flex: none; font-size: 14px; }
.guide-step .tx { font-size: 15px; line-height: 1.45; padding-top: 3px; }
.dl-card { display: flex; align-items: center; gap: 12px; }
.dl-card .gi { width: 52px; height: 52px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .stagger > *, .cta::after, .cta .plus, .key-tile .bar > div, .load > div, .option.active .tick, .paybar { animation: none !important; }
  .segmented .thumb { transition: none; }
}
