/* ============================================================
   SHARED AUTH SECTION — GalaxySeven
   Unified auth UI used across all pages (Home, Bebay, etc.)
   Works in two modes:
     .logged-out → centered card with login/register forms
     .logged-in  → compact user bar in premium banner row (right side)
   ============================================================ */

:root {
    --sa-bg: rgba(12, 10, 29, 0.65);
    --sa-bg-card: rgba(17, 24, 39, 0.95);
    --sa-bg-input: rgba(10, 14, 26, 0.9);
    --sa-border: #374151;
    --sa-accent: #9333ea;
    --sa-accent-light: #a855f7;
    --sa-gold: #d4a843;
    --sa-text: #e5e7eb;
    --sa-text-dim: #9ca3af;
    --sa-red: #dc2626;
    --sa-green: #22c55e;
    --sa-blur: 16px;
    --sa-transition: 300ms ease;

    /* Membership badge colors (shared across all pages) */
    --mt-silver: #c0c0c0;
    --mt-gold: #ffd700;
    --mt-diamond: #b9f2ff;
}

/* ── Auth Section Container ──────────────────── */
.shared-auth-section {
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    position: relative;
    padding: 20px;
    box-sizing: border-box;
}

/* Logged-out mode: full-screen modal overlay — always centered, always on top */
.shared-auth-section.logged-out {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

/* Dark backdrop behind the auth card */
.shared-auth-section.logged-out::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    z-index: -1;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ── Auth Container (the card / bar) ─────────── */
.shared-auth-container {
    width: 100%;
    box-sizing: border-box;
}

.shared-auth-section.logged-out .shared-auth-container {
    max-width: 420px;
    background: var(--sa-bg-card);
    border: 1px solid var(--sa-border);
    padding: 36px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ── Title & Subtitle ────────────────────────── */
.shared-auth-title {
    text-align: center;
    margin-bottom: 8px;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--cc-purple), var(--cc-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text; 
    font-family: "Maven Pro", sans-serif;
    color: var(--sa-text);
}

.shared-auth-subtitle {
    text-align: center;
    color: var(--sa-text-dim);
    margin-bottom: 28px;
    font-size: 0.9rem;
}

/* ── Tabs ────────────────────────────────────── */
.shared-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 22px;
    overflow: hidden;
    border: 1px solid var(--sa-border);
}

.shared-auth-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    background: #1f2937;
    color: var(--sa-text-dim);
    border: none;
    font-family: "Montserrat", sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background var(--sa-transition), color var(--sa-transition);
}

.shared-auth-tab.active {
    background: var(--sa-accent);
    color: #fff;
}

.shared-auth-tab:hover:not(.active) {
    background: rgba(147, 51, 234, 0.2);
}

/* ── Forms ───────────────────────────────────── */
.shared-auth-form {
    display: none;
    flex-direction: column;
    gap: 14px;
}

.shared-auth-form.active {
    display: flex;
}

.shared-auth-form input {
    padding: 13px 16px;
    border: 1px solid var(--sa-border);
    background: var(--sa-bg-input);
    color: var(--sa-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.shared-auth-form input:focus {
    border-color: var(--sa-accent);
}

.shared-auth-form input::placeholder {
    color: var(--sa-text-dim);
}

/* Force uppercase on keycode input */
.shared-auth-form input.keycode-input {
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.shared-auth-form input.keycode-input::placeholder {
    text-transform: none;
    letter-spacing: normal;
}

.shared-auth-error {
    color: var(--sa-red);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
}

/* ── Primary Button ──────────────────────────── */
.shared-btn-primary {
    padding: 14px;
    border: none;
    background: var(--sa-accent);
    color: #fff;
    font-family: "Montserrat", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    clip-path: polygon(3% 0, 100% 0, 97% 100%, 0% 100%);
}

.shared-btn-primary:hover {
    background: var(--sa-accent-light);
    transform: translateY(-1px);
}

.shared-btn-primary:active {
    transform: scale(0.98);
}

/* ── Auth Divider ── */
.shared-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
}

.shared-auth-divider span {
    flex: 1;
    color: var(--sa-text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

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

/* ── Google OAuth Button ── */
.shared-btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--sa-border);
    background: #fff;
    color: #1f2937;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    clip-path: polygon(3% 0, 100% 0, 97% 100%, 0% 100%);
    position: relative;
}

.shared-btn-google:hover {
    background: #f9fafb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.shared-btn-google:active {
    transform: scale(0.98);
}

.shared-btn-google:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.shared-btn-google .google-icon {
    flex-shrink: 0;
}

/* ── User Info Panel — Floating right-side box that follows scroll ── */
.shared-auth-user-info {
    position: fixed;
    top: 50px;
    right: 12px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 300px;
    max-width: calc(100vw - 24px);
    padding: 0;
    background: var(--sa-bg);
    backdrop-filter: blur(var(--sa-blur));
    -webkit-backdrop-filter: blur(var(--sa-blur));
    border: 1px solid var(--sa-border);
    box-shadow:
        -4px 0 24px rgba(0, 0, 0, 0.5),
        0 4px 24px rgba(0, 0, 0, 0.3);
    clip-path: none;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    overflow: hidden;
}

/* Retracted: slide off-screen to the right, only toggle button peeks */
.shared-auth-user-info.retracted {
    transform: translateX(calc(100% - 10px));
    opacity: 0.85;
}

/* ── Toggle Arrow Button ──────────────────── */
.sa-toggle-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 56px;
    background: rgba(111, 0, 255, 0.25);
    border: 1px solid rgba(111, 0, 255, 0.4);
    border-right: none;
    color: #c0a8ff;
    font-family: "Montserrat", sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    z-index: 2;
    padding: 0;
    line-height: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.sa-toggle-btn:hover {
    background: rgba(111, 0, 255, 0.45);
    color: #fff;
    box-shadow: 0 0 12px rgba(111, 0, 255, 0.3);
}
.sa-toggle-btn:active {
    transform: translateY(-50%) scale(0.93);
}

/* ── Panel Inner content wrapper ──────────── */
.sa-panel-inner {
    padding: 10px 14px 10px 32px;  /* left pad for toggle button */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Top Row: Welcome + Logout ──────────────── */
.shared-auth-user-top-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.shared-auth-user-top-row .shared-auth-user-welcome {
    border-bottom: none;
    padding-bottom: 0;
    flex: 1;
    min-width: 0;
}

.shared-auth-user-top-row .shared-btn-logout {
    width: auto;
    flex-shrink: 0;
    padding: 4px 10px;
    font-size: 0.65rem;
}

/* ── Refresh Balance Button (small icon in top row) ── */
.sa-refresh-btn {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--sa-text-dim);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}
.sa-refresh-btn:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.sa-refresh-btn:active {
    transform: scale(0.9);
}
.sa-refresh-btn--spinning {
    animation: sa-spin 0.8s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}
@keyframes sa-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.shared-auth-user-welcome {
    color: var(--sa-text-dim);
    font-family: "Montserrat", sans-serif;
    font-size: clamp(0.7rem, 1.2vw, 0.78rem);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.shared-auth-user-welcome strong {
    color: #fff;
    font-weight: 700;
}

.shared-auth-points-display {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--sa-gold);
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: clamp(0.72rem, 1.3vw, 0.85rem);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1;
}

.shared-auth-points-display .pts-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ── Item Value Display (silver, total inventory worth) ── */
.shared-auth-item-value-display {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #C0C0C0;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(192, 192, 192, 0.3);
    flex-shrink: 0;
    line-height: 1;
}

.shared-auth-item-value-display .item-value-icon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    object-fit: contain;
    filter: invert(1);
}

/* ── Cases Opened Display (purple) ── */
.shared-auth-cases-opened-display {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #c084fc;  /* purple */
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(192, 132, 252, 0.3);
    flex-shrink: 0;
    line-height: 1;
}

/* ── Top-Up Balance Display (gold, membership top-up) ── */
.shared-auth-topup-balance-display {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #22c55e;  /* green for top-up */
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.8rem);
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
    flex-shrink: 0;
    line-height: 1;
}

.shared-auth-topup-balance-display .topup-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* ── Loading Skeleton Animation (spoiler guard) ── */
.sa-loading {
    position: relative;
    overflow: hidden;
}
.sa-loading .pts-icon,
.sa-loading .item-value-icon {
    opacity: 0.2;
    filter: grayscale(0.5);
}

/* Hide the text content while loading — show a pulsing skeleton bar */
.sa-loading-value {
    position: relative;
    color: transparent !important;
    text-shadow: none !important;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    min-width: 55px;
    min-height: 16px;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
}
.sa-loading-value::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.35) 40%,
        rgba(255,255,255,0.55) 50%,
        rgba(255,255,255,0.35) 60%,
        rgba(255,255,255,0) 100%
    );
    background-size: 200% 100%;
    animation: sa-shimmer 1s ease-in-out infinite;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
}
/* Pulsing glow ring around the skeleton */
.sa-loading-value::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    animation: sa-pulse-glow 1.2s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes sa-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes sa-pulse-glow {
    0%, 100% { border-color: rgba(255, 255, 255, 0.06); box-shadow: 0 0 4px rgba(255,255,255,0.03); }
    50% { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 0 8px rgba(255,255,255,0.08); }
}

/* ── Inventory Button ──────────────────────── */
.shared-btn-inventory {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2px, 0.4vw, 4px);
    padding: clamp(5px, 0.9vw, 7px) clamp(10px, 1.8vw, 18px);
    border: 1px solid #6366f1;
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    clip-path: none;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.shared-btn-inventory:hover {
    border-color: #818cf8;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.22);
}

/* ── Admin Panel Button ──────────────────────── */
.shared-btn-admin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(2px, 0.4vw, 4px);
    padding: clamp(5px, 0.9vw, 7px) clamp(10px, 1.8vw, 18px);
    border: 1px solid #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    font-family: "Montserrat", sans-serif;
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    clip-path: none;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}

.shared-btn-admin:hover {
    border-color: #fbbf24;
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.2);
}

/* ── Logout Button ───────────────────────────── */
.shared-btn-logout {
    padding: clamp(5px, 0.9vw, 7px) clamp(10px, 1.8vw, 18px);
    border: 1px solid var(--sa-border);
    background: transparent;
    color: var(--sa-text-dim);
    font-family: "Montserrat", sans-serif;
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    clip-path: none;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 100%;
    box-sizing: border-box;
}

.shared-btn-logout:hover {
    border-color: var(--sa-red);
    color: var(--sa-red);
    background: rgba(220, 38, 38, 0.08);
}

/* ── Game Section ────────────────────────────── */
.shared-game-section {
    display: none;
}

.shared-game-section.active {
    display: block;
}

/* ── Toast ───────────────────────────────────── */
.shared-toast {
    position: fixed;
    top: 90px;
    right: 20px;
    background: var(--sa-bg-card);
    border: 1px solid var(--sa-border);
    padding: 14px 20px;
    color: var(--sa-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 320px;
}

.shared-toast.show {
    transform: translateX(0);
}

.shared-toast.success { border-color: var(--sa-green); }
.shared-toast.error { border-color: var(--sa-red); }
.shared-toast.win { border-color: var(--sa-gold); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
    .shared-auth-section.logged-out {
        padding: 16px;
    }
    .shared-auth-section.logged-out .shared-auth-container {
        padding: 24px 18px;
    }
    .shared-auth-title {
        font-size: 1.5rem;
    }

    /* Floating panel: narrower, closer to edge */
    .shared-auth-user-info {
        width: 190px;
        right: 4px;
        top: 50px;
    }
    .shared-auth-user-info.retracted {
        transform: translateX(calc(100% - 8px));
    }
    .sa-toggle-btn {
        width: 24px;
        height: 44px;
        font-size: 0.6rem;
    }
    .sa-panel-inner {
        padding: 8px 10px 8px 28px;
        gap: 6px;
    }

    .shared-auth-user-welcome {
        font-size: 0.65rem;
        padding-bottom: 3px;
    }
    .shared-auth-points-display {
        font-size: 0.7rem;
    }
    .shared-auth-cases-opened-display {
        font-size: 0.7rem;
    }
    .shared-btn-inventory {
        font-size: 0.68rem;
        padding: 5px 10px;
        gap: 2px;
    }
    .shared-btn-admin {
        font-size: 0.68rem;
        padding: 5px 10px;
        gap: 2px;
    }
    .shared-btn-logout {
        font-size: 0.68rem;
        padding: 5px 10px;
    }
}

/* ── PROVABLY FAIR — Settings Button ─────────── */
.sa-pf-settings-btn {
    background: rgba(147, 51, 234, 0.15);
    border: 1px solid rgba(147, 51, 234, 0.3);
    color: #a78bfa;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    font-family: "Montserrat", sans-serif;
    line-height: 1;
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}
.sa-pf-settings-btn:hover {
    background: rgba(147, 51, 234, 0.3);
    color: #c4b5fd;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.25);
}

/* ── PROVABLY FAIR — Modal Overlay ───────────── */
.sa-pf-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.78);
    z-index: 20000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    box-sizing: border-box;
    overflow-y: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sa-pf-modal-overlay.active {
    display: flex;
}

.sa-pf-modal {
    background: rgba(17, 24, 39, 0.97);
    border: 1px solid #374151;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    animation: saPfFadeIn 0.25s ease;
}
@keyframes saPfFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sa-pf-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #374151;
}
.sa-pf-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-family: "Maven Pro", sans-serif;
    color: #e5e7eb;
}
.sa-pf-modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}
.sa-pf-modal-close:hover { color: #fff; }

/* ── Tab Navigation ── */
.sa-pf-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #374151;
    padding: 0 24px;
    overflow-x: auto;
}
.sa-pf-tab-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    text-align: center;
    cursor: pointer;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #9ca3af;
    font-family: "Montserrat", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}
.sa-pf-tab-btn:hover { color: #d1d5db; }
.sa-pf-tab-btn.active {
    color: #a78bfa;
    border-bottom-color: #9333ea;
}

/* ── Tab Panels ── */
.sa-pf-tab-panel {
    display: none;
    padding: 0;
}
.sa-pf-tab-panel.active {
    display: block;
}

/* Make existing body work as tab panel wrapper */
.sa-pf-modal-body-tabs {
    padding: 20px 24px;
}

/* ── User Profile Tab ── */
.sa-pf-profile-section {
    margin-bottom: 18px;
}
.sa-pf-profile-section h4 {
    margin: 0 0 8px 0;
    color: #c4b5fd;
    font-size: 0.85rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-avatar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sa-pf-avatar-item {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    object-fit: contain;
    background: rgba(30, 41, 59, 0.6);
    transition: border-color 0.2s, transform 0.15s;
}
.sa-pf-avatar-item:hover { transform: scale(1.1); }
.sa-pf-avatar-item.selected {
    border-color: #9333ea;
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.4);
}
.sa-pf-banner-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sa-pf-banner-item {
    width: 72px;
    height: 36px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    object-fit: cover;
    background: rgba(30, 41, 59, 0.6);
    transition: border-color 0.2s, transform 0.15s;
}
.sa-pf-banner-item:hover { transform: scale(1.05); }
.sa-pf-banner-item.selected {
    border-color: #9333ea;
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.4);
}
.sa-pf-banner-none {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6b7280;
    background: rgba(30, 41, 59, 0.6);
    border: 2px dashed #4b5563;
}
.sa-pf-banner-none:hover {
    color: #ef4444;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
.sa-pf-banner-none.selected {
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}
/* ── Banner Effect Video Grid (premium/membership users) ── */
.sa-pf-effect-section {
    margin-bottom: 18px;
}
.sa-pf-effect-section h4 {
    margin: 0 0 8px 0;
    color: #ffd700;
    font-size: 0.85rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-effect-section .sa-pf-membership-lock {
    color: #9ca3af;
    font-size: 0.72rem;
    font-style: italic;
}
.sa-pf-effect-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.sa-pf-effect-item {
    width: 96px;
    height: 54px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    object-fit: cover;
    background: rgba(30, 41, 59, 0.6);
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
.sa-pf-effect-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
.sa-pf-effect-item:hover { transform: scale(1.05); }
.sa-pf-effect-item.selected {
    border-color: #ffd700;
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.3);
}
.sa-pf-effect-none {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #6b7280;
    background: rgba(30, 41, 59, 0.6);
    border: 2px dashed #4b5563;
    width: 96px;
    height: 54px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.sa-pf-effect-none:hover { color: #ef4444; border-color: #ef4444; background: rgba(239, 68, 68, 0.1); }
.sa-pf-effect-none.selected { border-color: #ef4444; color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }

.sa-pf-profile-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.7);
    border-radius: 8px;
    border: 1px solid #374151;
    margin-bottom: 16px;
}
.sa-pf-preview-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: contain;
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid #6366f1;
    flex-shrink: 0;
}
.sa-pf-preview-info {
    flex: 1;
    min-width: 0;
}
.sa-pf-preview-name {
    color: #e5e7eb;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-preview-banner {
    width: 100%;
    height: 24px;
    object-fit: cover;
    border-radius: 3px;
    margin-top: 4px;
    opacity: 0.8;
}

/* ── Settings Tab ── */
.sa-pf-settings-group {
    margin-bottom: 16px;
}
.sa-pf-settings-group label {
    display: block;
    color: #c4b5fd;
    font-size: 0.82rem;
    font-family: "Montserrat", sans-serif;
    margin-bottom: 6px;
}
.sa-pf-settings-group .sa-pf-hint {
    display: block;
    color: #6b7280;
    font-size: 0.7rem;
    margin-top: 4px;
}
.sa-pf-settings-group .sa-pf-hint a {
    color: #a78bfa;
    text-decoration: underline;
}
.sa-pf-settings-group input[type="text"],
.sa-pf-settings-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(10, 14, 26, 0.9);
    border: 1px solid #374151;
    color: #e5e7eb;
    font-family: "Montserrat", sans-serif;
    font-size: 0.82rem;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.sa-pf-settings-group input[type="text"]:focus,
.sa-pf-settings-group select:focus {
    border-color: #9333ea;
}
.sa-pf-settings-group input[type="range"] {
    width: 100%;
    margin-top: 4px;
    accent-color: #9333ea;
}
.sa-pf-volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sa-pf-volume-row span {
    color: #c4b5fd;
    font-size: 0.8rem;
    min-width: 36px;
    text-align: right;
    font-family: "Montserrat", sans-serif;
}

/* ── Save Button ── */
.sa-pf-save-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: #9333ea;
    color: #fff;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, transform 0.15s;
    margin-top: 8px;
}
.sa-pf-save-btn:hover { background: #a855f7; transform: translateY(-1px); }
.sa-pf-save-btn:active { transform: scale(0.98); }
.sa-pf-save-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── shared-auth-user-top-row avatar ── */
.sa-user-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    border: 1px solid rgba(147, 51, 234, 0.3);
    flex-shrink: 0;
    background: rgba(30, 41, 59, 0.6);
}
.sa-user-top-row-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.sa-pf-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Info box */
.sa-pf-info-box {
    background: rgba(147, 51, 234, 0.08);
    border: 1px solid rgba(147, 51, 234, 0.2);
    border-radius: 8px;
    padding: 14px 18px;
}
.sa-pf-info-box h4 {
    margin: 0 0 8px 0;
    color: #c4b5fd;
    font-size: 0.9rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-info-box p {
    color: #9ca3af;
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 0 6px 0;
}
.sa-pf-info-box ol {
    color: #9ca3af;
    font-size: 0.8rem;
    margin: 6px 0;
    padding-left: 20px;
    line-height: 1.6;
}
.sa-pf-info-box code {
    background: rgba(0,0,0,0.3);
    color: #a78bfa;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
    word-break: break-all;
}

/* State display */
.sa-pf-state {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sa-pf-state-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
}
.sa-pf-label {
    color: #9ca3af;
    white-space: nowrap;
}
.sa-pf-value {
    background: rgba(10, 14, 26, 0.8);
    color: #e5e7eb;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.72rem;
    word-break: break-all;
    text-align: right;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sa-pf-revealed {
    color: #fbbf24;
    border: 1px dashed rgba(251, 191, 36, 0.3);
}

/* Update section */
.sa-pf-update {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sa-pf-update h4 {
    margin: 0;
    color: #e5e7eb;
    font-size: 0.9rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-hint {
    color: #6b7280;
    font-size: 0.75rem;
    margin: 0;
}
.sa-pf-input-row {
    display: flex;
    gap: 8px;
}
.sa-pf-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #374151;
    background: rgba(10, 14, 26, 0.9);
    color: #e5e7eb;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}
.sa-pf-input:focus {
    border-color: #9333ea;
}
.sa-pf-input-sm {
    max-width: 100px;
}

.sa-pf-btn {
    padding: 10px 20px;
    background: #9333ea;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}
.sa-pf-btn:hover {
    background: #a855f7;
}

.sa-pf-error {
    color: #dc2626;
    font-size: 0.78rem;
    margin: 0;
    min-height: 0;
}
.sa-pf-success {
    color: #22c55e;
    font-size: 0.78rem;
    margin: 0;
    min-height: 0;
}

/* Verify section */
.sa-pf-verify-box {
    border-top: 1px solid #1f2937;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sa-pf-verify-box h4 {
    margin: 0;
    color: #e5e7eb;
    font-size: 0.9rem;
    font-family: "Montserrat", sans-serif;
}
.sa-pf-verify-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.sa-pf-verify-result {
    font-size: 0.8rem;
    margin: 4px 0;
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.5;
}
.sa-pf-success-text {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.08);
}
.sa-pf-error-text {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
}

/* ── ITEM VALUE DISPLAY — clickable hint ── */
.shared-auth-item-value-display {
    cursor: pointer;
    transition: opacity 0.2s, filter 0.2s;
}
.shared-auth-item-value-display:hover {
    opacity: 0.85;
    filter: brightness(1.15);
}

/* ═══════════════════════════════════════════════════
   MINI-INVENTORY POPUP (click on item-value-display)
   ═══════════════════════════════════════════════════ */
.sa-inv-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.78);
    z-index: 25000;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.sa-inv-popup-overlay.active {
    display: flex;
}

.sa-inv-popup {
    background: rgba(17, 24, 39, 0.97);
    border: 1px solid #374151;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    min-width: 320px;
    max-height: 85vh;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: saInvFadeIn 0.25s ease;
}
@keyframes saInvFadeIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Popup Header ── */
.sa-inv-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #374151;
    flex-shrink: 0;
}
.sa-inv-popup-title {
    margin: 0;
    font-size: 1.05rem;
    font-family: "Maven Pro", sans-serif;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sa-inv-popup-title .item-value-icon {
    width: 22px;
    height: 22px;
    filter: invert(1);
}
.sa-inv-popup-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Sort Cycle Button ── */
.sa-inv-sort-btn {
    padding: 6px 14px;
    border: 1px solid #4b5563;
    background: rgba(55, 65, 81, 0.5);
    color: #d1d5db;
    font-family: "Montserrat", sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
    white-space: nowrap;
}
.sa-inv-sort-btn:hover {
    border-color: #818cf8;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.15);
}

.sa-inv-popup-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}
.sa-inv-popup-close:hover { color: #fff; }

/* ── Popup Body (scrollable grid) ── */
.sa-inv-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 0;
}
.sa-inv-popup-body::-webkit-scrollbar {
    width: 5px;
}
.sa-inv-popup-body::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}

/* Mini grid: 5 columns, compact cards */
.sa-inv-popup-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
}

.sa-inv-popup-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
}

/* Mini item card — portrait 3:4 ratio */
.sa-inv-mini-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #374151;
    cursor: pointer;
    transition: all 0.18s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    overflow: hidden;
    aspect-ratio: 3 / 4;
}
.sa-inv-mini-card:hover {
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    z-index: 1;
}
.sa-inv-mini-card.selected {
    border-color: #818cf8;
    background: rgba(99, 102, 241, 0.12);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.18);
}
.sa-inv-mini-card .sa-inv-mini-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #6b7280;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: transparent;
    transition: all 0.15s;
    z-index: 3;
}
.sa-inv-mini-card.selected .sa-inv-mini-check {
    background: #6366f1;
    border-color: #818cf8;
    color: #fff;
}
.sa-inv-mini-img-bg {
    width: 100%;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border-radius: 3px;
    padding-top: 6px;
    box-sizing: border-box;
}
/* Tier-specific linear gradients — matches userinventory.css */
.sa-inv-mini-img-bg.co-tier-common,
.sa-inv-mini-img-bg.co-tier-consumer,
.sa-inv-mini-img-bg.co-tier-industrial {
    background: linear-gradient(180deg, rgba(192, 192, 192, 0.45) 0%, rgba(192, 192, 192, 0.12) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-rare,
.sa-inv-mini-img-bg.co-tier-milspec {
    background: linear-gradient(180deg, rgba(65, 105, 225, 0.5) 0%, rgba(65, 105, 225, 0.15) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-epic,
.sa-inv-mini-img-bg.co-tier-restricted {
    background: linear-gradient(180deg, rgba(148, 0, 211, 0.5) 0%, rgba(148, 0, 211, 0.15) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-classified {
    background: linear-gradient(180deg, rgba(255, 0, 221, 0.5) 0%, rgba(255, 0, 221, 0.15) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-covert {
    background: linear-gradient(180deg, rgba(235, 75, 75, 0.5) 0%, rgba(235, 75, 75, 0.15) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-legendary {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.55) 0%, rgba(255, 215, 0, 0.18) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-extraordinary {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.55) 0%, rgba(255, 215, 0, 0.18) 36%, transparent 60%);
}
.sa-inv-mini-img-bg.co-tier-contraband {
    background: linear-gradient(180deg, rgb(255, 103, 2) 0%, rgba(255, 123, 0, 0.18) 36%, transparent 60%);
}
.sa-inv-mini-img {
    max-width: 80%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 0;
}
/* Name, wear, value — own row, bottom of card, centered */
.sa-inv-mini-name {
    width: 100%;
    padding: 2px 4px 2px;
    box-sizing: border-box;
    font-family: "Montserrat", sans-serif;
    font-size: 0.6rem;
    font-weight: 700;
    color: #f3f4f6;
    text-align: center;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    flex-shrink: 0;
}
.sa-inv-mini-name-type {
    font-size: 0.5rem;
    font-weight: 500;
    color: #9ca3af;
}
.sa-inv-mini-name-skin {
    font-size: 0.58rem;
    font-weight: 700;
    color: #f3f4f6;
}
.sa-inv-mini-wear {
    width: 100%;
    padding: 1px 4px 2px;
    box-sizing: border-box;
    font-size: 0.5rem;
    color: #c0c0c0;
    text-align: center;
    line-height: 1;
    flex-shrink: 0;
}
.sa-inv-mini-value {
    width: 100%;
    padding: 1px 4px 3px;
    box-sizing: border-box;
    font-family: "Montserrat", sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #22c55e;
    text-align: center;
    line-height: 1;
    flex-shrink: 0;
}
.sa-inv-mini-divide {
    font-size: 0.5rem;
    color: #facc15;
    font-weight: 600;
}
.sa-inv-mini-partial-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 1px 5px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.55rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4a90d9, #2856a3);
    border-radius: 2px;
    line-height: 1.3;
    z-index: 3;
    pointer-events: none;
    letter-spacing: 0.04em;
}

/* ── Popup Footer / Action Bar ── */
.sa-inv-popup-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #374151;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.sa-inv-popup-footer-left {
    display: flex;
    gap: 8px;
}
.sa-inv-popup-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sa-inv-popup-selected-info {
    color: #9ca3af;
    font-family: "Montserrat", sans-serif;
    font-size: 0.72rem;
    white-space: nowrap;
}

/* Popup buttons */
.sa-inv-btn {
    padding: 7px 16px;
    border-radius: 5px;
    font-family: "Montserrat", sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    white-space: nowrap;
}
.sa-inv-btn-outline {
    background: transparent;
    border-color: #4b5563;
    color: #d1d5db;
}
.sa-inv-btn-outline:hover {
    border-color: #818cf8;
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.1);
}
.sa-inv-btn-sell {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}
.sa-inv-btn-sell:hover {
    background: #ef4444;
    border-color: #ef4444;
}
.sa-inv-btn-sell:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #991b1b;
    border-color: #991b1b;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .sa-inv-popup {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 10px;
    }
    .sa-inv-popup-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .sa-inv-popup-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .sa-inv-popup-footer-right {
        justify-content: space-between;
    }
}

/* ── Membership Badge in Nav (shared across all pages) ── */
.mt-membership-badge-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 4px;
    width: fit-content;
}

.mt-membership-badge-nav.silver {
    background: rgba(192, 192, 192, 0.2);
    color: var(--mt-silver);
    border: 1px solid rgba(192, 192, 192, 0.4);
}

.mt-membership-badge-nav.gold {
    background: rgba(255, 215, 0, 0.2);
    color: var(--mt-gold);
    border: 1px solid rgba(255, 215, 0, 0.4);
    animation: mt-badge-pulse 2s ease-in-out infinite;
}

.mt-membership-badge-nav.diamond {
    background: rgba(185, 242, 255, 0.2);
    color: var(--mt-diamond);
    border: 1px solid rgba(185, 242, 255, 0.4);
    animation: mt-badge-pulse 2s ease-in-out infinite;
}

@keyframes mt-badge-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 215, 0, 0); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
}
