/* VEIL VPN — Telegram Mini App
   Дизайн: используем нативные цветовые переменные Telegram (адаптация под
   светлую/тёмную тему пользователя), поверх — собственный акцент: тёмный
   индигово-фиолетовый «покров» (veil) с медленным переливом за карточкой
   статуса. Цифры (цена, сроки, устройства) — моноширинным начертанием,
   для ощущения технологичности инструмента. */

:root {
  --bg: var(--tg-theme-bg-color, #17151f);
  --bg-secondary: var(--tg-theme-secondary-bg-color, #211e2c);
  --text: var(--tg-theme-text-color, #f2f0f8);
  --hint: var(--tg-theme-hint-color, #8b87a0);
  --button: var(--tg-theme-button-color, #6c5ce7);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --section-bg: var(--tg-theme-section-bg-color, #1c1926);
  --link: var(--tg-theme-link-color, #9d8cff);
  --destructive: var(--tg-theme-destructive-text-color, #ff6b6b);

  --veil-1: #6c5ce7;
  --veil-2: #2e1f63;
  --veil-3: #b794f6;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: 108px; /* место под нижнюю панель CTA */
}

.veil-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--veil-3);
  margin: 0 0 6px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
}

.brand-lockup .eyebrow {
  margin: 0;
}

.brand-logo {
  height: 16px;
  width: auto;
  /* Логотип — чёрная заливка на прозрачном фоне; инвертируем в белый,
     чтобы был виден на тёмном/цветном фоне карточки статуса. */
  filter: invert(1);
  display: block;
}

/* --- Карточка статуса подписки --- */
.status-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 22px 20px;
  min-height: 120px;
  isolation: isolate;
}

.status-card__veil {
  position: absolute;
  inset: -40%;
  z-index: -1;
  background: conic-gradient(from 0deg, var(--veil-2), var(--veil-1), var(--veil-3), var(--veil-2));
  filter: blur(38px) saturate(120%);
  opacity: 0.85;
  animation: veil-drift 22s linear infinite;
}

@keyframes veil-drift {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .status-card__veil { animation: none; }
}

.status-card__content { position: relative; }

.status-card__loading { color: rgba(255,255,255,0.75); font-size: 14px; }

.status-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #ffffff;
}

.status-sub {
  font-size: 14px;
  color: rgba(255,255,255,0.82);
  margin: 0 0 14px;
}

.status-days {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1;
}

.status-days__label {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-left: 8px;
}

.status-link-row {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0,0,0,0.28);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.status-link-row code {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-link-row button {
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.16);
  color: #fff;
  cursor: pointer;
}

.trial-btn {
  margin-top: 16px;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  background: #ffffff;
  color: var(--veil-2);
  cursor: pointer;
}

/* --- Секции --- */
.section__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--text);
}

.section--muted {
  background: var(--section-bg);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.hint { color: var(--hint); font-size: 13px; margin: 0 0 12px; }

/* --- Тарифы --- */
.tariff-list { display: flex; flex-direction: column; gap: 8px; }

.tariff-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--section-bg);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.tariff-card:focus-visible,
.stepper__btn:focus-visible,
.btn:focus-visible,
.trial-btn:focus-visible {
  outline: 2px solid var(--veil-3);
  outline-offset: 2px;
}

.tariff-card--selected {
  border-color: var(--button);
  background: color-mix(in srgb, var(--button) 14%, var(--section-bg));
}

.tariff-card__name { font-weight: 600; font-size: 14px; }
.tariff-card__days { font-size: 12px; color: var(--hint); margin-top: 2px; }
.tariff-card__price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

/* --- Степпер устройств --- */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: var(--section-bg);
  border-radius: var(--radius-md);
  padding: 14px;
}

.stepper__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--button);
  color: var(--button-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.stepper__btn:disabled { opacity: 0.35; cursor: default; }

.stepper__value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  min-width: 2ch;
  text-align: center;
}

/* --- Разбивка цены --- */
.price-breakdown {
  background: var(--section-bg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
}

.price-line {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--hint);
}

.price-line--total {
  color: var(--text);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 6px;
  padding-top: 10px;
}

/* --- Реферальная ссылка --- */
.link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.link-row__text {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-row__copy {
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--button);
  color: var(--button-text);
  cursor: pointer;
}

/* --- Нижняя панель оплаты --- */
.cta-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-secondary);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cta-bar__price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  text-align: center;
}

.cta-bar__buttons { display: flex; flex-direction: column; gap: 8px; }

.btn {
  flex: none;
  width: 100%;
  border: none;
  border-radius: var(--radius-md);
  padding: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn--primary { background: var(--button); color: var(--button-text); }
.btn--secondary { background: rgba(255,255,255,0.94); color: var(--veil-2); }

.error-banner {
  background: color-mix(in srgb, var(--destructive) 16%, transparent);
  color: var(--destructive);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
}
