/* ------------------------------------------------------------------
   Word Chain — daily word link puzzle.
   Board of seven words, on-screen keyboard, result card.
------------------------------------------------------------------ */

.word-chain-page {
  --wl-bg: #111315;
  --wl-text: #f1f7ee;
  --wl-accent: #ff2959;
  --wl-accent-hover: #e32751;
  --wl-gold: #f7c948;
  --wl-solved: #3a9e62;
  --wl-card-bg: #f1f7ee;
  --wl-card-text: #1b2a31;
  --wl-line: rgba(241, 247, 238, 0.14);
  --wl-chip: rgba(241, 247, 238, 0.08);
  --wl-tile: clamp(30px, 9.2vw, 44px);
}

.wl-stage {
  width: 100%;
  min-height: calc(100vh - 64px);
  padding: 20px 12px 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--wl-bg);
  color: var(--wl-text);
}
.wl-game { width: 100%; max-width: 500px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

.wl-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.wl-label { font: 700 13px 'Inter', sans-serif; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75; }
.wl-stats { display: flex; gap: 14px; font: 600 14px 'Inter', sans-serif; opacity: 0.85; font-variant-numeric: tabular-nums; }

/* --- Board ------------------------------------------------------ */

.wl-board { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wl-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: border-color .15s ease, background .15s ease;
}
.wl-row.is-open { cursor: pointer; border-color: var(--wl-line); border-style: dashed; }
.wl-row.is-open:hover, .wl-row.is-open:focus-visible { border-color: rgba(241, 247, 238, 0.4); outline: none; }
.wl-row.is-active { border-color: var(--wl-accent); background: rgba(255, 41, 89, 0.08); }

.wl-tile {
  width: var(--wl-tile);
  height: var(--wl-tile);
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(241, 247, 238, 0.1);
  border: 2px solid rgba(241, 247, 238, 0.16);
  font: 700 calc(var(--wl-tile) * 0.5) 'Inter', sans-serif;
  color: var(--wl-text);
  text-transform: uppercase;
}
.wl-tile.is-shown { background: var(--wl-card-bg); border-color: var(--wl-card-bg); color: var(--wl-card-text); }
.wl-tile.is-typed { border-color: rgba(241, 247, 238, 0.6); }
.wl-tile.is-caret { border-color: var(--wl-accent); animation: wl-caret 1s steps(1) infinite; }
@keyframes wl-caret { 50% { border-color: rgba(241, 247, 238, 0.16); } }

.wl-row.is-solved .wl-tile { background: var(--wl-solved); border-color: var(--wl-solved); color: #fff; }
.wl-row.is-given .wl-tile { background: var(--wl-card-bg); border-color: var(--wl-card-bg); color: var(--wl-card-text); }

.wl-row.is-wrong { animation: wl-shake .35s; }
@keyframes wl-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.wl-row.is-pop .wl-tile { animation: wl-pop .4s ease; }
.wl-row.is-pop .wl-tile:nth-child(2) { animation-delay: .04s; }
.wl-row.is-pop .wl-tile:nth-child(3) { animation-delay: .08s; }
.wl-row.is-pop .wl-tile:nth-child(4) { animation-delay: .12s; }
.wl-row.is-pop .wl-tile:nth-child(5) { animation-delay: .16s; }
.wl-row.is-pop .wl-tile:nth-child(6) { animation-delay: .2s; }
.wl-row.is-pop .wl-tile:nth-child(7) { animation-delay: .24s; }
.wl-row.is-pop .wl-tile:nth-child(8) { animation-delay: .28s; }
@keyframes wl-pop { 50% { transform: scale(1.15); } }

.wl-msg { min-height: 1.4em; margin: 0; font-size: 15px; text-align: center; color: inherit; opacity: 0.85; }
.wl-msg.is-bad { color: #ffb3c4; opacity: 1; }

/* --- Keyboard and hint ------------------------------------------ */

.wl-controls { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wl-controls[hidden] { display: none; }
.wl-keys { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.wl-keys div { display: flex; justify-content: center; gap: 5px; }
.wl-key {
  flex: 1 1 0;
  max-width: 44px;
  height: 52px;
  border: 0;
  border-radius: 7px;
  background: rgba(241, 247, 238, 0.18);
  color: var(--wl-text);
  font: 700 16px 'Inter', sans-serif;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.wl-key:active { background: rgba(241, 247, 238, 0.32); }
.wl-key.is-wide { flex: 1.6 1 0; max-width: 72px; font-size: 13px; }
.wl-hint {
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--wl-gold);
  background: transparent;
  color: var(--wl-gold);
  font: 600 15px 'Inter', sans-serif;
  cursor: pointer;
}
.wl-hint:hover { background: rgba(247, 201, 72, 0.12); }

/* --- Result ----------------------------------------------------- */

.wl-result {
  width: 100%;
  border-radius: 24px;
  padding: 28px 24px;
  background: var(--wl-card-bg);
  color: var(--wl-card-text);
  text-align: center;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.45);
}
.wl-result[hidden] { display: none; }
.wl-result-eyebrow { font: 700 12px 'Inter', sans-serif; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }
.wl-stars { margin: 6px 0; font-size: 44px; line-height: 1; letter-spacing: 6px; color: var(--wl-gold); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); }
.wl-result-note { margin: 0 0 18px; font-size: 15px; opacity: 0.8; color: inherit; }
.wl-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.wl-btn {
  background: var(--wl-accent);
  color: #fff;
  font: 400 19px 'Crete Round', serif;
  padding: 13px 26px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.wl-btn:hover { background: var(--wl-accent-hover); }
.wl-btn-ghost { background: transparent; color: var(--wl-card-text); border: 1px solid rgba(27, 42, 49, 0.25); }
.wl-btn-ghost:hover { background: rgba(27, 42, 49, 0.06); }

/* --- Rules and content ------------------------------------------ */

.wl-rules {
  background: var(--wl-bg);
  color: var(--wl-text);
  padding: 48px 0 32px;
  border-top: 1px solid var(--wl-line);
  font-family: 'Crete Round', serif;
}
.wl-rules .game-h1 { font-family: 'Crete Round', serif; font-weight: 400; font-size: 46px; text-align: center; margin: 0 0 4px; }
.wl-rules h2 { font-family: 'Crete Round', serif; font-weight: 400; font-size: 30px; text-align: center; opacity: 0.85; margin: 0 0 24px; }
.wl-rules .prose { max-width: 62ch; margin: 0 auto; opacity: 0.92; line-height: 1.6; }
.wl-rules .prose p { color: inherit; }

.wl-example { padding-left: 1.2em; }
.wl-example span { margin-left: 8px; color: var(--text-3, #9fb1b6); font-style: italic; }
