.email-auth { color: #f5f5f5; margin-bottom: 20px; min-width: 0; }
@media (min-width: 1024px) {
    #app .login-overlay.email-enabled { overflow-y: auto; overflow-x: hidden; align-items: flex-start; padding: 32px 24px 88px; }
    #app .email-enabled .login-layout { flex-shrink: 0; margin-top: auto; margin-bottom: auto; }
}
.email-auth-modes { display: flex; gap: 4px; border-bottom: 1px solid #ffffff30; margin-bottom: 20px; }
.email-auth button { cursor: pointer; font: inherit; }
.email-auth-modes button { flex: 1; padding: 10px 2px; font-size: 13px; color: #c5c5c5; border-bottom: 2px solid transparent; }
.email-auth-modes button[aria-pressed="true"] { color: #ffd700; border-color: #ffd700; }
.email-auth h2 { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
.email-auth form > label:not(.email-auth-consent) { display: block; font-size: 14px; margin: 14px 0 6px; }
.email-auth-field { position: relative; min-width: 0; flex: 1; }
.email-auth-field::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 2px; background: #ffd700; box-shadow: 0 0 15px #ffd700cc; transform: scaleX(0); transform-origin: left; transition: transform .5s; pointer-events: none; }
.email-auth-field:focus-within::after { transform: scaleX(1); }
.email-auth input:not([type="checkbox"]) { box-sizing: border-box; display: block; width: 100%; min-width: 0; min-height: 52px; border: 0; border-bottom: 2px solid #ffffff33; border-radius: 0; padding: 12px 8px; background: #ffffff0d; color: #fff; font: inherit; font-size: 16px; transition: border-color .2s, background-color .2s; }
.email-auth .email-auth-field input:focus-visible { outline: none; background-color: #ffffff14; }
.email-auth input::placeholder { color: #a9a9a9; }
.email-auth input[type="checkbox"]:focus-visible, .email-auth button:focus-visible { outline: 2px solid #ffd700; outline-offset: 3px; }
.email-auth-code-row { display: flex; flex-direction: column; gap: 8px; }
.email-auth-code-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
#email-auth-code-status { min-width: 0; flex: 1; margin: 0; color: #c0c0c0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.email-auth-code-row button { flex-shrink: 0; width: 8em; min-height: 48px; padding: 6px 8px; border: 1px solid #ffffff40; border-radius: 6px; font-size: 13px; color: #ffd700; font-variant-numeric: tabular-nums; transition: border-color .2s, background-color .2s; }
.email-auth button:disabled { cursor: not-allowed; opacity: .5; }
.email-auth-hint { font-size: 12px; line-height: 1.6; color: #c0c0c0; margin: 8px 0; }
.email-auth-consent { display: flex; gap: 9px; align-items: flex-start; margin: 18px 0 8px; font-size: 12px; line-height: 1.8; }
.email-auth-consent input { flex-shrink: 0; margin-top: 4px; accent-color: #ffd700; }
.email-auth-consent button, .email-auth-forgot { color: #ffd700; text-decoration: underline; text-underline-offset: 3px; }
.email-auth .email-auth-submit { position: relative; display: block; overflow: hidden; width: 100%; min-height: 56px; margin-top: 20px; padding: 12px 16px; background: #ffd700; color: #111; border-radius: 0; font-weight: 700; transform: skewX(-4deg); box-shadow: 0 8px 20px #0003; transition: transform .2s, filter .2s; }
.email-auth-submit > span { position: relative; z-index: 1; display: block; transform: skewX(4deg); }
.email-auth-submit::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #ffffff80, transparent); transform: translateX(-200%); transition: transform 1s; pointer-events: none; }
@media (hover: hover) {
    .email-auth-submit:not(:disabled):hover { filter: brightness(1.08); transform: skewX(-4deg) scale(1.02); }
    .email-auth-submit:not(:disabled):hover::before { transform: translateX(200%); }
    .email-auth-code-row button:not(:disabled):hover { border-color: #ffd700; background-color: #ffd70014; }
    .email-auth-modes button:hover { color: #ffd700; background-color: #ffd7000a; }
}
.email-auth-submit:not(:disabled):active { transform: skewX(-4deg) scale(.98); }
.email-auth-forgot { display: block; margin: 14px 0 0 auto; font-size: 13px !important; }
.email-auth-notice { padding: 10px 12px; border-left: 2px solid #ffd700; background: #ffd7000a; margin: 16px 0 0; line-height: 1.6; font-size: 13px; color: #f4d57c; overflow-wrap: anywhere; }
.email-auth-notice.is-error { color: #ff999b; border: 0; background: none; padding: 0; }
@media (max-width: 380px) { .email-auth-code-row { gap: 5px; } .email-auth-code-row button { padding: 6px; font-size: 12px; } }

/* Override the base forms plugin while retaining visible keyboard focus. */
.email-auth input:focus { border-color: #ffd700; box-shadow: none; --tw-ring-shadow: 0 0 #0000; --tw-ring-offset-shadow: 0 0 #0000; }
.email-auth-consent input[type="checkbox"] { appearance: none; width: 17px; height: 17px; border: 1px solid #ffffff70; border-radius: 3px; background-color: #ffffff08; color: #ffd700; cursor: pointer; }
.email-auth-consent input[type="checkbox"]:checked { background-color: #ffd700; border-color: #ffd700; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23111' stroke-width='2' d='m3 8 3 3 7-7'/%3E%3C/svg%3E"); }
#app .login-overlay.email-enabled { scrollbar-gutter: stable; }

.email-auth-success { padding: 28px 20px; text-align: center; border: 1px solid #ffd70080; border-radius: 10px; background: #ffd7000d; }
.email-auth-success-mark { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; background: #ffd700; color: #111; font-size: 32px; font-weight: 700; }
.email-auth-success h2 { color: #ffd700; font-size: 24px; }
.email-auth-success p { line-height: 1.8; font-size: 14px; }
.email-auth-success h2:focus-visible { outline: 2px solid #ffd700; outline-offset: 4px; }

#email-auth-confirm-hint { min-height: 1.6em; }
.email-auth button, .email-auth input { touch-action: manipulation; }
@media (prefers-reduced-motion: reduce) {
    .email-auth-field::after, .email-auth input, .email-auth button, .email-auth-submit::before { transition: none; }
    .email-auth-submit::before { display: none; }
    #app .login-overlay .bg-animated, #app .login-overlay .scan-diagonal, #app .login-overlay .stadium-sweep, #app .login-overlay .particle, #app .login-overlay .pulse-accent { animation: none; }
}

/* Animate measured content height instead of jumping between auto heights. */
#app .email-enabled .login-form-card { overflow: hidden; transition: height .32s cubic-bezier(.22, 1, .36, 1); }
@media (prefers-reduced-motion: reduce) {
    #app .email-enabled .login-form-card { transition: none; }
}

/* Anchored validation bubbles do not participate in the card height. */
.email-auth-code-row, .email-auth-consent-field { position: relative; }
.email-auth-error-bubble { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; width: max-content; max-width: 100%; box-sizing: border-box; margin: 0; padding: 9px 12px; border: 1px solid #bca34b; border-radius: 7px; background: #242218; color: #ffe7a3; box-shadow: 0 5px 16px #0005; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; pointer-events: none; animation: email-error-appear .16s ease-out both; }
.email-auth-error-bubble::before { content: ''; position: absolute; top: -5px; left: 18px; width: 8px; height: 8px; background: #242218; border-top: 1px solid #bca34b; border-left: 1px solid #bca34b; transform: rotate(45deg); }
.email-auth input[aria-invalid="true"] { border-bottom-color: #ffd700; }
@keyframes email-error-appear { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .email-auth-error-bubble { animation: none; } }
