:root {
    --color-bg: #f5f7fb;
    --color-bg-card: #ffffff;
    --color-primary: #2563eb;
    --color-primary-soft: rgba(37, 99, 235, 0.08);
    --color-accent: #16a34a;
    --color-border: rgba(148, 163, 184, 0.5);
    --color-text: #0f172a;
    --color-text-muted: #6b7280;
    --color-error: #dc2626;
    --radius-lg: 18px;
    --radius-md: 10px;
    --transition-fast: 0.18s ease-out;
    --shadow-soft: 0 16px 40px rgba(15, 23, 42, 0.12);
}

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #e5edff 0, #f5f7fb 45%, #eef2ff 100%);
    color: var(--color-text);
}

body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* 카드 */
.login-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 28px 26px 26px;
    border-radius: var(--radius-lg);
    background: var(--color-bg-card);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-soft);
    animation: card-fade-in 0.35s ease-out;
    z-index: 2;
}

/* 브랜드 영역 */
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: radial-gradient(circle at 20% 0, #60a5fa, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #eff6ff;
    font-size: 18px;
    box-shadow: 0 0 0 1px rgba(191, 219, 254, 0.8);
}

.brand-text h1 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand-text p {
    margin: 3px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* 메시지 영역 */
.messages {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.message {
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: #f9fafb;
}

.message.error {
    border-color: rgba(248, 113, 113, 0.7);
    color: #b91c1c;
    background: #fef2f2;
}

.message.success {
    border-color: rgba(34, 197, 94, 0.7);
    color: #166534;
    background: #ecfdf3;
}

.message.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease-out;
}

/* 폼 요소 */
form {
    margin-top: 4px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #111827;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: var(--radius-md);
    background: #f9fafb;
    border: 1px solid var(--color-border);
    padding: 0 10px;
    transition: border-color var(--transition-fast),
                box-shadow var(--transition-fast),
                background var(--transition-fast),
                transform 0.12s ease-out;
}

.input-wrapper:focus-within {
    border-color: rgba(37, 99, 235, 0.95);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
    background: #eef2ff;
    transform: translateY(-1px);
}

.input-icon {
    font-size: 15px;
    margin-right: 6px;
    opacity: 0.8;
}

.input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 10px 6px;
    font-size: 14px;
    color: var(--color-text);
}

.input-wrapper input::placeholder {
    color: rgba(148, 163, 184, 0.8);
}

/* 패스워드 토글 버튼 */
.password-toggle {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 4px;
    margin-left: 6px;
    border-radius: 999px;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.password-toggle:hover {
    color: var(--color-text);
    background: rgba(148, 163, 184, 0.18);
}

.password-rules {
    list-style: none;
    margin: 6px 0 0;
    padding-left: 0;
    font-size: 11px;
    color: var(--color-text-muted);
}

.password-rules li {
    margin-bottom: 2px;
    transition: color 0.15s ease-out;
}

.password-rules li.rule-ok {
    color: #16a34a; /* 초록색 */
}

.password-rules li.rule-bad {
    color: var(--color-error);
}

/* 에러 메시지 */
.error-message {
    display: block;
    min-height: 14px;
    font-size: 11px;
    margin-top: 4px;
    color: var(--color-error);
}

/* 버튼 / 푸터 */
.form-actions {
    margin-top: 14px;
    margin-bottom: 10px;
}

.btn-primary {
    width: 100%;
    border: none;
    outline: none;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f9fafb;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    transition: transform 0.09s ease-out,
                box-shadow 0.09s ease-out,
                filter 0.09s ease-out;
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 14px 36px rgba(37, 99, 235, 0.5);
}

.hint-message {
    display: block;
    font-size: 11px;
    margin-top: 3px;
    color: var(--color-text-muted);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(30, 64, 175, 0.45);
}

.form-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.link-signup {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    position: relative;
}

.link-signup::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, #60a5fa, #16a34a);
    transition: width 0.18s ease-out;
}

.link-signup:hover::after {
    width: 100%;
}

/* 배경 장식 - 밝은 톤 */
.login-bg-deco {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.circle {
    position: absolute;
    border-radius: 999px;
    filter: blur(40px);
    opacity: 0.7;
}

.circle-1 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at center, rgba(96, 165, 250, 0.6), transparent 70%);
    top: -60px;
    right: -40px;
}

.circle-2 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at center, rgba(52, 211, 153, 0.6), transparent 70%);
    bottom: -80px;
    left: -40px;
}

.circle-3 {
    width: 160px;
    height: 160px;
    background: radial-gradient(circle at center, rgba(251, 191, 36, 0.5), transparent 70%);
    bottom: 10%;
    right: 12%;
    opacity: 0.5;
}

/* 애니메이션 */
@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.login-card.shake {
    animation: shake 0.38s cubic-bezier(.36,.07,.19,.97);
}

/* 에러 인풋 표시 */
.input-wrapper input.input-error {
    color: #b91c1c;
}

.input-wrapper:has(input.input-error) {
    border-color: rgba(220, 38, 38, 0.85);
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.4);
}

/* 반응형 */
@media (max-width: 640px) {
    .login-card {
        max-width: 100%;
        padding: 22px 18px 20px;
    }

    .login-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: 48px;
    }

    .brand-text h1 {
        font-size: 16px;
    }

    .brand-text p {
        font-size: 11px;
    }
}