:root {
  --background: hsl(220 20% 7%);
  --foreground: hsl(210 20% 95%);
  --card: hsl(220 18% 10% / 0.84);
  --primary: hsl(185 80% 55%);
  --primary-foreground: hsl(220 20% 7%);
  --secondary-foreground: hsl(210 20% 85%);
  --muted: hsl(220 15% 14%);
  --muted-foreground: hsl(215 15% 58%);
  --accent: hsl(265 70% 60%);
  --accent-foreground: hsl(210 20% 95%);
  --border: hsl(220 15% 18%);
  --danger-bg: hsl(0 70% 55% / 0.1);
  --danger-border: hsl(0 70% 55% / 0.35);
  --danger-text: hsl(0 80% 82%);
  --radius: 18px;
  --glow-primary: 0 0 24px hsl(185 80% 55% / 0.26);
  --glow-accent: 0 0 24px hsl(265 70% 60% / 0.24);
  --surface-gradient: linear-gradient(180deg, hsl(220 18% 12%), hsl(220 20% 7%));
  --primary-gradient: linear-gradient(135deg, hsl(185 80% 55%), hsl(200 80% 50%));
  --accent-gradient: linear-gradient(135deg, hsl(265 70% 60%), hsl(285 70% 55%));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--foreground);
  background: var(--background);
}
img { max-width: 100%; display: block; }
button { font: inherit; }
a { color: var(--primary); }

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--surface-gradient);
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top center, hsl(185 80% 55% / 0.08), transparent 32%),
    radial-gradient(circle at bottom center, hsl(265 70% 60% / 0.08), transparent 28%);
  z-index: -1;
  pointer-events: none;
}

h1, h2, h3, .font-display { font-family: 'Space Grotesk', sans-serif; }
.text-center { text-align: center; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.75rem; }
.text-glow { text-shadow: 0 0 20px hsl(185 80% 55% / 0.5), 0 0 40px hsl(185 80% 55% / 0.2); }

.center-shell,
.app-shell {
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
}

.center-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-shell {
  display: flex;
  flex-direction: column;
}

.container-sm {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.stack-8 > * + * { margin-top: 8px; }
.stack-12 > * + * { margin-top: 12px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-20 > * + * { margin-top: 20px; }
.stack-24 > * + * { margin-top: 24px; }
.stack-32 > * + * { margin-top: 32px; }

.logo-box {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: var(--glow-primary);
  animation: pulseGlow 2.6s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 18px hsl(185 80% 55% / 0.18); }
  50% { transform: scale(1.02); box-shadow: 0 0 28px hsl(185 80% 55% / 0.35); }
}

.title-xl {
  font-size: clamp(2.1rem, 5vw, 2.7rem);
  line-height: 1.05;
  font-weight: 700;
  margin: 0;
}

.title-lg {
  font-size: clamp(1.45rem, 4vw, 1.8rem);
  line-height: 1.15;
  font-weight: 700;
  margin: 0;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.stat-value {
  font-size: 2rem;
  line-height: 1;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
}

.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-foreground);
  margin-top: 6px;
}

.divider-vertical {
  width: 1px;
  height: 48px;
  background: var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  text-decoration: none;
}

.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }

.btn-primary {
  background: var(--primary-gradient);
  color: var(--primary-foreground);
  box-shadow: var(--glow-primary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.08rem;
  font-weight: 700;
}

.btn-primary:hover { opacity: 0.92; }

.btn-outline {
  background: hsl(220 18% 10% / 0.72);
  color: var(--secondary-foreground);
  border-color: var(--border);
}

.btn-outline:hover {
  color: var(--foreground);
  border-color: hsl(185 80% 55% / 0.45);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(10px);
}

.badge-icon {
  width: 112px;
  height: 112px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  background: var(--accent-gradient);
  box-shadow: var(--glow-accent);
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--muted);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.screen-block {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
}

.screen-top,
.screen-bottom { flex: 0 0 auto; }

.screen-middle {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex: 1;
  min-height: 0;
  padding: 18px 0;
}

.player-area {
  position: relative;
  width: 220px;
  height: 220px;
  user-select: none;
}

.player-svg {
  width: 220px;
  height: 220px;
  display: block;
  transform: rotate(-90deg);
  cursor: pointer;
}

.player-toggle {
  position: absolute;
  inset: 0;
  width: 84px;
  height: 84px;
  margin: auto;
  border: 0;
  border-radius: 999px;
  background: var(--primary-gradient);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-primary);
  cursor: pointer;
}

.player-time {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.error-box {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 0.94rem;
}

.link-cta {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.link-cta:hover { text-decoration: underline; }

@media (max-width: 420px) {
  .center-shell,
  .app-shell {
    padding-left: 18px;
    padding-right: 18px;
  }

  .logo-box {
    width: 144px;
    height: 144px;
  }

  .player-area,
  .player-svg {
    width: 200px;
    height: 200px;
  }

  .player-toggle {
    width: 76px;
    height: 76px;
  }
}
