:root {
    --bg: #FFFFFF;
    --surface: #F5F5F5;
    --text-primary: #1A1A1A;
    --text-muted: #999;
    --accent: #6B7280;
    --accent-hover: #4B5563;
    --border: #E3E3E3;
    --glass-bg: rgba(255,255,255,0.5);
    --glass-border: rgba(255,255,255,0.6);
    --glass-shadow: rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Manrope', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: 0.01em;
    background: var(--bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
}

.font-clash { font-family: 'Clash Display', sans-serif; }

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D5D5D5; border-radius: 2px; }
::selection { background-color: var(--accent); color: white; }

.glass {
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid rgba(255,255,255,0.6);
    box-shadow:
        0 1px 2px rgba(0,0,0,0.02),
        0 4px 16px rgba(0,0,0,0.03),
        inset 0 1px 0 rgba(255,255,255,0.7);
    transition: box-shadow 0.35s ease, transform 0.35s ease;
}
.glass:hover {
    box-shadow:
        0 2px 4px rgba(0,0,0,0.03),
        0 8px 32px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.8);
}

.glass-nav {
    background: rgba(247,247,247,0.65);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border-bottom: 1px solid rgba(255,255,255,0.4);
}

.game-card-gradient {
    background: linear-gradient(to right,
        rgba(255,255,255,1) 0%,
        rgba(255,255,255,0.96) 12%,
        rgba(255,255,255,0.82) 35%,
        rgba(255,255,255,0.35) 58%,
        rgba(255,255,255,0.06) 80%,
        transparent 100%
    );
}

.card-material {
    background: white;
    border: 1px solid var(--border);
    box-shadow:
        0 1px 2px rgba(0,0,0,0.03),
        0 4px 12px rgba(0,0,0,0.02);
    transition: box-shadow 0.3s ease, transform 0.3s ease, filter 1s ease;
    filter: saturate(0.6);
}
.card-material:hover {
    box-shadow:
        0 2px 4px rgba(0,0,0,0.04),
        0 8px 24px rgba(0,0,0,0.06);
    filter: saturate(1);
}

/* Encyclopedia cards - saturation on inner element to avoid animation conflict */
.card-material.tilt-card .tilt-card-inner {
    filter: saturate(0.45);
    transition: filter 0.8s ease;
}
.card-material.tilt-card:hover .tilt-card-inner {
    filter: saturate(1);
}

.surface-inset {
    background: #F5F5F5;
    border-radius: 0.5rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.tilt-card {
    perspective: 1200px;
    transform-style: preserve-3d;
    transition: box-shadow 0.15s ease-out;
}
.tilt-card-subtle {
    perspective: 1200px;
    transform-style: preserve-3d;
    transition: box-shadow 0.15s ease-out, filter 1s ease;
    filter: saturate(0.6);
}
.tilt-card-subtle:hover {
    filter: saturate(1);
}
.tilt-card-inner {
    transition: transform 0.15s ease-out, filter 0.3s ease;
    transform-style: preserve-3d;
    transform-origin: center center;
    will-change: transform, filter;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes pixelizeLoad {
    0% {
        opacity: 0;
        filter: blur(20px);
    }
    50% {
        opacity: 0.8;
        filter: blur(8px);
    }
    100% {
        opacity: 1;
        filter: blur(0px);
    }
}

.fade-in-up {
    opacity: 1;
}
.fade-in-up-delay-1 { animation-delay: 0.05s; }
.fade-in-up-delay-2 { animation-delay: 0.10s; }
.fade-in-up-delay-3 { animation-delay: 0.15s; }
.fade-in-up-delay-4 { animation-delay: 0.20s; }
.fade-in-up-delay-5 { animation-delay: 0.25s; }
.fade-in-up-delay-6 { animation-delay: 0.30s; }
.fade-in-up-delay-7 { animation-delay: 0.35s; }
.fade-in-up-delay-8 { animation-delay: 0.40s; }


@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.youtube-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,26,26,0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.youtube-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.youtube-modal-video {
    width: 100%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    border-radius: 1rem;
    overflow: hidden;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s ease 0.05s, opacity 0.3s ease 0.05s;
}
.youtube-modal-overlay.active .youtube-modal-video {
    transform: scale(1);
    opacity: 1;
}

.review-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.review-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.review-modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
    transition: transform 0.3s ease 0.05s, opacity 0.3s ease 0.05s;
}
.review-modal-overlay.active .review-modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.qa-answer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}
.qa-item.open .qa-answer {
    opacity: 1;
}
.qa-chevron {
    transition: transform 0.2s ease;
}
.qa-item.open .qa-chevron {
    transform: rotate(180deg);
}

.nav-underline {
    height: 1px;
    background: var(--text-primary);
    margin-top: 1px;
    transform: scaleX(0);
    transition: transform 0.2s ease;
}
.nav-link.active .nav-underline {
    transform: scaleX(1);
}

.platform-filters {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.platform-filters.open {
    max-height: 60px;
}

.mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.mobile-menu.open {
    max-height: 400px;
}

/* Custom Tooltip */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}
.tooltip-wrapper[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.95);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 12px;
    font-weight: 300;
    white-space: nowrap;
    z-index: 50;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.tooltip-wrapper[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(26, 26, 26, 0.95);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.tooltip-wrapper[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}
.tooltip-wrapper[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

@media (min-width: 768px) {
    .youtube-modal-overlay { padding: 2rem; }
}

@keyframes crtPowerOn {
    0% {
        clip-path: inset(50% 50% 50% 50%);
        opacity: 0;
        filter: brightness(2) blur(2px);
    }
    50% {
        filter: brightness(1.5) blur(1px);
    }
    100% {
        clip-path: inset(0% 0% 0% 0%);
        opacity: 1;
        filter: brightness(1) blur(0px);
    }
}

@keyframes crtPowerOff {
    0% {
        clip-path: inset(0% 0% 0% 0%);
        opacity: 1;
        filter: brightness(1) blur(0px);
    }
    50% {
        filter: brightness(1.5) blur(1px);
    }
    100% {
        clip-path: inset(50% 50% 50% 50%);
        opacity: 0;
        filter: brightness(2) blur(2px);
    }
}

.crt-power-on {
    animation: crtPowerOn 0.4s ease-out forwards;
}

.crt-power-off {
    animation: crtPowerOff 0.4s ease-in forwards;
}

@media (max-width: 767px) {
    .tilt-card-inner { transform: none !important; }
    /* No saturation effects on mobile */
    .card-material { filter: none !important; transition: none !important; }
    .card-material.tilt-card .tilt-card-inner { filter: none !important; transition: none !important; }
    .tilt-card-subtle { filter: none !important; transition: none !important; }
    /* Encyclopedia: 1 card per row in portrait */
    .enc-grid { grid-template-columns: 1fr !important; max-width: 325px; margin-left: auto; margin-right: auto; }
    /* Category filter: hide chips, show select */
    .enc-cat-chips { display: none !important; }
    .enc-cat-select { display: block !important; }
}
