/* Word Search — paper-and-ink puzzle */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(28px, 4.4vw, 40px);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.05;
}
.page-head .sub {
  color: var(--ink-soft);
  margin: 6px 0 0;
  font-size: 14px;
  min-height: 1.4em;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

.select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.select-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.picker {
  font: 600 14px 'Inter', sans-serif;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 38px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.picker:hover { border-color: var(--line-strong); }
.picker:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.15);
}

.play {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.ws-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 22px;
  align-items: start;
}
@media (max-width: 820px) {
  .ws-layout { grid-template-columns: 1fr; }
}

.ws-grid-wrap { min-width: 0; }

.ws-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 70px;
}
.meta-k {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.meta-v {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.ws-grid {
  display: grid;
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.ws-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: clamp(12px, 2.2vw, 22px);
  color: var(--ink);
  border-radius: 4px;
  transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}
.ws-cell.is-selecting {
  background: var(--accent);
  color: var(--accent-soft);
}
.ws-cell.is-found {
  background: var(--accent-soft);
  color: var(--accent);
}
/* Just-found — gold wash across the letters */
@keyframes ws-found-flash {
  0%   { background: rgba(213, 192, 125, 0.9); transform: scale(1); }
  50%  { background: rgba(213, 192, 125, 0.5); transform: scale(1.08); }
  100% { background: var(--accent-soft); transform: scale(1); }
}
.ws-cell.just-found {
  animation: ws-found-flash 500ms ease-out;
}

/* Word-list line struck through with animation */
@keyframes ws-word-strike {
  from { opacity: 0.8; transform: translateX(-2px); }
  to   { opacity: 1; transform: translateX(0); }
}
.words-list li.just-found {
  animation: ws-word-strike 320ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .ws-cell.just-found, .words-list li.just-found { animation: none; }
}
.ws-cell.is-found.is-selecting {
  background: var(--accent);
  color: var(--accent-soft);
}

.ws-words {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.words-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.words-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
@media (min-width: 821px) {
  .words-list { grid-template-columns: 1fr; }
}
.words-list li {
  font: 600 14px 'Inter', sans-serif;
  color: var(--ink);
  padding: 3px 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 180ms ease, opacity 180ms ease;
  position: relative;
}
.words-list li.is-found {
  color: var(--muted);
  opacity: 0.7;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--accent);
}

/* Win overlay */
.win-overlay {
  position: fixed; inset: 0; background: rgba(28, 42, 58, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.win-overlay[hidden] { display: none; }
.win-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; text-align: center; box-shadow: var(--shadow-lift); max-width: 360px;
}
.win-title {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.win-sub {
  color: var(--ink-soft);
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.5;
}
.win-actions { display: flex; gap: 10px; justify-content: center; }

/* aside */
.aside-info { margin-top: 22px; }
.aside-info details {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
.aside-info summary {
  cursor: pointer;
  font: 700 14px 'Inter', sans-serif;
  color: var(--ink);
}
.aside-info .help-body {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}
.aside-info .help-body p { margin: 0 0 8px; }
.aside-info .help-body ul { margin: 0; padding-left: 18px; }
.aside-info .help-body li { margin: 4px 0; }
