/* ============================================================================
   BRAIN Auth Pages - Matching Chat Interface Style
   ============================================================================ */

:root {
    --primary-blue: #1880c0;
    --dark-bg: #0a0e1a;
    --glass-bg: rgba(15, 23, 41, 0.7);
    --glass-border: rgba(24, 128, 192, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --input-bg: rgba(30, 41, 59, 0.4);
    --hover-bg: rgba(24, 128, 192, 0.1);
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --accent-glow: rgba(24, 128, 192, 0.4);
}

body {
    font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
    background: var(--dark-bg);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================================
   Background with Advanced Animations
   ============================================================================ */

.background {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(ellipse at top, #0f1729 0%, #0a0e1a 100%);
    overflow: hidden;
}

/* Animated gradient orbs */
.background::before,
.background::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float-orb 20s ease-in-out infinite;
}

.background::before {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-blue) 0%, transparent 70%);
    top: -200px;
    inset-inline-end: -200px;
    animation-delay: -5s;
}

.background::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #4bb3e3 0%, transparent 70%);
    bottom: -150px;
    inset-inline-start: -150px;
    animation-duration: 25s;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(100px, -100px) scale(1.1);
    }
    66% {
        transform: translate(-50px, 50px) scale(0.9);
    }
}

/* Neural network canvas */
.neural-network {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
}

/* Animated grid pattern overlay */
.auth-container::before {
    content: '';
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(24, 128, 192, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 128, 192, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 30s linear infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes gridMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Neural network canvas with enhanced effects */
.neural-network {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
    pointer-events: none;
    z-index: 0;
}

/* Grid overlay effect */
.background::after {
    background-image: 
        linear-gradient(rgba(24, 128, 192, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 128, 192, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.3;
}

/* ============================================================================
   Main Container
   ============================================================================ */

.auth-container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 2rem;
}

/* ============================================================================
   Logo Section
   ============================================================================ */

.logo-section {
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 0 30px rgba(24, 128, 192, 0.5));
    animation: float 6s ease-in-out infinite;
    /* app.css makes every img display:block, so the parent's text-align
       can't centre it — the auto side margins have to do it. */
    margin: 0 auto 1rem;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.logo-section h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.logo-section p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ============================================================================
   Auth Card
   ============================================================================ */

.auth-card {
    width: 100%;
    max-width: 480px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(24, 128, 192, 0.1) inset,
        0 8px 32px rgba(24, 128, 192, 0.1);
    position: relative;
    animation: slideUp 0.6s ease-out 0.2s both;
    overflow: hidden;
}

/* Glass shimmer effect */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(24, 128, 192, 0.1),
        transparent
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        inset-inline-start: -100%;
    }
    100% {
        inset-inline-start: 200%;
    }
}

/* Glowing border effect on hover */
.auth-card::after {
    content: '';
    position: absolute;
    top: -2px;
    inset-inline-start: -2px;
    inset-inline-end: -2px;
    bottom: -2px;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(24, 128, 192, 0.3) 50%,
        transparent 70%
    );
    border-radius: 20px;
    opacity: 0;
    z-index: -1;
    animation: borderGlow 3s linear infinite;
    animation-play-state: paused;
}

.auth-card:hover::after {
    animation-play-state: running;
    opacity: 1;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================================
   Auth Forms
   ============================================================================ */

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeInForm 0.4s ease-out;
}

@keyframes fadeInForm {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-form h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
}

.form-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ============================================================================
   Form Steps
   ============================================================================ */

.register-step,
.reset-step {
    display: none;
}

.register-step.active,
.reset-step.active {
    display: block;
    animation: fadeInForm 0.4s ease-out;
}

/* ============================================================================
   Input Groups
   ============================================================================ */

.input-group {
    margin-bottom: 1.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.optional {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) inset;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary-blue);
    background: rgba(24, 128, 192, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 0 0 3px rgba(24, 128, 192, 0.1),
        0 0 20px rgba(24, 128, 192, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.1) inset;
    transform: translateY(-1px);
}

.input-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 20px;
    padding-inline-end: 2.5rem;
}

.input-group select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

/* Password Strength */
.password-strength {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s;
    border-radius: 2px;
}

.strength-bar.weak {
    width: 33%;
    background: var(--error);
}

.strength-bar.medium {
    width: 66%;
    background: var(--warning);
}

.strength-bar.strong {
    width: 100%;
    background: var(--success);
}

.password-hint,
.password-match {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.password-hint.weak {
    color: var(--error);
}

.password-hint.medium {
    color: var(--warning);
}

.password-hint.strong {
    color: var(--success);
}

.password-match.error {
    color: var(--error);
}

.password-match.success {
    color: var(--success);
}
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding: 12px 44px 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.password-wrapper input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Button */
#toggle-password {
    position: absolute;
    inset-inline-end: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SVG icons */
.icon-eye {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

/* Hide closed by default */
.icon-eye.closed {
    display: none;
}

/* Hover effect */
#toggle-password:hover .icon-eye {
    color: var(--primary-blue);
    transform: scale(1.1);
}
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    width: 100%;
    padding: 12px 44px 12px 14px; /* space for icon */
}

.toggle-password {
    position: absolute;
    inset-inline-end: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* icons */
.icon-eye {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.icon-eye.closed {
    display: none;
}

.toggle-password:hover .icon-eye {
    color: var(--primary-blue);
}
/* ============================================================================
   Checkboxes
   ============================================================================ */

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1e9ad9 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 15px rgba(24, 128, 192, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

/* Button shine effect.
   This is a hover sweep, but it used to be parked at left:-50% on a 200%-wide
   box — so the gradient's bright 50% mid-band landed across the middle of the
   button and sat there permanently, reading as a diagonal seam / lighting
   artifact rather than a highlight. It now stays fully transparent at rest and
   only fades in as it sweeps across on hover. */
.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    inset-inline-start: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    opacity: 0;
    pointer-events: none;
    transition: left 0.6s ease, opacity 0.3s ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1e9ad9 0%, #4bb3e3 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 25px var(--accent-glow),
        0 0 30px rgba(24, 128, 192, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.btn-primary:hover:not(:disabled)::before {
    inset-inline-start: 100%;
    opacity: 1;
}

/* Respect a reduced-motion preference: no sweep, no artifact either way. */
@media (prefers-reduced-motion: reduce) {
    .btn-primary::before,
    .btn-primary:hover:not(:disabled)::before {
        transition: none;
        opacity: 0;
    }
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(24, 128, 192, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary.loading span {
    opacity: 0;
}

.btn-loader {
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.8s linear infinite;
}

.btn-primary.loading .btn-loader {
    opacity: 1;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================================
   OAuth Buttons
   ============================================================================ */

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.oauth-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.oauth-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    inset-inline-start: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(24, 128, 192, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.oauth-btn:hover {
    background: var(--hover-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 
        0 4px 15px rgba(24, 128, 192, 0.2),
        0 0 20px rgba(24, 128, 192, 0.1);
}

.oauth-btn:hover::before {
    width: 300px;
    height: 300px;
}

.oauth-btn:active {
    transform: translateY(0);
}

/* ============================================================================
   Links
   ============================================================================ */

.link {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

.link:hover {
    color: #4bb3e3;
    text-decoration: underline;
}

/* ============================================================================
   Form Footer
   ============================================================================ */

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================================================
   OTP Section
   ============================================================================ */

.otp-info {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(24, 128, 192, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(24, 128, 192, 0.1) inset;
}

.otp-info svg {
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.otp-info p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.otp-info strong {
    color: var(--primary-blue);
}

.otp-inputs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.otp-input,
.reset-otp {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--input-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    color: var(--primary-blue);
    transition: all 0.3s;
    outline: none;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) inset;
}

.otp-input:focus,
.reset-otp:focus {
    border-color: var(--primary-blue);
    background: rgba(24, 128, 192, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 
        0 0 0 3px rgba(24, 128, 192, 0.2),
        0 0 20px rgba(24, 128, 192, 0.3),
        0 0 30px rgba(24, 128, 192, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.1) inset;
    transform: scale(1.05);
}

.otp-input:not(:placeholder-shown),
.reset-otp:not(:placeholder-shown) {
    border-color: var(--primary-blue);
    background: rgba(24, 128, 192, 0.08);
}

.otp-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.otp-timer {
    color: var(--text-secondary);
}

.otp-timer span {
    color: var(--primary-blue);
    font-weight: 600;
}

/* ============================================================================
   Date of Birth Input
   ============================================================================ */

.input-group input[type="date"] {
    color-scheme: dark;
    cursor: pointer;
}

.input-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.55) sepia(1) hue-rotate(165deg) saturate(2);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.input-group input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* Error border state — used when age is under 18 */
.input-group input.input-error {
    border-color: rgba(239, 68, 68, 0.55) !important;
    background: rgba(239, 68, 68, 0.04) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08) !important;
}

/* Inline age-restriction error pill */
.age-error {
    display: none;
    align-items: center;
    gap: 0.45rem;
    padding: 0.65rem 0.875rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: 8px;
    color: var(--error);
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-top: 0.5rem;
}

.age-error.show {
    display: flex;
    animation: fadeInForm 0.2s ease-out;
}

/* Submit button — smooth opacity fade when toggling disabled ↔ active */
.btn-primary {
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s, opacity 0.4s ease;
}

/* ============================================================================
   Age-Gate Form Body Reveal
   ============================================================================ */

/*
 * .form-body wraps the full sign-up form (email, OAuth) and is hidden until
 * the user passes the age-gate (18+ DOB + terms accepted).
 * max-height animation drives the slide-open; opacity fades content in after
 * a tiny delay so the container opens first, then reveals its children.
 */
.form-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition:
        max-height  0.55s cubic-bezier(0.4, 0, 0.2, 1),
        opacity     0.42s ease 0.12s,
        transform   0.42s ease 0.12s;
}

.form-body.revealed {
    max-height: 1600px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition:
        max-height  0.6s  cubic-bezier(0.4, 0, 0.2, 1),
        opacity     0.45s ease 0.1s,
        transform   0.45s ease 0.1s;
}

/* Subtle rule separating the gate from the revealed form */
.age-gate-divider {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: 1.5rem 0;
    opacity: 0.55;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

/* ============================================================================
   MFA (TOTP) enrollment / verification blocks — shared by the admin login
   flow and any future in-page (non-modal) 2FA step.
   ============================================================================ */

.mfa-qr-box {
    display: flex;
    justify-content: center;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.mfa-qr-box img {
    width: 180px;
    height: 180px;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

.mfa-manual {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin-bottom: 1.5rem;
}

.mfa-secret-code {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--primary-blue);
    font-family: monospace;
    letter-spacing: 0.05em;
    word-break: break-all;
}

.mfa-hint {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.mfa-backup-list {
    list-style: none;
    display: grid;
    /* auto-fit, not a hard 1fr 1fr: backup codes are monospace and must not
       wrap mid-code. Two up while each column can hold one, one up below
       that — no media query needed, which also covers the card being
       narrower than the viewport. */
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 0.5rem;
    margin: 0 0 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.mfa-backup-list li {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-align: center;
    /* A code that wraps is a code that gets copied wrong. */
    white-space: nowrap;
}

.mfa-warning {
    color: var(--warning);
    font-size: 0.8125rem;
    text-align: center;
    margin-bottom: 1.25rem;
}

/* ── Mobile ───────────────────────────────────────────────────────────────
   vh doesn't track the collapsing address bar, so a 100vh auth screen is
   ~60px taller than the visible viewport on mobile Safari/Chrome and the
   card ends up scrolled half off. dvh does track it; the vh line above
   stays as the fallback. */
@supports (min-height: 100dvh) {
    body,
    .auth-container { min-height: 100dvh; }
}

@media (max-width: 900px) {
    /* Two 500px orbs behind an 80px blur, animated forever, is the most
       expensive thing on an otherwise static page — and on a phone it is
       paid for in scroll jank and battery. Keep the colour, drop the
       motion, shrink the blur surface. */
    .background::before,
    .background::after {
        animation: none;
        width: 280px;
        height: 280px;
        filter: blur(60px);
    }
}

@media (max-width: 640px) {
    .auth-container {
        padding: 1rem;
        /* Clear the notch and the home indicator. */
        padding-top:    calc(1rem + env(safe-area-inset-top, 0px));
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .auth-card {
        padding: 2rem 1.5rem;
        width: 100%;
    }

    /* 44px is the smallest reliably tappable target. */
    .auth-btn,
    .btn-primary,
    .oauth-btn { min-height: 48px; }

    .input-row {
        grid-template-columns: 1fr;
    }

    .oauth-buttons {
        grid-template-columns: 1fr;
    }

    .otp-inputs {
        gap: 0.5rem;
    }

    .otp-input,
    .reset-otp {
        width: 40px;
        height: 50px;
        font-size: 1.25rem;
    }

    .auth-form h2 {
        font-size: 1.5rem;
    }
}
