/**
 * Word search game — front-end styles for word-search-game-template.php.
 * Mirrors the word game's chrome (Poppins, purple accent) with a letter grid
 * and a to-find word list.
 */

.word-search-game-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 0;
}

.word-search-game {
  --ws-accent: #b898ff;
  --ws-accent-dark: #7c4dff;
  --ws-ink: #1a1a1a;
  --ws-muted: #6b6b72;
  --ws-line: #e6e6ec;
  --ws-radius: 12px;
  --ws-found: #2f9e44;
  --ws-miss: #e03131;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--ws-ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2rem;
  align-items: start;
}
.word-search-game__main { min-width: 0; }
.word-search-game__main > :last-child { margin-bottom: 3rem; }

.word-search-game__siderail {
  position: sticky;
  top: 16px;
  align-self: start;
  width: 300px;
  min-height: 600px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.word-search-game__video-mrec { display: none; }

@media (max-width: 991.98px) {
  .word-search-game { grid-template-columns: 1fr; }
  .word-search-game__siderail { display: none; }
  .word-search-game__video-mrec {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 250px;
    margin: 1.5rem 0;
  }
}

.word-search-game__breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .75rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ws-accent-dark);
  text-transform: uppercase;
  letter-spacing: .08em;
  text-decoration: none;
}
.word-search-game__breadcrumb:hover,
.word-search-game__breadcrumb:focus-visible { color: #5b2ec4; text-decoration: none; }
.word-search-game__breadcrumb-arrow { display: inline-block; transform: translateX(-2px); }

.word-search-game__hero { margin-bottom: 1.5rem; }
.word-search-game__hero-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  border-radius: .5rem;
}
.word-search-game__title.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.word-search-game__intro {
  margin: 0 0 1.5rem;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--ws-ink);
}
.word-search-game__intro > :first-child { margin-top: 0; }
.word-search-game__intro > :last-child { margin-bottom: 0; }
.word-search-game__intro p { margin: 0 0 1rem; }

.word-search-game__prompt { font-weight: 600; margin: 1.25rem 0 .8rem; }

/* Difficulty picker. */
.word-search-game__levels {
  display: flex;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin: 0 0 1.1rem;
}
.word-search-game__level {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .55rem 1.2rem;
  background: #fff;
  border: 2px solid var(--ws-line);
  border-radius: var(--ws-radius);
  cursor: pointer;
  color: var(--ws-ink);
}
.word-search-game__level:hover { border-color: var(--ws-accent); }
.word-search-game__level.is-selected {
  border-color: var(--ws-accent-dark);
  background: #f4f0ff;
}
.word-search-game__level:disabled { opacity: .55; cursor: default; }
.word-search-game__level-name { font-weight: 700; }
.word-search-game__level-detail { font-size: .78rem; color: var(--ws-muted); }

/* Found / timer meta. */
.word-search-game__meta {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin: 0 0 1rem;
  font-size: .9rem;
  color: var(--ws-muted);
}
.word-search-game__meta[hidden] { display: none; }
.word-search-game__meta b { color: var(--ws-ink); font-variant-numeric: tabular-nums; }

/* Grid + word list layout. */
.word-search-game__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 1.5rem;
  align-items: start;
}

.word-search-game__grid {
  display: grid;
  grid-template-columns: repeat(var(--ws-cols, 10), minmax(0, 1fr));
  gap: 4px;
  max-width: 640px;
  margin: 0 auto;
  touch-action: none; /* let us own drag gestures */
  user-select: none;
  -webkit-user-select: none;
}
.word-search-game__cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f2f2f6;
  color: var(--ws-ink);
  font-weight: 600;
  font-size: clamp(.8rem, 3vw, 1.35rem);
  text-transform: uppercase;
  cursor: pointer;
  touch-action: none;
}
.word-search-game__cell.is-preview {
  background: var(--ws-accent);
  color: #fff;
}
.word-search-game__cell.is-anchor {
  background: var(--ws-accent-dark);
  color: #fff;
}
.word-search-game__cell.is-found {
  background: var(--ws-found);
  color: #fff;
}
.word-search-game__cell.is-miss {
  background: var(--ws-miss);
  color: #fff;
}

.word-search-game__wordlist {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 1;
  font-size: .95rem;
}
.word-search-game__word {
  padding: .3rem 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ws-ink);
}
.word-search-game__word::before {
  content: '';
  width: .55rem;
  height: .55rem;
  border-radius: 2px;
  background: var(--ws-line);
  flex: 0 0 auto;
}
.word-search-game__word.is-found {
  color: var(--ws-muted);
  text-decoration: line-through;
}
.word-search-game__word.is-found::before { background: var(--ws-found); }

/* Controls. */
.word-search-game__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1.2rem 0 1rem;
}
.word-search-game__btn {
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: .6rem 1.4rem;
  cursor: pointer;
  border: 2px solid transparent;
}
.word-search-game__btn--primary { background: var(--ws-accent-dark); color: #fff; }
.word-search-game__btn--primary:hover { background: #6a3df0; }
.word-search-game__btn--primary:disabled { opacity: .5; cursor: default; }
.word-search-game__btn--ghost { background: transparent; border-color: var(--ws-accent); color: var(--ws-accent-dark); }

.word-search-game__status { margin: 0; color: var(--ws-muted); flex: 1 1 100%; text-align: center; min-width: 0; }
.word-search-game__status:empty { display: none; }
.word-search-game__noscript { color: #e53935; }

/* Result + form. */
.word-search-game__result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-radius);
  background: #faf8ff;
}
.word-search-game__score { font-size: 1.2rem; margin: 0 0 1rem; }
.word-search-game__score strong { color: var(--ws-accent-dark); }
.word-search-game__form[hidden] { display: none; }
.word-search-game__form-intro { font-weight: 600; margin: 0 0 .6rem; }
.word-search-game__form-note { margin: 0 0 .8rem; font-size: .78rem; line-height: 1.4; color: var(--ws-muted, #666); }
.word-search-game__form.is-known [data-lb-intro],
.word-search-game__form.is-known [data-lb-note],
.word-search-game__form.is-known [data-lb-fields],
.word-search-game__form.is-known [data-lb-consent] { display: none; }

.word-search-game__known {
  margin: 0 0 1.25rem;
  padding: .9rem 1.1rem;
  border: 1px solid var(--ws-line);
  border-radius: var(--ws-radius);
  background: #faf8ff;
}
.word-search-game__known-name { font-weight: 700; margin: 0 0 .3rem; }
.word-search-game__known .word-search-game__form-note { margin: 0; }
.word-search-game__fields { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.word-search-game__field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; }
.word-search-game__field:last-of-type { grid-column: 1 / -1; }
.word-search-game__field input {
  font: inherit;
  padding: .55rem .7rem;
  border: 1px solid var(--ws-line);
  border-radius: 8px;
}
.word-search-game__field input:focus-visible { outline: 2px solid var(--ws-accent-dark); outline-offset: 1px; }
.word-search-game__form button[type="submit"] { margin-top: .9rem; }
.word-search-game__form-feedback { margin: .6rem 0 0; font-size: .9rem; color: var(--ws-accent-dark); min-height: 1.1em; }
.word-search-game__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.word-search-game__consent { display: flex; align-items: flex-start; gap: .5rem; margin: .2rem 0 .9rem; font-size: .82rem; line-height: 1.35; color: var(--ws-ink, #333); cursor: pointer; }
.word-search-game__consent input { flex: 0 0 auto; margin-top: .15rem; }

/* Leaderboard. */
.word-search-game__leaderboard { margin-top: 2rem; }
.word-search-game__leaderboard-title { font-size: 1.3rem; margin: 0 0 .75rem; }
.word-search-game__board { list-style: none; margin: 0; padding: 0; }
.word-search-game__board-row {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: center;
  gap: .5rem;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--ws-line);
}
.word-search-game__board-row.is-me {
  background: #f4f0ff;
  border-radius: 8px;
  border-bottom-color: transparent;
  font-weight: 600;
}
.word-search-game__board-row.is-me em { color: var(--ws-accent-dark); font-style: normal; font-size: .8rem; }
.word-search-game__board-rank { font-weight: 700; color: var(--ws-accent-dark); }
.word-search-game__board-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.word-search-game__board-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.word-search-game__board-sep {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: .4rem 0;
  padding: .3rem 0;
  color: var(--ws-accent-dark);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.word-search-game__board-sep::before,
.word-search-game__board-sep::after {
  content: '';
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--ws-accent);
  opacity: .8;
}
.word-search-game__board-empty { color: var(--ws-muted); font-style: italic; padding: .6rem .8rem; }
.word-search-game__board-note { margin: .8rem 0 0; font-size: .8rem; color: var(--ws-muted); }

@media (max-width: 720px) {
  /* Grid stacks above the word list and fills the full width. */
  .word-search-game-wrap { padding-left: .5rem; padding-right: .5rem; }
  .word-search-game__layout { grid-template-columns: 1fr; gap: 1rem; }
  .word-search-game__grid { max-width: none; margin: 0; }
  /* Word list as an explicit, aligned 2-column grid (not multicol flow). */
  .word-search-game__wordlist {
    columns: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
    row-gap: .15rem;
  }
}
@media (max-width: 560px) {
  .word-search-game__fields { grid-template-columns: 1fr; }
  .word-search-game__field:last-of-type { grid-column: auto; }
}
