/* ==========================================
   ReflexLab - Clicks Per Second (CPS) Test
   Page-specific styles. Layers on top of styles.css;
   reuses its tokens, components, nav, widgets, and rank system.
   ========================================== */

/* ------------------------------------------
   Screen-reader-only helper
   ------------------------------------------ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------
   Nav cross-link (styled like btn-nav, as an anchor)
   ------------------------------------------ */
.btn-nav-link {
  text-decoration: none;
}

/* ------------------------------------------
   Widget-title emoji — same iconography as the
   homepage telemetry widgets (tip cards inherit
   .tip-card-icon from styles.css unchanged)
   ------------------------------------------ */
.widget-icon {
  font-size: var(--font-size-lg);
  flex-shrink: 0;
}

/* ==========================================
   LIVE COUNTING DISPLAY (inside the test area)
   ========================================== */
.cps-live {
  text-align: center;
  z-index: 1;
  padding: 0 var(--space-lg);
}

.cps-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-sm);
  line-height: 1;
}

.cps-value {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 11vw, 5rem);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.cps-unit-inline {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
}

.cps-live-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
}

.cps-live-meta strong {
  font-family: var(--font-mono);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}

.cps-meta-sep {
  color: var(--color-text-muted);
}

/* ==========================================
   TEST AREA STATE: COUNTING
   (idle reuses .state-idle; complete reuses
    .state-session-complete + .rank-* from styles.css)
   ========================================== */
.test-area.state-cps-counting {
  background: var(--color-accent-subtle);
  border: 2px solid var(--color-accent);
  box-shadow: var(--shadow-glow-accent);
  cursor: pointer;
}

/* ==========================================
   COUNTDOWN TIMER BAR
   ========================================== */
.cps-timer-track {
  width: 100%;
  max-width: 960px;
  height: 6px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cps-timer-fill {
  height: 100%;
  width: 100%;
  background: var(--color-accent);
  border-radius: var(--radius-full);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* ==========================================
   RESULT META + NEW-BEST FLAG
   ========================================== */
.cps-result-meta {
  margin-top: var(--space-sm);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.cps-best-flag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.02em;
  animation: cpsBestPop 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.cps-best-flag span {
  font-size: var(--font-size-base);
}

@keyframes cpsBestPop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==========================================
   CLICK RIPPLE (per-click feedback; clipped by
   the test area's overflow:hidden)
   ========================================== */
.cps-ripple {
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: var(--radius-full);
  background: radial-gradient(
    circle,
    rgba(34, 197, 94, 0.35) 0%,
    rgba(34, 197, 94, 0) 70%
  );
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0.9;
  z-index: 0;
  animation: cpsRipple 0.5s ease-out forwards;
}

@keyframes cpsRipple {
  100% {
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

/* ==========================================
   REDUCED MOTION
   styles.css already neutralizes animations globally,
   but be explicit for the CPS-specific pieces.
   ========================================== */
@media (prefers-reduced-motion: reduce) {
  .cps-best-flag {
    animation: none;
  }
  .cps-ripple {
    display: none;
  }
}
