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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    color: #000000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 5px;
    position: relative;
}

.school-logo {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 130px;
    height: 130px;
    z-index: 100;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    -moz-user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

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

header {
    width: 100%;
    text-align: center;
    padding: 5px 0;
    border-bottom: 1px solid #d3d6da;
    margin-bottom: 0;
}

header h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #000000;
    margin: 0;
}

.game-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 0;
}

.message {
    height: 20px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: #000000;
    visibility: hidden;
}

.message.show {
    visibility: visible;
}

.message.error {
    color: #d32f2f;
}

.message.success {
    color: #6aaa64;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 350px;
    aspect-ratio: 5/6;
}

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

.tile.filled {
    border-color: #878a8c;
    animation: pop 0.1s;
}

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

.tile.correct {
    background-color: #6aaa64;
    border-color: #6aaa64;
    color: #ffffff;
    animation: flip 0.6s ease-in;
}

.tile.present {
    background-color: #c9b458;
    border-color: #c9b458;
    color: #ffffff;
    animation: flip 0.6s ease-in;
}

.tile.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: #ffffff;
    animation: flip 0.6s ease-in;
}

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

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

.keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 8px;
}

.replay-button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    background-color: #6aaa64;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 20px;
    transition: background-color 0.2s;
}

.replay-button:hover {
    background-color: #5a9a54;
}

.replay-button:active {
    background-color: #4a8a44;
}

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

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

.key:hover {
    background-color: #c5c8cb;
}

.key:active {
    background-color: #b8bbbe;
}

.key:focus {
    outline: none;
}

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

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

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

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

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #000000;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background-color: #f0f0f0;
}

.modal h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #000000;
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #000000;
}

.modal p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: #000000;
}

.modal ul {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

.modal ul li {
    font-size: 16px;
    margin-bottom: 8px;
    padding-left: 24px;
    position: relative;
    color: #000000;
}

.modal ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #000000;
}

.example-word {
    display: flex;
    gap: 5px;
    margin: 16px 0;
}

.example-tile {
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 700;
    border: 2px solid #d3d6da;
    text-transform: uppercase;
}

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

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

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

.word-length-selection {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #d3d6da;
}

.word-length-selection label {
    font-size: 16px;
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
    color: #000000;
}

.length-options {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.length-option {
    flex: 1;
    padding: 12px;
    border: 2px solid #d3d6da;
    border-radius: 4px;
    background-color: #ffffff;
    cursor: pointer;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    color: #000000;
}

.length-option:hover {
    background-color: #f5f5f5;
    border-color: #878a8c;
}

.length-option.selected {
    background-color: #6aaa64;
    border-color: #6aaa64;
    color: #ffffff;
}

.start-button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    background-color: #6aaa64;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.start-button:hover {
    background-color: #5a9a54;
}

@media (max-width: 480px) {
    header h1 {
        font-size: 28px;
    }
    
    .tile {
        font-size: 24px;
    }
    
    .key {
        height: 50px;
        font-size: 12px;
        min-width: 30px;
    }
    
    .grid {
        max-width: 280px;
    }
    
    .modal {
        padding: 20px;
    }
    
    .example-tile {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}