/* ===========================================================================
   Word Search — layout on top of corner.css. Large-type letter grid, themed
   word list, tap-and-drag OR tap-first/tap-last selection. Colorblind-safe:
   found words are struck through with a check in the LIST (text cue), not
   signalled by grid color alone. Endless: every grid is generated fresh from
   themed word lists. Sizes via --cell (set by fit()).
   =========================================================================== */
.ws-main { --cell: 34px;
  max-width: 620px; margin: 0 auto; padding: 6px clamp(10px, 3vw, 20px) 24px;
  display: flex; flex-direction: column; align-items: center; }

.ws-head { width: 100%; text-align: center; margin: 2px 0 6px; }
.ws-head h1 { font-size: clamp(1.4rem, 5.2vw, 2rem); }
.ws-head .ws-sub { color: var(--ink-soft); font-weight: 700; font-size: .92rem; margin-top: 1px; }

.ws-diff { display: inline-flex; margin: 8px 0 2px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.ws-diff button { border: 0; background: transparent; cursor: pointer; min-height: 40px; padding: 0 16px;
  border-radius: 999px; font-family: var(--font-display); font-weight: 600; font-size: .98rem; color: var(--ink-soft); }
.ws-diff button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.ws-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 6px 0 2px; width: 100%; }
.ws-controls .qc-iconbtn { min-height: 44px; min-width: 0; padding: 0 12px; font-size: .84rem; gap: .32em; box-shadow: var(--shadow-soft); }

.ws-theme { font-family: var(--font-display); font-weight: 700; color: var(--accent-ink); font-size: 1.05rem; margin: 6px 0 2px; }

/* ---- grid ---- */
.ws-grid { display: grid; margin: 4px auto 0; background: var(--surface);
  border: 2px solid var(--line); border-radius: 8px; overflow: hidden; touch-action: none; user-select: none; }
.ws-cell { display: flex; align-items: center; justify-content: center; border: 1px solid var(--line);
  width: var(--cell); height: var(--cell); font-family: var(--font-display); font-weight: 600;
  font-size: calc(var(--cell) * 0.5); line-height: 1; color: var(--ink); text-transform: uppercase;
  cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ws-cell.found { background: var(--accent-soft); color: var(--accent-ink); }
.ws-cell.sel { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); color: var(--on-accent); }
.ws-cell.anchor { background: var(--accent); color: var(--on-accent); }

/* ---- word list ---- */
.ws-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: 12px auto 0;
  max-width: 460px; width: 100%; }
.ws-words .w { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; color: var(--ink);
  padding: 4px 4px; }
.ws-words .w.found { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 2px; }
.ws-words .w.found::after { content: " \2713"; color: var(--accent-ink); text-decoration: none; }

.ws-msg { min-height: 1.4em; margin: 6px 0 0; text-align: center; font-family: var(--font-display);
  font-weight: 600; font-size: 1rem; color: var(--accent-ink); }

/* ---- result ---- */
.ws-result { display: none; width: 100%; max-width: 460px; margin: 12px 0 2px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
body.ws.is-done .ws-result { display: block; }
.ws-result h2 { font-size: 1.3rem; margin-bottom: .2em; }
.ws-result .streakline { color: var(--ink-soft); font-weight: 700; margin-top: 4px; }
.ws-result-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }

@media (max-width: 460px) {
  .ws-controls .lbl { display: none; }
  .ws-controls .qc-iconbtn { padding: 0 13px; font-size: 1.15rem; }
  .ws-diff button { padding: 0 12px; font-size: .9rem; }
}

/* ---- print: a clean black-and-white grid + word list for paper ---- */
@media print {
  .qc-nav, .qc-foot, .ws-diff, .ws-controls, .ws-msg, .ws-result, .ws-sub, .qc-sr, .qc-modal-overlay { display: none !important; }
  html, body, .ws-main { background: #fff !important; color: #000 !important; }
  .ws-main { --cell: 40px !important; max-width: none; padding: 0; }
  .ws-head h1, .ws-theme { color: #000 !important; }
  .ws-grid { border: 2px solid #000 !important; background: #fff !important; }
  .ws-cell { background: #fff !important; color: #000 !important; border: 1px solid #bbb !important; }
  .ws-cell.found, .ws-cell.sel, .ws-cell.anchor { background: #fff !important; color: #000 !important; }
  .ws-words { margin-top: 14px; }
  .ws-words .w, .ws-words .w.found { color: #000 !important; text-decoration: none !important; }
  .ws-words .w.found::after { content: "" !important; }
}
