/* Mobile-first responsive design */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
    /* Prevent zoom on mobile */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    /* Improve mobile scrolling */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Animated background with floating particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: floatingParticles 20s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes floatingParticles {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% { 
        transform: translate(10px, -10px) scale(1.1);
        opacity: 0.5;
    }
    50% { 
        transform: translate(-5px, 10px) scale(0.9);
        opacity: 0.4;
    }
    75% { 
        transform: translate(-10px, -5px) scale(1.05);
        opacity: 0.6;
    }
}

.container {
    /* Mobile-first: full width with minimal padding */
    width: 100%;
    padding: 6px;
    min-height: 100vh;
    /* Allow natural scrolling - removed max-height and overflow constraints */
}

.header {
    text-align: center;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 20px; /* Better proportions */
    padding-right: 80px; /* Reduced padding to give more space for button */
    gap: 24px; /* Better spacing following 8px grid */
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
    min-height: 60px;
}

.header-right {
    display: flex;
    flex-direction: column; /* Stack buttons vertically */
    align-items: center;
    justify-content: flex-start;
    flex-shrink: 0;
    min-width: 60px; /* Just enough for the small circular button */
    gap: 8px; /* Space between buttons if we add more */
}

.logo-section {
    flex-shrink: 0;
}

.brand-logo {
    width: 100px !important; /* Made slightly smaller to not exceed menu overlay */
    height: 100px !important; /* Made slightly smaller to not exceed menu overlay */
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.brand-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 48px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Performance progress bar below total rank */
.game-progress-container {
    display: none; /* Initially hidden, shows when game starts */
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s ease;
}

.game-progress-container:not([style*="display: none"]) {
    opacity: 1;
    transform: translateY(0);
}

.game-progress-bar {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #22c55e; /* Start with green */
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
}

.progress-label {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-action {
    display: flex;
    justify-content: center;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Animation states for game action */
.game-action.slide-to-right {
    transform: translateX(200px);
}

/* Header center - button centered, best score positioned absolutely below */
.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
    min-height: 60px;
}

.header-center .game-action {
    position: relative;
    z-index: 2;
}

.header-center .best-score-container {
    position: absolute;
    top: 100%; /* Position below the button */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    margin-top: 8px; /* 8px grid spacing */
    pointer-events: none; /* Don't interfere with clicks */
}

/* Total rank display - includes performance bar below */
.total-rank-display {
    display: none; /* Initially hidden */
    flex-direction: column;
    align-items: center;
    gap: 8px; /* Space between rank and performance */
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 140px;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.total-rank-display.show {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

/* Removed start button and reset button - using replay button in overlay instead */

/* Faster rotation animation for smaller button */
@keyframes rotateSymbol {
    0% { transform: translateY(-2px) scale(1.1) rotate(0deg); }
    100% { transform: translateY(-2px) scale(1.1) rotate(360deg); }
}

.rank-label {
    font-size: 0.8rem; /* Slightly smaller */
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-align: center;
}

.rank-value {
    font-size: 1.4rem; /* Made slightly bigger */
    color: #ffeb3b;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    text-align: center;
}

.rank-value.updated {
    transform: scale(1.1);
    color: #4ade80;
}

.game-action-center {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.game-action {
    display: flex;
    justify-content: flex-start;
}

.logo-section {
    margin-bottom: 10px;
}

/* Vertical Menu System */
.header-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 50;
}

.vertical-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Base button styling for all menu items */
.vertical-menu > button,
.settings-container > button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px;
    font-size: 1.1rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
}

.vertical-menu > button:hover,
.settings-container > button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

.vertical-menu > button:active,
.settings-container > button:active {
    transform: translateY(-1px) scale(0.98);
    transition: transform 0.1s ease;
}

/* Professional shine effect */
.vertical-menu > button::before,
.settings-container > button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.vertical-menu > button:hover::before,
.settings-container > button:hover::before {
    left: 100%;
}

/* Settings Container with Sliding Menu */
.settings-container {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-menu {
    position: absolute;
    top: 0;
    right: 60px; /* Position to the left of settings button */
    display: flex !important;
    flex-direction: row !important; /* Force horizontal layout on all devices */
    gap: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    align-items: center;
    white-space: nowrap; /* Prevent wrapping */
    flex-wrap: nowrap !important; /* Never allow wrapping */
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Settings menu buttons */
.settings-menu button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px;
    font-size: 1rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.25);
    backdrop-filter: blur(8px);
    flex-shrink: 0 !important; /* Prevent shrinking */
    min-width: 44px !important; /* Ensure minimum width */
}

.settings-menu button:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

.settings-menu button:active {
    transform: translateY(0) scale(0.96);
    transition: transform 0.1s ease;
}

/* Professional toggle state styling */
.settings-menu .sound-toggle.muted,
.settings-menu .country-toggle.hidden-mode,
.settings-menu .hints-toggle.disabled-mode {
    background: linear-gradient(135deg, #e53e3e, #c53030);
    box-shadow: 0 3px 12px rgba(229, 62, 62, 0.25);
}

.settings-menu .sound-toggle.muted:hover,
.settings-menu .country-toggle.hidden-mode:hover,
.settings-menu .hints-toggle.disabled-mode:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4);
}

/* Dynamic button - TikTok initially, then Replay when game starts */
.dynamic-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.dynamic-button[data-mode="tiktok"] {
    background: linear-gradient(135deg, #ff0050, #ff4081) !important;
}

.dynamic-button[data-mode="tiktok"]:hover {
    background: linear-gradient(135deg, #e6004a, #e63675) !important;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 0, 80, 0.4);
}

.dynamic-button[data-mode="replay"]:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%) !important;
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

/* Help button special styling */
.help-button {
    background: linear-gradient(135deg, #4299e1, #3182ce) !important;
}

.help-button:hover {
    background: linear-gradient(135deg, #3182ce, #2c5aa0) !important;
    transform: translateY(-3px) scale(1.05);
}

/* Coffee button special styling */
.coffee-button {
    background: linear-gradient(135deg, #ff813f, #ff6b35) !important;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    margin: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 129, 63, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
}

.coffee-button:hover {
    background: linear-gradient(135deg, #ff6b35, #ff5722) !important;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 129, 63, 0.4);
}

.coffee-button .coffee-icon {
    font-size: 20px;
    color: white;
}

/* Icon sizing */
.toggle-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Force horizontal layout on mobile devices */
@media screen and (max-width: 768px), screen and (hover: none) {
    .settings-menu {
        flex-direction: row !important;
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
    }
    
    .settings-menu button {
        flex-shrink: 0 !important;
    }
}

/* Mobile Responsive - Consistent behavior, just smaller sizes */
@media (max-width: 768px) {
    /* Mobile fix - prevent category box overlap by removing scaling */
    .category-item.category-box.selected {
        transform: none !important; /* Remove scaling to prevent overlap */
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        animation: none; /* Remove animation that causes scaling */
    }
    
    .category-item.category-box.selected:active {
        transform: none !important;
    }
    
    .header-controls {
        top: 10px;
        right: 10px;
    }
    
    /* Mobile header adjustments */
    .header-content {
        padding: 15px 20px;
        padding-right: 80px; /* Less padding on mobile */
        gap: 15px;
        align-items: center;
    }
    
    .header-left {
        gap: 10px;
    }
    
    .header-center {
        margin-right: 10px; /* Less margin on mobile */
    }
    
    .brand-logo {
        width: 100px; /* Adjusted for mobile */
        height: 100px; /* Adjusted for mobile */
    }
    
    .start-button, .reset-button {
        font-size: 0.9rem;
        padding: 8px 16px;
        min-width: 100px;
    }
    
    .total-rank-display {
        padding: 10px 12px;
    }
    
    .rank-label {
        font-size: 0.8rem;
    }
    
    .rank-value {
        font-size: 1.2rem;
    }
    
    .rank-progress {
        width: 100px;
        height: 5px;
    }
    
    .vertical-menu {
        gap: 6px;
    }
    
    .vertical-menu > button,
    .settings-container > button {
        width: 42px;
        height: 42px;
        padding: 10px;
        font-size: 1rem;
    }
    
    .settings-menu {
        right: 54px !important;
        gap: 6px;
        flex-direction: row !important; /* Force horizontal */
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    .settings-menu button {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        padding: 10px;
        font-size: 0.9rem;
        flex-shrink: 0 !important;
        display: flex !important;
    }
}

/* Horizontal header mobile responsive styles */
@media (max-width: 768px) {
    .header-content {
        padding: 15px 20px;
        gap: 15px;
    }
    
    .brand-logo {
        width: 100px;
        height: 100px;
    }
    
    .logo-section {
        margin-bottom: 5px;
    }
    
    .score-display {
        font-size: 14px;
    }
    
    .score-value {
        font-size: 16px !important;
    }
    
    .start-btn, .reset-btn, .back-btn {
        padding: 8px 16px;
        font-size: 14px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    /* Smaller mobile header */
    .header-content {
        padding: 12px 15px;
        padding-right: 70px; /* Even less padding on small mobile */
        gap: 12px;
    }
    
    .brand-logo {
        width: 55px;
        height: 55px;
    }
    
    .start-button, .reset-button {
        font-size: 0.85rem;
        padding: 7px 14px;
        min-width: 90px;
    }
    
    .total-rank-display {
        padding: 8px 10px;
    }
    
    .rank-label {
        font-size: 0.75rem;
    }
    
    .rank-value {
        font-size: 1.1rem;
    }
    
    .rank-progress {
        width: 80px;
        height: 4px;
    }
    
    .vertical-menu > button,
    .settings-container > button {
        width: 38px;
        height: 38px;
        padding: 8px;
        font-size: 0.95rem;
    }
    
    .settings-menu {
        right: 50px !important;
        gap: 5px;
        flex-direction: row !important; /* Force horizontal */
        display: flex !important;
        flex-wrap: nowrap !important;
    }
    
    .settings-menu button {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 8px;
        font-size: 0.85rem;
        flex-shrink: 0 !important;
        display: flex !important;
    }
}

/* Extra small mobile optimization for horizontal header */
@media (max-width: 480px) {
    .header-content {
        padding: 12px 15px;
        gap: 10px;
    }
    
    .brand-logo {
        width: 70px;
        height: 70px;
    }
    
    .logo-section {
        margin-bottom: 3px;
    }
    
    .score-display {
        font-size: 12px;
    }
    
    .score-value {
        font-size: 14px !important;
    }
    
    .start-btn, .reset-btn, .back-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.title {
    font-size: 1.9rem;
    font-weight: 700;
    color: #2d3748;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin: 0;
    text-align: center;
}

.subtitle {
    font-size: 1rem;
    color: #666;
    font-weight: 400;
    margin: 8px 0 0 0;
    font-style: italic;
}

.help-button {
    background: linear-gradient(45deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 5px;
}

.help-button:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.game-controls {
    margin-bottom: 10px;
}

.score-display {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 12px;
    margin: 12px 0;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.score-main {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.score-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    padding: 12px 20px;
    border-radius: 15px;
    min-width: 80px;
    text-align: center;
    transition: all 0.4s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.score-value.updated {
    transform: scale(1.15);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Inline progress bar next to score */
.score-progress {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.score-bar {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169, #ed8936, #e53e3e);
    width: var(--progress, 0%);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
}

/* Best score container - small and positioned below button */
.best-score-container {
    opacity: 0.8; /* Slightly transparent */
    transform: translateY(0);
    transition: all 0.6s ease;
    text-align: center;
    padding: 4px 8px; /* Smaller padding */
    background: rgba(255, 255, 255, 0.08); /* More subtle background */
    border-radius: 6px; /* Smaller radius */
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15); /* More subtle border */
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem; /* Smaller text */
}

.best-score-container.show {
    opacity: 1;
    transform: translateY(0);
}

.best-score-container.animate-in {
    animation: bestScoreSlide 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.best-score-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0;
}

@keyframes bestScoreSlide {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
    }
    50% {
        transform: translateY(2px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.score-rating {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 3px;
}

.best-score {
    font-size: 0.75rem;
    font-weight: 600;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
}

.game-area {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.current-flag-section {
    text-align: center;
    margin-bottom: 10px;
    padding: 10px 8px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.flag-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.flag-display {
    width: 120px;
    height: 72px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.flag-display.ready {
    box-shadow: 0 0 0 2px #38a169, 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: readyPulse 2s ease-in-out infinite;
}

.flag-display.spinning {
    box-shadow: 0 0 0 2px #ed8936, 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flag-placeholder {
    color: #718096;
    font-size: 0.8rem; /* Slightly smaller text */
    text-align: center;
    padding: 8px; /* Reduced padding */
    line-height: 1.2; /* Tighter line height */
    word-wrap: break-word; /* Allow text wrapping */
    overflow-wrap: break-word;
}

.flag-emoji {
    font-size: 48px;
    line-height: 1;
}

.country-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Instruction text and country name - smaller on mobile */
.round-info {
    font-size: 0.9rem;
    margin-top: 6px;
}

.country-name {
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.round-info {
    font-size: 0.8rem;
    color: #4a5568;
    font-weight: 500;
    margin-top: 6px;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    padding: 4px 10px; /* Reduced padding */
    text-align: center;
}

/* Even smaller text for extra small screens */
@media (max-width: 360px) {
    .round-info {
        font-size: 0.7rem;
        margin-top: 3px;
        padding: 3px 8px;
    }
    
    .country-name {
        font-size: 1rem;
        letter-spacing: 0.2px;
    }
}

/* Round counter / instruction text styling */
#roundCounter {
    font-weight: 500;
    color: #4a5568;
    line-height: 1.4;
    text-align: center;
}

#roundCounter.tutorial-active {
    color: #667eea;
    font-weight: 600;
}

/* Mobile optimization for instruction text */
@media (max-width: 768px) {
    #roundCounter {
        font-size: 0.9rem;
        line-height: 1.3;
    }
}

@media (max-width: 480px) {
    #roundCounter {
        font-size: 0.85rem;
        line-height: 1.25;
    }
}

@media (max-width: 360px) {
    #roundCounter {
        font-size: 0.8rem;
        line-height: 1.2;
    }
}

/* Rank quality indicators */
.category-score {
    position: relative;
}

.category-score::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 100%;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-item.selected .category-score::after {
    opacity: 1;
}

.category-item.selected .category-score[data-rank="excellent"]::after {
    background: #48bb78; /* Green for ranks 1-10 */
}

.category-item.selected .category-score[data-rank="good"]::after {
    background: #ed8936; /* Orange for ranks 11-30 */
}

.category-item.selected .category-score[data-rank="poor"]::after {
    background: #e53e3e; /* Red for ranks 31+ */
}

.categories-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
    max-width: 600px; /* Constrain width for better desktop appearance */
    margin-left: auto;
    margin-right: auto;
}

.category-item.category-box {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 40px;
    display: flex;
    align-items: center;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}

.category-item.category-box:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.category-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

/* Emoji on the left - much smaller */
.category-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
}

/* Info container takes remaining space */
.category-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    gap: 8px;
}

/* Category title */
.category-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.1;
    letter-spacing: 0.3px;
    flex: 1;
}

/* Horizontal section with flag and score */
.category-bottom {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Flag without border */
.assigned-flag {
    width: 20px;
    opacity: 1;
    height: 14px;
    border-radius: 2px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

/* Score display */
.category-score {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 6px;
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    line-height: 1;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
}

.category-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

/* Desktop hover effects */
@media (hover: hover) {
    .category-item:hover::before {
        left: 100%;
    }
    
    .category-item:hover {
        transform: translateY(-2px);
        border-color: #667eea;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.15);
    }
}

/* Mobile touch feedback - no hover effects */
.category-item:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.category-item.category-box.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    cursor: default;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    animation: categoryBoxSelection 0.4s ease;
}

@keyframes categoryBoxSelection {
    0% { 
        transform: translateY(0) scale(1); 
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    50% { 
        transform: translateY(-8px) scale(1.08); 
        box-shadow: 0 20px 40px rgba(102, 126, 234, 0.5);
    }
    100% { 
        transform: translateY(-5px) scale(1.05);
        box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    }
}

.category-item.category-box.selected:active {
    transform: translateY(-5px) scale(1.05);
}

.category-item.category-box.selected .category-title {
    color: rgba(255, 255, 255, 0.95);
}

.category-item.category-box.selected .category-score {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.category-item.category-box.selected .assigned-flag {
    opacity: 1;
    filter: brightness(1.2) contrast(1.2);
    transform: scale(1.1);
}

.category-item.category-box.selected .flag-emoji {
    opacity: 1 !important;
    color: initial !important;
    /* filter: brightness(1.1) contrast(1.1) !important; */
}

/* Ensure flag emojis in selected categories are always fully visible */
.category-item.selected .flag-emoji,
.category-item.category-box.selected .assigned-flag .flag-emoji,
.category-item.selected .assigned-flag .flag-emoji {
    opacity: 1 !important;
    filter: brightness(1.1) contrast(1.1) !important;
}

/* Unselected state - Compact horizontal layout matching selected */
.category-item:not(.selected) .category-content {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0;
}

.category-item:not(.selected) .category-emoji {
    font-size: 1.3rem;
    width: 28px;
}

.category-item:not(.selected) .category-info {
    flex: 1;
}

.category-item:not(.selected) .category-title {
    font-size: 0.75rem;
    text-align: left;
    margin: 0;
}

.category-item:not(.selected) .category-bottom {
    display: none;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.category-name {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
}

.category-icon {
    font-size: 1.1rem;
}

.assigned-flag {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    min-width: 24px;
}

.assigned-flag .flag-emoji {
    font-size: 20px;
}

.category-score {
    font-size: 1rem;
    font-weight: 700;
    color: #e53e3e;
    min-width: 35px;
    text-align: right;
}

.category-item.selected .category-score {
    color: #2d3748;
    background: #ffd700;
    padding: 3px 6px;
    border-radius: 6px;
    font-weight: 700;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.start-button, .reset-button, .play-again-button, .share-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    min-height: 40px;
    min-width: 120px;
}

.start-button:active, .reset-button:active, .play-again-button:active, .share-button:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.game-over-modal {
    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: 1000;
    padding: 20px;
}

.help-modal {
    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: 1000;
    padding: 20px;
}

.help-modal .modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.close-button {
    background: #e53e3e;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-button:active {
    transform: scale(0.9);
}

.help-content {
    text-align: left;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    color: #2d3748;
    font-size: 1.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section p {
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 10px;
}

.help-section ol, .help-section ul {
    color: #4a5568;
    line-height: 1.6;
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}

.categories-help {
    display: grid;
    gap: 15px;
}

.category-help-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.help-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.category-help-item strong {
    color: #2d3748;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.category-help-item p {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
    line-height: 1.4;
}

/* Settings Help Section */
.settings-help {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.setting-help-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: #edf2f7;
    border-radius: 8px;
    border-left: 4px solid #38a169;
}

.setting-help-item strong {
    color: #2d3748;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.setting-help-item p {
    font-size: 0.9rem;
    color: #718096;
    margin: 0;
    line-height: 1.4;
}

.modal-content {
    background: white;
    padding: 30px 20px;
    border-radius: 15px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: #2d3748;
}

.final-score {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #e53e3e;
    font-weight: 700;
}

.score-breakdown {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: left;
    max-height: 300px;
    overflow-y: auto;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.95rem;
}

.breakdown-item:last-child {
    border-bottom: none;
}

.breakdown-country {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    flex: 1;
}

.breakdown-category {
    color: #4a5568;
    font-size: 0.85rem;
    text-transform: capitalize;
    flex: 1;
    text-align: center;
}

.breakdown-score {
    font-weight: 700;
    color: #e53e3e;
    min-width: 40px;
    text-align: right;
}

/* Disabled state for categories */
.category-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid #cbd5e0;
    transform: scale(0.98);
}

.category-item.disabled .category-score {
    background: #f7fafc;
    color: #2d3748;
    opacity: 0.9;
}

.category-item.disabled:active {
    transform: none;
}

.category-item.spinning-disabled:not(.selected) {
    opacity: 1;
    cursor: not-allowed;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: #cbd5e0;
}

/* Enhanced spinning animation for flags */
.flag-emoji.spinning {
    animation: flagSpinning 0.2s linear infinite;
    filter: blur(1px);
    transform: scale(1.1);
}

@keyframes flagSpinning {
    0% { transform: rotateY(0deg) scale(1.1); }
    50% { transform: rotateY(180deg) scale(1.2); }
    100% { transform: rotateY(360deg) scale(1.1); }
}

/* Enhanced flag transition */
.flag-display.flag-transition .flag-emoji {
    animation: flagReveal 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

@keyframes flagReveal {
    0% { 
        transform: scale(0.3) rotateY(180deg);
        opacity: 0;
        filter: blur(5px);
    }
    70% { 
        transform: scale(1.1) rotateY(20deg);
        filter: blur(1px);
    }
    100% { 
        transform: scale(1) rotateY(0deg);
        opacity: 1;
        filter: blur(0px);
    }
}

/* Confetti effect for achievements */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #ffd700;
    z-index: 500; /* Lower z-index to not cover flag */
    pointer-events: none;
    border-radius: 50%;
}

.confetti.red { background: #ff6b6b; }
.confetti.blue { background: #4ecdc4; }
.confetti.green { background: #45b7d1; }
.confetti.yellow { background: #ffd93d; }
.confetti.purple { background: #a8e6cf; }

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Enhanced category selection feedback */
.category-item.just-selected {
    animation: categoryPulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-color: #667eea !important;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4) !important;
}

@keyframes categoryPulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% { 
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
    }
}

/* Enhanced button press feedback */
.start-button:active, .reset-button:active, .play-again-button:active, .share-button:active,
.help-button:active, .close-button:active, .country-toggle:active, .tiktok-link:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
}

/* Loading pulse animation */
.start-button:disabled {
    animation: loadingPulse 1.5s ease-in-out infinite;
    opacity: 0.7;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.9; }
}

/* Enhanced modal animations */
.game-over-modal {
    backdrop-filter: blur(8px);
}

.help-modal {
    backdrop-filter: blur(8px);
}

.modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalSlideIn {
    0% {
        transform: translateY(-50px) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Score breakdown styling */
.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border-left: 3px solid #667eea;
    transition: all 0.3s ease;
}

.breakdown-item:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: translateX(5px);
}

.breakdown-country {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    font-weight: 500;
}

.breakdown-category {
    flex: 1;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    text-transform: capitalize;
}

.breakdown-score {
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
    text-align: right;
}

/* Enhanced spinning disabled state */
.category-item.spinning-disabled:not(.selected) {
    opacity: 0.5;
    transform: scale(0.98);
    pointer-events: none;
    filter: grayscale(50%);
    transition: all 0.3s ease;
}

/* Enhanced achievement glow */
.achievement-notification.show .achievement-icon {
    animation: achievementGlow 2s ease-in-out infinite, achievementBounce 0.6s ease-out;
}

@keyframes achievementGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.8));
        transform: scale(1);
    }
    50% { 
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 1));
        transform: scale(1.1);
    }
}

/* Pulsing effect for ready flags */
.flag-display.ready .flag-emoji {
    animation: flagReady 2s ease-in-out infinite;
}

@keyframes flagReady {
    0%, 100% { 
        transform: scale(1);
        filter: drop-shadow(0 0 3px rgba(102, 126, 234, 0.3));
    }
    50% { 
        transform: scale(1.02);
        filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.5));
    }
}

/* Country toggle button styling */
.country-toggle {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    justify-content: center;
}

.country-toggle:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.country-toggle.hidden-mode {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

/* Hints toggle button styling */
.hints-toggle {
    background: linear-gradient(45deg, #38a169, #2f855a);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    justify-content: center;
}

.hints-toggle:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.hints-toggle.disabled-mode {
    background: linear-gradient(45deg, #718096, #4a5568);
}

.toggle-icon {
    font-size: 0.9rem;
}

.toggle-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.toggle-text {
    font-size: 0.8rem;
}

/* Sound toggle button */
.sound-toggle {
    background: linear-gradient(45deg, #48bb78, #38a169);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    justify-content: center;
}

.sound-toggle:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.sound-toggle.muted {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

.sound-toggle.muted .toggle-icon {
    opacity: 0.8;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: white;
    animation: loadingPulse 2s ease-in-out infinite;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-progress {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

/* Keyboard shortcuts styling */
.keyboard-shortcuts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.shortcut-group h4 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 5px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

kbd {
    background: #f7f7f7;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    color: #333;
    display: inline-block;
    font-size: 0.8em;
    font-weight: bold;
    line-height: 1;
    padding: 2px 6px;
    white-space: nowrap;
    font-family: monospace;
    margin-left: 8px;
}

/* Visual feedback for keyboard navigation */
.category-item:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* User Analytics Section */
.user-analytics {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6b46c1;
}

.analytics-note {
    font-size: 0.7rem;
    opacity: 0.7;
    text-align: center;
    line-height: 1.3;
    margin: 0;
}

@media (max-width: 480px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-item {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    
    .stat-label {
        margin-bottom: 0;
    }
}

/* Desktop breakpoint - enhance for larger screens */
@media (min-width: 768px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .header {
        padding: 25px;
        margin-bottom: 30px;
        border-radius: 20px;
    }
    
    .title {
        font-size: 2.5rem;
        margin-bottom: 20px;
        text-align: center;
    }
    
    .header-top {
        justify-content: center;
        text-align: center;
    }
    
    .help-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(66, 153, 225, 0.3);
    }
    
    .game-area {
        padding: 30px;
        margin-bottom: 30px;
        border-radius: 20px;
    }
    
    .current-flag-section {
        padding: 30px;
        margin-bottom: 40px;
        border-radius: 15px;
    }
    
    .flag-display {
        width: 200px;
        height: 120px;
        border-width: 3px;
        border-radius: 10px;
    }
    
    .flag-emoji {
        font-size: 80px;
    }
    
    .country-name {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .categories-grid {
        gap: 4px;
        margin-top: 8px;
        max-width: 800px; /* Much wider for desktop */
    }
    
    .category-item {
        padding: 20px;
        border-radius: 15px;
    }
    
    /* Desktop hover effects */
    .category-item:hover {
        transform: translateY(-5px);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        border-color: #667eea;
    }
    
    .category-item.selected:hover {
        transform: none;
    }
    
    .category-item.disabled:hover {
        transform: none;
        box-shadow: none;
        border-color: #e2e8f0;
    }
    
    .start-button:hover, .reset-button:hover, .play-again-button:hover, .share-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    }
    
    .modal-content {
        padding: 40px;
        max-width: 500px;
        border-radius: 20px;
    }
    
    /* Share modal responsive styles */
    .share-modal .modal-content {
        max-width: 450px;
    }
    
    .share-actions {
        gap: 8px;
    }
    
    .share-actions button {
        min-width: 110px;
        font-size: 0.85rem;
    }
    
    .score-display {
        gap: 10px;
    }
}

/* Small mobile score display adjustments */
@media (max-width: 480px) {
    .container {
        padding: 6px;
    }
    
    .header {
        margin-bottom: 8px;
        padding: 10px 10px 8px 10px; /* Slightly reduced top padding from 12px to 10px */
    }
    
    .title {
        font-size: 1.65rem; /* Very slightly smaller from 1.7rem */
    }
    
    .current-flag-section {
        margin-bottom: 8px; /* Keep same */
        padding: 10px 8px; /* Slightly reduced from 12px 10px */
    }
    
    .flag-display {
        width: 100px;
        height: 60px;
    }
    
    .flag-emoji {
        font-size: 40px;
    }
    
    .categories-grid {
        gap: 6px;
    }
    
    .category-item {
        padding: 8px 12px;
        min-height: 42px;
        border-radius: 10px;
    }
    
    .category-emoji {
        font-size: 1.6rem;
        width: 34px;
    }
    
    .category-title {
        font-size: 0.95rem;
    }
    
    .assigned-flag {
        margin-right: 6px;
        min-width: 20px;
    }
    
    .assigned-flag .flag-emoji {
        font-size: 18px;
    }
    
    .category-score {
        font-size: 0.9rem;
        min-width: 30px;
    }
}

/* Extra small mobile screens - ultra compact */
@media (max-width: 360px) {
    .container {
        padding: 4px;
    }
    
    .header {
        margin-bottom: 6px;
        padding: 10px 8px 8px 8px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .current-flag-section {
        margin-bottom: 8px;
        padding: 10px 8px;
    }
    
    .flag-display {
        width: 90px;
        height: 54px;
    }
    
    .flag-emoji {
        font-size: 36px;
    }
    
    .categories-grid {
        gap: 3px;
    }
    
    .category-item {
        padding: 6px 8px;
        min-height: 36px;
        border-radius: 6px;
    }
    
    .category-emoji {
        font-size: 1.3rem;
        width: 28px;
    }
    
    .category-title {
        font-size: 0.75rem;
    }
    
    .assigned-flag {
        margin-right: 4px;
        min-width: 18px;
    }
    
    .assigned-flag .flag-emoji {
        font-size: 16px;
    }
    
    .category-score {
        font-size: 0.85rem;
        min-width: 28px;
    }
    
    .score-value {
        font-size: 1.2rem !important;
        padding: 3px 7px !important; /* Very slightly smaller from 4px 8px */
    }
}

/* Tutorial Modal Styles */
.tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.tutorial-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
}

.tutorial-content h3 {
    color: #4a5568;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 700;
}

.tutorial-content p {
    color: #2d3748;
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

.tutorial-example {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid #e2e8f0;
}

.example-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 8px 0;
    border-radius: 8px;
    font-weight: 600;
}

.example-item.good {
    background: rgba(72, 187, 120, 0.1);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.example-item.bad {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
}

.result.good {
    color: #48bb78;
}

.result.bad {
    color: #e53e3e;
}

.tutorial-tip {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 1rem;
}

.tutorial-button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.tutorial-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.tutorial-button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .tutorial-content {
        padding: 25px 20px;
        max-width: 95%;
    }
    
    .tutorial-content h3 {
        font-size: 1.3rem;
    }
    
    .tutorial-content p {
        font-size: 1rem;
    }
    
    .example-item {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* Better mobile viewport handling */
@media (max-height: 700px) {
    .container {
        padding: 4px;
    }
    
    .header {
        margin-bottom: 6px;
        padding: 10px 8px 8px 8px;
    }
    
    .current-flag-section {
        margin-bottom: 8px;
        padding: 10px 8px;
    }
    
    .categories-grid {
        gap: 3px;
    }
    
    .category-item {
        padding: 4px 6px;
        min-height: 30px;
    }
}

/* Short screen optimization */
@media (max-height: 600px) {
    .title {
        font-size: 1.6rem;
    }
    
    .flag-display {
        width: 100px;
        height: 60px;
    }
    
    .flag-emoji {
        font-size: 38px;
    }
    
    .category-item {
        padding: 5px 8px;
        min-height: 36px;
    }
    
    .category-name {
        font-size: 0.8rem;
    }
}

/* Mobile button menu - simplified horizontal layout */
@media (max-width: 768px) {
    .header {
        position: relative;
        overflow: visible;
    }
    
    .header-controls {
        position: absolute;
        top: 10px;
        right: 10px;
        display: flex;
        gap: 6px;
        align-items: center;
        z-index: 10;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(5px);
        border-radius: 12px;
        padding: 6px;
    }
    
    /* Mobile Settings Dropdown */
    .settings-toggle,
    .tiktok-link,
    .help-button {
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid #e2e8f0;
        color: #4a5568;
        backdrop-filter: blur(3px);
        padding: 8px;
        min-width: 32px;
        height: 32px;
        border-radius: 50%;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    }
    
    .settings-toggle:active,
    .tiktok-link:active,
    .help-button:active {
        background: rgba(255, 255, 255, 0.8);
        transform: scale(0.95);
    }
    
    /* Hide text on mobile, show only icons */
    .settings-text,
    .tiktok-text,
    .help-text {
        display: none;
    }
    
    /* Mobile settings menu positioning */
    .settings-menu {
        position: fixed;
        top: 60px;
        right: 10px;
        left: auto;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(15px);
        border: 1px solid rgba(102, 126, 234, 0.2);
        border-radius: 16px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
        padding: 12px;
        max-width: 200px;
        min-width: 160px;
        margin-top: 0;
        margin-right: 0;
        display: flex;
        flex-direction: column;
        gap: 8px;
        transform: translateX(20px);
    }
    
    .settings-menu.show {
        transform: translateX(0);
    }
    
    /* Mobile settings menu items keep their toggle states */
    .settings-menu .sound-toggle.muted,
    .settings-menu .country-toggle.hidden-mode,
    .settings-menu .hints-toggle.disabled-mode {
        background: linear-gradient(135deg, #e53e3e, #c53030);
        box-shadow: 0 2px 8px rgba(229, 62, 62, 0.2);
    }
    
    /* Adjust title margin for mobile */
    .title {
        margin-right: 140px;
        text-align: left;
        padding-left: 0px;
    }
}

/* Mobile button menu animations */
@media (max-width: 768px) {
    .header-controls {
        animation: slideInFromRight 0.3s ease-out;
    }
    
    .header-controls button {
        animation: fadeInDown 0.4s ease-out;
        animation-fill-mode: both;
    }
    
    .header-controls button:nth-child(1) {
        animation-delay: 0.1s;
    }
    
    .header-controls button:nth-child(2) {
        animation-delay: 0.2s;
    }
    
    .header-controls button:nth-child(3) {
        animation-delay: 0.3s;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Extra small mobile - even more compact buttons */
@media (max-width: 480px) {
    .header-controls {
        top: 8px;
        right: 8px;
        gap: 4px;
        padding: 4px;
    }
    
    /* Additional title adjustments for smaller screens */
    .title {
        margin-right: 150px;
        padding-left: 15px;
        font-size: 1.6rem;
    }
}

/* Button hover text tooltips */
.country-toggle .toggle-text,
.sound-toggle .toggle-text,
.hints-toggle .toggle-text,
.help-button .help-text {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(45, 55, 72, 0.95);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(5px);
    margin-right: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Tooltip arrow */
.country-toggle .toggle-text::after,
.sound-toggle .toggle-text::after,
.hints-toggle .toggle-text::after,
.help-button .help-text::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-left-color: rgba(45, 55, 72, 0.95);
}

/* Desktop hover effects for buttons */
@media (hover: hover) {
    .country-toggle:hover .toggle-text,
    .sound-toggle:hover .toggle-text,
    .hints-toggle:hover .toggle-text,
    .help-button:hover .help-text {
        opacity: 1;
        visibility: visible;
        transform: translateY(-50%) translateX(-4px);
    }
    
    .country-toggle:hover,
    .sound-toggle:hover,
    .hints-toggle:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .help-button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
    }
}

/* Mobile - hide text by default, show only emoji */
@media (max-width: 768px) {
    .country-toggle .toggle-text,
    .sound-toggle .toggle-text,
    .hints-toggle .toggle-text,
    .help-button .help-text {
        display: none;
    }
    
    .country-toggle,
    .sound-toggle,
    .hints-toggle,
    .tiktok-link {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        min-width: 36px;
    }
    
    .help-button {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        min-width: 36px;
    }
    
    .toggle-icon,
    .help-icon {
        font-size: 1rem;
    }
}

/* Extra small mobile - even smaller buttons */
@media (max-width: 480px) {
    .country-toggle,
    .sound-toggle,
    .tiktok-link,
    .help-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .toggle-icon,
    .help-icon {
        font-size: 0.9rem;
    }
}

/* Button state variations */
.country-toggle.hidden-mode {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

.sound-toggle.muted {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

.sound-toggle.muted .toggle-icon {
    opacity: 0.8;
}

.hints-toggle.disabled-mode {
    background: linear-gradient(45deg, #718096, #4a5568);
}

/* Enhanced button feedback */
.country-toggle:active,
.sound-toggle:active,
.hints-toggle:active,
.help-button:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Button state color adjustments */
.country-toggle.hidden-mode {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

.country-toggle.hidden-mode .toggle-text {
    background: rgba(229, 62, 62, 0.95);
}

.country-toggle.hidden-mode .toggle-text::after {
    border-left-color: rgba(229, 62, 62, 0.95);
}

.sound-toggle.muted {
    background: linear-gradient(45deg, #e53e3e, #c53030);
}

.sound-toggle.muted .toggle-text {
    background: rgba(229, 62, 62, 0.95);
}

.sound-toggle.muted .toggle-text::after {
    border-left-color: rgba(229, 62, 62, 0.95);
}

/* Button focus states for accessibility */
.country-toggle:focus,
.sound-toggle:focus,
.help-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Achievement notification system */
.achievement-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #2d3748;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;  /* Increased z-index to be above everything */
    border: 2px solid #ffed4e;
    opacity: 0;
    visibility: hidden;
    max-width: 90vw;
    min-width: 280px;
    backdrop-filter: blur(10px);
}

.achievement-notification.show {
    top: 10px;  /* Reduced to be closer to top edge */
    opacity: 1;
    visibility: visible;
    animation: achievementBounce 0.6s ease-out;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievement-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.achievement-text {
    flex: 1;
}

.achievement-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1.2;
}

.achievement-desc {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 500;
    line-height: 1.3;
}

@keyframes achievementBounce {
    0% { 
        transform: translateX(-50%) translateY(-10px) scale(0.8);
        opacity: 0;
    }
    50% { 
        transform: translateX(-50%) translateY(0) scale(1.05);
        opacity: 1;
    }
    100% { 
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
}

/* Mobile-specific achievement notification adjustments */
@media (max-width: 768px) {
    .achievement-notification {
        min-width: 250px;
        max-width: 95vw;
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .achievement-notification.show {
        top: 8px;  /* Even closer to top on mobile */
    }
    
    .achievement-icon {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .achievement-notification {
        min-width: 220px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .achievement-notification.show {
        top: 5px;  /* Very close to top on small screens */
    }
    
    .achievement-icon {
        font-size: 1.2rem;
    }
}

/* Hint notification system for better choices - compact 3-line design */
.hint-notification {
    position: fixed;
    top: -150px;
    right: 15px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9998;
    border: 2px solid #63b3ed;
    opacity: 0;
    visibility: hidden;
    max-width: 165px;
    min-width: 145px;
    backdrop-filter: blur(8px);
    font-size: 0.75rem;
    line-height: 1.2;
    text-align: center;
}

.hint-notification.show {
    top: 120px;  /* Positioned higher and on right to avoid rank display */
    opacity: 1;
    visibility: visible;
    animation: hintSlideIn 0.4s ease-out;
}

/* Simplified content structure - remove unused classes */
.hint-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.hint-desc {
    opacity: 0.9;
    font-weight: 400;
}

@keyframes hintSlideIn {
    0% { 
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    50% { 
        transform: translateX(0) scale(1.02);
        opacity: 1;
    }
    100% { 
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Mobile-specific hint notification adjustments */
@media (max-width: 768px) {
    .hint-notification {
        max-width: 155px;
        min-width: 135px;
        padding: 7px 10px;
        font-size: 0.7rem;
        top: -120px;
        right: 10px;
    }
    
    .hint-notification.show {
        top: 100px;
    }
    
    .hint-title {
        font-size: 0.7rem;
    }
    
    .hint-desc {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .hint-notification {
        max-width: 145px;
        min-width: 125px;
        right: 8px;
        padding: 7px 10px;
        border-radius: 8px;
        font-size: 0.65rem;
    }
    
    .hint-notification.show {
        top: 80px;
    }
    
    .hint-title {
        font-size: 0.65rem;
    }
    
    .hint-desc {
        font-size: 0.6rem;
    }
}

/* Share Modal Styles */
.share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.share-modal .modal-content {
    max-width: 450px;
    width: 90%;
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 15px;
}

.share-header h2 {
    font-size: 1.5rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.share-card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.share-card-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.share-card-body {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.share-score {
    margin-bottom: 15px;
}

.share-score-label {
    font-size: 1rem;
    opacity: 0.8;
}

.share-score-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.share-rating {
    font-size: 1.1rem;
    font-style: italic;
    opacity: 0.9;
}

.share-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 15px;
}

.share-result-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.share-result-flag {
    font-size: 1.8rem;
}

.share-result-country {
    font-weight: 600;
    text-align: left;
}

.share-result-category {
    opacity: 0.8;
    text-transform: capitalize;
}

.share-result-score {
    font-weight: 700;
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.share-actions button {
    flex: 1;
    background: linear-gradient(45deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
}

.share-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(66, 153, 225, 0.3);
}

.share-actions button:active {
    transform: scale(0.96);
}

.share-actions .download-button {
    background: linear-gradient(45deg, #48bb78, #38a169);
}

.share-actions .native-share-button {
    background: linear-gradient(45deg, #ed8936, #dd6b20);
}

/* Compact Share Card Styles */
.compact-share .share-card {
    padding: 15px;
    border-radius: 10px;
}

.compact-share .share-header h2 {
    font-size: 1.0rem;
}

.compact-share .share-body {
    padding: 10px 0;
}

.compact-share .share-results-grid {
    gap: 5px;
}

.compact-share .share-result-item {
    padding: 5px;
    border-radius: 5px;
}

.compact-share .share-result-flag {
    font-size: 1.5rem;
}

.compact-share .share-result-country {
    font-size: 0.9rem;
}

.compact-share .share-result-category {
    font-size: 0.8rem;
}

.compact-share .share-result-score {
    font-size: 1rem;
}

/* Patreon Link Styling */
.patreon-link {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.patreon-link p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    text-align: center;
    line-height: 1.4;
}

.patreon-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    padding: 2px 4px;
    border-radius: 4px;
}

.patreon-link a:hover {
    color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
    text-decoration: none;
}

.patreon-link a:active {
    transform: scale(0.98);
}

/* Mobile responsive patreon link */
@media (max-width: 480px) {
    .patreon-link p {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .patreon-link {
        margin-top: 12px;
        padding-top: 12px;
    }
}

/* Game over actions styling */
.game-over-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.game-over-actions .share-button {
    background: linear-gradient(45deg, #4299e1, #3182ce);
    text-transform: none; /* Don't uppercase for share button */
    letter-spacing: 0.2px;
}

/* TikTok button styling (matches other header controls) */
.tiktok-link {
    background: linear-gradient(45deg, #ff0050, #ff4081);
    color: white;
    border: none;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
    user-select: none;
    position: relative;
    overflow: hidden;
    min-width: 36px;
    justify-content: center;
}

.tiktok-link:active {
    transform: scale(0.96);
    transition: transform 0.1s ease;
}

.tiktok-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 80, 0.3);
}

/* Social Media Footer */
.social-footer {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.social-container {
    text-align: center;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.social-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.2);
}

.social-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.social-text {
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    color: #555;
}

.social-tagline {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    margin: 0;
}

/* Platform-specific subtle styling */
.social-link.buymeacoffee:hover {
    background: rgba(255, 129, 63, 0.05);
    border-color: rgba(255, 129, 63, 0.3);
}

/* Coffee emoji styling */
.coffee-emoji {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.social-link.twitter:hover {
    background: rgba(29, 161, 242, 0.05);
    border-color: rgba(29, 161, 242, 0.3);
}

.social-link.youtube:hover {
    background: rgba(255, 0, 0, 0.05);
    border-color: rgba(255, 0, 0, 0.3);
}

.social-link.tiktok:hover {
    background: rgba(255, 0, 80, 0.05);
    border-color: rgba(255, 0, 80, 0.3);
}

/* Mobile responsive social footer */
@media (max-width: 768px) {
    .social-footer {
        margin-top: 16px;
        margin-bottom: 20px; /* Add bottom margin for better mobile scrolling */
        padding: 12px;
    }
    
    .social-links {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .social-link {
        padding: 6px 10px;
        font-size: 0.8rem;
        /* Make links more touch-friendly */
        min-height: 32px;
        min-width: 60px;
    }
    
    .social-logo {
        width: 14px;
        height: 14px;
    }
    
    .social-text {
        font-size: 0.8rem;
    }
    
    .social-tagline {
        font-size: 0.75rem;
        margin-bottom: 0;
    }
}

/* Extra mobile spacing to ensure footer is easily accessible */
@media (max-width: 480px) {
    .container {
        padding-bottom: 16px; /* Extra bottom padding on mobile */
    }
    
    .social-footer {
        margin-bottom: 24px; /* Extra bottom margin on small screens */
    }
}

@media (max-width: 480px) {
    .social-links {
        gap: 6px;
    }
    
    .social-link {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .social-logo {
        width: 12px;
        height: 12px;
    }
}

/* Ensure TikTok button fits with other header controls on mobile */
@media (max-width: 768px) {
    .tiktok-link {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        min-width: 36px;
    }
    
    .tiktok-link .toggle-text {
        display: none;
    }
    
    .tiktok-link .toggle-icon {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .tiktok-link {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    .tiktok-link .toggle-icon {
        font-size: 0.9rem;
    }
}

/* Logo integration - Bigger vertical centered logo with action button below */
.title-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.game-action .start-button,
.game-action .reset-button {
    font-size: 1.2rem;
    padding: 15px 30px;
    font-weight: 700;
    min-width: 140px;
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.game-action .start-button:hover,
.game-action .reset-button:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Enhanced Loading Screen with Extended Duration */
.loading-logo {
    width: 110px; /* Proportionally increased from 100px */
    height: 110px; /* Proportionally increased from 100px */
    border-radius: 50%;
    object-fit: cover;
    animation: logoEntrance 3s ease-out;
    position: relative;
    z-index: 2;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.loading-logo-glow {
    position: absolute;
    width: 130px; /* Proportionally increased from 120px */
    height: 130px; /* Proportionally increased from 120px */
    border-radius: 50%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.4) 0%, transparent 70%);
    animation: logoGlow 3s ease-out infinite alternate;
    z-index: 1;
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.2) rotate(-360deg);
    }
    40% {
        opacity: 0.8;
        transform: scale(1.3) rotate(-90deg);
    }
    70% {
        opacity: 1;
        transform: scale(0.9) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes logoGlow {
    0% {
        opacity: 0.2;
        transform: scale(0.8);
    }
    100% {
        opacity: 0.7;
        transform: scale(1.2);
    }
}

/* Mobile responsive for main logo */
@media (max-width: 768px) {
    .main-logo {
        width: 36px;
        height: 36px;
    }
    
    .title-container {
        gap: 10px;
    }
    
    .loading-logo {
        width: 88px; /* Proportionally increased from 80px */
        height: 88px; /* Proportionally increased from 80px */
    }
    
    .loading-logo-glow {
        width: 110px; /* Proportionally increased from 100px */
        height: 110px; /* Proportionally increased from 100px */
    }
}

@media (max-width: 480px) {
    .main-logo {
        width: 32px;
        height: 32px;
    }
    
    .title-container {
        gap: 8px;
    }
    
    .loading-logo {
        width: 77px; /* Proportionally increased from 70px */
        height: 77px; /* Proportionally increased from 70px */
    }
    
    .loading-logo-glow {
        width: 100px; /* Proportionally increased from 90px */
        height: 100px; /* Proportionally increased from 90px */
    }
}

/* Fixed Header Layout - Properly Centered Logo and Title */
.header-main {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 5px;
    position: relative;
}

.logo-brand {
    margin-right: 15px; /* Space between logo and title */
}

.brand-logo {
    width: 60px; /* 20% bigger than original 50px */
    height: 60px; /* 20% bigger than original 50px */
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.brand-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: #333;
    line-height: 1;
    text-align: center;
}

.game-action {
    display: flex;
    justify-content: center;
}

.game-action .start-button,
.game-action .reset-button {
    font-size: 1.1rem;
    padding: 12px 24px;
    font-weight: 600;
    min-width: 120px;
}

/* Privacy Policy Styling */
.privacy-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #4a5568;
}

.privacy-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.privacy-section h4 {
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.privacy-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.privacy-section li {
    margin-bottom: 6px;
    color: #4a5568;
}

.privacy-section a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.privacy-section a:hover {
    text-decoration: underline;
}

.privacy-compliance {
    background: #e6fffa;
    border: 2px solid #38b2ac;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.privacy-compliance p {
    margin: 0;
    color: #2d3748;
    font-weight: 600;
}

/* Mobile privacy section adjustments */
@media (max-width: 768px) {
    .privacy-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .privacy-content {
        font-size: 0.85rem;
    }
}

/* Simplified Privacy Content */
.privacy-content-simple {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #4a5568;
}

.privacy-content-simple p {
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.privacy-content-simple p:last-child {
    border-bottom: none;
    font-weight: 600;
    text-align: center;
    margin-top: 15px;
}

.privacy-content-simple a {
    color: #667eea;
    text-decoration: none;
}

.privacy-content-simple a:hover {
    text-decoration: underline;
}

/* Ad Container Styles */
.ad-container {
    margin: 20px auto;
    padding: 10px;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.ad-container ins {
    display: block !important;
    min-height: 90px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

/* Responsive ad sizes */
@media (max-width: 768px) {
    .ad-container {
        margin: 15px auto;
        padding: 8px;
    }
}

@media (min-width: 769px) {
    .ad-container {
        max-width: 728px;
    }
}

/* Mobile responsive modal fixes to ensure patreon link visibility */
@media (max-width: 480px) {
    .game-over-modal .modal-content {
        max-height: 85vh;
        padding: 25px 15px;
    }
    
    /* Smaller ads in game-over modal on mobile */
    .game-over-modal .ad-container {
        margin: 12px auto;
        padding: 5px;
    }
    
    .game-over-modal .ad-container ins {
        min-height: 60px;
    }
    
    /* Ensure patreon link is always visible */
    .game-over-modal .patreon-link {
        margin-top: 8px;
        padding-top: 8px;
        flex-shrink: 0;
    }
    
    .game-over-modal .patreon-link p {
        font-size: 0.8rem;
        margin: 8px 0;
    }
}

@media (max-width: 360px) {
    .game-over-modal .modal-content {
        max-height: 90vh;
        padding: 20px 12px;
    }
    
    .game-over-modal .ad-container {
        margin: 8px auto;
        padding: 3px;
    }
    
    .game-over-modal .ad-container ins {
        min-height: 50px;
    }
}

/* Mobile-specific ultra-compact design */
@media (max-width: 480px) {
    .categories-grid {
        gap: 3px;
        margin: 6px 0;
        max-height: none; /* Ensure it fits */
    }
    
    .category-item.category-box {
        min-height: 35px;
        padding: 5px 8px;
        border-radius: 8px;
        border-width: 1.5px;
    }
    
    .category-content {
        gap: 8px;
    }
    
    .category-emoji {
        font-size: 1.2rem;
        width: 26px;
    }
    
    .category-title {
        font-size: 0.75rem;
    }
    
    .assigned-flag {
        width: 18px;
        height: 12px;
    }
    
    .category-score {
        font-size: 0.8rem;
        padding: 2px 5px;
        border-radius: 4px;
    }
    
    /* Unselected mobile adjustments - match compact sizing */
    .category-item:not(.selected) .category-content {
        padding: 0;
        gap: 8px;
    }
    
    .category-item:not(.selected) .category-emoji {
        font-size: 1.2rem;
        width: 26px;
    }
    
    .category-item:not(.selected) .category-title {
        font-size: 0.7rem;
    }
    
    .header {
        padding: 12px 10px;
        margin-bottom: 8px;
    }
    
    .title-container {
        gap: 20px;
    }
    
    .brand-logo {
        width: 70px;
        height: 70px;
        border-width: 2px;
    }
    
    .score-display {
        padding: 10px;
        margin: 8px 0;
        gap: 4px;
    }
    
    .game-area {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .current-flag-section {
        margin-bottom: 8px;
        padding: 8px 6px;
    }
    
    .flag-display {
        width: 100px;
        height: 60px;
    }
    
    .score-label {
        font-size: 0.9rem;
    }
    
    .score-value {
        font-size: 1.4rem;
        padding: 8px 15px;
        min-width: 60px;
        border-radius: 12px;
    }
    
    .score-progress {
        width: 100px;
        height: 6px;
    }
    
    .game-action .start-button,
    .game-action .reset-button {
        font-size: 1rem;
        padding: 10px 20px;
        min-width: 100px;
        border-radius: 20px;
    }
}

/* Very small mobile screens */
@media (max-width: 360px) {
    .container {
        padding: 4px;
    }
    
    .category-item.category-box {
        min-height: 52px;
        max-height: 62px;
        padding: 5px 3px;
    }
    
    .category-content .category-icon {
        font-size: 1rem;
    }
    
    .category-content .category-name {
        font-size: 0.6rem;
    }
    
    .category-content .assigned-flag {
        width: 16px;
        height: 10px;
    }
    
    .category-content .category-score {
        font-size: 0.7rem;
        padding: 1px 3px;
        min-width: 20px;
    }
    
    .header {
        padding: 10px 8px;
    }
    
    .brand-logo {
        width: 65px;
        height: 65px;
    }
    
    .flag-display {
        width: 90px;
        height: 54px;
    }
    
    .score-label {
        font-size: 0.8rem;
    }
    
    .score-value {
        font-size: 1.2rem;
        padding: 6px 12px;
        min-width: 50px;
    }
    
    .score-progress {
        width: 80px;
        height: 5px;
    }
    
    .game-action .start-button,
    .game-action .reset-button {
        font-size: 0.9rem;
        padding: 8px 16px;
        min-width: 85px;
    }
    
    /* Mobile header adjustments */
    .header-content {
        padding: 15px 10px;
        padding-right: 100px; /* Less padding on mobile */
        gap: 15px;
    }
    
    .best-score-container {
        padding: 6px 10px;
        gap: 4px;
    }
    
    .best-score-label {
        font-size: 0.7rem;
    }
    
    .best-score {
        font-size: 0.9rem;
    }
    
    .total-rank-display {
        padding: 8px 12px;
        min-width: 120px;
    }
    
    .rank-label {
        font-size: 0.75rem;
    }
    
    .rank-value {
        font-size: 1.2rem;
    }
}

/* Tablet and desktop responsive design improvements */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        margin: 0 auto;
        padding: 20px;
    }
    
    .header {
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    .title-container {
        gap: 40px;
    }
    
    .brand-logo {
        width: 120px;
        height: 120px;
    }
    
    .score-display {
        margin: 20px 0;
        padding: 20px;
    }
    
    .score-progress {
        width: 150px;
    }
    
    .categories-grid {
        gap: 16px;
        max-width: 500px;
        margin: 25px auto;
    }
    
    .category-item.category-box {
        min-height: 100px;
        padding: 15px 12px;
        border-radius: 16px;
    }
    
    .category-content .category-icon {
        font-size: 2.2rem;
    }
    
    .category-content .category-name {
        font-size: 1rem;
    }
    
    .category-content .assigned-flag {
        width: 30px;
        height: 20px;
    }
    
    .category-content .category-score {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
}

/* CRITICAL: Ensure all flags in selected categories are always fully visible */
.category-item.selected .assigned-flag,
.category-item.selected .assigned-flag .flag-emoji,
.category-item.category-box.selected .assigned-flag,
.category-item.category-box.selected .assigned-flag .flag-emoji {
    opacity: 1 !important;
    filter: brightness(1.1) contrast(1.1) !important;
    transition: none !important; /* Prevent transitions from affecting flag opacity */
}

/* Targeted fix: Keep animations but prevent flag/text opacity issues */
.category-item.selected .assigned-flag,
.category-item.selected .assigned-flag .flag-emoji,
.category-item.category-box.selected .assigned-flag .flag-emoji,
.category-item.selected .category-title,
.category-item.selected .category-score {
    opacity: 1 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease !important; /* Allow transform/shadow transitions but not opacity */
}

/* Allow normal category animations but ensure container stays opaque */
.category-item.selected,
.category-item.category-box.selected {
    opacity: 1 !important;
    /* Keep all other transitions for animations */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transition-property: transform, background, border-color, box-shadow !important; /* Exclude opacity from transitions */
}
