* {
    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;
}

.container {
    width: 100%;
    max-width: 800px;
}

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

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

.stats-toggle {
    position: absolute;
    top: 0;
    right: 0;
}

.stats-toggle button {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.stats-toggle button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.stats-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.stats-panel.hidden {
    display: none;
}

.stats-panel h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
}

.game-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.category-selection {
    margin-bottom: 25px;
    text-align: center;
}

.category-selection h3 {
    color: #667eea;
    margin-bottom: 15px;
}

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

.category-btn {
    position: relative;
    cursor: pointer;
}

.category-btn input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.category-btn span {
    display: block;
    padding: 12px 24px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
}

.category-btn input:checked + span {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    transform: scale(1.05);
}

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

.game-info {
    text-align: center;
    margin-bottom: 20px;
}

.attempts-left {
    font-size: 1.3rem;
    color: #333;
    font-weight: 600;
}

.attempts-left span {
    color: #e74c3c;
    font-size: 1.5rem;
    font-weight: bold;
}

.hangman-display {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.body-part {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.word-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    min-height: 60px;
}

.letter {
    width: 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    border-bottom: 3px solid #667eea;
    color: #667eea;
}

.letter.revealed {
    animation: revealLetter 0.3s ease-in-out;
}

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

.wrong-letters {
    text-align: center;
    margin-bottom: 25px;
    min-height: 60px;
}

.wrong-letters h4 {
    color: #e74c3c;
    margin-bottom: 10px;
}

#wrongLettersList {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.wrong-letter {
    display: inline-block;
    padding: 8px 12px;
    background: #e74c3c;
    color: white;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1rem;
}

.keyboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
    gap: 8px;
    margin-bottom: 25px;
}

.key {
    padding: 15px 10px;
    font-size: 1.1rem;
    font-weight: bold;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.key:hover:not(.correct):not(.wrong) {
    background: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.key.correct {
    background: #27ae60;
    color: white;
    border-color: #27ae60;
    cursor: not-allowed;
}

.key.wrong {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
    cursor: not-allowed;
}

.game-controls {
    text-align: center;
}

.btn-primary {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    width: 100%;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    animation: modalAppear 0.3s ease-in-out;
}

@keyframes modalAppear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

.modal-content p {
    font-size: 1.3rem;
    margin-bottom: 25px;
    color: #555;
}

.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.confetti-container.hidden {
    display: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    .stats-toggle {
        position: static;
        margin-top: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .game-container {
        padding: 20px;
    }
    
    .category-buttons {
        flex-direction: column;
    }
    
    .category-btn span {
        width: 100%;
    }
    
    .word-display {
        gap: 5px;
    }
    
    .letter {
        width: 30px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .keyboard {
        grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
        gap: 5px;
    }
    
    .key {
        padding: 12px 5px;
        font-size: 1rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-content h2 {
        font-size: 2rem;
    }
    
    .modal-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .hangman-display svg {
        width: 150px;
        height: 180px;
    }
    
    .letter {
        width: 25px;
        height: 35px;
        font-size: 1.2rem;
    }
}