/* LOOT WORDLE. Reusable component styles. */

.wd-stage {
  position: relative;
  width: 100%;
  min-height: 380px;
  padding: 18px 18px 22px;
  border: 2px solid #111111;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 4px 0 #111111;
  overflow: hidden;
  box-sizing: border-box;
}

.wd-stage * { box-sizing: border-box; }

/* ---------------- hud ---------------- */

.wd-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.wd-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 2px solid #111111;
  border-radius: 999px;
  background: #ffffff;
  font: 700 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
  color: #111111;
  box-shadow: 0 3px 0 #111111;
  transition: transform 0.15s;
}

.wd-pill.wd-pop { transform: scale(1.12); }

.wd-coin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd76a, #c9930a 65%, #8a5f08);
  border: 1.5px solid #8a5f08;
  flex: none;
}

/* ---------------- grid ---------------- */

.wd-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
}

.wd-row {
  display: flex;
  gap: 6px;
}

.wd-tile {
  width: 48px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #111111;
  border-radius: 8px;
  background: #ffffff;
  font: 700 22px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-transform: uppercase;
  color: #111111;
  box-shadow: 0 2px 0 #111111;
}

.wd-row.wd-future .wd-tile { opacity: 0.4; }

.wd-row.wd-cur .wd-tile.wd-typed {
  border-color: #e0651c;
  box-shadow: 0 2px 0 #a34410;
  animation: wdPop 0.25s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.wd-row.wd-cur .wd-tile.wd-next {
  animation: wdBlink 1s step-end infinite;
}

@keyframes wdPop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes wdBlink {
  0%, 100% { background: #ffffff; }
  50% { background: #ffe9a8; }
}

/* reveal: the tile spins on its X axis; the result color lands mid-spin */
.wd-tile.wd-spin { animation: wdSpin 0.32s ease-in-out; }

@keyframes wdSpin {
  0%   { transform: rotateX(0); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.wd-tile.wd-good {
  background: #16a04c;
  border-color: #111111;
  color: #ffffff;
}

.wd-tile.wd-near {
  background: #ffd76a;
  border-color: #111111;
  color: #111111;
}

.wd-tile.wd-miss {
  background: #111111;
  border-color: #111111;
  color: #ffffff;
}

.wd-row.wd-shake { animation: wdShake 0.3s; }

@keyframes wdShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* ---------------- message ---------------- */

.wd-msg {
  margin-top: 14px;
  min-height: 18px;
  text-align: center;
  font: 700 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.18em;
  color: #d21f33;
}

/* ---------------- keyboard ---------------- */

.wd-kbd {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.wd-kbd-row {
  display: flex;
  justify-content: center;
  gap: 5px;
  width: 100%;
}

.wd-key {
  appearance: none;
  cursor: pointer;
  flex: 1;
  max-width: 36px;
  height: 46px;
  padding: 0;
  border: 2px solid #111111;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
  font: 700 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  text-transform: uppercase;
  box-shadow: 0 2px 0 #111111;
  transition: transform 0.08s;
}

.wd-key:active { transform: translateY(2px); box-shadow: none; }

.wd-key.wd-wide { max-width: 58px; flex: 1.6; font-size: 11px; }

.wd-key.wd-good { background: #16a04c; color: #ffffff; }
.wd-key.wd-near { background: #ffd76a; color: #111111; }
.wd-key.wd-miss { background: #111111; color: #ffffff; }

/* ---------------- overlays ---------------- */

.wd-over,
.wd-intro {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #ffffff;
  border-radius: 16px;
  z-index: 20;
  text-align: center;
  padding: 20px;
}

.wd-over { opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.wd-over.wd-show { opacity: 1; pointer-events: auto; }
.wd-intro.wd-hide { display: none; }

.wd-over-title,
.wd-logo {
  font: 700 26px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  color: #111111;
}

.wd-over-title { color: #d21f33; }
.wd-over-title.wd-won { color: #16a04c; }

.wd-logo {
  padding: 10px 18px;
  border: 2px solid #111111;
  border-radius: 14px;
  background: #ffd76a;
  box-shadow: 0 4px 0 #111111;
}

.wd-how {
  font: 600 12px/1.9 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  color: #111111;
}

.wd-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 600 11px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  color: #111111;
}

.wd-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wd-chip {
  width: 20px;
  height: 22px;
  border: 2px solid #111111;
  border-radius: 6px;
  box-shadow: 0 2px 0 #111111;
  flex: none;
}

.wd-chip.wd-good { background: #16a04c; }
.wd-chip.wd-near { background: #ffd76a; }
.wd-chip.wd-miss { background: #111111; }

.wd-over-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 600 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.14em;
  color: #111111;
}

.wd-over-stats b { color: #e0651c; }

.wd-btn {
  appearance: none;
  cursor: pointer;
  border: 2px solid #111111;
  border-radius: 12px;
  padding: 13px 22px;
  background: #ffffff;
  color: #111111;
  font: 700 15px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 3px 0 #111111;
  transition: transform 0.1s;
}

.wd-btn.wd-primary {
  background: #d21f33;
  border-color: #d21f33;
  color: #ffffff;
  box-shadow: 0 3px 0 #9c0f1c;
}

.wd-btn:hover { transform: translateY(-1px); }
.wd-btn:active { transform: translateY(1px); }

/* ---------------- float ---------------- */

.wd-float {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, 8px);
  font: 700 17px ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #c9930a;
  letter-spacing: 0.06em;
  white-space: nowrap;
  animation: wdFloat 0.95s ease-out forwards;
  pointer-events: none;
  z-index: 40;
}

@keyframes wdFloat {
  0%   { opacity: 0; transform: translate(-50%, 10px); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -58px); }
}

@media (max-width: 600px) {
  .wd-stage { min-height: 340px; padding: 14px 10px 18px; }
  .wd-tile { width: 42px; height: 46px; font-size: 19px; border-radius: 7px; }
  .wd-row { gap: 5px; }
  .wd-key { max-width: 32px; height: 44px; font-size: 12px; }
  .wd-key.wd-wide { max-width: 52px; font-size: 10px; }
}
