:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1b1c1e;
  --muted: #62656b;
  --line: #e2e0da;
  --accent: #2455d6;
  --accent-ink: #ffffff;
  --ok: #17803d;
  --ok-bg: #dcf3e3;
  --warn: #9a5b00;
  --warn-bg: #fdefd3;
  --bad: #b3261e;
  --bad-bg: #fbe0dd;
  --radius: 18px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518;
    --surface: #1e2024;
    --text: #eceef1;
    --muted: #9aa0a8;
    --line: #2e3137;
    --accent: #6f93ff;
    --accent-ink: #0c1024;
    --ok: #5bd488;
    --ok-bg: #173323;
    --warn: #f2b34c;
    --warn-bg: #3a2b10;
    --bad: #ff8a80;
    --bad-bg: #3d1916;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}
main { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { font-size: 1.5rem; margin: 8px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.banner {
  position: sticky; top: 0; z-index: 5;
  padding: 12px 16px; font-weight: 700; text-align: center;
  background: var(--warn-bg); color: var(--warn);
}
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}

button, select {
  font: inherit; color: inherit;
}
.btn {
  display: block; width: 100%;
  padding: 18px 16px; border-radius: var(--radius);
  border: 2px solid var(--line); background: var(--surface);
  font-size: 1.15rem; font-weight: 700; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn.danger { color: var(--bad); }
.btn small { display: block; font-weight: 500; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.btn.primary small { color: inherit; opacity: .85; }
.btn.giant { padding: 34px 16px; font-size: 1.6rem; }

.stack { display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr; } }

.meter { height: 18px; border-radius: 9px; background: var(--line); overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--ok); transition: width .1s linear; }
.meter.hot > div { background: var(--bad); }

.stat { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat b { font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .85rem; font-weight: 600; background: var(--line); color: var(--muted); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 14px 20px; border-radius: 14px;
  font-weight: 700; max-width: calc(100% - 32px); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.toast.show { opacity: 1; }

/* Listener "playing" indicator */
.eq { display: inline-flex; gap: 3px; align-items: flex-end; height: 18px; vertical-align: -3px; }
.eq i { width: 4px; background: currentColor; border-radius: 2px; height: 30%; }
.eq.on i { animation: eq 0.9s ease-in-out infinite; }
.eq.on i:nth-child(2) { animation-delay: -.3s; }
.eq.on i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%,100% { height: 25%; } 50% { height: 100%; } }
@media (prefers-reduced-motion: reduce) { .eq.on i { animation: none; height: 70%; } }

.qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.qr img { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 12px; }
.qr code { word-break: break-all; font-size: .95rem; }

.qr-svg svg { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 12px; display: block; }
h2 .pill { vertical-align: 2px; margin-left: 6px; text-transform: none; letter-spacing: 0; }
