:root {
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --paper: #edf1f9;
  --ink: #243145;
  --muted: #526078;
  --edge: rgba(255,255,255,.86);
  --glass: rgba(254,254,255,.39);
  --shine: rgba(255,255,255,.96);
  --shadow: rgba(48,67,112,.12);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  transition: background-color .55s;
  --signal: #635a92;
  --wave: rgba(100,90,150,.42);
  -webkit-tap-highlight-color: transparent;
}
body[data-tone="low"] { --signal: #1758af; --paper: #dbeafe; --wave: rgba(25,101,217,.49); }
body[data-tone="high"] { --signal: #a92b45; --paper: #ffe2e5; --wave: rgba(213,38,69,.47); }
#surface, #ripples { position: fixed; inset: 0; }
#ripples { pointer-events: none; overflow: hidden; }
#surface {
  z-index: 1; width: 100%; height: 100%; border: 0; border-radius: 0; padding: 0;
  background: transparent; appearance: none; touch-action: manipulation; cursor: pointer;
}
#surface:focus-visible { outline: 2px solid var(--signal); outline-offset: -5px; }
#ripples { z-index: 2; }
.ring {
  position: absolute; width: 100px; height: 100px; margin: -50px 0 0 -50px;
  border: 1.4px solid var(--wave); border-radius: 50%;
  box-shadow: 0 0 0 1px var(--edge), inset 0 3px 6px var(--shine);
  animation: ring 1.15s cubic-bezier(.16,.55,.36,1) forwards;
}
.ring::after { content: ""; position: absolute; inset: 7px; border-radius: inherit; border: 1px solid var(--edge); }
@keyframes ring { from { transform: scale(.09); opacity: .94; } to { transform: scale(3.65); opacity: 0; } }
.layout {
  position: relative; z-index: 3; pointer-events: none; user-select: none; -webkit-user-select: none;
  max-width: 720px; min-height: 100vh; min-height: 100svh; margin: auto;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: max(22px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
}
.topbar, h1, .state, .footnote { display: flex; align-items: center; }
.topbar, .footnote { justify-content: space-between; }
h1 { margin: 0; gap: 10px; font-size: 20px; letter-spacing: -.05em; font-weight: 620; }
.wave-icon { display: inline-flex; align-items: center; gap: 2px; height: 25px; color: var(--signal); }
.wave-icon i { height: 6px; width: 2px; border-radius: 4px; background: currentColor; }
.wave-icon i:nth-child(2) { height: 13px; }
.wave-icon i:nth-child(3) { height: 22px; }
.wave-icon i:nth-child(4) { height: 11px; }
.glass {
  background: var(--glass); border: 1px solid var(--edge);
  -webkit-backdrop-filter: blur(22px) saturate(1.25); backdrop-filter: blur(22px) saturate(1.25);
  box-shadow: inset 0 1px 1px var(--shine), inset 0 -1px 1px var(--shadow), 0 6px 20px -9px var(--shadow);
}
.reset {
  pointer-events: auto; appearance: none; cursor: pointer; touch-action: manipulation;
  min-height: 44px; padding: 0 19px; border-radius: 24px; font: inherit; font-size: 14px; color: var(--ink);
}
.reset:active { transform: scale(.96); }
.reset:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.reading { align-self: center; text-align: center; padding: 28px 0; }
.state { justify-content: center; gap: 8px; font-size: 14px; color: var(--muted); }
.dot { width: 7px; height: 7px; background: var(--signal); border-radius: 50%; }
.digits {
  font-size: clamp(82px, 24vw, 146px); font-weight: 300; line-height: 1.13; letter-spacing: -.075em;
  font-variant-numeric: tabular-nums; color: var(--ink); margin: 12px 0 0; text-indent: -.045em;
}
body:not([data-tone="neutral"]) .digits, body:not([data-tone="neutral"]) .state { color: var(--signal); }
.unit, .hint, .footnote, .stat-label, .stat-value small { color: var(--muted); }
.unit { font-size: 14px; font-weight: 500; letter-spacing: .07em; }
.unit span { margin: 0 3px; }
.hint { font-size: 16px; line-height: 1.5; margin: 38px 0 0; }
.footer { width: 100%; max-width: 490px; margin: 0 auto; }
.stats {
  border-radius: 26px; padding: 18px 0; display: grid; grid-template-columns: 1fr 1fr 1.1fr;
  text-align: center;
}
.stats > div + div { border-left: 1px solid var(--shadow); }
.stat-label { display: block; font-size: 12px; }
.stat-value { display: block; margin-top: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-value b { font-size: 22px; font-weight: 500; letter-spacing: -.04em; }
.stat-value small { margin-left: 4px; font-size: 11px; }
.footnote { gap: 10px; margin: 14px 8px 0; font-size: 12px; line-height: 1.5; }
@media (min-width: 700px) and (min-height: 650px) { .layout { padding-block: 40px; } }
@media (max-width: 350px) { .layout { padding-inline: 16px; } }
@media (max-height: 500px) { .reading { padding-block: 6px; } .digits { font-size: 72px; margin-top: 0; } .hint { margin: 8px 0; } .stats { padding-block: 8px; } }
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121925; --ink: #f4f5fd; --muted: #c1cbdf;
    --edge: rgba(211,228,255,.22); --glass: rgba(43,54,76,.50); --shine: rgba(223,234,255,.29); --shadow: rgba(5,9,22,.44);
  }
  body { --signal: #c4b6ed; --wave: rgba(205,193,247,.62); }
  body[data-tone="low"] { --signal: #8bbdff; --paper: #15263e; --wave: rgba(118,175,255,.65); }
  body[data-tone="high"] { --signal: #ff9aa7; --paper: #331d29; --wave: rgba(255,139,153,.65); }
}
@media (prefers-reduced-motion: reduce) {
  .ring { animation: still-ring .18s linear forwards; }
  @keyframes still-ring { from { transform: scale(.44); opacity: .8; } to { transform: scale(.44); opacity: 0; } }
  body { transition: none; }
}
