/* Vocabulary word search: letter grid with highlighter strokes for found words. */

.ws-pick-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.4rem; }
.ws-h2 { font-family: var(--gm-head); font-weight: 800; font-size: 1.1rem; }
.ws-note { color: var(--gm-muted); font-size: 0.9rem; margin-bottom: 0.8rem !important; }
.ws-own { margin-top: 1rem !important; color: var(--gm-muted); font-size: 0.9rem; }
.ws-own a { color: var(--gm-blue); font-weight: 700; }

.ws-play { display: grid; gap: 0.9rem; }
.ws-topic-name { font-size: 1rem; white-space: nowrap; }

.ws-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 17rem;
    gap: clamp(1rem, 3vw, 1.75rem);
    align-items: start;
}

.ws-board {
    position: relative;
    width: min(100%, 34rem);
    justify-self: center;
    aspect-ratio: 1;
    border-radius: 14px;
    background: var(--gm-card);
    border: 1px solid var(--gm-line);
    box-shadow: 0 18px 36px -22px var(--gm-shadow);
}
.ws-grid {
    --n: 10;
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(var(--n), 1fr);
    grid-template-rows: repeat(var(--n), 1fr);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
}
.ws-grid.is-miss { animation: ws-miss 0.3s ease; }
@keyframes ws-miss { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.ws-cell {
    display: grid;
    place-items: center;
    border-radius: 50%;
    font: 800 clamp(0.8rem, 3.4vw, 1.3rem)/1 'Mulish', sans-serif;
    color: var(--gm-ink);
}
.ws-cell.is-sel { background: rgba(29, 95, 196, 0.22); }
.ws-cell.is-anchor { background: rgba(29, 95, 196, 0.4); color: #fff; }
.ws-cell.is-hint { animation: ws-hint 1.4s ease; }
@keyframes ws-hint { 15%, 45%, 75% { background: #ffd970; transform: scale(1.25); } }

.ws-marks {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
}
.ws-marks line {
    stroke-width: 0.72;
    stroke-linecap: round;
    opacity: 0.45;
    animation: ws-draw 0.35s ease-out;
}
.ws-marks line.is-given { opacity: 0.25; stroke-dasharray: 0.2 0.25; }
@keyframes ws-draw { from { opacity: 0; } }

.ws-side { display: grid; gap: 0.75rem; min-width: 0; }
.ws-side .gm-seg { display: flex; }
.ws-side .gm-seg button { flex: 1; padding-inline: 0.4rem; }

.ws-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    border-radius: 0.9rem;
    background: var(--gm-card);
    border: 1px solid var(--gm-line);
}
.ws-list li {
    display: grid;
    padding: 0.35rem 0.55rem;
    border-radius: 0.6rem;
    border-left: 4px solid transparent;
    line-height: 1.3;
}
.ws-word { font-weight: 800; letter-spacing: 0.02em; }
.ws-vi { font-size: 0.8rem; color: var(--gm-muted); display: none; }
.ws-list li.is-found { border-left-color: var(--wc); background: color-mix(in srgb, var(--wc) 14%, transparent); }
.ws-list li.is-found .ws-word { text-decoration: line-through; text-decoration-color: var(--wc); text-decoration-thickness: 2px; }
.ws-list li.is-found .ws-vi { display: block; }
/* "find by meaning": the meaning is the clue, the word stays masked until found */
.list-vi .ws-list li .ws-vi { display: block; font-size: 0.88rem; color: var(--gm-ink); font-weight: 700; }
.list-vi .ws-list li:not(.is-found) .ws-word { color: var(--gm-muted); letter-spacing: 0.15em; font-size: 0.85rem; }

.ws-tools { display: grid; grid-template-columns: 1fr 1fr; }
.ws-play.is-done .ws-marks line { opacity: 0.6; }

@media (max-width: 860px) {
    .ws-layout { grid-template-columns: minmax(0, 1fr); }
    .ws-side { width: min(100%, 34rem); justify-self: center; }
}

/* full screen: the grid takes the height left under the score row */
.gm.is-full .ws-board { width: min(100%, calc(var(--gm-h) - 4.5rem)); }
