/* ═══ CRICMATES MOTION SYSTEM ═══ */
@media (prefers-reduced-motion: reduce) {
  .cm-animated-app *, .cm-animated-app *::before, .cm-animated-app *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@keyframes cm-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cm-fade-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes cm-slide-in-right {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes cm-scale-in {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes cm-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes cm-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(253, 224, 71, 0.45); }
  50% { box-shadow: 0 0 24px 6px rgba(253, 224, 71, 0.35); }
}
@keyframes cm-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes cm-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes cm-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}
@keyframes cm-heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.12); }
  28% { transform: scale(1); }
  42% { transform: scale(1.08); }
  70% { transform: scale(1); }
}
@keyframes cm-score-flash {
  0% { transform: scale(1); color: inherit; }
  40% { transform: scale(1.15); color: var(--yellow-cta); }
  100% { transform: scale(1); }
}
@keyframes cm-confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(80px) rotate(360deg); opacity: 0; }
}
@keyframes cm-screen-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes cm-stagger-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.cm-animated-app .screen.active {
  animation: cm-screen-enter 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cm-animated-app .start-btn,
.cm-animated-app .dash-cta-bar,
.cm-animated-app .fab-btn {
  animation: cm-pulse-glow 2.8s ease-in-out infinite;
}
.cm-animated-app .start-btn:active,
.cm-animated-app .dash-cta-bar:active {
  animation: cm-pop 0.25s ease;
}

.cm-animated-app .dash-stat-card,
.cm-animated-app .dash-action-card,
.cm-animated-app .live-match-card,
.cm-animated-app .friend-card,
.cm-animated-app .friend-list-row,
.cm-animated-app .history-card,
.cm-animated-app .pstat-card {
  animation: cm-fade-in-up 0.5s ease both;
}
.cm-animated-app .dash-stat-card:nth-child(1) { animation-delay: 0.05s; }
.cm-animated-app .dash-stat-card:nth-child(2) { animation-delay: 0.1s; }
.cm-animated-app .dash-stat-card:nth-child(3) { animation-delay: 0.15s; }
.cm-animated-app .dash-stat-card:nth-child(4) { animation-delay: 0.2s; }
.cm-animated-app .dash-stat-card:nth-child(5) { animation-delay: 0.25s; }

.cm-animated-app .run-btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s;
}
.cm-animated-app .run-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.cm-animated-app .run-btn:active {
  transform: scale(0.95);
}
.cm-animated-app .run-btn.run-4:hover,
.cm-animated-app .run-btn.run-6:hover {
  animation: cm-wiggle 0.4s ease;
}
.cm-animated-app .run-btn.run-pop {
  animation: cm-pop 0.35s ease;
}

.cm-animated-app .runs-display.score-bump,
.cm-animated-app .wickets-display.score-bump {
  animation: cm-score-flash 0.45s ease;
}

.cm-animated-app .modal-card {
  animation: cm-scale-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.cm-animated-app .modal-overlay:not(.hidden) {
  animation: cm-fade-in 0.25s ease both;
}

.cm-animated-app .profile-hero {
  animation: cm-slide-in-right 0.55s ease both;
}
.cm-animated-app .profile-stats-grid .pstat-card {
  animation: cm-stagger-rise 0.45s ease both;
}
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(1) { animation-delay: 0.04s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(2) { animation-delay: 0.08s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(3) { animation-delay: 0.12s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(4) { animation-delay: 0.16s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(5) { animation-delay: 0.2s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(6) { animation-delay: 0.24s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(7) { animation-delay: 0.28s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(8) { animation-delay: 0.32s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(9) { animation-delay: 0.36s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(10) { animation-delay: 0.4s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(11) { animation-delay: 0.44s; }
.cm-animated-app .profile-stats-grid .pstat-card:nth-child(12) { animation-delay: 0.48s; }

.cm-animated-app .logo-icon {
  animation: cm-float 3s ease-in-out infinite;
}
.cm-animated-app .result-trophy {
  animation: cm-heartbeat 1.4s ease infinite;
}

.cm-animated-app .ball-chip {
  animation: cm-scale-in 0.3s ease both;
}

.cm-toast-pop {
  animation: cm-pop 0.35s ease, cm-fade-in 0.35s ease;
}

.cm-confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
}
.cm-confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: cm-confetti-fall 0.9s ease forwards;
}

.cm-shimmer-bar {
  background: linear-gradient(90deg, transparent, rgba(253, 224, 71, 0.25), transparent);
  background-size: 200% 100%;
  animation: cm-shimmer 1.8s linear infinite;
}

/* ═══ SPLASH PITCH LOADER (ball → stumps) ═══ */
#screen-splash {
  --splash-load-dur: 2.2s;
}

.splash-pitch-loader {
  width: min(92vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  animation: cm-fade-in 0.55s ease both;
}

.splash-pitch-track {
  position: relative;
  width: 100%;
  height: 16px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: visible;
}

.splash-pitch-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #d1d5db 0%, #9ca3af 45%, #6b7280 100%);
  animation: splash-pitch-fill var(--splash-load-dur) ease-out forwards;
}

.splash-pitch-ball {
  position: absolute;
  top: 50%;
  left: 6px;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  z-index: 3;
  animation: splash-pitch-ball var(--splash-load-dur) ease-out forwards;
}

.splash-pitch-ball-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #f87171, #dc2626 55%, #991b1b);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.55), inset 0 2px 6px rgba(255, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.splash-pitch-ball-core .pitch-seam {
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

.splash-pitch-ball-core .pitch-seam1 {
  width: 22px;
  height: 22px;
  top: 2px;
  left: -6px;
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(28deg);
}

.splash-pitch-ball-core .pitch-seam2 {
  width: 22px;
  height: 22px;
  top: 2px;
  right: -6px;
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(-28deg);
}

.splash-pitch-stumps {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 2px);
  display: flex;
  align-items: flex-end;
  gap: 3px;
  transform-origin: bottom center;
  animation: splash-pitch-stump-hit var(--splash-load-dur) ease-out forwards;
}

.splash-pitch-stumps .pitch-stump {
  display: block;
  width: 5px;
  height: 30px;
  background: linear-gradient(180deg, #374151, #111827);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.splash-pitch-stumps .pitch-stump-mid {
  height: 34px;
}

.splash-pitch-stumps .pitch-bail {
  position: absolute;
  top: -5px;
  width: 9px;
  height: 3px;
  background: #111827;
  border-radius: 1px;
}

.splash-pitch-stumps .pitch-bail-l {
  left: 4px;
  animation: splash-pitch-bail-l var(--splash-load-dur) ease-out forwards;
}

.splash-pitch-stumps .pitch-bail-r {
  right: 4px;
  animation: splash-pitch-bail-r var(--splash-load-dur) ease-out forwards;
}

.splash-pitch-label {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.04em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  animation: splash-pitch-label-pulse 1.4s ease-in-out infinite;
}

@keyframes splash-pitch-fill {
  0% { width: 0%; }
  82% { width: calc(100% - 44px); }
  100% { width: 100%; }
}

@keyframes splash-pitch-ball {
  0% {
    left: 4px;
    transform: translateY(-50%) rotate(0deg);
  }
  82% {
    left: calc(100% - 52px);
    transform: translateY(-50%) rotate(620deg);
  }
  90% {
    left: calc(100% - 38px);
    transform: translateY(-72%) rotate(680deg) scale(1.08);
  }
  100% {
    left: calc(100% - 38px);
    transform: translateY(-50%) rotate(680deg);
  }
}

@keyframes splash-pitch-stump-hit {
  0%, 84% { transform: rotate(0deg); }
  92% { transform: rotate(-24deg); }
  100% { transform: rotate(-28deg); }
}

@keyframes splash-pitch-bail-l {
  0%, 86% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-16px, -22px) rotate(-75deg);
  }
}

@keyframes splash-pitch-bail-r {
  0%, 86% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(16px, -24px) rotate(75deg);
  }
}

@keyframes splash-pitch-label-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

/* ═══ COIN TOSS (fair flip) ═══ */
.toss-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -8px 0 16px;
  line-height: 1.45;
}

.toss-coin-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding: 20px 16px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}

.toss-coin-scene {
  perspective: 800px;
  width: 120px;
  height: 120px;
}

.toss-coin-scene-sm {
  width: 88px;
  height: 88px;
  margin: 0 auto 16px;
}

.coin-flipper {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.coin-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.1s linear;
}

.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.coin-heads {
  background: radial-gradient(circle at 35% 30%, #fde68a, #d97706 70%, #92400e);
  color: #1a0a2e;
  transform: rotateY(0deg);
}

.coin-tails {
  background: radial-gradient(circle at 35% 30%, #e2e8f0, #64748b 70%, #334155);
  color: #0f172a;
  transform: rotateY(180deg);
}

.coin-flipper.show-heads .coin-inner {
  transform: rotateY(0deg);
}

.coin-flipper.show-tails .coin-inner {
  transform: rotateY(180deg);
}

.coin-flipper.is-flipping.land-heads .coin-inner {
  animation: coin-spin-heads 2.4s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

.coin-flipper.is-flipping.land-tails .coin-inner {
  animation: coin-spin-tails 2.4s cubic-bezier(0.2, 0.85, 0.25, 1) forwards;
}

@keyframes coin-spin-heads {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(2160deg); }
}

@keyframes coin-spin-tails {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(1980deg); }
}

.toss-side-labels {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 320px;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.toss-side-label {
  flex: 1;
  text-align: center;
}

.toss-result-text {
  min-height: 1.4em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--purple-bright);
  text-align: center;
  line-height: 1.4;
}

.toss-flip-btn {
  min-width: 160px;
}

.toss-group.full-width {
  flex: 1 1 100%;
  min-width: 100%;
}

.dash-panel-collapsed {
  display: none !important;
}
