body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    background-color: #000;
}

/* GDPR Cookie Banner Styles */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    padding: 20px;
    z-index: 10000;
    display: none;
    font-family: Arial, sans-serif;
}

.cookie-banner.show {
    display: block;
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
}

.cookie-text p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.cookie-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.accept-btn {
    background: #4CAF50;
    color: white;
}

.accept-btn:hover {
    background: #45a049;
}

.reject-btn {
    background: #666;
    color: white;
}

.reject-btn:hover {
    background: #555;
}

@media (min-width: 768px) {
    .cookie-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .cookie-buttons {
        flex-shrink: 0;
    }
}

#container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Safari mobile viewport fix - address bar at bottom pushes content up */
@supports (-webkit-touch-callout: none) {
    /* Safari-specific adjustments */
    #container {
        height: 100vh;
        height: -webkit-fill-available; /* Safari specific height */
        padding-bottom: env(safe-area-inset-bottom, 20px); /* Account for bottom address bar */
        box-sizing: border-box;
    }
    
    #top-bar-container {
        top: max(32px, env(safe-area-inset-top, 32px)); /* Ensure visibility below status bar */
    }
}

#top-bar-container {
    position: absolute;
    top: 32px;
    padding: 12px;
    box-sizing: border-box;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        rgba(120, 81, 169, 0.95),
        rgba(194, 73, 158, 0.95),
        rgba(255, 140, 107, 0.95));
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.3);
    z-index: 9;
    pointer-events: none;
    border-radius: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 540px;
    height: 100px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(255, 140, 200, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: scoreboardGlow 3s ease-in-out infinite;
}

@keyframes scoreboardGlow {
    0%, 100% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(255, 140, 200, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow:
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 60px rgba(255, 140, 200, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

#score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    justify-content: space-between;
    position: relative; /* For absolute positioning of reason message */
}

#score {
    color: #fff;
    font-size: 2.8rem;
    font-family: 'Arial Black', 'Arial Bold', sans-serif;
    font-weight: 900;
    white-space: nowrap;
    line-height: 1;
    min-height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    text-shadow:
        3px 3px 6px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(255, 255, 255, 0.5),
        0 0 40px rgba(255, 200, 255, 0.3);
    letter-spacing: 12px;
}

#player-score,
#ai-score {
    transition: font-size 0.3s ease-out, color 0.3s ease-out, transform 0.2s ease;
    display: inline-block;
    line-height: 1;
    background: linear-gradient(180deg, #ffffff 0%, #fff8dc 50%, #ffe4b5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.player-score-point-anim {
    font-size: 2.5rem !important;
    color: orange !important;
}

.ai-score-point-anim {
    font-size: 2.5rem !important;
    color: orange !important;
}

/* ================ TABLE TENNIS FLIP CARD SCOREBOARD ================ */
#flip-scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 10px 0;
}

.score-side {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.team-label {
    color: #fff;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.9),
        0 0 10px rgba(255, 255, 255, 0.4);
    background: linear-gradient(180deg, #ffffff, #ffeb3b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-divider {
    color: #fff;
    font-size: 2.5rem;
    font-weight: bold;
    font-family: 'Arial Black', Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin: 0 10px;
}

/* Flip Card Container */
.flip-card {
    background-color: transparent;
    width: 80px;
    height: 80px;
    perspective: 1000px;
    border-radius: 8px;
    overflow: hidden;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

/* Flip animation trigger */
.flip-card.flipping .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.flip-card-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
}

.flip-card-back {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 50%, #ffeb3b 100%);
    color: white;
    transform: rotateY(180deg);
}

.flip-card-front span,
.flip-card-back span {
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 2.2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

/* Glowing effect when score changes */
.flip-card.scoring {
    animation: scoreGlow 0.8s ease-out;
}

@keyframes scoreGlow {
    0% { 
        box-shadow: 0 0 20px rgba(255, 107, 53, 0.8); 
        transform: scale(1.1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(255, 107, 53, 1); 
        transform: scale(1.15);
    }
    100% { 
        box-shadow: 0 0 10px rgba(255, 107, 53, 0.3); 
        transform: scale(1);
    }
}

.show-category {
    display: none; /* Hide debug version number from display */
    color: #fff;
    font-size: 0.9rem;
    font-family: monospace;
    text-align: center;
    min-height: 1em;
    position: static;
    top: auto;
    left: auto;
    transform: none;
    width: auto;
    box-sizing: content-box;
    z-index: auto;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 5px;
}

.reason-for-point {
    color: #333; /* Changed from orange to dark gray/black */
    font-size: 1rem;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
    min-height: 1em;
    
    /* Position absolutely to prevent pushing other elements */
    position: absolute;
    top: 100%; /* Position below the score container */
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    z-index: 1000;
    
    /* Nice oblong background styling */
    background: rgba(248, 249, 250, 0.95); /* Soft pastel white with slight transparency */
    border-radius: 20px; /* Oblong shape */
    padding: 8px 16px;
    backdrop-filter: blur(10px); /* Subtle blur effect */
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    
    /* Hide by default, show only when there's content */
    display: none;
    
    /* Ensure proper width */
    white-space: nowrap;
    max-width: 300px;
}

/* Visibility is now controlled by JavaScript in ui_score.js */

/* Info Button - Metallic style on right side */
.info-button {
    position: absolute;
    top: 12px;
    right: 18px; /* Right side to match player score position */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1500;
    pointer-events: auto !important;
    box-sizing: border-box;

    /* Metallic gradient background */
    background: linear-gradient(145deg, #e6e6e6, #cccccc);
    border: 2px solid #999;
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        2px 2px 8px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.info-button:hover {
    transform: scale(1.1);
    box-shadow: 
        inset 2px 2px 5px rgba(255, 255, 255, 0.9),
        inset -2px -2px 5px rgba(0, 0, 0, 0.3),
        3px 3px 10px rgba(0, 0, 0, 0.4);
}

.info-button:active {
    transform: scale(0.95);
    box-shadow: 
        inset -2px -2px 5px rgba(255, 255, 255, 0.8),
        inset 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.info-icon {
    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #444;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    font-family: serif;
}

/* Settings Button - Metallic style underneath info button */
.settings-button {
    position: absolute;
    top: 56px; /* 12px + 36px + 8px gap */
    right: 18px; /* Right side to match player score position */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1500;
    pointer-events: auto !important;
    box-sizing: border-box;

    /* Metallic gradient background */
    background: linear-gradient(145deg, #e6e6e6, #cccccc);
    border: 2px solid #999;
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        2px 2px 8px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-button:hover {
    transform: scale(1.1);
    box-shadow: 
        inset 2px 2px 5px rgba(255, 255, 255, 0.9),
        inset -2px -2px 5px rgba(0, 0, 0, 0.3),
        3px 3px 10px rgba(0, 0, 0, 0.4);
}

.settings-button:active {
    transform: scale(0.95);
    box-shadow: 
        inset -2px -2px 5px rgba(255, 255, 255, 0.8),
        inset 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.settings-icon {
    font-size: 16px;
    color: #444;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Vapor Trail Settings Button - Positioned where AI difficulty button was (left side) */
.vapor-settings-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 18px; /* Left side to match AI score position */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1500;
    pointer-events: auto !important;
    box-sizing: border-box;

    /* Metallic gradient background with sparkle theme */
    background: linear-gradient(145deg, #e6e6ff, #c0c0e8);
    border: 2px solid #9999cc;
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        2px 2px 8px rgba(0, 0, 0, 0.3);

    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.vapor-settings-button:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.9),
        inset -2px -2px 5px rgba(0, 0, 0, 0.3),
        3px 3px 10px rgba(0, 0, 0, 0.4);
}

.vapor-settings-button:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow:
        inset -2px -2px 5px rgba(255, 255, 255, 0.8),
        inset 2px 2px 5px rgba(0, 0, 0, 0.3);
}

.vapor-settings-icon {
    font-size: 16px;
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Info Image Overlay */
#info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.info-overlay-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#info-image {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
}

/* Settings Overlays (Audio and Vapor Trail) */
#audio-settings-overlay,
#vapor-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.settings-overlay-content {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #4ecdc4;
    border-radius: 20px;
    padding: 35px;
    max-width: 450px;
    width: 90vw;
    box-shadow: 
        0 0 20px rgba(78, 205, 196, 0.3),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1),
        inset -2px -2px 5px rgba(0, 0, 0, 0.5),
        0 15px 40px rgba(0, 0, 0, 0.7);
}

.settings-overlay-content h2 {
    color: #4ecdc4;
    margin: 0 0 30px 0;
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 
        0 0 10px rgba(78, 205, 196, 0.5),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

.setting-group {
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.setting-label-title {
    display: block;
    color: #e0e0e0;
    font-weight: bold;
    margin-bottom: 12px;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.setting-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    color: #c0c0c0;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: rgba(78, 205, 196, 0.1);
}

.setting-label:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: translateX(3px);
}

.setting-label input[type="checkbox"],
.setting-label input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.setting-text {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    color: inherit;
}

/* Slider styling */
.slider-container {
    margin-top: 15px;
}

.slider-container input[type="range"] {
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, #4ecdc4, #45b7b8, #32cd32, #ffa500, #ff4500);
    outline: none;
    border-radius: 5px;
    margin-bottom: 10px;
    -webkit-appearance: none;
    appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #4ecdc4, #45b7b8);
    border: 2px solid #4ecdc4;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 0 10px rgba(78, 205, 196, 0.5),
        0 2px 5px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.slider-container input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 
        0 0 15px rgba(78, 205, 196, 0.7),
        0 3px 8px rgba(0, 0, 0, 0.4);
}

.slider-container input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(145deg, #4ecdc4, #45b7b8);
    border: 2px solid #4ecdc4;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 0 10px rgba(78, 205, 196, 0.5),
        0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Disabled slider styles */
.slider-container input[type="range"]:disabled {
    background: linear-gradient(to right, #333, #444, #555, #666, #777);
    cursor: not-allowed;
}

.slider-container input[type="range"]:disabled::-webkit-slider-thumb {
    background: linear-gradient(145deg, #666, #555);
    border: 2px solid #555;
    box-shadow: 
        0 0 5px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
}

.slider-container input[type="range"]:disabled::-webkit-slider-thumb:hover {
    transform: none;
    box-shadow: 
        0 0 5px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2);
}

.slider-container input[type="range"]:disabled::-moz-range-thumb {
    background: linear-gradient(145deg, #666, #555);
    border: 2px solid #555;
    box-shadow: 
        0 0 5px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
}

.slider-container.disabled .slider-labels {
    color: #555;
}

.slider-container.disabled .slider-value {
    color: #666;
    text-shadow: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.slider-value {
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 0 0 8px rgba(78, 205, 196, 0.5);
}

.settings-buttons {
    text-align: center;
    margin-top: 25px;
}

.settings-button-close {
    background: linear-gradient(145deg, #4ecdc4, #45b7b8);
    border: 2px solid #4ecdc4;
    border-radius: 12px;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    color: #1a1a1a;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 0 15px rgba(78, 205, 196, 0.4),
        inset 2px 2px 5px rgba(255, 255, 255, 0.3),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.settings-button-close:hover {
    transform: scale(1.05) translateY(-2px);
    background: linear-gradient(145deg, #56d6cc, #4ecdc4);
    box-shadow: 
        0 0 20px rgba(78, 205, 196, 0.6),
        inset 2px 2px 5px rgba(255, 255, 255, 0.4),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        0 6px 20px rgba(0, 0, 0, 0.4);
}

.settings-button-close:active {
    transform: scale(0.95) translateY(0px);
    background: linear-gradient(145deg, #45b7b8, #3da8a8);
    box-shadow:
        0 0 10px rgba(78, 205, 196, 0.3),
        inset -2px -2px 5px rgba(255, 255, 255, 0.2),
        inset 2px 2px 5px rgba(0, 0, 0, 0.4);
}

/* AI Difficulty Overlay - Futuristic Metallic Style */
#ai-difficulty-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

#ai-difficulty-overlay .difficulty-selection {
    position: relative;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #4ecdc4;
    border-radius: 20px;
    padding: 35px;
    max-width: 450px;
    width: 90vw;
    box-shadow:
        0 0 20px rgba(78, 205, 196, 0.3),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1),
        inset -2px -2px 5px rgba(0, 0, 0, 0.5),
        0 15px 40px rgba(0, 0, 0, 0.7);
}

#ai-difficulty-overlay .overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

#ai-difficulty-overlay .overlay-header h3 {
    color: #4ecdc4;
    margin: 0;
    font-size: 28px;
    font-weight: bold;
    text-shadow:
        0 0 10px rgba(78, 205, 196, 0.5),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
    flex-grow: 1;
    text-align: center;
}

#ai-difficulty-overlay .close-button {
    background: linear-gradient(145deg, #e6e6e6, #cccccc);
    border: 2px solid #999;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #444;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.8),
        inset -2px -2px 5px rgba(0, 0, 0, 0.2),
        2px 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

#ai-difficulty-overlay .close-button:hover {
    transform: scale(1.1);
    box-shadow:
        inset 2px 2px 5px rgba(255, 255, 255, 0.9),
        inset -2px -2px 5px rgba(0, 0, 0, 0.3),
        3px 3px 10px rgba(0, 0, 0, 0.4);
}

#ai-difficulty-overlay .difficulty-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
}

#ai-difficulty-overlay .difficulty-option {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 2px solid rgba(78, 205, 196, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

#ai-difficulty-overlay .difficulty-option:hover {
    background: rgba(78, 205, 196, 0.2);
    transform: translateX(3px);
    border-color: rgba(78, 205, 196, 0.6);
}

#ai-difficulty-overlay .difficulty-option.selected {
    background: rgba(78, 205, 196, 0.3);
    border-color: #4ecdc4;
    box-shadow:
        0 0 15px rgba(78, 205, 196, 0.4),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1);
}

#ai-difficulty-overlay .difficulty-option[data-difficulty="easy"] {
    border-color: rgba(144, 238, 144, 0.6);
}

#ai-difficulty-overlay .difficulty-option[data-difficulty="easy"]:hover,
#ai-difficulty-overlay .difficulty-option[data-difficulty="easy"].selected {
    background: rgba(144, 238, 144, 0.2);
    border-color: #90EE90;
    box-shadow:
        0 0 15px rgba(144, 238, 144, 0.4),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1);
}

#ai-difficulty-overlay .difficulty-option[data-difficulty="hard"] {
    border-color: rgba(255, 182, 193, 0.6);
}

#ai-difficulty-overlay .difficulty-option[data-difficulty="hard"]:hover,
#ai-difficulty-overlay .difficulty-option[data-difficulty="hard"].selected {
    background: rgba(255, 182, 193, 0.2);
    border-color: #FFB6C1;
    box-shadow:
        0 0 15px rgba(255, 182, 193, 0.4),
        inset 2px 2px 5px rgba(255, 255, 255, 0.1);
}

#ai-difficulty-overlay .difficulty-name {
    font-weight: bold;
    font-size: 20px;
    margin-bottom: 8px;
    color: #e0e0e0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

#ai-difficulty-overlay .difficulty-description {
    color: #c0c0c0;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

#audio-panel-toggle-btn {
    display: none;
    top: 55px;
    width: 50px;
    height: 50px;
    background: rgb(0, 198, 31);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    z-index: 10001;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(255,107,53,0.4);
    touch-action: manipulation;
    color: transparent;
    text-shadow: 0 0 0 rgba(128, 0, 255, 0.9);
    pointer-events: auto;
    position: absolute;
    left: 70%;
    transform: translateX(-50%);
}

#controlPanel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateX(-100%);
    width: 80vw;
    height: 90vh;
    background: rgba(128, 0, 255, 0.9);
    border: 2px solid #f700ff;
    border-radius: 20px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-shadow: 0 2px 20px rgba(0, 255, 0, 0.4);
    overflow-y: auto;
    gap: 30px;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    opacity: 0;
    pointer-events: none;
}

#controlPanel.is-visible {
    transform: translate(-50%, -50%) translateX(0);
    opacity: 1;
    pointer-events: all;
}

.category-title {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 10px;
    min-height: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
}

#indicators {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #444;
    border: 2px solid #ccc;
    transition: background-color 0.3s ease;
    position: relative;
}

.indicator[data-index="1"], .indicator[data-index="3"] {
    top: -35px;
}

.indicator[data-index="1"] {
    left: -5px;
}

.indicator[data-index="3"] {
    right: -5px;
}

.indicator[data-index="2"] {
    top: -45px;
}

#modeSelectButton {
    padding: 30px 40px;
    font-size: 18px;
    border-radius: 60px;
    border: none;
    background-color: rgb(0, 198, 31);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

#modeSelectButton:hover {
    background-color: #31f061;
}

/* Mobile-optimized loading screen */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

#loading-logo {
    width: 300px;
    height: auto;
    margin-bottom: 30px;
    animation: pulse 2s infinite;
    transform: rotate(90deg);
}

#loading-text {
    color: white;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    min-height: 27px; /* Prevent layout shift */
}

/* Mobile-specific loading styles */
@media (max-width: 768px) {
    /* Purple background for mobile testing */
    body {
        background-color: #8B008B !important;
    }

    #container {
        background-color: #8B008B !important;
    }

    #loading {
        background: #000000 !important;
    }
    
    #loading-logo {
        width: 250px;
        margin-bottom: 25px;
    }
    
    #loading-text {
        font-size: 16px;
        margin-bottom: 15px;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

/* Loading Progress Bar */
.loading-progress {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin: 20px auto;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.loading-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #81C784);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

@keyframes workingDot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* Error state */
#loading.error #loading-text {
    color: #ff6b6b;
}

#loading.error #loading-logo {
    opacity: 0.5;
}

/* Retry button for mobile */
.retry-button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.retry-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Mobile touch optimizations */
@media (max-width: 768px) {
    .retry-button {
        padding: 12px 24px;
        font-size: 16px;
        min-height: 44px; /* iOS touch target minimum */
    }
}

@media (max-width: 768px) {
    #audio-panel-toggle-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
        top: 38px;
        left: 90%;
    }

    #top-bar-container {
        top: 10px;
        width: 100%;
        left: auto;
        transform: none;
        height: 100px;
    }

    #score {
        font-size: 1.2rem;
        min-height: 1.8rem;
    }

    .player-score-point-anim,
    .ai-score-point-anim {
        font-size: 1.8rem !important;
    }

    #player-score,
    #ai-score {
        font-size: 1.2rem;
    }

    /* Mobile flip card adjustments */
    #flip-scoreboard {
        gap: 15px;
        margin: 8px 0;
    }
    
    .flip-card {
        width: 60px;
        height: 60px;
    }
    
    .flip-card-front span,
    .flip-card-back span {
        font-size: 1.6rem;
    }
    
    .team-label {
        font-size: 0.8rem;
    }
    
    .score-divider {
        font-size: 2rem;
        margin: 0 8px;
    }

    .show-category {
        font-size: 0.7rem;
        padding-top: 0;
        padding-bottom: 0;
    }

    .reason-for-point {
        font-size: 0.9rem;
        padding: 10px 20px; /* Larger padding for mobile */
        margin-top: 15px; /* More space from scoreboard */
        max-width: 250px; /* Adjust width for mobile */
        border-radius: 25px; /* Slightly more rounded for mobile */
    }
    
    /* Info button mobile adjustments */
    .info-button {
        width: 28px;
        height: 28px;
        top: 6px;
        right: 6px; /* Right edge of mobile scoreboard */
    }
    
    .info-icon {
        font-size: 14px;
    }
    
    /* Settings button mobile adjustments */
    .settings-button {
        width: 28px;
        height: 28px;
        top: 40px; /* 6px + 28px height + 6px gap = underneath info button on mobile */
        right: 6px; /* Same right position as info button - right edge of mobile scoreboard */
        
        /* Ensure metallic styling is preserved on mobile */
        background: linear-gradient(145deg, #e6e6e6, #cccccc) !important;
        border: 2px solid #999 !important;
        box-shadow: 
            inset 2px 2px 5px rgba(255, 255, 255, 0.8),
            inset -2px -2px 5px rgba(0, 0, 0, 0.2),
            2px 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    
    .settings-icon {
        font-size: 14px;
    }
    
    /* Settings overlay mobile adjustments */
    .settings-overlay-content {
        max-height: 90vh;
        overflow-y: auto;
        padding: 25px 20px;
        width: 95vw;
        max-width: none;
    }
    
    .settings-overlay-content h2 {
        font-size: 22px;
        margin: 0 0 20px 0;
    }
    
    .setting-group {
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .settings-buttons {
        margin-top: 20px;
        padding-bottom: 50px; /* Extra space at bottom for scroll accessibility */
    }
    
    /* Vapor settings button mobile adjustments */
    .vapor-settings-button {
        width: 28px;
        height: 28px;
        top: 50%;
        transform: translateY(-50%);
        left: 6px; /* Left side to match AI score position on mobile */

        /* Ensure metallic styling is preserved on mobile */
        background: linear-gradient(145deg, #e6e6ff, #c0c0e8) !important;
        border: 2px solid #9999cc !important;
        box-shadow:
            inset 2px 2px 5px rgba(255, 255, 255, 0.8),
            inset -2px -2px 5px rgba(0, 0, 0, 0.2),
            2px 2px 8px rgba(0, 0, 0, 0.3) !important;
    }

    .vapor-settings-icon {
        font-size: 14px;
    }
    
    /* Info overlay mobile adjustments */
    .info-overlay-content {
        max-width: 95vw;
        max-height: 95vh;
    }
}

body {
    overscroll-behavior: none;
}

/* End Game Screen Styles */
#end-game-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    z-index: 1000;
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    overflow-y: auto;
    padding: 20px 0;
    box-sizing: border-box;
}

.end-game-content {
    max-width: 700px;
    width: 90%;
    padding: 20px;
    margin: auto;
}

.end-game-message {
    margin-bottom: 30px;
}

.end-game-message h1 {
    font-size: 2.5rem;
    margin: 0 0 15px 0;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.end-game-message p {
    font-size: 1.3rem;
    margin: 0;
    opacity: 0.9;
}

.marketing-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
    align-items: center;
}

.marketing-box {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 450px;
}

.marketing-box h2 {
    font-size: 1.7rem;
    margin: 0 0 12px 0;
    color: #4ecdc4;
}

.marketing-box p {
    font-size: 1.1rem;
    margin: 0 0 18px 0;
    opacity: 0.9;
}

.primary-button {
    background: linear-gradient(45deg, #ff6b6b, #ff8e53);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.video-section {
    max-width: 500px;
    width: 100%;
}

#marketing-video {
    width: 100%;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .end-game-message h1 {
        font-size: 2rem;
    }
    
    .end-game-message p {
        font-size: 1.2rem;
    }
    
    .marketing-box {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .marketing-box h2 {
        font-size: 1.5rem;
    }
    
    .marketing-box p {
        font-size: 1rem;
    }
    
    .primary-button,
    .secondary-button {
        padding: 15px 30px;
        font-size: 1.1rem;
        width: 100%;
        margin: 10px 0;
        display: block;
        text-align: center;
        min-height: 50px;
        touch-action: manipulation;
    }
    
    /* Ensure replay button is visible and accessible on mobile */
    #replay-button {
        margin-top: 25px;
        background: rgba(78, 205, 196, 0.9) !important;
        border-color: rgba(78, 205, 196, 1) !important;
        position: relative;
        z-index: 1000;
        color: #fff !important;
        font-weight: bold;
    }
    
    #replay-button:hover,
    #replay-button:active {
        background: rgba(78, 205, 196, 1) !important;
        transform: none; /* Remove transform on mobile for better touch response */
    }
    
    /* Fix video appearance on mobile */
    #marketing-video {
        max-height: 250px;
        object-fit: contain;
        background: #000;
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    /* Ensure end-game screen is properly layered on mobile */
    #end-game-screen {
        z-index: 9999;
        padding: 20px;
        box-sizing: border-box;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .end-game-content {
        width: 100%;
        max-width: none;
        padding: 10px;
    }
}

/* Swipe Tutorial Overlay */
#swipe-tutorial-overlay {
    position: fixed;
    bottom: 20px;  /* Even closer to bottom - 20px from actual bottom of screen */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
}

.tutorial-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;  /* Reduced from 15px - finger closer to text box */
}

.finger-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.7;
}

.finger-icon {
    font-size: 3rem;
    animation: swipeLeftRight 2s ease-in-out infinite;
    transform-origin: center;
}

.swipe-arrow {
    font-size: 2rem;
    opacity: 0.5;
    animation: arrowPulse 2s ease-in-out infinite;
}

.tutorial-message {
    color: #ffffff;
    font-size: 1.1rem;  /* Reduced from 1.4rem - smaller text */
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.5px;
    text-align: center;
    white-space: nowrap;  /* Single line - no wrapping */
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.6), 0 0 20px rgba(78, 205, 196, 0.4);
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.85), rgba(100, 225, 216, 0.85));
    padding: 10px 24px;  /* Reduced from 12px 28px - tighter box */
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

@keyframes swipeLeftRight {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-30px); }
    75% { transform: translateX(30px); }
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#splash-screen img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

#splash-screen.fade-out {
    opacity: 0;
}

/* Mobile responsiveness for tutorial elements */
@media (max-width: 768px) {
    /* Position tutorial overlay at fixed distance from bottom on mobile too */
    #swipe-tutorial-overlay {
        bottom: 30px;  /* Closer to bottom - 30px from actual bottom (accounting for safe area) */
    }

    /* Make tutorial elements bigger on mobile */
    .finger-icon {
        font-size: 5rem;  /* Slightly reduced from 6rem */
    }

    .swipe-arrow {
        font-size: 3.5rem;  /* Slightly reduced from 4rem */
    }

    .tutorial-message {
        font-size: 1.4rem;  /* Scaled up from new 1.1rem base */
        padding: 12px 30px;  /* Scaled up padding */
        white-space: nowrap;  /* Ensure single line on mobile too */
    }

    /* Adjust spacing for larger mobile elements */
    .tutorial-content {
        gap: 10px;  /* Reduced from 20px - finger closer to text */
    }

    .finger-animation {
        gap: 12px;  /* Reduced from 15px - tighter */
    }
}