@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

* {
    font-family: 'Noto Sans SC', sans-serif;
    will-change: auto;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.25; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -30px) scale(1.08); }
}

@keyframes fragmentAssemble {
    0% {
        opacity: 0;
        transform: translate(var(--startX), var(--startY)) scale(0.6);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

@keyframes shimmer {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes mainCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes successPulse {
    0% { transform: scale(0.95); opacity: 0; }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes rotateShine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes shakeOnce {
    0%, 100% {
        transform: translateY(-50%) translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateY(-50%) translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateY(-50%) translateX(4px);
    }
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

@keyframes flipOnce {
    0% {
        transform: translateY(-50%) rotateY(0deg);
    }
    50% {
        transform: translateY(-50%) rotateY(180deg);
    }
    100% {
        transform: translateY(-50%) rotateY(360deg);
    }
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 2.5s ease-in-out infinite;
    will-change: opacity, transform;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: orbFloat 10s ease-in-out infinite;
    mix-blend-mode: screen;
    will-change: transform;
    pointer-events: none;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.25) 0%, transparent 70%);
    bottom: -80px;
    right: -80px;
    animation-delay: -3.5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.2) 0%, transparent 70%);
    top: 50%;
    right: 15%;
    animation-delay: -7s;
}

.fragment {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
    animation: fragmentAssemble 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    pointer-events: none;
}

.auth-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 20;
    animation: mainCardFadeIn 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
    opacity: 0;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.7), rgba(236, 72, 153, 0.7), transparent);
    animation: shimmer 2.5s ease-in-out infinite;
}

.auth-container {
    position: relative;
    z-index: 10;
}

.auth-button {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 150% 150%;
    color: white;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-position 0.5s ease;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    font-size: 16px;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.auth-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.4s ease;
}

.auth-button:hover {
    transform: translateY(-3px) scale(1.01);
    background-position: 100% 50%;
    box-shadow: 0 12px 28px -8px rgba(99, 102, 241, 0.4);
}

.auth-button:hover::before {
    left: 100%;
}

.auth-button:active {
    transform: translateY(-1px) scale(0.99);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.25s ease, transform 0.25s ease;
    width: 20px;
    height: 20px;
}

.input-field {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 14px;
    padding: 16px 16px 16px 48px;
    width: 100%;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    font-size: 16px;
}

.input-field:focus {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    outline: none;
}

.input-field:focus + .input-icon {
    color: rgba(99, 102, 241, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.input-wrapper:hover .input-icon {
    color: rgba(255, 255, 255, 0.7);
}

.input-wrapper:hover .input-field {
    border-color: rgba(255, 255, 255, 0.15);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.error-message {
    background: rgba(239, 68, 68, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fecaca;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 28px;
    animation: shake 0.6s ease;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.1);
}

.success-message {
    background: rgba(34, 197, 94, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #bbf7d0;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 28px;
    animation: successPulse 0.6s ease;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.1);
}

.logo-container {
    width: 90px;
    height: 90px;
    margin: 0 auto 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 150% 150%;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.4);
    animation: gradientShift 7s ease infinite;
    position: relative;
    overflow: hidden;
}

.logo-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: rotateShine 8s linear infinite;
}

.logo-svg {
    width: 56px;
    height: 56px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.site-title {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
}

.label {
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
    letter-spacing: 0.3px;
}

.default-account {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    text-align: center;
    margin-top: 24px;
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    margin: 24px 0;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.link-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    transform: translateY(-2px);
}

.input-icon.valid {
    color: #22c55e !important;
    filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.6)) !important;
    animation: flipOnce 0.6s ease-out forwards;
}

.input-icon.invalid {
    color: #ef4444 !important;
    filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6)) !important;
    animation: shakeOnce 0.5s ease-out forwards;
}

.input-icon.loading {
    animation: spin 1s linear infinite;
}

@media (max-width: 768px) {
    .auth-card {
        padding: 36px 28px;
        max-width: 100%;
    }

    .logo-container {
        width: 90px;
        height: 90px;
        margin-bottom: 32px;
    }

    .logo-svg {
        width: 46px;
        height: 46px;
    }

    .site-title {
        font-size: 24px;
    }

    .auth-subtitle {
        font-size: 14px;
    }

    .input-field {
        padding: 16px 16px 16px 48px;
        font-size: 16px;
        min-height: 50px;
    }

    .input-icon {
        left: 16px;
        width: 20px;
        height: 20px;
    }

    .auth-button {
        padding: 16px;
        font-size: 16px;
        min-height: 50px;
    }

    .label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .error-message,
    .success-message {
        padding: 14px;
        margin-bottom: 20px;
    }

    .divider {
        margin: 20px 0;
    }

    .link-button {
        padding: 12px 16px;
        min-height: 44px;
        font-size: 14px;
    }

    .default-account {
        font-size: 12px;
        margin-top: 20px;
    }

    .fragment {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 24px;
    }

    .logo-container {
        width: 80px;
        height: 80px;
        margin-bottom: 24px;
        border-radius: 24px;
    }

    .logo-svg {
        width: 40px;
        height: 40px;
    }

    .site-title {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .auth-subtitle {
        font-size: 14px;
    }

    .input-field {
        padding: 14px 14px 14px 44px;
        border-radius: 14px;
        font-size: 15px;
    }

    .input-icon {
        left: 14px;
    }

    .auth-button {
        padding: 14px;
        border-radius: 14px;
    }

    .error-message,
    .success-message {
        padding: 12px;
        border-radius: 14px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 24px 16px;
    }

    .site-title {
        font-size: 20px;
    }

    .input-field {
        font-size: 14px;
    }

    .label {
        font-size: 14px;
    }

    .auth-button {
        font-size: 15px;
    }
}

.input-field,
.auth-button,
.link-button {
    touch-action: manipulation;
}

@media (max-height: 600px) and (orientation: landscape) {
    .auth-card {
        padding: 24px 20px;
        margin-top: 10px;
    }

    .logo-container {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
    }

    .logo-svg {
        width: 36px;
        height: 36px;
    }

    .site-title {
        font-size: 20px;
        margin-bottom: 4px;
    }
}

.login-card,
.register-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4),
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 20;
    animation: mainCardFadeIn 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s forwards;
    opacity: 0;
    overflow: hidden;
}

.login-card::before,
.register-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.7), rgba(236, 72, 153, 0.7), transparent);
    animation: shimmer 2.5s ease-in-out infinite;
}