.word-fill {
    max-width: 820px;
    margin: 20px auto;
    padding: 24px;
    font-family: Arial, sans-serif;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-sizing: border-box;
}

.word-fill * {
    box-sizing: border-box;
}

.word-fill h3 {
    margin: 0 0 10px;
    text-align: center;
    font-size: 24px;
}

.word-fill-instruction {
    margin: 0 0 18px;
    text-align: center;
    color: #666;
    font-size: 15px;
}

.word-fill-progress {
    margin-bottom: 16px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.word-fill-passage {
    min-height: 130px;
    padding: 18px 20px;
    background: #fbfcfe;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
}

.word-fill-passage p {
    margin: 0;
    font-size: 18px;
    line-height: 2.1;
}

.fill-gap {
    display: inline;
    white-space: nowrap;
    margin: 0 2px;
}

.fill-gap-number {
    margin-right: 2px;
    color: #002244;
    font-size: 12px;
    font-weight: bold;
    vertical-align: super;
}

.fill-input {
    width: 9ch;
    min-width: 9ch;
    padding: 0 3px 1px;
    border: 0;
    border-bottom: 2px solid #002244;
    background: transparent;
    color: #002244;
    font: inherit;
    text-align: center;
    outline: none;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.fill-input:focus {
    border-bottom-color: #2878c8;
    background: #f2f8ff;
}

.fill-input.correct {
    border-bottom-color: #269b4b;
    color: #1d7a3b;
}

.fill-input.incorrect {
    border-bottom-color: #d83232;
    color: #b52323;
}

.fill-gap-prompt {
    margin-left: 3px;
    color: #666;
    font-size: 12px;
}

.fill-correction {
    margin-left: 3px;
    color: #b52323;
    font-size: 12px;
    font-weight: bold;
}

.word-fill-message {
    min-height: 22px;
    margin-top: 16px;
    text-align: center;
    font-size: 15px;
}

.word-fill-message.correct {
    color: #159447;
}

.word-fill-message.incorrect {
    color: #b52323;
}

.word-fill-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}

.word-fill-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 7px;
    font-size: 16px;
    cursor: pointer;
}

.word-fill-check {
    color: white;
    background: #2878c8;
}

.word-fill-check:hover {
    background: #1f65ab;
}

.word-fill-next {
    color: #333;
    background: #e5e5e5;
}

.word-fill-next:hover:not(:disabled) {
    background: #d8d8d8;
}

.word-fill-buttons button:disabled {
    opacity: 0.5;
    cursor: default;
}

.word-fill-total {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

.word-fill-done {
    text-align: center;
    font-size: 22px;
    font-weight: bold;
    color: #2367b1;
}

@media (max-width: 560px) {
    .word-fill {
        padding: 14px;
    }

    .word-fill-passage {
        padding: 14px 12px;
    }

    .word-fill-passage p {
        font-size: 16px;
        line-height: 2.3;
    }

    .fill-input {
        width: 8ch;
        min-width: 8ch;
        font-size: 16px;
    }

    .fill-gap-prompt,
    .fill-correction {
        font-size: 11px;
    }
}
