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

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #3d3a38;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #e8e4e0;
    padding: 40px 20px;
}

.header {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    margin: 0;
    color: #f0ebe6;
}

.header-buttons {
    right: 0;
    display: flex;
    gap: 16px;
    align-items: center;
}

.instructions-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #4a4644;
    border: 2px solid #5a5654;
    color: #c9a882;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.instructions-btn:hover {
    background-color: #524e4c;
    border-color: #6a6664;
    color: #d4b594;
}

.instructions-btn:active {
    background-color: #3d3a38;
    border-color: #4a4644;
}

.header .new-puzzle-btn,
.header .hint-btn {
    margin-top: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
    height: 36px;
}

@media (max-width: 768px) {
    .header {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.8rem;
        letter-spacing: 0.2em;
    }

    .header-buttons {
        gap: 12px;
    }

    .instructions-btn {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
    }

    .header .new-puzzle-btn,
    .header .hint-btn {
        padding: 5px 10px;
        font-size: 0.7rem;
        height: 32px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 20px 10px;
    }

    .header {
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.5rem;
        letter-spacing: 0.15em;
    }

    .header-buttons {
        gap: 8px;
    }

    .instructions-btn {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }

    .header .new-puzzle-btn,
    .header .hint-btn {
        padding: 4px 8px;
        font-size: 0.65rem;
        height: 28px;
    }
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.available-letters {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background-color: #4a4644;
    border: 2px solid #5a5654;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.available-letter {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #6b8f71;
    color: #f0ebe6;
    transition: all 0.15s ease;
}

@media (max-width: 480px) {
    .available-letters {
        gap: 6px;
        padding: 12px 8px;
    }

    .available-letter {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

.available-letter.used {
    background-color: #52504e;
    color: #7a7775;
}

.available-letter.win {
    background-color: #6b8f71;
    color: #f0ebe6;
    animation: pop 0.3s ease;
}

.rows-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-row {
    margin-bottom: 24px;
}

.secondary-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.row {
    display: flex;
    gap: 8px;
}

.cell {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #4a4644;
    border: 2px solid #5a5654;
    color: #f0ebe6;
    transition: all 0.1s ease;
}

.main-row .cell {
    width: 58px;
    height: 58px;
    font-size: 1.7rem;
    background-color: #524e4c;
    border-color: #6a6664;
}

@media (max-width: 768px) {
    .cell {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .main-row .cell {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .cell {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    .main-row .cell {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        border-width: 2px;
    }

    .row {
        gap: 4px;
    }

    .rows-container .main-row {
        margin-bottom: 16px;
    }

    .secondary-rows {
        gap: 6px;
    }
}

.cell.filled {
    border-color: #8b7355;
    background-color: #554f4a;
}

.main-row .cell.filled {
    border-color: #a88b6d;
    background-color: #5a5450;
}

.cell.current {
    border-color: #c9a882;
}

.secondary-rows .row:nth-child(1) .cell {
    border-color: #6b5a5a;
}

.secondary-rows .row:nth-child(1) .cell.filled {
    border-color: #8b6a6a;
    background-color: #4d4545;
}

.secondary-rows .row:nth-child(2) .cell {
    border-color: #5a6b5a;
}

.secondary-rows .row:nth-child(2) .cell.filled {
    border-color: #6a8b6a;
    background-color: #454d45;
}

.secondary-rows .row:nth-child(3) .cell {
    border-color: #5a5a6b;
}

.secondary-rows .row:nth-child(3) .cell.filled {
    border-color: #6a6a8b;
    background-color: #45454d;
}

.secondary-rows .row:nth-child(4) .cell {
    border-color: #6b5f5a;
}

.secondary-rows .row:nth-child(4) .cell.filled {
    border-color: #8b7a6a;
    background-color: #4d4a45;
}

.cell.shrouded {
    background-color: #252322 !important;
    border-color: #302d2b !important;
    color: #4a4745;
}

.cell.shrouded.filled {
    background-color: #2a2725 !important;
    border-color: #383432 !important;
    color: #5a5753;
}

.cell.revealed {
    background-color: #5a6b6b !important;
    border-color: #7a9b9b !important;
    color: #aadddd;
}

.main-row .cell.revealed {
    background-color: #5a6b6b !important;
    border-color: #8aabab !important;
}

.cell.correct {
    animation: pop 0.3s ease;
}

.main-row .cell.correct {
    background-color: #6a6260 !important;
    border-color: #b8a490 !important;
}

.secondary-rows .row:nth-child(1) .cell.correct {
    background-color: #5d4f4f !important;
    border-color: #a87878 !important;
}

.secondary-rows .row:nth-child(2) .cell.correct {
    background-color: #4f5d4f !important;
    border-color: #78a878 !important;
}

.secondary-rows .row:nth-child(3) .cell.correct {
    background-color: #4f4f5d !important;
    border-color: #7878a8 !important;
}

.secondary-rows .row:nth-child(4) .cell.correct {
    background-color: #5d564f !important;
    border-color: #a89078 !important;
}

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

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.available-letters.invalid {
    animation: flash-invalid 0.3s ease;
}

@keyframes flash-invalid {
    0% {
        background-color: #4a4644;
    }

    50% {
        background-color: #5c4444;
    }

    100% {
        background-color: #4a4644;
    }
}

.new-puzzle-btn,
.hint-btn {
    margin-top: 40px;
    padding: 8px 16px;
    background-color: #4a4644;
    border: 2px solid #5a5654;
    color: #c9a882;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.new-puzzle-btn:hover,
.hint-btn:hover {
    background-color: #524e4c;
    border-color: #6a6664;
    color: #d4b594;
}

.new-puzzle-btn:active,
.hint-btn:active {
    background-color: #3d3a38;
    border-color: #4a4644;
}

.new-puzzle-btn:disabled,
.hint-btn:disabled {
    background-color: #3d3a38;
    border-color: #4a4644;
    color: #5a5654;
    cursor: not-allowed;
}

.instructions {
    margin-top: 20px;
    text-align: center;
    color: #9a9693;
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 500px;
    padding: 0 10px;
}

.instructions span {
    color: #c9a882;
}

@media (max-width: 480px) {
    .instructions {
        font-size: 0.8rem;
        margin-top: 15px;
    }
}

/* Keyboard Styles */
.keyboard {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 600px;
    width: 100%;
    padding: 0 10px;
}

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

.key {
    min-width: 40px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4a4644;
    border: 2px solid #5a5654;
    color: #e8e4e0;
    font-size: 1.4rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    flex: 1;
    max-width: 50px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    border-radius: 4px;
}

.key.wide {
    flex: 1.5;
    max-width: 70px;
    font-size: 0.85rem;
    text-transform: none;
}

.key:hover {
    background-color: #524e4c;
    border-color: #6a6664;
}

.key:active {
    background-color: #3d3a38;
    border-color: #4a4644;
    transform: scale(0.95);
}

.key.used {
    background-color: #52504e;
    color: #7a7775;
    border-color: #4a4644;
}

.key.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.key.disabled:hover {
    background-color: #4a4644;
    border-color: #5a5654;
}

@media (max-width: 768px) {
    .keyboard {
        margin-top: 25px;
        gap: 6px;
    }

    .key {
        min-width: 32px;
        height: 48px;
        font-size: 1.2rem;
        max-width: 42px;
    }

    .key.wide {
        max-width: 60px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .keyboard {
        margin-top: 20px;
        gap: 5px;
    }

    .keyboard-row {
        gap: 4px;
    }

    .key {
        min-width: 26px;
        height: 42px;
        font-size: 1rem;
        max-width: 36px;
        border-width: 1px;
    }

    .key.wide {
        max-width: 50px;
        font-size: 0.7rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #3d3a38;
    border: 2px solid #5a5654;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #9a9693;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #c9a882;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #f0ebe6;
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.modal-content h3 {
    margin: 30px 0 15px 0;
    color: #c9a882;
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.instructions-text {
    color: #e8e4e0;
    line-height: 1.6;
    margin-bottom: 20px;
}

.instructions-text p {
    margin-bottom: 15px;
}

.instructions-text ul {
    list-style: none;
    padding-left: 0;
}

.instructions-text li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.instructions-text li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #c9a882;
}

.kbd {
    display: inline-block;
    background-color: #4a4644;
    border: 1px solid #5a5654;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: monospace;
    color: #c9a882;
    font-weight: 600;
}

.example-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background-color: #4a4644;
    border-radius: 8px;
}

.example-available-letters {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    background-color: #524e4c;
    border: 2px solid #5a5654;
    flex-wrap: wrap;
    justify-content: center;
}

.example-available-letters .available-letter {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

.example-rows-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.example-main-row {
    margin-bottom: 16px;
}

.example-main-row .cell {
    width: 38px;
    height: 38px;
    font-size: 1.2rem;
}

.example-secondary-rows .cell {
    width: 32px;
    height: 32px;
    font-size: 1rem;
}

.example-secondary-rows {
    gap: 6px;
}

@media (max-width: 768px) {
    .modal-content {
        padding: 30px 25px;
    }

    .modal-content h2 {
        font-size: 1.6rem;
    }

    .example-main-row .cell {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .example-secondary-rows .cell {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .example-available-letters .available-letter {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
}

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

    .modal-content {
        padding: 25px 15px;
        max-height: 95vh;
    }

    .modal-content h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }

    .modal-content h3 {
        font-size: 1rem;
        margin: 20px 0 10px 0;
    }

    .modal-close {
        font-size: 2rem;
        width: 35px;
        height: 35px;
    }

    .example-container {
        padding: 15px 10px;
    }

    .example-main-row .cell {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .example-secondary-rows .cell {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
        border-width: 1px;
    }

    .example-available-letters .available-letter {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .example-available-letters {
        gap: 4px;
        padding: 10px 12px;
    }

    .example-secondary-rows {
        gap: 4px;
    }

    .example-secondary-rows .row {
        gap: 4px;
    }

    .example-main-row {
        margin-bottom: 12px;
    }

}