/* Google Fonts loaded via HTML preload for better CLS */

:root {
    /* LEGO Brand Colors */
    --lego-red: #E3000B;
    --lego-yellow: #FFD700;
    --lego-blue: #0055BF;
    --lego-green: #237841;
    --lego-orange: #FF6D00;

    /* Dark Theme */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Gradients */
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    --gradient-glow: radial-gradient(circle at center, rgba(255, 215, 0, 0.15) 0%, transparent 70%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(255, 215, 0, 0.2);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ========== ACCESSIBILITY STYLES ========== */

/* Focus Indicators - Visible by default, hidden when .no-focus-indicators */
body:not(.no-focus-indicators) *:focus-visible {
    outline: 3px solid var(--lego-yellow) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.3) !important;
}

body:not(.no-focus-indicators) a:focus-visible,
body:not(.no-focus-indicators) button:focus-visible,
body:not(.no-focus-indicators) input:focus-visible,
body:not(.no-focus-indicators) select:focus-visible,
body:not(.no-focus-indicators) textarea:focus-visible {
    outline: 3px solid var(--lego-yellow) !important;
    outline-offset: 2px !important;
}

/* Underline Links */
body.underline-links a {
    text-decoration: underline !important;
}

/* Large Text Mode - Applied via .large-text class on body */
body.large-text {
    font-size: 1.25rem !important;
}

body.large-text h1 {
    font-size: clamp(3rem, 6vw, 5rem) !important;
}

body.large-text h2 {
    font-size: clamp(1.75rem, 3vw, 2.5rem) !important;
}

body.large-text h3 {
    font-size: clamp(1.25rem, 2vw, 1.75rem) !important;
}

body.large-text p,
body.large-text span,
body.large-text li {
    font-size: 1.15rem !important;
}

body.large-text .btn {
    font-size: 1.1rem !important;
    padding: 14px 28px !important;
}

/* Reduced Motion */
body.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* GPU-accelerated animations */
.series-card,
.btn,
.modal {
    will-change: transform;
}

/* Layout containment for performance */
.series-grid,
.minifigures-grid {
    contain: layout style;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* Modern Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}


body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Ambient Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(227, 0, 11, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 85, 191, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 215, 0, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    width: 90%;
    max-width: none;
    margin: 0 auto;
    padding: 0 var(--spacing-xl);
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    background: rgba(10, 10, 15, 0.9);
    border-bottom: 1px solid var(--glass-border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--lego-yellow) 0%, var(--lego-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-icon-btn svg {
    width: 24px;
    height: 24px;
}

.nav-icon-btn:hover,
.nav-icon-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-profile-link {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-left: 8px;
    transition: transform 0.2s;
}

.header-profile-link:hover {
    transform: scale(1.05);
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* Auth Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--lego-yellow) 0%, var(--lego-orange) 100%);
    color: #000;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--glass-bg);
    border-color: var(--lego-yellow);
}

.btn-google {
    background: #fff;
    color: #333;
    font-weight: 500;
}

.btn-google:hover {
    background: #f5f5f5;
}

.btn-google svg {
    width: 18px;
    height: 18px;
}

/* Hero Section */
.hero {
    min-height: 30vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(80px + var(--spacing-2xl)) var(--spacing-xl) var(--spacing-md);
    position: relative;
}

.hero-title {
    margin-bottom: var(--spacing-md);
    animation: fadeInUp 0.8s ease-out;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.1;
}

.hero-title span {
    display: block;
    background: linear-gradient(135deg, var(--lego-yellow) 0%, var(--lego-red) 50%, var(--lego-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--lego-yellow);
    color: #000;
    border-color: var(--lego-yellow);
    font-weight: 600;
}

/* Series Grid - Uniform Height */
.series-section {
    padding: var(--spacing-2xl) 0;
    min-height: 100vh;
    /* Reserve space for content to prevent CLS */
}

.section-title {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.875rem;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-md);
}

.series-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all var(--transition-normal);
    height: 200px;
    /* Fixed height for all cards */
}

.series-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 1;
}

.series-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.series-card:hover::before {
    opacity: 1;
}

.series-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
    content-visibility: auto;
}

.series-card:hover .series-card-image {
    transform: scale(1.1);
}

.series-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: var(--spacing-md);
    z-index: 2;
}

.series-card-number {
    font-size: 0.65rem;
    color: var(--lego-yellow);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2px;
}

.series-card-title {
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) rotate(var(--rotate, 0deg));
    }

    50% {
        transform: translateY(-15px) rotate(var(--rotate, 0deg));
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.08;
    }

    50% {
        opacity: 0.15;
    }
}

/* Responsive - Homepage */
@media (max-width: none) {
    .series-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1000px) {
    .series-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .series-card {
        height: 180px;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-2xl: 2rem;
    }

    .series-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .series-card {
        height: 160px;
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    .hero {
        min-height: 20vh;
        /* padding-top removed */
    }

    .logo-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .series-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .series-card {
        height: 140px;
    }

    .series-card-title {
        font-size: 0.7rem;
    }
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    grid-column: 1 / -1;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--lego-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Series Detail Page Styles */
.series-detail {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.question-marks-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.question-mark {
    position: absolute;
    font-weight: 900;
    opacity: 0.12;
    user-select: none;
}

.series-header {
    position: relative;
    z-index: 10;
    padding: calc(80px + var(--spacing-md)) var(--spacing-md) var(--spacing-md);
    text-align: center;
}

.series-title {
    margin-bottom: var(--spacing-sm);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: var(--spacing-md);
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--lego-yellow);
}

/* Minifigures Grid - Responsive to screen height */
.minifigures-container {
    position: relative;
    z-index: 10;
    padding: 0 var(--spacing-sm) var(--spacing-md);
}

.minifigures-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-sm);
    position: relative;
    z-index: 10;
}

.minifigure-card {
    background: var(--glass-bg);

    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    text-align: center;
    transition: all var(--transition-normal);
}

.minifigure-card:hover {
    transform: translateY(-4px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-sm);
}

.minifigure-image {
    width: 100%;
    height: auto;
    max-height: calc((100vh - 200px) / 4 - 60px);
    object-fit: contain;
    margin: 0 auto var(--spacing-xs);
    transition: transform var(--transition-normal);
}

.minifigure-card:hover .minifigure-image {
    transform: scale(1.05);
}

.minifigure-number {
    font-size: 0.65rem;
    color: var(--lego-yellow);
    font-weight: 600;
    margin-bottom: 2px;
}

.minifigure-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive for minifigures - Fit all to screen */
@media (max-width: 1200px) {
    .minifigures-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .minifigures-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .minifigure-image {
        max-height: calc((100vh - 180px) / 4 - 50px);
    }
}

@media (max-width: 600px) {
    .minifigures-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .minifigure-card {
        padding: 4px;
        border-radius: 6px;
    }

    .minifigure-image {
        max-height: calc((100vh - 160px) / 4 - 40px);
    }

    .minifigure-title {
        font-size: 0.6rem;
    }

    .minifigure-number {
        font-size: 0.55rem;
    }

    .series-header {
        padding: calc(70px + var(--spacing-sm)) var(--spacing-sm) var(--spacing-sm);
    }
}

/* Lazy Loading */
.lazy-image {
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.lazy-image.loaded {
    opacity: 1;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    max-width: 420px;
    width: 90%;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--lego-yellow);
}

.form-divider {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-divider::before,
.form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.btn-full {
    width: 100%;
}

.modal-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-footer a {
    color: var(--lego-yellow);
}

.modal-footer a:hover {
    text-decoration: underline;
}

/* User Profile Avatar in Header */
.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover;
    border: none;
    transition: transform var(--transition-fast);
}

/* Filters */
.filter-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn.active,
.filter-btn:hover {
    border-color: var(--lego-yellow);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(255, 215, 0, 0.1);
}

/* Specific Filter Button Styles */
.filter-btn.filter-newest.active {
    border-color: white !important;
    color: white !important;
    background: transparent !important;
}

/* --- New Market Styles (UI Polish) --- */
.market-controls {
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.filter-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    min-width: 150px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-select:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-select:focus {
    border-color: var(--lego-yellow);
    box-shadow: 0 0 0 2px rgba(255, 207, 0, 0.2);
}

.btn-create-offer {
    background: linear-gradient(135deg, var(--lego-yellow), #e5c100);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(255, 207, 0, 0.3);
}

.btn-create-offer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 207, 0, 0.4);
}

/* Action Buttons */
.btn-action {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-accept {
    background: #4CAF50;
    /* Green */
    color: white;
}

.btn-accept:hover {
    background: #388E3C;
    transform: translateY(-1px);
}

.btn-counter:hover {
    background: #004bbb;
    transform: translateY(-1px);
}

.overlay-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2100;
    align-items: center;
    justify-content: center;
}

.overlay-panel.active {
    display: flex;
}

.confirm-box {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    min-width: 350px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-counter:hover {
    background: #004499;
    transform: translateY(-1px);
}

/* Friend List Container */
.friends-list-container {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    margin-top: 5px;
    display: none;
    /* Hidden by default until populated/search */
}

.friend-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    transition: background 0.2s;
}

.friend-item:last-child {
    border-bottom: none;
}

.friend-item:hover {
    background: var(--bg-secondary);
}

.friend-item.selected {
    background: var(--lego-blue);
    color: white;
}

/* View Preferences */

/* Compact Mode */
body.compact-mode {
    --spacing-xs: 0.15rem;
    --spacing-sm: 0.35rem;
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
    --spacing-2xl: 2rem;
    --spacing-3xl: 2.5rem;
}

body.compact-mode .series-card {
    height: 160px;
}

body.compact-mode .minifigure-image {
    max-height: calc((100vh - 200px) / 5 - 40px);
}

/* List View (for Series Grid) */
.series-grid.view-list {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-sm);
}

.series-grid.view-list .series-card {
    height: auto;
    min-height: 80px;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: var(--spacing-sm);
}

.series-grid.view-list .series-card-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
}

.series-grid.view-list .series-card-overlay {
    position: relative;
    inset: auto;
    background: none;
    padding: 0 0 0 var(--spacing-md);
    flex: 1;
    justify-content: center;
}

.series-grid.view-list .series-card-title {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.series-grid.view-list .series-card:hover {
    transform: translateX(4px);
}
/* Footer */
.footer {
    width: 100%;
    margin-top: auto;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    border-top: 1px solid var(--glass-border);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--lego-yellow);
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Hide footer on mobile for non-homepage pages */
@media (max-width: 768px) {
    body:not(.homepage) .footer {
        display: none;
    }
}


/* UNIVERSAL SITE HEADER */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(250, 247, 241, 0.85);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line, #e9e6df);
    color: #0f0f10;
}
.site-header .page {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    padding: 1.05rem clamp(1.2rem, 4vw, 3rem);
    max-width: none;
    margin: 0 auto;
    width: 100%;
}
.wordmark {
    font-weight: 500;
    letter-spacing: .34em;
    text-decoration: none;
    color: #0f0f10 !important;
    font-size: 1.1rem;
    transition: opacity 0.2s;
    background: none !important;
    -webkit-text-fill-color: #0f0f10 !important;
    background-clip: initial !important;
}
.wordmark:hover {
    opacity: 0.8;
}
.primary-nav {
    margin-left: auto;
    display: flex;
    gap: 1.8rem;
    align-items: center;
}
.primary-nav a {
    color: #6b7280;
    text-decoration: none;
    font-size: .85rem;
    position: relative;
    padding: .3rem 0;
    transition: color .18s;
}
.primary-nav a:hover {
    color: #0f0f10;
}
.primary-nav a.active {
    color: #0f0f10;
    font-weight: 600;
}
.primary-nav a.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    background: #ff3a5e;
}
.header-actions {
    margin-left: 1rem;
    display: flex;
    align-items: center;
}
