* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    overscroll-behavior: contain;
    touch-action: manipulation;
}

.game-container {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    margin: 20px;
    z-index: 10;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

.subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.score-display {
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
}

#message {
    font-size: 1.3rem;
    margin-bottom: 30px;
    min-height: 30px;
    font-weight: 500;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(2, 150px);
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
}

.color-button {
    width: 150px;
    height: 150px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 4px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.color-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    border-radius: inherit;
    pointer-events: none;
}

.color-button:hover:not(.disabled) {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.color-button.active {
    transform: scale(1.1);
    filter: brightness(1.8);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8);
    animation: pulse 0.6s ease-in-out;
}

.color-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.red { background-color: #e74c3c; }
.blue { background-color: #3498db; }
.green { background-color: #2ecc71; }
.yellow { background-color: #f1c40f; }

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 16px;
}

#start-btn {
    background: white;
    color: #667eea;
    padding: 15px 30px;
    font-size: 18px;
}

#start-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#sound-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#sound-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Modal Styles */
.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;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #667eea;
    font-size: 1.8rem;
}

.final-score {
    font-size: 2.5rem;
    margin: 20px 0;
    color: #667eea;
    font-weight: bold;
}

.new-record {
    font-size: 1.2rem;
    color: #e74c3c;
    font-weight: bold;
    margin-top: 10px;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

#play-again-btn, #share-btn {
    background: #667eea;
    color: white;
    padding: 12px 25px;
    border-radius: 20px;
    flex: 1;
    min-width: 120px;
}

#play-again-btn:hover, #share-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

/* Ad Containers */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 15px 0;
}

.top-ad {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.bottom-ad {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.modal-ad {
    margin: 20px 0;
}

.ad-placeholder {
    background: rgba(0, 0, 0, 0.1);
    color: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 12px;
    border: 1px dashed rgba(0, 0, 0, 0.2);
}

/* Share Message */
.share-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2ecc71;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 2000;
    animation: fadeInOut 2s ease-in-out;
}

/* SEO Content */
.seo-content {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1.1); }
    50% { transform: scale(1.15); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .game-container {
        padding: 25px;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2.5rem;
    }
    
    .game-board {
        grid-template-columns: repeat(2, 120px);
        gap: 15px;
    }
    
    .color-button {
        width: 120px;
        height: 120px;
    }
    
    .score-display {
        font-size: 1.2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .top-ad, .bottom-ad {
        position: relative;
        transform: none;
        left: auto;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus, .color-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .color-button {
        border-width: 5px !important;
    }
}