/* 方案三 · 温和纸感版 (design canvas "护理行为监测演示"). System fonts only: no web
   fonts or CDNs, since some are blocked or slow in mainland China. */
:root {
  --paper: #FBF8F3;
  --card: #FFFFFF;
  --sand: #F1EBE1;
  --line: #E7E1D6;
  --chip-line: #EFE8DC;
  --ink: #2F2A24;
  --ink-2: #4A443B;
  --muted: #6B6358;
  --faint: #7A7266;
  --accent: #24685A;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
button { font-family: inherit; }
[hidden] { display: none !important; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

.page { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { max-width: 1120px; width: 100%; margin: 0 auto; padding: 40px 32px 24px; display: flex; flex-direction: column; gap: 28px; }

/* header */
.top { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; justify-content: space-between; }
.brand { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 13px; color: var(--muted); letter-spacing: 3px; }
h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; }
.live:hover { color: var(--ink); }
.live[aria-pressed="true"] { color: var(--accent); border-color: #BCDDD4; }
.live .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.live[aria-pressed="true"] .pulse { background: #2F7D6D; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .live .pulse { animation: none !important; } }
.range { display: flex; background: var(--sand); border-radius: 999px; padding: 4px; gap: 4px; }
.range button { border: 0; cursor: pointer; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 500; background: transparent; color: var(--muted); }
.range button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }

/* devices */
.devices { display: flex; flex-wrap: wrap; gap: 4px 28px; border-bottom: 1px solid var(--line); }
.device { background: transparent; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; cursor: pointer; padding: 10px 2px 12px; min-height: 44px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font: inherit; color: var(--muted); text-align: left; }
.device:hover { color: var(--ink); }
.device[aria-pressed="true"] { color: var(--ink); border-bottom-color: #2F7D6D; }
.device .name { font-size: 16px; font-weight: 700; }
.device .sub { font-size: 12px; color: var(--muted); }
.status { margin: -12px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }
.status:empty { display: none; }

/* empty state */
.empty { padding: 72px 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.empty h2 { margin: 0; font-size: 24px; font-weight: 700; }
.empty p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.8; }

.content { display: flex; flex-direction: column; gap: 28px; }

/* hero */
.hero { display: flex; flex-direction: column; gap: 8px; }
.headline { margin: 0; font-size: 26px; line-height: 1.6; font-weight: 500; }
.headline strong { color: var(--accent); font-weight: 700; }
.meta { margin: 0; font-size: 13px; color: var(--muted); }

/* KPI strip */
.kpis { display: flex; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.kpi { flex: 1 1 260px; padding: 24px 28px; display: flex; flex-direction: column; gap: 12px; }
.kpi + .kpi { border-left: 1px solid var(--sand); }
.kpi .title { font-size: 14px; color: var(--muted); }
.kpi .figure { display: flex; align-items: baseline; gap: 10px; }
.kpi .ratio { font-size: 48px; font-weight: 700; line-height: 1; color: var(--ink); }
.kpi .what { font-size: 13px; color: var(--muted); }
.kpi .stack { display: flex; gap: 2px; height: 10px; }
.kpi .stack span { height: 10px; border-radius: 999px; }
.kpi .rows { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.kpi .rows span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* timeline card */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px; }
.titles { display: flex; flex-direction: column; gap: 4px; }
.titles h2 { margin: 0; font-size: 22px; font-weight: 700; }
.titles .sub { font-size: 13px; color: var(--muted); }
.hover { min-height: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--ink-2); background: var(--paper); border-radius: 999px; padding: 4px 14px; }
.hover .dot { width: 10px; height: 10px; }
.hover b { font-weight: 700; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.bar-label.second { margin-top: 8px; }
.bar { position: relative; background: var(--sand); overflow: hidden; touch-action: manipulation; }
.bar.tall { height: 52px; border-radius: 14px; }
.bar.thin { height: 16px; border-radius: 999px; }
.seg { position: absolute; top: 0; bottom: 0; cursor: default; }
.seg:hover, .seg.on { filter: brightness(1.08) saturate(1.1); }
.ticks { position: relative; height: 24px; }
.ticks span { position: absolute; top: 6px; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }

.legend { display: flex; flex-direction: column; gap: 14px; padding-top: 18px; border-top: 1px solid var(--sand); }
.legend .group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.legend .group > b { width: 120px; font-family: var(--serif); font-size: 14px; font-weight: 700; }
.legend .chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--chip-line); border-radius: 999px; padding: 4px 12px 4px 8px; }
.legend .chip .dot { width: 10px; height: 10px; }

footer { margin-top: auto; padding: 24px 32px 40px; text-align: center; font-size: 12px; color: var(--faint); line-height: 1.8; }

@media (max-width: 640px) {
  .wrap { padding: 28px 16px 16px; gap: 24px; }
  h1 { font-size: 28px; }
  .headline { font-size: 21px; }
  .kpi + .kpi { border-left: 0; border-top: 1px solid var(--sand); }
  .kpi { padding: 20px; }
  .kpi .ratio { font-size: 40px; }
  .card { padding: 20px 16px; }
  .legend .group > b { width: 100%; }
  footer { padding: 20px 16px 32px; }
}
