:root {
  --bg: #f5f1e8;
  --ink: #1f2a20;
  --muted: #6d7265;
  --card: rgba(255, 252, 245, 0.82);
  --line: rgba(31, 42, 32, 0.12);
  --accent: #0f766e;
  --accent-soft: #c7efe9;
  --warn: #c2410c;
  --upright: #2e8b57;
  --slight: #d97706;
  --slouched: #dc2626;
  --severe: #7c2d12;
  --state-change: #b45309;
  --calibration: #111827;
  --aac4: #d946ef;
  --aab2: #0891b2;
  --baseline: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.15), transparent 32%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.14), transparent 28%),
    linear-gradient(180deg, #f8f5ee 0%, var(--bg) 100%);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  margin-bottom: 24px;
}

.hero-copy {
  max-width: 72ch;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-size: 12px;
}

h1, h2 {
  margin: 0;
  font-family: "IBM Plex Serif", Georgia, serif;
}

h3 {
  margin: 0;
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 18px;
}

h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1;
}

.subtitle {
  max-width: 60ch;
  color: var(--muted);
}

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

.card,
.panel {
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(14px);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(31, 42, 32, 0.08);
}

.panel + .panel {
  margin-top: 18px;
}

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

canvas {
  width: 100%;
  display: block;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 42, 32, 0.08);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.live-tilt-block canvas {
  border: none;
  background: transparent;
  margin: 0 auto;
}

.summary-block {
  min-width: 0;
}

.summary-block p {
  color: var(--muted);
}

.full-width-panel {
  width: 100%;
}

.challenge-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

.gauge-value {
  margin: 4px 0 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
  margin-right: 6px;
}

.upright { background: var(--upright); }
.slight { background: var(--slight); }
.slouched { background: var(--slouched); }
.severe { background: var(--severe); }
.state-change { background: var(--state-change); }
.calibration { background: var(--calibration); }
.aac4 { background: var(--aac4); }
.aab2 { background: var(--aab2); }
.baseline { background: var(--baseline); }

.event-log-wrap {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.event-log-header {
  margin-bottom: 10px;
}

.event-log {
  display: grid;
  gap: 8px;
}

.event-row {
  display: grid;
  grid-template-columns: 92px 84px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(31, 42, 32, 0.08);
  color: var(--muted);
  font-size: 14px;
}

.event-time {
  font-variant-numeric: tabular-nums;
}

.event-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.event-tag.aac4 {
  background: var(--aac4);
}

.event-tag.aab2 {
  background: var(--aab2);
}

.event-tag.hold {
  background: var(--calibration);
}

.event-tag.baseline {
  background: var(--baseline);
}

.challenge-copy,
.challenge-stats p,
.card p {
  color: var(--muted);
}

.challenge-actions {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}

button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

button.secondary {
  background: rgba(31, 42, 32, 0.08);
  color: var(--ink);
}

.pie-wrap {
  margin-top: 16px;
}

@media (max-width: 960px) {
  .summary-grid,
  .challenge-layout {
    grid-template-columns: 1fr;
  }
}
