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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #121213;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #3a3a3c;
    width: 100%;
    padding-bottom: 20px;
}

header h1 {
    font-size: 37px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #ffffff;
    text-transform: uppercase;
}

.game-container {
    width: 100%;
    margin-bottom: 40px;
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
}

.row {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.tile {
    width: 62px;
    height: 62px;
    border: 2px solid #3a3a3c;
    background-color: #121213;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    color: #ffffff;
    transition: all 0.2s ease;
}

.tile.filled {
    border-color: #565758;
    animation: pop 0.1s ease;
}

.tile.correct {
    background-color: #6aaa64;
    border-color: #6aaa64;
    color: #ffffff;
}

.tile.present {
    background-color: #c9b458;
    border-color: #c9b458;
    color: #ffffff;
}

.tile.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: #ffffff;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes flip {
    0% {
        transform: rotateX(0);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0);
    }
}

.tile.flip {
    animation: flip 0.6s ease;
}

.toast-message {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background-color: #3a3a3c;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.toast-message.show {
    opacity: 1;
    visibility: visible;
}

.welcome-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.welcome-modal.show {
    opacity: 1;
    visibility: visible;
}

.welcome-box {
    background-color: #121213;
    border: 2px solid #3a3a3c;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    max-width: 320px;
    width: 90%;
}

.welcome-box h2 {
    font-size: 28px;
    margin: 0 0 24px;
    color: #fff;
}

.game-over-modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.game-over-modal.show {
    opacity: 1;
    visibility: visible;
}

.game-over-box {
    background-color: #121213;
    border: 2px solid #3a3a3c;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    max-width: 320px;
    width: 90%;
}

.game-over-box h2 {
    font-size: 28px;
    margin: 0 0 16px;
    color: #fff;
}

.game-over-word {
    font-size: 18px;
    color: #787c7e;
    margin: 0 0 24px;
}

.game-over-word:empty {
    display: none;
}

.play-again-btn {
    background-color: #6aaa64;
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.play-again-btn:hover {
    background-color: #5a9a54;
}

.keyboard-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 500px;
    margin-top: 20px;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.key {
    flex: 1;
    min-width: 0;
    height: 58px;
    border: none;
    border-radius: 4px;
    background-color: #818384;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.key:hover {
    background-color: #6b6d6f;
}

.key:active {
    background-color: #565758;
    transform: scale(0.95);
}

.key.key-wide {
    flex: 1.5;
    font-size: 12px;
}

.key.correct {
    background-color: #6aaa64;
    color: #ffffff;
}

.key.present {
    background-color: #c9b458;
    color: #ffffff;
}

.key.absent {
    background-color: #3a3a3c;
    color: #ffffff;
}

/* Responsive design */
@media (max-width: 600px) {
    .tile {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }
    
    .key {
        height: 50px;
        font-size: 12px;
    }
    
    header h1 {
        font-size: 32px;
    }
}

@media (max-width: 400px) {
    .tile {
        width: 45px;
        height: 45px;
        font-size: 24px;
    }
    
    .key {
        height: 45px;
        font-size: 11px;
    }
}
