/* ============================================================
   SPEED TAP 2026 — Modern Neon Glassmorphism
   ============================================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

:root {
  --bg-deep: #08080f;
  --bg-2: #0d0d1a;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --neon-cyan: #00e5ff;
  --neon-purple: #a855f7;
  --neon-pink: #ec4899;
  --neon-lime: #a3ff12;
  --neon-orange: #ff7a00;

  --text: #ffffff;
  --text-dim: #8a8aa0;
  --text-soft: #c7c7d9;

  --grad-main: linear-gradient(135deg, #00e5ff 0%, #a855f7 50%, #ec4899 100%);
  --grad-btn: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --grad-neon: linear-gradient(135deg, #00e5ff, #a855f7);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-weight: 600;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* ============================================================
   Aurora Background
   ============================================================ */
.aurora {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.7;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #a855f7, transparent 70%);
  top: -150px;
  right: -100px;
  animation: drift1 18s ease-in-out infinite;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #00e5ff, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: drift2 22s ease-in-out infinite;
}

.blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #ec4899, transparent 70%);
  top: 40%;
  left: 30%;
  animation: drift3 20s ease-in-out infinite;
}

@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-80px, 60px) scale(1.15); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(80px, -60px) scale(1.2); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-60px, -80px) scale(0.9); }
}

/* شبكة نيون */
.grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 75%);
}

/* ============================================================
   Confetti Canvas
   ============================================================ */
#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

/* ============================================================
   Container
   ============================================================ */
.game-container {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 460px;
  height: 100vh;
  height: 100dvh;
  max-height: 900px;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ============================================================
   Screens
   ============================================================ */
.screen {
  position: absolute;
  inset: 0;
  padding: 24px 22px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  animation: screenIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.screen.active { display: flex; }

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* ============================================================
   Brand Badge
   ============================================================ */
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-lime);
  box-shadow: 0 0 10px var(--neon-lime);
  animation: liveBlink 1.5s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============================================================
   Logo
   ============================================================ */
.logo-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}

.logo-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.5), transparent 70%);
  filter: blur(30px);
  animation: logoGlow 3s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.logo {
  position: relative;
  font-size: 84px;
  line-height: 1;
  filter: drop-shadow(0 0 25px rgba(0, 229, 255, 0.8));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(-5deg); }
}

/* ============================================================
   Title
   ============================================================ */
.title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -1px;
  text-align: center;
  line-height: 1;
}

.title-gradient {
  background: var(--grad-main);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleShine 4s linear infinite;
}

@keyframes titleShine {
  to { background-position: 200% center; }
}

.subtitle {
  font-size: 15px;
  color: var(--text-dim);
  text-align: center;
  font-weight: 500;
  line-height: 1.6;
}

.highlight {
  color: var(--neon-cyan);
  font-weight: 800;
  text-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

/* ============================================================
   Stats Glass Card
   ============================================================ */
.stats-glass {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  position: relative;
  overflow: hidden;
}

.stats-glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

.stat-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.3));
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 900;
  color: var(--neon-cyan);
  font-variant-numeric: tabular-nums;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border-strong);
}

/* ============================================================
   Rank Preview
   ============================================================ */
.rank-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 800;
}

.rank-emoji { font-size: 18px; }
.rank-name { color: var(--text-soft); }

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
  position: relative;
  width: 100%;
  padding: 18px 24px;
  font-size: 17px;
  font-weight: 800;
  font-family: inherit;
  color: white;
  background: var(--grad-btn);
  border: none;
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 10px 30px rgba(168, 85, 247, 0.4),
    0 0 0 1px rgba(255,255,255,0.1) inset,
    0 -3px 0 rgba(0,0,0,0.2) inset;
  transition: transform 0.15s ease, box-shadow 0.25s;
  letter-spacing: 0.5px;
}

.btn-primary:active {
  transform: scale(0.97) translateY(1px);
  box-shadow: 0 4px 15px rgba(168, 85, 247, 0.6);
}

.btn-text { position: relative; z-index: 2; }

.btn-shine {
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shine 3s ease-in-out infinite;
}

@keyframes shine {
  0%, 60% { left: -100%; }
  100% { left: 200%; }
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  cursor: pointer;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.15s, background 0.2s;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255,255,255,0.12);
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.2s;
}

.link-btn:hover { color: var(--text); }

/* Hint pills */
.hint-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.hint-pill {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 100px;
}

/* ============================================================
   Countdown Screen
   ============================================================ */
.countdown-wrap {
  position: relative;
  width: 280px;
  height: 280px;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 6;
}

.ring-progress {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 660;
  stroke-dashoffset: 0;
}

.countdown-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 110px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.6));
}

.countdown-text.pop {
  animation: countPop 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes countPop {
  0% { transform: scale(0.3); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.countdown-hint {
  font-size: 15px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 1px;
}

.pulse-dots {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pulse-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-purple);
  box-shadow: 0 0 12px var(--neon-purple);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.pulse-dots span:nth-child(2) { animation-delay: 0.2s; background: var(--neon-cyan); box-shadow: 0 0 12px var(--neon-cyan); }
.pulse-dots span:nth-child(3) { animation-delay: 0.4s; background: var(--neon-pink); box-shadow: 0 0 12px var(--neon-pink); }

@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.5); opacity: 1; }
}

/* ============================================================
   Play Screen
   ============================================================ */
#playScreen {
  justify-content: space-between;
  padding-top: 20px;
  padding-bottom: 20px;
}

.hud-glass {
  display: flex;
  gap: 12px;
  width: 100%;
}

.hud-box {
  flex: 1;
  padding: 12px 16px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  overflow: hidden;
}

.hud-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
}

.hud-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.hud-value {
  font-size: 26px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--neon-cyan);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.5);
  transition: color 0.3s;
}

.hud-score-value {
  color: var(--neon-purple);
  text-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
}

.hud-value.danger {
  color: var(--neon-pink);
  text-shadow: 0 0 20px rgba(236, 72, 153, 0.7);
  animation: dangerBlink 0.5s infinite;
}

@keyframes dangerBlink {
  50% { opacity: 0.5; }
}

/* Progress */
.progress-wrap { width: 100%; }

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--grad-main);
  background-size: 200% auto;
  border-radius: 100px;
  transition: width 0.08s linear;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.7);
  animation: titleShine 3s linear infinite;
}

/* Combo meter */
.combo-meter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 100px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.3s, transform 0.3s;
}

.combo-meter.active {
  opacity: 1;
  transform: scale(1);
}

.combo-meter.hot {
  border-color: var(--neon-orange);
  box-shadow: 0 0 25px rgba(255, 122, 0, 0.5);
}

.combo-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}

.combo-value {
  font-size: 18px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  min-width: 32px;
  text-align: center;
}

.combo-bar {
  width: 60px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  overflow: hidden;
}

.combo-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-orange), var(--neon-pink));
  border-radius: 100px;
  transition: width 0.1s linear;
}

/* ============================================================
   Tap Area & Button
   ============================================================ */
.tap-area {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.tap-ring-outer,
.tap-ring-mid {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--border);
  pointer-events: none;
}

.tap-ring-outer {
  width: min(80vw, 340px);
  height: min(80vw, 340px);
  border-color: rgba(168, 85, 247, 0.15);
  animation: ringPulse 3s ease-in-out infinite;
}

.tap-ring-mid {
  width: min(70vw, 290px);
  height: min(70vw, 290px);
  border-color: rgba(0, 229, 255, 0.15);
  animation: ringPulse 3s ease-in-out infinite 0.5s;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.05); opacity: 1; }
}

.tap-btn {
  position: relative;
  width: min(64vw, 260px);
  height: min(64vw, 260px);
  border-radius: 50%;
  border: none;
  background: var(--grad-btn);
  color: white;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 0 60px rgba(168, 85, 247, 0.55),
    0 0 120px rgba(236, 72, 153, 0.25),
    inset 0 -8px 20px rgba(0, 0, 0, 0.3),
    inset 0 2px 10px rgba(255, 255, 255, 0.2);
  transition: transform 0.08s ease;
  touch-action: manipulation;
  z-index: 2;
}

.tap-btn:active {
  transform: scale(0.94);
}

.tap-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.3), transparent 60%);
  pointer-events: none;
  z-index: 1;
}

.tap-btn::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.tap-btn.tapped::after {
  animation: tapRing 0.5s ease-out;
}

@keyframes tapRing {
  0% { opacity: 1; inset: -4px; }
  100% { opacity: 0; inset: -40px; }
}

.tap-emoji {
  font-size: 56px;
  filter: drop-shadow(0 0 12px rgba(255,255,255,0.6));
  animation: bounce 2s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

.tap-label {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 3px;
  position: relative;
  z-index: 2;
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Tap button colors cycle */
.tap-btn.color-0 { background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%); box-shadow: 0 0 60px rgba(168,85,247,0.55), 0 0 120px rgba(236,72,153,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }
.tap-btn.color-1 { background: linear-gradient(135deg, #00e5ff 0%, #22c55e 100%); box-shadow: 0 0 60px rgba(0,229,255,0.55), 0 0 120px rgba(34,197,94,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }
.tap-btn.color-2 { background: linear-gradient(135deg, #ff7a00 0%, #ff2d55 100%); box-shadow: 0 0 60px rgba(255,122,0,0.55), 0 0 120px rgba(255,45,85,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }
.tap-btn.color-3 { background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%); box-shadow: 0 0 60px rgba(236,72,153,0.55), 0 0 120px rgba(244,63,94,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }
.tap-btn.color-4 { background: linear-gradient(135deg, #a3ff12 0%, #00e5ff 100%); box-shadow: 0 0 60px rgba(163,255,18,0.55), 0 0 120px rgba(0,229,255,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }
.tap-btn.color-5 { background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%); box-shadow: 0 0 60px rgba(139,92,246,0.55), 0 0 120px rgba(217,70,239,0.25), inset 0 -8px 20px rgba(0,0,0,0.3); }

/* Particles */
.particle {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 100;
  animation: particleFly 0.8s ease-out forwards;
}

@keyframes particleFly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* Score Popup */
.score-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 52px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--neon-lime);
  pointer-events: none;
  opacity: 0;
  z-index: 50;
  text-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
  white-space: nowrap;
}

.score-popup.show {
  animation: scoreFloat 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scoreFloat {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  30% { opacity: 1; transform: translate(-50%, -70%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -160%) scale(1); }
}

.play-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 100px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-lime);
  box-shadow: 0 0 10px var(--neon-lime);
  animation: liveBlink 1.5s infinite;
}

/* Screen shake */
.shake {
  animation: shake 0.3s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ============================================================
   Result Screen
   ============================================================ */
#resultScreen {
  justify-content: center;
  gap: 14px;
  padding-top: 30px;
  padding-bottom: 30px;
  overflow-y: auto;
}

.result-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.result-tag {
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  background: var(--glass-strong);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
}

.result-title {
  font-size: 24px;
  font-weight: 900;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-rank {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 100px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.rank-emoji-big { font-size: 24px; }
.rank-name-big {
  font-size: 15px;
  font-weight: 900;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.result-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-score {
  font-size: 96px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1;
  background: var(--grad-main);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.5));
  animation: titleShine 4s linear infinite;
  font-variant-numeric: tabular-nums;
}

.result-score-label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.stat-card-icon { font-size: 16px; }

.stat-card-value {
  font-size: 20px;
  font-weight: 900;
  font-family: 'Space Grotesk', sans-serif;
  background: var(--grad-main);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}

.stat-card-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
}

/* Compare Bar */
.compare-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.compare-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 700;
}

.compare-track {
  position: relative;
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  overflow: hidden;
}

.compare-fill {
  height: 100%;
  width: 0%;
  background: var(--grad-main);
  border-radius: 100px;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.compare-avg-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  right: 30%;
  width: 2px;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan);
  z-index: 2;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 20px;
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-height: 720px) {
  .title { font-size: 32px; }
  .logo { font-size: 64px; }
  .logo-wrap { width: 90px; height: 90px; }
  .result-score { font-size: 72px; }
  .countdown-wrap { width: 220px; height: 220px; }
  .countdown-text { font-size: 80px; }
  .tap-emoji { font-size: 44px; }
  .tap-btn { width: min(58vw, 220px); height: min(58vw, 220px); }
  .tap-ring-outer { width: min(72vw, 300px); height: min(72vw, 300px); }
  .tap-ring-mid { width: min(64vw, 250px); height: min(64vw, 250px); }
}

@media (min-width: 500px) {
  .game-container {
    border-radius: 32px;
    border: 1px solid var(--border);
    box-shadow: 0 40px 100px rgba(0,0,0,0.6);
  }
}