.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 55% at 50% -12%, var(--glow), transparent 70%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

.login-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.login-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--heading);
    font-size: 16px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.2s var(--ease);
}

.login-close:hover { background: var(--accent-soft); }

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 44px 36px 36px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: cardAppear 0.5s var(--ease-out);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    font-size: 56px;
    line-height: 1;
}

.login-title {
    margin-top: 6px;
    font-family: var(--font-hand);
    font-size: 60px;
    font-weight: 400;
    line-height: 1.1;
    color: var(--hand);
}

.login-subtitle {
    margin-top: 2px;
    font-family: var(--font-display);
    font-size: 15px;
    font-style: italic;
    color: var(--text-muted);
}

.login-form { display: flex; flex-direction: column; }

.login-label {
    margin: 14px 0 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.login-field { position: relative; display: flex; }

.login-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px; /* 16px stops iOS zooming the page on focus */
    outline: none;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.login-input:focus {
    border-color: var(--accent-hover);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-field .login-input { padding-right: 56px; }

.login-reveal {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--navy);
    cursor: pointer;
}

.login-reveal:hover { background: var(--navy-soft); }

.login-reveal:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.login-reveal .eye-off,
.login-reveal[aria-pressed="true"] .eye-open { display: none; }

.login-reveal[aria-pressed="true"] .eye-off { display: block; }

.login-error {
    min-height: 18px;
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--danger);
}

.login-submit {
    margin-top: 18px;
    padding: 15px 24px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--on-accent);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.login-submit:hover:not(:disabled) { background: var(--accent-hover); }
.login-submit:active:not(:disabled) { transform: scale(0.99); }

.login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-hint {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .login-card  { padding: 38px 24px 30px; }
    .login-title { font-size: 52px; }
    .login-logo  { font-size: 48px; }
}
