:root {
  --r: 18px;
  --r-sm: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page-background);
  color: var(--text);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, .pass-date { font-family: var(--display-font); }

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 20px 24px;
}

/* ---------- заголовок ---------- */
.hero { text-align: center; padding: 28px 0 28px; }
.hero-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  background: rgb(var(--accent-rgb) / .12);
  border: 1px solid rgb(var(--accent-rgb) / .24);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 18px;
}
.hero h1 { font-size: 34px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; }
.grad {
  background: var(--accent-heading);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub { color: var(--text-2); margin: 14px auto 0; max-width: 400px; font-size: 15px; }

/* ---------- общие блоки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.card--center { text-align: center; padding: 28px 20px 18px; }
.card-title { font-size: 20px; font-weight: 700; margin: 14px 0 6px; }
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 28px 0 12px;
}
.muted { color: var(--text-2); font-size: 15px; }
.center { text-align: center; }
.hint { color: var(--text-3); font-size: 13px; margin-top: 14px; line-height: 1.5; }

.field { display: block; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .25); }

.btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 15px 18px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn-primary {
  color: var(--action-text);
  background: var(--action-fill);
  box-shadow: var(--action-shadow);
}
.btn-primary:hover { box-shadow: var(--action-shadow-hover); }
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .55; cursor: default; box-shadow: none; }
.btn-secondary {
  margin-top: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-hover);
}
.btn-secondary:hover { background: var(--surface-lift); }
.btn-link { background: none; color: var(--text-2); font-weight: 500; font-size: 15px; margin-top: 6px; padding: 12px; }
.btn-link:hover { color: var(--text); }
.auth-card .field { margin-top: 14px; }
.auth-card a { color: inherit; text-underline-offset: 2px; }
.auth-actions { display: flex; flex-wrap: wrap; gap: 12px 16px; margin-top: 16px; }
.auth-actions .btn-inline { margin-left: 0; padding-block: 6px; }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.auth-tab {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab[aria-pressed="true"] { color: var(--text); background: var(--surface-lift); border-color: var(--line); }
.auth-consent { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.auth-consent input { flex: none; width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); }
.auth-captcha { margin-top: 14px; min-height: 65px; }
.auth-telegram { margin-top: 14px; }
.auth-telegram .btn { margin-top: 0; }
.auth-telegram .hint { margin-top: 8px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin-top: 18px; color: var(--text-3); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- аккаунт с сайта без подписки ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 24px 22px;
  border-radius: 22px;
  border-color: #3a2a63;
  background: linear-gradient(180deg, #1e1636, var(--surface));
}
.empty-title { font-size: 22px; font-weight: 700; line-height: 1.25; }
.empty .btn { margin-top: 4px; }
.empty-aside { margin-top: 12px; }
.empty-aside b { display: block; font-size: 16px; }
.empty-aside .muted { margin-top: 6px; font-size: 14px; }
.empty-aside .btn-inline { display: inline-block; margin: 10px 0 0; padding: 0; text-decoration: none; }

/* ---------- карта подписки ---------- */
.pass {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 20px 18px;
  min-height: 178px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 140% at 100% 0%, #587bb947 0%, transparent 55%),
    radial-gradient(120% 120% at 0% 100%, rgb(var(--accent-rgb) / .22) 0%, transparent 60%),
    linear-gradient(135deg, #20182f 0%, #27213d 48%, #151725 100%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 18px 50px #08061180, inset 0 1px 0 rgb(var(--accent-2-rgb) / .13);
}
.pass::before,
.pass::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .12);
  pointer-events: none;
}
.pass::before { width: 260px; height: 260px; right: -90px; bottom: -150px; }
.pass::after { width: 180px; height: 180px; right: -40px; bottom: -110px; }
.pass--expired {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(251, 191, 36, .28) 0%, transparent 55%),
    radial-gradient(120% 120% at 0% 100%, rgb(var(--accent-rgb) / .35) 0%, transparent 60%),
    var(--panel-fill);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.pass-top { display: flex; justify-content: space-between; align-items: center; }
.pass-brand { font-size: 12px; font-weight: 800; letter-spacing: .22em; color: rgba(255, 255, 255, .85); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid rgba(255, 255, 255, .14);
}
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip--ok { color: var(--green); }
.chip--expired { color: var(--yellow); }
.pass-caption { margin-top: auto; padding-top: 22px; font-size: 13px; color: rgba(255, 255, 255, .7); }
.pass-date { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.pass-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  color: rgba(255, 255, 255, .8);
}
.pass-devices { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.pass-kind { letter-spacing: .12em; text-transform: uppercase; font-size: 11px; color: rgba(255, 255, 255, .55); }

/* ---------- сроки ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 132px;
  padding: 14px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.tile:hover { border-color: var(--line-hover); background: var(--surface-lift); }
.tile:active { transform: scale(.98); }
.tile[aria-checked="true"] {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgb(var(--accent-rgb) / .22), rgb(var(--accent-rgb) / .06));
  box-shadow: 0 0 0 1px var(--accent) inset, 0 10px 28px rgb(var(--accent-rgb) / .25);
}
.tile-months { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.tile-unit { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.tile-price { margin-top: auto; padding-top: 14px; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.tile-month { font-size: 12px; color: var(--text-3); overflow-wrap: anywhere; }
.tile-badge {
  position: absolute;
  top: -10px;
  right: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 7px;
  color: var(--action-text);
  background: var(--action-fill);
}
.tile-badge--best { background: linear-gradient(135deg, #6ee7b7, var(--green)); }
.tile--skeleton, .pass--skeleton { cursor: default; border-color: transparent; }
.pass--skeleton { background: var(--surface); box-shadow: none; margin-bottom: 38px; }
.tile--skeleton, .pass--skeleton { animation: pulse 1.4s ease-in-out infinite; }
#step-loading .muted { margin-top: 20px; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- способы оплаты ---------- */
.methods { display: grid; gap: 8px; }
.limit-label { display: block; }
.limit-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-hover);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.checkout-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.checkout-choice input { flex: none; margin-top: 4px; accent-color: var(--accent); }
#downgrade-warning { margin-top: 8px; }
.checkout-status { margin-top: 14px; color: var(--text); }
.tile--upgrade { grid-column: 1 / -1; min-height: 0; }
.tile--upgrade .tile-price { padding-top: 4px; }
.method {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.method:hover { border-color: var(--line-hover); background: var(--surface-lift); }
.method[aria-checked="true"] { border-color: var(--accent); background: rgb(var(--accent-rgb) / .1); }
.method-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  color: var(--accent-2);
}
.method-title { flex: 1; font-weight: 600; font-size: 15px; }
.method-dot {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-hover);
  transition: border .15s ease;
}
.method[aria-checked="true"] .method-dot { border: 6px solid var(--accent); }

/* ---------- кнопка оплаты прилипает к низу ---------- */
.paybar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 18px -20px 0;
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom));
  /* Низ растворяется: под блоком оплаты идут устройства, резкая граница видна. */
  background: linear-gradient(180deg, rgb(var(--bg-rgb) / 0), rgb(var(--bg-rgb) / .92) 35%, rgb(var(--bg-rgb) / .92) 75%, rgb(var(--bg-rgb) / 0));
}
.paybar .btn { margin-top: 0; }

/* ---------- состояния ---------- */
.big-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 20px; }
.big-icon--ok { color: var(--green); background: rgba(52, 211, 153, .12); box-shadow: 0 0 0 1px rgba(52, 211, 153, .25) inset; }
.big-icon--warn { color: var(--yellow); background: rgba(251, 191, 36, .12); box-shadow: 0 0 0 1px rgba(251, 191, 36, .25) inset; }
.error-text { margin: 16px 0 4px; font-size: 15px; }

.steps { list-style: none; counter-reset: s; text-align: left; margin: 18px 0 4px; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.steps li::before {
  content: counter(s);
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
  background: rgb(var(--accent-rgb) / .15);
}

/* ---------- подвал ---------- */
.foot {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  max-width: 520px;
  width: calc(100% - 40px);
  margin: 12px auto 0;
}
.foot b { color: var(--text-2); }
.foot nav { display: flex; justify-content: center; gap: 18px; margin-top: 8px; }
.foot a { color: var(--text-2); text-decoration: none; }
.foot a:hover { color: var(--text); }
.noscript { position: relative; z-index: 1; text-align: center; color: var(--text-2); padding: 20px; }

@media (max-width: 360px) {
  .hero h1 { font-size: 29px; }
  .tile { padding: 12px 10px; }
  .tile-months { font-size: 26px; }
}

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

.done-title { font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin-top: 18px; }

/* На шагах с подпиской заголовок сжимается: главное — карта и выбор. */
body.compact .hero { padding: 6px 0 20px; }
body.compact .hero-badge,
body.compact .hero-sub { display: none; }
body.compact .hero h1 { font-size: 24px; }

/* ---------- устройства ---------- */
.section-count { color: var(--text-2); letter-spacing: .04em; margin-left: 6px; }
/* minmax(0, …): иначе длинное имя в одну строку растягивает карточку за край экрана. */
.devices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.device {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.device--skeleton { border-color: transparent; animation: pulse 1.4s ease-in-out infinite; }
.device-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--accent-2);
  background: rgb(var(--accent-rgb) / .14);
}
.device-body { flex: 1; min-width: 0; }
.device-title { display: block; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.device-meta { display: block; font-size: 13px; color: var(--text-3); margin-top: 2px; overflow-wrap: anywhere; }
.device-del {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  color: var(--text-3);
  background: none;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.device-del:hover { color: var(--red); background: rgba(248, 113, 113, .1); }
.device--confirm { flex-wrap: wrap; border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .06); }
.device--confirm .device-body { flex-basis: 100%; }
.device-actions { display: flex; gap: 8px; width: 100%; }
.device-actions button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--line-hover);
  color: var(--text);
  background: var(--surface);
}
.device-actions .device-confirm-del { border-color: transparent; color: #fff; background: #dc4a4a; }
.device-actions button:disabled { opacity: .55; cursor: default; }
.devices-empty { color: var(--text-2); font-size: 14px; padding: 14px; text-align: center; border: 1px dashed var(--line-hover); border-radius: 16px; }
.devices-error { margin-top: 10px; font-size: 14px; color: var(--yellow); }
.devices-error .btn-inline { display: block; margin: 6px 0 0; padding: 0; }
.btn-inline { border: 0; background: none; color: var(--accent-2); font-weight: 600; font-size: 14px; cursor: pointer; margin-left: 6px; }

/* ---------- подключение ---------- */
.connect .btn:first-child { margin-top: 0; }
