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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: #fff;
    padding-top: 10px;
}

.container {
    text-align: center;
    padding: 10px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

h1 {
    font-size: 2em;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #00ff88, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.mode-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    margin: auto;
}

.mode-selection h2 {
    font-size: 1.5em;
    color: #fff;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.mode-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #fff;
}

.mode-btn:hover {
    transform: scale(1.05);
}

.mode-btn.easy {
    background: linear-gradient(135deg, #00b894, #00cec9);
}

.mode-btn.normal {
    background: linear-gradient(135deg, #0984e3, #74b9ff);
}

.mode-btn.hard {
    background: linear-gradient(135deg, #d63031, #fd79a8);
}

.mode-name {
    font-size: 1.3em;
    font-weight: bold;
}

.mode-desc {
    font-size: 0.85em;
    opacity: 0.9;
}

.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.game-area.hidden {
    display: none;
}

.game-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 1em;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.game-info span {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 15px;
}

#current-letter {
    font-size: 1.1em;
    font-weight: bold;
    color: #ff6b6b;
}

.mode-display {
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.5), rgba(118, 75, 162, 0.5)) !important;
}

#restart-btn, #change-mode-btn {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 6px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85em;
    transition: transform 0.2s;
}

#restart-btn:hover, #change-mode-btn:hover {
    transform: scale(1.05);
}

.canvas-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 0;
    padding: 5px;
}

#gameCanvas {
    border: 3px solid #00ff88;
    border-radius: 10px;
    background: #0a0a0a;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.instructions {
    margin-top: 8px;
    color: #888;
    font-size: 0.85em;
    flex-shrink: 0;
}

.instructions p {
    margin: 2px 0;
}

.score-popup {
    position: fixed;
    font-size: 1.5em;
    font-weight: bold;
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px);
    }
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        padding-top: 5px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .mode-selection {
        padding: 20px;
        gap: 15px;
    }
    
    .mode-selection h2 {
        font-size: 1.2em;
    }
    
    .mode-name {
        font-size: 1.1em;
    }
    
    .mode-btn {
        padding: 12px 20px;
    }
    
    .game-info {
        gap: 8px;
        font-size: 0.85em;
        margin-bottom: 5px;
    }
    
    .game-info span {
        padding: 5px 10px;
    }
    
    .instructions {
        font-size: 0.75em;
        margin-top: 5px;
    }
}