*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0d0d0f;
    --surface: #16161a;
    --surface-2: #1e1e24;
    --border: #2a2a35;
    --accent: #7c6af7;
    --accent-glow: rgba(124, 106, 247, 0.25);
    --accent-2: #f7c56a;
    --text: #e8e8f0;
    --text-muted: #8888a0;
    --success: #4ade80;
    --error: #f87171;
    --radius: 12px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Figtree', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* Glow orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}

/* Top Navigation Bar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(13, 13, 15, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand {
    font-family: 'Epilogue', sans-serif;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-brand::before {
    content: '✦';
    color: var(--accent);
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;

}

.btn-nav-outline {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Figtree', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn-nav-outline:hover {
    border-color: var(--accent);
    color: var(--text);
}

.btn-nav-primary {
    padding: 5px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), #9c84f7);
    color: white;
    font-family: 'Figtree', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn-nav-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 106, 247, 0.4);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
}

.user-name {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: 'Figtree', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-logout:hover {
    border-color: var(--error);
    color: var(--error);
}

/* ── Credits badge ── */
.credits-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(124, 106, 247, 0.1);
    border: 1px solid rgba(124, 106, 247, 0.22);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    cursor: default;
}

/* ── Add Credits button ── */
.btn-add-credits {
    padding: 5px 12px;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: transparent;
    color: var(--accent);
    font-family: 'Figtree', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.btn-add-credits:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 12px rgba(124,106,247,0.3);
}

/* Animations */
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Shared input styles ── */
input[type="email"],
input[type="password"],
input[type="text"] {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: 'Figtree', sans-serif;
    font-size: 14px;
    padding: 12px 14px;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    -webkit-appearance: none;
}
input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder { color: var(--text-muted); }

/* ── Card ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    animation: fadeUp 0.6s ease 0.1s both;
    transition: box-shadow 0.3s;
}
.card:hover { box-shadow: 0 0 60px rgba(124,106,247,0.06); }

/* ── Form field ── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }

/* ── Field labels ── */
label {
    font-family: 'Epilogue', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
label span { color: var(--accent); margin-left: 3px; }

/* ── Submit button ── */
.btn-submit {
    width: 70%;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--accent), #9c84f7);
    color: white;
    border: none;

    border-radius: 8px;
    font-family: 'Epilogue', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(124,106,247,0.4);
}
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeDown 0.4s ease both;
}
.alert-error {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--error);
}

.alert-no-credits {
    background: rgba(124,106,247,0.08);
    border: 1px solid rgba(124,106,247,0.3);
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 14px;
    animation: fadeDown 0.4s ease both;
}

.alert-credits-link {
    margin-left: auto;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.alert-credits-link:hover { text-decoration: underline; }

/* ── Auth page centering ── */
.auth-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 60px);
    padding: 80px 16px 40px;
}

.auth-wrapper .card {
    text-align: center;
}

.auth-wrapper .field {
    text-align: left;
}

.auth-wrapper .btn-submit {
    margin-left: auto;
    margin-right: auto;
}

/* ── Divider with label ── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    font-family: 'Figtree', sans-serif;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
}
.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── OAuth / social login button ── */
.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 70%;
    margin-left: auto;
    margin-right: auto;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text);
    font-family: 'Figtree', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0;
    text-transform: none;
}
.btn-oauth:hover {
    border-color: rgba(124,106,247,0.4);
    background: var(--surface);
}

/* ── Fallback orb sizes (page CSS overrides these) ── */
.orb-1 { width: 400px; height: 400px; background: var(--accent); top: -100px; right: -100px; opacity: 0.1; }
.orb-2 { width: 300px; height: 300px; background: var(--accent-2); bottom: -50px; left: -50px; opacity: 0.07; }

@media (max-width: 480px) {
    .card { padding: 28px 20px; }
    .auth-wrapper { padding: 70px 16px 32px; }
}
