:root {
  --bg: #0B0D10;
  --bg-lift: #161A20;
  --surface: #171B21;
  --surface-2: #222831;
  --track: #2A313B;
  --text: #F2F4F7;
  --text-2: #8B95A3;
  --sleep: #8C9EFF;
  --recovery-high: #2BD67B;
  --recovery-mid: #F5C443;
  --recovery-low: #F2545B;
  --strain: #34C6D3;
  --workout-badge: #34C6D3;
  --sleep-badge: #5A6BCC;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse 120% 320px at 50% 0, var(--bg-lift), var(--bg)) no-repeat var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top) + 12px)
    calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 24px)
    calc(env(safe-area-inset-left) + 16px);
}

.dashboard { user-select: none; -webkit-user-select: none; cursor: default; }

.app-name {
  margin: 18px 0 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  text-transform: uppercase;
}

/* Sign-in */
.signin {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.signin .app-name { margin: 0; font-size: 22px; }
.signin p { color: var(--text-2); }
.signin button {
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.signin .signin-error { min-height: 20px; color: var(--recovery-low); font-size: 14px; }

/* Header */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.top-left, .top-right { display: flex; align-items: center; gap: 6px; }
.top-right { justify-content: flex-end; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}
.glyph { width: 16px; height: 16px; fill: var(--text-2); }
.glyph-outline { fill: none; stroke: var(--text-2); stroke-width: 1.8; }
.placeholder-value { color: var(--text-2); font-size: 13px; }
.day-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.chevron { color: var(--text-2); opacity: 0.5; padding: 0 3px; }
.notice { margin-top: 10px; color: var(--text-2); font-size: 12px; text-align: center; }

/* Rings */
.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5%; padding: 0 2%; }
.ring-dial { position: relative; aspect-ratio: 1; }
.ring-dial svg { display: block; width: 100%; height: 100%; }
.ring-track, .ring-fill { stroke-width: 8; }
.ring-track { stroke: var(--track); }
.ring-fill { stroke-linecap: round; transition: stroke-dasharray 600ms ease-out; }
.ring-fill.is-empty { stroke: none; }
.ring-sleep { stroke: var(--sleep); }
.ring-strain { stroke: var(--strain); }
.band-high { stroke: var(--recovery-high); }
.band-mid { stroke: var(--recovery-mid); }
.band-low { stroke: var(--recovery-low); }
.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 6.5vw, 28px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ring-label {
  margin-top: 8px;
  text-align: center;
  color: var(--text-2);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* My Day */
.section-title { margin: 28px 0 12px; font-size: 24px; font-weight: 700; }
.card { background: var(--surface); border-radius: 14px; padding: 14px; }
.card-title { color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; }
.activities { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 12px; }
.activity { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.badge {
  min-width: 72px;
  padding: 9px 10px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.badge-sleep { background: var(--sleep-badge); }
.badge-workout { background: var(--workout-badge); color: var(--bg); }
.icon { width: 14px; height: 14px; fill: currentColor; flex: none; }
.activity-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.times {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.tick { width: 1px; height: 6px; margin-right: 12px; background: var(--track); }
.empty { color: var(--text-2); font-size: 14px; padding: 6px 0; }
.placeholder { height: 48px; border-radius: 10px; background: var(--surface-2); }

/* Loading */
.is-loading .ring-track, .is-loading .placeholder { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

@media (prefers-reduced-motion: reduce) {
  .ring-fill { transition: none; }
  .is-loading .ring-track, .is-loading .placeholder { animation: none; }
}
