﻿/* Comparison streak badge in header */
#comparison-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 6px 12px;
    margin-left: auto;
}

#comparison-streak-badge .icon {
    font-size: 1.1em;
}

#comparison-streak-badge .text {
    font-weight: 600;
}

#comparison-streak-badge.hidden {
    display: none;
}

#comparison-streak-badge.pulse {
    animation: pulseBadge 0.8s ease;
}

@keyframes pulseBadge {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

/* Second chance toast */
#comparison-second-chance {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%);
    background: rgba(255, 223, 0, 0.95);
    color: #222;
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

#comparison-second-chance.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
}

#comparison-second-chance.hidden {
    display: none;
}

/* Comparison game ad container - desktop only */
@media (min-width: 1024px) {
    .comparison-ad-container {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0 auto;
        max-width: 650px;
        padding: 12px 16px;
        z-index: 50;
        display: flex;
        justify-content: center;
        align-items: center;
        pointer-events: auto;
        /* Match placeholder look of other ads */
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-height: 100px;
    }
}

/* Hide comparison ad on mobile/tablet */
@media (max-width: 1023px) {
    .comparison-ad-container {
        display: none;
    }
}

/* Desktop HD (1366x768): scale game panel and center vertically */
@media (min-width: 769px) and (max-width: 1366px) and (max-height: 768px) {
    .game-info-container {
        left: 20px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    .game-info {
        transform: scale(0.7705);
        transform-origin: top left;
    }

    .right-panel {
        /* Facts panel: span full viewport height and adapt on resize */
        transform: translateX(100%) !important;
        /* no scale on container so it reaches bottom */
        transform-origin: top right !important;
        right: 20px !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 270px !important;
        /* slightly reduced width for 1366px */
        height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .right-panel:not(.hidden) {
        /* Slide in without scaling so full height is preserved */
        transform: translateX(0) !important;
        opacity: 1 !important;
        display: block !important;
    }

    /* Explicit open state safety net */
    .right-panel.open {
        transform: translateX(0) !important;
        opacity: 1 !important;
        display: block !important;
        z-index: 100 !important;
    }

    .streak-tab {
        /* Match game info panel scaling in 1366px mode */
        transform: scale(0.7705) !important;
        transform-origin: bottom center;
    }

    /* Ensure same base width; visual width equals 320 * 0.7705 for all panels (game-info, right-panel, streak-tab) */
    #right-panel.right-panel {
        width: 300px;
    }

    .streak-tab {
        left: 20px !important;
        /* Align with game-info-container left offset */
        bottom: 0;
        /* Align to bottom of viewport */
        width: 270px !important;
        /* Override any conflicting code - same width as game-info-container max-width */
        /* Visual width will be 320 * 0.7705 = 246.56px, same as game-info panel */
    }

    /* Slightly smaller text in facts at this resolution */
    #right-panel,
    #right-panel .country-facts-scroll {
        font-size: 0.92em;
    }

    /* Override max-height constraint for facts scroll in 1366px mode */
    #right-panel .country-facts-scroll {
        /* Fill remaining space within the panel and scroll */
        flex: 1 1 auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Ensure globe is positioned exactly like the start screen in 1366px mode */
    .globe-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #globe {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
    }
}

/* Desktop: Always match all panel widths to game info panel width */
@media (min-width: 769px) {
    .streak-tab {
        /* Match the same scaling as game-info panel - will be overridden by specific media queries */
        transform: scale(1);
        transform-origin: bottom center;
        position: fixed !important;
        left: 20px !important;
        /* Align with game info left edge */
        bottom: 0 !important;
        width: 270px !important;
        /* Match game info panel base width */
    }

    .right-panel {
        /* Match the same scaling as game-info panel - will be overridden by specific media queries */
        /* Don't override translateX here - let the visibility rules handle that */
        transform-origin: top right;
    }

    /* Center game info panel vertically in viewport - override base positioning */
    .game-info-container:not(.hidden) {
        position: fixed !important;
        top: 50% !important;
        left: 20px !important;
        transform: translateY(-50%) scale(0.85) !important;
        transform-origin: center left !important;
        z-index: 1000 !important;
        height: auto !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Ensure game info panel adjusts to viewport height changes */
    .game-info-container .game-info {
        max-height: calc(100vh - 40px);
        /* Account for top/bottom margins */
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Handle very short viewports */
    @media (min-width: 769px) and (max-height: 600px) {
        .game-info-container:not(.hidden) {
            top: 20px !important;
            transform: scale(0.85) !important;
        }

        .game-info-container .game-info {
            max-height: calc(100vh - 40px);
        }
    }

    /* Handle very tall viewports */
    @media (min-width: 769px) and (min-height: 1200px) {
        .game-info-container:not(.hidden) {
            top: 50% !important;
            transform: translateY(-50%) scale(0.85) !important;
        }
    }
}

/* Desktop override: ensure Daily Challenge panel spans full viewport height */
@media (min-width: 769px) {
    .game-info-container.daily-mode:not(.hidden) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        height: 100vh !important;

        width: 320px !important;
        max-width: 320px !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 1000;
        /* Ensure the entire panel has a defined stacking context */
    }

    .game-info-container.daily-mode .game-info {
        height: 100% !important;
        overflow: visible;
        /* Allow suggestions to overflow */
        display: flex;
        flex-direction: column;
        position: relative;
        --close-color: #ffa500;
        --somewhat-close-color: #ffff00;
        --wrong-color: #ff0000;

        /* Color blind friendly colors - Enhanced for better accessibility */
        --colorblind-correct: #A3BE8C;
        /* Muted green - distinguishable from red */
        --colorblind-close: #EBCB8B;
        /* Muted yellow - distinguishable from green */
        --colorblind-somewhat-close: #88C0D0;
        /* Light blue - distinguishable from other colors */
        --colorblind-wrong: #BF616A;
        /* Muted red - distinguishable from green */

        /* Dyslexia friendly font */
        --dyslexia-font: 'Open Sans', 'Arial', sans-serif;
        --default-font: 'Lexend', sans-serif;
    }

    /* Country color classes for guesses */
    .country.correct {
        fill: var(--correct-color) !important;
        opacity: 1 !important;
    }

    .country.close {
        fill: var(--close-color) !important;
        opacity: 1 !important;
    }

    .country.somewhat-close {
        fill: var(--somewhat-close-color) !important;
        opacity: 1 !important;
    }

    .country.wrong {
        fill: var(--wrong-color) !important;
        opacity: 1 !important;
    }

    /* Color blind mode classes */
    .colorblind-mode .country.correct {
        fill: var(--colorblind-correct) !important;
    }

    .colorblind-mode .country.close {
        fill: var(--colorblind-close) !important;
    }

    .colorblind-mode .country.somewhat-close {
        fill: var(--colorblind-somewhat-close) !important;
    }

    .colorblind-mode .country.wrong {
        fill: var(--colorblind-wrong) !important;
    }

    /* Dyslexia friendly mode */
    .dyslexia-mode {
        font-family: var(--dyslexia-font) !important;
        line-height: 1.6 !important;
        letter-spacing: 0.1em !important;
    }

    .dyslexia-mode h1,
    .dyslexia-mode h2,
    .dyslexia-mode h3,
    .dyslexia-mode p,
    .dyslexia-mode button,
    .dyslexia-mode label,
    .dyslexia-mode select {
        font-family: var(--dyslexia-font) !important;
        line-height: 1.6 !important;
        letter-spacing: 0.1em !important;
    }

    /* Active state for accessibility toggle buttons */
    .toggle-button.active {
        background: linear-gradient(135deg, #4CAF50, #45a049) !important;
        box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4) !important;
    }

    .toggle-button.active:hover {
        box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5) !important;
    }

    body {
        font-family: 'Lexend', sans-serif;
        font-weight: 300;
        background-color: #000011;
        /* Match globe canvas dark blue */
        color: var(--md-on-surface);
        overflow: hidden;
        line-height: 1.5;
    }



    /* Desktop game info container styles */
    @media (min-width: 769px) {
        .game-info-container {
            position: absolute;
            top: 30px;
            left: 30px;
            z-index: 100;
            min-width: 280px;
            max-width: 320px;
            height: 38vh;
            opacity: 0;
            transform: translateY(-20px);
            transition: opacity 0.3s ease, transform 0.3s ease;
            pointer-events: none;
            box-sizing: border-box;
        }
    }

    /* Daily Challenge Mode: Position on left side with full viewport height - Desktop only */
    @media (min-width: 769px) {
        .game-info-container.daily-mode {
            top: 0;
            left: 0;
            right: auto;
            width: 320px;
            max-width: 320px;
            height: 100vh;

            padding: 0;
            /* flush with left edge container, inner handles padding */
            box-sizing: border-box;
            background: transparent;
            border: none;
            box-shadow: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .game-info-container.daily-mode .game-info {
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        .game-info-container.daily-mode .game-info .desktop-layout {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            /* Center content vertically within desktop-layout */
            align-items: center;
            /* Center content horizontally within desktop-layout */
        }

        .game-info-container:not(.hidden) {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
    }

    .game-info {
        /* Enhanced Glassmorphism Effect - matching main menu exactly */
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
        padding: 32px;
        border-radius: 28px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;

        /* Enhanced visual effects */
        position: relative;
        overflow: visible;
        /* Allow suggestions to overflow */
        min-height: fit-content;
        /* Prevent panel from extending */
    }

    /* Daily Challenge Mode: Adjust game info panel */
    .game-info.daily-mode {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        padding: 16px;
        border-radius: 0 16px 16px 0;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    /* Daily challenge layout sections - Desktop only */
    @media (min-width: 769px) {
        .daily-challenge-input {
            width: 100%;
            position: relative;
            /* anchor suggestions */
            display: grid;
            grid-template-columns: 1fr;
            gap: 10px;
            z-index: 1000;
            /* Ensure input section is above guesses */
            overflow: visible;
            /* Ensure suggestions can overflow this container */
        }

        #daily-challenge-title {
            font-weight: 700;
            font-size: 1.2rem;
            opacity: .9;
            text-align: left;
        }
    }

    #country-guess-input {
        width: 100%;
        z-index: 1001;
        /* Ensure input is above suggestions */
        position: relative;
    }

    #submit-guess {
        width: 100%;
        z-index: 1001;
        /* Ensure button is above suggestions */
        position: relative;
    }

    /* Suggestions dropdown directly under input */
    #country-suggestions {
        position: fixed;
        /* Changed from absolute to fixed to escape stacking context */
        top: auto;
        /* Will be set by JavaScript */
        left: auto;
        /* Will be set by JavaScript */
        right: auto;
        width: auto;
        /* Will be set by JavaScript to match input width */
        z-index: 99999;
        /* Extremely high z-index to ensure it's above everything */
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(6px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 8px;
        max-height: 40vh;
        overflow-y: auto;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }


    .country-suggestions.hidden {
        display: none !important;
    }

    /* ===== NEW MOBILE DAILY CHALLENGE SUGGESTIONS ===== */
    @media (max-width: 768px) {

        /* Mobile Daily Challenge Suggestions - Brand New Implementation */
        .game-info.daily-mode #country-suggestions {
            position: absolute !important;
            top: calc(100% + 8px) !important;
            left: 0 !important;
            right: 0 !important;
            bottom: auto !important;
            width: 100% !important;
            max-width: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
            background: rgba(0, 0, 0, 0.9) !important;
            border: 1px solid rgba(255, 255, 255, 0.2) !important;
            border-radius: 8px !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
            max-height: 200px !important;
            overflow-y: auto !important;
            z-index: 10001 !important;
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            transform: none !important;
        }

        /* Hide suggestions when not needed */
        .game-info.daily-mode #country-suggestions.hidden {
            display: none !important;
        }

        /* Individual suggestion items */
        .game-info.daily-mode #country-suggestions .country-suggestion {
            display: flex !important;
            align-items: center !important;
            padding: 12px 16px !important;
            cursor: pointer !important;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
            color: white !important;
            font-size: 16px !important;
            min-height: 48px !important;
            transition: background-color 0.2s ease !important;
            background: transparent !important;
        }

        /* Hover and selected states */
        .game-info.daily-mode #country-suggestions .country-suggestion:hover,
        .game-info.daily-mode #country-suggestions .country-suggestion.selected {
            background: rgba(255, 255, 255, 0.15) !important;
        }

        /* Remove border from last item */
        .game-info.daily-mode #country-suggestions .country-suggestion:last-child {
            border-bottom: none !important;
        }

        /* Active state for touch feedback */
        .game-info.daily-mode #country-suggestions .country-suggestion:active {
            background: rgba(255, 255, 255, 0.25) !important;
            transform: scale(0.98) !important;
        }
    }


    /* Suggestion rows (fix class mismatch: country-suggestion) */
    #country-suggestions .country-suggestion {
        padding: 12px 16px;
        cursor: pointer;
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 1.15rem;
        transition: background-color 0.1s ease;
        /* Faster transition for better responsiveness */
        /* Ensure proper text rendering */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        /* Improve click/touch targets */
        min-height: 44px;
        /* Minimum touch target size */
        width: 100%;
        box-sizing: border-box;
        text-align: left;
        border: none;
        background: transparent;
        color: white;
    }

    #country-suggestions .country-suggestion:hover,
    #country-suggestions .country-suggestion.selected {
        background: rgba(255, 255, 255, 0.15);
        /* Add slight scale effect for better feedback */
        transform: scale(1.02);
        transition: all 0.1s ease;
    }

    #country-suggestions .country-suggestion:active {
        background: rgba(255, 255, 255, 0.25);
        transform: scale(0.98);
    }

    /* Mobile-specific improvements for daily challenge */
    @media (max-width: 768px) {

        /* Daily Challenge Mode Specific Fixes */
        .game-info.daily-mode {
            /* Ensure proper layout for daily challenge */
            display: flex !important;
            flex-direction: column !important;
            padding: 0 !important;
            position: relative !important;
            z-index: 1000 !important;
        }

        /* Copy beginner mode layout: hide timer, center score, stretch stats */
        .game-info.daily-mode .timer {
            display: none !important;
        }

        .game-info.daily-mode .score {
            flex: 1 !important;
            justify-content: center !important;
            text-align: center !important;
            width: 100% !important;
            min-width: 100% !important;
            max-width: 100% !important;
        }

        .game-info.daily-mode .stats-container {
            justify-content: stretch !important;
            width: 100% !important;
        }

        /* Daily Challenge Title - FORCE TO TOP OF GAME INFO PANEL */
        .game-info.daily-mode .daily-challenge-title,
        .game-info.daily-mode #daily-challenge-title {
            order: 1 !important;
            display: block !important;
            font-size: 24px !important;
            font-weight: 700 !important;
            text-align: center !important;
            color: white !important;
            background: rgba(0, 0, 0, 0.8) !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            margin: 0 !important;
            font-family: 'Lexend', sans-serif !important;
            text-rendering: optimizeLegibility !important;
            -webkit-font-smoothing: antialiased !important;
            -moz-osx-font-smoothing: grayscale !important;
            position: relative !important;
            z-index: 1000 !important;
            width: 100% !important;
            box-sizing: border-box !important;
        }

        /* Daily Challenge Input Container - Second element */
        .game-info.daily-mode .daily-challenge-input {
            order: 2;

            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            position: relative;
            z-index: 1001 !important;
            margin: 0 !important;
            overflow: visible !important;
        }

        /* Daily Challenge Guesses positioned under input */
        .game-info.daily-mode .daily-guesses {
            order: 3;
            max-height: 200px;
            overflow-y: auto;
            padding: 16px;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(5px);
            -webkit-backdrop-filter: blur(5px);
            display: block;
            width: 100%;
            box-sizing: border-box;
        }

        /* Mobile Daily Challenge Exit Button - positioned above top right of ad */
        .mobile-daily-exit-button {
            position: fixed !important;
            bottom: 100px !important;
            right: 20px !important;
            z-index: 10000 !important;
            background: rgba(244, 67, 54, 0.3) !important;
            border: 1px solid rgba(244, 67, 54, 0.5) !important;
            color: white !important;
            border-radius: 20px !important;
            padding: 12px 16px !important;
            font-size: 1em !important;
            font-weight: 600 !important;
            cursor: pointer !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
            transition: all 0.2s ease !important;
            min-width: 80px !important;
            max-width: 100px !important;
            text-align: center !important;
        }

        .mobile-daily-exit-button:hover {
            background: rgba(244, 67, 54, 0.5) !important;
            transform: translateY(-3px) !important;
            box-shadow: 0 8px 25px rgba(244, 67, 54, 0.3) !important;
        }

        .mobile-daily-exit-button:active {
            transform: translateY(-1px) !important;
        }

        /* Mobile Daily Challenge Ad Container - positioned at bottom of viewport */
        .mobile-daily-ad-container {
            position: fixed !important;
            bottom: 0 !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
            z-index: 9999 !important;
            background: rgba(0, 0, 0, 0.95) !important;
            border-top: 2px solid rgba(255, 255, 255, 0.2) !important;
            padding: 12px !important;
            margin: 0 !important;
            display: block !important;
            min-height: 80px !important;
        }

        /* Hide the regular ad container in mobile daily challenge mode */
        @media (max-width: 768px) {
            .game-info.daily-mode .game-info-ad-container {
                display: none !important;
            }
        }

        /* Hide Next button and neighbors hint in Daily Challenge mode */
        .game-info.daily-mode #mobile-next-country,
        .game-info.daily-mode #next-country,
        .game-info.daily-mode #mobile-neighbors-hint,
        .game-info.daily-mode #neighbors-hint,
        .game-info.daily-mode .hint-container {
            display: none !important;
        }

        /* Move Exit button to bottom of game-info panel */
        .game-info.daily-mode #mobile-reset-game,
        .game-info.daily-mode #reset-game {
            position: absolute !important;
            bottom: 20px !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            z-index: 1000 !important;
            margin: 0 !important;
        }


        /* Daily guesses layout handled above in the main daily-guesses rule */

        /* Mobile Daily Challenge - Original format with 3 rows before scrolling */
        .game-info.daily-mode .daily-guesses {
            max-height: 180px !important;
            /* Exactly 3 rows (60px per row) */
            overflow-y: auto !important;
        }

        .game-info.daily-mode .daily-guesses .guess-row {
            display: flex !important;
            flex-direction: row !important;
            align-items: center !important;
            padding: 6px !important;
            background: rgba(255, 255, 255, 0.05) !important;
            border: 1px solid rgba(255, 255, 255, 0.1) !important;
            border-radius: 4px !important;
            font-size: 0.8rem !important;
            gap: 4px !important;
        }

        /* Adjust globe positioning and clarity */
        .game-info.daily-mode #globe-container {
            position: fixed !important;
            top: 50% !important;
            left: 50% !important;
            transform: translate(-50%, -50%) !important;
            width: 100vw !important;
            height: 100vh !important;
            z-index: -1 !important;
        }

        .game-info.daily-mode #globe-container canvas {
            filter: none !important;
            /* Remove blur */
            opacity: 0.8 !important;
        }

        /* Duplicate rule removed - handled above in main daily-mode rules */

        /* Input positioning handled above in the main daily-challenge-input rule */

        /* Input and button styling handled above in the main daily-mode rules */

        /* Daily challenge input margin handled in daily-mode specific rules above */

        #country-suggestions:not(.game-info.daily-mode #country-suggestions) {
            /* Better positioning on mobile - EXCLUDES daily challenge mode */
            display: block;
            visibility: visible;
            position: fixed;
            top: auto;
            bottom: 80px;
            /* Position just below input field for better UX */
            left: 20px;
            right: 20px;
            max-height: 40vh;
            z-index: 10000;
            /* Increased from 5000 to ensure it overlays guesses */
        }


        /* Daily guesses height handled in daily-mode specific rules above */

        /* Daily challenge guess row styling */
        .daily-guesses .guess-row {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 8px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            font-size: 0.9rem;
        }

        /* Mobile Daily Challenge - Individual guess elements */
        .game-info.daily-mode .daily-guesses .guess-row .num {
            min-width: 16px;
            font-weight: 600;
            color: rgba(255, 255, 255, 0.7);
            font-size: 0.75rem;
        }

        .game-info.daily-mode .daily-guesses .guess-row .flag {
            width: 16px;
            height: 12px;
            object-fit: cover;
            border-radius: 2px;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }

        .game-info.daily-mode .daily-guesses .guess-row .name {
            flex: 1;
            min-width: 0;
            font-weight: 500;
            color: white;
            font-size: 0.75rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .game-info.daily-mode .daily-guesses .guess-row .distance {
            font-weight: 600;
            color: #ffd700;
            font-size: 0.75rem;
            min-width: 40px;
            text-align: right;
        }

        /* Mobile Daily Challenge - Correct/Incorrect distance colors */
        .game-info.daily-mode .daily-guesses .guess-row.correct .distance {
            color: #4ade80;
        }

        .game-info.daily-mode .daily-guesses .guess-row.incorrect .distance {
            color: #f87171;
        }

        /* ULTRA AGGRESSIVE - Force Daily Challenge Title to TOP */
        .game-info.daily-mode #daily-challenge-title {
            order: 1 !important;
            display: block !important;
            position: relative !important;
            z-index: 9999 !important;
            margin: 0 !important;
            /* padding: 0px 16px 10px 16px !important; */
            width: 100% !important;
            box-sizing: border-box !important;
            font-size: 24px !important;
            font-weight: 700 !important;
            text-align: center !important;
            color: white !important;
            background: rgba(0, 0, 0, 0.8) !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            font-family: 'Lexend', sans-serif !important;
            text-rendering: optimizeLegibility !important;
            -webkit-font-smoothing: antialiased !important;
            -moz-osx-font-smoothing: grayscale !important;
        }

        /* Show mobile-row-3 in mobile version */
        .mobile-row.mobile-row-3 {
            display: flex !important;
        }

        /* Larger touch targets on mobile - EXCLUDES daily challenge mode */
        #country-suggestions:not(.game-info.daily-mode #country-suggestions) .country-suggestion {
            min-height: 48px;
            font-size: 1.2rem;
            padding: 14px 16px;
        }
    }

    @media (min-height: 900px) {
        .daily-guesses .guess-row {
            font-size: 1rem;
        }
    }


    /* Desktop Daily Challenge Exit Button */
    .desktop-daily-exit-button {
        background: rgba(244, 67, 54, 0.9) !important;
        border: 1px solid rgba(244, 67, 54, 0.7) !important;
        color: white !important;
        border-radius: 8px !important;
        padding: 12px 20px !important;
        font-size: 1em !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3) !important;
        transition: all 0.2s ease !important;
        width: 100% !important;
        text-align: center !important;
        margin: 16px 0 !important;
        font-family: 'Lexend', sans-serif !important;
    }

    .desktop-daily-exit-button:hover {
        background: rgba(244, 67, 54, 1) !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 6px 20px rgba(244, 67, 54, 0.4) !important;
    }

    .desktop-daily-exit-button:active {
        transform: translateY(0px) !important;
    }

    /* Hide desktop exit button on mobile */
    @media (max-width: 768px) {
        .desktop-daily-exit-button {
            display: none !important;
        }
    }

    /* Place Exit button just above ad at the bottom - DESKTOP ONLY */
    @media (min-width: 769px) {
        .game-info.daily-mode .button-group {
            margin-top: auto;
            order: 98;
        }

        .game-info.daily-mode .game-info-ad-container {
            order: 99;
            display: flex !important;
            /* Ensure ad container is visible on desktop */
        }

        /* Desktop Daily Challenge - Original format with improved height */
        .game-info.daily-mode .daily-guesses {
            max-height: calc(100vh - 250px) !important;
            /* Allow space for exit button */
            overflow-y: auto !important;
        }

        /* Position desktop exit button above ad */
        .game-info.daily-mode .desktop-daily-exit-button {
            order: 97 !important;
            display: block !important;
        }
    }

    /* Lower the input by reserving some header spacing */
    .game-info.daily-mode .desktop-layout {
        padding-top: 8px;
    }

    /* --- Desktop Blitz visibility fix --- */
    .game-info.blitz-mode .stats-container,
    .game-info.blitz-mode .countries-left-container,
    .game-info.blitz-mode .desktop-layout {
        display: flex !important;
    }

    .game-info.blitz-mode .stats-container,
    .game-info.blitz-mode .countries-left-container {
        gap: 12px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Timer and Score containers */
    .game-info.blitz-mode .stats-container .timer,
    .game-info.blitz-mode .stats-container .score {
        background-color: rgba(30, 30, 30, 0.9) !important;
        padding: 6px 12px !important;
        border-radius: 20px !important;
        font-weight: 500 !important;
        font-size: 14px !important;
        min-width: 100px;
        text-align: center;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    /* Countries Left and Accuracy containers - need more width for longer text */
    .game-info.blitz-mode .countries-left-container .countries-left,
    .game-info.blitz-mode .countries-left-container .guess-accuracy {
        background-color: rgba(30, 30, 30, 0.9) !important;
        padding: 6px 12px !important;
        border-radius: 20px !important;
        font-weight: 500 !important;
        font-size: 16px !important;
        min-width: 180px;
        text-align: center;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        white-space: nowrap !important;
    }

    /* --- Desktop Blitz exact layout --- */
    @media (min-width: 769px) {
        .game-info.blitz-mode .countries-left-container {
            display: flex !important;
            flex-direction: column !important;

            width: 100% !important;
        }

        .game-info.blitz-mode .stats-container {
            width: 100% !important;
            display: flex !important;
            justify-content: space-between !important;

        }

        .game-info.blitz-mode .stats-container .timer,
        .game-info.blitz-mode .stats-container .score {
            flex: 1 !important;
            text-align: center !important;
        }

        .game-info.blitz-mode .countries-left,
        .game-info.blitz-mode .guess-accuracy {
            width: 100% !important;
            flex: 1 !important;
            display: block !important;
            margin: 0 !important;
            box-sizing: border-box !important;
            background: rgba(50, 50, 50, 0.3) !important;
            backdrop-filter: blur(10px) !important;
            -webkit-backdrop-filter: blur(10px) !important;
            border: 1px solid rgba(255, 255, 255, 0.15) !important;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
            color: white !important;
            padding: 8px 16px !important;
            border-radius: 20px !important;
            font-size: 18px !important;
            font-weight: 500 !important;
            text-align: center !important;
            white-space: nowrap !important;
        }
    }

    /* --- Desktop Blitz column flow & spacing --- */
    @media (min-width: 769px) {
        .game-info.blitz-mode {
            display: flex !important;
            flex-direction: column !important;
            /* gap: 20px !important; */
        }

        .game-info.blitz-mode .desktop-layout {
            display: flex !important;
            flex-direction: column !important;
        }
    }

    /* Make flag prompt smaller for desktop */
    @media (min-width: 768px) {
        #flag-prompt {
            width: 160px;
            /* Reduced from 100px */
            margin: 8px auto;
            /* Reduced margin */
        }

        #flag-prompt img {
            max-width: 50px;
            /* Reduced from 90px */
        }
    }

    .hint-container {
        width: 100%;
        /* Enhanced Glassmorphism Effect */
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        padding: 8px;
        margin-top: 4px;
        transition: all 0.3s ease;
        font-size: 0.8em;
        position: relative;
        overflow: hidden;
    }



    .hint-header {
        font-weight: 500;
        font-size: 0.9em;
        font-family: 'Lexend', sans-serif;
        margin-bottom: 2px;
        color: #ffcc00;
        text-align: center;
        position: relative;
        z-index: 2;
    }

    .hint {
        font-size: 0.4em;
        font-family: 'Lexend', sans-serif;
        font-weight: 300;
        margin-bottom: 3px;
        color: #ffffff;
        line-height: 1.2;
        text-align: center;
        position: relative;
        z-index: 2;
    }

    #neighbors-hint {
        color: white;
        font-family: 'Lexend', sans-serif;
        font-weight: 300;
        position: relative;
        z-index: 2;
    }

    #neighbors-value {
        font-size: 0.7em;
        font-family: 'Lexend', sans-serif;
        font-weight: 300;
        display: block;
        margin-top: 2px;
        line-height: 1.1;
        text-align: center;
        position: relative;
        z-index: 2;
    }

    /* Hide neighbors hint in Pro mode */
    .game-info.pro-mode #neighbors-hint {
        display: none !important;
    }

    .game-info h2 {
        font-size: 1.5em;
        margin-bottom: 12px;
        position: relative;
        z-index: 2;
    }

    .game-info div {
        font-size: 1em;
        margin: 3px;
        position: relative;

    }

    .game-info button {
        /* Glassmorphism Effect - matching main menu buttons */
        background: rgba(26, 115, 232, 0.3);
        /* Blue with transparency */
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(26, 115, 232, 0.5);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

        color: #ffffff;
        padding: 16px 20px;
        font-size: 18px;
        /* Increased from 14px */
        font-weight: 500;
        font-family: 'Lexend', sans-serif;
        letter-spacing: 0.1px;
        text-transform: none;
        border-radius: 20px;
        cursor: pointer;
        transition: all 0.3s ease;
        margin: 10px 0;

        position: relative;
        overflow: hidden;
        z-index: 2;
    }

    .game-info button:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(26, 115, 232, 0.3);
        background: rgba(26, 115, 232, 0.5);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
    }

    /* Specific colors for different button types */
    .game-info button#next-country {
        background: rgba(76, 175, 80, 0.3);
        /* Green for next */
        border-color: rgba(76, 175, 80, 0.5);
    }

    .game-info button#next-country:hover {
        background: rgba(76, 175, 80, 0.5);
        box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    }

    .game-info button#reset-game {
        background: rgba(244, 67, 54, 0.3);
        /* Red for exit */
        border-color: rgba(244, 67, 54, 0.5);
    }

    .game-info button#reset-game:hover {
        background: rgba(244, 67, 54, 0.5);
        box-shadow: 0 8px 25px rgba(244, 67, 54, 0.3);
    }


    .globe-container {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: transparent;
        overflow: hidden;
        touch-action: none;
    }


    /* Overlay behavior: do NOT shift globe when panels open (desktop) */
    @media (min-width: 1024px) {

        .left-panel:not(.hidden)~.globe-container,
        .right-panel:not(.hidden)~.globe-container,
        .left-panel:not(.hidden)~.right-panel:not(.hidden)~.globe-container {
            left: 0;
            right: 0;
            width: 100%;
        }
    }

    #globe {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        height: 100%;
    }

    #globe svg {
        display: block;
        margin: 0 auto;
        /* Performance optimizations for ultra-low LOD */
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;

        /* Optimize rendering - prioritize quality on mobile */
        image-rendering: auto;
        shape-rendering: geometricPrecision;
        text-rendering: optimizeLegibility;
    }

    /* Performance optimizations for country paths */
    #globe .country {
        /* Reduce stroke complexity */
        stroke-width: 0.5px;
        /* Optimize fill rendering */
        fill-opacity: 0.8;
        /* Prevent unnecessary repaints */
        will-change: fill, stroke;
    }

    /* Mobile-specific SVG quality improvements */
    @media (max-width: 768px) {
        #globe svg {
            /* Improve SVG rendering quality on mobile */
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
            shape-rendering: geometricPrecision;
        }

        #globe .country {
            /* Sharper borders on mobile */
            stroke-width: 0.75px;
            shape-rendering: geometricPrecision;
            /* Improve edge quality */
            vector-effect: non-scaling-stroke;
        }
    }

    /* Mobile zoom visual feedback */
    #globe.zoom-active {
        transform: scale(1.02);
        transition: transform 0.15s ease-out;
        filter: brightness(1.1) saturate(1.2);
    }

    #globe.double-tap-zoom {
        transform: scale(1.05);
        transition: transform 0.3s ease-out;
        filter: brightness(1.2) saturate(1.3);
    }

    /* Exciting globe animations */
    @keyframes globeRotate {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }

    @keyframes countryGlow {

        0%,
        100% {
            filter: drop-shadow(0 0 8px rgba(0, 168, 255, 0.3));
        }

        50% {
            filter: drop-shadow(0 0 15px rgba(0, 168, 255, 0.6)) drop-shadow(0 0 25px rgba(0, 87, 168, 0.4));
        }
    }

    /* D3 globe group and country animations removed - using 3D globe only */


    /* Styles for country highlighting */
    .country-highlight.correct {
        fill: var(--correct-color) !important;
        stroke: var(--correct-color) !important;
        stroke-width: 1px !important;
    }

    /* Style for flashing neighboring countries in beginner mode */
    .neighbor-flash {
        fill: #EAFFEA !important;
        /* Light green color */
        stroke: #EAFFEA !important;
        filter: drop-shadow(0 0 5px #EAFFEA) !important;
        animation: pulse 1.5s infinite alternate;
    }

    @keyframes pulse {
        0% {
            opacity: 0.5;
            filter: drop-shadow(0 0 3px #EAFFEA) !important;
        }

        100% {
            opacity: 1;
            filter: drop-shadow(0 0 8px #EAFFEA) !important;
        }
    }

    .country-highlight.close {
        fill: rgba(255, 165, 0, 0.7) !important;
        stroke: #ffa500 !important;
        stroke-width: 1px !important;
    }

    .country-highlight.somewhat-close {
        fill: rgba(255, 255, 0, 0.7) !important;
        stroke: #ffff00 !important;
        stroke-width: 1px !important;
    }

    .country-highlight.wrong {
        fill: rgba(255, 0, 0, 0.7) !important;
        stroke: #ff0000 !important;
        stroke-width: 1px !important;
    }

    /* Progress map styles */
    .progress-indicator {
        pointer-events: none;
        user-select: none;
    }

    .hidden {
        display: none !important;
    }

    button {
        background-color: var(--md-sys-color-secondary);
        color: var(--md-sys-color-secondary);
        border: none;
        padding: 12px 24px;
        border-radius: 20px;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.2s, transform 0.1s;
    }

    button:hover {
        background-color: var(--md-sys-color-secondary);
        transform: translateY(-1px);
    }

    button:active {
        transform: translateY(0);
    }

    .game-mode-selection {
        text-align: center;
        margin-bottom: 20px;
    }

    .game-info,
    .country-info {
        margin-top: 20px;
    }

    .game-info>div,
    .country-info>div {
        margin: 10px 0;
    }

    #country-to-guess {
        font-size: 2.1em !important;
        margin: 12px 0;
        font-weight: 800;
        color: rgb(210, 210, 210) !important;
        display: block;
        text-align: center;
        font-family: 'Lexend', sans-serif;
        /* Responsive scaling for long country names */
        max-width: 100%;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.1;
        /* Ensure text is fully visible */
        overflow: visible !important;
        white-space: normal !important;
        text-overflow: unset !important;
    }

    /* Auto-scale font size based on country name length */
    #country-to-guess[data-length="long"] {
        font-size: 1.8em !important;
    }

    #country-to-guess[data-length="very-long"] {
        font-size: 1.4em !important;
    }

    #country-to-guess[data-length="extremely-long"] {
        font-size: 1.1em !important;
    }

    #flag-prompt.hidden {
        display: none !important;
    }

    /* Make flag prompt smaller for desktop */
    #flag-prompt {
        display: block !important;
        width: 160px;
        /* Reduced from 100px */
        margin: 10px auto;
        /* Reduced margin */
        text-align: center;
        padding: 3px;
        /* Reduced padding */
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 6px;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }

    #flag-prompt img {
        max-width: 70px;
        /* Reduced from 90px */
        height: auto;
        display: block;
        margin: 0 auto;
        border: 2px solid white;
        transition: opacity 0.2s ease-in-out;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }


    /* Desktop-specific improvements */
    @media (min-width: 769px) {

        /* Ensure country names are fully visible on desktop */
        #country-to-guess {
            white-space: normal !important;
            overflow: visible !important;
            text-overflow: unset !important;
            max-width: 100% !important;
            word-wrap: break-word !important;
            overflow-wrap: break-word !important;
        }


        /* Ensure stats containers have enough space */
        .stats-container,
        .countries-left-container {
            min-width: 200px;
        }

        /* Ensure buttons stay on one line on desktop */
        .game-info .button-group {
            display: flex !important;
            flex-direction: row !important;
            justify-content: center !important;
            gap: 15px !important;
            flex-wrap: nowrap !important;
            width: 100% !important;
            max-width: 500px !important;

        }

        .game-info .button-group button {
            flex: 0 0 auto !important;
            min-width: 120px !important;
            max-width: 140px !important;
            white-space: nowrap !important;
            padding: 12px 16px !important;
            font-size: 16px !important;
        }
    }

    .instructions {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background-color: rgba(0, 0, 0, 0.7);
        padding: 10px 20px;
        border-radius: 5px;
        text-align: center;
        z-index: 2;
    }

    #flag-container {
        margin: 15px 0;
        text-align: center;
    }

    #flag-container img {
        max-width: 100%;
        border: 1px solid #333;
    }

    #country-facts {
        font-size: 0.9em;
        line-height: 1.5;
        padding-right: 5px;
    }

    /* Add scrolling to country facts - Desktop: no scrollbar, Mobile: with scrollbar */
    .country-facts-scroll {
        max-height: calc(100vh - 100px);
        /* Allow extending to bottom of page with some padding */
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 8px;
        max-height: calc(65vh - 120px);
        /* Use 65vh minus header space */
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 8px;
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        /* Ensure proper flex behavior */
        flex: 1;
        min-height: 0;
    }
}



/* Mobile: Show scrollbars */
@media (max-width: 768px) {
    .country-facts-scroll {
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
        -webkit-overflow-scrolling: touch;
    }

    .country-facts-scroll::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .country-facts-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .country-facts-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    .country-facts-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Facts container no longer needs its own scrollbar */

/* D3 globe styles removed - using 3D globe only */

/* D3 globe animations removed - using 3D globe only */

/* Shimmer effect removed - was causing horizontal moving glow */
/* @keyframes shimmer {
    0% { 
        background-position: -200% center;
    }
    100% { 
        background-position: 200% center;
    }
} */

/* Add shimmer effect to the globe container - DISABLED */
/* .globe-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 168, 255, 0.1),
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
} */

/* Mobile-specific performance optimizations */
.mobile-optimized {
    /* Optimize for mobile performance */
    shape-rendering: optimizeSpeed;
    text-rendering: optimizeSpeed;
}

/* MOBILE PERFORMANCE: Aggressive optimizations for mobile devices */
@media (max-width: 768px) {
    .mobile-optimized {
        /* Force hardware acceleration */
        transform: translateZ(0);
        backface-visibility: hidden;
        perspective: 1000px;

        /* Improve SVG rendering quality on mobile */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        shape-rendering: geometricPrecision;

        /* Reduce visual complexity */
        filter: none !important;
        box-shadow: none !important;
        text-shadow: none !important;

        /* Optimize rendering */
        will-change: transform;
        contain: layout style paint;
    }

    /* Reduce backdrop filter complexity on mobile */
    .right-panel {
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
    }

    /* Simplify glassmorphism effects */
    .game-info-container {
        backdrop-filter: blur(8px) !important;
        -webkit-backdrop-filter: blur(8px) !important;
    }
}

/* D3 mobile-optimized styles removed - using 3D globe only */

.mobile-optimized .star {
    /* Mobile: Optimize star rendering */
    shape-rendering: optimizeSpeed;
}

/* D3 mobile interaction styles removed - using 3D globe only */

/* D3 country styles removed - using 3D globe only */

/* D3 country boundary styles removed - using 3D globe only */



/* D3 mode-specific styles removed - using 3D globe only */

/* D3 hard mode styles removed - using 3D globe only */

/* D3 country highlight styles removed - using 3D globe only */

/* D3 country highlight styles removed - using 3D globe only */

/* Distance label at guess point */
.distance-label {
    fill: white;
    stroke: #333;
    stroke-width: clamp(1.5px, 0.35vw, 4px);
    font-size: clamp(16px, 2.2vw, 40px);
    font-weight: bold;
    text-anchor: middle;
    dominant-baseline: central;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8));
    pointer-events: none;
    z-index: 1000;
}

.distance-label-bg {
    fill: rgba(0, 0, 0, 0.7);
    stroke: #333;
    stroke-width: clamp(1px, 0.25vw, 3px);
    rx: 4;
    ry: 4;
}

.travel-line {
    fill: none;
    stroke: white;
    stroke-width: 2px;
    stroke-dasharray: 8, 4;
    /* Dash pattern: 8px dash, 4px gap */
    stroke-linecap: round;
    marker-end: url(#arrowhead);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.7));
    animation: travelFlow 2s linear infinite;
}

@keyframes travelFlow {
    0% {
        stroke-dashoffset: 0;
    }

    100% {
        stroke-dashoffset: -12;
        /* Negative value makes it flow forward (8 + 4 = 12) */
    }
}

/* Removed invalid CSS attempting to define SVG markers in CSS */

@keyframes pulse {

    0%,
    100% {
        stroke-opacity: 0.8;
        stroke-width: 1.5px;
    }

    50% {
        stroke-opacity: 1;
        stroke-width: 2px;
    }
}

/* 3D Stars */
.star {
    fill: white;
    stroke: none;
    transition: r 0.1s, opacity 0.1s;
    will-change: transform;
}

/* Remove all other star-related CSS (distant-star, medium-star, etc) */

/* 3D Stars */
.star {
    fill: white;
    stroke: none;
}

.distant-star {
    opacity: 0.5;
    animation: twinkle-star 4s infinite ease-in-out;
}

.medium-star {
    opacity: 0.7;
    animation: twinkle-star 6s infinite ease-in-out;
}

.close-star {
    opacity: 0.9;
    animation: twinkle-star 8s infinite ease-in-out;
}

@keyframes twinkle-star {

    0%,
    100% {
        opacity: 0.2;
    }

    50% {
        opacity: 1;
    }
}

/* Blue-themed Material You Colors */
:root {
    /* Light Mode Defaults */
    --md-primary: #6750A4;
    --md-on-primary: #FFFFFF;
    --md-secondary: #625B71;
    --md-on-secondary: #FFFFFF;
    --md-surface: #FFFBFE;
    --md-on-surface: #1C1B1F;
    --md-error: #B3261E;
    --md-sys-color-primary: #1a73e8;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d3e3fd;
    --md-sys-color-on-primary-container: #001d35;
    --md-sys-color-secondary: #5a7ab8;
    --md-sys-color-on-secondary: #ffffff;
    --md-sys-color-secondary-container: #d8e2ff;
    --md-sys-color-on-secondary-container: #111c2b;
    --md-sys-color-surface-variant: #e1e2ec;
    --md-sys-color-on-surface-variant: #44464f;
    --md-sys-color-outline: #74777f;
    --md-sys-color-shadow: #000000;
    --top-bar-height: 75px;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Dark Mode Overrides */
        --md-primary: #D0BCFF;
        --md-on-primary: #381E72;
        --md-secondary: #CCC2DC;
        --md-on-secondary: #332D41;
        --md-surface: #1C1B1F;
        --md-on-surface: #E6E1E5;
        --md-error: #F2B8B5;
        --md-sys-color-primary: #a8c7ff;
        --md-sys-color-on-primary: #002f66;
        --md-sys-color-primary-container: #004493;
        --md-sys-color-on-primary-container: #d6e3ff;
        --md-sys-color-secondary: #b0c6ff;
        --md-sys-color-on-secondary: #1a2f4d;
        --md-sys-color-secondary-container: #3a4f6d;
        --md-sys-color-on-secondary-container: #d6e3ff;
        --md-sys-color-surface: #1a1c1e;
        --md-sys-color-surface-variant: #44464f;
        --md-sys-color-on-surface-variant: #c4c5d0;
        --md-sys-color-outline: #8e9099;
    }
}

/* Start Screen - Simple Centering */
.start-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* Enhanced Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

    /* Simple responsive sizing */
    width: min(90vw, 530px);
    max-height: 95vh;
    padding: min(4vh, 32px) min(4vw, 32px);
    border-radius: min(3vw, 22px);
    text-align: center;
    z-index: 100;
    overflow: hidden;
    box-sizing: border-box;
}

.start-screen h1 {
    color: #ffffff;
    margin-bottom: clamp(8px, 2vh, 16px);
    font-size: clamp(3em, 12vw, 8em);
    font-weight: 900;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.01em;
    text-shadow: none;
    line-height: 1.05;
    text-align: center;
    word-break: break-word;
    margin-top: 50px;
}

/* Start screen logo image sizing */
.start-screen .logo {
    display: block;
    margin: 0 auto;
    width: min(35vw, 280px);
    height: auto;
    max-width: 100%;
}

/* A11y utility for visually hidden, screen-reader readable text */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.start-screen h1::after {
    content: none;
}

/* Removed gradient animation for title */

.start-screen .byline {
    color: rgba(255, 255, 255, 0.9);
    margin-top: min(1vh, 8px);
    margin-bottom: min(2vh, 21px);
    font-size: min(3vw, 1.4em);
    font-weight: 800;
    font-family: 'Lexend', sans-serif;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
    line-height: 1.3;
    text-align: center;
    white-space: normal;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.start-screen p {
    color: white;
    margin-bottom: clamp(8px, 1.5vh, 16px);
    line-height: 1.6;
    /* Responsive font size - reduced for desktop */
    font-size: clamp(11px, 1.8vw, 11px);
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
    opacity: 0.85;
    max-width: min(400px, 90%);
    margin-left: auto;
    margin-right: auto;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: min(1.5vh, 12px);
    width: 100%;
    max-width: min(550px, 90%);
    margin-top: min(2vh, 16px);
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
    justify-items: center;
    align-content: center;
    align-items: center;
}

/* Base cog icon styling - visible on all screen sizes */
.cog-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    background: rgba(107, 114, 128, 0.8);
    border: 1px solid rgba(107, 114, 128, 0.9);
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

.cog-icon:hover {
    background: rgba(107, 114, 128, 0.95);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.6);
}

.cog-icon::before {
    content: "⚙";
    font-size: 16px;
    color: white;
    font-weight: bold;
}

/* Large desktop screens - larger cog icon */
@media (min-width: 1440px) {

    .cog-icon {
        top: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .cog-icon::before {
        font-size: 18px;
    }
}


@media (min-width: 1440px) {
    .mode-buttons {
        max-width: min(85%, 1200px) !important;
        gap: min(1.2vw, 16px);
        justify-content: center;
        justify-items: center;
    }

    .mode-buttons button {
        min-height: min(7vh, 70px);
    }
}

/* Medium desktop screens */
@media (min-width: 1024px) and (max-width: 1439px) {
    /* Styles already defined in the main desktop media query */
}

/* Smaller desktop screens - no start-screen overrides needed */

/* Original h1 styles from the main desktop media query - removing duplicate */
/*
    font-size: min(6vw, 7rem) !important;
    letter-spacing: 0.01em;
    margin-bottom: min(1vh, 6px);
    text-align: center;
  }

  .start-screen .byline {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.6rem;
    opacity: 0.9;
    text-align: center;
    max-width: min(400px, 90%);
    margin-left: auto;
    margin-right: auto;
  }

  /* Turn mode buttons into premium cards */
.mode-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: min(1.2vw, 8px);
    width: 100% !important;
    max-width: min(90%, 1000px) !important;
    margin: min(2vh, 16px) auto 0;
    place-items: stretch;
    justify-content: center;
    align-content: center;
}


.mode-buttons button {
    align-items: center;
    justify-content: center;
    text-align: center;
    aspect-ratio: 6 / 4;
    /* slightly wider than tall, but shorter */
    min-height: 0;
    height: auto;
    padding: 4px;
    border-radius: 8px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    /* Higher contrast cards */
    background: rgba(36, 38, 48, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.10);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.30);
}

.mode-buttons button span:first-child {
    font-size: 14px;
    margin-bottom: 4px;
    font-weight: 700;
    display: block;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mode-buttons button .subtext {
    font-size: clamp(8px, .8vw, 9px);
    line-height: 1.2;
    max-width: 95%;
    opacity: 0.9;
    overflow: visible;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Per-mode accents (cards) */
#mode-beginner {
    background: rgba(76, 175, 80, 0.8);
    /* Vibrant green flat color */
    border-color: rgba(76, 175, 80, 0.9);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#mode-beginner:hover {
    background: rgba(76, 175, 80, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(76, 175, 80, 0.6);
}

#mode-easy {
    background: rgba(26, 115, 232, 0.8);
    /* Vibrant blue flat color */
    border-color: rgba(26, 115, 232, 0.9);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}

#mode-easy:hover {
    background: rgba(26, 115, 232, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(26, 115, 232, 0.6);
}

#mode-hard {
    background: rgba(156, 39, 176, 0.8);
    /* Vibrant purple flat color */
    border-color: rgba(156, 39, 176, 0.9);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

#mode-hard:hover {
    background: rgba(156, 39, 176, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(156, 39, 176, 0.6);
}

/* Distinct colors for option modes on desktop */
#mode-flag {
    background: rgba(244, 67, 54, 0.8);
    /* Vibrant red flat color */
    border-color: rgba(244, 67, 54, 0.9);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

#mode-flag:hover {
    background: rgba(244, 67, 54, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(244, 67, 54, 0.6);
}

#mode-comparison-mobile {
    background: rgba(255, 152, 0, 0.8);
    /* Vibrant orange flat color */
    border-color: rgba(255, 152, 0, 0.9);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

#mode-comparison-mobile:hover {
    background: rgba(255, 152, 0, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(255, 152, 0, 0.6);
}

#mode-blitz {
    background: rgba(3, 169, 244, 0.8);
    /* Vibrant cyan flat color */
    border-color: rgba(3, 169, 244, 0.9);
    box-shadow: 0 4px 15px rgba(3, 169, 244, 0.4);
}

#mode-blitz:hover {
    background: rgba(3, 169, 244, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(3, 169, 244, 0.6);
}

/* Keep leaderboard with vibrant flat colors */
#open-leaderboard {
    background: rgba(255, 215, 0, 0.8);
    /* Vibrant gold flat color */
    border-color: rgba(255, 215, 0, 0.9);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

#open-leaderboard:hover {
    background: rgba(255, 215, 0, 0.95);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(255, 215, 0, 0.6);
}

/* Add subtle desktop background glow behind hero */
.start-screen::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto -10%;
    height: 60%;
    background: radial-gradient(60% 60% at 50% 50%, rgba(168, 199, 255, 0.14), rgba(208, 188, 255, 0.08) 50%, rgba(0, 0, 0, 0) 70%);
    filter: blur(18px);
    z-index: -1;
}

/* Cinematic aurora layer */
.start-screen::after {
    display: none;
}

@keyframes auroraShift {
    0% {
        transform: translateY(-2%) rotate(0deg) scale(1.05);
        opacity: 0.6;
    }

    50% {
        transform: translateY(2%) rotate(8deg) scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-1%) rotate(-6deg) scale(1.06);
        opacity: 0.65;
    }
}

/* Scanline shimmer over hero */
.start-screen .scanlines {
    display: none;
}

/* Mode tile icon badges removed */
#mode-beginner::before,
#mode-easy::before,
#mode-hard::before,
#mode-flag::before,
#mode-bigger::before,
#mode-blitz::before,
#open-leaderboard::before {
    content: none;
}

/* Rich hover micro-interactions */
.mode-buttons button {
    perspective: 800px;
    transform-style: preserve-3d;
}

.mode-buttons button:hover {
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

/* Revolving byline below the main tagline */
/* .start-screen .byline::after {
    content: "Master the world, one guess at a time";
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.85;
    animation: taglineCycle 16s steps(1) infinite;
  }
  @keyframes taglineCycle {
    0% { content: "Master the world, one guess at a time"; }
    25% { content: "Flags, borders, and bragging rights"; }
    50% { content: "From beginners to pros â€” find your challenge"; }
    75% { content: "Fast, global, and gloriously tricky"; }
    100% { content: "Master the world, one guess at a time"; }
  } */

/* Ensure logo width matches byline width on desktop */
.start-screen .logo {
    display: block;
    width: min(25vw, 266px);
    max-width: 100%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}


.mode-buttons button {
    margin: 0;
    /* Responsive sizing with consistent scaling */
    font-size: min(1.8vw, 14px);
    padding: min(2vh, 16px) min(2vw, 20px);
    border-radius: min(2vw, 16px);
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    letter-spacing: 0.1px;
    text-transform: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    /* Enforce consistent button height across all tiles (taller for readability) */
    height: 17vh !important;

    min-height: 0 !important;

    /* Enhanced Glassmorphism */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);

    position: relative;
    overflow: hidden;

    /* Layout for responsive text */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

/* Keep button title/subtext from forcing uneven heights */
.mode-buttons button span:first-child {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mode-buttons button .subtext {
    overflow: visible;
    display: block;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Responsive button text layout with consistent scaling */
.mode-buttons button span:first-child {
    font-size: min(2.2vw, 16px);
    font-weight: 600;
    margin-bottom: min(0.8vh, 5px);
    display: block;
    line-height: 1.2;
}

.mode-buttons button .subtext {
    font-size: min(1.3vw, 12px);
    font-weight: 300;
    opacity: 0.8;
    line-height: 1.3;
    max-width: 95%;
    display: block;
}

/* Enhanced hover effects */
.mode-buttons button:hover {
    transform: translateY(min(-0.5vh, -4px)) scale(1.02);
    box-shadow: 0 min(2vh, 12px) min(3vw, 30px) rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Daily Challenge Completion Modal */
.daily-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.daily-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.daily-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.daily-modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(26, 115, 232, 0.95), rgba(0, 150, 136, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    max-width: 600px;
    margin: 10px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.daily-modal:not(.hidden) .daily-modal-content {
    transform: scale(1);
}

.daily-modal-header {
    text-align: center;
    padding: clamp(20px, 4vh, 30px) clamp(20px, 4vw, 30px) clamp(15px, 3vh, 20px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.celebration-icon {
    font-size: clamp(2rem, 8vw, 4rem);
    margin-bottom: clamp(8px, 2vh, 15px);
    animation: bounce 0.6s ease;
}

.daily-modal-title {
    color: #ffffff;
    font-size: clamp(1.2rem, 5vw, 2rem);
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.daily-modal-body {
    padding: clamp(20px, 4vw, 30px);
    text-align: center;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.daily-modal-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    margin-bottom: clamp(10px, 3vh, 20px);
    line-height: 1.4;
}

.daily-modal-country {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: clamp(10px, 2vw, 15px);
    padding: clamp(15px, 4vw, 20px);
    margin: clamp(15px, 3vh, 20px) 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.country-name {
    color: #ffffff;
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.daily-modal-info {
    margin-top: clamp(15px, 3vh, 25px);
}

.comeback-message {
    color: rgba(255, 255, 255, 0.8);
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    margin-bottom: clamp(10px, 2vh, 20px);
    line-height: 1.3;
}

.daily-modal-stats {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 20px);
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    margin-bottom: clamp(3px, 1vh, 5px);
    line-height: 1.2;
}

.stat-value {
    display: block;
    color: #ffffff;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    line-height: 1.2;
}

.daily-modal-footer {
    padding: clamp(15px, 3vh, 20px) clamp(20px, 4vw, 30px) clamp(20px, 4vh, 30px);
    display: flex;
    gap: clamp(10px, 2vw, 15px);
    justify-content: center;
    flex-shrink: 0;
}

.daily-modal-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: clamp(8px, 1.5vw, 12px);
    color: #ffffff;
    padding: clamp(10px, 2vh, 12px) clamp(18px, 3vw, 24px);
    font-size: clamp(0.8rem, 2.2vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: clamp(100px, 20vw, 140px);
    line-height: 1.2;
}

.daily-modal-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.daily-modal-button.primary {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.8), rgba(76, 175, 80, 0.6));
    border-color: rgba(76, 175, 80, 0.9);
}

.daily-modal-button.primary:hover {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(76, 175, 80, 0.7));
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.daily-modal-button.secondary {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.8), rgba(156, 39, 176, 0.6));
    border-color: rgba(156, 39, 176, 0.9);
}

.daily-modal-button.secondary:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.9), rgba(156, 39, 176, 0.7));
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

/* Dynamic sizing replaces responsive breakpoints - no scroll bars needed! */

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .daily-modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
        border-radius: 15px;
    }

    .daily-modal-header {
        padding: 25px 20px 15px;
    }

    .celebration-icon {
        font-size: 3rem;
        margin-bottom: 10px;
    }

    .daily-modal-title {
        font-size: 1.5rem;
    }

    .daily-modal-body {
        padding: 20px;
    }

    .daily-modal-message {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .daily-modal-country {
        padding: 15px;
        margin: 15px 0;
    }

    .country-name {
        font-size: 1.2rem;
    }

    .daily-modal-footer {
        padding: 15px 20px 20px;
        flex-direction: column;
        gap: 10px;
    }

    .daily-modal-button {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }

    .daily-modal-stats {
        flex-direction: column;
        gap: 10px;
    }
}

/* Large Desktop Enhancements */
@media (min-width: 1440px) {
    .daily-modal-content {
        max-width: 600px;
    }

    .daily-modal-title {
        font-size: 2.5rem;
    }

    .celebration-icon {
        font-size: 5rem;
    }

    .country-name {
        font-size: 1.8rem;
    }
}

.mode-buttons button.beginner {
    background: rgba(76, 175, 80, 0.8);
    /* Vibrant green flat color */
    color: #ffffff;
    border-color: rgba(76, 175, 80, 0.9);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.mode-buttons button.easy {
    background: rgba(26, 115, 232, 0.8);
    /* Vibrant blue flat color */
    color: #ffffff;
    border-color: rgba(26, 115, 232, 0.9);
    box-shadow: 0 4px 15px rgba(26, 115, 232, 0.4);
}

.mode-buttons button.hard {
    background: rgba(156, 39, 176, 0.8);
    /* Vibrant purple flat color */
    color: #ffffff;
    border-color: rgba(156, 39, 176, 0.9);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

.mode-buttons button.options {
    background: rgba(0, 150, 136, 0.8);
    /* Vibrant teal flat color */
    color: #ffffff;
    border-color: rgba(0, 150, 136, 0.9);
    box-shadow: 0 4px 15px rgba(0, 150, 136, 0.4);
}

/* Distinct colors for option modes (default/mobile) */
#mode-flag {
    background: rgba(244, 67, 54, 0.8);
    /* Vibrant red flat color */
    border-color: rgba(244, 67, 54, 0.9);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.4);
}

#mode-comparison-mobile {
    background: rgba(255, 152, 0, 0.8);
    /* Vibrant orange flat color */
    border-color: rgba(255, 152, 0, 0.9);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.4);
}

#mode-blitz {
    background: rgba(3, 169, 244, 0.8);
    /* Vibrant cyan flat color */
    border-color: rgba(3, 169, 244, 0.9);
    box-shadow: 0 4px 15px rgba(3, 169, 244, 0.4);
}

#mode-flag:hover {
    background: rgba(244, 67, 54, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(244, 67, 54, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

#mode-comparison-mobile:hover {
    background: rgba(255, 152, 0, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(255, 152, 0, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

#mode-blitz:hover {
    background: rgba(3, 169, 244, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(3, 169, 244, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

.mode-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.mode-buttons button.beginner:hover {
    background: rgba(76, 175, 80, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(76, 175, 80, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

.mode-buttons button.easy:hover {
    background: rgba(26, 115, 232, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(26, 115, 232, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

.mode-buttons button.hard:hover {
    background: rgba(156, 39, 176, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(156, 39, 176, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

.mode-buttons button.options:hover {
    background: rgba(0, 150, 136, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(0, 150, 136, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

.mode-buttons button.leaderboard-btn {
    background: rgba(255, 215, 0, 0.8);
    /* Vibrant gold flat color */
    color: #ffffff;
    border-color: rgba(255, 215, 0, 0.9);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.mode-buttons button.leaderboard-btn:hover {
    background: rgba(255, 215, 0, 0.95);
    box-shadow: 0 clamp(8px, 2vh, 15px) clamp(20px, 4vh, 40px) rgba(255, 215, 0, 0.6);
    transform: translateY(-6px) scale(1.02) rotateX(1.5deg);
}

/* Typography */
h2,
h3,
.timer,
.score,
.countries-left,
.guess-accuracy {
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    color: white;
    text-align: center;
}

h2 {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

h3 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 12px;
}


#country-to-guess {
    font-weight: 800;
    font-family: 'Lexend', sans-serif;
    color: var(--md-sys-color-primary);
}

/* Buttons */
button {
    background-color: var(--md-sys-color-secondary);
    color: var(--md-on-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    width: 100%;
}

button:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}



/* Update country info panel */
.country-info {
    background-color: #252525;
    padding: 15px;
    border-radius: 5px;
    margin-top: 20px;
}

/* Pinch zoom visual feedback */
.pinch-zoom-active {
    cursor: zoom-in !important;
}

.pinch-zoom-active::after {
    content: "ðŸ”";
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    border-radius: 50%;
    z-index: 1000;
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Improve touch handling */
#globe {
    touch-action: pan-x pan-y;
    /* Allow panning but handle pinch zoom manually */
}

#globe svg {
    touch-action: none;
    /* Prevent browser's default touch handling */
}



/* D3 hard mode styles removed - using 3D globe only */

/* D3 hard mode highlight styles removed - using 3D globe only */

/* New layout styles */
.game-ui {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 20px;
    z-index: 100;
    pointer-events: none;
}

/* Desktop right panel styles */
@media (min-width: 769px) {
    .right-panel {
        position: fixed !important;
        right: 0 !important;
        left: auto !important;
        top: 0;
        width: 270px;
        height: 100vh;

        /* Enhanced Glassmorphism Effect - matching main menu exactly */
        background: rgba(30, 30, 30, 0.25);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.18);
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

        border-radius: 28px 0 0 28px;
        padding: 24px;
        color: white;
        z-index: 100;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        transform: translateX(100%);
        scrollbar-width: none;
        /* Hide scrollbar by default */
        -ms-overflow-style: none;
        /* Hide scrollbar in IE/Edge */
    }
}

/* Desktop scrollbar styles for right panel */
@media (min-width: 769px) {

    /* Custom scrollbar for right panel */
    .right-panel::-webkit-scrollbar {
        width: 12px;
    }

    .right-panel::-webkit-scrollbar-track {
        background: rgba(50, 50, 50, 0.3);
        border-radius: 6px;
    }

    .right-panel::-webkit-scrollbar-thumb {
        background: rgba(110, 166, 255, 0.6);
        border-radius: 6px;
    }

    .right-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(110, 166, 255, 0.8);
    }

    /* Firefox scrollbar */
    .right-panel {
        scrollbar-width: thin;
        scrollbar-color: rgba(110, 166, 255, 0.6) rgba(50, 50, 50, 0.3);
    }

    /* Show scrollbars only when content overflows */
    .right-panel:not(.hidden) {
        scrollbar-width: auto;
        opacity: 1;
    }

    .right-panel:not(.hidden)::-webkit-scrollbar {
        display: block;
    }
}

/* Desktop-specific enhancements */
@media (min-width: 769px) {
    .right-panel {
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid rgba(255, 255, 255, 0.18);
    }

    .right-panel:not(.hidden) {
        /* Keep visibility but don't override scaling - let the general desktop rule handle scaling */
        transform: translateX(0) scale(1);
    }

    .right-panel.hidden {
        transform: translateX(100%);
    }
}

/* Desktop hidden panel rules */
@media (min-width: 769px) {
    .right-panel.hidden {
        /* Keep in DOM for smooth slide-out; just hide via opacity/transform */
        opacity: 0;
        pointer-events: none;
    }
}

.guess-button {
    background-color: #1a73e8;
    color: white;
    font-weight: bold;
    margin: 10px 0;
    padding: 12px 24px;
}

/* Country info styles */
.country-flag {
    width: 100%;
    max-height: 150px;
    object-fit: contain;
    margin-bottom: 15px;
    border: 1px solid #444;
}

.fact-group {
    margin-top: 15px;
}

.fact-group p {
    margin: 8px 0;
}

/* Desktop panel visibility rules */
@media (min-width: 769px) {

    .left-panel,
    .right-panel {
        display: none;
        /* Start hidden */
    }

    .left-panel:not(.hidden),
    .right-panel:not(.hidden) {
        display: block;
        /* Show when not hidden */
    }
}

button.disabled {
    background: rgba(102, 102, 102, 0.3) !important;
    border-color: rgba(102, 102, 102, 0.5) !important;
    color: rgba(255, 255, 255, 0.5) !important;
    cursor: not-allowed;
    opacity: 0.7;
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
}

button.disabled:hover {
    transform: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    background: rgba(102, 102, 102, 0.3) !important;
}

button.disabled::before {
    display: none !important;
}

/* Pinch zoom visual feedback */
.pinch-zoom-active {
    transition: box-shadow 0.3s ease;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .game-info-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
        z-index: 1000 !important;
        /* Ensure high z-index */
    }

    /* Ultra-high specificity mobile rules to override any desktop rules */
    html body div#game-info-container.game-info-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 0 !important;
        overflow: visible !important;
        z-index: 1000 !important;
    }

    .game-info-container.hidden {
        transform: translateY(-100%) !important;
    }

    .game-info {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 12px !important;
        border-radius: 0 0 15px 15px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        /* Override any conflicting transform or positioning */
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
    }

    /* Make sure no child elements are causing overflow */
    .game-info * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Ensure globe container adjusts properly */
    .globe-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        transform: none !important;
    }

    #globe {
        position: absolute !important;
        top: 25vh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 75vh !important;
        transform: none !important;
    }

    /* Mobile scaling for specific game info elements */
    .game-info .timer,
    .game-info .score,
    .game-info .countries-left,
    .game-info .guess-accuracy {
        font-size: 0.7em !important;
        /* 30% smaller */
        padding: 0.7em !important;
        /* 30% smaller padding */
    }

    .game-info #neighbors-hint {
        font-size: 1em !important;
        /* 30% smaller */
    }

    .game-info button#next-country,
    .game-info button#reset-game {
        font-size: 0.7em !important;
        /* 30% smaller */
        padding: 0.7em 1.4em !important;
        /* 30% smaller padding */
    }

    /* Shrink gaps and margins */
    .game-info .stats-container,
    .game-info .countries-left-container {
        gap: 0.1em !important;
        /* Ultra small gap */
        margin: 0.1em 0 !important;
        /* Ultra small margin */
    }

    .game-info h2 {
        margin-bottom: 0.1em !important;
        /* Ultra small margin */
    }

    .game-info div {
        margin: 0.1em 0 !important;
        /* Ultra small margin */
    }

    .game-info .button-group {
        gap: 0.1em !important;
        /* Ultra small gap */
        margin-top: 0.1em !important;
        /* Ultra small margin */
    }

    /* Reduce country name size slightly */
    .game-info #country-to-guess {
        font-size: 2em !important;
        /* Slightly smaller country name */
    }
}

/* Additional mobile device rules for body.mobile-device and html[data-viewport="mobile"] */
body.mobile-device .game-info-container,
html[data-viewport="mobile"] .game-info-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    z-index: 1000 !important;
}

/* Ultra-high specificity mobile rules to override any desktop rules */
html body.mobile-device div#game-info-container.game-info-container,
html[data-viewport="mobile"] body div#game-info-container.game-info-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    max-width: 100vw !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    transform: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    z-index: 1000 !important;
}

body.mobile-device .game-info-container.hidden,
html[data-viewport="mobile"] .game-info-container.hidden {
    transform: translateY(-100%) !important;
}

body.mobile-device .game-info,
html[data-viewport="mobile"] .game-info {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    padding: 12px !important;
    border-radius: 0 0 15px 15px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
}

/* Galaxy S8 styles moved to end of file for proper cascade order */

/* iPhone SE specific styles - prevent inheritance conflicts */
@media (max-width: 375px) and (max-height: 667px) {
    .game-info-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        z-index: 1000 !important;
        transform: scaleX(1.0) !important;
        /* Scale horizontally to fit viewport */

    }

    .game-info {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 10px !important;
        border-radius: 0 0 12px 12px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: scaleX(1.0) !important;
        /* Scale horizontally to fit viewport */
        transform-origin: left top !important;
    }

    .game-info * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .game-info .timer,
    .game-info .score,
    .game-info .countries-left,
    .game-info .guess-accuracy {
        font-size: 0.65em !important;
        padding: 0.6em !important;
    }

    .game-info #neighbors-hint {
        font-size: 0.85em !important;
    }

    .game-info button#next-country,
    .game-info button#reset-game {
        font-size: 0.65em !important;
        padding: 0.6em 1.2em !important;
    }

    .game-info .stats-container,
    .game-info .countries-left-container {
        gap: 0.08em !important;
        margin: 0.08em 0 !important;
    }

    .game-info h2 {
        margin-bottom: 0.08em !important;
    }

    .game-info div {
        margin: 0.08em 0 !important;
    }

    .game-info .button-group {
        gap: 0.08em !important;
        margin-top: 0.08em !important;
    }

    .game-info #country-to-guess {
        font-size: 1.8em !important;
    }

    .globe-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        transform: none !important;
    }

    #globe {
        position: absolute !important;
        top: 25vh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 75vh !important;
        transform: none !important;
    }

    .panel-toggle:hover {
        background: rgba(50, 50, 50, 0.3);
        transform: translateY(-1px);
    }

    .right-panel:not(.expanded) .panel-content {
        display: none;
    }



    .right-panel .flag-container {
        margin-top: 8px;
        padding: 6px;
        margin-bottom: 14px;
        border-radius: 12px;
    }

    .right-panel .flag-container h3 {
        font-size: 1.4em;
        margin-bottom: 8px;
    }

    .right-panel .flag-container img {
        max-height: 120px;
        margin-top: 5px;
    }

    .right-panel .country-facts {
        font-size: 12px;
    }

    .right-panel .country-facts-scroll {
        max-height: calc(65vh - 120px);
        /* Use available space minus header and padding */
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        /* Mobile: Show scrollbars only when needed */
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
        /* Ensure content fills available space */
        flex: 1;
        min-height: 0;
        /* Allow flex item to shrink */
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }

    .right-panel .fact-group h4 {
        font-size: 15px;
        margin-top: 15px;
        margin-bottom: 5px;
        padding-bottom: 3px;
        border-bottom: 1px solid #555;
    }

    .right-panel .fact-group p {
        margin: 5px 0;
    }

    #country-to-guess {
        margin: 2px 0 !important;
    }

    .game-info h2 {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .right-panel .flag-container h3 {
        font-size: 1.4em;
        margin-bottom: 8px;
    }

    .right-panel .flag-container img {
        max-height: 120px;
        margin-top: 5px;
    }

    .panel-handle {
        width: 50px;
        height: 6px;
        background: #ccc;
        border-radius: 3px;
        margin: 10px auto;
        cursor: pointer;
    }

    /* Ensure button group takes full width for comparison */
    .game-info .button-group {
        display: flex;
        justify-content: space-around;
        /* This makes buttons spread out */
        gap: 8px;
        margin-top: 5px;
        /* Adjust spacing as needed */
        width: 100%;
        box-sizing: border-box;
    }

    /* Make the stats container spread its content (timer/score) */
    .stats-container {
        margin: 3px 0 !important;
        gap: 3px !important;
    }


    /* Ensure countries-left is still full width */
    .countries-left {
        width: 100% !important;
        margin: 5px auto !important;
        box-sizing: border-box;
        /* Add box-sizing here too */
        /* Retain other styles like padding, background etc. */
    }

    .timer,
    .score,
    .countries-left,
    .guess-accuracy {
        font-size: 14px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}

/* Country Info Panel Styles - Enhanced Glassmorphism */

.flag-container {
    text-align: center;
    margin-bottom: 20px;
    /* Enhanced Glassmorphism Effect - matching main menu exactly */
    background: rgba(30, 30, 30, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

    border-radius: 12px;
    padding: 6px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.flag-container:hover {
    background: rgba(30, 30, 30, 0.35);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    transform: translateY(-2px);
}

.flag-container h3 {
    font-size: 1.8em;
    margin: 10px 0;
    color: #6ea6ff;
    position: relative;
    z-index: 2;
}

.country-flag {
    max-width: 200px;
    max-height: 120px;
    border: 2px solid #444;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Smaller flag for horizontal layout */
.country-flag-small {
    width: 60px !important;
    height: auto !important;
    border: 1px solid #444 !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    max-height: 40px !important;
}

/* Larger flag for better visual balance */
.country-flag-large {
    width: 80px !important;
    height: auto !important;
    border: 2px solid #444 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    max-height: 55px !important;
}

.fact-group {
    margin-bottom: 20px;
    background-color: rgba(50, 50, 50, 0.3);
    padding: 15px;
    border-radius: 8px;
}

.fact-group h4 {
    color: #6ea6ff;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
}

.fact-group p {
    margin: 8px 0;
    line-height: 1.5;
}

.fact-group strong {
    color: #aaa;
}

/* Mobile styles */
@media (max-width: 768px) {
    .flag-container h3 {
        font-size: 1.5em;
    }

    .country-flag {
        max-width: 150px;
    }

    .fact-group {
        padding: 8px !important;
        margin-bottom: 10px !important;
    }
}

/* Country Info Panel Styles - Enhanced Glassmorphism */

.flag-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    /* Enhanced Glassmorphism Effect */
    background: rgba(50, 50, 50, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Glassmorphism shine effect for flag header */
.flag-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.5s;
    pointer-events: none;
    z-index: 1;
}

.flag-header:hover::before {
    left: 100%;
}

.flag-header:hover {
    background: rgba(50, 50, 50, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: translateY(-2px);
}

.country-flag {
    max-width: 200px;
    max-height: 120px;
    border: 2px solid #444;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.flag-header h2 {
    font-size: 1.8em;
    margin: 10px 0 5px;
    color: #6ea6ff;
    position: relative;
    z-index: 2;
}

.official-name {
    font-style: italic;
    color: #aaa;
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
    margin-bottom: 15px;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.fact-group {
    /* Enhanced Glassmorphism Effect */
    background: rgba(50, 50, 50, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 16px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Glassmorphism shine effect for fact groups */
.fact-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transition: left 0.5s;
    pointer-events: none;
    z-index: 1;
}

.fact-group:hover::before {
    left: 100%;
}

.fact-group:hover {
    background: rgba(50, 50, 50, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.fact-group h3 {
    color: #6ea6ff;
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #444;
    position: relative;
    z-index: 2;
}

.fact-group p {
    margin: 10px 0;
    line-height: 1.5;
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
    position: relative;
    z-index: 2;
}

.fact-group strong {
    color: #aaa;
    min-width: 120px;
    display: inline-block;
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    position: relative;
    z-index: 2;
}

.loading,
.error {
    text-align: center;
    padding: 20px;
    color: #aaa;
}

/* Hide game options from grid - now handled by cog icon */
#open-options {
    display: none !important;
}

/* Enhanced Mobile Detection and Layout */
/* Force mobile layout for ALL mobile devices - target both html and body */

/* IMMEDIATE Mobile Layout - Apply immediately without waiting for JavaScript */
.mobile-layout-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
}

.mobile-stats-container {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
}

.mobile-row {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
}


/* Simplified mobile layout - consolidated selectors */

/* Allow mobile facts panel to work on mobile viewport - removed aggressive hiding */

/* Force mobile layout for ALL mobile devices - target both html and body */
html[data-viewport="mobile"] .mobile-layout-container,
html.mobile-viewport .mobile-layout-container,
body.mobile-device .mobile-layout-container {
    display: flex !important;
    width: 100% !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
    align-items: flex-start !important;
    flex-direction: row !important;
}

html[data-device-type="android-mobile"] .mobile-row,
html[data-device-type="android-tablet"] .mobile-row,
html[data-device-type="iphone"] .mobile-row,
html[data-device-type="ipad"] .mobile-row,
html[data-device-type="ios-mobile"] .mobile-row,
html.android-mobile .mobile-row,
html.iphone .mobile-row,
html.ipad .mobile-row,
html.ios-mobile .mobile-row,
body[data-device-type="android-mobile"] .mobile-row,
body[data-device-type="android-tablet"] .mobile-row,
body[data-device-type="iphone"] .mobile-row,
body[data-device-type="ipad"] .mobile-row,
body[data-device-type="ios-mobile"] .mobile-row,
body.mobile-device .mobile-row {
    display: flex !important;
}

html[data-viewport="mobile"] .desktop-layout,
html.mobile-viewport .desktop-layout,
body.mobile-device .desktop-layout {
    display: none !important;
}

/* Allow mobile facts panel to work on mobile devices - removed aggressive hiding */

/* Show mobile stats on mobile devices */
html[data-viewport="mobile"] .mobile-stats-container,
html.mobile-viewport .mobile-stats-container,
body.mobile-device .mobile-stats-container {
    display: flex !important;
}

/* AGGRESSIVE Mobile Layout - Force mobile layout for small screens */
@media (max-width: 768px) {

    /* Force mobile layout containers to be visible */
    .mobile-layout-container {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }

    .mobile-stats-container {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }

    .mobile-row {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
    }

    /* Hide desktop layout on small screens */
    .desktop-layout {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        top: -9999px !important;
    }


    .country-flag {
        max-width: 150px;
    }

    .flag-header h2 {
        font-size: 1.5em;
    }

    .facts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .fact-group {
        padding: 12px;
    }
}

/* Facts Panel Layout */
.country-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 1px !important;
    margin-bottom: 20px !important;
    padding: 6px 0 !important;
}

.country-flag {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border: 1px solid #444;
    border-radius: 4px;
}

.compact-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 15px;
}

.fact-card {
    display: flex;
    gap: 12px;
    background: rgba(50, 50, 50, 0.25);
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 0 6px 6px 0;
    transition: transform 0.2s;
}

.fact-card:hover {
    transform: translateY(-2px);
    background: rgba(50, 50, 50, 0.3);
}

.fact-icon {
    float: left;
    margin-right: 12px;
    font-size: 1.2em;
    opacity: 0.8;
}

.fact-content {
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.fact-title {
    font-size: 0.85em;
    color: #6ea6ff;
    margin-bottom: 4px;
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
}

.fact-value {
    font-size: 0.9em;
    line-height: 1.5;
    color: #ddd;
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
}

/* Simple Loading States */
.loading-fact {
    background: rgba(50, 50, 50, 0.3);
    height: 40px;
    border-radius: 8px;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

/* Staggered loading animation */
.loading-fact:nth-child(1) {
    animation-delay: 0s;
}

.loading-fact:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-fact:nth-child(3) {
    animation-delay: 0.4s;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .compact-facts {
        grid-template-columns: 1fr;
    }

    .country-header {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 10px !important;
        margin-bottom: 16px !important;
        padding: 4px 0 !important;
    }

    .country-header h2 {
        font-size: 20px !important;
    }

    .country-flag-large {
        width: 65px !important;
        max-height: 45px !important;
    }

    .country-facts-scroll {
        max-height: calc(100vh - 160px);
        padding-bottom: 60px;
        margin-bottom: 20px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        /* Mobile: Show scrollbars */
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }

    .flag-container {
        padding: 6px;
        border-radius: 12px;
        margin-bottom: 16px;
        text-align: center;
    }
}

/* Fun Facts Styling */
.country-header {
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

/* Country Comparison Slide Out Animations */
.country-option.slide-out-left {
    animation: slideOutLeft 0.5s forwards;
}

.country-option.slide-out-right {
    animation: slideOutRight 0.5s forwards;
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(-150%);
        /* Move far left */
        opacity: 0;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(150%);
        /* Move far right */
        opacity: 0;
    }
}

.country-quote {
    font-style: italic;
    color: #aaa;
    margin-top: 10px;
    font-size: 0.95em;
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
}

.fun-facts {
    display: grid;
    gap: 18px;
}

.fact-card {
    /* Enhanced Glassmorphism Effect - matching main menu */
    background: rgba(50, 50, 50, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);

    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid #6ea6ff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.fact-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    transition: left 0.5s;
    z-index: 1;
}

.fact-card:hover::before {
    left: 100%;
}

.fact-card:hover {
    transform: translateY(-5px);
    background: rgba(50, 50, 50, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

.fact-icon {
    font-size: 1.8em;
    float: left;
    margin-right: 15px;
    margin-top: 3px;
}

.fact-content h3 {
    margin: 0 0 8px 0;
    color: #6ea6ff;
    font-size: 1.1em;
}

.fact-content p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.95em;
}

/* Mobile */
@media (max-width: 768px) {
    .fact-card {
        padding: 12px;
    }

    .fact-icon {
        font-size: 1.5em;
        margin-right: 12px;
    }
}

/* Mobile-specific styles (e.g., screens less than 768px wide) */
@media (max-width: 768px) {
    .game-info {
        margin: 0 !important;
        /* Override existing top position */
    }

    h2 {
        font-size: 3rem !important;
        /* Increase font size */
        font-weight: 800 !important;
        /* Extra bold */
        font-family: 'Lexend', sans-serif !important;
    }
}

.shooting-star {
    stroke: white;
    stroke-width: 1px;
    filter: blur(1px);
    stroke-dasharray: 5, 5;
    animation: shooting-star-glow 1s infinite alternate;
}

@keyframes shooting-star-glow {
    0% {
        filter: blur(1px) brightness(1);
    }

    100% {
        filter: blur(2px) brightness(1.5);
    }
}

.shooting-star-core {
    stroke: white;
    stroke-width: 2px;
    filter: url(#glow);
    stroke-linecap: round;
}

.shooting-star-tail {
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 4px;
    filter: url(#blur);
    stroke-linecap: round;
}

/* Add these SVG filters to your defs */
#glow {
    filter: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='glow'%3E%3CfeGaussianBlur stdDeviation='1' result='blur'/%3E%3CfeComposite in='SourceGraphic' in2='blur' operator='over'/%3E%3C/filter%3E%3C/svg%3E#glow");
}

.guess-accuracy {
    display: inline-block;
    /* Enhanced Glassmorphism Effect */
    background: rgba(50, 50, 50, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
    padding: 8px 16px;
    border-radius: 16px;
    margin: 0 5px;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.guess-accuracy:hover {
    background: rgba(50, 50, 50, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: translateY(-1px);
}

/* Mobile Layout Styles */
@media (max-width: 768px) {

    /* Hide desktop layout on mobile */
    .desktop-layout {
        display: none !important;
    }

    /* Show mobile layout */
    .mobile-row {
        display: flex;
        width: 100%;
        margin-bottom: 8px;
        gap: 8px;
        align-items: center;
    }

    /* Mobile Layout: Flag on left, stats on right - Show by default */
    .game-info .mobile-layout-container {
        display: flex !important;
        width: 100% !important;
        gap: 12px !important;
        margin-bottom: 12px !important;
        align-items: flex-start !important;
        flex-direction: row !important;
    }

    /* Show flag layout in flag mode */
    .game-info.flag-mode .mobile-layout-container {
        display: flex !important;
    }

    .game-info .mobile-flag-container {
        flex: 0 0 auto !important;
        width: 140px !important;
        /* 120px * 0.75 = 90px */
        height: 94px !important;
        /* 105px * 0.75 = 78.75px */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 2px !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border-radius: 6px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }

    .game-info .mobile-flag-container #flag-prompt {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: center !important;
        background: none !important;
        border: none !important;
        border-radius: 0 !important;
    }

    /* Override hidden class for mobile flag-prompt */
    .game-info .mobile-flag-container #flag-prompt.hidden {
        display: flex !important;
    }

    /* Ensure flag-prompt is visible in flag mode */
    .game-info.flag-mode .mobile-flag-container #flag-prompt {
        display: flex !important;
    }

    /* Daily Challenge Mode: Restore original mobile layout */
    .game-info.daily-mode .mobile-layout-container {
        display: none !important;
        /* Hide the mobile layout container in daily challenge */
    }

    .game-info.daily-mode .mobile-row {
        display: none !important;
        /* Hide all mobile rows in daily challenge */
    }

    .game-info.daily-mode .desktop-layout {
        display: flex !important;
        /* Show desktop layout in daily challenge */
    }

    /* Daily Challenge Mode: Restore original font sizes and padding */
    .game-info.daily-mode .timer,
    .game-info.daily-mode .score,
    .game-info.daily-mode .guess-accuracy,
    .game-info.daily-mode .countries-left {
        font-size: 14px !important;
        /* Restore original font size */
        padding: 8px 12px !important;
        /* Restore original padding */
        border-radius: 20px !important;
        /* Restore original border radius */
    }

    .game-info .mobile-flag-container #flag-prompt img {
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        border-radius: 4px !important;
        display: block !important;
        transition: opacity 0.2s ease-in-out !important;
        margin: 0 !important;
        border: 1px solid white !important;
    }

    .game-info .mobile-stats-container {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 3.375px !important;
        /* 4.5px * 0.75 = 3.375px */
        min-width: 0 !important;
    }

    .game-info .mobile-stats-container .timer,
    .game-info .mobile-stats-container .score,
    .game-info .mobile-stats-container .guess-accuracy {
        background-color: rgba(30, 30, 30, 0.9) !important;
        color: white !important;
        padding: 4.5px 6.75px !important;
        /* 6px * 0.75 = 4.5px, 9px * 0.75 = 6.75px */
        border-radius: 11.25px !important;
        /* 15px * 0.75 = 11.25px */
        font-size: 12px !important;
        /* Match hint font-size */
        font-weight: 500 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        text-align: center !important;
        white-space: nowrap !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Countries-left within mobile-stats-container - match hint font-size */
    .game-info .mobile-stats-container .countries-left {
        background-color: rgba(30, 30, 30, 0.9) !important;
        color: white !important;
        padding: 4.5px 6.75px !important;
        /* 6px * 0.75 = 4.5px, 9px * 0.75 = 6.75px */
        border-radius: 11.25px !important;
        /* 15px * 0.75 = 11.25px */
        font-size: 12px !important;
        /* Match hint font-size */
        font-weight: 500 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        text-align: center !important;
        white-space: nowrap !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Row 1: Time, Score, Accuracy in one row - Show for non-flag modes */
    .mobile-row-1 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 8px;
        margin-bottom: 8px;
    }

    /* Show single row layout in flag mode too */
    .game-info.flag-mode .mobile-row-1 {
        display: flex !important;
    }

    /* Make each stat element take equal space in mobile row */
    .mobile-row-1 .timer,
    .mobile-row-1 .score,
    .mobile-row-1 .guess-accuracy {
        flex: 1;
        text-align: center;
        margin: 0;
        background-color: rgba(30, 30, 30, 0.9) !important;
        color: white !important;
        padding: 8px 12px !important;
        border-radius: 20px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Row 2: Countries Left at half height */
    .mobile-row-2 {
        justify-content: center;
        height: 15px;
        /* Even smaller height */
        padding-top: 12px;
        margin: 12px 0 8px 0;
        /* More top margin, less bottom margin */
    }

    .mobile-row-2 .countries-left {
        background-color: rgba(30, 30, 30, 0.9);
        color: white;
        padding: 2px 8px;
        /* Even more reduced padding */
        border-radius: 15px;
        /* Smaller border radius */
        font-size: 10px;
        /* Even smaller font */
        font-weight: 500;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
        white-space: nowrap;
        line-height: 1.2;
        /* Tighter line height */
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Row 3: Next, Hints, Exit */
    .mobile-row-3 {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        padding-top: 2px;
        margin: 0;
        /* Remove top and bottom margin */
    }

    .mobile-row-3 button {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        color: #ffffff;
        padding: 8px 16px;
        font-size: 14px;
        font-weight: 500;
        font-family: 'Lexend', sans-serif;
        border-radius: 20px;
        transition: all 0.3s ease;
        flex: 0 0 auto;
        width: auto;
        min-width: auto;
    }

    /* Specific styling for mobile buttons */
    #mobile-next-country {
        background: rgba(76, 175, 80, 0.3);
        border: 1px solid rgba(76, 175, 80, 0.5);
        display: inline-block;
    }

    #mobile-reset-game {
        background: rgba(244, 67, 54, 0.3);
        border: 1px solid rgba(244, 67, 54, 0.5);
        display: inline-block;
    }

    .mobile-row-3 .hint {
        flex: 1;
        font-size: 12px;
        text-align: center;
        padding: 0 8px;
        color: rgba(255, 255, 255, 0.8);
        display: block;
        visibility: visible;
    }

    /* Ensure mobile elements are visible and clickable */
    #mobile-next-country,
    #mobile-reset-game {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        cursor: pointer !important;
    }

    /* Handle disabled state for mobile next button */
    #mobile-next-country:disabled {
        opacity: 0.6 !important;
        cursor: not-allowed !important;
        pointer-events: none !important;
        /* Prevent clicks when disabled */
    }

    /* Hover effects for mobile buttons */
    #mobile-next-country:hover:not(:disabled) {
        background: rgba(76, 175, 80, 0.5) !important;
        border-color: rgba(76, 175, 80, 0.7) !important;
    }

    #mobile-reset-game:hover {
        background: rgba(244, 67, 54, 0.5) !important;
        border-color: rgba(244, 67, 54, 0.7) !important;
    }

    #mobile-neighbors-hint {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Desktop Layout Styles */
@media (min-width: 769px) {

    /* Hide mobile layout on desktop - BUT allow mobile devices to override */
    .mobile-row:not(.mobile-active) {
        display: none !important;
    }

    .mobile-layout-container:not(.mobile-active) {
        display: none !important;
    }

    /* Simplified mobile layout - consolidated selectors */

    /* Show mobile layout on desktop when in flag mode */
    .game-info.flag-mode .mobile-layout-container {
        display: flex !important;
        width: 100% !important;
        gap: 20px !important;

        align-items: center !important;
        justify-content: center !important;
        flex-direction: row !important;
    }

    /* Hide mobile stats container on desktop when in flag mode */
    .game-info.flag-mode .mobile-stats-container {
        display: none !important;
    }

    /* Increase flag size significantly on desktop flag mode */
    @media (min-width: 769px) {
        .game-info.flag-mode .mobile-flag-container {
            width: 220px !important;
            height: 170px !important;
            padding: 3px !important;
        }

        /* Ensure flag image scales properly in desktop flag mode */
        .game-info.flag-mode .mobile-flag-container #flag-prompt img {
            max-width: calc(100% - 2px) !important;
            max-height: calc(100% - 2px) !important;
            width: calc(100% - 2px) !important;
            height: calc(100% - 2px) !important;
            object-fit: contain !important;
            transition: opacity 0.2s ease-in-out !important;
        }

        /* Override the base flag-prompt img max-width for desktop flag mode */
        .game-info.flag-mode #flag-prompt img {
            max-width: calc(100% - 2px) !important;
            max-height: calc(100% - 2px) !important;
            transition: opacity 0.2s ease-in-out !important;
        }

        /* Override the base flag-prompt width for desktop flag mode */
        .game-info.flag-mode #flag-prompt {
            width: 100% !important;
            height: 100% !important;
            margin: 0 !important;
            padding: 0 !important;
            box-sizing: border-box !important;
        }
    }

    /* Show desktop layout */
    .desktop-layout {
        display: block;
        margin: 0px;
    }
}

/* Remove the existing timer and score styles */
.game-info .timer,
.game-info .score,
.game-info .countries-left {
    display: inline;
    justify-content: unset;
    margin: 0;
}

/* Update the countries-left style for responsive widths - Enhanced Glassmorphism */
.countries-left {
    position: relative;
    overflow: hidden;
    text-align: center;
    display: inline-block;
    /* Enhanced Glassmorphism Effect */
    background: rgba(50, 50, 50, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    margin: 0 5px;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 500;
}

/* Desktop: Make countries-left/accuracy span full available width to panel padding */
@media (min-width: 769px) {
    .countries-left-container {
        display: flex;
        flex-direction: column;
        /* stack vertically like in screenshot */
        width: 100%;
    }

    /* Make stats container match the width of other rows */
    .stats-container {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }

    /* Make timer and score elements take equal space to fill the row */
    .stats-container .timer,
    .stats-container .score {
        flex: 1;
        text-align: center;
    }

    .countries-left,
    .guess-accuracy {
        width: 100% !important;
        /* reach right padding edge */
        flex: 0 0 100% !important;
        display: block;
        margin: 0;
        /* no side margins so it spans fully */
        box-sizing: border-box;
        /* include padding/border in width */
        /* Keep styling consistent */
        background: rgba(50, 50, 50, 0.3);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        text-align: center;
        white-space: nowrap;
    }

    /* Strong override to beat generic inline styles elsewhere */
    .game-info .countries-left,
    .game-info .guess-accuracy {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.countries-left:hover {
    background: rgba(50, 50, 50, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: translateY(-1px);
}

/* The progress bar using ::before */
.countries-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--progress-width, 0%);
    background-color: #4CAF50;
    border-radius: 20px;
    z-index: -1;
    transition: width 0.5s ease-in-out;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .countries-left {
        padding: 6px 12px;
        flex: 1 1 auto;
        min-width: calc(50% - 16px);
    }
}

/* Streak popup */
.streak-popup {
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(0.9) translateZ(0);
    will-change: transform, opacity;
    contain: content;
    background: rgba(20, 20, 20, 0.9);
    border: 3px solid rgba(255, 215, 0, 0.9);
    color: #ffd700;
    font-weight: 900;
    padding: 25px 40px;
    border-radius: 25px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    font-size: 28px;
    letter-spacing: 1px;
    max-width: 500px;
    min-width: 300px;
    text-align: center;
    word-wrap: break-word;
    white-space: normal;
}

/* Correction Opportunity UI */
.correction-opportunity {
    background: rgba(255, 193, 7, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 10px;
    /* smaller */
    padding: 10px;
    /* half padding */
    margin: 10px 0;
    /* slightly smaller margin */
    text-align: center;
    animation: correctionSlideIn 0.5s ease-out;
    font-size: 0.1em;
    /* scale down inner typography roughly by half */
    will-change: transform, opacity;
    contain: content;
}

.correction-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 8px;
}

.correction-icon {
    font-size: 1em;
    /* ~half size target in correction opportunity header */
    animation: correctionPulse 2s infinite;
}

.correction-title {
    font-size: 1em;
    /* Smaller title */
    font-weight: 600;
    color: #ffc107;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.correction-message {
    font-size: 1em;
    /* Smaller body */
    color: #ffffff;
    margin-bottom: 12px;
    /* tighter spacing */
    line-height: 1.4;
}

.correction-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Make correction buttons match in-game buttons */
.correction-btn {
    background: rgba(26, 115, 232, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(26, 115, 232, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: #ffffff;
    padding: 12px 20px;
    /* match Next Country button vertical size more closely */
    font-size: 16px;
    /* slightly smaller to equalize visual height */
    line-height: 1;
    /* compact like Next Country */
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    letter-spacing: 0.1px;
    text-transform: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 0;
    /* allow natural width like Next Country */
    white-space: nowrap;
    /* keep on one line like Next Country */
}

.correction-btn.accept {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.correction-btn.accept:hover {
    background: rgba(76, 175, 80, 0.5);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    transform: translateY(-2px);
}

.correction-btn.skip {
    background: rgba(244, 67, 54, 0.3);
    color: #ffffff;
    border: 1px solid rgba(244, 67, 54, 0.5);
}

.correction-btn.skip:hover {
    background: rgba(108, 117, 125, 0.5);
    transform: translateY(-1px);
}

/* Correction Mode Display */
.correction-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid rgba(255, 193, 7, 0.6);
    border-radius: 15px;
    animation: correctionModeGlow 2s infinite alternate;
    max-width: 100%;
}


/* Daily Challenge Input Styles - Desktop only, Mobile overrides handled in part1.css */
@media (min-width: 769px) {
    .daily-challenge-input {
        width: 100%;
        position: relative;
        /* anchor suggestions */
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        z-index: 1000;
        /* Ensure input section is above guesses */
    }
}

/* Daily challenge title - Desktop only, Mobile overrides handled in part1.css */
@media (min-width: 769px) {
    #daily-challenge-title {
        font-weight: 700;
        font-size: 1.2rem;
        opacity: .9;
        text-align: left;
    }
}

#country-guess-input {
    width: 100%;
    z-index: 1001;
    /* Ensure input is above suggestions */
    position: relative;
    padding: 12px 16px;
    font-size: 1.1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#country-guess-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#submit-guess {
    width: 100%;
    z-index: 1001;
    /* Ensure button is above suggestions */
    position: relative;
    padding: 12px 16px;
    font-size: 1.1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(76, 175, 80, 0.3);
    color: white;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

#submit-guess:hover {
    background: rgba(76, 175, 80, 0.5);
}

#submit-guess:active {
    transform: scale(0.98);
}

#submit-guess:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Daily guesses container */
.daily-guesses {
    max-height: 50vh;
    /* Increased from 30vh to allow more content */
    z-index: 1;
    /* Keep this low to ensure suggestions appear above */
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 8px;
    margin-top: 8px;
    position: relative;
    /* Ensure it creates its own stacking context */
}

/* Guess row styling */
.daily-guesses .guess-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.daily-guesses .guess-row.correct {
    border-left-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.daily-guesses .guess-row.incorrect {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Guess row elements */
.daily-guesses .guess-row .num {
    min-width: 20px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

.daily-guesses .guess-row .flag {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.daily-guesses .guess-row .name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.daily-guesses .guess-row .distance {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Fix z-index for country suggestions */
#country-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 10000;
    /* Increased from 5000 to ensure it sits on top of guesses */
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    max-height: 50vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    pointer-events: auto;
    /* Prevent the suggestion layer from being blocked by other elements */
    transform: translateZ(0);
    /* Add a small shadow to make it stand out */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    /* Ensure it's positioned correctly on all devices */
    box-sizing: border-box;
    /* Improve scrolling performance */
    -webkit-overflow-scrolling: touch;
}

.country-suggestions.hidden {
    display: none !important;
}

/* Suggestion rows (fix class mismatch: country-suggestion) */
#country-suggestions .country-suggestion {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    transition: background-color 0.1s ease;
    /* Faster transition for better responsiveness */
    /* Ensure proper text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Improve click/touch targets */
    min-height: 44px;
    /* Minimum touch target size */
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    border: none;
    background: transparent;
    color: white;
}

#country-suggestions .country-suggestion:hover,
#country-suggestions .country-suggestion.selected {
    background: rgba(255, 255, 255, 0.15);
    /* Add slight scale effect for better feedback */
    transform: scale(1.02);
    transition: all 0.1s ease;
}

#country-suggestions .country-suggestion:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.98);
}

.country-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    margin-top: 5px;
    box-sizing: border-box;
}

.country-suggestion {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.2s ease;
}

.country-suggestion:hover,
.country-suggestion.selected {
    background: rgba(74, 144, 226, 0.3);
}

.country-suggestion:last-child {
    border-bottom: none;
}

.submit-guess {
    padding: 12px 20px;
    border-radius: 20px;
    border: none;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Lexend', sans-serif;
}

.submit-guess:hover {
    background: linear-gradient(135deg, #357abd, #2c6aa0);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.submit-guess:active {
    transform: translateY(0);
}

.submit-guess:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Distance display */
.distance-display {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 12px;
    margin: 10px 0;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
}

.distance-display.close {
    background: rgba(255, 165, 0, 0.3);
    border-color: rgba(255, 165, 0, 0.5);
    color: #ffa500;
}

.distance-display.correct {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.5);
}

.distance-display.incorrect {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.5);
}

/* Player guess display */
.player-guess-display {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 12px;
    margin: 10px 0;
    text-align: center;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}

.player-guess-display.with-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.player-guess-display.correct {
    background: rgba(46, 204, 113, 0.3);
    border-color: rgba(46, 204, 113, 0.5);
}

.player-guess-display.incorrect {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.5);
}

.player-guess-display.close {
    background: rgba(255, 165, 0, 0.3);
    border-color: rgba(255, 165, 0, 0.5);
}

.player-guess-display .country-flag {
    width: 30px;
    height: 20px;
    border-radius: 3px;
}

.player-guess-display .correct-message {
    font-size: 18px;
    font-weight: 600;
    margin-top: 5px;
    color: #2ecc71;
}

.correction-target-icon {
    font-size: 0.9em;
    /* half-ish size for target icon */
    animation: correctionPulse 1.5s infinite;
}

.correction-mode-text {
    font-size: 1.1em;
    font-weight: 600;
    color: #ffc107;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

/* Correction Country Highlight */
.correction-highlight {
    fill: #ffc107 !important;
    stroke: #ff6b35 !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.8));
    animation: correctionCountryPulse 2s infinite;
}

/* Correction Result Popup */
.correction-result {
    position: fixed;
    left: 50%;
    top: 30%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    z-index: 3000;
    animation: correctionResultPop 0.6s ease-out;
}

.correction-result.success {
    border: 3px solid rgba(76, 175, 80, 0.8);
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
}

.correction-result.failure {
    border: 3px solid rgba(244, 67, 54, 0.8);
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}

.correction-result-icon {
    font-size: 3em;
    margin-bottom: 15px;
    animation: correctionResultBounce 0.8s ease-out;
}

.correction-result-text {
    font-size: 1.5em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #ffffff;
}

.correction-result-points {
    font-size: 1.2em;
    font-weight: 500;
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

/* Animations */
@keyframes correctionSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes correctionPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes correctionModeGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
    }

    100% {
        box-shadow: 0 0 30px rgba(255, 193, 7, 0.6);
    }
}

@keyframes correctionCountryPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.8));
    }

    50% {
        filter: drop-shadow(0 0 20px rgba(255, 193, 7, 1));
    }
}

@keyframes correctionResultPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes correctionResultBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.streak-popup.show {
    animation: streakPop 2500ms ease-out forwards;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
}

@keyframes streakPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotate(-5deg);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15) rotate(2deg);
    }

    20% {
        transform: translate(-50%, -50%) scale(1.05) rotate(-1deg);
    }

    30% {
        transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
    }

    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.0) rotate(0deg);
    }

    85% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.98) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.95) rotate(1deg);
    }
}

/* Streak 5+ Effects - Rainbow and Sparkles */
.streak-popup.streak-5 {
    animation: streakPop 2500ms ease-out forwards, rainbowText 2s ease-in-out infinite;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
}

@keyframes rainbowText {
    0% {
        color: #ff0000;
    }

    16% {
        color: #ff8000;
    }

    33% {
        color: #ffff00;
    }

    50% {
        color: #00ff00;
    }

    66% {
        color: #0080ff;
    }

    83% {
        color: #8000ff;
    }

    100% {
        color: #ff0000;
    }
}

.streak-popup.streak-5::before {
    content: "âœ¨";
    position: absolute;
    top: -20px;
    left: 20px;
    animation: none;
    font-size: 20px;
}

.streak-popup.streak-5::after {
    content: "âœ¨";
    position: absolute;
    top: -20px;
    right: 20px;
    animation: none;
    font-size: 20px;
}

@keyframes sparkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
}

/* Streak 6+ Effects - Fireworks */
.streak-popup.streak-6 {
    animation: streakPop 2500ms ease-out forwards, rainbowText 2s ease-in-out infinite;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
    overflow: visible;
}

.streak-popup.streak-6::before {
    content: "ðŸŽ†";
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    animation: none;
    font-size: 30px;
    z-index: 10;
}

.streak-popup.streak-6::after {
    content: "ðŸŽ†";
    position: absolute;
    top: -30px;
    left: 30%;
    transform: translateX(-50%);
    animation: none;
    font-size: 25px;
    z-index: 10;
}

@keyframes firework {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }

    40% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    60% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
}

/* Streak 10+ Effects - Airplanes */
.streak-popup.streak-10 {
    animation: streakPop 2500ms ease-out forwards, rainbowText 2s ease-in-out infinite;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
    overflow: visible;
}

.streak-popup.streak-10::before {
    content: "âœˆï¸";
    position: absolute;
    top: -40px;
    left: -50px;
    animation: none;
    font-size: 25px;
    z-index: 10;
}

.streak-popup.streak-10::after {
    content: "âœˆï¸";
    position: absolute;
    top: -40px;
    right: -50px;
    animation: none;
    font-size: 25px;
    z-index: 10;
}

@keyframes airplane {
    0% {
        transform: translateX(-100px) translateY(0px) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateX(100px) translateY(-20px) rotate(5deg);
        opacity: 0;
    }
}

/* Streak 13+ Effects - Particle Explosions */
.streak-popup.streak-13 {
    animation: streakPop 2500ms ease-out forwards, rainbowText 2s ease-in-out infinite, particleExplosion 2s ease-out;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
    overflow: visible;
}

@keyframes particleExplosion {
    0% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }

    50% {
        box-shadow: 0 0 60px rgba(255, 165, 0, 0.8), 0 0 100px rgba(255, 100, 0, 0.6);
    }

    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

.streak-popup.streak-13::before {
    content: "ðŸ’¥";
    position: absolute;
    top: -50px;
    left: 20px;
    animation: none;
    font-size: 35px;
    z-index: 10;
}

.streak-popup.streak-13::after {
    content: "ðŸ’¥";
    position: absolute;
    top: -50px;
    right: 20px;
    animation: none;
    font-size: 35px;
    z-index: 10;
}

@keyframes explosion {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }

    30% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }

    60% {
        opacity: 0.8;
        transform: scale(1.2) rotate(360deg);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) rotate(540deg);
    }
}

/* Streak 15+ Effects - Cosmic */
.streak-popup.streak-15 {
    animation: streakPop 2500ms ease-out forwards, rainbowText 2s ease-in-out infinite, cosmicGlow 3s ease-in-out infinite;
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%) scale(1.0);
    overflow: visible;
}

@keyframes cosmicGlow {
    0% {
        box-shadow:
            0 0 30px rgba(255, 215, 0, 0.6),
            0 0 60px rgba(255, 165, 0, 0.4),
            0 0 100px rgba(100, 50, 255, 0.3);
    }

    50% {
        box-shadow:
            0 0 50px rgba(255, 215, 0, 0.8),
            0 0 100px rgba(255, 165, 0, 0.6),
            0 0 150px rgba(100, 50, 255, 0.5),
            0 0 200px rgba(255, 100, 255, 0.3);
    }

    100% {
        box-shadow:
            0 0 30px rgba(255, 215, 0, 0.6),
            0 0 60px rgba(255, 165, 0, 0.4),
            0 0 100px rgba(100, 50, 255, 0.3);
    }
}

.streak-popup.streak-15::before {
    content: "ðŸŒŸ";
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    animation: none;
    font-size: 40px;
    z-index: 10;
}

.streak-popup.streak-15::after {
    content: "ðŸš€";
    position: absolute;
    top: -60px;
    left: 30%;
    transform: translateX(-50%);
    animation: none;
    font-size: 35px;
    z-index: 10;
}

@keyframes starBurst {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5) rotate(0deg);
    }

    25% {
        opacity: 1;
        transform: translateX(-50%) scale(1.3) rotate(90deg);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) scale(1) rotate(180deg);
    }

    75% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.2) rotate(270deg);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8) rotate(360deg);
    }
}

@keyframes rocket {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0px) rotate(0deg);
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-100px) rotate(10deg);
    }
}

/* Streak Loss Popup */
.streak-loss-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(1.0);
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.25), rgba(255, 69, 0, 0.2));
    border: 3px solid rgba(220, 20, 60, 0.9);
    color: #ff6b6b;
    font-weight: 900;
    padding: 20px 35px;
    border-radius: 20px;
    font-size: 24px;
    text-align: center;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(220, 20, 60, 0.3);
    backdrop-filter: blur(10px);
    font-family: 'Alfa Slab One', cursive;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    min-width: 300px;
    word-wrap: break-word;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
}

.streak-loss-popup.show {
    animation: streakLossPop 4000ms ease-out forwards;
}

@keyframes streakLossPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8) rotate(5deg);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1) rotate(-2deg);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(1deg);
    }

    30% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05) rotate(0deg);
    }

    40% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }

    60% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
    }

    80% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.98) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -60%) scale(0.95) rotate(1deg);
    }
}

/* Streak Loss 5+ Effects - Sad Sparkles */
.streak-loss-popup.streak-loss-5 {
    animation: streakLossPop 4000ms ease-out forwards, sadGlow 2s ease-in-out infinite;
}

@keyframes sadGlow {
    0% {
        box-shadow: 0 8px 32px rgba(220, 20, 60, 0.3);
        border-color: rgba(220, 20, 60, 0.9);
    }

    50% {
        box-shadow: 0 8px 40px rgba(255, 69, 0, 0.4);
        border-color: rgba(255, 69, 0, 0.9);
    }

    100% {
        box-shadow: 0 8px 32px rgba(220, 20, 60, 0.3);
        border-color: rgba(220, 20, 60, 0.9);
    }
}

.streak-loss-popup.streak-loss-5::before {
    content: "ðŸ’”";
    position: absolute;
    top: -15px;
    left: 20px;
    animation: sadSparkle 2s ease-in-out infinite;
    font-size: 18px;
}

.streak-loss-popup.streak-loss-5::after {
    content: "ðŸ’”";
    position: absolute;
    top: -15px;
    right: 20px;
    animation: sadSparkle 2s ease-in-out infinite 0.5s;
    font-size: 18px;
}

@keyframes sadSparkle {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1.1) rotate(180deg);
    }
}

/* Streak Loss 10+ Effects - Broken Heart */
.streak-loss-popup.streak-loss-10 {
    animation: streakLossPop 4000ms ease-out forwards, brokenHeart 2s ease-in-out infinite;
    position: relative;
    overflow: visible;
}

@keyframes brokenHeart {
    0% {
        box-shadow: 0 8px 32px rgba(220, 20, 60, 0.3);
        border-color: rgba(220, 20, 60, 0.9);
    }

    50% {
        box-shadow: 0 8px 50px rgba(255, 20, 20, 0.5);
        border-color: rgba(255, 20, 20, 0.9);
    }

    100% {
        box-shadow: 0 8px 32px rgba(220, 20, 60, 0.3);
        border-color: rgba(220, 20, 60, 0.9);
    }
}

.streak-loss-popup.streak-loss-10::before {
    content: "ðŸ’”";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    animation: heartBreak 2s ease-out infinite;
    font-size: 25px;
    z-index: 10;
}

.streak-loss-popup.streak-loss-10::after {
    content: "ðŸ’”";
    position: absolute;
    top: -25px;
    left: 30%;
    transform: translateX(-50%);
    animation: heartBreak 2s ease-out infinite 0.3s;
    font-size: 20px;
    z-index: 10;
}

@keyframes heartBreak {
    0% {
        opacity: 0;
        transform: translateX(-50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translateX(-50%) scale(1.2);
    }

    40% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    60% {
        opacity: 0.8;
        transform: translateX(-50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) scale(0.8);
    }
}

/* Streak Loss 15+ Effects - Epic Fail */
.streak-loss-popup.streak-loss-15 {
    animation: streakLossPop 4000ms ease-out forwards, epicFail 3s ease-in-out infinite;
    position: relative;
    overflow: visible;
}

@keyframes epicFail {
    0% {
        box-shadow:
            0 8px 32px rgba(220, 20, 60, 0.3),
            0 0 20px rgba(255, 0, 0, 0.2);
    }

    50% {
        box-shadow:
            0 8px 50px rgba(255, 0, 0, 0.5),
            0 0 40px rgba(255, 100, 0, 0.3),
            0 0 60px rgba(255, 200, 0, 0.2);
    }

    100% {
        box-shadow:
            0 8px 32px rgba(220, 20, 60, 0.3),
            0 0 20px rgba(255, 0, 0, 0.2);
    }
}

.streak-loss-popup.streak-loss-15::before {
    content: "ðŸ’¥";
    position: absolute;
    top: -35px;
    left: 20px;
    animation: epicExplosion 2s ease-out infinite;
    font-size: 30px;
    z-index: 10;
}

.streak-loss-popup.streak-loss-15::after {
    content: "ðŸ’¥";
    position: absolute;
    top: -35px;
    right: 20px;
    animation: epicExplosion 2s ease-out infinite 0.7s;
    font-size: 30px;
    z-index: 10;
}

/* Mobile-specific positioning for streak loss popup */
@media (max-width: 768px) {
    .streak-loss-popup {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) scale(1.0) !important;
        max-width: 90vw !important;
        min-width: 280px !important;
        padding: 20px 25px !important;
        font-size: 22px !important;
        line-height: 1.3 !important;
        text-align: center !important;
    }
}

@keyframes epicExplosion {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(0deg);
    }

    30% {
        opacity: 1;
        transform: scale(1.5) rotate(180deg);
    }

    60% {
        opacity: 0.8;
        transform: scale(1.2) rotate(360deg);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) rotate(540deg);
    }
}

/* Mobile fullscreen mode styles */
.mobile-fullscreen {
    overflow: hidden !important;
}

/* Hide elements during mobile fullscreen for better immersion */
.mobile-fullscreen .start-screen,
.mobile-fullscreen .options-menu {
    height: 100vh;
    overflow: hidden;
}

/* Fullscreen mode adjustments for game elements */
body:-webkit-full-screen .game-info-container,
body:-moz-full-screen .game-info-container,
body:fullscreen .game-info-container {
    transform: scale(0.95);
    top: 25px;
    left: 25px;
}

body:-webkit-full-screen .right-panel,
body:-moz-full-screen .right-panel,
body:fullscreen .right-panel {
    font-size: 0.95em;
}

/* Ensure fullscreen icon is always visible in options menu */
.fullscreen-icon {
    display: inline-block;
    line-height: 1;
    font-style: normal;
}

/* === Buttons === */
button.secondary {
    background-color: var(--md-secondary);
    color: var(--md-on-secondary);
}

button.error {
    background-color: var(--md-error);
    color: white;
}

p {
    color: var(--md-on-surface);
    font-size: 1rem;
    /* 16px */
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
    margin: 0.75rem 0;
}

.game-info .button-group {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px !important;
    justify-content: center !important;
    width: 100% !important;
}

.country.hidden {
    display: none;
}

/* Game Options Styles */
.game-options {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.game-options h3 {
    margin: 0 0 15px 0;
    color: #ffcc00;
    font-size: 1.2em;
}

.unit-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.unit-selection label {
    color: white;
    font-size: 0.9em;
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
}

/* Unit selection styling moved to main unit-selection section above */

/* Add to styles.css */
.toggle-options {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.toggle-button {
    /* Glassmorphism Effect */
    background: rgba(60, 60, 60, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    color: white;
    padding: 16px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    min-width: 120px;
    font-size: 18px;
    /* Increased from 14px */
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    letter-spacing: 0.1px;
    text-transform: none;
    margin: 0;

    position: relative;
    overflow: hidden;
}

.toggle-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    background: rgba(80, 80, 80, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.toggle-button:active {
    transform: translateY(-1px);
}

.toggle-button.active {
    background: rgba(76, 175, 80, 0.4) !important;
    border-color: rgba(76, 175, 80, 0.6) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3) !important;
}

.toggle-button .icon {
    font-size: 1.2rem;
}



.voice-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.voice-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.voice-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Lexend', sans-serif;
    font-weight: 300;
    text-align: center;
}

.voice-selection label {
    color: white;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
}

.voice-dropdown {
    /* Glassmorphism Effect - matching main menu buttons */
    background: rgba(142, 109, 184, 0.3);
    /* Purple with transparency */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(142, 109, 184, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    color: white;
    border-radius: min(20px, 3vw);
    padding: min(16px, 2.5vw) min(20px, 3vw);
    font-size: clamp(12px, 2.2vw, 14px);
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: min(280px, 70vw);
    text-align: center;

    position: relative;
    overflow: hidden;
}

.voice-dropdown:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(142, 109, 184, 0.3);
    background: rgba(142, 109, 184, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.voice-dropdown:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(142, 109, 184, 0.4);
}

/* Style dropdown options for consistency */
.voice-dropdown option,
.unit-selection select option {
    background: rgba(30, 30, 30, 0.95);
    color: white !important;
    padding: 8px;
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
}

/* Ensure option styling works across browsers */
select option {
    background: rgba(30, 30, 30, 0.95) !important;
    color: white !important;
}

/* Ensure all options menu text is white */
.options-menu,
.options-content,
.voice-selection,
.unit-selection,
.compact-options,
.toggle-row {
    color: white !important;
}

.options-menu h2,
.options-menu label,
.options-menu span,
.voice-selection label,
.unit-selection label,
.voice-count,
.toggle-button span,
.toggle-button .icon,
.back-button span {
    color: white !important;
}

/* Ensure all text elements in options are white */
.options-menu *,
.options-content * {
    color: white !important;
}

.test-voice-btn {
    /* Glassmorphism Effect - matching main menu buttons */
    background: rgba(76, 175, 80, 0.3);
    /* Green with transparency */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(76, 175, 80, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    color: #ffffff;
    border-radius: min(20px, 3vw);
    padding: min(16px, 2.5vw);
    font-size: clamp(12px, 2.2vw, 14px);
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: 0.1px;
    text-transform: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: min(280px, 70vw);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: min(8px, 1vw);
    margin-top: min(8px, 1vw);

    position: relative;
    overflow: hidden;
}

.test-voice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.test-voice-btn:active {
    transform: translateY(-1px);
}

.test-voice-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.4);
}



.toggle-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.toggle-button.disabled:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    transform: none !important;
}

.mode-buttons button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.mode-buttons button.disabled:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}






/* Options Menu Styles */
.options-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    padding: 20px;
    box-sizing: border-box;
}

.options-menu:not(.hidden) {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Game Options title - plain text only */
.options-title {
    color: #ffffff;
    font-size: 1.5em !important;
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: 0.1px;
    text-transform: none;
    text-align: center;
    margin: 0 auto 16px auto;

    /* Make it non-interactive */
    cursor: default;
    pointer-events: none;
}



.options-content {
    /* Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);

    border-radius: min(28px, 3.5vw);
    padding: min(32px, 4vw);
    margin-bottom: min(16px, 2vw);

    /* Balanced sizing - works on desktop and mobile */
    width: min(400px, 85vw);
    max-height: 85vh;
    overflow-y: auto;

    text-align: center;

    /* Enhanced visual effects */
    position: relative;
    overflow-x: hidden;
}

/* Time Based Challenges Menu Styling */
.time-challenge-row {
    margin-bottom: min(16px, 2.5vw);
    width: 100%;
}

.time-challenge-button {
    /* Enhanced Glassmorphism Effect */
    background: rgba(50, 50, 50, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    border-radius: min(28px, 3.5vmin);
    padding: min(20px, 3vmin);
    margin: 0;
    width: 100%;
    max-width: min(400px, 85vw);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.time-challenge-button:hover {
    background: rgba(50, 50, 50, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.challenge-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    gap: 4px;
}

.challenge-title {
    color: white;
    font-family: 'Lexend', sans-serif;
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.challenge-desc {
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Lexend', sans-serif;
    font-size: clamp(12px, 2vw, 14px);
    font-weight: 400;
    margin: 0;
    line-height: 1.3;
}

.challenge-icon {
    font-size: clamp(24px, 4vw, 32px);
    margin-left: auto;
    opacity: 0.9;
    transition: transform 0.3s ease;
}

.time-challenge-button:hover .challenge-icon {
    transform: scale(1.1);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .time-challenge-button {
        padding: min(16px, 2.5vw);
    }

    .challenge-content {
        gap: 2px;
    }

    .challenge-title {
        font-size: clamp(14px, 3vw, 18px);
    }

    .challenge-desc {
        font-size: clamp(11px, 2.5vw, 13px);
    }

    .challenge-icon {
        font-size: clamp(20px, 5vw, 28px);
    }
}

/* iPhone SE specific optimizations */
@media (max-width: 480px) {
    .time-challenge-button {
        padding: min(14px, 2vw);
        border-radius: min(24px, 3vmin);
    }

    .challenge-title {
        font-size: 1.1em;
        letter-spacing: 0.02em;
    }

    .challenge-desc {
        font-size: 0.9em;
    }
}

/* Timer pulse animation for time-based challenges */
@keyframes timer-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Time-based challenge timer styling */
.timer.warning {
    color: #ff4444 !important;
    animation: timer-pulse 1s infinite;
    text-shadow: 0 0 5px rgba(255, 68, 68, 0.5);
}

.timer.critical {
    color: #ff0000 !important;
    animation: timer-pulse 0.5s infinite;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* Blitz mode time indicator bar */
.blitz-time-indicator {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    width: 100% !important;
    background: #4ade80 !important;
    background-color: #4ade80 !important;
    transition: width 1s linear, background-color 0.3s ease !important;
    z-index: 1 !important;
    border-radius: inherit !important;
    opacity: 0.9 !important;
    display: block !important;
}

.blitz-time-indicator.orange {
    background: #f59e0b !important;
    background-color: #f59e0b !important;
}

.blitz-time-indicator.red {
    background: #ef4444 !important;
    background-color: #ef4444 !important;
}

/* Blitz mode timer panel styling - covers entire panel */
.blitz-timer-active {
    background: linear-gradient(90deg, #4ade80 0%, #4ade80 100%) !important;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
    transition: background-size 1s linear, background 0.3s ease !important;
}

/* Ensure timer text is visible above the green background */
.blitz-timer-active .timer,
.blitz-timer-active #timer,
.blitz-timer-active #timer-mobile-stats,
.blitz-timer-active #timer-mobile-row {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8) !important;
    position: relative !important;
    z-index: 2 !important;
}

/* Country correct answer highlight for wrong guesses */
.correct-answer {
    fill: var(--correct-color) !important;
    stroke: #ffffff !important;
    stroke-width: 2px !important;
    opacity: 1 !important;
}

/* Remove mobile-specific overrides for options menu */
@media (max-width: 768px) {
    .options-content {
        /* Keep consistent proportional sizing */
        width: min(400px, 85vw);
        padding: min(32px, 5vw);
        max-height: 80vh;
        border-radius: min(28px, 4vw);
        color: white !important;
    }

    .toggle-row {
        gap: min(8px, 1.2vw) !important;
    }

    .toggle-button {
        min-width: min(100px, 20vw) !important;
        padding: min(12px, 2vw) !important;
        font-size: clamp(10px, 2vw, 12px) !important;
        color: white !important;
    }

    .voice-dropdown {
        max-width: min(240px, 60vw) !important;
        font-size: clamp(10px, 2vw, 12px) !important;
        padding: min(6px, 1vw) min(10px, 2vw) !important;
        color: white !important;
    }

    .voice-selection label {
        font-size: clamp(10px, 2vw, 12px) !important;
        color: white !important;
    }

    /* Ensure all mobile options text is white */
    .options-menu *,
    .options-content * {
        color: white !important;
    }
}

.compact-options {
    display: flex;
    flex-direction: column;
    gap: min(12px, 1.8vw);
}

.toggle-row {
    display: flex;
    justify-content: center;
    gap: min(12px, 1.8vw);
}

.unit-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.unit-selection label {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
}

.unit-selection select {
    /* Glassmorphism Effect - matching main menu buttons */
    background: rgba(255, 204, 0, 0.3);
    /* Yellow/gold with transparency */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 204, 0, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    color: white;
    border-radius: min(20px, 3vw);
    padding: min(16px, 2.5vw) min(20px, 3vw);
    font-size: clamp(12px, 2.2vw, 14px);
    font-family: 'Lexend', sans-serif;
    font-weight: 500;
    letter-spacing: 0.1px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: min(150px, 35vw);
    text-align: center;

    position: relative;
    overflow: hidden;
}

.unit-selection select:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 204, 0, 0.3);
    background: rgba(255, 204, 0, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.unit-selection select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.4);
}

.options-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.back-button {
    /* Glassmorphism Effect - matching main menu buttons */
    background: rgba(26, 115, 232, 0.3);
    /* Blue with transparency */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(26, 115, 232, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    color: #ffffff;
    border-radius: min(20px, 3vw);
    padding: min(16px, 2.5vw);
    font-size: clamp(12px, 2.2vw, 14px);
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    letter-spacing: 0.1px;
    text-transform: none;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: min(8px, 1vw);
    width: 100%;
    max-width: min(200px, 50vw);

    position: relative;
    overflow: hidden;
}

.back-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(26, 115, 232, 0.3);
    background: rgba(26, 115, 232, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.back-button:active {
    transform: translateY(-1px);
}

.options-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.options-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.options-button:active {
    transform: translateY(0);
}

.accessibility-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem;
}

.accessibility-options .toggle-options {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 0.3rem 0;
}

.main-menu-buttons {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Mobile-specific positioning */
@media (max-width: 768px) {
    .stars-toggle-container {
        bottom: auto;
        /* Remove bottom positioning */
        top: 20px;
        /* Position at the top */
        right: 20px;
        /* Keep right alignment */
    }
}

/* General button styling - override for options menu */
button,
.toggle-button,
.mode-button {
    color: #333;
    /* Dark grey text */
    /* ... existing button styles ... */
}

/* Override general button styling specifically for options menu */
.options-menu button,
.options-menu .toggle-button,
.options-menu .back-button,
.options-menu .test-voice-btn {
    color: white !important;
}

.options-menu button span,
.options-menu .toggle-button span,
.options-menu .back-button span,
.options-menu .test-voice-btn span {
    color: white !important;
}

/* Specific button classes */
.mode-easy,
.mode-hard,
.next-country,
.reset-game,
.toggle-stars-game {
    color: #333 !important;
    /* Ensure dark grey text */
}

/* Hover and active states */
button:hover,
.toggle-button:hover,
.mode-button:hover {
    color: #333;
    /* Maintain dark grey on hover */
}

button:active,
.toggle-button:active,
.mode-button:active {
    color: #333;
    /* Maintain dark grey when active */
}

/* Disabled state */
button:disabled,
.toggle-button:disabled,
.mode-button:disabled {
    color: #444 !important;
    /* Apply darker grey to all disabled buttons if desired */
    opacity: 0.7;
}

/* Disabled state for Next Country button */
.next-country:disabled,
#next-country:disabled {
    color: #444 !important;
    /* Darker grey for disabled text */
    opacity: 0.7;
    pointer-events: none !important;
    /* Prevent clicks when disabled */
}

/* Mobile devices - Stack vertically, compact layout */
@media (max-width: 768px) {
    .start-screen {
        width: clamp(300px, 90vw, 400px);
        padding: clamp(16px, 4vw, 24px);
        max-height: 98vh;
        min-height: fit-content;
    }

    .start-screen h1 {
        font-size: clamp(3.5em, 12vw, 5.5em);
        margin-bottom: clamp(8px, 2vh, 16px);
        line-height: 1.1;
        word-break: break-word;
        text-align: center;
    }

    .start-screen .byline {
        margin-top: clamp(4px, 1vh, 8px);
        margin-bottom: clamp(12px, 2vh, 20px);
        font-size: clamp(0.65em, 2.2vw, 0.85em);
        line-height: 1.3;
        text-align: center;
        white-space: normal;
    }

    .start-screen p {
        margin-bottom: clamp(6px, 1vh, 12px);
        font-size: clamp(10px, 2.5vw, 13px);
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: clamp(6px, 1vh, 12px);
        margin-top: clamp(6px, 1vh, 12px);
    }

    .mode-buttons button {
        padding: clamp(10px, 2vh, 16px) clamp(12px, 3vw, 20px) !important;
        font-size: clamp(11px, 2.5vw, 14px) !important;
        min-height: clamp(50px, 6vh, 70px) !important;
        height: auto !important;
    }

    .mode-buttons button span:first-child {
        font-size: clamp(12px, 2.8vw, 16px) !important;
        margin-bottom: clamp(1px, 0.3vh, 4px) !important;
    }

    .mode-buttons button .subtext {
        font-size: clamp(9px, 2vw, 12px) !important;
    }

    .mode-buttons button:hover {
        transform: translateY(-2px) scale(1);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    }
}

/* Small mobile devices - Ultra compact */
@media (max-width: 480px) {

    /* Prevent overlap between title and byline */
    .start-screen h1 {
        font-size: clamp(2.2em, 9vw, 3em);
        margin-bottom: clamp(10px, 3.5vh, 20px);
        line-height: 1.1;
        word-break: break-word;
    }

    .start-screen .byline {
        margin-top: clamp(6px, 2vh, 14px);
        line-height: 1.2;
        white-space: normal;
    }

    .start-screen {
        width: clamp(280px, 95vw, 350px);
        padding: clamp(12px, 3vw, 20px);
        max-height: 99vh;
    }

    .start-screen h1 {
        font-size: clamp(2.8em, 11vw, 4em);
        margin-bottom: clamp(6px, 1.5vh, 12px);
        line-height: 1.1;
        word-break: break-word;
        text-align: center;
    }

    .start-screen .byline {
        margin-top: clamp(2px, 0.5vh, 6px);
        margin-bottom: clamp(8px, 1.5vh, 16px);
        font-size: clamp(0.6em, 3vw, 0.8em);
        line-height: 1.3;
        text-align: center;
        white-space: normal;
    }

    .start-screen p {
        margin-bottom: clamp(4px, 0.8vh, 8px);
        font-size: clamp(9px, 3vw, 12px);
        line-height: 1.4;
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: clamp(4px, 0.8vh, 8px);
        margin-top: clamp(4px, 0.8vh, 8px);
    }

    .mode-buttons button {
        padding: clamp(8px, 1.5vh, 12px) clamp(10px, 2.5vw, 16px) !important;
        font-size: clamp(10px, 3vw, 13px) !important;
        min-height: clamp(45px, 5vh, 60px) !important;
        height: auto !important;
    }

    .mode-buttons button span:first-child {
        font-size: clamp(11px, 3.2vw, 14px) !important;
        margin-bottom: clamp(1px, 0.2vh, 2px) !important;
    }

    .mode-buttons button .subtext {
        font-size: clamp(8px, 2.5vw, 11px) !important;
        line-height: 1.2 !important;
    }
}

/* Very small mobile devices - Extra compact */
@media (max-width: 360px) {
    .start-screen {
        width: clamp(260px, 95vw, 320px);
        padding: clamp(10px, 2.5vw, 16px);
    }

    .start-screen h1 {
        font-size: clamp(2.2em, 12vw, 3.5em);
        margin-bottom: clamp(4px, 1vh, 8px);
        line-height: 1.05;
        text-align: center;
        word-break: break-word;
    }

    .start-screen .byline {
        margin-top: clamp(1px, 0.3vh, 4px);
        margin-bottom: clamp(6px, 1vh, 12px);
        font-size: clamp(0.55em, 3.5vw, 0.75em);
        line-height: 1.2;
        text-align: center;
        white-space: normal;
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: clamp(3px, 0.6vh, 6px);
        margin-top: clamp(3px, 0.6vh, 6px);
    }

    .mode-buttons button {
        padding: clamp(6px, 1.2vh, 10px) clamp(8px, 2vw, 12px) !important;
        font-size: clamp(9px, 2.8vw, 12px) !important;
        min-height: clamp(40px, 4.5vh, 55px) !important;
        height: auto !important;
    }

    .mode-buttons button span:first-child {
        font-size: clamp(10px, 2.9vw, 13px) !important;
        margin-bottom: clamp(1px, 0.1vh, 2px) !important;
    }

    .mode-buttons button .subtext {
        font-size: clamp(7px, 2.2vw, 10px) !important;
        line-height: 1.2 !important;
    }
}

/* iPad Mini and small tablets - Galaxy S8 format (single column, compact layout) */
@media (min-width: 601px) and (max-width: 768px) {
    .start-screen {
        width: clamp(300px, 90vw, 600px);
        padding: clamp(16px, 4vw, 24px);
        /* max-height: 98vh; */
        min-height: fit-content;
    }

    .start-screen h1 {
        font-size: clamp(3.5em, 12vw, 5.5em);
        margin-bottom: clamp(8px, 2vh, 16px);
        line-height: 1.1;
        word-break: break-word;
        text-align: center;
    }

    .start-screen .byline {
        margin-top: clamp(4px, 1vh, 8px);
        margin-bottom: clamp(12px, 2vh, 20px);
        font-size: clamp(0.65em, 2.2vw, 0.85em);
        line-height: 1.3;
        text-align: center;
        white-space: normal;
    }

    .start-screen p {
        margin-bottom: clamp(6px, 1vh, 12px);
        font-size: clamp(10px, 2.5vw, 13px);
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: clamp(8px, 1.5vh, 12px);
    }

    .mode-buttons button {
        min-height: clamp(60px, 8vh, 80px);
        padding: clamp(12px, 2vh, 16px) clamp(16px, 3vw, 20px);
    }
}

/* iPad devices - Galaxy S8 format (single column, compact layout) */
@media (min-width: 769px) and (max-width: 1024px) {
    .start-screen {
        width: clamp(300px, 90vw, 600px);
        padding: clamp(16px, 4vw, 24px);
        /* max-height: 98vh; */
        min-height: fit-content;
    }

    .start-screen h1 {
        font-size: clamp(3.5em, 12vw, 5.5em);
        margin-bottom: clamp(8px, 2vh, 16px);
        line-height: 1.1;
        word-break: break-word;
        text-align: center;
    }

    .start-screen .byline {
        margin-top: clamp(4px, 1vh, 8px);
        margin-bottom: clamp(12px, 2vh, 20px);
        font-size: clamp(0.65em, 2.2vw, 0.85em);
        line-height: 1.3;
        text-align: center;
        white-space: normal;
    }

    .start-screen p {
        margin-bottom: clamp(6px, 1vh, 12px);
        font-size: clamp(10px, 2.5vw, 13px);
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        justify-items: stretch;
        width: 100%;
        max-width: 100%;
        gap: clamp(8px, 1.5vh, 12px);
    }

    .mode-buttons button {
        min-height: clamp(60px, 8vh, 80px);
        padding: clamp(12px, 2vh, 16px) clamp(16px, 3vw, 20px);
    }
}

/* iPad Pro devices - Use desktop layout for consistency */
@media (min-width: 1024px) and (max-width: 1365px) {
    .start-screen {
        width: clamp(800px, 80vw, 1200px);
        height: fit-content;
        max-height: 90vh;
        min-height: auto;

        padding: 28px 36px;
        border-radius: 24px;
        gap: 14px;
        align-items: stretch;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        transform-origin: center center;
        margin: 0;
        right: auto;
        bottom: auto;
        overflow: hidden;
        text-align: center;
        background: rgba(25, 27, 34, 0.58);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.10);
    }

    .start-screen h1 {
        font-size: clamp(5rem, 12vw, 8rem) !important;
        letter-spacing: 0.01em;
        margin-bottom: 6px;
        text-align: center;
    }

    .start-screen .byline {
        margin-top: 0;
        margin-bottom: 10px;
        font-size: 1.4rem;
        opacity: 0.9;
        text-align: center;
    }

    .start-screen p {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .mode-buttons {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        margin-top: 8px;
        max-width: 80%;
    }

    .mode-buttons button {
        min-height: 20px;
        padding: 5px 7px;
        font-size: 0.7rem;
    }
}

/* Large desktop - keep wide panel and 4x2 grid */
@media (min-width: 1366px) {
    .start-screen {
        width: clamp(1100px, 70vw, 1400px);
        padding: clamp(32px, 4vh, 40px);
    }

    .mode-buttons {
        grid-template-columns: repeat(4, minmax(220px, 1fr));
        grid-template-rows: repeat(2, auto);
        gap: clamp(16px, 2vh, 22px);
        max-width: none;
    }

    .mode-buttons button {
        min-height: clamp(80px, 10vh, 73px);
        height: auto;
        padding: clamp(16px, 2.5vh, 16px) clamp(20px, 3vw, 19px);
    }

    .mode-buttons button span:first-child {
        font-size: clamp(18px, 1.6vw, 22px);
        margin-bottom: 6px;
    }

    /* .mode-buttons button .subtext {
    font-size: clamp(12px, .8vw, 14px);
    max-width: 92%;
  } */
}

/* Ultra-wide screens - maintain wide panel and 4x2 grid */
@media (min-width: 1920px) {
    .start-screen {
        width: clamp(1200px, 60vw, 1600px);
        padding: 40px;
        max-width: none;
    }

    .mode-buttons {
        grid-template-columns: repeat(4, minmax(240px, 1fr));
        grid-template-rows: repeat(2, auto);
        gap: 22px;
        max-width: none;
    }

    .mode-buttons button {
        max-height: none;
        height: auto;
        padding: clamp(16px, 2.5vh, 16px) clamp(20px, 3vw, 19px);
    }
}

/* Short screens - Reduce vertical spacing */
@media (max-height: 600px) and (max-width: 1023px) {
    .start-screen {
        max-height: 98vh;
        padding: clamp(12px, 2vh, 24px) clamp(16px, 3vw, 32px);
    }

    .start-screen h1 {
        font-size: clamp(2em, 5vw, 3.5em);
        margin-bottom: clamp(4px, 1vh, 8px);
    }

    .start-screen .byline {
        margin-top: clamp(-15px, -2vh, -25px);
        margin-bottom: clamp(6px, 1vh, 12px);
    }

    .start-screen p {
        margin-bottom: clamp(4px, 0.8vh, 8px);
        font-size: clamp(10px, 1.5vw, 14px);
    }

    .mode-buttons {
        gap: clamp(4px, 0.8vh, 8px);
        margin-top: clamp(4px, 0.8vh, 8px);
    }

    .mode-buttons button {
        min-height: clamp(40px, 6vh, 60px);
        padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vw, 20px);
    }
}

/* Extra short screens - Emergency compact mode */
@media (max-height: 480px) and (max-width: 1023px) {
    .start-screen {
        max-height: 99vh;
        padding: clamp(8px, 1.5vh, 16px) clamp(12px, 2.5vw, 24px);
    }

    .start-screen h1 {
        font-size: clamp(1.8em, 4vw, 2.8em);
        margin-bottom: clamp(2px, 0.5vh, 6px);
    }

    .start-screen .byline {
        margin-top: clamp(-12px, -1.5vh, -20px);
        margin-bottom: clamp(4px, 0.8vh, 8px);
        font-size: clamp(0.6em, 2vw, 0.8em);
    }

    .start-screen p {
        margin-bottom: clamp(2px, 0.5vh, 6px);
        font-size: clamp(9px, 1.2vw, 12px);
        line-height: 1.3;
    }

    .mode-buttons {
        gap: clamp(3px, 0.5vh, 6px);
        margin-top: clamp(2px, 0.5vh, 6px);
    }

    .mode-buttons button {
        min-height: clamp(35px, 5vh, 50px);
        padding: clamp(6px, 1vh, 10px) clamp(10px, 1.5vw, 16px);
        font-size: clamp(9px, 1.5vw, 12px);
    }

    .mode-buttons button span:first-child {
        font-size: clamp(10px, 1.8vw, 13px);
        margin-bottom: clamp(0px, 0.2vh, 2px);
    }

    .mode-buttons button .subtext {
        font-size: clamp(7px, .8vw, 10px);
        line-height: 1.1;
    }
}

/* Desktop styles for stats elements */
@media (min-width: 769px) {

    /* Hide any heading text inside the country facts panel on desktop */
    #country-facts h1,
    #country-facts h2,
    #country-facts h3,
    #country-facts .heading,
    #country-facts .title,
    .panel-toggle {
        display: none !important;
    }

    .stats-container {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .countries-left-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        max-width: none !important;
        /* allow full panel width */
        align-self: stretch;
        margin: 0;
        /* use panel padding, not centered fixed width */
    }

    .timer,
    .score {
        background-color: rgba(30, 30, 30, 0.9);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Strong override to prevent text wrapping - from old jojio solution */
    .game-info .timer,
    .game-info .score {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .countries-left,
    .guess-accuracy {
        background-color: rgba(30, 30, 30, 0.9);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin: 0;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }

    /* Strong override to prevent text wrapping - from old jojio solution */
    .game-info .countries-left,
    .game-info .guess-accuracy {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

.country-name-label {
    fill: white;
    /* Or choose a contrasting color */
    font-size: clamp(14px, 2.8vw, 18px);
    font-weight: bold;
    text-anchor: middle;
    /* Ensures centering */
    pointer-events: none;
    /* Prevent label from blocking clicks */
    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.7));
    /* Optional text shadow */
}

/* Apply same sizing explicitly for mobile mode */
@media (max-width: 768px) {
    .country-name-label {
        font-size: clamp(14px, 3vw, 18px);
    }
}

/* Floating Particles Background Effect */
/* .floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

.particle:nth-child(odd) {
    background: rgba(110, 166, 255, 0.2);
    animation-duration: 20s;
}

.particle:nth-child(3n) {
    background: rgba(255, 201, 139, 0.15);
    animation-duration: 25s;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
} */

/* Glass morphism glow effect */
@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(110, 166, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(110, 166, 255, 0.5);
    }
}

/* Enhanced glassmorphism for special elements */
.enhanced-glass {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: glow 3s ease-in-out infinite;
}

/* Country Comparison Game Styles */
.country-comparison-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(12, 12, 12, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
    font-family: 'Lexend', sans-serif;
    padding: 20px;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    pointer-events: none;
}

.country-comparison-container:not(.hidden) {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.comparison-header {
    text-align: center;
    margin-bottom: 40px;
}

.comparison-header h2 {
    font-size: 2.5em;
    font-weight: 500;
    margin-bottom: 20px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.comparison-score {
    font-size: 1.8em;
    font-weight: 300;
    color: #0057A8;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.comparison-countries {
    display: flex;
    align-items: center;
    gap: 60px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.country-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 250px;
    max-width: 300px;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

.country-option:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: rgba(66, 133, 244, 0.6);
    box-shadow: 0 15px 40px rgba(66, 133, 244, 0.3);
    background: rgba(255, 255, 255, 0.15);
}

.country-option.correct {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
    animation: pulse-correct 0.6s ease;
}

.country-option.incorrect {
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.1);
    animation: shake 0.6s ease;
}

/* Sliding animations for country comparison */
.country-option.slide-out-down {
    animation: slideOutDown 0.5s ease forwards !important;
    pointer-events: none;
    z-index: 1;
}

.country-option.slide-in-up {
    animation: slideInUp 0.5s ease forwards !important;
    z-index: 2;
}

@keyframes pulse-correct {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

@keyframes slideOutDown {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) scale(0.7);
        opacity: 0;
    }
}

@keyframes slideInUp {
    0% {
        transform: translateY(100vh) scale(0.7);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Land animation for area questions */
.country-visual.land-highlight {
    animation: landHighlight 2s ease-in-out;
}

@keyframes landHighlight {
    0% {
        box-shadow: 0 0 0 rgba(0, 255, 0, 0);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
    }

    100% {
        box-shadow: 0 0 0 rgba(0, 255, 0, 0);
    }
}

/* Airport ticker-style number counter */
.number-counter-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
    height: 45px;
    /* Reduced from 60px to prevent overlap */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    width: 100%;
    /* Use full width of parent container */
    max-width: 320px;
    /* Increased width for wider ticker */
    z-index: 15;
    /* Ensure it appears above the reserved space */
}

.number-scroll {
    position: relative;
    transition: transform 0.1s ease-out;
    font-size: 28px;
    /* Reduced from 32px to fit smaller height */
    font-weight: bold;
    color: white;
    /* Changed from green to white */
    font-family: 'Lexend', sans-serif;
    /* Same font as country names */
    letter-spacing: 1px;
    background: linear-gradient(45deg, #000, #111);
    border-radius: 6px;
    padding: 8px 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    white-space: nowrap;
    /* Prevent text wrapping */
    overflow: hidden;
    /* Hide overflow */
}

/* Ticker unit styling */
.number-counter-container span {
    font-size: 14px;
    /* Reduced from 16px to fit smaller height */
    font-weight: normal;
    margin-left: 4px;
    /* Reduced margin */
    color: white;
    /* Changed from green to white */
    font-family: 'Lexend', sans-serif;
    /* Same font as country names */
    display: flex;
    align-items: center;
    white-space: nowrap;
    /* Prevent text wrapping */
}

.country-visual {
    margin-bottom: 10px;
    /* Reduced margin to bring names closer */
    width: 100%;
    height: 350px;
    /* Increased height by another 50% for even bigger flags */
    position: relative;
    border-radius: 20px;
    overflow: hidden;
}

.country-flag-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.country-flag {
    width: 300%;
    /* Increased width to make flags much bigger */
    height: 300%;
    /* Increased height to make flags much bigger */
    object-fit: cover;
    margin: -100%;
    /* Center the larger flag */
}

.country-info {
    text-align: center;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: transparent;
    padding: 15px;
    margin: 0;
}

/* Reserve space for ticker in desktop version */
.country-visual::after {
    content: '';
    display: block;
    height: 40px;
    /* Reduced from 60px to remove excess space */
    width: 100%;
    visibility: hidden;
    /* Make it invisible but still take up space */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    /* Below the country-info but above the flag */
}

.country-info h3 {
    color: white;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.country-stats {
    font-size: 0.9em;
    font-weight: 300;
    color: white;
    line-height: 1.4;
    white-space: pre-line;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    position: relative;
    /* Required for absolute positioning of ticker */
    min-height: 40px;
    /* Reduced to match reserved space */
}

.vs-divider {
    font-size: 3em;
    font-weight: bold;
    color: white;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
    background: none;
    -webkit-text-fill-color: white;
    animation: glow-or 2s ease-in-out infinite alternate;
}

@keyframes glow-or {
    from {
        filter: drop-shadow(0 0 10px rgba(255, 204, 0, 0.5));
    }

    to {
        filter: drop-shadow(0 0 20px rgba(255, 204, 0, 0.8));
    }
}

.comparison-controls {
    display: flex;
    gap: 20px;
}

.reset-button {
    padding: 15px 30px;
    background: rgba(255, 59, 48, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: white;
    font-family: 'Lexend', sans-serif;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 59, 48, 0.3);
}

.reset-button:hover {
    transform: translateY(-2px);
    background: rgba(255, 59, 48, 0.9);
    box-shadow: 0 8px 25px rgba(255, 59, 48, 0.4);
}

.restart-button {
    padding: 15px 30px;
    background: rgba(76, 175, 80, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: white;
    font-family: 'Lexend', sans-serif;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.restart-button:hover {
    transform: translateY(-2px);
    background: rgba(76, 175, 80, 0.9);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

/* Game Over Screen Styles */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    /* Very high z-index to appear above everything */
}

.game-over-content {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-over-message {
    font-size: 1.5em;
    color: white;
    margin-bottom: 20px;
    font-family: 'Lexend', sans-serif;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-over-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-family: 'Lexend', sans-serif;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-over-buttons .restart-button {
    background: rgba(76, 175, 80, 0.8);
    color: white;
}

.game-over-buttons .restart-button:hover {
    background: rgba(76, 175, 80, 0.9);
    transform: translateY(-2px);
}

.game-over-buttons .exit-button {
    background: rgba(255, 59, 48, 0.8);
    color: white;
}

.game-over-buttons .exit-button:hover {
    background: rgba(255, 59, 48, 0.9);
    transform: translateY(-2px);
}

/* Mobile responsive design for country comparison */
@media (max-width: 768px) {
    .comparison-countries {
        flex-direction: column;
        gap: 30px;
    }

    .country-option {
        min-width: 280px;
        max-width: 320px;
    }

    .comparison-header h2 {
        font-size: 1.8em;
    }

    .vs-divider {
        font-size: 2em;
        transform: rotate(90deg);
    }

    .country-svg-container {
        width: 150px;
        height: 150px;
    }
}

/* Mobile Optimizations for Country Comparison Game */
@media (max-width: 768px) {

    /* Hide globe when country comparison game is active on mobile */
    .country-comparison-container:not(.hidden)~.globe-container,
    .country-comparison-container:not(.hidden)+.globe-container {
        display: none !important;
    }

    .country-comparison-container {
        padding: 15px;
        justify-content: flex-start;
        padding-top: 20px;
        padding-bottom: 80px;
        /* Add bottom padding for exit button */
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .comparison-header {
        margin-bottom: 20px;
        flex-shrink: 0;
        /* Prevent header from shrinking */
    }

    .comparison-header h2 {
        font-size: 1.2em !important;
        /* Made even smaller from 1.1em and added !important to override conflict */
        margin-bottom: 10px;
        line-height: 1.2;
    }

    .comparison-score {
        font-size: 1.6em;
        /* Made bigger from 1.2em */
        margin-bottom: 15px;
    }

    .comparison-countries {
        flex-direction: column;
        gap: 20px;
        margin-bottom: 20px;
        flex: 1;
        /* Take up remaining space */
        display: flex;
        justify-content: center;
        /* Center content vertically */
        align-items: center;
        min-height: 0;
        /* Allow flex shrinking */
    }

    .country-option {
        min-width: 240px;
        /* Reduced from 280px */
        max-width: none;
        /* Remove max-width constraint to allow full width */
        padding: 0;
        flex: 1;
        /* Take up available space */
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
        /* Allow shrinking */
    }

    .country-visual {
        height: auto;
        /* Remove fixed height */
        min-height: 120px;
        /* Minimum height */
        max-height: 40vh;
        /* Maximum height as percentage of viewport */
        margin-bottom: 0;
        /* Remove margin since name goes below */
        position: relative;
        /* Make this the positioning context for ticker */
        flex: 1;
        /* Take up available space */
        display: flex;
        flex-direction: column;
    }

    .country-flag {
        width: 200%;
        /* Reduced from 250% */
        height: 200%;
        /* Reduced from 250% */
        margin: -50%;
        /* Adjusted from -75% */
        flex: 1;
        /* Take up available space */
        object-fit: cover;
    }

    .country-info {
        padding: 10px;
        margin-top: 0;
        /* Remove top margin */
        text-align: center;
        position: relative;
        /* Ensure proper positioning */
        width: 100%;
        /* Ensure full width */
        flex-shrink: 0;
        /* Prevent info from shrinking */
    }

    .country-info h3 {
        font-size: 1em;
        /* Reduced from 1.1em */
        margin-bottom: 15px;
        /* Add space below country name for ticker */
        text-align: center;
        margin-top: 0;
        /* Remove top margin since name is below container */
        position: relative;
        /* Ensure proper positioning */
        z-index: 5;
        /* Ensure name appears above other elements */
    }

    /* Removed reserved space since ticker is now working correctly */

    .country-stats {
        font-size: 0.8em;
        position: relative;
        /* Required for absolute positioning of ticker */
        min-height: 50px;
        /* Reduced to fit ticker more tightly */
    }

    .vs-divider {
        font-size: 1.8em;
        /* Reduced from 2em */
        transform: none;
        /* Remove rotation to make it horizontal */
        margin: 10px 0;
        flex-shrink: 0;
        /* Prevent divider from shrinking */
    }

    .number-counter-container {
        height: 50px;
        padding: 6px 10px;
        width: 100%;
        /* Match flag width exactly */
        max-width: none;
        /* Remove max-width constraint */
        position: absolute;
        bottom: 0;
        /* Position at bottom of country-stats container */
        left: 0;
        right: 0;
        transform: none;
        /* Remove centering transform */
        z-index: 15;
        /* Ensure it appears above the reserved space */
    }

    .number-scroll {
        font-size: 24px;
        /* Reduced font size to fit numbers */
        padding: 6px 10px;
    }

    .number-counter-container span {
        font-size: 12px;
        /* Reduced font size to fit units */
        margin-left: 3px;
    }

    .comparison-controls {
        gap: 15px;
        flex-wrap: wrap;
        justify-content: center;
        position: fixed;
        /* Fix position at bottom */
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        flex-shrink: 0;
        /* Prevent controls from shrinking */
    }

    .reset-button,
    .restart-button {
        padding: 12px 24px;
        font-size: 1em;
        border-radius: 12px;
    }
}

/* iPhone SE and very small phones */
@media (max-width: 375px) {
    .country-comparison-container {
        padding: 7.5px;
        /* 50% of 15px */
        padding-top: 10px;
        /* 50% of 20px */
        padding-bottom: 40px;
        /* 50% of 80px */
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .comparison-header {
        flex-shrink: 0;
    }

    .comparison-header h2 {
        font-size: 1em !important;
        /* 50% of 2em */
        margin-bottom: 6px;
        line-height: 1.1;
    }

    .comparison-score {
        font-size: 0.9em;
        /* 50% of 1.8em */
        margin-bottom: 10px;
    }

    .comparison-countries {
        gap: 12px;
        margin-bottom: 12px;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
    }

    .country-option {
        min-width: 200px;
        max-width: none;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .country-visual {
        height: auto;
        min-height: 80px;
        max-height: 35vh;
        margin-bottom: 0;
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .country-flag {
        width: 160%;
        height: 160%;
        margin: -30%;
        flex: 1;
        object-fit: cover;
    }

    .country-info {
        padding: 6px;
        margin-top: 0;
        text-align: center;
        position: relative;
        width: 100%;
        flex-shrink: 0;
    }

    .country-info h3 {
        font-size: 0.85em;
        margin-bottom: 10px;
        text-align: center;
        margin-top: 0;
        position: relative;
        z-index: 5;
    }

    .country-stats {
        font-size: 0.7em;
        position: relative;
        min-height: 40px;
    }

    .vs-divider {
        font-size: 1.4em;
        transform: none;
        margin: 6px 0;
        flex-shrink: 0;
    }

    .number-counter-container {
        height: 40px;
        padding: 4px 6px;
        width: 100%;
        max-width: none;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        z-index: 15;
    }

    .number-scroll {
        font-size: 18px;
        padding: 4px 6px;
    }

    .number-counter-container span {
        font-size: 9px;
        margin-left: 2px;
    }

    .comparison-controls {
        gap: 10px;
        position: fixed;
        bottom: 12px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        flex-shrink: 0;
    }

    .reset-button,
    .restart-button {
        padding: 8px 16px;
        font-size: 0.85em;
        border-radius: 8px;
    }
}

/* Standard mobile phones (iPhone 11, Galaxy S21, etc.) */
@media (min-width: 376px) and (max-width: 480px) {
    .country-comparison-container {
        padding: 12px;
        /* 60% of 15px */
        padding-top: 12px;
        /* 60% of 20px */
        padding-bottom: 48px;
        /* 60% of 80px */
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .comparison-header {
        flex-shrink: 0;
    }

    .comparison-header h2 {
        font-size: 1.2em !important;
        /* 60% of 2em */
        margin-bottom: 8px;
        line-height: 1.1;
    }

    .comparison-score {
        font-size: 1.08em;
        /* 60% of 1.8em */
        margin-bottom: 12px;
    }

    .comparison-countries {
        gap: 15px;
        margin-bottom: 15px;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
    }

    .country-option {
        min-width: 220px;
        /* Reduced from 260px */
        max-width: none;
        /* Remove max-width constraint to allow full width */
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .country-visual {
        height: auto;
        /* Remove fixed height */
        min-height: 100px;
        max-height: 38vh;
        margin-bottom: 0;
        /* Remove margin since name goes below */
        position: relative;
        /* Make this the positioning context for ticker */
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .country-flag {
        width: 180%;
        /* Reduced from 200% */
        height: 180%;
        /* Reduced from 200% */
        margin: -40%;
        /* Adjusted from -50% */
        flex: 1;
        object-fit: cover;
    }

    .country-info {
        padding: 8px;
        margin-top: 0;
        /* Remove top margin */
        text-align: center;
        position: relative;
        /* Ensure proper positioning */
        width: 100%;
        /* Ensure full width */
        flex-shrink: 0;
    }

    .country-info h3 {
        font-size: 0.9em;
        /* Reduced from 1em */
        margin-bottom: 12px;
        /* Add space below country name for ticker */
        text-align: center;
        margin-top: 0;
        /* Remove top margin since name is below container */
        position: relative;
        /* Ensure proper positioning */
        z-index: 5;
        /* Ensure name appears above other elements */
    }

    /* Removed reserved space since ticker is now working correctly */

    .country-stats {
        font-size: 0.75em;
        position: relative;
        /* Required for absolute positioning of ticker */
        min-height: 45px;
        /* Reduced to fit ticker more tightly */
    }

    .vs-divider {
        font-size: 1.6em;
        /* Reduced from 1.8em */
        transform: none;
        /* Remove rotation to make it horizontal */
        margin: 8px 0;
        flex-shrink: 0;
    }

    .number-counter-container {
        height: 45px;
        padding: 5px 8px;
        width: 100%;
        /* Match flag width exactly */
        max-width: none;
        /* Remove max-width constraint */
        position: absolute;
        bottom: 0;
        /* Position at bottom of country-stats container */
        left: 0;
        right: 0;
        transform: none;
        /* Remove centering transform */
        z-index: 15;
        /* Ensure it appears above the reserved space */
    }

    .number-scroll {
        font-size: 20px;
        /* Reduced font size to fit numbers */
        padding: 5px 8px;
    }

    .number-counter-container span {
        font-size: 10px;
        /* Reduced font size to fit units */
        margin-left: 2px;
    }

    .comparison-controls {
        gap: 12px;
        position: fixed;
        /* Fix position at bottom */
        bottom: 15px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        flex-shrink: 0;
    }

    .reset-button,
    .restart-button {
        padding: 10px 20px;
        font-size: 0.9em;
        border-radius: 10px;
    }

    /* Mobile Game Over Screen */
    .game-over-content {
        padding: 20px;
        max-width: 90%;
    }

    .game-over-message {
        font-size: 1.2em;
        margin-bottom: 15px;
    }

    .game-over-buttons {
        gap: 10px;
    }

    .game-over-buttons button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

/* Large phones (iPhone 12/13/14 Pro Max, Galaxy S24 Ultra, etc.) */
@media (min-width: 481px) and (max-width: 600px) {
    .country-comparison-container {
        padding: 12px;
        /* 80% of 15px */
        padding-top: 16px;
        /* 80% of 20px */
        padding-bottom: 64px;
        /* 80% of 80px */
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .comparison-header {
        flex-shrink: 0;
    }

    .comparison-header h2 {
        font-size: 1.6em !important;
        /* 80% of 2em */
        margin-bottom: 10px;
        line-height: 1.2;
    }

    .comparison-score {
        font-size: 1.44em;
        /* 80% of 1.8em */
        margin-bottom: 15px;
    }

    .comparison-countries {
        gap: 18px;
        margin-bottom: 18px;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
    }

    .country-option {
        min-width: 260px;
        max-width: none;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .country-visual {
        height: auto;
        min-height: 140px;
        max-height: 42vh;
        margin-bottom: 0;
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .country-flag {
        width: 190%;
        height: 190%;
        margin: -45%;
        flex: 1;
        object-fit: cover;
    }

    .country-info {
        padding: 12px;
        margin-top: 0;
        text-align: center;
        position: relative;
        width: 100%;
        flex-shrink: 0;
    }

    .country-info h3 {
        font-size: 1.1em;
        margin-bottom: 15px;
        text-align: center;
        margin-top: 0;
        position: relative;
        z-index: 5;
    }

    .country-stats {
        font-size: 0.85em;
        position: relative;
        min-height: 55px;
    }

    .vs-divider {
        font-size: 2em;
        transform: none;
        margin: 12px 0;
        flex-shrink: 0;
    }

    .number-counter-container {
        height: 55px;
        padding: 8px 12px;
        width: 100%;
        max-width: none;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        z-index: 15;
    }

    .number-scroll {
        font-size: 26px;
        padding: 8px 12px;
    }

    .number-counter-container span {
        font-size: 13px;
        margin-left: 4px;
    }

    .comparison-controls {
        gap: 18px;
        position: fixed;
        bottom: 25px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        flex-shrink: 0;
    }

    .reset-button,
    .restart-button {
        padding: 14px 28px;
        font-size: 1.1em;
        border-radius: 14px;
    }
}

/* Small tablets (iPad Mini, etc.) */
@media (min-width: 601px) and (max-width: 768px) {
    .country-comparison-container {
        padding: 15px;
        padding-top: 20px;
        padding-bottom: 80px;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .comparison-header {
        flex-shrink: 0;
    }

    .comparison-header h2 {
        font-size: 2em !important;
        margin-bottom: 12px;
        line-height: 1.3;
    }

    .comparison-score {
        font-size: 1.8em;
        margin-bottom: 18px;
    }

    .comparison-countries {
        gap: 20px;
        margin-bottom: 20px;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 0;
    }

    .country-option {
        min-width: 280px;
        max-width: none;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 0;
    }

    .country-visual {
        height: auto;
        min-height: 160px;
        max-height: 45vh;
        margin-bottom: 0;
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .country-flag {
        width: 200%;
        height: 200%;
        margin: -50%;
        flex: 1;
        object-fit: cover;
    }

    .country-info {
        padding: 15px;
        margin-top: 0;
        text-align: center;
        position: relative;
        width: 100%;
        flex-shrink: 0;
    }

    .country-info h3 {
        font-size: 1.2em;
        margin-bottom: 18px;
        text-align: center;
        margin-top: 0;
        position: relative;
        z-index: 5;
    }

    .country-stats {
        font-size: 0.9em;
        position: relative;
        min-height: 60px;
    }

    .vs-divider {
        font-size: 2.2em;
        transform: none;
        margin: 15px 0;
        flex-shrink: 0;
    }

    .number-counter-container {
        height: 60px;
        padding: 10px 15px;
        width: 100%;
        max-width: none;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        z-index: 15;
    }

    .number-scroll {
        font-size: 30px;
        padding: 10px 15px;
    }

    .number-counter-container span {
        font-size: 15px;
        margin-left: 5px;
    }

    .comparison-controls {
        gap: 20px;
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        flex-shrink: 0;
    }

    .reset-button,
    .restart-button {
        padding: 16px 32px;
        font-size: 1.2em;
        border-radius: 16px;
    }
}

/* Leaderboard Styles - Two Column Layout */
.leaderboard-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    flex-direction: row;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.leaderboard-container.hidden {
    display: none;
}

/* Old leaderboard-container > div rule removed for two-column layout */

.leaderboard-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: transparent;
    color: white;
}

.leaderboard-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
    font-family: 'Lexend', sans-serif;
    color: white;
}

.leaderboard-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 70%;

}

.leaderboard-tab {
    /* Glassmorphism Effect - matching main menu buttons */
    background: rgba(142, 109, 184, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(142, 109, 184, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    transition: all 0.3s ease;
}

.leaderboard-tab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(142, 109, 184, 0.3);
    background: rgba(142, 109, 184, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.leaderboard-tab:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(142, 109, 184, 0.5);
}

.leaderboard-tab.active {
    background: rgba(76, 175, 80, 0.5);
    border-color: rgba(76, 175, 80, 0.7);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.leaderboard-close {
    /* Glassmorphism Effect */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.leaderboard-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.leaderboard-right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.leaderboard-content {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    color: white;
    /* Smooth scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    min-height: 0;
}

/* Custom scrollbar for webkit browsers */
.leaderboard-content::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    /* Enhanced Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: white;
    font-family: 'Lexend', sans-serif;
}

.leaderboard-table-container {
    /* Enhanced Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-height: 70vh;
    overflow-y: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'Lexend', sans-serif;
}

.leaderboard-table thead {
    background: rgba(142, 109, 184, 0.3);
    color: white;
}

.leaderboard-table th {
    padding: 20px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-table td {
    padding: 16px;
    vertical-align: middle;
    color: white;
}

.leaderboard-table .rank {
    font-weight: 600;
    font-size: 18px;
    text-align: center;
    width: 60px;
    color: white;
}

.leaderboard-table .player-name {
    font-weight: 500;
    color: white;
}

.leaderboard-table .score {
    font-weight: 600;
    color: white;
    font-size: 16px;
    text-align: center;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

.leaderboard-table .accuracy {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.leaderboard-table .mode {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.leaderboard-table .date {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Top 3 ranking styles - Enhanced Glassmorphism */
.leaderboard-table .rank-1 {
    background: rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.leaderboard-table .rank-2 {
    background: rgba(192, 192, 192, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(192, 192, 192, 0.5);
}

.leaderboard-table .rank-3 {
    background: rgba(205, 127, 50, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(205, 127, 50, 0.5);
}

.leaderboard-table .rank-1 td,
.leaderboard-table .rank-2 td,
.leaderboard-table .rank-3 td {
    color: white;
}

.leaderboard-table .rank-1 .score,
.leaderboard-table .rank-2 .score,
.leaderboard-table .rank-3 .score {
    color: white;
    font-weight: 700;
}

.no-scores {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    font-family: 'Lexend', sans-serif;
}

/* Player search form removed */

/* Responsive design */
@media (max-width: 768px) {
    .leaderboard-container {
        padding: 10px;
    }

    .leaderboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 20px;
    }

    .leaderboard-controls {
        justify-content: center;
    }

    .leaderboard-table {
        font-size: 12px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
    }

    .leaderboard-table .date,
    .leaderboard-table .mode {
        display: none;
    }

    /* Player search form removed */
}

@media (max-width: 480px) {
    .leaderboard-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .leaderboard-table .accuracy {
        display: none;
    }
}

/* Mobile leaderboard improvements - merged into main responsive section */

.leaderboard-content {
    padding: 32px;
    overflow-y: auto;
    flex: 1;
    color: white;
    /* Smooth scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Custom scrollbar for webkit browsers */
.leaderboard-content::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: transparent;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    /* Enhanced Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    font-family: 'Lexend', sans-serif;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: white;
    font-family: 'Lexend', sans-serif;
}

.leaderboard-table-container {
    /* Enhanced Glassmorphism Effect */
    background: rgba(30, 30, 30, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);


}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    font-family: 'Lexend', sans-serif;
}

.leaderboard-table thead {
    background: rgba(142, 109, 184, 0.3);
    color: white;
}

.leaderboard-table th {
    padding: 20px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.leaderboard-table tbody tr:last-child {
    border-bottom: none;
}

.leaderboard-table td {
    padding: 16px;
    vertical-align: middle;
    color: white;
}

.leaderboard-table .rank {
    font-weight: 600;
    font-size: 18px;
    text-align: center;
    width: 60px;
    color: white;
}

.leaderboard-table .player-name {
    font-weight: 500;
    color: white;
}

.leaderboard-table .score {
    font-weight: 600;
    color: white;
    font-size: 16px;
    text-align: center;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}

.leaderboard-table .accuracy {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

.leaderboard-table .mode {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.leaderboard-table .date {
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

/* Top 3 ranking styles - Enhanced Glassmorphism */
.leaderboard-table .rank-1 {
    background: rgba(255, 215, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.leaderboard-table .rank-2 {
    background: rgba(192, 192, 192, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(192, 192, 192, 0.5);
}

.leaderboard-table .rank-3 {
    background: rgba(205, 127, 50, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(205, 127, 50, 0.5);
}

.leaderboard-table .rank-1 td,
.leaderboard-table .rank-2 td,
.leaderboard-table .rank-3 td {
    color: white;
}

.leaderboard-table .rank-1 .score,
.leaderboard-table .rank-2 .score,
.leaderboard-table .rank-3 .score {
    color: white;
    font-weight: 700;
}

.no-scores {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    font-family: 'Lexend', sans-serif;
}

/* Player search form removed */

/* Responsive design */
@media (max-width: 768px) {
    .leaderboard-container {
        padding: 10px;
    }

    .leaderboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 20px;
    }

    .leaderboard-controls {
        justify-content: center;
    }

    .leaderboard-table {
        font-size: 12px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
    }

    .leaderboard-table .date,
    .leaderboard-table .mode {
        display: none;
    }

    /* Player search form removed */
}

@media (max-width: 480px) {
    .leaderboard-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .leaderboard-table .accuracy {
        display: none;
    }
}

/* Beginner mode: Hide timer and expand score */
.game-info.beginner-mode .timer {
    display: none !important;
}

.game-info.beginner-mode .score {
    flex: 1 !important;
    justify-content: center !important;
    text-align: center !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
}

.game-info.beginner-mode .stats-container {
    justify-content: stretch !important;
    width: 100% !important;
}

/* Smaller text for beginner, normal, pro, and flag modes */
.game-info.flag-mode .stats-container .timer,
.game-info.beginner-mode .stats-container .timer,
.game-info.normal-mode .stats-container .timer,
.game-info.pro-mode .stats-container .timer,
.game-info.flag-mode .stats-container .score,
.game-info.beginner-mode .stats-container .score,
.game-info.normal-mode .stats-container .score,
.game-info.pro-mode .stats-container .score {
    font-size: 17px !important;
}

.game-info.flag-mode .countries-left-container .countries-left,
.game-info.beginner-mode .countries-left-container .countries-left,
.game-info.normal-mode .countries-left-container .countries-left,
.game-info.pro-mode .countries-left-container .countries-left,
.game-info.flag-mode .countries-left-container .guess-accuracy,
.game-info.beginner-mode .countries-left-container .guess-accuracy,
.game-info.normal-mode .countries-left-container .guess-accuracy,
.game-info.pro-mode .countries-left-container .guess-accuracy {
    font-size: 17px !important;
}

/* Ensure stats container has proper flex layout */
.stats-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Streak Tab (Desktop Only) - Aligned with Game Info Panel */
.streak-tab {
    position: fixed;
    /* Fixed to viewport */
    bottom: 0;
    /* Connect to bottom edge */
    left: 30px;
    /* Align with game info panel left edge */
    width: 320px;
    /* Match game info panel max width */
    transform: translateX(0);
    /* No centering offset needed */
    /* Glassmorphism Effect - matching leaderboard tab style */
    background: rgba(255, 107, 53, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 107, 53, 0.5);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
    border-radius: 20px 20px 0 0;
    /* Rounded top corners only - like a tab */
    padding: 12px 20px 16px 20px;
    /* Extra bottom padding for tab effect */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    opacity: 0;
    transform: translateX(0) translateY(100%);
    /* Start below the viewport */
    pointer-events: none;
    /* Prevent interfering with interactions */
    height: auto;
    /* Let it size naturally */
}

.streak-tab.show {
    opacity: 1;
    transform: translateX(0) translateY(0);
    /* Slide up to visible position */
}

.streak-tab-content {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Center content within the tab */
    gap: 8px;
    color: white;
    font-weight: 500;
    font-size: 20px;
    font-family: 'Lexend', sans-serif;
}

.streak-icon {
    font-size: 16px;
    animation: streakPulse 2s ease-in-out infinite;
}

.streak-text {
    font-family: 'Lexend', sans-serif;
}

@keyframes streakPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Hide streak tab on mobile */
@media (max-width: 768px) {
    .streak-tab {
        display: none !important;
    }
}


/* Desktop: apply the same compact sizing for Correction Opportunity */
@media (min-width: 769px) {
    .correction-opportunity {
        font-size: 0.1em;
        /* scale down inner typography on desktop too */
    }

    .correction-icon {
        font-size: 1em;
    }

    .correction-title {
        font-size: 1em;
    }

    .correction-message {
        font-size: 1em;
    }

    .correction-buttons .correction-btn {
        padding: 12px 20px;
        font-size: 16px;
        line-height: 1;
        min-width: 0;
        border-radius: 20px;
        white-space: nowrap;
    }
}

/* Galaxy S8 specific styles - MUST be at the end to override all other rules */
@media (max-width: 360px) {
    html body div#game-info-container.game-info-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        z-index: 1000 !important;
    }

    html body div#game-info-container.game-info-container .game-info {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 8px !important;
        border-radius: 0 0 12px 12px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: scaleX(1.0) !important;
        /* Scale horizontally to fit viewport */
        transform-origin: left top !important;
    }

    html body div#game-info-container.game-info-container .game-info * {
        max-width: none !important;
        box-sizing: border-box !important;
    }

    html body div#game-info-container.game-info-container .game-info .timer,
    html body div#game-info-container.game-info-container .game-info .score,
    html body div#game-info-container.game-info-container .game-info .countries-left,
    html body div#game-info-container.game-info-container .game-info .guess-accuracy {
        font-size: 0.6em !important;
        padding: 0.5em !important;
    }

    html body div#game-info-container.game-info-container .game-info #neighbors-hint {
        font-size: 0.8em !important;
    }

    html body div#game-info-container.game-info-container .game-info button#next-country,
    html body div#game-info-container.game-info-container .game-info button#reset-game {
        font-size: 0.6em !important;
        padding: 0.5em 1em !important;
    }

    html body div#game-info-container.game-info-container .game-info .stats-container,
    html body div#game-info-container.game-info-container .game-info .countries-left-container {
        gap: 0.05em !important;
        margin: 0.05em 0 !important;
    }

    html body div#game-info-container.game-info-container .game-info h2 {
        margin-bottom: 0.05em !important;
    }

    html body div#game-info-container.game-info-container .game-info div {
        margin: 0.05em 0 !important;
    }

    html body div#game-info-container.game-info-container .game-info .button-group {
        gap: 0.05em !important;
        margin-top: 0.05em !important;
    }

    html body div#game-info-container.game-info-container .game-info #country-to-guess {
        font-size: 1.5em !important;
    }

    html body .globe-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        transform: none !important;
    }

    html body #globe {
        position: absolute !important;
        top: 25vh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 75vh !important;
        transform: none !important;
    }

    /* Galaxy S8 Facts Panel - Bottom Tab Implementation */
    html body #right-panel.right-panel {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 100% !important;
        height: 50px !important;
        margin: 0 !important;
        padding: 12px !important;
        transform: none !important;
        /* Enhanced Glassmorphism Effect for mobile */
        background: rgba(30, 30, 30, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
        border-radius: 28px 28px 0 0 !important;
        z-index: 1000 !important;
        overflow: hidden !important;
        transition: height 0.4s ease-in-out, border-radius 0.4s ease-in-out !important;
    }

    /* Show mobile panel only when not hidden */
    html body #right-panel.right-panel:not(.hidden) {
        display: block !important;
    }

    /* Hide mobile panel when hidden class is applied */
    html body #right-panel.right-panel.hidden {
        display: none !important;
    }

    html body #right-panel.right-panel.expanded {
        height: 85vh !important;
        border-radius: 28px 28px 0 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* Panel Toggle Button for Galaxy S8 */
    html body #right-panel.right-panel .panel-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 50px !important;
        background: rgba(40, 40, 40, 0.2) !important;
        border: none !important;
        border-radius: 20px !important;
        color: white !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        margin-bottom: 8px !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    html body #right-panel.right-panel .panel-toggle:hover {
        background: rgba(50, 50, 50, 0.3) !important;
        transform: translateY(-1px) !important;
    }

    html body #right-panel.right-panel:not(.expanded) .panel-content {
        display: none !important;
    }

    /* Ensure proper flexbox structure for Galaxy S8 facts panel */
    html body #right-panel.right-panel.expanded .panel-toggle {
        flex-shrink: 0 !important;
        margin-bottom: 8px !important;
    }

    html body #right-panel.right-panel.expanded .flag-container {
        flex-shrink: 0 !important;
    }

    html body #right-panel.right-panel.expanded .country-facts-scroll {
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px !important;
        padding-bottom: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent !important;
    }

    html body #right-panel.right-panel .flag-container {
        margin-top: 8px !important;
        padding: 16px !important;
        margin-bottom: 14px !important;
        border-radius: 18px !important;
    }

    html body #right-panel.right-panel .flag-container h3 {
        font-size: 1.4em !important;
        margin-bottom: 8px !important;
    }

    html body #right-panel.right-panel .flag-container img {
        max-height: 80px !important;
        margin-top: 5px !important;
    }

    html body #right-panel.right-panel .country-facts {
        font-size: 12px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar {
        display: block !important;
        width: 6px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-track {
        background: transparent !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3) !important;
        border-radius: 3px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5) !important;
    }

    html body #right-panel.right-panel .fact-group h4 {
        font-size: 15px !important;
        margin-top: 15px !important;
        margin-bottom: 5px !important;
        padding-bottom: 3px !important;
        border-bottom: 1px solid #555 !important;
    }

    html body #right-panel.right-panel .fact-group p {
        margin: 5px 0 !important;
    }
}

/* iPhone SE specific styles - prevent inheritance conflicts */
@media (max-width: 375px) and (max-height: 667px) {
    .game-info-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        min-width: 100vw !important;
        max-width: 100vw !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        transform: none !important;
        border-radius: 0 !important;
        overflow: hidden !important;
        z-index: 1000 !important;
        transform: scaleX(1.0) !important;
        /* Scale horizontally to fit viewport */

    }

    .game-info {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 10px !important;
        border-radius: 0 0 12px 12px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
        left: 0 !important;
        right: 0 !important;
        transform: scaleX(1.0) !important;
        /* Scale horizontally to fit viewport */
        transform-origin: left top !important;
    }

    .game-info * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .game-info .timer,
    .game-info .score,
    .game-info .countries-left,
    .game-info .guess-accuracy {
        font-size: 0.65em !important;
        padding: 0.6em !important;
    }

    .game-info #neighbors-hint {
        font-size: 0.85em !important;
    }

    .game-info button#next-country,
    .game-info button#reset-game {
        font-size: 0.65em !important;
        padding: 0.6em 1.2em !important;
    }

    .game-info .stats-container,
    .game-info .countries-left-container {
        gap: 0.08em !important;
        margin: 0.08em 0 !important;
    }

    .game-info h2 {
        margin-bottom: 0.08em !important;
    }

    .game-info div {
        margin: 0.08em 0 !important;
    }

    .game-info .button-group {
        gap: 0.08em !important;
        margin-top: 0.08em !important;
    }

    .game-info #country-to-guess {
        font-size: 1.8em !important;
    }

    .globe-container {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        transform: none !important;
    }

    #globe {
        position: absolute !important;
        top: 25vh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        height: 75vh !important;
        transform: none !important;
    }

    /* iPhone SE Facts Panel - Bottom Tab Implementation */
    html body #right-panel.right-panel {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 100% !important;
        height: 50px !important;
        margin: 0 !important;
        padding: 12px !important;
        transform: none !important;
        /* Enhanced Glassmorphism Effect for mobile */
        background: rgba(30, 30, 30, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
        border-radius: 28px 28px 0 0 !important;
        z-index: 1000 !important;
        overflow: hidden !important;
        transition: height 0.4s ease-in-out, border-radius 0.4s ease-in-out !important;
    }

    /* Show mobile panel only when not hidden */
    html body #right-panel.right-panel:not(.hidden) {
        display: block !important;
    }

    /* Hide mobile panel when hidden class is applied */
    html body #right-panel.right-panel.hidden {
        display: none !important;
    }

    html body #right-panel.right-panel.expanded {
        height: 85vh !important;
        border-radius: 28px 28px 0 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* Panel Toggle Button for iPhone SE */
    html body #right-panel.right-panel .panel-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 50px !important;
        background: rgba(40, 40, 40, 0.2) !important;
        border: none !important;
        border-radius: 20px !important;
        color: white !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        transition: all 0.3s ease !important;
        margin-bottom: 8px !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    html body #right-panel.right-panel .panel-toggle:hover {
        background: rgba(50, 50, 50, 0.3) !important;
        transform: translateY(-1px) !important;
    }

    html body #right-panel.right-panel:not(.expanded) .panel-content {
        display: none !important;
    }

    /* Ensure proper flexbox structure for iPhone SE facts panel */
    html body #right-panel.right-panel.expanded .panel-toggle {
        flex-shrink: 0 !important;
        margin-bottom: 8px !important;
    }

    html body #right-panel.right-panel.expanded .flag-container {
        flex-shrink: 0 !important;
    }

    html body #right-panel.right-panel.expanded .country-facts-scroll {
        flex: 1 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px !important;
        padding-bottom: 20px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent !important;
    }

    html body #right-panel.right-panel .flag-container {
        margin-top: 8px !important;
        padding: 16px !important;
        margin-bottom: 14px !important;
        border-radius: 18px !important;
    }

    html body #right-panel.right-panel .flag-container h3 {
        font-size: 1.4em !important;
        margin-bottom: 8px !important;
    }

    html body #right-panel.right-panel .flag-container img {
        max-height: 80px !important;
        margin-top: 5px !important;
    }

    html body #right-panel.right-panel .country-facts {
        font-size: 12px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar {
        display: block !important;
        width: 6px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-track {
        background: transparent !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3) !important;
        border-radius: 3px !important;
    }

    html body #right-panel.right-panel .country-facts-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5) !important;
    }

    html body #right-panel.right-panel .fact-group h4 {
        font-size: 15px !important;
        margin-top: 15px !important;
        margin-bottom: 5px !important;
        padding-bottom: 3px !important;
        border-bottom: 1px solid #555 !important;
    }

    html body #right-panel.right-panel .fact-group p {
        margin: 5px 0 !important;
    }
}

/* Mobile Facts Panel - Bottom Tab Implementation */
@media (max-width: 768px) {
    .right-panel {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        width: 100% !important;
        height: 50px !important;
        margin: 0 !important;
        padding: 12px !important;
        transform: none !important;
        /* Enhanced Glassmorphism Effect for mobile */
        background: rgba(30, 30, 30, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
        border-radius: 28px 28px 0 0 !important;
        z-index: 1000 !important;
        overflow: hidden !important;
        transition: height 0.4s ease-in-out, border-radius 0.4s ease-in-out !important;
        /* Simple, working animation */
    }

    /* Show mobile panel only when not hidden */
    .right-panel:not(.hidden) {
        display: block !important;
    }

    /* Hide mobile panel when hidden class is applied */
    .right-panel.hidden {
        display: none !important;
    }

    .right-panel.expanded {
        height: 85vh !important;
        /* Increased height to accommodate all content */
        border-radius: 28px 28px 0 0 !important;
        /* Keep rounded corners */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding: 12px !important;
        /* Ensure proper padding for all content */
        box-sizing: border-box !important;
        /* Include padding in height calculation */
    }

    /* Panel Toggle Button */
    .panel-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 50px;
        background: rgba(40, 40, 40, 0.2);
        border: none;
        border-radius: 20px;
        color: white;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-bottom: 8px;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .panel-toggle:hover {
        background: rgba(50, 50, 50, 0.3);
        transform: translateY(-1px);
    }

    .right-panel:not(.expanded) .panel-content {
        display: none;
    }

    /* Hide facts panel content when not expanded - mobile */
    .right-panel:not(.expanded) #flag-container,
    .right-panel:not(.expanded) #country-facts,
    .right-panel:not(.expanded) #ad-container {
        display: none !important;
    }

    /* Ensure proper flexbox structure for mobile facts panel */
    .right-panel.expanded .panel-toggle {
        flex-shrink: 0;
        /* Don't shrink the toggle button */
        margin-bottom: 8px;
        /* Small margin below toggle */
    }

    .right-panel.expanded .flag-container {
        flex-shrink: 0;
        /* Don't shrink the flag container */
    }

    .right-panel.expanded .country-facts-scroll {
        flex: 1;
        /* Take remaining space */
        min-height: 0;
        /* Allow flex item to shrink */
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 8px;
        padding-bottom: 20px;
        -webkit-overflow-scrolling: touch;
        /* Mobile: Show scrollbars only when needed */
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    }

    .right-panel .flag-container {
        margin-top: 8px;
        padding: 6px;
        margin-bottom: 14px;
        border-radius: 12px;
    }

    .right-panel .flag-container h3 {
        font-size: 1.4em;
        margin-bottom: 8px;
    }

    .right-panel .flag-container img {
        max-height: 120px;
        margin-top: 5px;
    }

    .right-panel .country-facts {
        font-size: 12px;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar {
        display: block;
        width: 6px;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }

    .right-panel .country-facts-scroll::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }

    .right-panel .fact-group h4 {
        font-size: 15px;
        margin-top: 15px;
        margin-bottom: 5px;
        padding-bottom: 3px;
        border-bottom: 1px solid #555;
    }

    .right-panel .fact-group p {
        margin: 5px 0;
    }

    #country-to-guess {
        margin: 2px 0 !important;
    }

    .game-info h2 {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .right-panel .flag-container h3 {
        font-size: 1.4em;
        margin-bottom: 8px;
    }

    .right-panel .flag-container img {
        max-height: 120px;
        margin-top: 5px;
    }

    .panel-handle {
        width: 50px;
        height: 6px;
        background: #ccc;
        border-radius: 3px;
        margin: 10px auto;
        cursor: pointer;
    }
}

/* Additional mobile device rules for body.mobile-device and html[data-viewport="mobile"] */
body.mobile-device .right-panel,
html[data-viewport="mobile"] .right-panel {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 100% !important;
    height: 50px !important;
    margin: 0 !important;
    padding: 12px !important;
    transform: none !important;
    background: rgba(30, 30, 30, 0.25) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
    border-radius: 28px 28px 0 0 !important;
    z-index: 1000 !important;
    overflow: hidden !important;
    transition: height 0.4s ease-in-out, border-radius 0.4s ease-in-out !important;
}

body.mobile-device .right-panel:not(.hidden),
html[data-viewport="mobile"] .right-panel:not(.hidden) {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

body.mobile-device .right-panel.hidden,
html[data-viewport="mobile"] .right-panel.hidden {
    display: none !important;
}

body.mobile-device .right-panel.expanded,
html[data-viewport="mobile"] .right-panel.expanded {
    height: 60vh !important;
    border-radius: 28px 28px 0 0 !important;
}

/* Hide facts panel content when not expanded - mobile device rules */
body.mobile-device .right-panel:not(.expanded) #flag-container,
body.mobile-device .right-panel:not(.expanded) #country-facts,
body.mobile-device .right-panel:not(.expanded) #ad-container,
html[data-viewport="mobile"] .right-panel:not(.expanded) #flag-container,
html[data-viewport="mobile"] .right-panel:not(.expanded) #country-facts,
html[data-viewport="mobile"] .right-panel:not(.expanded) #ad-container {
    display: none !important;
}

/* Hide country label after guess - important to override other styles */
#country-to-guess.hidden-after-guess {
    display: none !important;
}

/* Leaderboard Styles */
.leaderboard-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    color: white;
    font-family: 'Open Sans', sans-serif;
}

.leaderboard-container.hidden {
    display: none;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.8);
}

.leaderboard-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.leaderboard-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.leaderboard-tab {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.leaderboard-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.leaderboard-tab.active {
    background: rgba(76, 175, 80, 0.8);
    border-color: rgba(76, 175, 80, 1);
    color: white;
}

.leaderboard-tabs-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.leaderboard-tabs-column {
    display: flex;
    justify-content: space-evenly;
    gap: 10px;
    width: 100%;
}

.leaderboard-tabs-row {
    display: flex;
    justify-content: center;
    width: 100%;
}

.leaderboard-close {
    background: rgba(244, 67, 54, 0.8);
    border: 1px solid rgba(244, 67, 54, 1);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-close:hover {
    background: rgba(244, 67, 54, 1);
    transform: scale(1.1);
}

.leaderboard-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.leaderboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    display: block;
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #4CAF50;
}

/* Removed duplicate leaderboard styles - using main styles above */

.rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 193, 7, 0.1));
    border-left: 4px solid #FFD700;
}

.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(158, 158, 158, 0.1));
    border-left: 4px solid #C0C0C0;
}

.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(184, 115, 51, 0.1));
    border-left: 4px solid #CD7F32;
}

.no-scores {
    text-align: center;
    padding: 40px;
    opacity: 0.7;
    font-style: italic;
}

/* Player search form removed */

/* Mobile Responsive */
@media (max-width: 768px) {
    .leaderboard-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .leaderboard-controls {
        justify-content: center;
        gap: 8px;
    }

    .leaderboard-tab {
        padding: 6px 12px;
        font-size: 12px;
    }

    .leaderboard-content {
        padding: 15px;
    }

    .leaderboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 20px;
    }

    .stat-item {
        padding: 12px;
    }

    .stat-value {
        font-size: 20px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .player-name {
        max-width: 100px;
    }

    .country {
        max-width: 80px;
        font-size: 11px;
    }

    /* Player search form removed */
}

/* High Score Modal Styles */
.highscore-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: highscoreModalAppear 0.5s ease-out;
}

.highscore-modal.closing {
    animation: highscoreModalDisappear 0.3s ease-in forwards;
}

@keyframes highscoreModalAppear {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes highscoreModalDisappear {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }

    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
}

.highscore-modal-content {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 193, 7, 0.9));
    border: 3px solid #FFD700;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    text-align: center;
    color: #333;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 40px;
}

/* Custom scrollbar for high score modal */
.highscore-modal-content::-webkit-scrollbar {
    width: 8px;
}

.highscore-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.highscore-modal-content::-webkit-scrollbar-thumb {
    background: rgba(184, 134, 11, 0.8);
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.highscore-modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 134, 11, 1);
}

/* Firefox scrollbar */
.highscore-modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(184, 134, 11, 0.8) rgba(255, 255, 255, 0.2);
}

.highscore-modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.highscore-header {
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.highscore-icon {
    font-size: 60px;
    margin-bottom: 10px;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.highscore-header h2 {
    margin: 0;
    font-size: 32px;
    font-weight: 900;
    color: #B8860B;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 5px;
}

.highscore-subtitle {
    font-size: 18px;
    font-weight: 600;
    color: #8B6914;
    margin-bottom: 0;
}

.highscore-stats {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
    z-index: 1;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 16px;
}

.stat-row:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 600;
    color: #666;
}

.stat-value {
    font-weight: 700;
    color: #2E7D32;
    font-size: 18px;
}

.highscore-form {
    position: relative;
    z-index: 1;
}

.highscore-form label {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #8B6914;
    margin-bottom: 15px;
}

#highscore-name-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #FFD700;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

#highscore-name-input:focus {
    outline: none;
    border-color: #B8860B;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

#highscore-name-input::placeholder {
    color: #999;
    font-weight: 400;
}

.highscore-country-select {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #FFD700;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    margin-bottom: 20px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    cursor: pointer;
}

.highscore-country-select:focus {
    outline: none;
    border-color: #B8860B;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.highscore-country-select option {
    padding: 10px;
    font-size: 16px;
    background: white;
    color: #333;
}

.highscore-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.highscore-save-btn,
.highscore-skip-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.highscore-save-btn {
    background: linear-gradient(135deg, #4CAF50, #45A049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.highscore-save-btn:hover {
    background: linear-gradient(135deg, #45A049, #3D8B40);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.highscore-skip-btn {
    background: linear-gradient(135deg, #757575, #616161);
    color: white;
    box-shadow: 0 4px 15px rgba(117, 117, 117, 0.4);
}

.highscore-skip-btn:hover {
    background: linear-gradient(135deg, #616161, #424242);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(117, 117, 117, 0.6);
}

/* Celebration Effects */
.highscore-celebration {
    animation: screenFlash 0.5s ease-out;
}

@keyframes screenFlash {
    0% {
        background-color: rgba(255, 255, 255, 0);
    }

    50% {
        background-color: rgba(255, 255, 255, 0.3);
    }

    100% {
        background-color: rgba(255, 255, 255, 0);
    }
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1999;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.highscore-success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #4CAF50, #45A049);
    color: white;
    padding: 15px 30px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 18px;
    z-index: 2001;
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.5);
    animation: successMessageAppear 0.5s ease-out;
}

@keyframes successMessageAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.success-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-icon {
    font-size: 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .highscore-modal-content {
        padding: 20px;
        margin: 20px;
        max-width: none;
        max-height: 95vh;
    }

    .highscore-header h2 {
        font-size: 24px;
    }

    .highscore-subtitle {
        font-size: 16px;
    }

    .highscore-icon {
        font-size: 40px;
    }

    .highscore-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .highscore-save-btn,
    .highscore-skip-btn {
        min-width: auto;
        width: 100%;
    }

    .stat-row {
        font-size: 14px;
    }

    .stat-value {
        font-size: 16px;
    }
}

/* Mobile leaderboard header fix */
@media (max-width: 768px) {
    .leaderboard-header h2 {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        font-size: 24px !important;
        margin-bottom: 8px !important;
    }

    .leaderboard-controls {
        width: 100% !important;
    }

    .leaderboard-stats {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
        padding: 8px !important;
        margin-bottom: 12px !important;
    }

    .stat-item {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: left !important;
        padding: 6px 10px !important;
        background: rgba(30, 30, 30, 0.3) !important;
        border-radius: 8px !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .stat-label {
        font-size: 14px !important;
        margin-bottom: 0 !important;
    }

    .stat-value {
        font-size: 18px !important;
    }

    .leaderboard-table-container {
        /* max-height: 300px !important; */
        overflow-y: auto !important;
        overflow-x: auto !important;
    }

    .leaderboard-table {
        font-size: 12px !important;
        min-width: 100% !important;
        table-layout: fixed !important;
        width: 900px !important;
        /* Increased width to prevent cutoff */
    }

    .leaderboard-table th {
        padding: 6px 4px !important;
        text-align: center !important;
        font-size: 10px !important;
        font-weight: 600 !important;
    }

    .leaderboard-table td {
        padding: 6px 4px !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .leaderboard-table th:nth-child(1),
    .leaderboard-table td:nth-child(1) {
        width: 10% !important;
        /* RANK */
        text-align: center !important;
    }

    .leaderboard-table th:nth-child(2),
    .leaderboard-table td:nth-child(2) {
        width: 18% !important;
        /* PLAYER */
        text-align: left !important;
    }

    .leaderboard-table th:nth-child(3),
    .leaderboard-table td:nth-child(3) {
        width: 12% !important;
        /* COUNTRY FLAG */
        text-align: center !important;
    }

    .leaderboard-table th:nth-child(4),
    .leaderboard-table td:nth-child(4) {
        width: 20% !important;
        /* SCORE */
        text-align: center !important;
    }

    .leaderboard-table th:nth-child(5),
    .leaderboard-table td:nth-child(5) {
        width: 15% !important;
        /* ACCURACY */
        text-align: center !important;
    }

    .leaderboard-table th:nth-child(6),
    .leaderboard-table td:nth-child(6) {
        width: 25% !important;
        /* DATE */
        text-align: center !important;
    }

    .leaderboard-table .mode {
        display: none !important;
    }

    /* Show date column on mobile */
    .leaderboard-table .date {
        display: table-cell !important;
    }

    .leaderboard-table .rank {
        text-align: center !important;
        font-size: 11px !important;
    }

    .leaderboard-table .player-name {
        text-align: left !important;
        font-size: 11px !important;
        max-width: 120px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .leaderboard-table .country {
        text-align: center !important;
        font-size: 11px !important;
    }

    .leaderboard-table .score {
        text-align: center !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        background: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .leaderboard-table .accuracy {
        text-align: center !important;
        font-size: 10px !important;
    }

    .leaderboard-table .date {
        text-align: center !important;
        font-size: 10px !important;
    }

    /* Country styling for mobile */
    .leaderboard-table .country-cell {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }

    .leaderboard-table .country-name {
        display: block !important;
        font-size: 10px !important;
        color: white !important;
        text-align: center !important;
        margin: 0 !important;
        line-height: 1.1 !important;
    }
}

/* Desktop country display */
.leaderboard-table .country-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.leaderboard-table .country-name {
    display: block;
    font-size: 12px;
    color: white;
    text-align: center;
    margin: 0;
    line-height: 1.2;
}

/* Desktop alignment fixes */
.leaderboard-table th {
    text-align: center !important;
}

.leaderboard-table th:nth-child(2) {
    text-align: left !important;
    /* PLAYER column left-aligned */
}

.leaderboard-table td {
    text-align: center !important;
}

.leaderboard-table td:nth-child(2) {
    text-align: left !important;
    /* PLAYER column left-aligned */
}

/* Fix specific column classes */
.leaderboard-table .rank {
    text-align: center !important;
}

.leaderboard-table .player-name {
    text-align: left !important;
}

.leaderboard-table .country {
    text-align: center !important;
}

.leaderboard-table .score {
    text-align: center !important;
}

.leaderboard-table .accuracy {
    text-align: center !important;
}

.leaderboard-table .date {
    text-align: center !important;
}

/* Leaderboard Mode Heading */
.leaderboard-mode-heading {
    text-align: center;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(30, 30, 30, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.leaderboard-mode-heading h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
    font-family: 'Lexend', sans-serif;
}

/* Two-Column Leaderboard Layout */
.leaderboard-container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
}

.leaderboard-left-column {
    width: 200px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    padding: 0;
    align-items: center;


}

.leaderboard-right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.leaderboard-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.leaderboard-controls {
    flex: 1;
    padding: 20px;
    overflow: visible;
    justify-content: center;
}

.leaderboard-tabs-stacked {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-tabs-stacked .leaderboard-tab {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    justify-content: flex-start;
}

.leaderboard-exit {
    width: 100%;
    padding: 12px 16px;
    text-align: center;
    justify-content: center;
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #dc3545;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-family: 'Lexend', sans-serif;
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.leaderboard-exit:hover {
    background: rgba(220, 53, 69, 0.3);
    border-color: rgba(220, 53, 69, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.leaderboard-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    height: 100%;
}

/* Mobile Leaderboard - Optimized for Small Screens */
@media (max-width: 768px) {

    /* Ultra-compact single-column layout for mobile */
    .leaderboard-container {
        flex-direction: column !important;
        padding: 5px;
        height: 100vh !important;
        overflow: hidden !important;
    }

    .leaderboard-left-column {
        width: 100% !important;
        background: rgba(30, 30, 30, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
        border-radius: 16px !important;
        margin-bottom: 8px !important;
        border-right: none !important;
    }

    .leaderboard-right-column {
        width: 100% !important;
        height: auto !important;
    }

    .leaderboard-header {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        background: rgba(30, 30, 30, 0.35) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        border-radius: 16px 16px 0 0 !important;
    }

    .leaderboard-header h2 {
        font-size: 18px !important;
        margin: 0 !important;
        flex: 1;
    }

    .leaderboard-controls {
        justify-content: center;
        padding: 12px 16px !important;
        background: rgba(30, 30, 30, 0.2) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .leaderboard-tabs-stacked {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
    }

    .leaderboard-tabs-stacked .leaderboard-tab {
        text-align: center !important;
        justify-content: center !important;
        padding: 8px 4px !important;
        font-size: 11px !important;
        min-height: 32px !important;
    }

    .leaderboard-exit {
        grid-column: auto !important;
        margin-top: 0 !important;
        padding: 8px !important;
        font-size: 12px !important;
        min-height: 32px !important;
    }

    .leaderboard-content {
        background: rgba(30, 30, 30, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37) !important;
        border-radius: 0 0 16px 16px !important;
        height: calc(100vh - 100px) !important;
        overflow: hidden !important;
        padding: 12px 12px 8px 12px !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .leaderboard-mode-heading {
        margin-bottom: 8px !important;
        padding: 8px !important;
    }

    .leaderboard-mode-heading h3 {
        font-size: 16px !important;
        margin: 0 !important;
    }

    .leaderboard-stats {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .leaderboard-stats .stat-item {
        padding: 6px !important;
        font-size: 11px !important;
    }

    .leaderboard-stats .stat-label {
        font-size: 10px !important;
    }

    .leaderboard-stats .stat-value {
        font-size: 12px !important;
    }

    .leaderboard-table {
        font-size: 10px !important;
        min-width: 100% !important;
        width: max-content !important;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 4px 2px !important;
        white-space: nowrap !important;
    }

    .leaderboard-table .rank {
        width: 25px !important;
        min-width: 25px !important;
    }

    .leaderboard-table .player-name {
        width: 70px !important;
        min-width: 70px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .leaderboard-table .country {
        width: 50px !important;
        min-width: 50px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .leaderboard-table .score {
        width: 45px !important;
        min-width: 45px !important;
        font-size: 10px !important;
        text-align: right !important;
    }

    .leaderboard-table .accuracy {
        display: none !important;
    }

    .leaderboard-table .date {
        display: none !important;
    }

    .leaderboard-table-container {
        padding-bottom: 12px !important;
        height: calc(100% - 60px) !important;
        overflow-y: auto !important;
        overflow-x: auto !important;
        display: flex !important;
        flex-direction: column !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .leaderboard-table {
        flex: 1 !important;
        min-height: 0 !important;
    }

    /* Custom scrollbar for mobile leaderboard */
    .leaderboard-content::-webkit-scrollbar {
        width: 4px;
    }

    .leaderboard-content::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
    }

    .leaderboard-content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .leaderboard-content::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }

    /* Custom scrollbar for table container */
    .leaderboard-table-container::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    .leaderboard-table-container::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 2px;
    }

    .leaderboard-table-container::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .leaderboard-table-container::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Main Content Section Styling */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.hero-section {
    text-align: center;
    margin-bottom: 50px;
}

.hero-section h2 {
    font-size: 2.5em;
    color: #fff;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-description {
    font-size: 1.2em;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

.game-modes-section h3,
.accessibility-section h3,
.educational-benefits h3,
.stats-section h3 {
    font-size: 2em;
    color: #fff;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s ease;
}

.mode-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.mode-card h4 {
    font-size: 1.4em;
    color: #70ccd8;
    margin-bottom: 15px;
    font-weight: 600;
}

.mode-card p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    font-size: 1em;
}

.accessibility-features {
    display: grid;
    gap: 20px;
    margin-bottom: 40px;
}

.feature-item {
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid #70ccd8;
    padding: 20px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.feature-item strong {
    color: #70c38d;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.benefit-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.benefit-item h4 {
    font-size: 1.3em;
    color: #70c38d;
    margin-bottom: 15px;
    font-weight: 600;
}

.benefit-item p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
}

.stats-section {
    margin-top: 50px;
}

.stats-grid {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 30px 25px;
    min-width: 150px;
}

.stat-number {
    font-size: 3em;
    font-weight: 700;
    color: #70ccd8;
    margin-bottom: 10px;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
    font-weight: 500;
}

/* Educational Info Section (Secondary Content) */
.educational-info {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 30px 25px;
    margin-top: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.info-section h3 {
    color: #fff;
    font-size: 1.8em;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
}

.info-section>p {
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    margin-bottom: 25px;
    line-height: 1.6;
}

.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.highlight-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.highlight-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.highlight-item h4 {
    color: #70ccd8;
    font-size: 1.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

.highlight-item p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    font-size: 0.95em;
}

/* Brief intro text styling */
.intro-text {
    text-align: center;
    margin-bottom: 20px;
}

.intro-text p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1em;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .educational-info {
        padding: 25px 20px;
        margin-top: 25px;
    }

    .info-section h3 {
        font-size: 1.5em;
    }

    .highlights-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .highlight-item {
        padding: 18px;
    }

    .intro-text p {
        font-size: .7em;
    }
}
}