/* ============================================================
   GiverGames Word Harvest -- wh.css
   Builds on dnd.css (marquee, gate, result, code box, sparks).
   ============================================================ */

.wh-page .marquee-title .mt-deal,
.wh-page .marquee-title .mt-nodeal { font-size: clamp(2rem, 7.5vw, 3.2rem); }
.wh-page .dnd-stage.playing .mt-deal,
.wh-page .dnd-stage.playing .mt-nodeal { font-size: clamp(1.4rem, 5.6vw, 1.9rem); }


/* ============================================================
   READY SCREEN
   ============================================================ */
.wh-howto { color: rgba(255,255,255,0.82); font-size: 1.02rem; }
.wh-howto strong { color: var(--yellow); }

.wh-demo {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 22px;
}
.wh-demo .tile { width: 40px; height: 46px; font-size: 1.2rem; }

.wh-scoring {
  width: 100%;
  margin: 0 auto 12px;
  border-collapse: separate;
  border-spacing: 0 6px;
  font-size: 0.9rem;
}
.wh-scoring caption {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
}
.wh-scoring th { text-align: left; font-weight: 600; color: rgba(255,255,255,0.75); padding-left: 10px; }
.wh-scoring td { text-align: right; font-weight: 900; color: var(--yellow); padding-right: 14px; }


/* ============================================================
   TILES
   ============================================================ */
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  font-weight: 900;
  color: var(--charcoal);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.45) 0%, transparent 40%),
    linear-gradient(180deg, #FFE27A 0%, var(--yellow) 45%, #D9A300 100%);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.16), 0 6px 14px rgba(0,0,0,0.3);
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.tile.on { background: linear-gradient(180deg, #3FE0D0, var(--teal) 50%, #0E9A8E); color: var(--ink); }


/* ============================================================
   GAME
   ============================================================ */
.wh-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  max-width: 560px;
  margin: 0 auto 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
}
.wh-top b { color: var(--white); }
.wh-score b { color: var(--yellow); font-size: 1.3rem; }
.wh-score.bump b { display: inline-block; animation: thump 0.45s ease; }

/* The clock: a bar that drains, and the seconds left */
.wh-clock {
  position: relative;
  max-width: 560px;
  height: 34px;
  margin: 0 auto 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.wh-clock-bar {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--teal), #3FE0D0);
}
.wh-clock.hurry .wh-clock-bar { background: linear-gradient(90deg, #E2574C, #FF8A80); }
.wh-clock.hurry { animation: pulse 0.5s ease-in-out infinite alternate; }
@keyframes pulse { to { box-shadow: inset 0 0 0 1px rgba(255,138,128,0.6), 0 0 18px rgba(226,87,76,0.45); } }
.wh-clock-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--white);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Source letters */
.wh-source {
  display: grid;
  grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr));
  gap: 6px;
  max-width: calc(var(--n, 10) * 56px);
  margin: 0 auto 20px;
  perspective: 800px;
}
.wh-source .tile {
  width: 100%;
  aspect-ratio: auto;
  height: clamp(42px, 11vw, 58px);
  font-size: clamp(1.1rem, 5vw, 1.6rem);
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.wh-source .tile:active { transform: scale(0.92); }
.wh-source .tile.used { opacity: 0.18; transform: scale(0.88); pointer-events: none; box-shadow: none; }
.wh-source.flip .tile { animation: tileFlip 0.42s cubic-bezier(.3,1.3,.5,1) backwards; }
@keyframes tileFlip {
  from { transform: rotateX(-90deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* The word being built */
.wh-answer {
  min-height: 64px;
  max-width: 560px;
  margin: 0 auto 18px;
  padding: 8px;
  border-radius: 16px;
  border: 2px dashed rgba(255,255,255,0.18);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.wh-answer input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  text-align: center;
  font-family: inherit;
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--white);
  caret-color: var(--yellow);
}
.wh-answer input::placeholder {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255,255,255,0.4);
}
.wh-answer:focus-within { border-color: var(--yellow); border-style: solid; }
.wh-answer.nope { animation: nope 0.3s ease; }
@keyframes nope {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.wh-answer .tile {
  width: clamp(32px, 8.5vw, 44px);
  height: clamp(40px, 10vw, 50px);
  font-size: clamp(1rem, 4.4vw, 1.4rem);
  animation: snap 0.18s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes snap {
  from { transform: translateY(-14px) scale(0.6); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.wh-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 12px;
  max-width: 420px;
  margin: 0 auto;
}
.wh-actions .btn-nodeal, .wh-actions .btn-deal { font-size: 1.05rem; padding: 15px 10px; }
.wh-actions .btn-deal:disabled { opacity: 0.45; cursor: default; filter: grayscale(0.4); }

/* Words found for the current giving word */
.wh-found {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 560px;
  margin: 16px auto 0;
}
.wh-found li {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(19,199,182,0.18);
  color: #BFF5EF;
  animation: snap 0.25s cubic-bezier(.3,1.6,.5,1) both;
}
.wh-found li b { color: var(--yellow); margin-left: 4px; }

/* Scored word pop: floats over the marquee so it never hides the
   next window's letters while that clock is running */
.wh-pop {
  position: fixed;
  left: 50%;
  top: 72px;
  z-index: 150;
  transform: translateX(-50%);
  padding: 14px 26px;
  border-radius: 20px;
  background: rgba(24,34,40,0.94);
  box-shadow: 0 0 0 2px rgba(253,205,44,0.6), 0 20px 50px rgba(0,0,0,0.5);
  text-align: center;
  pointer-events: none;
  animation: popIn 0.4s cubic-bezier(.2,1.6,.4,1) both;
}
.wh-pop b { display: block; font-size: 2rem; font-weight: 900; color: var(--yellow); line-height: 1.1; }
.wh-pop span { display: block; font-size: 0.95rem; font-weight: 700; letter-spacing: 0.06em; color: var(--white); }
.wh-pop.miss { box-shadow: 0 0 0 2px rgba(255,255,255,0.25), 0 20px 50px rgba(0,0,0,0.5); }
.wh-pop.miss b { font-size: 1.4rem; color: rgba(255,255,255,0.85); }
@keyframes popIn {
  from { transform: translateX(-50%) translateY(16px) scale(0.6); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}


/* ============================================================
   RESULT RECAP
   ============================================================ */
.wh-recap-wrap { overflow-x: auto; margin-top: 12px; }
.wh-recap { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.wh-recap th, .wh-recap td { padding: 7px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.08); }
.wh-recap th { font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.5); }
.wh-recap td { color: rgba(255,255,255,0.8); }
.wh-recap td.pts { font-weight: 900; color: var(--yellow); }
.wh-recap td.miss { color: rgba(255,255,255,0.4); font-style: italic; }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 760px) {
  .wh-source { gap: 4px; }
  .wh-source .tile { border-radius: 8px; }
  .wh-answer { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .wh-source.flip .tile, .wh-answer .tile, .wh-pop, .wh-clock.hurry { animation: none !important; }
}
