:root {
  --bg-0: #060814;
  --bg-1: #0b1020;
  --ink:  #e9ecff;
  --ink-dim: #9aa3c7;
  --brand: #7c5cff;
  --brand-2: #22d3ee;
  --accent: #f472b6;
  --ok: #34d399;
  --glass: rgba(255,255,255,0.06);
  --glass-strong: rgba(255,255,255,0.12);
  --stroke: rgba(255,255,255,0.10);
  --shadow: 0 30px 80px -20px rgba(124,92,255,0.35), 0 10px 40px -10px rgba(0,0,0,0.6);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(1200px 800px at 80% -10%, #1c1f4a 0%, transparent 60%),
              radial-gradient(1000px 700px at -10% 110%, #0a3a4a 0%, transparent 55%),
              linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

/* --- Aurora background --- */
.aurora { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob {
  position: absolute; width: 620px; height: 620px; border-radius: 50%;
  filter: blur(90px); opacity: 0.55; mix-blend-mode: screen;
  animation: float 22s ease-in-out infinite;
}
.b1 { background: var(--brand);   top: -180px; left: -140px; }
.b2 { background: var(--brand-2); top: 30%;    right: -220px; animation-delay: -6s; }
.b3 { background: var(--accent);  bottom: -220px; left: 20%;  animation-delay: -12s; opacity: 0.4; }
@keyframes float {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  50%     { transform: translate3d(30px,-40px,0) scale(1.08); }
}

/* --- Glass primitive --- */
.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow: var(--shadow);
}

/* --- Top bar --- */
.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 20px 8px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; font-weight: 700; }
.brand h1 span {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: conic-gradient(from 120deg, var(--brand), var(--brand-2), var(--accent), var(--brand));
  box-shadow: 0 0 24px 2px rgba(124,92,255,0.65);
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--stroke);
  font-size: 12px; color: var(--ink-dim); backdrop-filter: blur(12px);
}
.pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #f59e0b;
  box-shadow: 0 0 10px currentColor;
}
.pill.ok .dot { background: var(--ok); }
.pill.ok { color: var(--ok); }
.pill.err .dot { background: #ef4444; }
.pill.err { color: #ef4444; }

/* --- Stage --- */
.stage {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto; padding: 16px 16px 40px;
  display: flex; flex-direction: column; gap: 16px;
}

/* --- Hero --- */
.hero {
  padding: 24px;
  display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center;
  overflow: hidden; position: relative;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 20% 0%, rgba(124,92,255,0.25), transparent 60%);
  pointer-events: none;
}
.hero-copy { position: relative; }
.eyebrow {
  margin: 0 0 8px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim);
}
.hero-copy h2 {
  margin: 0 0 10px; font-size: 30px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 700;
}
.hero-copy h2 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--brand), var(--brand-2) 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { margin: 0; color: var(--ink-dim); font-size: 14px; line-height: 1.5; max-width: 42ch; }

/* Ring */
.ring { position: relative; width: 108px; height: 108px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.08); stroke-width: 10; }
.ring-fg {
  fill: none; stroke: url(#g); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1.2s cubic-bezier(.2,.8,.2,1);
  stroke: #7c5cff;
}
.ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em;
}
.ring-num small { font-size: 11px; color: var(--ink-dim); }

/* --- KPIs --- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { padding: 14px; border-radius: var(--radius-md); }
.kpi-label { font-size: 11px; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.kpi-value small { font-size: 11px; color: var(--ink-dim); font-weight: 500; margin-left: 4px; }
@media (max-width: 520px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .hero { grid-template-columns: 1fr; }
  .hero-viz { justify-self: end; }
  .hero-copy h2 { font-size: 26px; }
}

/* --- Empty state --- */
.empty { padding: 28px; text-align: center; }
.empty-icon { font-size: 42px; margin-bottom: 6px; filter: drop-shadow(0 6px 20px rgba(124,92,255,0.5)); }
.empty h3 { margin: 6px 0; font-size: 18px; }
.empty p { margin: 0; color: var(--ink-dim); font-size: 13px; line-height: 1.55; }
.empty strong { color: var(--ink); }

/* --- Workouts card --- */
.workouts-card { padding: 18px 20px; }
.wc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wc-head h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; }
.wc-sub { margin: 0; color: var(--ink-dim); font-size: 13px; }
.wc-sub span:first-child { color: var(--ink); font-weight: 600; }
.wc-badge {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, rgba(124,92,255,0.35), rgba(34,211,238,0.25));
  box-shadow: 0 4px 20px rgba(124,92,255,0.25);
}
.wc-hint { margin: 12px 0 0; font-size: 12px; color: var(--ink-dim); line-height: 1.5; }

/* --- Bottom nav --- */
.bnav {
  position: fixed; z-index: 5;
  left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 8px; border-radius: 22px;
  max-width: 720px; margin: 0 auto;
}
.bnav button {
  appearance: none; background: transparent; border: 0; color: var(--ink-dim);
  padding: 8px 6px; border-radius: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: inherit; transition: all .2s;
}
.bnav button span { font-size: 20px; }
.bnav button small { font-size: 10px; letter-spacing: 0.02em; }
.bnav button.active {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(124,92,255,0.28), rgba(34,211,238,0.14));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
