*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --red: #c0392b;
    --red-dark: #a93226;
    --red-light: #e74c3c;
    --gold: #d4a044;
    /* 亮色调整：背景更浅白，卡片保持纯白 */
    --bg: #f8f7f3;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-label: #8c8c8c;
    --border: #e2ded6;
    --input-bg: #fcfbf9;
    --input-focus-bg: #ffffff;
}

body {
    font-family: 'Karla', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}


@keyframes driftGlow {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -25px) scale(1.08);
    }

    50% {
        transform: translate(-15px, 20px) scale(0.94);
    }

    75% {
        transform: translate(-28px, -10px) scale(1.04);
    }
}

/* 入场动画 */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(22px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-wrapper {
    animation: fadeUp 0.6s ease both;
}

.login-card {
    animation: fadeUp 0.6s 0.1s ease both;
}

.login-footer-links {
    animation: fadeUp 0.6s 0.18s ease both;
}

/* 登录卡片容器 */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 44px 40px 40px;
    width: 100%;
    position: relative;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}

/* 卡片顶部红色装饰线 */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 40px;
    right: 40px;
    height: 2px;
    background: var(--red);
    border-radius: 0 0 1px 1px;
}

/* Logo 区域 */
.logo-area {
    display: flex;
    justify-content: center;
    margin-bottom: 34px;
}

.logo-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    cursor: default;
    user-select: none;
}

/* 标题区域 */
.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-welcome {
    font-family: 'Karla', sans-serif;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.login-title {
    font-family: 'EB Garamond', serif;
    font-size: 38px;
    font-weight: 400;
    line-height: 1.08;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* 表单 */
.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group label {
    display: block;
    font-family: 'Karla', sans-serif;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-bottom: 7px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 13px;
    z-index: 2;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0aca5;
}

.input-icon svg {
    width: 15px;
    height: 15px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    font-family: 'Karla', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
    transition: all 0.2s ease;
    outline: none;
}

.form-group input::placeholder {
    color: #c4bfb7;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.form-group input:hover {
    border-color: #c5c0b8;
    background: var(--input-focus-bg);
}

.form-group input:focus {
    border-color: var(--red);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.06);
    outline: none;
}

.form-group input.error {
    border-color: var(--red-light);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.05);
}

.password-toggle {
    position: absolute;
    right: 10px;
    z-index: 2;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    color: #b0aca5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 3px;
}

.password-toggle:hover {
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.02);
}

.password-toggle svg {
    width: 16px;
    height: 16px;
}

/* 选项行 */
.options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 12px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-family: 'Karla', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    transition: color 0.2s;
}

.remember-me:hover {
    color: var(--text);
}

.remember-me input[type="checkbox"] {
    display: none;
}

.custom-checkbox {
    width: 17px;
    height: 17px;
    border: 1.5px solid #c5c0b8;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    background: #fff;
}

.custom-checkbox::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
    opacity: 0;
    transition: opacity 0.15s;
}

.remember-me input:checked+.custom-checkbox {
    background: var(--red);
    border-color: var(--red);
}

.remember-me input:checked+.custom-checkbox::after {
    opacity: 1;
}

.forgot-link {
    font-family: 'Karla', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 4px 0;
}

.forgot-link:hover {
    color: var(--red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 登录按钮 */
.btn-login {
    width: 100%;
    padding: 14px;
    font-family: 'Karla', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--red);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    background: var(--red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(192, 57, 43, 0.22);
}

.btn-login:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(192, 57, 43, 0.15);
    transition: all 0.08s;
}

.btn-login:focus-visible {
    outline: 3px solid rgba(192, 57, 43, 0.3);
    outline-offset: 2px;
}

.btn-login.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-login .btn-text {
    transition: opacity 0.2s;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login .spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
}

.btn-login.loading .spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 红色装饰短线 */
.accent-line {
    height: 2px;
    background: var(--red);
    width: 40px;
    margin: 0 auto 0;
}

/* 底部注册提示 */
.register-hint {
    text-align: center;
    margin-top: 22px;
    font-family: 'Karla', sans-serif;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.register-hint a {
    color: var(--red);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 11px;
}

.register-hint a:hover {
    color: var(--red-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* 文学引用 */
.card-quote {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.card-quote-text {
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    font-style: italic;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.card-quote-author {
    font-family: 'Karla', sans-serif;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-label);
    margin-top: 6px;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(-130px);
    background: #1a1a1a;
    color: #fff;
    padding: 12px 26px;
    border-radius: 4px;
    font-family: 'Karla', sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 100;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #2d6a4f;
    color: #fff;
}

.toast.error {
    background: #c0392b;
    color: #fff;
}

/* 页脚链接 */
.login-footer-links {
    text-align: center;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.login-footer-links a {
    font-family: 'Karla', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    margin: 0 10px;
}

.login-footer-links a:hover {
    color: var(--text);
}

.login-footer-links span {
    color: #c5c0b8;
    font-size: 10px;
}

/* ══════════════════════════════════════
               响应式设计
            ══════════════════════════════════════ */

@media (max-width: 520px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 32px;
    }

    .login-card {
        padding: 32px 22px 28px;
        border-radius: 5px;
    }

    .login-card::before {
        left: 22px;
        right: 22px;
    }

    .login-title {
        font-size: 30px;
    }

    .login-welcome {
        font-size: 9.5px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .form-group label {
        font-size: 8.5px;
    }

    .form-group input {
        padding: 11px 12px 11px 36px;
        font-size: 13px;
        border-radius: 3px;
    }

    .input-icon {
        left: 10px;
    }

    .input-icon svg {
        width: 14px;
        height: 14px;
    }

    .password-toggle {
        right: 6px;
        padding: 5px 6px;
    }

    .password-toggle svg {
        width: 14px;
        height: 14px;
    }

    .btn-login {
        padding: 13px;
        font-size: 11.5px;
        letter-spacing: 0.12em;
    }

    .options-row {
        font-size: 10.5px;
        margin-bottom: 20px;
        gap: 8px;
    }

    .remember-me {
        font-size: 10px;
    }

    .forgot-link {
        font-size: 10px;
    }

    .card-quote {
        margin-top: 22px;
        padding-top: 16px;
    }

    .card-quote-text {
        font-size: 13px;
    }

    .card-quote-author {
        font-size: 8.5px;
    }

    .register-hint {
        font-size: 10.5px;
        margin-top: 16px;
    }

    .register-hint a {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .login-card {
        padding: 26px 16px 22px;
    }

    .login-card::before {
        left: 16px;
        right: 16px;
    }

    .login-title {
        font-size: 26px;
    }

    .logo-area {
        margin-bottom: 24px;
    }

    .login-header {
        margin-bottom: 22px;
    }

    .form-group input {
        padding: 10px 10px 10px 32px;
        font-size: 12px;
    }

    .input-icon {
        left: 8px;
    }

    .input-icon svg {
        width: 13px;
        height: 13px;
    }

    .btn-login {
        padding: 12px;
        font-size: 11px;
    }

    .options-row {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .card-quote-text {
        font-size: 12px;
    }
}

@media (min-width: 768px) {
    .login-card {
        padding: 48px 44px 44px;
    }

    .login-title {
        font-size: 42px;
    }
}

@media (min-width: 1200px) {
    .login-wrapper {
        max-width: 460px;
    }

    .login-card {
        padding: 52px 48px 48px;
        border-radius: 8px;
    }

    .login-card::before {
        left: 48px;
        right: 48px;
    }

    .login-title {
        font-size: 46px;
    }
}
