/* ============================================================
   NYX — auth (login / register)
   Modern glass card on a calm cosmic gradient. No canvas,
   no floating eyes, no theatrics — just fast and clean.
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    background: #060411;
    color: #f2f0ff;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(1000px 700px at 85% -10%, rgba(124, 58, 237, 0.22), transparent 60%),
        radial-gradient(900px 700px at -10% 110%, rgba(217, 70, 239, 0.14), transparent 55%),
        linear-gradient(180deg, #07050f 0%, #0b0818 55%, #120c26 100%);
    z-index: 0;
}

/* Twinkling dust — pure CSS, cheap */
.space-dust {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 22%, rgba(240,244,255,0.8) 50%, transparent 51%),
        radial-gradient(1px 1px at 28% 74%, rgba(240,244,255,0.6) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 43% 12%, rgba(240,244,255,0.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 58% 62%, rgba(240,244,255,0.7) 50%, transparent 51%),
        radial-gradient(2px 2px at 69% 28%, rgba(240,244,255,0.45) 50%, transparent 51%),
        radial-gradient(1px 1px at 82% 83%, rgba(240,244,255,0.6) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 91% 44%, rgba(240,244,255,0.5) 50%, transparent 51%),
        radial-gradient(1px 1px at 7% 89%, rgba(240,244,255,0.55) 50%, transparent 51%);
    background-size: 900px 700px;
    opacity: 0.5;
    animation: dustDrift 40s linear infinite alternate;
}

@keyframes dustDrift {
    from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
    to   { background-position: 80px -40px, -50px 60px, 30px 20px, -70px -50px, 60px 40px, -30px 80px, 40px -60px, -50px -30px; }
}

/* --- Auth page shell --- */
.auth-wrap {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px
        calc(max(env(safe-area-inset-right, 0px), 20px))
        calc(max(env(safe-area-inset-bottom, 0px), 20px))
        calc(max(env(safe-area-inset-left, 0px), 20px));
    overflow-y: auto;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 34px 28px 26px;
    background: rgba(16, 13, 31, 0.6);
    border: 1px solid rgba(151, 131, 255, 0.14);
    border-radius: 26px;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: cardIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 26px;
}

.brand-mark {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8b5cf6, #a855f7 45%, #d946ef);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.4);
    margin-bottom: 18px;
}

.moon-symbol {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #fdfdff, #cfd0ff 55%, #9aa0ff);
    box-shadow: inset -7px -3px 0 rgba(6, 4, 17, 0.85);
}

.auth-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.28em;
    margin-right: -0.28em;
    background: linear-gradient(135deg, #e6e1ff, #c4b5fd 55%, #f0abfc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.auth-sub {
    margin-top: 8px;
    font-size: 0.88rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(196, 181, 253, 0.75);
}

/* --- Form --- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.field label {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(242, 240, 255, 0.55);
    letter-spacing: 0.02em;
}

.field input {
    width: 100%;
    padding: 13px 16px;
    background: rgba(10, 8, 22, 0.75);
    border: 1px solid rgba(151, 131, 255, 0.18);
    border-radius: 14px;
    color: #f2f0ff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    -webkit-appearance: none;
}

.field input::placeholder { color: rgba(242, 240, 255, 0.3); }

.field input:focus {
    border-color: #a855f7;
    background: rgba(10, 8, 22, 0.95);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 0 24px rgba(139, 92, 246, 0.12);
}

.submit-btn {
    margin-top: 6px;
    padding: 14px 18px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
    background: linear-gradient(135deg, #7c3aed, #a855f7 50%, #d946ef);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(139, 92, 246, 0.35);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s, filter 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(139, 92, 246, 0.45);
    filter: brightness(1.05);
}

.submit-btn:active { transform: translateY(0) scale(0.98); }
.submit-btn:disabled { opacity: 0.6; cursor: default; transform: none; }

.form-links {
    margin-top: 18px;
    text-align: center;
}

.nyx-link {
    color: rgba(196, 181, 253, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nyx-link:hover { color: #e6e1ff; }

/* --- Feedback --- */
.error-message, .success-message {
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
    text-align: center;
    animation: fadeSlide 0.25s ease-out;
}

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

.error-message {
    background: rgba(251, 113, 133, 0.12);
    border: 1px solid rgba(251, 113, 133, 0.3);
    color: #fda4af;
}

.success-message {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #6ee7b7;
}

/* --- Loading overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(6, 4, 17, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: opacity 0.25s ease;
}

.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(151, 131, 255, 0.2);
    border-top-color: #a855f7;
    animation: spin 0.8s linear infinite;
}

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

.loading-text { font-size: 1.05rem; font-weight: 500; color: #e6e1ff; }
.loading-details { font-size: 0.85rem; color: rgba(242, 240, 255, 0.5); margin-top: -10px; }

/* --- Responsive --- */
@media (max-width: 480px) {
    .auth-card { padding: 26px 20px 22px; }
    .brand-mark { width: 54px; height: 54px; border-radius: 18px; }
    .auth-title { font-size: 1.4rem; }
    .field input { padding: 12px 14px; }
}