* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#game-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 900px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Courier New', monospace;
}

#game-stats {
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-weight: bold;
    color: #495057;
}

#game-stats span {
    font-size: 1.1rem;
}

#challenge-area {
    text-align: center;
    margin-bottom: 20px;
}

#instructions {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #495057;
    font-weight: 500;
}

#canvas {
    border: 3px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    margin-bottom: 20px;
    max-width: 100%;
    height: auto;
}

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#textInput {
    padding: 12px;
    font-size: 1.1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    min-width: 300px;
    text-align: center;
}

#textInput:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

#imageGrid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    max-width: 300px;
    margin: 0 auto;
}

#sliderArea {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.grid-square {
    width: 100px;
    height: 100px;
    border: 2px solid #dee2e6;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.grid-square:hover {
    border-color: #4285f4;
    background: #e3f2fd;
}

.grid-square.selected {
    border-color: #4285f4;
    background: #2196f3;
    color: white;
}

#audioArea {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#playAudio {
    padding: 12px 24px;
    font-size: 1.1rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#playAudio:hover {
    background: #45a049;
}

#robotCheck {
    font-size: 1.2rem;
    padding: 15px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: #f8f9fa;
}

#robotCheck label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

#robotCheckbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

button {
    padding: 12px 24px;
    font-size: 1.1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 120px;
}

#submitBtn {
    background: #4285f4;
    color: white;
}

#submitBtn:hover {
    background: #3367d6;
    transform: translateY(-2px);
}

#skipBtn {
    background: #FF9800;
    color: white;
}

#skipBtn:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

#restartBtn {
    background: #4CAF50;
    color: white;
    font-size: 1.3rem;
    padding: 15px 30px;
}

#restartBtn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

#progress {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

#progressBar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 10px;
}

#gameOver {
    text-align: center;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 3px solid #4CAF50;
}

#gameOver h2 {
    font-size: 2.5rem;
    color: #4CAF50;
    margin-bottom: 20px;
}

#gameOver p {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #495057;
}

#finalScore {
    font-weight: bold;
    color: #FF9800;
}

@media (max-width: 768px) {
    #game-container {
        padding: 20px;
        margin: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    #game-stats {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #canvas {
        width: 100%;
        max-width: 100%;
    }
    
    #textInput {
        min-width: auto;
        width: 100%;
        max-width: 300px;
    }
    
    #controls {
        flex-direction: column;
    }
    
    button {
        width: 100%;
        max-width: 200px;
    }
}

/* Loading and animation effects */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.success-glow {
    box-shadow: 0 0 20px #4CAF50;
    animation: successPulse 0.6s ease-in-out;
}

.error-glow {
    box-shadow: 0 0 20px #F44336;
    animation: errorShake 0.6s ease-in-out;
}

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

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

/* Glitch effect for transitions */
.glitch {
    animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
    0%, 100% { 
        filter: none; 
    }
    20% { 
        filter: hue-rotate(90deg) saturate(2); 
        transform: translateX(2px);
    }
    40% { 
        filter: hue-rotate(180deg) saturate(0.5); 
        transform: translateX(-2px);
    }
    60% { 
        filter: hue-rotate(270deg) saturate(3); 
        transform: translateX(1px);
    }
    80% { 
        filter: hue-rotate(360deg) saturate(0); 
        transform: translateX(-1px);
    }
}