/* animations.css — Styles for the animation stage and all 7 animation engines */

/* ─── Countdown overlay ──────────────────────────────────────────────────── */

.countdown {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: var(--z-overlay);
  border-radius: inherit;
  cursor: pointer;
  user-select: none;
}

.countdown__number {
  font-family: var(--font-display);
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 800;
  color: #fff;
  line-height: 1;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  animation: countdown-pop 0.35s var(--ease-out-quart) both;
}

.countdown__skip {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
  margin-block-start: var(--space-3);
  letter-spacing: 0.04em;
}

@keyframes countdown-pop {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ─── Shared canvas wrapper ──────────────────────────────────────────────── */

.anim-canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.anim-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* ─── Animation 1: Spin Wheel ────────────────────────────────────────────── */

.wheel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.wheel-pointer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-inline: 12px solid transparent;
  border-block-start: 28px solid var(--color-secondary);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  z-index: 2;
}

/* ─── Animation 2: Dual Orbit ────────────────────────────────────────────── */

.orbit-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* ─── Animation 3: Slot Machine ──────────────────────────────────────────── */

.slots-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  height: 100%;
  padding: var(--space-4);
  box-sizing: border-box;
}

.slots-machine {
  display: flex;
  gap: var(--space-3);
  background: var(--surface-2);
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg), inset 0 2px 8px rgba(0,0,0,0.15);
  position: relative;
}

.slots-reel-wrap {
  width: 120px;
  height: 180px;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  background: var(--surface-1);
  position: relative;
}

.slots-reel {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.slots-cell {
  width: 120px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  padding: var(--space-1) var(--space-2);
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Win-line: top and bottom borders on the middle visible row */
.slots-reel-wrap::before,
.slots-reel-wrap::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  height: 2px;
  background: var(--color-secondary);
  z-index: 3;
  pointer-events: none;
}

.slots-reel-wrap::before { top: 60px; }
.slots-reel-wrap::after  { top: 120px; }

/* ─── Animation 4: Single Reel ───────────────────────────────────────────── */

.reel-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-4);
  box-sizing: border-box;
}

.reel-window {
  width: min(340px, 90%);
  height: 80px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 2px solid var(--color-primary);
  background: var(--surface-1);
  position: relative;
  box-shadow: var(--shadow-md);
}

.reel-tape {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.reel-cell {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  padding: var(--space-2) var(--space-4);
  box-sizing: border-box;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-window::before,
.reel-window::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  height: 2px;
  background: var(--color-secondary);
  z-index: 3;
  pointer-events: none;
}

.reel-window::before { top: 0; }
.reel-window::after  { bottom: 0; }

/* ─── Animation 5: TV Display ────────────────────────────────────────────── */

.tv-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.tv-body {
  background: #1a1a2e;
  border-radius: 16px 16px 24px 24px;
  padding: var(--space-3);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 0 3px #2d2d4e;
  position: relative;
  width: min(320px, 88%);
}

.tv-screen {
  background: #0a0a1a;
  border-radius: 10px;
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CRT scanline overlay */
.tv-screen::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 2;
  border-radius: inherit;
}

.tv-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(1rem, 4vw, 2rem);
  font-weight: 700;
  color: #00ff88;
  text-shadow: 0 0 12px rgba(0, 255, 136, 0.8);
  text-align: center;
  padding: var(--space-3);
  word-break: break-word;
  position: relative;
  z-index: 1;
  max-width: 90%;
}

.tv-channel {
  position: absolute;
  top: var(--space-2);
  inset-inline-end: var(--space-2);
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--text-xs);
  color: rgba(0, 255, 136, 0.5);
  z-index: 3;
}

.tv-final-badge {
  position: absolute;
  bottom: var(--space-2);
  inset-inline-start: 50%;
  transform: translateX(-50%);
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--text-xs);
  color: #ffff00;
  text-shadow: 0 0 8px rgba(255, 255, 0, 0.8);
  letter-spacing: 0.2em;
  z-index: 3;
  white-space: nowrap;
}

.tv-legs {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-block-start: var(--space-1);
}

.tv-leg {
  width: 10px;
  height: 20px;
  background: #2d2d4e;
  border-radius: 0 0 4px 4px;
}

/* ─── Animation 6: Rolling Die ───────────────────────────────────────────── */

.die-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  perspective: 600px;
}

.die-scene {
  width: 100px;
  height: 100px;
  transform-style: preserve-3d;
  will-change: transform;
}

.die-face {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--surface-1);
  border: 2px solid var(--border);
  box-shadow: inset 0 0 12px rgba(0,0,0,0.1);
  text-align: center;
  padding: var(--space-1);
  box-sizing: border-box;
  word-break: break-word;
  overflow: hidden;
  backface-visibility: hidden;
}

.die-face--1 { transform: translateZ(50px); }
.die-face--2 { transform: rotateY(180deg) translateZ(50px); }
.die-face--3 { transform: rotateY(90deg)  translateZ(50px); }
.die-face--4 { transform: rotateY(-90deg) translateZ(50px); }
.die-face--5 { transform: rotateX(90deg)  translateZ(50px); }
.die-face--6 { transform: rotateX(-90deg) translateZ(50px); }

/* ─── Animation 7: Lottery Balls ─────────────────────────────────────────── */

.lottery-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: 100%;
  padding: var(--space-3);
  box-sizing: border-box;
}

.lottery-tank {
  position: relative;
  width: min(300px, 90%);
  height: 200px;
  border: 3px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  overflow: hidden;
  box-shadow: var(--shadow-md), inset 0 0 20px rgba(0,0,0,0.08);
}

.lottery-ball {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.25), inset 2px 2px 4px rgba(255,255,255,0.4);
}

.lottery-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
}

.lottery-winner-ball {
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset -3px -3px 6px rgba(0,0,0,0.25), inset 2px 2px 4px rgba(255,255,255,0.4);
}

.lottery-winner-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lottery-winner-name.is-visible {
  opacity: 1;
}

/* ─── Reduced motion overrides ───────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .countdown__number {
    animation: none;
  }
}
