:root {
    --bg-color: #0e1120;
    --bg-deep: #090b16;
    --surface: #151a2e;
    --surface-2: #1c2238;
    --line: rgba(255, 255, 255, 0.08);
    --line-gold: rgba(255, 189, 41, 0.25);
    --accent-color: #ffbd29;
    --accent-strong: #ffa600;
    --gold-gradient: linear-gradient(135deg, #ffd370 0%, #ffbd29 45%, #ffa600 100%);
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.65);
    --text-faint: rgba(255, 255, 255, 0.45);
    --text-over-accent: #0e1120;
    --error-color: #ff6279;
    --glow-gold: 0 0 24px rgba(255, 189, 41, 0.35);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-deep: 0 24px 60px rgba(0, 0, 0, 0.5);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@font-face {
    font-family: 'Formula Condensed';
    src: url('/fonts/FormulaCondensed-Light.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'Gilroy Regular';
    src: url('/fonts/Gilroy-Regular.ttf') format('truetype');
    font-display: swap;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body,
#root {
    min-height: 100%;
}

html {
    background: var(--bg-color);
    overflow-y: auto;
}

::selection {
    background: var(--accent-color);
    color: var(--bg-color);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

body {
    margin: 0;
    min-height: 100dvh;
    background-color: var(--bg-color);
    background-image: radial-gradient(
            ellipse 80% 50% at 50% -10%,
            rgba(255, 189, 41, 0.08),
            transparent
        ),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(255, 189, 41, 0.04), transparent);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Gilroy Regular', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-width: 320px;
}

#root {
    min-height: 100dvh;
}

/* ---- Top navigation bar ---- */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: center;
    padding: 10px 24px;
    pointer-events: none;
    /* Match .page / .grid width */
    max-width: 1340px;
    margin: 0 auto;
    left: 0;
    right: 0;
    width: 100%;
}

.top-bar-inner {
    pointer-events: all;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    /* iOS-style pill container */
    height: 62px;
    padding: 6px 6px 6px 10px;
    border-radius: 9999px;
    animation: navSlideDown 0.45s var(--ease-out) both;
    /* Frosted glass */
    background: rgba(20, 16, 12, 0.72);
    backdrop-filter: blur(30px) saturate(1.8);
    -webkit-backdrop-filter: blur(30px) saturate(1.8);
    /* Thin white border highlight at top */
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.12) inset, 0 -1px 0 0 rgba(0, 0, 0, 0.5) inset,
        0 8px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.top-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Right container snaps to end of its grid cell */
.top-bar-container--right {
    justify-self: end;
}

.top-bar-logo-link {
    display: flex;
    align-items: center;
    /* On desktop: ordered to the front of the flex row (before links) */
    order: -1;
    margin-right: 4px;
    transition: transform 0.25s var(--ease-spring);
}

.top-bar-logo-link:hover {
    transform: scale(1.1) rotate(-4deg);
}

.top-bar-logo {
    height: 41px;
    width: auto;
    display: block;
    margin: 0 8px;
}

@keyframes navSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none; /* must be none, not scale(1) — avoids stacking context that breaks backdrop-filter */
    }
}

/* ---- Page layout ---- */
.page {
    max-width: 1340px;
    margin: 0 auto;
    padding: 24px;
    min-height: calc(100dvh - 82px);
    position: relative;
    z-index: 2;
}

.env-badge {
    font-size: 9px;
    font-family: 'Formula Condensed', sans-serif;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1;
    align-self: flex-end;
    padding-bottom: 3px;
    margin-left: 2px;
}

/* iOS-style pill chip for icon buttons (logout, settings) */
.player-chip {
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 9999px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0;
    position: relative;
    z-index: 1;
}

.player-chip:hover {
    color: rgba(255, 255, 255, 1);
}

.player-chip:active {
    transform: scale(0.94);
}

/* iOS segmented-control style nav links */
.top-bar-links {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 9999px;
    height: 48px;
    position: relative; /* needed for the sliding pill */
}

/* The magic sliding pill */
.top-bar-links-slider {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 41px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
    pointer-events: none;
    transition: left 0.22s var(--ease-out), width 0.22s var(--ease-out), opacity 0.15s ease;
    z-index: 0;
}

.top-bar-links a {
    display: flex;
    align-items: center;
    height: 41px;
    padding: 0 19px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 17px;
    font-weight: 600;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 9999px;
    transition: color 0.22s ease;
    position: relative;
    z-index: 1; /* above the sliding pill */
}

.top-bar-links a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.top-bar-links a:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.4);
    outline-offset: 2px;
}

/* Active / current link: white puck */
.top-bar-links a.active {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
    font-weight: 700;
}

/* ---- Mobile menu ---- */
.top-bar-menu-wrap {
    position: relative;
}

/* Hidden on desktop, visible on mobile */
.top-bar-menu-btn {
    display: none;
}

.menu-btn-icon {
    display: flex;
}

.menu-btn-icon--to-close {
    animation: iconSpinClose 0.22s var(--ease-spring) both;
}

.menu-btn-icon--to-open {
    animation: iconSpinOpen 0.22s var(--ease-spring) both;
}

@keyframes iconSpinClose {
    from { transform: rotate(-90deg) scale(0.5); opacity: 0; }
    to { transform: none; opacity: 1; }
}

@keyframes iconSpinOpen {
    from { transform: rotate(90deg) scale(0.5); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* Glassy dropdown panel */
.top-bar-dropdown {
    position: fixed;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border-radius: 18px;
    background: rgba(20, 16, 12, 0.75);
    backdrop-filter: blur(30px) saturate(1.8);
    -webkit-backdrop-filter: blur(30px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.12) inset, 0 12px 40px rgba(0, 0, 0, 0.55),
        0 4px 12px rgba(0, 0, 0, 0.3);
    animation: dropdownReveal 0.18s var(--ease-out) both;
    z-index: 100;
}

@keyframes dropdownReveal {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.top-bar-dropdown a {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.top-bar-dropdown a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 1);
}

/* Right dropdown: opens to the left */
/* position is set via inline style from the portal */

/* User name header inside right dropdown */
.top-bar-dropdown-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 8px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 12px;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

/* Buttons (logout, settings) inside right dropdown */
.top-bar-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border-radius: 12px;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.top-bar-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 1);
}

/* Desktop: show inline right content, hide mobile button */
.top-bar-right--desktop {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Right icon buttons track — mirrors .top-bar-links */
.top-bar-right-track {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 4px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 9999px;
    height: 48px;
    position: relative;
}

.top-bar-menu-wrap--right {
    display: none;
}

/* Collapse links into hamburger below 700px */
@media (max-width: 700px) {
    .top-bar-links--desktop {
        display: none;
    }

    .top-bar-menu-btn {
        display: flex;
    }

    /* Hide desktop right content, show mobile settings button */
    .top-bar-right--desktop {
        display: none;
    }

    .top-bar-menu-wrap--right {
        display: block;
    }

    .top-bar {
        padding: 8px 12px;
    }

    .top-bar-inner {
        /* Switch to 3-col grid so logo can be truly centered */
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        height: 54px;
        /* Equal padding on all sides so buttons sit symmetrically */
        padding: 6px;
        gap: 6px;
    }

    /* Logo: reset desktop order, place in center column */
    .top-bar-logo-link {
        order: 0;
        justify-self: center;
        margin-right: 0;
    }

    /* Right container: snap to end of its column */
    .top-bar-container--right {
        justify-self: end;
    }

    .top-bar-logo {
        height: 32px;
        margin: 0 4px;
    }

    /* Both mobile icon buttons: same fixed size */
    .top-bar-menu-btn {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }

    .player-chip {
        width: 40px;
        height: 40px;
    }

    .top-bar-container {
        gap: 6px;
    }
}

@media (max-width: 420px) {
    .top-bar-inner {
        height: 50px;
        gap: 4px;
    }

    .player-chip {
        width: 36px;
        height: 36px;
    }
}

/* ---- Error bar ---- */
.error-bar {
    background: rgba(255, 98, 121, 0.1);
    border: 1px solid rgba(255, 98, 121, 0.35);
    color: var(--error-color);
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: 14px;
}

.error-dismiss {
    opacity: 0.6;
    font-size: 12px;
}

/* ---- Game grid ---- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none; /* must be none — scale(1) creates a stacking context that breaks backdrop-filter */
    }
}

.card {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 1px solid rgba(255, 189, 41, 0.12);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    color: inherit;
    transition: transform 0.18s var(--ease-spring), border-color 0.2s ease, box-shadow 0.2s ease;
    animation: cardReveal 0.9s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 160ms);
}

.card:hover:not(.card-busy) {
    transform: translateY(-6px) scale(1.02);
    border-color: var(--accent-color);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--accent-color),
        0 0 28px rgba(255, 189, 41, 0.25);
}

.card:active:not(.card-busy) {
    transform: translateY(-2px) scale(0.98);
}

.card.card-busy {
    opacity: 0.6;
    cursor: wait;
}

@keyframes shimmerSweep {
    from {
        background-position: -200% center;
    }
    to {
        background-position: 200% center;
    }
}

.card-media {
    position: relative;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
}

.card-media::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        115deg,
        transparent 38%,
        rgba(255, 255, 255, 0.22) 50%,
        transparent 62%
    );
    background-size: 250% 100%;
    background-position: 130% center;
    pointer-events: none;
    z-index: 3;
}

.card:hover:not(.card-busy) .card-shine {
    animation: shimmerSweep 0.7s ease;
}

/* ---- Card footer: theme picker + F2P token crediting (left), Play (right) ---- */
.card-footer-left {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.select-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.select-label {
    flex-shrink: 0;
    font-family: 'Formula Condensed', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.card-footer-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

.theme-select {
    appearance: none;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 4px 24px 4px 9px;
    font-family: 'Formula Condensed', sans-serif;
    font-size: 13px;
    letter-spacing: 0.03em;
    text-transform: capitalize;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--accent-color) 50%),
        linear-gradient(135deg, var(--accent-color) 50%, transparent 50%);
    background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    min-width: 0;
    max-width: 100%;
    text-overflow: ellipsis;
}

.theme-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.token-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.04em;
}

.token-credit-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gold-gradient);
    border: none;
    color: var(--bg-color);
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.18s var(--ease-spring), box-shadow 0.2s ease;
}

.token-credit-btn:hover:not(:disabled) {
    transform: scale(1.15);
    box-shadow: 0 4px 14px rgba(255, 189, 41, 0.5);
}

.token-credit-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.card-image {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    transition: transform 0.45s var(--ease-out);
}

.card:hover:not(.card-busy) .card-image {
    transform: scale(1.06);
}

.card-image-blank {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
}

.card-image-blank span {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-faint);
    font-family: 'Formula Condensed', monospace;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 16px;
    min-height: 44px;
    flex-shrink: 0;
    background: var(--surface-2);
    border-top: 1px solid var(--line);
}

.card-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 14px;
    font-weight: 600;
    font-family: 'Formula Condensed', sans-serif;
    font-size: 17px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    z-index: 2;
    pointer-events: none;
}

/* ---- Auth screen (ported from dummy-operator login/register pages) ---- */
.auth-screen {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100dvh - 82px);
    backdrop-filter: blur(40px) saturate(1.8) brightness(1.05);
    -webkit-backdrop-filter: blur(40px) saturate(1.8) brightness(1.05);
}

.auth-ambient {
    position: absolute;
    width: min(80vw, 700px);
    aspect-ratio: 1.2;
    border-radius: 50%;
    background: radial-gradient(
        ellipse,
        rgba(255, 189, 41, 0.13) 0%,
        rgba(255, 189, 41, 0.04) 45%,
        transparent 70%
    );
    animation: glowPulse 6s ease-in-out infinite;
    pointer-events: none;
}

.auth-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    padding: 32px 28px 28px;
    width: min(90%, 380px);
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.22) inset, 0 -1px 0 0 rgba(0, 0, 0, 0.3) inset,
        0 24px 60px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: cardReveal 0.5s var(--ease-out) both;
    color: var(--text-primary);
}

.auth-card h2 {
    color: rgba(255, 255, 255, 0.95);
    font-family: 'Formula Condensed', sans-serif;
    font-size: 1.9rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    margin: 0 0 0.25rem;
}

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
}

.auth-card input,
.auth-card select {
    padding: 0.6rem 0.75rem;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    font-family: inherit;
    transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.2s ease;
}

.auth-card input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.auth-card select option {
    background: #1c2238;
    color: #fff;
}

.auth-card input:focus,
.auth-card select:focus {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.12);
}

/* Kill browser autofill yellow — box-shadow paints over it, long transition hides the color change */
.auth-card input:-webkit-autofill,
.auth-card input:-webkit-autofill:hover,
.auth-card input:-webkit-autofill:focus,
.auth-card input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px rgba(30, 24, 20, 0.6) inset;
    box-shadow: 0 0 0 1000px rgba(30, 24, 20, 0.6) inset;
    -webkit-text-fill-color: rgba(255, 255, 255, 0.9);
    caret-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.15);
    transition: background-color 5000s ease-in-out 0s;
}

.auth-error {
    color: var(--error-color);
    margin: 0;
    padding: 0;
    height: 10px;
    font-size: 0.85rem;
}

.auth-error.shake {
    animation: shake 0.4s ease;
}

.auth-primary-button {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.65rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Formula Condensed', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.18s var(--ease-spring),
        box-shadow 0.2s ease;
}

.auth-primary-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.auth-primary-button:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
    box-shadow: none;
}

.auth-primary-button:disabled {
    opacity: 0.4;
    cursor: wait;
}

.auth-link {
    text-align: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    position: relative;
    transition: color 0.2s ease;
}

.auth-link:hover {
    color: rgba(255, 255, 255, 1);
}

@keyframes glowPulse {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.06);
    }
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    18% {
        transform: translateX(-8px);
    }
    36% {
        transform: translateX(8px);
    }
    54% {
        transform: translateX(-5px);
    }
    72% {
        transform: translateX(5px);
    }
}

.loading-note {
    color: var(--text-muted);
    text-align: center;
    padding: 48px 0;
}

/* ─── Goosicorn mascot strip ─────────────────────────────────────────────── */
/* Matches the .page container: centered, same max-width and side padding. */
.mascot-strip {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 1340px;
    z-index: 40;
    pointer-events: none;
}

/* Perspective grid floor — behind site content, in front of page background */
.mascot-pip {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 1340px;
    height: 280px;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* ─── Settings modal ─────────────────────────────────────────────────────── */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.settings-panel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    padding: 24px 28px 28px;
    min-width: 320px;
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.22) inset, 0 -1px 0 0 rgba(0, 0, 0, 0.3) inset,
        0 24px 60px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.25);
    animation: cardReveal 0.22s var(--ease-out) both;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.settings-title {
    margin: 0;
    font-family: 'Formula Condensed', sans-serif;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.9);
}

.settings-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    line-height: 1;
    padding: 0;
}

.settings-close:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.settings-rows {
    display: flex;
    flex-direction: column;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    user-select: none;
}

.toggle-row:last-child {
    border-bottom: none;
}

.toggle-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.75);
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 24px;
    transition: background 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: var(--bg-color);
}

.mascot-pip::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 80px 60px;
    transform: perspective(180px) rotateX(50deg);
    transform-origin: 50% 100%;
    mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.6) 50%, black 100%);
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.6) 50%,
        black 100%
    );
}
