:root {
    --color-bg: #0f1220;
    --color-surface: #1a1f36;
    --color-text: #eef0f8;
    --color-muted: #9aa1b9;
    --color-accent: #6c5ce7;
    --color-accent-hover: #8177f0;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    color: var(--color-accent-hover);
}

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
}

.main-nav a {
    margin-left: 20px;
    color: var(--color-muted);
    font-weight: 500;
}

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

.gh-lang-select {
    margin-left: 20px;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.gh-lang-select:hover {
    border-color: var(--color-accent);
}

.gh-coin-balance {
    margin-left: 20px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9rem;
}

.gh-google-login {
    margin-left: 20px;
    background: var(--color-accent);
    color: #fff !important;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

main.container {
    padding: 32px 20px 60px;
    min-height: 60vh;
}

.hero {
    text-align: center;
    padding: 40px 0 20px;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.hero p {
    color: var(--color-muted);
}

.hero-banner {
    display: block;
    width: 100%;
    max-width: 900px;
    height: auto;
    margin: 0 auto 16px;
    border-radius: 16px;
}

.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;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.game-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.15s ease, border-color 0.15s ease;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-accent);
}

.game-card-thumb {
    display: block;
    width: calc(100% + 40px);
    margin: -20px -20px 4px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.game-card h3 {
    margin: 0;
}

.game-card p {
    color: var(--color-muted);
    font-size: 0.9rem;
    margin: 0;
}

.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.category-filters a {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-muted);
    font-size: 0.85rem;
}

.category-filters a.active {
    background: var(--color-accent);
    color: #fff;
}

.game-play-area {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 24px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.game-meta {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 24px;
}

.game-meta h2 {
    margin-top: 0;
}

.related-games {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 16px;
}

.related-games a {
    display: block;
    padding: 8px 0;
    color: var(--color-text);
}

.sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#leaderboard-panel ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

#leaderboard-panel li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#leaderboard-panel li:last-child {
    border-bottom: none;
}

#leaderboard-panel .lb-rank {
    width: 20px;
    color: var(--color-muted);
    font-weight: 700;
}

#leaderboard-panel .lb-flag {
    font-size: 1.1rem;
}

#leaderboard-panel .lb-initials {
    flex: 1;
    font-weight: 700;
    letter-spacing: 0.1em;
}

#leaderboard-panel .lb-score {
    color: #ffe14d;
    font-weight: 700;
}

#leaderboard-panel .lb-empty {
    color: var(--color-muted);
    border: none;
    padding: 6px 0;
}

.gh-score-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 14, 28, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.gh-score-modal {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 28px;
    text-align: center;
    width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.gh-score-modal h3 {
    margin: 0 0 8px;
}

.gh-score-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffe14d;
    margin: 0 0 12px;
}

.gh-score-input {
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: var(--color-bg);
    color: var(--color-text);
    margin-bottom: 6px;
    box-sizing: border-box;
}

.gh-score-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin: 0 0 10px;
    min-height: 1em;
}

.gh-score-country-label {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin: 0 0 8px;
}

.gh-score-countries {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    margin-bottom: 16px;
    padding: 2px;
}

.gh-country-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #232842;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 8px 2px;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.gh-country-btn.selected {
    border-color: var(--color-accent);
    background: #2b3153;
    color: var(--color-text);
}

.gh-score-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.gh-score-submit,
.gh-score-skip {
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.gh-score-submit {
    background: var(--color-accent);
    color: #fff;
}

.gh-score-skip {
    background: #232842;
    color: var(--color-muted);
}

.ad-slot {
    margin: 24px 0;
    text-align: center;
    color: var(--color-muted);
    font-size: 0.8rem;
}

.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 0;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-nav a {
    margin-left: 16px;
    color: var(--color-muted);
}

@media (max-width: 640px) {
    .game-meta {
        grid-template-columns: 1fr;
    }
    .header-inner {
        flex-direction: column;
        gap: 10px;
    }
    .main-nav a {
        margin: 0 10px;
    }
    .gh-lang-select {
        margin: 8px 0 0;
    }
    .gh-coin-balance,
    .gh-google-login {
        margin: 8px 0 0;
    }
    main.container {
        padding: 20px 10px 40px;
    }
    .game-play-area {
        padding: 12px;
    }
}
