/* Word Hunt: Royal + Gold Poster Block */
.wh-root {
  --wh-ground: #E9EEFA;
  --wh-ink: #111111;
  --wh-header: #0F2A6B;
  --wh-royal: #1F4FD1;
  --wh-gold: #FFC21A;
  --wh-miss: #353D4E;
  position: relative;
  box-sizing: border-box;
  max-width: 440px;
  margin: 24px auto;
  background: var(--wh-ground);
  color: var(--wh-ink);
  border: 3px solid var(--wh-ink);
  box-shadow: 6px 6px 0 var(--wh-ink);
  font-family: 'Archivo', system-ui, sans-serif;
  line-height: 1.3;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.wh-root *, .wh-root *::before, .wh-root *::after { box-sizing: border-box; }
.wh-root button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1;
  cursor: pointer;
  border-radius: 0;
  text-shadow: none;
}
.wh-root button:focus-visible { outline: 3px solid var(--wh-gold); outline-offset: 2px; }
.wh-root svg { display: block; }

/* Header */
.wh-head {
  background: var(--wh-header);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wh-logo { display: flex; align-items: center; font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 24px; line-height: 1; letter-spacing: 0.5px; }
.wh-logo span { padding: 5px 9px; border: 3px solid var(--wh-ink); box-shadow: 3px 3px 0 var(--wh-ink); }
.wh-logo-word { background: var(--wh-gold); color: var(--wh-ink); }
.wh-logo-hunt { background: var(--wh-royal); color: #FFFFFF; border-left: none !important; }
.wh-tools { display: flex; gap: 8px; }
.wh-icon {
  width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--wh-ground);
  border: 2px solid var(--wh-ground);
}
.wh-icon:hover { background: rgba(255, 255, 255, 0.12); }

/* Date and points strip */
.wh-strip {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px;
  border-bottom: 3px solid var(--wh-ink);
  gap: 10px;
  font-weight: 700; font-size: 13px; letter-spacing: 1px;
}
.wh-date { white-space: nowrap; }
.wh-points-wrap { display: flex; align-items: center; gap: 8px; }
.wh-clock {
  display: flex; align-items: center; gap: 5px;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 18px; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px; border: 2px solid var(--wh-ink); background: #FFFFFF; color: var(--wh-ink);
}
.wh-clock svg { width: 16px; height: 16px; }
.wh-clock-idle { opacity: 0.6; }
.wh-clock-low { background: var(--wh-gold); animation: wh-tick 1s steps(1) infinite; }
@keyframes wh-tick { 50% { background: #FFFFFF; } }
.wh-points {
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 18px; letter-spacing: 0;
  background: var(--wh-header); color: var(--wh-gold); padding: 2px 8px; min-width: 56px; text-align: center;
}

/* Board */
.wh-board { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 12px 0; }
.wh-row { display: flex; gap: 6px; }
.wh-tile {
  --wh-bg: rgba(255, 255, 255, 0.55);
  --wh-fg: var(--wh-ink);
  width: clamp(46px, 14vw, 58px);
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo Black', 'Archivo', sans-serif;
  font-size: clamp(24px, 7vw, 28px);
  line-height: 1;
  background: var(--wh-bg);
  color: var(--wh-fg);
  border: 3px solid rgba(17, 17, 17, 0.2);
}
.wh-tile.wh-typed, .wh-tile.wh-filled {
  --wh-bg: #FFFFFF;
  border-color: var(--wh-ink);
  box-shadow: 3px 3px 0 var(--wh-ink);
}
.wh-tile.wh-c { --wh-bg: var(--wh-royal); --wh-fg: #FFFFFF; }
.wh-tile.wh-p { --wh-bg: var(--wh-gold); --wh-fg: var(--wh-ink); }
.wh-tile.wh-x { --wh-bg: var(--wh-miss); --wh-fg: #FFFFFF; }
.wh-tile.wh-blank { --wh-bg: #FFFFFF; }

.wh-pop { animation: wh-pop 0.1s ease-out; }
@keyframes wh-pop { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.wh-flip { animation: wh-flip 0.5s ease both; animation-delay: calc(var(--i) * 0.2s); }
@keyframes wh-flip {
  0% { transform: rotateX(0); background: #FFFFFF; color: var(--wh-ink); }
  50% { transform: rotateX(90deg); background: #FFFFFF; color: var(--wh-ink); }
  50.1% { transform: rotateX(90deg); background: var(--wh-bg); color: var(--wh-fg); }
  100% { transform: rotateX(0); background: var(--wh-bg); color: var(--wh-fg); }
}

.wh-shake { animation: wh-shake 0.4s ease; }
@keyframes wh-shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.wh-win .wh-tile { animation: wh-bounce 0.5s ease both; animation-delay: calc(var(--i) * 0.08s); }
@keyframes wh-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } 60% { transform: translateY(2px); } }

.wh-status { margin: 16px 0 0; padding: 0; text-align: center; font-weight: 700; font-size: 13px; letter-spacing: 1px; }

/* Keyboard */
.wh-keys { padding: 18px 8px 18px; display: flex; flex-direction: column; gap: 7px; }
.wh-keyrow { display: flex; gap: 5px; }
.wh-keyrow-mid { padding: 0 4.5%; }
.wh-key {
  flex: 1 1 0; min-width: 0; height: 54px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 15px;
  background: #FFFFFF; color: var(--wh-ink);
  border: 2px solid var(--wh-ink);
  box-shadow: 2px 2px 0 var(--wh-ink);
  transition: transform 0.05s;
}
.wh-key:active { transform: translate(2px, 2px); box-shadow: none; }
.wh-key-wide { flex: 1.6 1 0; font-size: 11px; letter-spacing: 0.5px; }
.wh-key.wh-c { background: var(--wh-royal); color: #FFFFFF; }
.wh-key.wh-p { background: var(--wh-gold); color: var(--wh-ink); }
.wh-key.wh-x { background: var(--wh-miss); color: #FFFFFF; }

/* Toast */
.wh-toast {
  position: absolute; left: 50%; top: 74px; transform: translate(-50%, -8px);
  background: var(--wh-ink); color: #FFFFFF;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 14px; letter-spacing: 0.5px;
  padding: 10px 16px; border: 2px solid var(--wh-gold);
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 5; white-space: nowrap;
}
.wh-toast.wh-show { opacity: 1; transform: translate(-50%, 0); }

/* Modal */
.wh-modal {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(10, 18, 40, 0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.wh-modal[hidden] { display: none; }
.wh-dialog {
  width: 100%; max-width: 400px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--wh-ground); color: var(--wh-ink);
  border: 3px solid var(--wh-ink); box-shadow: 8px 8px 0 var(--wh-ink);
  font-family: 'Archivo', system-ui, sans-serif;
}
.wh-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--wh-header); padding: 10px 12px 10px 16px;
}
.wh-dialog-title {
  margin: 0; padding: 0; border: 0;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 20px; letter-spacing: 1px; line-height: 1.1;
  color: var(--wh-gold); text-transform: none;
}
.wh-dialog-body { padding: 18px 18px 20px; font-size: 15px; }
.wh-dialog-body p { margin: 0 0 12px; }
.wh-ex-row { display: flex; gap: 6px; margin: 14px 0 6px; }
.wh-ex-row .wh-tile { width: 44px; font-size: 22px; box-shadow: 2px 2px 0 var(--wh-ink); }
.wh-dialog-body .wh-ex-note { font-size: 14px; margin-bottom: 4px; }
.wh-dialog-body .wh-hard {
  margin: 14px 0 12px; padding: 10px 12px;
  background: #FFFFFF; border: 2px solid var(--wh-ink); border-left: 8px solid var(--wh-gold);
}
.wh-answer { justify-content: center; margin: 2px 0 14px; }
.wh-answer .wh-tile { width: 52px; font-size: 26px; }

.wh-btn {
  display: block; width: 100%; margin-top: 16px; padding: 14px 16px !important;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 16px; letter-spacing: 1px;
  background: var(--wh-gold); color: var(--wh-ink);
  border: 3px solid var(--wh-ink); box-shadow: 4px 4px 0 var(--wh-ink);
}
.wh-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--wh-ink); }

.wh-earned { display: flex; flex-direction: column; align-items: center; margin-bottom: 16px; }
.wh-earned-num {
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 40px; line-height: 1;
  background: var(--wh-header); color: var(--wh-gold); padding: 6px 14px;
  border: 3px solid var(--wh-ink); box-shadow: 4px 4px 0 var(--wh-ink);
}
.wh-earned-label { margin-top: 8px; font-weight: 700; font-size: 12px; letter-spacing: 1.5px; }

.wh-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.wh-stat { display: flex; flex-direction: column; align-items: center; text-align: center; background: #FFFFFF; border: 2px solid var(--wh-ink); padding: 8px 4px; }
.wh-stat-num { font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 22px; line-height: 1.1; }
.wh-stat-label { font-size: 11px; font-weight: 700; line-height: 1.2; margin-top: 2px; }

.wh-sub { margin: 0 0 8px; padding: 0; font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 13px; letter-spacing: 1.5px; }
.wh-dist { display: flex; flex-direction: column; gap: 5px; }
.wh-dist-row { display: flex; align-items: center; gap: 8px; }
.wh-dist-n { width: 12px; font-weight: 700; font-size: 13px; }
.wh-dist-bar {
  display: block; text-align: right; padding: 3px 7px;
  font-weight: 700; font-size: 13px;
  background: var(--wh-miss); color: #FFFFFF;
}
.wh-dist-bar.wh-dist-today { background: var(--wh-royal); }
.wh-dialog-body .wh-total { margin: 14px 0 0; font-weight: 700; font-size: 13px; text-align: center; }
.wh-next { display: flex; flex-direction: column; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 3px solid var(--wh-ink); }
.wh-next-label { font-weight: 700; font-size: 12px; letter-spacing: 1.5px; }
.wh-next-clock { font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 28px; letter-spacing: 1px; }

@media (prefers-reduced-motion: reduce) {
  .wh-root *, .wh-modal * { animation: none !important; transition: none !important; }
}
@media (max-width: 400px) {
  .wh-points-label { display: none; }
  .wh-strip { padding: 10px 12px; }
}
@media (max-width: 380px) {
  .wh-key-wide { font-size: 9px; }
  .wh-logo { font-size: 20px; }
  .wh-icon { width: 40px; height: 40px; }
  .wh-key { height: 50px; font-size: 13px; }
}

/* Desktop: wider board, bigger tiles and keys */
@media (min-width: 768px) {
  .wh-root { max-width: 580px; }
  .wh-head { padding: 16px 20px; }
  .wh-logo { font-size: 28px; }
  .wh-strip { padding: 12px 20px; }
  .wh-board { gap: 8px; padding-top: 28px; }
  .wh-row { gap: 8px; }
  .wh-tile { width: 70px; font-size: 34px; }
  .wh-status { margin-top: 20px; font-size: 14px; }
  .wh-keys { padding: 22px 18px 22px; gap: 8px; }
  .wh-keyrow { gap: 6px; }
  .wh-key { height: 60px; font-size: 18px; }
  .wh-key-wide { font-size: 13px; }
  .wh-toast { top: 84px; font-size: 16px; }
}

/* Leaderboard */
.wh-lb { margin: 0 0 18px; }
.wh-lb-form { margin: 0 0 12px; padding: 12px; background: #FFFFFF; border: 2px solid var(--wh-ink); }
.wh-lb-label { display: block; margin-bottom: 8px; font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 13px; letter-spacing: 1px; }
.wh-lb-inputrow { display: flex; gap: 8px; }
.wh-root .wh-lb-input {
  flex: 1 1 auto; min-width: 0; width: 100%; height: 50px; margin: 0; padding: 0 12px;
  font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 26px; letter-spacing: 8px; text-transform: uppercase;
  color: var(--wh-ink); background: var(--wh-ground);
  border: 3px solid var(--wh-ink); border-radius: 0; box-shadow: none; outline: none;
  user-select: text; -webkit-user-select: text;
}
.wh-root .wh-lb-input:focus { border-color: var(--wh-royal); }
.wh-root .wh-lb-input::placeholder { color: rgba(17, 17, 17, 0.3); }
.wh-root .wh-lb-btn { width: auto; margin-top: 0; flex: 0 0 auto; padding: 0 18px !important; height: 50px; }
.wh-root .wh-lb-btn:disabled { opacity: 0.6; cursor: default; }
.wh-dialog-body .wh-lb-msg { margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #B42318; }
.wh-dialog-body .wh-lb-msg:empty { display: none; }
.wh-dialog-body .wh-lb-placed { margin: 0 0 10px; font-weight: 700; font-size: 14px; }
.wh-dialog-body .wh-lb-empty { margin: 0; padding: 12px; font-size: 14px; background: #FFFFFF; border: 2px solid var(--wh-ink); }
.wh-lb-list { list-style: none; margin: 0; padding: 0; border: 2px solid var(--wh-ink); background: #FFFFFF; }
.wh-lb-row {
  display: grid; grid-template-columns: 28px 1fr auto 52px; align-items: center; gap: 10px;
  margin: 0; padding: 7px 12px; font-variant-numeric: tabular-nums;
  border-top: 1px solid rgba(17, 17, 17, 0.12);
}
.wh-lb-row:first-child { border-top: none; }
.wh-lb-row:first-child .wh-lb-rank { background: var(--wh-gold); }
.wh-lb-rank { font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 13px; text-align: center; line-height: 24px; height: 24px; border: 2px solid var(--wh-ink); }
.wh-lb-init { font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 18px; letter-spacing: 3px; }
.wh-lb-pts { font-family: 'Archivo Black', 'Archivo', sans-serif; font-size: 15px; color: var(--wh-royal); }
.wh-lb-time { font-weight: 700; font-size: 13px; text-align: right; }
.wh-lb-mine { background: var(--wh-royal); color: #FFFFFF; }
.wh-lb-mine .wh-lb-pts { color: var(--wh-gold); }
.wh-lb-mine .wh-lb-rank { border-color: #FFFFFF; }
