/* General Reset & Background Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-image: url('pc-bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-color: #0f172a;
    color: #ffffff;
    min-height: 100vh;
    padding: 12px;
    padding-top: 185px;
}

@media (max-width: 768px) {
    body {
        background-image: url('phone-bg.png');
        padding: 8px;
        padding-top: 175px;
    }
}

/* Smart Auto-Hide Header Bar */
.app-header {
    max-width: 1200px;
    margin: 0 auto;
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease-in-out;
    will-change: transform;
}

.app-header.header-hidden {
    transform: translateY(-130%);
}

@media (max-width: 768px) {
    .app-header {
        top: 6px;
        left: 6px;
        right: 6px;
        padding: 8px;
        border-radius: 14px;
        gap: 6px;
    }
}

/* Header Top Row (Logo + Search Container) */
.header-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .brand-logo {
        height: 32px;
    }
}

.search-container {
    flex-grow: 1;
}

.search-container input {
    width: 100%;
    padding: 10px 16px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(30, 41, 59, 0.95);
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: 0.2s ease;
}

.search-container input:focus {
    background: #1e293b;
    border-color: #00c6ff;
    box-shadow: 0 0 12px rgba(0, 198, 255, 0.4);
}

/* Main Action Navigation Cards */
.main-nav-cards {
    display: flex;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
}

.nav-card {
    flex: 1;
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 6px 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    color: #cbd5e1;
    text-align: center;
    white-space: nowrap;
    transition: all 0.2s ease;
}

@media (min-width: 768px) {
    .nav-card {
        font-size: 13px;
        padding: 7px 16px;
        flex: unset;
    }
    .main-nav-cards {
        justify-content: center;
    }
}

.nav-card.active, .nav-card:hover {
    background: #00c6ff;
    color: #0f172a;
    border-color: #00c6ff;
    box-shadow: 0 4px 12px rgba(0, 198, 255, 0.4);
}

/* Categories Wrapper with Scroll Arrows */
.categories-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    width: 100%;
}

.scroll-arrow-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: 0.2s;
    z-index: 10;
}

.scroll-arrow-btn:hover {
    background: #00c6ff;
    color: #0f172a;
    border-color: #00c6ff;
}

/* Professional Category Filter Bar */
.categories-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    flex-grow: 1;
    scroll-behavior: smooth;
}

.categories-bar::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    padding: 5px 14px;
    border-radius: 18px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.cat-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.cat-btn.active {
    background: linear-gradient(135deg, #00c6ff, #0072ff);
    color: #ffffff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0, 198, 255, 0.4);
}

/* Clean Professional Grid Container */
.games-grid-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

@media (min-width: 600px) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

@media (min-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 14px;
    }
}

@media (min-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 14px;
    }
}

/* Game Card Styling */
.game-card {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 1 / 1;
}

.game-card:hover {
    transform: translateY(-4px);
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0, 198, 255, 0.4);
    border: 1px solid #00c6ff;
}

.game-thumb-box {
    width: 100%;
    height: 100%;
    position: relative;
}

.game-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.heart-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
    z-index: 5;
    opacity: 0.85;
}

.heart-btn:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
}

.red-heart {
    filter: drop-shadow(0 0 4px #ff4757);
}

.game-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 6px 6px 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    pointer-events: none;
}

@media (min-width: 768px) {
    .game-title-overlay {
        font-size: 12px;
    }
}