:root {
  --bg: #111;
  --card: #1a1a1a;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #8c8c8c;
  --accent: #ff5a7a;
  --ok: #3ccf8e;
  --warn: #f2b84b;
  --bad: #ff5f5f;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f4;
    --card: #fff;
    --line: #e4e4e0;
    --text: #161616;
    --muted: #777;
    --accent: #e8436a;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Inter", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
h3 { font-size: 12px; color: var(--muted); font-weight: 500; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.06em; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stack { display: grid; gap: 14px; align-content: start; }
.muted { color: var(--muted); font-size: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
[hidden] { display: none !important; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

button {
  font: inherit; font-weight: 600; color: #fff; background: var(--accent);
  border: 0; border-radius: 10px; padding: 10px 18px; cursor: pointer;
}
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button:disabled { opacity: 0.5; cursor: default; }

select, input[type=text] {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}

label.row { display: grid; grid-template-columns: 70px 1fr 52px; align-items: center; gap: 10px; margin: 8px 0; font-size: 14px; }
label.row output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0; }
input[type=range], input[type=checkbox] { accent-color: var(--accent); }
input[type=range] { width: 100%; }
details { margin-top: 8px; }
summary { cursor: pointer; padding: 4px 0; }

.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 60ms linear; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.notice { font-size: 14px; color: var(--bad); padding: 8px 0 0; }

/* Сегменты-кнопки (автотюн, лад) */
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 12px 6px; font-weight: 500; font-size: 15px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); }

/* --- Хост --- */
.host { max-width: 1040px; margin: 0 auto; padding: 24px 16px; display: grid; gap: 16px; grid-template-columns: 300px 1fr; }
.host > .bar { grid-column: 1 / -1; }
.qr { background: #fff; border-radius: 10px; padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.url { word-break: break-all; font-size: 12px; margin: 8px 0; color: var(--muted); }
.mics { display: grid; gap: 12px; }
.mic-card .top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tunerow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; font-size: 14px; }
.tunerow span:first-child { width: 70px; }
.tunerow select { padding: 6px 10px; font-size: 14px; }
.lat { font-size: 13px; color: var(--muted); margin-top: 6px; }
.lat b { color: var(--text); }
.measured { font-size: 13px; color: var(--text); margin-left: 8px; }
.measure { padding: 6px 12px; font-size: 13px; }
audio { width: 100%; margin-top: 8px; }

@media (max-width: 760px) {
  .host { grid-template-columns: 1fr; }
}

/* --- Телефон --- */
.phone { max-width: 480px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px 32px; min-height: 100dvh; display: flex; flex-direction: column; gap: 22px; }
.phone .status { font-size: 14px; color: var(--muted); }
.phone input[type=text] { width: 100%; padding: 14px; }
.big { width: 100%; padding: 18px; font-size: 18px; border-radius: 14px; }
.big-meter { height: 14px; border-radius: 7px; }
.hint { margin: 8px 0 0; min-height: 20px; }
.keyrow { display: flex; gap: 8px; }
.keyrow select { flex: 1; padding: 12px; }
.keyrow .seg { flex: 1.3; }
.keyrow .seg button { padding: 10px 6px; }
button.big.on { background: var(--bad); border-color: var(--bad); color: #fff; }
.tips { font-size: 14px; color: var(--muted); margin-top: auto; }
.tips ul { padding-left: 18px; margin: 8px 0 0; }
.tips li { margin: 4px 0; }

.overlay {
  position: fixed; inset: 0; z-index: 10; border-radius: 0; width: 100%;
  background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 650; text-align: center;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
