/* ================================================================
   GAME CARD ART — each card's picture has its own move. Only children
   and pseudo-elements animate: .gc-art itself carries the hover lift,
   and a second transform on it would fight that. Every loop ends on
   the frame it starts on, so nothing visibly resets.
   ================================================================ */

/* Earworm: the tiles flip like a scored row, green → amber → grey and round. */
#ew-card .gc-art { perspective: 300px; }
#ew-card .gc-art i { transform: none; animation: arcTile 6s ease-in-out infinite; backface-visibility: hidden; }
#ew-card .gc-art i:nth-child(1) { translate: 0 0;    animation-delay: 0s; }
#ew-card .gc-art i:nth-child(2) { translate: 0 6px;  animation-delay: -4s; transform: none; }
#ew-card .gc-art i:nth-child(3) { translate: 0 -3px; animation-delay: -2s; transform: none; }
@keyframes arcTile {
  0%, 25%   { transform: rotateX(0);     background: var(--g);              color: #0d0b12; }
  29%       { transform: rotateX(90deg); background: var(--g);              color: #0d0b12; }
  29.01%    { transform: rotateX(90deg); background: #efb927;               color: #0d0b12; }
  33%, 58%  { transform: rotateX(0);     background: #efb927;               color: #0d0b12; }
  62%       { transform: rotateX(90deg); background: #efb927;               color: #0d0b12; }
  62.01%    { transform: rotateX(90deg); background: rgba(255,255,255,.18); color: rgba(255,255,255,.8); }
  66%, 91%  { transform: rotateX(0);     background: rgba(255,255,255,.18); color: rgba(255,255,255,.8); }
  95%       { transform: rotateX(90deg); background: rgba(255,255,255,.18); color: rgba(255,255,255,.8); }
  95.01%    { transform: rotateX(90deg); background: var(--g);              color: #0d0b12; }
  100%      { transform: rotateX(0);     background: var(--g);              color: #0d0b12; }
}

/* Cover Fire: the fan shuffles — the front sleeve flicks up and round to the back. */
#blitz-card .gc-art i { transform: none; opacity: 1; animation: arcShuffle 4.2s cubic-bezier(.45, 0, .2, 1) infinite; }
#blitz-card .gc-art i:nth-child(1) { transform: none; opacity: 1; animation-delay: 0s; }
#blitz-card .gc-art i:nth-child(2) { transform: none; opacity: 1; animation-delay: -1.4s; }
#blitz-card .gc-art i:nth-child(3) { transform: none; opacity: 1; animation-delay: -2.8s; }
@keyframes arcShuffle {
  0%, 22%  { translate: -46px 0;    rotate: -12deg; z-index: 1; filter: brightness(.6); }
  33%, 55% { translate: -22px 0;    rotate: -4deg;  z-index: 2; filter: brightness(.85); }
  66%, 84% { translate: 0 0;        rotate: 7deg;   z-index: 3; filter: brightness(1); }
  92%      { translate: 18px -26px; rotate: 22deg;  z-index: 3; filter: brightness(1); }
  93%      { z-index: 0; }
  100%     { translate: -46px 0;    rotate: -12deg; z-index: 1; filter: brightness(.6); }
}

/* Guess the Cover: the record slides out of the sleeve and back in. */
#cover-card .gc-art { background: none; opacity: 1; }
#cover-card .gc-art::before, #cover-card .gc-art::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
#cover-card .gc-art::before {
  inset: 4px; border-radius: 50%;
  background: radial-gradient(circle, var(--g) 0 14%, #0d0b12 15% 18%, transparent 19%),
              repeating-radial-gradient(circle, #1c1922 0 1.5px, #2a2631 1.5px 3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .6);
  animation: arcSleeve 5s cubic-bezier(.45, 0, .2, 1) infinite;
}
#cover-card .gc-art::after {
  background: radial-gradient(circle at 60% 40%, color-mix(in srgb, var(--g) 80%, #fff) 0 14%, transparent 15%),
              linear-gradient(160deg, var(--g), color-mix(in srgb, var(--g) 30%, #0d0b12));
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45);
}
@keyframes arcSleeve { 0%, 18% { translate: 0 0; rotate: 0deg; } 46%, 70% { translate: 38px 0; rotate: 200deg; } 92%, 100% { translate: 0 0; rotate: 360deg; } }

/* Cover EXTREME: marching ants round the crop, the square breathing inside.
   The dashes are a 12px tile moved by exactly 12px, so the loop has no seam. */
#coverx-card .gc-art { border: 0; background: none; }
#coverx-card .gc-art::before {
  content: ''; position: absolute; inset: 0; border-radius: 10px; pointer-events: none; opacity: .75;
  background:
    repeating-linear-gradient(90deg, var(--g) 0 6px, transparent 6px 12px) 0 0 / 12px 1.5px repeat-x,
    repeating-linear-gradient(90deg, var(--g) 0 6px, transparent 6px 12px) 0 100% / 12px 1.5px repeat-x,
    repeating-linear-gradient(180deg, var(--g) 0 6px, transparent 6px 12px) 0 0 / 1.5px 12px repeat-y,
    repeating-linear-gradient(180deg, var(--g) 0 6px, transparent 6px 12px) 100% 0 / 1.5px 12px repeat-y;
  animation: arcAnts .9s linear infinite;
}
@keyframes arcAnts {
  from { background-position: 0 0, 12px 100%, 0 12px, 100% 0; }
  to   { background-position: 12px 0, 0 100%, 0 0, 100% 12px; }
}
#coverx-card .gc-art::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 2px;
  background: var(--g); box-shadow: 0 0 18px color-mix(in srgb, var(--g) 60%, transparent);
  animation: arcBreathe 2.8s ease-in-out infinite;
}
@keyframes arcBreathe { 0%, 100% { scale: 1; } 50% { scale: 1.35; } }

/* Tracklist: a "now playing" light steps down the tracks and comes round. */
#tracklist-card .gc-art i { transform-origin: left; animation: arcTrack 3.2s ease-in-out infinite; }
#tracklist-card .gc-art i:nth-child(4) { background: color-mix(in srgb, var(--g) 55%, transparent); }
#tracklist-card .gc-art i:nth-child(2) { animation-delay: .8s; }
#tracklist-card .gc-art i:nth-child(3) { animation-delay: 1.6s; }
#tracklist-card .gc-art i:nth-child(4) { animation-delay: 2.4s; }
@keyframes arcTrack {
  0%, 30%, 100% { background: color-mix(in srgb, var(--g) 55%, transparent); box-shadow: none; scale: 1 1; }
  8%, 20%       { background: var(--g); box-shadow: 0 0 12px color-mix(in srgb, var(--g) 70%, transparent); scale: 1.06 1.3; }
}

/* Higher or Lower: one rises as the other falls, then they trade. */
#hl-card .gc-art i:nth-child(1) { animation: arcUp 2.6s cubic-bezier(.34, 1.4, .64, 1) infinite; }
#hl-card .gc-art i:nth-child(2) { animation: arcDown 2.6s cubic-bezier(.34, 1.4, .64, 1) infinite; }
@keyframes arcUp {
  0%, 45%, 100% { translate: 0 0;    border-bottom-color: var(--g); }
  15%           { translate: 0 -8px; border-bottom-color: var(--g); }
  55%, 85%      { translate: 0 2px;  border-bottom-color: rgba(255, 255, 255, .22); }
}
@keyframes arcDown {
  0%, 45%, 100% { translate: 0 0;   border-top-color: rgba(255, 255, 255, .22); }
  55%, 85%      { translate: 0 0;   border-top-color: var(--g); }
  65%           { translate: 0 8px; border-top-color: var(--g); }
}

/* Guess the Year: a split-flap calendar, built and driven by Play.yearCard(). */
#year-card .gc-art { -webkit-text-stroke: 0; color: inherit; display: flex; align-items: flex-start; gap: 3px; }
#year-card .gc-art > i { font: 800 46px/1 var(--font-display); font-style: normal; color: var(--g); opacity: .8; margin: 2px 1px 0 0; }
.yf-d { position: relative; width: 46px; height: 64px; perspective: 260px; font: 800 50px/64px var(--font-display); text-align: center; color: var(--g); }
.yf-d > span { position: absolute; left: 0; right: 0; top: 0; height: 50%; overflow: hidden; backface-visibility: hidden;
  background: linear-gradient(180deg, #1f2c25, #18231e); border-radius: 8px 8px 0 0;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--g) 22%, transparent); }
.yf-d > span > b { position: absolute; left: 0; right: 0; top: 0; height: 64px; font: inherit; }
.yf-d > .yf-b, .yf-d > .yf-fb { top: 50%; border-radius: 0 0 8px 8px; background: linear-gradient(180deg, #15201b, #101914); }
.yf-d > .yf-b > b, .yf-d > .yf-fb > b { top: -32px; }
.yf-d > .yf-ft { z-index: 2; transform-origin: 50% 100%; }
.yf-d > .yf-fb { z-index: 2; transform-origin: 50% 0; transform: rotateX(90deg); }
.yf-d::after { content: ''; position: absolute; left: 2px; right: 2px; top: 50%; height: 1px; background: rgba(0, 0, 0, .7); z-index: 3; }
@media (max-width: 700px) {
  .yf-d { width: 34px; height: 48px; font-size: 37px; line-height: 48px; }
  .yf-d > span > b { height: 48px; }
  .yf-d > .yf-b > b, .yf-d > .yf-fb > b { top: -24px; }
  #year-card .gc-art > i { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) #games-grid.arcade .gc-art::before,
  html:not([data-motion="full"]) #games-grid.arcade .gc-art::after { animation: none !important; }
}
html[data-motion="none"] #games-grid.arcade .gc-art::before,
html[data-motion="none"] #games-grid.arcade .gc-art::after { animation: none !important; }
