/*
 * «Панда Гейт» — оформление страницы выдачи ключей (Telegram Mini App).
 * Стиль по образцу официального сайта AmneziaVPN: тёмная база, чистая типографика,
 * акцентный градиент, крупная главная кнопка. Переменные --tg-* задаёт app.js из
 * WebApp.themeParams (уважаем тему Telegram), значения ниже — безопасные дефолты.
 */

:root {
  --bg: #0f1216;
  --bg-elev: #171b22;
  --bg-card: #1d222b;
  --text: #eef2f7;
  --text-dim: #9aa4b2;
  --accent: #35c98a; /* фирменная зелень Amnezia-подобной палитры */
  --accent-2: #2aa3ff;
  --danger: #ff6b6b;
  --border: #262c36;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --maxw: 560px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ── Брендинг ─────────────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px 20px;
}

.brand__logo {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 4px 12px rgba(53, 201, 138, 0.35));
}

.brand__title {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-dim);
}

.brand__for {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-dim);
}

.brand__email {
  color: var(--text);
  font-weight: 600;
  word-break: break-all;
}

/* ── Таймер ───────────────────────────────────────────────── */
.timer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.timer__label {
  font-size: 13px;
  color: var(--text-dim);
}

.timer__value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.timer.timer--soon .timer__value {
  color: var(--danger);
}

/* ── Секции состояния ─────────────────────────────────────── */
.state {
  text-align: center;
  padding: 40px 16px;
}

.state__icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.state__text {
  color: var(--text-dim);
  font-size: 15px;
  margin: 0;
}

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Секции контента ──────────────────────────────────────── */
.content > section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
}

.section__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.section__hint {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-dim);
}

/* ── Главная секция .backup ───────────────────────────────── */
.backup {
  background: linear-gradient(160deg, rgba(53, 201, 138, 0.12), rgba(42, 163, 255, 0.08)) !important;
  border-color: rgba(53, 201, 138, 0.35) !important;
}

/* ── Кнопки ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn__icon {
  font-size: 18px;
}

.btn--primary {
  background: linear-gradient(120deg, var(--accent), #2fbf9c);
  color: #06231a;
  box-shadow: 0 8px 22px rgba(53, 201, 138, 0.3);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ── QR по странам ────────────────────────────────────────── */
.qr__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.qr-card__country {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}

.qr-card__img {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  object-fit: contain;
  display: block;
  margin: 0 auto 10px;
}

.qr-card__link {
  font-size: 13px;
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 600;
}

/* ── Фолбэк ───────────────────────────────────────────────── */
.fallback__result {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--accent);
  text-align: center;
}

/* ── Инструкции ───────────────────────────────────────────── */
.guide__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 460px) {
  .guide__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.guide__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.guide__os {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

.guide__steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-dim);
}

.guide__steps li {
  margin-bottom: 4px;
}

.guide__steps b {
  color: var(--text);
}

.server-instructions {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 0 8px;
}

/* ── Заглушка (expired.html) ──────────────────────────────── */
.expired {
  text-align: center;
  padding: 48px 16px;
}

.expired__icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.expired__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 10px;
}

.expired__text {
  color: var(--text-dim);
  font-size: 15px;
  margin: 0 auto 28px;
  max-width: 380px;
}

.expired__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 360px;
  margin: 0 auto;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border-radius: var(--radius-sm);
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.link-btn:active {
  transform: scale(0.98);
}

.link-btn--vk {
  background: #4a76a8;
  color: #fff;
}

.link-btn--tg {
  background: #2aa3ff;
  color: #fff;
}

/* ── Футер ────────────────────────────────────────────────── */
.footer {
  margin-top: 24px;
  text-align: center;
}

.footer p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}
