/* TwinEagles game animations (site 1.65.0). Pairs with game/te-motion.js and
   loads after te-future.css. Every moving part sits behind
   prefers-reduced-motion: no-preference. */

/* Page-to-page fade between the Games page and the games (View Transitions). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: tmVtOut .22s ease both; }
  ::view-transition-new(root) { animation: tmVtIn .32s ease both; }
  @keyframes tmVtOut { to { opacity: 0; transform: scale(.985); filter: blur(2px); } }
  @keyframes tmVtIn { from { opacity: 0; transform: translateY(10px) scale(1.01); } }
  body.te-game .game-crumb { view-transition-name: tm-crumb; }
}

/* Poker chips flying to the pot, winning hand glow */
body.te-game > .tm-chip, .tm-chip { position: absolute; z-index: 60; width: 18px; height: 18px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, #fff 0 22%, var(--tf-accent2, #E7C258) 24% 58%, #8B6914 60% 70%, var(--tf-accent2, #E7C258) 72%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tf-accent2, #E7C258) 70%, transparent); }
body.te-game .pcard.tm-win { box-shadow: 0 0 0 2px var(--tf-accent2, #E7C258), 0 0 22px var(--tf-accent2, #E7C258); }
@media (prefers-reduced-motion: no-preference) {
  body.te-game .pcard.tm-win { animation: tmWin 1.4s ease-in-out infinite; }
  @keyframes tmWin { 50% { transform: translateY(-5px); box-shadow: 0 0 0 2px var(--tf-accent2, #E7C258), 0 0 34px var(--tf-accent2, #E7C258); } }
}

/* Trivia: timer ring, streak flame, correct stamp */
.tm-ring { display: inline-block; width: 26px; height: 26px; vertical-align: middle; margin-right: .4rem; }
.tm-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-ring circle { fill: none; stroke-width: 4; }
.tm-ring-bg { stroke: rgba(255,255,255,.12); }
.tm-ring-fg { stroke: var(--tf-accent, #3BE8FF); stroke-linecap: round; transition: stroke .2s; filter: drop-shadow(0 0 3px var(--tf-accent, #3BE8FF)); }
.tm-ring.urgent .tm-ring-fg { stroke: #ff3b4e; filter: drop-shadow(0 0 4px #ff3b4e); }
.tm-flame { display: inline-flex; align-items: center; gap: 2px; margin-right: .5rem; color: #FFB347; font-weight: 800; vertical-align: middle; }
.tm-flame[hidden] { display: none; }
.tm-flame-art { display: inline-block; width: 26px; height: 26px; }
.tm-stamp { position: absolute; inset: 0; margin: auto; width: 140px; height: 140px; pointer-events: none; z-index: 5; }

/* Unscramble shuffle button */
.tm-shuffle { margin: .6rem auto 0; display: flex; font-size: .82rem !important; padding: 7px 14px !important; min-width: 0 !important; }

/* Word find: the line through each found word */
.tm-lines { position: absolute; pointer-events: none; z-index: 2; overflow: visible; }
.tm-lines { mix-blend-mode: screen; }
.tm-lines line { opacity: .5; }
/* Found letters keep their word colour. The Future look (te-future.css) painted
   every cell dark, which hid the navy letters of found words. */
body.te-wordfind .cell.found { color: #fff; }
body.te-wordfind .cell.f0 { background: color-mix(in srgb, #E7C258 34%, #08122a); border-color: #E7C258; }
body.te-wordfind .cell.f1 { background: color-mix(in srgb, #7FB7E6 34%, #08122a); border-color: #7FB7E6; }
body.te-wordfind .cell.f2 { background: color-mix(in srgb, #86D19A 34%, #08122a); border-color: #86D19A; }
body.te-wordfind .cell.f3 { background: color-mix(in srgb, #E6A07F 34%, #08122a); border-color: #E6A07F; }
body.te-wordfind .cell.f4 { background: color-mix(in srgb, #C3A6E8 34%, #08122a); border-color: #C3A6E8; }
@media (prefers-reduced-motion: no-preference) {
  body.te-wordfind .word-list li.done, body.te-wordfind li.done { transition: color .3s, opacity .3s; }
}

/* Hear the clip: equalizer */
.tm-eq { display: block; width: min(320px, 100%); height: 70px; margin: 1rem auto 0; }

/* Leaderboards: your row */
.tm-me { background: color-mix(in srgb, var(--tf-accent, #3BE8FF) 14%, transparent); border-radius: 4px; }

/* Win trophy */
.tm-trophy { width: 110px; height: 110px; margin: 0 auto .25rem; }
.tm-hide { display: none !important; }

/* Win burst (confetti or holiday emoji) */
body.te-game > .tm-burst, .tm-burst { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

/* Christmas snow */
body.te-game > .tm-snow, .tm-snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; opacity: .7; }

/* Games page: card tilt */
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  body.te-hub .game-card { transform-style: preserve-3d; will-change: transform; }
  body.te-hub .game-card.tm-tilt {
    transform: perspective(700px) rotateX(var(--tm-rx, 0)) rotateY(var(--tm-ry, 0)) translateY(-3px);
    transition: transform .08s linear;
    background-image: radial-gradient(circle at var(--tm-gx, 50%) var(--tm-gy, 50%), color-mix(in srgb, var(--tf-accent, #3BE8FF) 16%, transparent), transparent 60%);
  }
}

/* Arcade: old-TV screen glow (scan lines, vignette, faint flicker) and banner */
body.te-arcade-game .arcade-stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.55) 100%);
  mix-blend-mode: multiply;
}
body.te-arcade-game .arcade-stage { box-shadow: 0 0 28px -6px color-mix(in srgb, var(--tf-accent, #3BE8FF) 55%, transparent), inset 0 0 40px rgba(0,0,0,.6); }
body.te-arcade-game #arcadeOverlay { z-index: 2; }
@media (prefers-reduced-motion: no-preference) {
  body.te-arcade-game .arcade-stage canvas { animation: tmFlicker 6s steps(1) infinite; }
  @keyframes tmFlicker { 0%, 100% { filter: brightness(1) saturate(1.1); } 47% { filter: brightness(1.04) saturate(1.15); } 48% { filter: brightness(.97) saturate(1.1); } }
}
.tm-banner {
  position: absolute; left: 0; right: 0; top: 40%; z-index: 3; pointer-events: none; text-align: center;
  padding: .6rem 0; font-family: 'Orbitron', system-ui, sans-serif; font-weight: 800; font-size: clamp(1rem, 5vw, 1.6rem);
  letter-spacing: .18em; color: #fff; text-transform: uppercase;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tf-accent, #3BE8FF) 30%, transparent) 20% 80%, transparent);
  text-shadow: 0 0 12px var(--tf-accent, #3BE8FF);
}
