:root {
    --bg: #07101f;
    --panel: rgba(10, 20, 38, 0.82);
    --panel-solid: #0b1628;
    --line: rgba(148, 163, 184, 0.18);
    --line-strong: rgba(125, 211, 252, 0.32);
    --text: #f8fafc;
    --muted: #94a3b8;
    --muted-strong: #cbd5e1;
    --cyan: #22d3ee;
    --blue: #3b82f6;
    --violet: #8b5cf6;
    --danger: #fb7185;
    --success: #34d399;
    --warning: #fbbf24;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 18%, rgba(34, 211, 238, 0.14), transparent 26rem),
        radial-gradient(circle at 88% 82%, rgba(139, 92, 246, 0.16), transparent 30rem),
        linear-gradient(145deg, #050b16 0%, var(--bg) 48%, #081426 100%);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: 0;
    pointer-events: none;
}

body::before {
    inset: 0;
    opacity: 0.28;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.055) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 88%);
}

body::after {
    width: 22rem;
    height: 22rem;
    right: -8rem;
    top: -8rem;
    border-radius: 50%;
    border: 1px solid rgba(34, 211, 238, 0.18);
    box-shadow: 0 0 0 4rem rgba(59, 130, 246, 0.025), 0 0 0 8rem rgba(139, 92, 246, 0.018);
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.auth-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 32px;
    display: grid;
    place-items: center;
}

.auth-shell {
    width: min(1120px, 100%);
    min-height: 690px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: rgba(5, 12, 24, 0.7);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.brand-panel {
    position: relative;
    overflow: hidden;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        linear-gradient(160deg, rgba(16, 37, 64, 0.96), rgba(7, 18, 35, 0.94)),
        var(--panel-solid);
    border-right: 1px solid var(--line);
}

.brand-panel::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -160px;
    top: 44px;
    border-radius: 50%;
    background: conic-gradient(from 210deg, rgba(34, 211, 238, 0.34), rgba(59, 130, 246, 0.05), rgba(139, 92, 246, 0.3), rgba(34, 211, 238, 0.34));
    filter: blur(2px);
    opacity: 0.58;
}

.brand-panel::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    right: -72px;
    top: 124px;
    border-radius: 50%;
    background: #0b1628;
    box-shadow: inset 0 0 60px rgba(34, 211, 238, 0.12);
}

.brand-top,
.brand-copy,
.brand-footer {
    position: relative;
    z-index: 2;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #03111c;
    background: linear-gradient(135deg, var(--cyan), #a5f3fc);
    box-shadow: 0 12px 28px rgba(34, 211, 238, 0.22);
}

.brand-icon svg {
    width: 22px;
    height: 22px;
}

.brand-copy {
    max-width: 570px;
    margin: auto 0;
    padding: 54px 0 42px;
}

.eyebrow {
    margin: 0 0 18px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.brand-copy h1 {
    margin: 0;
    max-width: 530px;
    font-size: clamp(40px, 5vw, 68px);
    line-height: 1.02;
    letter-spacing: -0.045em;
}

.brand-copy h1 span {
    display: block;
    margin-top: 10px;
    color: transparent;
    background: linear-gradient(90deg, #e0f2fe, var(--cyan) 42%, #c4b5fd 90%);
    -webkit-background-clip: text;
    background-clip: text;
}

.brand-copy > p:last-of-type {
    max-width: 500px;
    margin: 24px 0 0;
    color: var(--muted-strong);
    font-size: 15px;
    line-height: 1.8;
}

.feature-list {
    display: grid;
    gap: 12px;
    margin-top: 30px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #dbeafe;
    font-size: 14px;
}

.feature-dot {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(34, 211, 238, 0.28);
    border-radius: 8px;
    background: rgba(34, 211, 238, 0.08);
    color: var(--cyan);
    font-size: 11px;
}

.brand-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: #64748b;
    font-size: 12px;
}

.brand-footer .secure {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
}

.secure-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.78);
}

.form-panel {
    padding: 48px 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(180deg, rgba(9, 18, 33, 0.88), rgba(7, 15, 29, 0.96));
}

.form-inner {
    width: min(430px, 100%);
    margin: 0 auto;
}

.auth-tabs {
    display: inline-flex;
    padding: 4px;
    margin-bottom: 34px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.58);
}

.auth-tab {
    min-width: 90px;
    padding: 9px 16px;
    border-radius: 9px;
    color: var(--muted);
    text-align: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: 160ms ease;
}

.auth-tab:hover {
    color: var(--text);
}

.auth-tab.active {
    color: #ecfeff;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(59, 130, 246, 0.16));
    box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.16);
}

.form-heading {
    margin-bottom: 30px;
}

.form-heading h2 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.025em;
}

.form-heading p {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field label {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 13px;
    outline: none;
    color: var(--text);
    caret-color: var(--cyan);
    background: rgba(15, 23, 42, 0.72);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.input-wrap input::placeholder {
    color: #526176;
}

.input-wrap input:hover {
    border-color: rgba(148, 163, 184, 0.34);
}

.input-wrap input:focus {
    border-color: rgba(34, 211, 238, 0.62);
    background: rgba(15, 23, 42, 0.94);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.08);
}

.input-wrap input:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.password-input input {
    padding-right: 50px;
}

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

.password-toggle:hover {
    color: var(--cyan);
    background: rgba(34, 211, 238, 0.07);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.code-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 136px;
    gap: 10px;
}

.secondary-btn,
.primary-btn {
    height: 50px;
    border-radius: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 150ms ease, opacity 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.secondary-btn {
    border: 1px solid rgba(34, 211, 238, 0.28);
    color: #cffafe;
    background: rgba(34, 211, 238, 0.08);
    font-size: 13px;
}

.secondary-btn:hover:not(:disabled) {
    border-color: rgba(34, 211, 238, 0.56);
    background: rgba(34, 211, 238, 0.12);
}

.primary-btn {
    width: 100%;
    margin-top: 4px;
    border: 0;
    color: #03111c;
    background: linear-gradient(120deg, #67e8f9, var(--cyan) 44%, #60a5fa 100%);
    box-shadow: 0 16px 30px rgba(34, 211, 238, 0.16);
}

.primary-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.primary-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled,
.secondary-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: -2px;
    color: var(--muted);
    font-size: 12px;
}

.form-meta a,
.switch-link a {
    color: #a5f3fc;
    text-decoration: none;
}

.form-meta a:hover,
.switch-link a:hover {
    text-decoration: underline;
}

.password-rule {
    margin: -2px 0 0;
    color: #64748b;
    font-size: 11px;
    line-height: 1.55;
}

.turnstile-card {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.46);
}

.turnstile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 700;
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #a7f3d0;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.security-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

#turnstile-container {
    min-height: 65px;
}

.auth-status {
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    opacity: 0;
    transform: translateY(-4px);
    color: var(--muted-strong);
    background: transparent;
    font-size: 12px;
    line-height: 1.55;
    transition: 160ms ease;
}

.auth-status.visible {
    min-height: 42px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    opacity: 1;
    transform: translateY(0);
}

.auth-status.success {
    color: #bbf7d0;
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.07);
}

.auth-status.error {
    color: #fecdd3;
    border-color: rgba(251, 113, 133, 0.26);
    background: rgba(251, 113, 133, 0.07);
}

.auth-status.info {
    color: #bae6fd;
    border-color: rgba(56, 189, 248, 0.22);
    background: rgba(56, 189, 248, 0.06);
}

.switch-link {
    margin: 26px 0 0;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    vertical-align: -2px;
    border: 2px solid rgba(3, 17, 28, 0.25);
    border-top-color: #03111c;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

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

@media (max-width: 900px) {
    .auth-page {
        padding: 20px;
    }

    .auth-shell {
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .brand-panel {
        min-height: 290px;
        padding: 32px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .brand-copy {
        padding: 48px 0 18px;
    }

    .brand-copy h1 {
        max-width: 640px;
        font-size: clamp(34px, 8vw, 52px);
    }

    .feature-list,
    .brand-footer {
        display: none;
    }

    .form-panel {
        padding: 42px 32px 48px;
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 0;
        align-items: stretch;
    }

    .auth-shell {
        width: 100%;
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .brand-panel {
        min-height: 220px;
        padding: 24px;
    }

    .brand-copy {
        padding: 34px 0 4px;
    }

    .brand-copy > p:last-of-type {
        display: none;
    }

    .brand-copy h1 {
        font-size: 34px;
    }

    .form-panel {
        padding: 34px 22px 42px;
        justify-content: flex-start;
    }

    .form-heading h2 {
        font-size: 27px;
    }

    .code-row {
        grid-template-columns: minmax(0, 1fr) 118px;
    }
}
