/* styles.css — dark, large-target theme for the web reporter (matches the app). */
:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface2: #1f2630;
  --border: #2a323d;
  --text: #e6edf3;
  --dim: #8b949e;
  --accent: #4aa3ff;
  --ok: #2ea043;
  --warn: #d29922;
  --bad: #f85149;
  --cold: #388bfd;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#app { max-width: 680px; margin: 0 auto; padding: 16px; }

h1 { font-size: 22px; margin: 8px 0 4px; }
h2 { font-size: 15px; color: var(--dim); font-weight: 600; margin: 18px 0 8px; }
.dim { color: var(--dim); font-size: 13px; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

label { display: block; color: var(--dim); font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
input[type=text], input[type=password], input[type=number] {
  width: 100%; min-height: 46px; padding: 0 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 16px;
}
button {
  min-height: 46px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); font-size: 15px; font-weight: 700;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #04223f; }
button.ghost { background: transparent; }
button.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
button:disabled { opacity: .5; }
button.block { width: 100%; }

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

.pill { border: 1px solid var(--dim); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill[data-s=connected] { color: var(--ok); border-color: var(--ok); }
.pill[data-s=connecting], .pill[data-s=reconnecting] { color: var(--warn); border-color: var(--warn); }
.pill[data-s=error], .pill[data-s=offline] { color: var(--bad); border-color: var(--bad); }
.pill[data-s=closed] { color: var(--dim); }

/* zone grid */
.zones { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.zone { padding: 18px 12px; text-align: center; }
.zone .znum { font-size: 22px; font-weight: 800; }
.zone .zname { color: var(--dim); font-size: 13px; }

/* SPL readout */
.spl { font-size: 46px; font-weight: 800; line-height: 1; }
.spl .u { font-size: 18px; font-weight: 700; }
.trend { font-size: 14px; font-weight: 700; }

/* analyzer resolution toggle */
.restoggle { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.resgroup { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.restab { min-height: 32px; padding: 0 12px; border: 0; border-radius: 0; font-size: 13px; color: var(--dim); background: var(--surface); }
.restab.on { background: rgba(74,163,255,.16); color: var(--accent); }

/* spectrum */
.spectrum { display: flex; align-items: flex-end; gap: 4px; height: 130px; margin-top: 8px; }
.spectrum.dense { gap: 2px; }
/* height:100% is required — the parent uses align-items:flex-end, so columns
   take content height (just the label) and the flex:1 track collapses to 0
   without it, leaving bars with no room to grow. */
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.track { position: relative; width: 74%; flex: 1; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); border-radius: 4px; }
.peak { position: absolute; left: 0; right: 0; height: 2px; background: var(--dim); opacity: .7; }
.maxline { position: absolute; left: 0; right: 0; height: 2px; background: var(--warn); }
.collabel { color: var(--dim); font-size: 9px; white-space: nowrap; }
.spectrum.dense .collabel { font-size: 8px; }
.peakrow { color: var(--warn); font-size: 13px; font-weight: 700; }

/* tags */
.taggroup { margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { flex: 1 1 45%; min-height: 48px; border: 2px solid var(--border); background: var(--surface); }
.tag.on { border-color: var(--accent); background: rgba(74,163,255,.16); color: var(--accent); }

.seg { display: flex; gap: 8px; }
.seg button { flex: 1; border: 2px solid var(--border); }
.seg button.on { border-color: var(--accent); background: rgba(74,163,255,.16); color: var(--accent); }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.actions button { flex: 1; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--ok); color: #04210d; font-weight: 800; padding: 12px 20px; border-radius: 999px; }
.hint { color: var(--warn); font-size: 12px; margin-top: 6px; }
