/* Same tokens as ForME's globals.css (iOS-style restyle 2026-12-01). Colour is a marker only:
   blue = the live level, dark = peak hold, orange = the strongest band, red = recording / errors. */
:root {
  --bg: #f2f3f7;
  --surface: #fff;
  --surface-2: #f0f1f5;
  --ink: #1c1e24;
  --ink-2: #454955;
  --muted: #7b8091;
  --line: rgba(28, 30, 36, .08);
  --accent: #3b82f6;
  --orange: #ff7a1a;
  --danger: #d9372b;
  --r-lg: 18px;
  --r-md: 12px;
  --shadow-1: 0 1px 2px rgba(28, 30, 36, .05), 0 6px 18px rgba(28, 30, 36, .06);
  color-scheme: light;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100dvh; background: var(--bg); }
main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
p { margin: 0; }

.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: none; font-size: 15px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: .01em; }
#badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
#badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #c5c8d2; }
#badge[data-state="live"] { color: var(--ink); }
#badge[data-state="live"]::before { background: var(--danger); }
#badge[data-state="error"]::before { background: var(--orange); }

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px; margin-bottom: 12px; }

.reading .label { font-size: 12px; color: var(--muted); }
.band-name { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.band-name strong { font-size: 40px; font-weight: 700; line-height: 1.15; letter-spacing: .01em; }
.band-name span { font-size: 20px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hint { font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 1.5em; line-height: 1.5; }
.note { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
#note { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
#frequency { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.meter { padding: 16px 12px 12px; }
#bands { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
.band { min-width: 0; text-align: center; }
.track {
  position: relative;
  height: min(42vh, 260px);
  min-height: 180px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
}
/* Faint lines at −30 and −60 dB, so heights can be compared at a glance. */
.track::before, .track::after { content: ""; position: absolute; left: 0; right: 0; height: 1px; background: rgba(28, 30, 36, .06); }
.track::before { bottom: 33.333%; }
.track::after { bottom: 66.667%; }
.fill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: var(--accent); opacity: .85; border-radius: 6px 6px 0 0; transform-origin: bottom; transform: scaleY(0); will-change: transform; }
.hold { position: absolute; left: 3px; right: 3px; bottom: 0; height: 3px; border-radius: 2px; background: var(--ink); opacity: 0; will-change: transform; }
.band.top .fill { background: var(--orange); opacity: 1; }
.band label { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.band.top label { color: var(--ink); font-weight: 700; }
.ranges { display: grid; grid-template-columns: repeat(5, 1fr); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }

.help-title { font-size: 16px; font-weight: 700; line-height: 1.5; padding-left: 16px; position: relative; }
.help-title::before { content: ""; position: absolute; left: 0; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.help ol { margin: 8px 0 0; padding-left: 1.3em; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.help-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.help-actions:empty { display: none; }
.help-actions a, .help-actions button {
  font: inherit; font-size: 14px; font-weight: 600; min-height: 44px; padding: 10px 14px;
  border-radius: var(--r-md); border: 0; background: var(--surface-2); color: var(--accent);
  text-decoration: none; display: inline-flex; align-items: center; cursor: pointer;
}

button.primary {
  display: block; width: 100%; min-height: 64px; margin-top: 4px;
  font: inherit; font-size: 19px; font-weight: 700; letter-spacing: .04em;
  border: 0; border-radius: var(--r-lg); background: var(--accent); color: #fff; cursor: pointer;
}
button.primary[data-running="true"] { background: var(--ink); }
button.primary:disabled { opacity: .5; cursor: default; }
button.primary:active:not(:disabled) { transform: scale(.985); }
:focus-visible { outline: 3px solid rgba(59, 130, 246, .45); outline-offset: 3px; }
#status { font-size: 13px; color: var(--muted); line-height: 1.6; margin-top: 10px; min-height: 1.6em; text-align: center; }

details { margin-top: 16px; font-size: 13px; color: var(--muted); line-height: 1.7; }
summary { min-height: 44px; display: list-item; padding: 11px 0; cursor: pointer; color: var(--ink-2); }
details p + p { margin-top: 8px; }
#input { color: var(--ink-2); overflow-wrap: anywhere; }

@media (max-width: 360px) {
  .card { padding: 14px; }
  #bands { gap: 4px; }
  .band label { font-size: 10px; }
  .band-name strong { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  button.primary:active:not(:disabled) { transform: none; }
}
