:root {
    --bg: #0f1115;
    --bg-2: #141820;
    --card: #181b22;
    --card-2: #1d222b;
    --border: #232833;
    --border-2: #2a3140;
    --text: #e8ecf3;
    --muted: #9aa3b2;
    --muted-2: #5d6572;
    --accent: #6c5ce7;
    --accent-2: #00d1b2;
    --danger: #ff5c7a;
    --ok: #2ecc71;
    --warn: #f5a623;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    background: radial-gradient(1200px 600px at 50% -10%, #1a2030 0%, var(--bg) 55%) no-repeat, var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
.app { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 8px 0 18px;
}
.brand {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text); font-weight: 700; font-size: 18px; text-decoration: none;
}
.brand span { letter-spacing: -.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.account { display: flex; align-items: center; gap: 10px; }
.balance {
    background: rgba(108,92,231,.16); border: 1px solid rgba(108,92,231,.35);
    color: #cfc8ff; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.banner {
    padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
    font-size: 14px;
}
.banner-warn { background: rgba(245,166,35,.12); border: 1px solid rgba(245,166,35,.35); color: #ffd98a; }
.hero { padding: 18px 0 10px; text-align: center; }
.hero h1 { font-size: 28px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -.6px; }
.hero p { color: var(--muted); margin: 0 auto 16px; max-width: 520px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.hero-points span {
    background: var(--card); border: 1px solid var(--border);
    color: var(--muted); padding: 6px 10px; border-radius: 999px; font-size: 13px;
}
.main { padding-top: 8px; }
.tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    background: var(--card); border: 1px solid var(--border);
    padding: 5px; border-radius: 14px; margin-bottom: 16px;
}
.tab {
    border: 0; background: transparent; color: var(--muted);
    padding: 10px 8px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.tab.active { background: var(--card-2); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field small { font-size: 12px; }
textarea, input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%; background: var(--bg-2); border: 1px solid var(--border-2);
    border-radius: 12px; padding: 12px 14px; color: var(--text); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 90px; }
textarea:focus, input:focus, select:focus {
    border-color: rgba(108,92,231,.8); box-shadow: 0 0 0 3px rgba(108,92,231,.18);
}
.counter { color: var(--muted-2); font-size: 12px; text-align: right; margin: -4px 0 12px; }
.field-label { font-size: 14px; color: var(--muted); margin: 12px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
    border: 1px solid var(--border-2); background: var(--bg-2); color: var(--muted);
    padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 14px;
    transition: all .15s;
}
.chip:hover { border-color: #3a4356; color: var(--text); }
.chip.active { background: rgba(108,92,231,.18); border-color: rgba(108,92,231,.7); color: #d9d2ff; }
.chip:disabled { opacity: .55; cursor: not-allowed; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent; border-radius: 12px; padding: 12px 16px;
    cursor: pointer; font-weight: 600; text-decoration: none; transition: all .15s;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #8b7bff); color: #fff; box-shadow: 0 8px 20px rgba(108,92,231,.25); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: #3a4356; background: rgba(255,255,255,.03); }
.btn-sm { padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; font-size: 14px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }
.results { display: grid; gap: 10px; margin-top: 16px; }
.variant {
    background: var(--card-2); border: 1px solid var(--border-2);
    border-radius: 14px; padding: 14px; display: grid; gap: 10px;
}
.variant-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.variant-text { font-size: 16px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.variant .btn { justify-self: start; }
.dialog-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.dialog-log { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
.dlg-item { font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.dlg-her { border-color: rgba(0,209,178,.25); }
.dlg-me { border-color: rgba(108,92,231,.25); }
.footer { display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; padding-top: 28px; font-size: 13px; color: var(--muted-2); }
.footer a { color: var(--muted); }
.muted { color: var(--muted); }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,7,10,.72); backdrop-filter: blur(3px); }
.modal-card {
    position: relative; width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--border-2); border-radius: 18px; padding: 22px;
    box-shadow: var(--shadow); z-index: 1; max-height: 90vh; overflow-y: auto;
}
.modal-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.4px; }
.modal-close { position: absolute; top: 10px; right: 10px; background: transparent; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.form-error { color: var(--danger); font-size: 14px; min-height: 18px; margin: 4px 0 10px; }
.form-error:empty { display: none; }
.packages { display: grid; gap: 10px; margin-top: 14px; }
.package {
    position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
    text-align: left; width: 100%; background: var(--bg-2); border: 1px solid var(--border-2);
    border-radius: 14px; padding: 14px; cursor: pointer; color: var(--text);
}
.package:hover { border-color: rgba(108,92,231,.7); }
.package-hot { border-color: rgba(108,92,231,.7); background: rgba(108,92,231,.10); }
.package-title { font-weight: 700; }
.package-gens { color: var(--muted); font-size: 13px; }
.package-price { font-weight: 700; grid-row: 1 / span 2; align-self: center; font-size: 20px; }
.package-badge {
    position: absolute; top: -8px; right: 10px; background: var(--accent);
    color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.toast-box { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(92vw, 420px); }
.toast {
    background: var(--card-2); border: 1px solid var(--border-2); color: var(--text);
    padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px;
    animation: toast-in .2s ease-out;
}
.toast-error { border-color: rgba(255,92,122,.5); }
.toast-ok { border-color: rgba(46,204,113,.5); }
.toast-warn { border-color: rgba(245,166,35,.5); }
.toast-out { opacity: 0; transform: translateY(8px); transition: all .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 640px) {
    .app { padding: 24px 24px 48px; }
    .hero h1 { font-size: 36px; }
    .panel { padding: 22px; }
}

/* =========================================================
   RESET + ADAPTIVE BASELINE (можно копировать всем, конфликтов нет)
   ========================================================= */

/* 1. Box-sizing для всех */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 2. Правильные переносы текста (убирает "расплывание" длинных слов) */
body, p, span, div, a, button, label, textarea {
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: none;
}

/* 3. Картинки / видео не выходят за пределы */
img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

/* 4. Горизонтальный overflow - запрет (кроме модалок) */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* 5. Ссылки: убираем подчёркивание по умолчанию, оставляем hover */
a {
    text-decoration: none;
    color: inherit;
}
a:hover {
    text-decoration: underline;
}

/* Исключения: явные текстовые ссылки в футере сохраняют подчёркивание */
.footer a,
.footer .link-btn {
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
}

/* Или наоборот - футер без подчёркивания. Выбери: */
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* 6. Кнопки — touch-friendly размер на мобильных */
button, .btn, .chip {
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}

/* 7. Инпуты — не даём Safari увеличивать при фокусе */
input, textarea, select {
    font-size: 16px; /* 16px+ = нет auto-zoom на iOS */
    max-width: 100%;
}

/* =========================================================
   BREAKPOINTS
   ========================================================= */

/* 1024px+ - десктоп: ограничиваем контент */
.main, .hero {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

/* 900px - планшет */
@media (max-width: 900px) {
    .hero h1 { font-size: 28px; line-height: 1.25; }
    .hero p  { font-size: 15px; }
    .topbar  { padding: 12px 16px; }
}

/* 640px - большой телефон */
@media (max-width: 640px) {
    /* Шапка: уменьшаем отступы, скрываем подписи */
    .topbar {
        padding: 10px 12px;
        gap: 8px;
    }
    .brand span {
        display: none;   /* на узком экране показываем только ?? */
    }
    .ia-nav-btn span {
        display: none;   /* «История», «Помощь», «Кабинет» > только иконки */
    }
    .ia-nav-btn {
        padding: 8px;
        min-width: 40px;
    }

    /* Hero */
    .hero {
        padding: 24px 16px;
    }
    .hero h1 {
        font-size: 22px;
        line-height: 1.3;
    }
    .hero p { font-size: 14px; }
    .hero-points {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Панель + карточки */
    .main { padding: 16px 12px; }
    .panel { padding: 16px; }
    .tabs { gap: 4px; }
    .tab {
        padding: 10px 12px;
        font-size: 13px;
    }
    .results { gap: 10px; }
    .variant { padding: 12px; }
    .variant-text { font-size: 14px; }

    /* Модалки — на всю ширину с отступами */
    .modal-card {
        width: calc(100% - 24px) !important;
        max-width: 480px !important;
        /*margin: 12px;*/
		margin: auto;
        padding: 20px 16px;
    }

    /* Кабинет */
    .cab-code-row {
        flex-wrap: nowrap;
        gap: 6px;
    }
    .cab-code-row code {
        font-size: 12px !important;
        letter-spacing: 0.5px !important;
    }

    /* Баланс на мобильном — компактнее */
    #balance {
        font-size: 12px;
        padding: 4px 8px;
    }

    /* Код в шапке — уменьшенный */
    .header-code {
        font-size: 10px !important;
        padding: 4px 6px !important;
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Футер — переносим в столбик */
    .footer {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        font-size: 12px;
        padding: 16px 12px;
    }
}

/* 380px - очень маленькие (iPhone SE) */
@media (max-width: 380px) {
    .hero h1 { font-size: 20px; }
    .modal-card { padding: 16px 12px; }
    .modal-card h2 { font-size: 18px; }
    .btn { font-size: 13px; padding: 10px 14px; }
}

/* =========================================================
   АНИМАЦИИ
   ========================================================= */

/* Плавное появление модалок */
.modal {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modal.open {
    opacity: 1;
    visibility: visible;
}
.modal-card {
    transform: translateY(12px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal.open .modal-card {
    transform: translateY(0) scale(1);
}

/* Плавное появление карточек с результатами */
@keyframes ia-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.variant {
    animation: ia-card-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.variant:nth-child(2) { animation-delay: 0.05s; }
.variant:nth-child(3) { animation-delay: 0.1s; }

/* Плавные кнопки */
.btn, .chip, .tab, .ia-nav-btn {
    transition: transform 0.12s ease, background-color 0.15s ease,
                box-shadow 0.15s ease, color 0.15s ease;
}
.btn:active:not(:disabled),
.chip:active:not(:disabled) {
    transform: scale(0.97);
}

/* Skeleton shimmer (если уже есть — не сломает) */
@keyframes ia-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Toast — выезд снизу */
@keyframes ia-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.toast {
    animation: ia-toast-in 0.24s ease;
}

/* Учитываем prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   Убираем подчёркивания у кнопок, но оставляем у текстовых ссылок
   ========================================================= */

button,
.btn,
.btn-ghost,
.btn-primary,
.btn-danger,
.ia-nav-btn,
.chip,
.tab,
.cab-copy,
.header-code,
.cab-device-revoke {
    text-decoration: none !important;
}

/* Явные текстовые ссылки (в футере, в тексте) — подчёркиваем при hover */
.footer a:hover,
.muted a:hover,
p a:hover {
    text-decoration: underline !important;
}

/* ===== Юридические документы, согласия, футер ===== */
.footer-legal {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
    line-height: 1.55;
    opacity: 0.72;
}
.footer-legal p { margin: 0; }
.footer-legal a { text-decoration: underline; }

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 12px 0 10px;
    cursor: pointer;
}
.consent-check input { margin-top: 2px; flex: 0 0 auto; }
.consent-text {
    font-size: 11.5px;
    line-height: 1.45;
    opacity: 0.8;
}
.consent-text a { text-decoration: underline; }

.legal-body-bg { background: var(--bg, #0f1115); }
.legal-page { max-width: 760px; margin: 0 auto; padding: 32px 18px 64px; }
.legal-page h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 6px; }
.legal-updated { margin: 0 0 22px; }
.legal-body { font-size: 15px; line-height: 1.65; }
.legal-back { margin: 0 0 18px; font-size: 13px; }
.legal-nav {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}
.legal-support { margin-top: 26px; }

/* ===== Контентные страницы: контакты и CTA ===== */
.page-contacts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
}
.page-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}
.page-contact--primary {
    border-color: rgba(109, 58, 192, 0.75);
    background: rgba(109, 58, 192, 0.22);
}
.page-contact-note { font-size: 12.5px; opacity: .65; }
.page-cta { margin: 26px 0 0; }

/* ===== Email-онбординг: баннер в кабинете и подсказка в пейволле ===== */
.cab-email-banner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
    padding: 12px 14px;
    margin: 0 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(109, 58, 192, 0.55);
    background: rgba(109, 58, 192, 0.14);
    font-size: 13px;
    line-height: 1.45;
}
.cab-email-banner b { font-size: 13.5px; }
.cab-email-banner span { opacity: .82; }

.paywall-email-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 13px;
    margin: 0 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(109, 58, 192, 0.5);
    background: rgba(109, 58, 192, 0.14);
    font-size: 13px;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .cab-email-banner .btn,
    .paywall-email-note .btn { width: 100%; }
    .page-contact { width: 100%; justify-content: center; }
}
