@font-face {
    font-family: "Kalam";
    src: url("fonts/Kalam-Regular.ttf") format("truetype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

[hidden] {
    display: none !important;
}

button,
input,
textarea {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgb(161 61 47 / 40%);
    outline-offset: 3px;
}

form,
.message-control {
    display: grid;
    gap: 12px;
}

form label,
.message-control label {
    font-size: 0.82rem;
    font-weight: 700;
}

form input,
.message-control textarea {
    width: 100%;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
}

.message-control textarea {
    resize: vertical;
}

.action-button {
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
}

.message-control .instructions {
    margin: 0;
}

.status {
    min-height: 1.5em;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.board-panel {
    min-width: 0;
    padding: 36px 40px 24px;
}

.word-board {
    position: relative;
    min-height: 460px;
    margin-top: 24px;
}

.empty-board {
    position: absolute;
    inset: 30% 16px auto;
    color: var(--muted);
    font-family: "Kalam", "Segoe Print", cursive;
    font-size: 28px;
    text-align: center;
}

.value-word {
    position: absolute;
    width: max-content;
    padding: 16px 22px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: "Kalam", "Segoe Print", cursive;
    font-weight: 400;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: pan-y;
}

.word-ring {
    position: absolute;
    inset: 1px;
    width: calc(100% - 2px);
    height: calc(100% - 2px);
    overflow: visible;
    pointer-events: none;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.value-word .word-ring {
    visibility: hidden;
}

.value-word[aria-pressed="true"] .word-ring {
    visibility: visible;
}

.message-panel {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.message-panel h3 {
    margin: 0 0 16px;
    color: var(--accent);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.main-message {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 18px 22px;
    border: 2px solid var(--ink);
    background: var(--surface);
    break-inside: avoid;
}

.main-message p {
    margin: 0;
    font-family: "Kalam", "Segoe Print", cursive;
    font-size: 24px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

#print-board {
    display: none;
}

@media (max-width: 1040px) {
    .board-panel {
        padding: 30px 24px 18px;
    }
}

@media (max-width: 760px) {
    .board-panel {
        padding: 32px 16px 20px;
    }
}

@media print {
    .board-panel {
        padding: 0;
    }

    .word-board {
        display: none;
    }

    #print-board {
        display: block;
        width: 100%;
        height: 145mm;
        break-inside: avoid;
    }

    .message-panel {
        margin-top: 4mm;
        padding-top: 4mm;
    }

    .main-message {
        padding: 3mm 5mm;
    }

    .main-message p {
        font-size: 16pt;
    }
}
