:root {
    color-scheme: dark;
    --bg: #080a0e;
    --bg-elevated: #0f131a;
    --surface: #131923;
    --surface-input: #0c1017;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f3f6fa;
    --text-soft: #b8c2d3;
    --muted: #8492a8;
    --accent: #a4ff01;
    --accent-hover: #b8ff3b;
    --accent-dim: rgba(164, 255, 1, 0.11);
    --accent-border: rgba(164, 255, 1, 0.32);
    --success: #2dd48f;
    --success-bg: rgba(45, 212, 143, 0.1);
    --danger: #ff6477;
    --danger-bg: rgba(255, 100, 119, 0.11);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 24px 64px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100svh;
    accent-color: var(--accent);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Split Auth Shell */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(340px, 0.92fr) minmax(0, 1.08fr);
    min-height: 100svh;
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 44px;
    background:
        radial-gradient(640px circle at 18% 12%, rgba(164, 255, 1, 0.11), transparent 55%),
        radial-gradient(480px circle at 90% 88%, rgba(45, 212, 143, 0.08), transparent 55%),
        linear-gradient(160deg, #0d121a 0%, #080a0e 100%);
    border-right: 1px solid var(--border);
    overflow: hidden;
}

.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at 30% 30%, black 20%, transparent 78%);
    pointer-events: none;
}

.auth-aside-inner {
    position: relative;
    z-index: 1;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-link:hover {
    text-decoration: none;
    color: var(--text);
}

.brand-link img {
    height: 36px;
    width: auto;
    display: block;
}

.aside-hero {
    margin-top: 56px;
}

.aside-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.aside-kicker::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.aside-title {
    font-size: clamp(1.85rem, 2.7vw, 2.45rem);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    max-width: 18ch;
}

.aside-desc {
    color: var(--muted);
    font-size: 0.96rem;
    max-width: 42ch;
    margin-bottom: 32px;
}

.aside-pillars {
    list-style: none;
    display: grid;
    gap: 14px;
}

.aside-pillars li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border);
}

.pillar-icon {
    flex: 0 0 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-dim);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.pillar-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.pillar-sub {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
}

.aside-footer {
    position: relative;
    z-index: 1;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--muted);
}

/* Right Main Panel */
.auth-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 36px 24px;
    background: radial-gradient(500px circle at 85% 8%, rgba(164, 255, 1, 0.045), transparent 55%), var(--bg);
}

.mobile-brand {
    display: none;
    margin-bottom: 24px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 34px 32px;
    box-shadow: var(--shadow-card);
}

.auth-card--wide {
    max-width: 620px;
}

.auth-header {
    margin-bottom: 24px;
}

.auth-step-badge {
    display: inline-block;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.auth-heading {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--muted);
    font-size: 0.92rem;
}

/* Alerts / Flash Toasts */
.alert-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.alert--error {
    background: var(--danger-bg);
    border-color: rgba(255, 100, 119, 0.35);
    color: #ffd0d6;
}

.alert--success {
    background: var(--success-bg);
    border-color: rgba(45, 212, 143, 0.35);
    color: #c8fce3;
}

.alert-badge {
    flex: 0 0 auto;
    font-weight: 700;
    line-height: 1.4;
}

/* Bonus Callout */
.bonus-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    margin-bottom: 20px;
    font-size: 0.86rem;
    color: var(--text);
}

.bonus-banner strong {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

/* Form Layout & Controls */
.auth-form {
    display: grid;
    gap: 16px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-soft);
}

.field-hint {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: -2px;
}

.input-control,
.select-control {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface-input);
    color: var(--text);
    font-family: inherit;
    font-size: 0.96rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input-control::placeholder {
    color: #5a6679;
}

.input-control:focus,
.select-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(164, 255, 1, 0.16);
}

.input-control[readonly] {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-soft);
    cursor: default;
}

/* Post-interaction validation (:user-invalid + fallback via :is()) */
:is(.input-control, .select-control):is(:user-invalid, .user-invalid-fallback) {
    border-color: var(--danger);
    background-color: rgba(255, 100, 119, 0.06);
}

:is(.input-control, .select-control):is(:user-valid, .user-valid-fallback) {
    border-color: rgba(45, 212, 143, 0.55);
}

.error-msg {
    display: none;
    font-size: 0.8rem;
    color: var(--danger);
}

.field:has(:is(:user-invalid, .user-invalid-fallback)) .error-msg {
    display: block;
}

/* Password field with toggle */
.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrap .input-control {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* Phone input group */
.phone-group {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 8px;
}

/* Single-input OTP styling (Modern Web Guidance) */
.otp-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.48em;
    text-align: center;
    min-height: 58px;
    padding: 12px 14px 12px calc(14px + 0.48em);
    font-variant-numeric: tabular-nums;
}

/* Captcha box */
.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #121a24, #0d1118);
    border: 1px dashed var(--accent-border);
    font-family: ui-monospace, monospace;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.32em;
    color: var(--accent);
    user-select: none;
}

/* Checkbox & Terms */
.check-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.86rem;
    color: var(--text-soft);
    cursor: pointer;
}

.check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex: 0 0 auto;
    cursor: pointer;
}

@supports not (accent-color: #a4ff01) {
    .check-label {
        position: relative;
        padding-left: 28px;
    }
    .check-label input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        width: 1px;
        height: 1px;
    }
    .check-label span::before {
        content: "";
        position: absolute;
        left: 0;
        top: 2px;
        width: 18px;
        height: 18px;
        border-radius: 4px;
        border: 1px solid var(--border-strong);
        background: var(--surface-input);
    }
    .check-label input[type="checkbox"]:checked + span::before {
        background: var(--accent);
        border-color: var(--accent);
    }
    .check-label input[type="checkbox"]:checked + span::after {
        content: "\2713";
        position: absolute;
        left: 4px;
        top: 0;
        color: #080a0e;
        font-weight: 700;
        font-size: 0.82rem;
    }
}

.form-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
}

/* Buttons */
.btn-submit {
    width: 100%;
    min-height: 48px;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #080a0e;
    font-family: inherit;
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn-submit:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(164, 255, 1, 0.22);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-soft);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    border-color: var(--accent-border);
    color: var(--text);
    text-decoration: none;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.88rem;
    color: var(--muted);
}

.auth-footer a {
    font-weight: 600;
}

.target-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    margin-top: 8px;
    word-break: break-all;
}

@media (max-width: 960px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }
    .auth-aside {
        display: none;
    }
    .mobile-brand {
        display: flex;
        justify-content: center;
    }
    .auth-main {
        justify-content: flex-start;
        padding: 24px 16px 40px;
    }
    .auth-card {
        padding: 26px 20px;
    }
}

@media (max-width: 560px) {
    .mobile-brand .brand-link {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    .mobile-brand .brand-logo {
        height: 30px;
    }
    .field-grid {
        grid-template-columns: 1fr;
    }
    .phone-group {
        grid-template-columns: 108px minmax(0, 1fr);
    }
    .auth-heading {
        font-size: 1.42rem;
    }
    .auth-card {
        padding: 22px 16px;
        border-radius: 16px;
    }
}

@media (max-width: 390px) {
    .phone-group {
        grid-template-columns: 1fr;
    }
}

/* Smooth GPU-composited UI animations (opt-in via prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
    @keyframes authFadeUp {
        from {
            opacity: 0;
            transform: translateY(16px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes authSlideIn {
        from {
            opacity: 0;
            transform: translateY(-8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .auth-card {
        animation: authFadeUp 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .aside-copy {
        animation: authFadeUp 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .pillar {
        animation: authFadeUp 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }

    .pillar:nth-child(2) {
        animation-delay: 80ms;
    }

    .pillar:nth-child(3) {
        animation-delay: 160ms;
    }

    .alert,
    .bonus-banner {
        animation: authSlideIn 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
    }
}
