:root {
  color-scheme: light;
  --bg: #f5f3ff;
  --ink: #161226;
  --muted: #726a86;
  --card: rgba(255, 255, 255, 0.86);
  --line: rgba(48, 35, 85, 0.12);
  --accent: #7c3aed;
  --accent-2: #13a889;
  --danger: #c2410c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.22), transparent 34rem),
    linear-gradient(180deg, #fbfaff 0%, var(--bg) 100%);
  color: var(--ink);
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.hero {
  display: grid;
  gap: 10px;
  padding: 22px 6px 18px;
}

.hero p,
.panel-head p {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.1rem, 9vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

#syncStatus {
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(35, 24, 65, 0.08);
  backdrop-filter: blur(18px);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 140px;
  padding: 16px;
}

.metric.primary {
  background: #21143f;
  color: white;
}

.metric span,
.sleep-grid span,
.history span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric.primary span,
.metric.primary small {
  color: rgba(255, 255, 255, 0.72);
}

.metric strong {
  align-self: end;
  font-size: clamp(2rem, 8vw, 4.8rem);
  line-height: 0.9;
  letter-spacing: -0.05em;
}

.metric small,
.metric strong small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
}

.panel {
  margin-top: 12px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 4px 0 0;
  font-size: 1.35rem;
}

.panel-head > span {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent);
  font-weight: 800;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.sleep-grid,
.habits {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sleep-grid div,
.habit,
.history-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.sleep-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
}

.habit {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.habit::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
}

.habit.done::before {
  background: var(--accent-2);
}

.history {
  display: grid;
  gap: 10px;
}

.history-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
}

.history-row strong {
  display: block;
}

.history-row p {
  margin: 2px 0 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 124px;
  }

  .sleep-grid,
  .habits {
    grid-template-columns: 1fr;
  }
}
