body {
    font-family: 'Press Start 2P', sans-serif;
    background: linear-gradient(120deg, #1e3c72, #2a5298);
    color: #ffffff;
    margin: 0;
    padding: 0;
    text-align: center;
    overflow-x: hidden;
}

#formed-words {
    display: none;
}

h2 {
    font-size: 28px;
    color: #ffd700;
    font-weight: bold;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 10px;
}

.score-board {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    background: linear-gradient(to right, #ff7e5f, #feb47b);
    border-radius: 12px;
    margin: 20px auto;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 18px;
}

.score-left, .score-center, .score-right {
    flex: 1;
    text-align: center;
}

#timer {
    color: #ff4444;
    font-weight: bold;
    font-size: 26px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.tiles-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.letter {
    padding: 20px;
    margin: 10px;
    background: radial-gradient(circle, #4caf50, #388e3c);
    color: #fff;
    border: 2px solid #2e7d32;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    border-radius: 12px;
    transition: transform 0.3s, background-color 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
}

.letter:hover {
    background: linear-gradient(to bottom, #66bb6a, #43a047);
    transform: scale(1.1) rotate(3deg);
}

.word-board {
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(to bottom, #3949ab, #1e88e5);
    border: 2px solid #1565c0;
    border-radius: 12px;
    color: #fff;
    font-size: 26px;
    font-weight: bold;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    text-align: center;
    width: 70%;
    max-width: 600px;
    min-height: 30px;
}

.clear-word-btn, .next-level-button, .start-game-button, .play-again-button, .hint-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(135deg, #ff6f00, #ff8f00);
    border: none;
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.2s ease;
}

.clear-word-btn:hover, .next-level-button:hover, .start-game-button:hover, .play-again-button:hover, .hint-btn:hover {
    background: linear-gradient(135deg, #ffa000, #ffc107);
    transform: scale(1.1);
}

.word-grid {
    margin: 20px auto;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content; 
    justify-content: center; 
    gap: 15px;
    padding: 20px;
}

.word-grid .word {
    padding: 15px;
    background: linear-gradient(to bottom, #e91e63, #d81b60);
    border: 2px solid #c2185b;
    color: black;
    font-size: 22px;
    height: 25px;
    border-radius: 10px;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s, background-color 0.3s ease;
}

.word-grid .word span {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: lightgray;
    margin: 2px;
    text-align: center;
    line-height: 20px;
}

.word-grid .word:hover {
    background: linear-gradient(to bottom, #f06292, #e91e63);
    transform: scale(1.05);
}

.box {
    display: inline-block;
    width: 40px; 
    height: 40px;
    background-color: lightgray;
    margin: 5px;
    text-align: center;
    line-height: 40px; 
    font-size: 18px;
    font-weight: bold;
    border: 2px solid darkgray;
    box-sizing: border-box;
    transition: 0.3s ease; 
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    padding-top: 60px;
    animation: fadeIn 0.5s ease-in-out;
}

.modal-content {
    background: linear-gradient(to bottom, #4caf50, #388e3c);
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 80%;
    max-width: 500px;
    color: #fff;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.modal-content h2 {
    font-size: 26px;
    text-shadow: 2px 2px 4px #000;
}

.modal-content p {
    font-size: 18px;
    line-height: 1.6;
}

.modal-content img {
    width: 80%; 
    height: auto; 
    max-width: 400px; 
    display: block; 
    margin: 0 auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .score-board {
        flex-direction: row; 
        max-width: 100%;
    }
    
    .score-left, .score-center, .score-right {
        text-align: center;
        margin-bottom: 10px;
    }
    h2 {
        font-size: 22px;
    }

    .letter {
        font-size: 16px;
        padding: 15px;
    }

    .word-board {
        font-size: 20px;
    }
    .word-grid {
        grid-template-rows: repeat(2, 1fr); 
        grid-auto-columns: auto; 
        justify-items: center; 
    }
}
