:root {
    --primary-color: #2997ff;
    --primary-light: #2997ff;
    --accent-blue: #2997ff;
    --card-background: #1d1d1f;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.16);
    --text-color: #f5f5f7;
    --text-muted: #86868b;
    --secondary-color: #2997ff;
    --body-background: #000000;
    --surface-1: #1d1d1f;
    --surface-2: #2d2d2f;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Poppins', 'Helvetica Neue', sans-serif;
    background-color: var(--body-background);
    color: var(--text-color);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
    text-decoration: none;
}

a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    scroll-behavior: smooth;
}

/* Header */
.site-header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 0.35rem 1.25rem;
    min-height: 48px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
}

.logo img {
    height: 36px;
}

/* Navigation */
.header-nav {
    display: flex;
    align-items: center;
    flex: 1 1 780px;
    min-width: 0;
    justify-content: flex-start;
    margin-left: 0.75rem;
}

.header-nav .nav-list,
.header-nav > ul {
    list-style: none;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
}

.header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    flex: 0 1 auto;
}

.header-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 400;
    transition: color 0.2s ease;
    letter-spacing: 0;
}

.header-nav a:hover {
    color: var(--text-color);
}

.nav-item {
    position: relative;
    padding-bottom: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0;
}

.nav-link .nav-caret {
    width: 0.75rem;
    height: 0.75rem;
    flex: 0 0 0.75rem;
    transition: transform 0.2s ease;
}

.nav-item.open > .nav-link .nav-caret {
    transform: rotate(180deg);
}

.nav-dropdown {
    position: absolute;
    top: 100%;
    left: -14px;
    width: 260px;
    background: #1d1d1f;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-dropdown[hidden] {
    display: none;
}

.nav-dropdown-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus-visible {
    background-color: rgba(255, 255, 255, 0.06);
}

.nav-dropdown-item img {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 8px;
    object-fit: cover;
}

.nav-dropdown-item span {
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-view-all {
    text-align: center;
    padding: 8px;
    border-radius: 10px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    position: relative;
}

.mobile-nav-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

.mobile-nav-toggle::before,
.mobile-nav-toggle::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.mobile-nav-toggle::before {
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.mobile-nav-toggle::after {
    opacity: 0;
    transform: rotate(-45deg) scaleX(0.6);
}

.mobile-nav-toggle[aria-expanded="true"]::before {
    transform: rotate(45deg);
    box-shadow: none;
}

.mobile-nav-toggle[aria-expanded="true"]::after {
    opacity: 1;
    transform: rotate(-45deg) scaleX(1);
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.search-container:focus-within {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: rgba(255, 255, 255, 0.1);
}

.search-container .search-icon {
    color: var(--text-muted);
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 0.85rem;
}

.search-container input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    width: clamp(120px, 14vw, 180px);
    font-size: 0.85rem;
    font-family: inherit;
}

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

#searchResults {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(300px, 85vw);
    background: #1d1d1f;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    display: grid;
    gap: 2px;
    z-index: 1500;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#searchResults:empty {
    display: none;
}

.search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    transition: background-color 0.15s ease;
    color: var(--text-color);
}

.search-result:hover,
.search-result:focus-visible {
    background-color: rgba(255, 255, 255, 0.06);
}

.search-result img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.view-all-button {
    display: block;
    text-align: center;
    padding: 8px;
    border-radius: 10px;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 0.9rem;
}

/* Main Content */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
}

/* Hero */
.hero {
    background: #1d1d1f;
    border-radius: 20px;
    padding: 3.5rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-content {
    position: relative;
    max-width: 640px;
    margin: 0;
    text-align: left;
}

.hero-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-color);
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    max-width: 520px;
    color: var(--text-muted);
    line-height: 1.5;
}

.hero-actions {
    display: inline-flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 24px;
    align-items: center;
}

.hero-grid .hero-content {
    max-width: 640px;
}

.hero-grid .hero-ad {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    padding: 16px;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-grid .hero-ad > * {
    width: 100%;
}

.hero-actions a {
    padding: 0.6rem 1.4rem;
    border-radius: 980px;
    text-decoration: none;
    font-weight: 400;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.hero-primary {
    background: var(--primary-color);
    color: #fff;
}

.hero-primary:hover {
    background: #0077ed;
}

.hero-secondary {
    color: var(--primary-color);
}

.hero-secondary:hover {
    text-decoration: underline;
}

.all-games-hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.all-games-hero p {
    max-width: 580px;
    margin: 0.5rem auto 0;
    color: var(--text-muted);
}

/* Main Grid */
.main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 3rem;
}

.games-grid-section, .promo-card {
    background: #1d1d1f;
    border-radius: 18px;
    padding: 1.25rem;
}

.new-this-week {
    grid-column: span 1;
}

.featured-playing {
    grid-column: span 1;
}

.large-cards {
    grid-column: span 1;
    background: transparent;
    padding: 0;
    display: contents;
}

.large-card {
    background: #1d1d1f;
    border-radius: 18px;
    padding: 1.25rem;
    grid-column: span 1;
    transition: transform 0.2s ease;
}

.large-card:hover {
    transform: scale(1.01);
}

.large-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

.promo-card {
    grid-column: span 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.section-header .see-all {
    color: var(--primary-color);
    font-size: 0.88rem;
    font-weight: 400;
}

.section-header .see-all:hover {
    text-decoration: underline;
}

.games-list a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--text-color);
    padding: 0.45rem;
    border-radius: 12px;
    transition: background-color 0.15s ease;
}

.games-list a:hover {
    background: rgba(255, 255, 255, 0.04);
}

.games-list img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

.games-list h3 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
}

.games-list p {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}

/* Featured Games */
#featured-games {
    margin-top: 0;
    margin-bottom: 3rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.all-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.game-card {
    background: #1d1d1f;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-color);
    transition: transform 0.2s ease;
}

.game-card-large {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-card-media {
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 180px;
}

.game-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.game-card-large .game-info {
    padding: 0.85rem 1rem 1rem;
}

.game-card-large .game-info h3 {
    font-size: 1rem;
    font-weight: 600;
}

.games-count {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.game-card:hover {
    transform: scale(1.03);
}

.game-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.game-card h3 {
    padding: 0.7rem 0.85rem;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Section titles */
.games-grid-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

/* btn-learn-more */
.btn-learn-more {
    display: inline-block;
    color: var(--primary-color);
    font-weight: 400;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.btn-learn-more:hover {
    text-decoration: underline;
}

/* Promo card */
.promo-card .promo-content h3 {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.promo-card .promo-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-color);
    letter-spacing: -0.02em;
}

.promo-card .promo-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
    font-size: 0.95rem;
}

@media (max-width: 992px) {
    .hero { padding: 2.5rem 1.5rem; }
    .hero-grid { grid-template-columns: 1fr; gap: 18px; }
    .hero-grid .hero-ad { order: 2; }
    .hero-content h1 { font-size: 2.5rem; }
    .main-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .new-this-week, .featured-playing, .large-cards, .promo-card { grid-column: span 2; }
    .large-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 768px) {
    .hero { padding: 2rem 1.25rem; }
    .hero-content h1 { font-size: 2rem; }
    .hero-content p { font-size: 1rem; }
    .hero-actions { width: 100%; flex-direction: column; align-items: stretch; }
    .hero-actions a { display: block; margin: 0.3rem 0; text-align: center; }
    .main-grid { grid-template-columns: 1fr; gap: 12px; }
    .games-grid-section, .promo-card { padding: 1rem; }
    .games-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}

@media (max-width: 640px) {
    .section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .hero { padding: 1.75rem 1rem; }
    .hero-content h1 { font-size: 1.75rem; }
}

@media (max-width: 1100px) {
    .search-container input { width: 150px; }
}

@media (max-width: 960px) {
    .site-header { padding: 0.35rem 0.9rem; }
    .mobile-nav-toggle { display: inline-flex; }
    .header-container { align-items: center; row-gap: 0.5rem; }
    .header-nav {
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        right: auto;
        width: min(340px, 92vw);
        background: #1d1d1f;
        border-radius: 14px;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
        padding: 12px;
        display: none;
        border: 1px solid rgba(255, 255, 255, 0.08);
        margin-left: 0;
    }
    .header-nav.active { display: block; }
    .header-nav .nav-list { flex-direction: column; align-items: stretch; gap: 0.5rem; }
    .nav-link { justify-content: space-between; width: 100%; }
    .header-right { margin-left: auto; min-width: 0; }
    .search-container { width: min(220px, 100%); }
    .nav-dropdown { position: static; width: 100%; margin-top: 4px; background: rgba(255, 255, 255, 0.04); box-shadow: none; padding: 8px; }
    .nav-dropdown-item { background: transparent; }
    .nav-dropdown-item { grid-template-columns: 36px minmax(0, 1fr); }
    .nav-dropdown-item img { width: 36px; height: 36px; }
    #searchResults { left: 0; right: auto; width: calc(100% + 4px); }
    .search-container input { width: 100%; min-width: 0; }
}

@media (max-width: 600px) {
    .site-header { padding: 0.35rem 0.75rem; }
    .header-container { flex-wrap: wrap; align-items: center; gap: 0.6rem; }
    .logo img { height: 32px; }
    .header-nav { width: 100%; max-width: none; }
    .header-right { order: 3; width: 100%; margin-left: 0; }
    .container { padding: 0 1rem; }
    .search-container {
        width: 100%;
        max-width: none;
        padding: 0.35rem 0.65rem;
    }
    .search-container input { font-size: 0.82rem; }
    #searchResults { width: 100%; max-height: 60vh; overflow-y: auto; }
    .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .game-player-card,
    .game-meta-card,
    .game-learning {
        padding: 16px !important;
        border-radius: 14px !important;
    }

    .game-player-header {
        justify-content: center !important;
        margin-bottom: 10px !important;
    }

    .game-fullscreen-toggle {
        width: 100%;
        justify-content: center;
        max-width: 260px;
    }

    .game-player-card iframe {
        height: min(62vh, 480px) !important;
        min-height: 280px !important;
    }

    .meta-details {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    .learning-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .game-container {
        display: block !important;
        width: min(100%, 980px) !important;
        max-width: calc(100% - 20px) !important;
        max-height: none !important;
        margin: 12px auto !important;
        gap: 0 !important;
    }

    .game-area,
    .sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 0 12px !important;
    }

    .game-area,
    .sidebar,
    .game-window {
        padding: 12px !important;
    }

    .sidebar {
        max-height: none !important;
        overflow: visible !important;
    }

    .game-window iframe,
    .game-window #game-frame,
    .game-area iframe,
    .game-area #game-frame {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 260px !important;
        height: min(58vh, 420px) !important;
    }

    .recommendations-container {
        padding: 0 10px !important;
        margin-top: 12px !important;
    }

    .recommendations {
        width: 100% !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    .recommendation {
        width: auto !important;
        height: auto !important;
        padding: 10px !important;
    }

    .recommendation img {
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 1 / 1;
        object-fit: cover !important;
    }
}

@media (max-width: 640px) {
    .game-player-card iframe {
        height: min(56vh, 360px) !important;
        min-height: 230px !important;
        border-radius: 10px !important;
    }

    .meta-callout {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .meta-details {
        grid-template-columns: 1fr !important;
    }

    .learning-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .game-window iframe,
    .game-window #game-frame,
    .game-area iframe,
    .game-area #game-frame {
        height: min(52vh, 320px) !important;
        min-height: 210px !important;
    }

    .recommendations {
        grid-template-columns: 1fr !important;
    }
}
