:root {
    --indigo-950: #030a22;
    --indigo-900: #07153b;
    --indigo-800: #0d2457;
    --indigo-700: #16376f;
    --moon: #f3f0e7;
    --moon-soft: rgba(243, 240, 231, 0.76);
    --line: rgba(243, 240, 231, 0.22);
    --earth: #7b5632;
}

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

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

body {
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    color: var(--moon);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Serif SC", system-ui, sans-serif;
    background:
        radial-gradient(circle at 38% 30%, rgba(232, 226, 207, 0.08), transparent 28%),
        radial-gradient(circle at 50% 16%, rgba(42, 75, 126, 0.32), transparent 36%),
        linear-gradient(180deg, var(--indigo-900), var(--indigo-950) 72%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.026) 0 1px, transparent 1px 4px),
        linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 5px);
    opacity: 0.7;
}

body::after {
    content: "";
    position: fixed;
    inset: 26px;
    pointer-events: none;
    border: 1px solid rgba(243, 240, 231, 0.12);
    box-shadow:
        inset 0 0 0 1px rgba(128, 86, 50, 0.14),
        0 0 0 1px rgba(3, 10, 34, 0.18);
}

#jiaxieCanvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    filter: saturate(0.92) contrast(1.08);
}

.login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
    align-items: center;
    gap: clamp(28px, 6vw, 82px);
    padding: clamp(22px, 5vw, 64px);
}

.brand-stage {
    min-height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 28px;
    pointer-events: none;
}

.brand-kicker,
.brand-note,
.card-head p {
    margin: 0;
    color: var(--moon-soft);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.brand-stage h1 {
    margin: 10px 0 12px;
    color: rgba(243, 240, 231, 0.08);
    font-size: clamp(44px, 8vw, 108px);
    line-height: 0.95;
    letter-spacing: 0.08em;
    font-weight: 900;
    user-select: none;
}

.brand-note {
    letter-spacing: 0.08em;
    color: rgba(220, 196, 164, 0.84);
}

.login-card {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(243, 240, 231, 0.12), rgba(243, 240, 231, 0.07)),
        rgba(3, 10, 34, 0.62);
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
    padding: 28px;
    border-top: 3px solid rgba(128, 86, 50, 0.5);
}

.card-head {
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(243, 240, 231, 0.14);
}

.card-head h2 {
    margin: 8px 0 0;
    color: var(--moon);
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: 0;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 18px;
    padding: 4px;
    border: 1px solid rgba(243, 240, 231, 0.14);
    border-radius: 6px;
    background: rgba(2, 7, 25, 0.32);
}

.auth-tab {
    height: 38px;
    margin: 0;
    border-color: transparent;
    color: rgba(243, 240, 231, 0.68);
    background: transparent;
    font-size: 14px;
    font-weight: 900;
}

.auth-tab::before,
.code-action::before {
    display: none;
}

.auth-tab.active {
    color: var(--indigo-950);
    background: linear-gradient(180deg, #f8f5eb, #d8d1bf);
}

form {
    display: grid;
    gap: 12px;
    padding-top: 22px;
}

label {
    color: rgba(243, 240, 231, 0.84);
    font-size: 14px;
    font-weight: 700;
}

input {
    width: 100%;
    height: 48px;
    border: 1px solid rgba(243, 240, 231, 0.18);
    border-radius: 6px;
    outline: none;
    padding: 0 14px;
    color: var(--moon);
    background: rgba(2, 7, 25, 0.52);
    font: inherit;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
    color: rgba(243, 240, 231, 0.38);
}

input:focus {
    border-color: rgba(243, 240, 231, 0.58);
    background: rgba(2, 7, 25, 0.72);
    box-shadow: 0 0 0 3px rgba(243, 240, 231, 0.08);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    margin-top: 8px;
    border: 1px solid rgba(243, 240, 231, 0.22);
    border-radius: 6px;
    color: var(--indigo-950);
    background: linear-gradient(180deg, #f8f5eb, #d8d1bf);
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.16s ease, filter 0.16s ease, opacity 0.16s ease;
}

button::before {
    content: "";
    width: 10px;
    height: 10px;
    margin-right: 8px;
    border-radius: 2px;
    background: var(--earth);
    transform: rotate(45deg);
}

button:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.68;
    transform: none;
}

.register-field {
    display: none;
}

body.register-mode .register-field {
    display: block;
}

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

.code-action {
    height: 48px;
    margin: 0;
    color: var(--moon);
    background: rgba(2, 7, 25, 0.52);
    border-color: rgba(243, 240, 231, 0.24);
    font-size: 13px;
}

.code-action:hover {
    background: rgba(2, 7, 25, 0.72);
}

.field-note {
    margin: 8px 0 0;
    color: rgba(220, 196, 164, 0.78);
    font-size: 12px;
    line-height: 1.5;
}

.login-message {
    min-height: 22px;
    color: rgba(243, 240, 231, 0.84);
    font-size: 14px;
    line-height: 1.6;
}

.login-message.error {
    color: #f4b9ad;
}

@media (max-width: 820px) {
    body {
        overflow-y: auto;
    }

    .login-shell {
        min-height: 100svh;
        grid-template-columns: 1fr;
        align-content: center;
        gap: 20px;
    }

    .brand-stage {
        min-height: 210px;
        justify-content: flex-end;
        padding-bottom: 0;
    }

    .login-card {
        padding: 22px;
    }

    .code-row {
        grid-template-columns: 1fr;
    }
}
