:root {
    --bg: #070b10;
    --surface: #0e141c;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f4f7fb;
    --muted: #8b97a8;
    --primary: #3391ff;
    --primary-dark: #1a6fd6;
}

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

html, body { max-width: 100%; overflow-x: hidden; }

body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: 'Instrument Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.auth-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 88px 18px 28px;
    overflow: hidden;
}

.auth-page__top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(180deg, rgba(7, 11, 16, 0.88), rgba(7, 11, 16, 0.35) 70%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.auth-page__top-brand img {
    height: 52px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

.auth-page__back {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gold, #ccb892);
    transition: border-color 0.15s, background 0.15s;
}

.auth-page__back:hover {
    border-color: color-mix(in srgb, var(--primary) 45%, transparent);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.auth-page__glow {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 50% -10%, color-mix(in srgb, var(--primary) 36%, transparent), transparent 60%),
        radial-gradient(ellipse 45% 40% at 100% 20%, rgba(56, 189, 248, 0.14), transparent 55%),
        radial-gradient(ellipse 40% 45% at 0% 80%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 55%),
        radial-gradient(ellipse 50% 40% at 85% 90%, rgba(99, 102, 241, 0.1), transparent 60%);
    animation: authDrift 14s ease-in-out infinite alternate;
}

.auth-page__glow::after {
    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: 56px 56px;
    mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, black 15%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 40%, black 15%, transparent 75%);
    opacity: 0.7;
}

.auth-page__orb {
    position: fixed;
    width: min(42vw, 520px);
    height: min(42vw, 520px);
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
    top: 8%;
    right: -4%;
    opacity: 0.55;
    z-index: 0;
    animation: authSpin 40s linear infinite;
    pointer-events: none;
}

.auth-page__orb::after {
    content: '';
    position: absolute;
    inset: 28px;
    border-radius: 50%;
    border: 1px dashed color-mix(in srgb, var(--primary) 18%, transparent);
}

.auth-page__orb--alt {
    top: auto;
    right: auto;
    bottom: -8%;
    left: -6%;
    width: min(38vw, 440px);
    height: min(38vw, 440px);
    opacity: 0.35;
    animation-direction: reverse;
    animation-duration: 52s;
}

@keyframes authDrift {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(18px) scale(1.04); }
}

@keyframes authSpin { to { transform: rotate(360deg); } }

@keyframes authRise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-page__panel {
    position: relative;
    z-index: 1;
    animation: authRise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-page__panel--login { width: min(100%, 420px); }
.auth-page__panel--register { width: min(100%, 480px); }

.auth-page__intro {
    text-align: center;
    margin-bottom: 28px;
}

.auth-page__intro h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2rem, 6vw, 2.55rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 10px;
}

.auth-page__intro h1 em {
    font-style: italic;
    color: color-mix(in srgb, var(--primary) 88%, #fff);
}

.auth-page__intro p {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-page__card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
        165deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.04) 45%,
        rgba(10, 15, 22, 0.35) 100%
    );
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 22px;
    padding: 26px 22px 22px;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 1px 0 rgba(255, 255, 255, 0.12) inset,
        0 24px 48px -16px rgba(0, 0, 0, 0.45),
        0 0 60px -20px color-mix(in srgb, var(--primary) 28%, transparent);
    backdrop-filter: blur(28px) saturate(1.35);
    -webkit-backdrop-filter: blur(28px) saturate(1.35);
    animation: authRise 0.85s 0.08s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-page__card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 22px;
    right: 22px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    pointer-events: none;
}

@media (min-width: 480px) {
    .auth-page__card { padding: 30px 28px 26px; }
}

.auth-field {
    position: relative;
    margin-bottom: 14px;
}

.auth-field input {
    width: 100%;
    padding: 26px 44px 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.35;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.auth-field input::placeholder { color: transparent; }

.auth-field label {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.9rem;
    pointer-events: none;
    transition: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-field input:focus,
.auth-field input:not(:placeholder-shown) {
    border-color: color-mix(in srgb, var(--primary) 55%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
    background: rgba(0, 0, 0, 0.38);
}

.auth-field input:focus + label,
.auth-field input:not(:placeholder-shown) + label {
    top: 8px;
    transform: none;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
}

.auth-field__icon,
.auth-field__toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #5f6b7a;
    font-size: 0.9rem;
}

.auth-field__icon { pointer-events: none; }

.auth-field__toggle {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: color 0.15s, background 0.15s;
}

.auth-field__toggle:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.04);
}

.auth-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 16px;
}

.auth-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.84rem;
    cursor: pointer;
}

.auth-remember input {
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
    cursor: pointer;
}

.auth-forgot {
    color: var(--primary);
    font-size: 0.84rem;
    font-weight: 600;
}

.auth-forgot:hover { opacity: 0.88; }

.auth-captcha { margin: 0 0 16px; }
.auth-captcha:empty { display: none; }
.auth-captcha .g-recaptcha { transform-origin: 0 0; }

@media (max-width: 360px) {
    .auth-captcha .g-recaptcha { transform: scale(0.86); }
}

.auth-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 28px -12px color-mix(in srgb, var(--primary) 55%, transparent);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px -12px color-mix(in srgb, var(--primary) 60%, transparent);
}

.auth-btn:active { transform: translateY(0); }
.auth-btn[disabled] { opacity: 0.72; cursor: wait; transform: none; }

.auth-foot {
    text-align: center;
    margin-top: 18px;
    color: var(--muted);
    font-size: 0.88rem;
}

.auth-foot a {
    color: var(--primary);
    font-weight: 600;
}

.auth-copy {
    text-align: center;
    margin-top: 22px;
    color: #4d5a6a;
    font-size: 0.75rem;
    animation: authRise 1s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Register wizard */
.reg-progress { margin-bottom: 18px; }
.reg-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.reg-progress-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}
.reg-step-count {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
}
.reg-bar-wrap {
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}
.reg-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    transition: width 0.4s ease;
}
.reg-tabs {
    display: flex;
    justify-content: space-between;
    gap: 4px;
}
.reg-tab {
    font-size: 0.64rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color 0.2s;
}
.reg-tab.active { color: var(--primary); }
.reg-tab.completed { color: #64748b; }

.reg-step { display: none; }
.reg-step.active {
    display: block;
    animation: authRise 0.35s ease;
}

.reg-step-head { text-align: center; margin-bottom: 18px; }
.reg-step-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    margin: 0 auto 10px;
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1rem;
}
.reg-step-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}
.reg-step-sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

.reg-row { display: flex; gap: 10px; }
.reg-row > .reg-group { flex: 1; min-width: 0; }
.reg-group { margin-bottom: 14px; }

.reg-label {
    display: block;
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.reg-label .req { color: var(--primary); }

.reg-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.35;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.reg-input::placeholder { color: #475569; }

.reg-input:focus {
    border-color: color-mix(in srgb, var(--primary) 55%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
    background: rgba(0, 0, 0, 0.38);
}

select.reg-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

select.reg-input option { background: #0f1923; color: #e2e8f0; }

.reg-input-icon { position: relative; }
.reg-input-icon .reg-input { padding-right: 44px; }
.reg-input-icon .ico {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #5f6b7a;
    font-size: 0.9rem;
    pointer-events: none;
}

.reg-input-icon .toggle-pw {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 10px;
    display: grid;
    place-items: center;
}

.reg-input-icon .toggle-pw:hover { color: var(--primary); }

.reg-phone-row { display: flex; gap: 0; }
.reg-phone-code {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    border-radius: 14px 0 0 14px;
    border: 1px solid var(--line);
    border-right: none;
    background: rgba(0, 0, 0, 0.22);
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    white-space: nowrap;
}

.reg-phone-code i { font-size: 0.75rem; color: #475569; }
.reg-phone-row .reg-input { border-radius: 0 14px 14px 0; }

.reg-pw-match {
    font-size: 0.74rem;
    margin-top: 6px;
    display: none;
    align-items: center;
    gap: 4px;
}

.reg-pw-match.match { display: flex; color: #22c55e; }
.reg-pw-match.no-match { display: flex; color: #ef4444; }

.reg-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.reg-btn-prev,
.reg-btn-next,
.reg-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.2s;
}

.reg-btn-prev {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border: 1px solid var(--line);
}

.reg-btn-prev:hover {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text);
}

.reg-btn-next,
.reg-btn-submit {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 12px 24px -10px color-mix(in srgb, var(--primary) 50%, transparent);
}

.reg-btn-next:hover,
.reg-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -10px color-mix(in srgb, var(--primary) 55%, transparent);
}

/* Verification / OTP */
.auth-verify-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    margin: 0 auto 16px;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    display: grid;
    place-items: center;
    color: var(--primary);
    font-size: 1.15rem;
}

.auth-verify-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(1.5rem, 5vw, 1.65rem);
    font-weight: 400;
    text-align: center;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    line-height: 1.15;
}

.auth-verify-title em {
    font-style: italic;
    color: color-mix(in srgb, var(--primary) 88%, #fff);
}

.auth-verify-sub {
    text-align: center;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0 0 22px;
}

.auth-verify-sub strong { color: var(--text); font-weight: 600; }

.auth-hint-box {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.auth-hint-box i {
    color: var(--primary);
    margin-top: 2px;
    flex-shrink: 0;
}

.otp {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 18px;
}

.otp__box {
    width: 44px;
    height: 52px;
    border-radius: 12px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    caret-color: var(--primary);
}

.otp__box:focus {
    border-color: color-mix(in srgb, var(--primary) 65%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
    background: rgba(0, 0, 0, 0.5);
}

.otp__box.filled { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

.auth-code-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

.auth-verify-hint {
    text-align: center;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.5;
}

.auth-verify-hint a { color: var(--primary); font-weight: 600; }

.auth-verify-error {
    text-align: center;
    color: #f87171;
    font-size: 0.78rem;
    margin: -8px 0 14px;
}

.auth-btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Password reset extras */
.auth-strength { margin-top: 8px; }
.auth-strength-bars { display: flex; gap: 4px; margin-bottom: 4px; }
.auth-strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}
.auth-strength-label { font-size: 0.65rem; color: #64748b; }

.auth-match {
    font-size: 0.74rem;
    margin-top: 6px;
    display: none;
    align-items: center;
    gap: 4px;
}

.auth-match.ok { display: flex; color: #22c55e; }
.auth-match.fail { display: flex; color: #ef4444; }

.auth-status {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 14px;
    border: 1px solid rgba(34, 197, 94, 0.25);
    background: rgba(34, 197, 94, 0.08);
    color: #86efac;
    font-size: 0.84rem;
    line-height: 1.45;
}
