/* ==========================================================================
   DreamVPN — компоненты. Подключать после tokens.css.
   Правила:
   1. Синяя кнопка — главное действие экрана. Вторая — белая с серой рамкой
      или серая заливка («Выбрать»).
   2. Градиент — только в главном заголовке первого экрана.
   3. Зелёный — «работает», скидки и галочки. Оранжевый и красный — статусы.
   4. Надзаголовки секций — синие, капсом, с разрядкой (как на happ.so).
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* — Текст — */
.h-hero { font: 800 var(--t-hero)/1.04 var(--font); letter-spacing: -0.063em; text-wrap: balance; }
.h2 { font: 800 var(--t-h2)/1.08 var(--font); letter-spacing: -0.05em; text-wrap: balance; }
.h3 { font: 800 var(--t-h3)/1.3 var(--font); letter-spacing: -0.016em; }
.h-screen { font: 800 clamp(28px, 6vw, 40px)/1.1 var(--font); letter-spacing: -0.045em; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: var(--t-lead); line-height: 1.55; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); }
.small { font-size: var(--t-small); line-height: 1.5; }
.micro { font-size: var(--t-micro); line-height: 1.45; color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font: 800 var(--t-eyebrow)/1.3 var(--font); letter-spacing: 2px; text-transform: uppercase; color: var(--brand); }
.link { color: var(--brand); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* — Знак: чёрный квадрат с полумесяцем — */
.logo { width: var(--logo, 40px); height: var(--logo, 40px); flex: none; }
.logo__bg { fill: var(--logo-bg, #0F1116); }
.logo__fg { fill: var(--logo-fg, #FFFFFF); }
.logo__st { fill: none; stroke: var(--logo-fg, #FFFFFF); stroke-width: 3.2; stroke-linecap: round; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand__text { display: grid; line-height: 1.15; }
.brand__name { font: 800 18px/1.1 var(--font); letter-spacing: -0.02em; }
.brand__sub { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }

/* — Кнопки — */
.btn {
  --h: var(--tap);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h); padding: 0 24px;
  border: 1.5px solid transparent; border-radius: var(--r-m);
  background: var(--fill); color: var(--ink);
  font: 700 16px/1.1 var(--font);
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.btn:active { transform: scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn--brand { background: var(--brand); color: #fff; font-weight: 800; box-shadow: var(--brand-glow); }
.btn--brand:hover { background: var(--brand-press); }
.btn--white { background: var(--paper); border-color: var(--line-strong); }
.btn--white:hover { border-color: var(--ink-3); }
.btn--fill:hover { background: color-mix(in srgb, var(--fill) 70%, var(--ink) 6%); }
.btn--ghost { background: transparent; padding: 0 12px; color: var(--ink-2); font-weight: 600; }
.btn--ghost:hover { color: var(--ink); }
.btn--danger { background: transparent; color: var(--stop); padding: 0 10px; font-weight: 600; }
.btn--on-brand { background: #fff; color: var(--brand); font-weight: 800; box-shadow: 0 8px 26px rgba(0, 0, 0, .14); }
.btn--glass { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .32); }
.btn--glass:hover { background: rgba(255, 255, 255, .22); }
.btn--lg { --h: 58px; font-size: 17px; padding: 0 40px; }
.btn--sm { --h: 40px; font-size: 14px; padding: 0 16px; border-radius: 12px; }
.btn--pill { border-radius: var(--r-pill); }
.btn--block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn[aria-busy="true"] { color: transparent !important; position: relative; pointer-events: none; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid #fff; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* — Чипы и метки — */
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px;
  border-radius: var(--r-pill); font-size: 14px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--ink-2); border: 1px solid transparent;
}
.chip--go { background: #EAF8EE; color: #1A6B33; border-color: rgba(52, 199, 89, .3); }
.chip--go::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--go-dot); box-shadow: 0 0 0 3px rgba(52, 199, 89, .18); }
.chip--brand { background: var(--brand-soft); color: var(--brand-ink); border-color: var(--brand-line); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.status {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: var(--r-pill); font-size: 13px; font-weight: 700; white-space: nowrap;
  background: var(--fill); color: var(--ink-2);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status--go { background: var(--go-soft); color: var(--go); }
.status--warn { background: var(--warn-soft); color: var(--warn); }
.status--stop { background: var(--stop-soft); color: var(--stop); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: var(--r-pill); font: 800 10px/1 var(--font); letter-spacing: .5px; text-transform: uppercase; background: var(--brand); color: #fff; white-space: nowrap; }
.badge--trial { background: var(--go-soft); color: var(--go); text-transform: none; letter-spacing: 0; font-size: 11px; border: 1px solid rgba(52, 199, 89, .3); }
.disc { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font: 800 11px/1 var(--font); background: var(--go-soft); color: var(--go); white-space: nowrap; }

/* — Карточки — */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 24px; }
.card--night { background: var(--night); color: var(--night-ink); border-color: transparent; }
.card--night .eyebrow { color: #5B9BFF; }

/* — Иконка в квадрате (возможности, способы оплаты) — */
.ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.ico svg { width: 22px; height: 22px; }
.ico--sm { width: 40px; height: 40px; border-radius: 11px; }
.ico--sm svg { width: 20px; height: 20px; }

/* — Номер шага — */
.stepnum { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--brand); color: #fff; font: 800 17px/1 var(--font); box-shadow: 0 4px 12px rgba(10, 108, 255, .35); }
.stepnum--sm { width: 28px; height: 28px; font-size: 14px; box-shadow: 0 3px 8px rgba(10, 108, 255, .3); }
.stepnum--night { background: rgba(255, 255, 255, .1); box-shadow: none; }
/* Цифра шага всегда белая — и в теме Telegram, и внутри ссылок/кнопок */
.stepnum, .stepnum * { color: #fff !important; }
.form-step { display: grid; gap: 14px; }
.form-step + .form-step { border-top: 1px solid var(--line); padding-top: 24px; margin-top: 24px; }
.form-step__head { display: flex; align-items: center; gap: 12px; }
.form-step__head h2 { font: 800 20px/1.2 var(--font); letter-spacing: -0.02em; flex: 1; }
.form-step__head .micro { text-align: right; }

/* — Поле — */
.field { display: grid; gap: 8px; }
.field__label { font-size: 14px; font-weight: 700; }
.field__box { position: relative; }
.field__box svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; margin-top: -10px; color: var(--ink-3); pointer-events: none; }
.field__input {
  width: 100%; height: 54px; padding: 0 16px 0 48px;
  border: 1.5px solid var(--line-strong); border-radius: 14px;
  background: var(--paper); color: var(--ink); font: 500 16px var(--font);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.field__input--plain { padding-left: 16px; }
.field__input::placeholder { color: var(--ink-3); }
.field__input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(10, 108, 255, .14); }
.field__hint { font-size: 13px; color: var(--ink-3); }
.field--error .field__input { border-color: var(--stop); box-shadow: 0 0 0 4px rgba(229, 72, 77, .12); }
.field--error .field__hint { color: var(--stop); }

.code-input { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code-input input {
  width: 100%; min-width: 0; height: 58px; text-align: center; font: 800 24px/1 var(--font);
  border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--paper);
}
.code-input input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(10, 108, 255, .14); }

/* — Тарифы (выбор в форме) — */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plan {
  position: relative; display: grid; gap: 2px; align-content: start;
  padding: 18px 16px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-l);
  background: var(--paper); cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan__term { font-weight: 700; font-size: 15px; }
.plan__price { font: 800 28px/1.15 var(--font); letter-spacing: -0.04em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.plan__price small { font-size: 15px; font-weight: 600; color: var(--ink-3); margin-left: 3px; letter-spacing: 0; }
.plan__note { font-size: 13px; color: var(--ink-3); }
.plan__check { position: absolute; top: 16px; right: 16px; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.plan > .badge, .plan > .disc { position: absolute; top: -11px; right: 12px; }
.plan:hover { border-color: var(--ink-3); }
.plan:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.plan:has(input:checked) .plan__price { color: var(--brand); }
.plan:has(input:checked) .plan__check { background: var(--brand); border-color: var(--brand); }
.plan:has(input:checked) .plan__check::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.plan:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 3px; }

/* — Варианты оплаты — */
.options { display: grid; gap: 12px; }
@media (min-width: 560px) { .options--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.option {
  display: flex; align-items: center; gap: 14px; padding: 16px; width: 100%; text-align: left;
  border: 1.5px solid var(--line-strong); border-radius: var(--r-l); background: var(--paper); cursor: pointer;
}
.option .ico { background: var(--fill); color: var(--ink); }
.option__body { display: grid; gap: 2px; min-width: 0; }
.option__title { font-weight: 700; }
.option__sub { font-size: 13px; color: var(--ink-3); }
.option[aria-checked="true"] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-soft); }
.option[aria-checked="true"] .ico { background: var(--paper); color: var(--brand); }

/* — Сводка заказа — */
.summary { background: var(--canvas); border-radius: var(--r-l); padding: 20px; display: grid; gap: 4px; }
.summary__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.summary__term { font-weight: 800; font-size: 17px; }
.summary__price { font: 800 30px/1 var(--font); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.summary__price small { font-size: 16px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.summary__save { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 14px; color: var(--ink-2); }

/* — Список с галочками — */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start; color: var(--ink-2); }
.checks li b { color: var(--ink); font-weight: 700; }
.checks svg { width: 18px; height: 18px; color: var(--go-dot); margin-top: 3px; }
.checks--center { justify-items: center; }
.checks--center li { grid-template-columns: 18px auto; font-size: 14px; }

/* — Ячейки (кабинет и Mini App) — */
.cells { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.cells__title { padding: 0 4px 10px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.cell {
  display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px;
  background: none; border: 0; width: 100%; text-align: left; text-decoration: none; color: inherit; position: relative; cursor: pointer;
}
.cell + .cell { border-top: 1px solid var(--line); }
.cell:active { background: var(--fill); }
.cell .ico { background: var(--fill); color: var(--ink); }
.cell__body { flex: 1; min-width: 0; display: grid; gap: 1px; }
.cell__title { font-weight: 700; font-size: 15.5px; }
.cell__sub { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell__chev { width: 8px; height: 13px; color: var(--ink-3); flex: none; }

/* — Переключатель вариантов — */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--fill); }
.seg button { height: 38px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(15, 17, 22, .1); }

/* — Шкала срока — */
.meter { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.meter--warn > i { background: var(--warn); }

/* — Ключ — */
.key { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--canvas); border: 1px solid var(--line); }
.key__value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }

/* — Вопросы (тёмные карточки, как на happ.so) — */
.faq { display: grid; gap: 12px; }
.faq details { background: var(--night-card); border: 1px solid var(--night-line); border-radius: var(--r-l); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 22px 24px; font-weight: 700; font-size: 17px; color: var(--night-ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, .28);
  background:
    linear-gradient(#fff, #fff) center / 11px 1.6px no-repeat,
    linear-gradient(#fff, #fff) center / 1.6px 11px no-repeat;
  transition: transform var(--dur-2) var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 24px 22px; color: var(--night-ink-2); max-width: 70ch; }

/* — Уведомление — */
.toast {
  position: fixed; left: 50%; bottom: calc(32px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; background: #0F1116; color: #fff; font-size: 15px; font-weight: 600; white-space: nowrap;
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* — Нижняя кнопка: предпросмотр MainButton Telegram — */
.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--canvas); border-top: 1px solid var(--line);
}
.bottom-bar .btn { max-width: var(--screen); margin: 0 auto; border-radius: 12px; box-shadow: none; }

/* — Переключатель — */
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 14px; background: var(--line-strong); transition: background var(--dur-1) var(--ease); pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform var(--dur-2) var(--ease); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
