/* games-b: Word Hunt (hunt-), Criss Cross (cross-), Picture Peek (peek-) and Link Up (link-). */

/* Shared: children stacked in one centred cell (Compose's Box with content centred). */
.hunt-stack { display: grid; place-items: center; min-height: 0; }
.hunt-stack > * { grid-area: 1 / 1; }
.hunt-struck { text-decoration: line-through; }

/* A spring-like pop: big, then a little under, then settled. */
@keyframes boardPop { 0% { transform: scale(1.15); } 45% { transform: scale(0.96); } 75% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes boardAppear { from { transform: scale(0.85); } 60% { transform: scale(1.03); } to { transform: scale(1); } }

/* Word Hunt */
.hunt-tray { display: grid; }
.hunt-tray > * { grid-area: 1 / 1; align-self: start; }
.hunt-chips { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: 6px; min-width: 0; }
.hunt-ghost { visibility: hidden; }
.hunt-chip {
  display: flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 10px 3px 5px;
  border-radius: 999px;
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
.hunt-chip-pop { animation: boardPop 0.5s ease-out; }
.hunt-chip-meaning { font-size: 14px; line-height: 20px; font-weight: 800; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hunt-chip-meaning.hunt-struck { color: rgba(30, 27, 75, 0.55); }
.hunt-chip-term { font-size: 14px; line-height: 20px; font-weight: 900; color: var(--ink); white-space: pre; }
.hunt-appear { animation: boardAppear 0.5s cubic-bezier(.3, 1.2, .5, 1) both; }
.hunt-canvas { display: block; touch-action: none; cursor: pointer; }
/* Over the grid, whose appear animation leaves it a layer of its own. */
.hunt-banner { pointer-events: none; z-index: 2; }
.hunt-banner-card { animation: popIn 0.45s cubic-bezier(.3, 1.6, .5, 1) both; }
.hunt-confetti { display: block; }
.hunt-hint { padding: 0 16px 0 10px; border: 1px solid var(--line); gap: 6px; }
@keyframes huntShakeA { 0%, 100% { transform: none; } 11.9% { transform: translateX(-14px); } 28.6% { transform: translateX(14px); } 45.2% { transform: translateX(-10px); } 61.9% { transform: translateX(10px); } 78.6% { transform: translateX(-5px); } }
@keyframes huntShakeB { 0%, 100% { transform: none; } 11.9% { transform: translateX(-14px); } 28.6% { transform: translateX(14px); } 45.2% { transform: translateX(-10px); } 61.9% { transform: translateX(10px); } 78.6% { transform: translateX(-5px); } }

/* Criss Cross */
.cross-pop { animation: crossPop 0.4s ease-out; }
@keyframes crossPop { 0% { transform: scale(0.92); } 55% { transform: scale(1.02); } 100% { transform: scale(1); } }
.cross-clue { justify-content: center; max-width: 100%; }
.cross-clue-meaning { font-size: 20px; line-height: 26px; font-weight: 800; color: var(--ink); text-align: center; min-width: 0; }
.cross-chevron { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cross-chevron.off { opacity: 0.3; cursor: default; }
.cross-chevron-face { width: 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--ink); transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1); }
.cross-chevron:not(.off):active .cross-chevron-face { transform: scale(0.9); }
.cross-area { display: grid; place-items: center; min-height: 0; overflow: hidden; }
.cross-area > * { grid-area: 1 / 1; }
.cross-board { max-width: 100%; }
.cross-appear { animation: boardAppear 0.5s cubic-bezier(.3, 1.2, .5, 1) both; }
.cross-square {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.25s ease, border-color 0.2s ease;
}
.cross-number { position: absolute; top: 1px; left: 3px; font-size: 9px; line-height: 9px; font-weight: 800; }
.cross-letter { font-weight: 900; line-height: 1; }
.cross-letter-pop { animation: crossLetterPop 0.4s ease-out; }
@keyframes crossLetterPop { 0% { transform: scale(1.18); } 45% { transform: scale(0.95); } 75% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes crossShakeA { 0%, 100% { transform: none; } 12.5% { transform: translateX(-8px); } 30% { transform: translateX(8px); } 47.5% { transform: translateX(-6px); } 65% { transform: translateX(6px); } 82.5% { transform: translateX(-3px); } }
@keyframes crossShakeB { 0%, 100% { transform: none; } 12.5% { transform: translateX(-8px); } 30% { transform: translateX(8px); } 47.5% { transform: translateX(-6px); } 65% { transform: translateX(6px); } 82.5% { transform: translateX(-3px); } }
@keyframes crossBounceA { 0%, 100% { transform: none; } 31.6% { transform: translateY(-12px); } 68.4% { transform: translateY(3px); } }
@keyframes crossBounceB { 0%, 100% { transform: none; } 31.6% { transform: translateY(-12px); } 68.4% { transform: translateY(3px); } }
.cross-clues { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.cross-clue-chip { max-width: 100%; padding: 3px 10px; border-radius: 999px; }
.cross-clue-chip.on { cursor: pointer; }
.cross-banner { display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 2; }
.cross-key { position: relative; height: 44px; flex-shrink: 0; cursor: pointer; user-select: none; }
.cross-key-ledge { position: absolute; left: 0; right: 0; top: 4px; height: 40px; border-radius: 10px; }
.cross-key-face { position: absolute; left: 0; right: 0; top: 0; height: 40px; border-radius: 10px; transition: transform 0.08s ease; }
.cross-key:active .cross-key-face { transform: translateY(3px); }
.cross-key-letter { font-size: 18px; font-weight: 800; color: var(--ink); }

/* Picture Peek */
.peek-area { min-height: 0; }
.peek-card { overflow: hidden; touch-action: none; cursor: pointer; }
.peek-foil { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.45s ease; }
.peek-foil.gone { opacity: 0; }
.peek-bounce { animation: peekBounce 0.7s ease-out; }
@keyframes peekBounce { 0% { transform: scale(1.06); } 30% { transform: scale(0.97); } 55% { transform: scale(1.02); } 80% { transform: scale(0.995); } 100% { transform: scale(1); } }
.peek-coin { position: absolute; left: 0; top: 0; pointer-events: none; }
.peek-meaning { max-width: 100%; animation: peekMeaningIn 0.3s ease-out both; }
@keyframes peekMeaningIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.peek-points {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 34px;
  line-height: 40px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 2.5px 0 var(--gold-ledge), -2.5px 0 var(--gold-ledge), 0 2.5px var(--gold-ledge), 0 -2.5px var(--gold-ledge),
    1.8px 1.8px var(--gold-ledge), -1.8px 1.8px var(--gold-ledge), 1.8px -1.8px var(--gold-ledge), -1.8px -1.8px var(--gold-ledge);
  pointer-events: none;
  animation: peekFloat 1.2s cubic-bezier(0, 0, .2, 1) both;
}
@keyframes peekFloat { 0% { transform: translateY(30px); opacity: 1; } 41% { opacity: 1; } 100% { transform: translateY(-30px); opacity: 0; } }
@keyframes peekShakeA { 0%, 100% { transform: none; } 11.9% { transform: translateX(-14px); } 28.6% { transform: translateX(14px); } 45.2% { transform: translateX(-10px); } 61.9% { transform: translateX(10px); } 78.6% { transform: translateX(-5px); } }
@keyframes peekShakeB { 0%, 100% { transform: none; } 11.9% { transform: translateX(-14px); } 28.6% { transform: translateX(14px); } 45.2% { transform: translateX(-10px); } 61.9% { transform: translateX(10px); } 78.6% { transform: translateX(-5px); } }
.peek-answer {
  --face: #fff;
  --ledge: var(--line);
  position: relative;
  height: 56px;
  margin-bottom: 5px;
  padding: 0 10px;
  border-radius: 18px;
  background: var(--face);
  box-shadow: 0 5px 0 var(--ledge);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  line-height: 1.2;
  transition: background-color 0.25s ease, box-shadow 0.25s ease, transform 0.08s ease, opacity 0.25s ease;
}
.peek-answer:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ledge); }
.peek-answer:disabled { cursor: default; }
/* Its number key, shown only where there is a mouse (and so, likely, a keyboard). */
.peek-key { display: none; position: absolute; top: 5px; left: 9px; font-size: 11px; line-height: 11px; font-weight: 800; opacity: 0.45; }
@media (hover: hover) and (pointer: fine) {
  .peek-key { display: block; }
  .peek-answer:hover:not(:disabled) { filter: brightness(0.98); }
}

/* Link Up */
.link-board { min-height: 0; }
.link-room { position: absolute; }
.link-cables { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.link-slot { position: absolute; }
.link-card {
  --lift: 0px;
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 16px;
  transform: translateY(var(--lift));
  transition: transform 0.18s cubic-bezier(.3, 1.6, .5, 1), background-color 0.2s ease, border-color 0.2s ease;
}
.link-card.lifted { --lift: -3px; }
.link-card.on { cursor: pointer; }
.link-card.on:active { transform: translateY(var(--lift)) scale(0.97); }
.link-plug { position: absolute; top: 50%; padding: 3px; border-radius: 50%; background: #fff; }
.link-plug > div { width: 100%; height: 100%; border-radius: 50%; transition: background-color 0.2s ease; }
.link-footer { position: absolute; left: 0; right: 0; height: 86px; padding: 4px; display: flex; justify-content: center; }
.link-message {
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  white-space: pre-line;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  animation: linkMessageIn 0.25s ease-out both;
}
@keyframes linkMessageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes linkShakeA { 0%, 100% { transform: none; } 15% { transform: translateX(-10px); } 32.5% { transform: translateX(10px); } 50% { transform: translateX(-6px); } 67.5% { transform: translateX(4px); } }
@keyframes linkShakeB { 0%, 100% { transform: none; } 15% { transform: translateX(-10px); } 32.5% { transform: translateX(10px); } 50% { transform: translateX(-6px); } 67.5% { transform: translateX(4px); } }

/* Desktop: the activities fill the window (GameSplit), so their big-board text grows too. */
@media (min-width: 900px) {
  .peek-area .peek-meaning { font-size: 24px; line-height: 30px; }
  .peek-points { font-size: 52px; line-height: 60px; }
  /* Link Up's line about the last cable, in the side panel under the prompt. */
  .link-side { padding: 8px 20px 0; display: flex; justify-content: center; }
  .link-side .link-message { font-size: 17px; line-height: 24px; -webkit-line-clamp: 9; }
}

@media (hover: hover) {
  .cross-key:hover .cross-key-face { filter: brightness(0.98); }
  .cross-clue-chip.on:hover { filter: brightness(0.98); }
  .cross-chevron:not(.off):hover .cross-chevron-face { filter: brightness(0.96); }
  .link-card.on:hover { filter: brightness(0.99); box-shadow: 0 3px 10px rgba(30, 27, 75, 0.08); }
}

@media (prefers-reduced-motion: reduce) {
  .hunt-appear, .cross-appear, .cross-pop, .hunt-chip-pop, .peek-bounce, .cross-letter-pop { animation: none; }
}
