html {
            color-scheme: dark;
        }

        body {
            min-height: 100vh;
            overflow-x: clip;
            display: flex;
            justify-content: center;
            align-items: center;
            background: radial-gradient(circle at 50% 50%, #15002a 0%, #000000 100%);
            padding: 2rem 1rem;
            position: relative;
        }

        .background-glow {
            position: absolute;
            top: 20%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: min(500px, 100vw);
            height: 500px;
            pointer-events: none;
            background: radial-gradient(circle, rgba(199, 0, 255, 0.15) 0%, rgba(42, 65, 229, 0.05) 50%, transparent 100%);
            z-index: -1;
            filter: blur(80px);
        }

        .auth-container {
            width: 100%;
            max-width: 460px;
            background: rgba(18, 18, 18, 0.5);
            backdrop-filter: var(--glass-blur);
            border: 1px solid var(--glass-border);
            border-radius: 32px;
            padding: 2.75rem 2.25rem;
            box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
            min-width: 0;
        }

        @media (max-width: 480px) {
            .auth-container {
                padding: 2rem 1.25rem;
                border-radius: 24px;
            }
        }

        .auth-header {
            text-align: center;
            margin-bottom: 2.5rem;
        }

        .auth-logo {
            display: inline-block;
            border-radius: 14px;
            margin-bottom: 1.25rem;
        }

        .auth-header img {
            display: block;
            width: 60px;
            height: 60px;
        }

        .auth-header h1 {
            font-family: 'Outfit', sans-serif;
            font-weight: 800;
            font-size: clamp(1.6rem, 6vw, 2rem);
            line-height: 1.15;
            text-wrap: balance;
        }

        .auth-header p {
            color: var(--light);
            font-size: 0.85rem;
            opacity: 0.7;
            margin-top: 0.5rem;
        }

        .tabs {
            display: flex;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 100px;
            padding: 4px;
            margin-bottom: 2rem;
        }

        .tab-btn {
            flex: 1;
            background: none;
            border: none;
            color: white;
            padding: 0.75rem;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            border-radius: 100px;
            transition: opacity 0.2s, background-color 0.2s;
            opacity: 0.7;
        }

        .tab-btn:hover {
            opacity: 1;
        }

        .tab-btn.active {
            background: linear-gradient(135deg, var(--p-base), var(--b-base));
            opacity: 1;
        }

        .form-group {
            margin-bottom: 1.5rem;
            position: relative;
        }

        .form-group label {
            display: block;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--light);
            opacity: 0.85;
            margin-bottom: 0.5rem;
        }

        .input-wrapper {
            position: relative;
        }

        .input-wrapper i {
            position: absolute;
            left: 1.25rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--light);
            opacity: 0.5;
            font-size: 0.95rem;
        }

        .form-control {
            width: 100%;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--glass-border);
            border-radius: 16px;
            padding: 1rem 1.25rem 1rem 3rem;
            color: white;
            font-family: 'Inter', sans-serif;
            font-size: 0.95rem;
            transition: border-color 0.2s, background-color 0.2s;
        }

        .form-control:focus {
            border-color: var(--p-base);
            background: rgba(255, 255, 255, 0.06);
        }

        .form-control:focus-visible {
            outline: var(--focus-ring, 2px solid #e6a8ff);
            outline-offset: 2px;
        }

        .form-control[aria-invalid="true"] {
            border-color: var(--danger, #ff5d73);
        }

        .form-group .field-error {
            margin-top: 6px;
        }

        .username-feedback {
            display: block;
            margin-top: 6px;
            font-size: 0.78rem;
            font-weight: 600;
            color: var(--text-muted, rgba(255, 255, 255, 0.64));
        }
        .username-feedback[data-state="ok"] { color: var(--ok, #3ccf91); }
        .username-feedback[data-state="bad"] { color: var(--danger-text, #ff9aa8); }
        .username-feedback[data-state="checking"] { color: #e6a8ff; }

        .forgot-row {
            text-align: right;
            margin: -0.75rem 0 1rem;
        }

        .link-btn {
            background: none;
            border: 0;
            padding: 4px 2px;
            color: #e6a8ff;
            font: 600 0.8rem/1.2 'Inter', sans-serif;
            cursor: pointer;
            border-radius: 4px;
        }

        .link-btn:hover {
            text-decoration: underline;
        }

        .checkbox-row {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            text-align: left;
        }

        .checkbox-row input {
            margin-top: 3px;
            width: 18px;
            height: 18px;
            flex-shrink: 0;
            accent-color: var(--p-base);
            cursor: pointer;
        }

        .form-group .checkbox-row label {
            font-size: 0.82rem;
            font-weight: 400;
            line-height: 1.45;
            opacity: 0.8;
            margin: 0;
            cursor: pointer;
        }

        .checkbox-row a {
            color: #e6a8ff;
            font-weight: 600;
        }

        .btn-submit {
            width: 100%;
            background: linear-gradient(135deg, var(--p-base), var(--b-base));
            color: white;
            border: none;
            border-radius: 16px;
            padding: 1.1rem;
            font-weight: 700;
            font-size: 0.95rem;
            cursor: pointer;
            transition: transform 0.2s, opacity 0.2s;
            margin-top: 1rem;
            box-shadow: 0 10px 20px rgba(199, 0, 255, 0.25);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            min-height: 52px;
        }

        .btn-submit:hover {
            transform: translateY(-1px);
        }

        .btn-submit:disabled {
            cursor: progress;
            opacity: 0.8;
            transform: none;
        }

        /* A link that looks like the main button (pennysphere-vote's "Sign in to vote") */
        a.btn-submit { text-decoration: none; }

        .separator {
            display: flex;
            align-items: center;
            text-align: center;
            color: var(--light);
            opacity: 0.4;
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 1px;
            margin: 2rem 0;
        }

        .separator::before,
        .separator::after {
            content: '';
            flex: 1;
            border-bottom: 1px solid var(--glass-border);
        }

        .separator:not(:empty)::before {
            margin-right: 1rem;
        }

        .separator:not(:empty)::after {
            margin-left: 1rem;
        }

        .sso-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 1rem;
        }

        .btn-sso {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--glass-border);
            border-radius: 16px;
            padding: 0.9rem;
            color: white;
            font-weight: 600;
            font-size: 0.85rem;
            cursor: pointer;
            transition: background-color 0.2s, border-color 0.2s;
        }

        .btn-sso:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .btn-sso:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.25);
        }

        .btn-sso i {
            font-size: 1rem;
        }

        .alert-box {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #f87171;
            padding: 0.9rem 1.25rem;
            border-radius: 16px;
            font-size: 0.8rem;
            margin-bottom: 1.5rem;
            display: none;
            align-items: center;
            gap: 0.75rem;
        }

        .alert-box.success {
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid rgba(16, 185, 129, 0.2);
            color: #34d399;
        }

        .loading-spinner {
            display: none;
            width: 20px;
            height: 20px;
            border: 3px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            border-top-color: white;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }

        .back-link {
            display: block;
            text-align: center;
            margin-top: 2rem;
            color: var(--light);
            text-decoration: none;
            font-size: 0.8rem;
            opacity: 0.7;
            transition: opacity 0.2s;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
            border-radius: 4px;
        }

        .back-link:hover {
            opacity: 1;
            color: white;
        }

        .sso-banner {
            background: rgba(199, 0, 255, 0.05);
            border: 1px solid rgba(199, 0, 255, 0.2);
            color: rgba(255, 255, 255, 0.9);
            font-size: 0.75rem;
            line-height: 1.5;
            padding: 0.8rem 1rem;
            border-radius: 16px;
            margin-top: 1.25rem;
            text-align: left;
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .sso-banner i {
            color: #C700FF;
            font-size: 0.9rem;
            margin-top: 2px;
        }

/* Live password checklist (sign-up): the same five requirements as every Avlory app */
.password-rules {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.password-rules-title { margin: 0 0 4px; }
.password-rules ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 3px;
}
.password-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
}
.password-rules li i { width: 1em; font-size: 0.8rem; }
.password-rules li.met { color: var(--ok); }

/* "Check your email" after creating an account */
.check-email { text-align: center; }
.check-email-icon {
    font-size: 2.2rem;
    color: var(--accent-text);
    margin-bottom: 1rem;
}
.check-email h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.check-email h2:focus { outline: none; }
.check-email p {
    color: var(--light);
    opacity: 0.8;
    font-size: 0.88rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.check-email .check-email-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 1;
    margin-top: 0.5rem;
}
.check-email-resend {
    width: 100%;
    margin-top: 0.75rem;
    min-height: 48px;
}
.check-email .check-email-note {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    opacity: 1;
}
.check-email-note[data-state="ok"] { color: var(--ok); }
.check-email-note[data-state="bad"] { color: var(--danger-text); }

/* Two-step sign-in: "Confirm it's you" (js/two-step.js). Also used by confirm.html for the apps. */
.two-step { text-align: center; }
.two-step-icon {
    font-size: 2.2rem;
    color: var(--accent-text);
    margin-bottom: 1rem;
}
.two-step h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.two-step h2:focus { outline: none; }
.two-step p {
    color: var(--light);
    font-size: 0.88rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.two-step .two-step-lede { opacity: 0.85; margin-bottom: 1.25rem; }
.two-step .two-step-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
.two-step .two-step-status { margin-top: 0.75rem; font-weight: 600; }
.two-step .two-step-error { margin-top: 0.5rem; }
.two-step .btn-submit, .two-step .btn-sso { width: 100%; min-height: 48px; margin-top: 0.75rem; }
.two-step form { margin-top: 1rem; text-align: left; }
.two-step #two-step-code {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.4em;
    font-size: 1.2rem;
}
.two-step .two-step-remember {
    justify-content: center;
    margin-top: 1rem;
    text-align: left;
}
.two-step .two-step-cancel { margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) {
    .loading-spinner { animation-duration: 2.4s; }
    .btn-submit, .btn-submit:hover { transition: none; transform: none; }
}

/* Pages whose card swaps "Loading…" for its result (confirm, pennysphere-vote): the card sits a little below the top
   instead of in the middle, so a taller result grows downwards and nothing on screen jumps (layout shift). */
body.auth-steady { align-items: flex-start; padding-top: clamp(2rem, 10vh, 6rem); }
