/* Crossword — page-specific styles */
.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: 8px; flex-wrap: wrap; align-items: center; }

.picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 10px;
}
.picker-label {
  font: 600 12px 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.picker select {
  appearance: none;
  background: transparent;
  border: 0;
  font: 600 14px 'Inter', sans-serif;
  color: var(--ink);
  padding: 6px 4px;
  cursor: pointer;
  outline: none;
}

.play {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px);
  gap: 26px;
  align-items: start;
}
@media (max-width: 760px) {
  .play { grid-template-columns: 1fr; padding: 16px; gap: 18px; }
}

.board-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }

.grid {
  --cells: 5;
  display: grid;
  grid-template-columns: repeat(var(--cells), 1fr);
  gap: 3px;
  background: var(--line-strong);
  border: 3px solid var(--line-strong);
  border-radius: 6px;
  width: min(86vw, 420px);
  aspect-ratio: 1 / 1;
  box-shadow: 0 1px 0 rgba(31, 58, 95, 0.1), 0 16px 28px -20px rgba(31, 58, 95, 0.45);
}
.cell {
  position: relative;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 clamp(20px, 5vw, 28px) 'Fraunces', Georgia, serif;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease;
}
.cell.is-block {
  background: var(--ink);
  cursor: default;
}
.cell.is-word { background: #f6e9c8; }
.cell.is-focus { background: #f0c463; }
.cell.is-wrong { color: var(--danger); animation: shake 220ms ease; }
.cell.is-revealed { color: var(--accent-2); }
.cell .num {
  position: absolute;
  top: 1px;
  left: 3px;
  font: 600 10px 'Inter', sans-serif;
  color: var(--ink-soft);
  pointer-events: none;
  letter-spacing: 0;
}
.cell.is-block .num { display: none; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

/* Letter fill — tiny pop when a letter is typed */
@keyframes cw-letter-in {
  0%   { transform: scale(0.6); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.cell input:not(:placeholder-shown), .cell .letter {
  animation: cw-letter-in 180ms ease-out;
}

/* Word solved — green wash briefly */
@keyframes cw-solved-flash {
  0%   { background: #a3d9a5; }
  100% { background: #f6e9c8; }
}
.cell.is-solved { animation: cw-solved-flash 900ms ease-out; }

@media (prefers-reduced-motion: reduce) {
  .cell input, .cell .letter, .cell.is-wrong, .cell.is-solved { animation: none; }
}

.clue-strip {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  width: min(86vw, 420px);
  display: flex;
  gap: 10px;
  align-items: baseline;
  font: 500 14px 'Inter', sans-serif;
  color: var(--ink);
  min-height: 44px;
}
.clue-strip-tag {
  font: 700 12px 'Inter', sans-serif;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
  flex: 0 0 auto;
}
.clue-strip-text { color: var(--ink-soft); line-height: 1.4; }

.kbd {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
  width: min(96vw, 480px);
}
.kbd button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 0;
  font: 600 14px 'Inter', sans-serif;
  cursor: pointer;
  transition: background 120ms ease, transform 100ms ease;
}
.kbd button:hover { background: var(--accent-soft); }
.kbd button:active { transform: translateY(1px); }
.kbd button.wide { grid-column: span 2; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.kbd button.wide.toggle { background: var(--bg-2); }

.clues h2 {
  font: 700 13px 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.clues section + section { margin-top: 18px; }
.clue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow: auto;
}
.clue-list li {
  display: flex;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  font: 500 14px 'Inter', sans-serif;
  line-height: 1.35;
  transition: background 120ms ease;
}
.clue-list li:hover { background: var(--bg-2); }
.clue-list li.is-active { background: #f0c463; color: var(--ink); }
.clue-list .num {
  flex: 0 0 22px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}
.clue-list li.is-active .num { color: var(--ink); }

.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; }

.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-card h2 {
  font: 700 30px 'Fraunces', Georgia, serif;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.win-card p { color: var(--ink-soft); margin: 0 0 18px; line-height: 1.5; }
.win-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
