/* Create By Asking: Word Hunch, the five-letter word game. Loaded after style.css and tools.css;
   reuses the dark .tool-shell panel and .chip-dark buttons. */

.wg { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 22px 28px; scroll-margin-top: 84px;
  --wg-correct: #2FB872; --wg-present: #E9B21F; --wg-absent: #4A4658; --wg-empty: rgba(255, 255, 255, 0.16); }
.wg > * { min-width: 0; }
.wg [hidden] { display: none !important; }
.wg-play { display: grid; gap: 12px; justify-items: center; }
.wg-top { width: 100%; max-width: 420px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.wg-top h3 { font-size: var(--step-1); margin: 0; }
.wg-no { font: 600 0.8rem/1 var(--mono); color: #FFC93C; margin-left: 4px; }
.wg-modes { display: flex; gap: 6px; }

.wg-board { display: grid; gap: 6px; width: min(100%, 300px); }
.wg-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wg-tile { aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--wg-empty); border-radius: 8px;
  font: 800 clamp(1.5rem, 7vw, 2rem)/1 var(--display); text-transform: uppercase; color: #fff; user-select: none; }
.wg-tile.filled { border-color: rgba(255, 255, 255, 0.45); }
.wg-tile.correct { background: var(--wg-correct); border-color: var(--wg-correct); }
.wg-tile.present { background: var(--wg-present); border-color: var(--wg-present); color: #1C0F3F; }
.wg-tile.absent { background: var(--wg-absent); border-color: var(--wg-absent); }
.wg-tile.pop { animation: wg-pop 0.1s ease-out; }
.wg-tile.flip { animation: wg-flip 0.32s ease-out; }
.wg-row.shake { animation: wg-shake 0.4s; }
.wg-row.win .wg-tile { animation: wg-jump 0.5s ease-out both; }
.wg-row.win .wg-tile:nth-child(2) { animation-delay: 0.08s; }
.wg-row.win .wg-tile:nth-child(3) { animation-delay: 0.16s; }
.wg-row.win .wg-tile:nth-child(4) { animation-delay: 0.24s; }
.wg-row.win .wg-tile:nth-child(5) { animation-delay: 0.32s; }
@keyframes wg-pop { 50% { transform: scale(1.1); } }
@keyframes wg-flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes wg-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes wg-jump { 40% { transform: translateY(-14px); } 70% { transform: translateY(2px); } }

.wg-msg { min-height: 2.8em; max-width: 360px; margin: 0; display: grid; place-items: center; text-align: center; font: 600 var(--step--1)/1.4 var(--body); color: #FFE08F; }
.wg-msg.bad { color: #FF9C8A; }
.wg-key.ready { background: #FFC93C; color: #1C0F3F; box-shadow: 0 0 0 3px rgba(255, 201, 60, 0.35); }
.wg-intro { margin: 0; font-size: var(--step--1); color: #CBBFE8; line-height: 1.45; }
.wg-end { width: 100%; max-width: 420px; margin: 0; text-align: center; font-size: var(--step-0); line-height: 1.5; background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 10px 14px; }
.wg-end strong { color: #5BD48F; }
.wg-end b { font-family: var(--mono); letter-spacing: 0.06em; color: #FFC93C; }
.wg-end span { display: block; color: #CBBFE8; font-size: var(--step--1); margin-top: 2px; }
.wg-link { border: 0; padding: 0; background: none; color: #FFC93C; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.wg-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; min-height: 0; }

.wg-keys { display: grid; gap: 6px; width: min(100%, 500px); touch-action: manipulation; }
.wg-krow { display: flex; gap: 5px; justify-content: center; }
.wg-key { flex: 1 1 0; min-width: 0; max-width: 46px; height: 52px; padding: 0; border: 0; border-radius: 7px; background: rgba(255, 255, 255, 0.22); color: #fff;
  font: 700 1rem/1 var(--body); text-transform: uppercase; cursor: pointer; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) { .wg-key:hover { background: rgba(255, 255, 255, 0.3); } }
.wg-key.wide { flex: 1.5 1 0; max-width: 70px; font-size: 0.75rem; text-transform: none; }
.wg-key svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vertical-align: middle; }
.wg-key.correct { background: var(--wg-correct); }
.wg-key.present { background: var(--wg-present); color: #1C0F3F; }
.wg-key.absent { background: rgba(255, 255, 255, 0.04); color: rgba(255, 255, 255, 0.3); }

.wg-side { display: grid; gap: 12px; align-content: start; background: rgba(255, 255, 255, 0.04); border-radius: 14px; padding: 14px; }
.wg-side h3 { font-size: var(--step-0); margin: 0; }
.wg-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.wg-nums b { display: block; font: 800 1.5rem/1.1 var(--display); color: #fff; }
.wg-nums span { font: 600 0.62rem/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: #A597CC; }
.wg-dlabel { margin: 6px 0 0; font: 600 0.68rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #A597CC; }
.wg-dist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wg-dist li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font: 600 0.8rem/1 var(--mono); color: #CBBFE8; }
.wg-dist i { display: block; font-style: normal; text-align: right; padding: 3px 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); color: #fff; }
.wg-dist li.now i { background: var(--wg-correct); }
.wg-how { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; font-size: var(--step--1); color: #CBBFE8; line-height: 1.35; }
.wg-how li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; }
.wg-how i { width: 22px; height: 22px; border-radius: 5px; }
.wg-how .g { background: var(--wg-correct); } .wg-how .y { background: var(--wg-present); } .wg-how .n { background: var(--wg-absent); }
.wg > .tool-note { grid-column: 1 / -1; margin: 0; }

@media (max-width: 860px) { .wg { grid-template-columns: 1fr; } .wg-side { max-width: 500px; width: 100%; justify-self: center; } }
@media (max-width: 420px) {
  .wg-key { height: 50px; font-size: 0.9rem; }
  .wg-krow { gap: 4px; }
  .wg-key.wide { font-size: 0.7rem; }
}

.tool-shell .wg-btns .btn-ghost.sure { background: #FF7A62; color: #1C0F3F; }
.wg-side [data-stats] { display: grid; gap: 8px; }
