* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1b2838;
    --bg-secondary: #16202d;
    --bg-card: #1e2329;
    --accent: #66c0f4;
    --text-primary: #c7d5e0;
    --text-secondary: #8f98a0;
    --border: #2a475e;
    --hover-bg: #2a475e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 0;
    padding: 30px 0;
    position: relative;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--accent);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
}

.tab-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: bold;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent);
}

.tab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
}

.columns-control {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px 0;
}

.columns-label {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.columns-slider {
    width: 200px;
    height: 6px;
    border-radius: 5px;
    background: var(--bg-card);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.columns-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: background 0.2s;
}

.columns-slider::-webkit-slider-thumb:hover {
    background: #5db3e6;
}

.columns-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.columns-slider::-moz-range-thumb:hover {
    background: #5db3e6;
}

.columns-value {
    min-width: 30px;
    padding: 5px 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 5px;
    font-weight: bold;
    color: var(--accent);
    text-align: center;
    font-size: 1rem;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.sticky-controls {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
    margin: 0 0 20px 0;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    background: rgba(27, 40, 56, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.search-container {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 192, 244, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.game-count {
    padding: 12px 20px;
    background: var(--bg-card);
    border-radius: 5px;
    font-weight: bold;
    color: var(--accent);
    border: 2px solid var(--border);
}

.loading {
    text-align: center;
    padding: 60px 20px;
    display: none;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #c5342a;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    margin-bottom: 30px;
    display: none;
}

.error.active {
    display: block;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 25px;
    padding: 20px 0;
    transition: grid-template-columns 0.2s ease;
}

.game-card {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid var(--border);
    position: relative;
    aspect-ratio: 3 / 4;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
}

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

.game-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 2;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
}

.game-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Fallback for games without cover art */
.game-card.no-cover {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.game-card.no-cover .game-name {
    position: static;
    color: var(--text-primary);
    text-shadow: none;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: var(--bg-primary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.scroll-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    background: #5db3e6;
}

.scroll-to-top:active {
    transform: translateY(-1px);
}

.scroll-to-top.show {
    display: flex;
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

/* Tablet styles */
@media (max-width: 1024px) and (min-width: 769px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* Phone styles */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .columns-control {
        padding: 10px 0;
        margin-bottom: 15px;
    }
    
    .columns-slider {
        width: 150px;
    }
    
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .sticky-controls {
        padding: 12px 0;
        margin: 0 0 15px 0;
    }
}
