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

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px solid #333;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: bold;
    letter-spacing: 0.2em;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.game-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 30px;
    width: 100%;
    position: relative;
}

.legend {
    position: absolute;
    right: -320px;
    top: 0;
    background: #111;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #333;
    min-width: 280px;
}

.legend h3 {
    font-size: 1.1rem;
    margin-bottom: 15px;
    text-align: center;
    color: #fff;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-tile {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid;
    border-radius: 3px;
    flex-shrink: 0;
}

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

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

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

.legend-item span {
    font-size: 0.9rem;
    color: #ccc;
    line-height: 1.3;
}

#game-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    margin-bottom: 30px;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.tile {
    width: 60px;
    height: 60px;
    border: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    background: #000;
    color: #fff;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.tile.filled {
    border-color: #666;
    background: #111;
}

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

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

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

.tile.flip {
    animation: flip 0.6s ease-in-out;
}

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

#message {
    height: 30px;
    font-size: 1.1rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

#keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

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

.keyboard-row:nth-child(2) {
    padding: 0 15px;
}

button {
    padding: 12px;
    font-size: 0.9rem;
    font-weight: bold;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    text-transform: uppercase;
}

button:hover {
    background: #444;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

button.wide {
    padding: 12px 20px;
    font-size: 0.8rem;
}

button.correct {
    background: #6aaa64;
    color: #fff;
}

button.present {
    background: #c9b458;
    color: #fff;
}

button.absent {
    background: #787c7e;
    color: #fff;
}

#reset-btn {
    background: #fff;
    color: #000;
    padding: 15px 30px;
    font-size: 1rem;
    border-radius: 6px;
    margin-top: 10px;
}

#reset-btn:hover {
    background: #ddd;
    transform: translateY(-2px);
}

@media (max-width: 1200px) {
    .legend {
        position: static;
        margin-top: 20px;
        width: 100%;
        max-width: 320px;
    }

    .game-container {
        flex-direction: column;
        align-items: center;
        gap: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
        max-width: 500px;
    }

    h1 {
        font-size: 2rem;
    }

    .legend {
        min-width: auto;
        width: 100%;
        max-width: 320px;
    }
    
    .tile {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    button {
        padding: 10px 8px;
        font-size: 0.8rem;
        min-width: 35px;
    }
    
    .keyboard-row {
        gap: 4px;
    }
}


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

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    text-align: center;
}

.modal-content h3 {
    margin-top: 0;
    color: #333;
}

.modal-content input {
    padding: 10px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin: 10px 0;
    width: 200px;
    text-align: center;
    text-transform: uppercase;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.set-word-btn {
    background-color: #6aaa64;
    color: white;
}

.set-word-btn:hover {
    background-color: #5a9a54;
}

.cancel-word-btn {
    background-color: #787c7e;
    color: white;
}

.cancel-word-btn:hover {
    background-color: #686c6e;
}

.custom-word-btn {
    background: #fff;
    color: #000;
    padding: 15px 30px;
    font-size: 1rem;
    border-radius: 6px;
    margin-top: 10px;
}

.custom-word-btn:hover {
    background-color: #717374;
}
