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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

header h1 {
    font-size: 20px;
    margin-bottom: 10px;
}

.header-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.header-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.score-board {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    opacity: 0.9;
    flex-wrap: wrap;
    gap: 5px;
}

.network-status {
    font-size: 10px;
    opacity: 0.8;
}

.game-screen {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Difficulty Selector */
.difficulty-selector {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.difficulty-selector h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.difficulty-btn {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-color: #4facfe;
}

.level-icon {
    font-size: 20px;
}

.level-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.level-desc {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

/* Game Area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
}

.hangman-display {
    text-align: center;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.hangman-drawing svg {
    max-width: 100%;
    height: auto;
}

.attempts-left {
    margin-top: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #e74c3c;
}

.word-display {
    text-align: center;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

#wordDisplay {
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 6px;
    margin-bottom: 10px;
    color: #333;
    font-family: 'Courier New', monospace;
    min-height: 30px;
}

.word-hint {
    font-size: 13px;
    color: #666;
    font-style: italic;
    line-height: 1.4;
    min-height: 18px;
}

/* Alphabet Grid */
.alphabet-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 200px;
    align-content: start;
}

.letter-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.letter-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.letter-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.letter-btn.correct {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
}

.letter-btn.incorrect {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

/* Game Over Modal */
.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;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    margin: 20px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header h2 {
    margin-bottom: 8px;
    color: #333;
    font-size: 18px;
}

.modal-header div {
    font-size: 40px;
    margin-bottom: 15px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body p {
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
}

#correctAnswer {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.modal-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.modal-btn:not(.primary) {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e0e0e0;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Animations */
.letter-btn.animate-correct {
    animation: correctPulse 0.6s ease;
}

.letter-btn.animate-incorrect {
    animation: incorrectShake 0.6s ease;
}

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

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

.body-part {
    animation: drawBodyPart 0.5s ease;
}

@keyframes drawBodyPart {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive adjustments */
@media (max-width: 360px) {
    .container {
        max-width: 100%;
    }
    
    .alphabet-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
        padding: 12px;
    }
    
    #wordDisplay {
        font-size: 20px;
        letter-spacing: 4px;
    }
    
    .header-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-height: 600px) {
    header {
        padding: 10px;
    }
    
    header h1 {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .game-screen {
        padding: 10px;
    }
    
    .hangman-display {
        padding: 10px;
    }
    
    .hangman-drawing svg {
        width: 140px;
        height: 160px;
    }
}

@media (min-height: 700px) {
    .game-screen {
        padding: 20px;
    }
    
    .game-area {
        gap: 20px;
    }
}