:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbe2ee;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #06b6d4;
    --danger: #dc2626;
    --ok: #16a34a;
    --ring: rgba(79, 70, 229, .25);
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 12px 40px rgba(15, 23, 42, .08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0f1d;
        --card: #111a31;
        --text: #e6eaf6;
        --muted: #93a0bd;
        --border: #25314f;
        --primary: #6366f1;
        --primary-hover: #7c7ff5;
        --ring: rgba(99, 102, 241, .35);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 40px rgba(0, 0, 0, .45);
    }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light dark; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }

.hero {
    position: relative;
    overflow: hidden;
    padding: 48px 56px;
    color: #e8ecff;
    background: linear-gradient(145deg, #0b1230 0%, #131a4d 55%, #0e2a47 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .55;
    animation: drift 18s ease-in-out infinite alternate;
}
.hero::before { width: 460px; height: 460px; left: -120px; top: -140px; background: #4f46e5; }
.hero::after { width: 420px; height: 420px; right: -140px; bottom: -120px; background: #06b6d4; animation-delay: -9s; }
.hero .grid {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.hero > * { position: relative; z-index: 1; }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(60px, 40px) scale(1.15); } }

.brand { display: flex; align-items: center; gap: 12px; font-weight: 650; font-size: 20px; letter-spacing: .2px; }
.brand svg { width: 36px; height: 36px; }
.hero h1 { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.12; font-weight: 700; letter-spacing: -.02em; max-width: 520px; }
.hero h1 span { background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { margin-top: 16px; color: #b6c0e6; max-width: 480px; font-size: 17px; }

.features { list-style: none; display: grid; gap: 16px; margin-top: 36px; max-width: 480px; }
.features li { display: flex; gap: 14px; align-items: flex-start; }
.features .ico {
    flex: none; width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
}
.features .ico svg { width: 20px; height: 20px; stroke: #c7d2fe; }
.features b { display: block; font-weight: 600; }
.features small { color: #aab6df; font-size: 14px; }

.hero-foot { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #aab6df; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* ---------- форма ---------- */
.panel { display: flex; flex-direction: column; justify-content: space-between; padding: 32px 24px; }
.panel-top { display: flex; justify-content: flex-end; font-size: 14px; color: var(--muted); }
.card-wrap { display: grid; place-items: center; padding: 24px 0; }
.card {
    width: 100%; max-width: 420px; background: var(--card);
    border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 36px 32px 28px;
}
.card h2 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.card .sub { color: var(--muted); margin: 6px 0 26px; font-size: 15px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.input { position: relative; }
.input svg.lead { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--muted); pointer-events: none; }
.input input {
    width: 100%; height: 46px; padding: 0 44px 0 42px; font: inherit; font-size: 15px;
    color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 10px;
    outline: none; transition: border-color .15s, box-shadow .15s;
}
.input input::placeholder { color: var(--muted); opacity: .7; }
.input input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.field.invalid input { border-color: var(--danger); }
.field.invalid input:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .2); }
.field .msg { display: none; color: var(--danger); font-size: 13px; margin-top: 6px; }
.field.invalid .msg { display: block; }
.toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--muted);
    display: grid; place-items: center;
}
.toggle:hover { background: rgba(100, 116, 139, .12); }
.toggle svg { width: 18px; height: 18px; stroke: currentColor; }
.shake { animation: shake .35s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 22px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.btn {
    width: 100%; height: 46px; border: 0; border-radius: 10px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
    color: #fff; background: linear-gradient(135deg, var(--primary), #6d5dfc); transition: filter .15s, transform .05s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: rgba(100, 116, 139, .1); filter: none; }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; display: none; }
.btn.busy .spin { display: block; }
@keyframes rot { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.alert { display: none; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 10px; font-size: 14px; margin-bottom: 18px;
    color: var(--danger); background: rgba(220, 38, 38, .08); border: 1px solid rgba(220, 38, 38, .25); }
.alert.show { display: flex; }
.alert.info { color: var(--ok); background: rgba(22, 163, 74, .08); border-color: rgba(22, 163, 74, .3); }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; stroke: currentColor; }

footer.small { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; color: var(--muted); font-size: 13px; padding-top: 8px; }
footer.small a { color: var(--muted); }

/* ---------- текстовые страницы и 404 ---------- */
.simple { max-width: 760px; margin: 0 auto; padding: 40px 24px 60px; }
.simple header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.simple .brand { color: var(--text); }
.simple h1 { font-size: 32px; letter-spacing: -.02em; margin-bottom: 8px; }
.simple h2 { font-size: 19px; margin: 28px 0 8px; }
.simple p, .simple li { color: var(--muted); }
.simple ul { padding-left: 20px; }
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.notfound .code { font-size: clamp(80px, 18vw, 150px); font-weight: 800; line-height: 1; letter-spacing: -.04em;
    background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.notfound p { color: var(--muted); margin: 10px 0 24px; }
.notfound > div .btn { display: inline-flex; width: auto; padding: 0 22px; text-decoration: none; }

/* ---------- адаптив ---------- */
@media (max-width: 920px) {
    .shell { grid-template-columns: 1fr; }
    .hero { padding: 28px 24px; min-height: 0; gap: 24px; }
    .hero h1, .hero p.lead, .features, .hero-foot { display: none; }
    .card { padding: 28px 22px 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .hero::before, .hero::after, .dot, .shake { animation: none; }
}

.backlink { text-align: center; margin: 18px 0 0 !important; }
.notfound .card { text-align: left; }
