/* Laid out like the iOS app's grouped lists. */
:root {
  color-scheme: light dark;
  --fg: #1d1d1f;
  --bg: #f2f2f7;
  --card: #ffffff;
  --secondary: #6e6e73;
  --line: #d1d1d6;
  --accent: #007aff;
  --good: #248a3d;
  --warn: #c93400;
  --bad: #d70015;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f5f5f7;
    --bg: #000000;
    --card: #1c1c1e;
    --secondary: #98989d;
    --line: #38383a;
    --accent: #0a84ff;
    --good: #30d158;
    --warn: #ff9f0a;
    --bad: #ff453a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
}

h1 { font-size: 2rem; margin: 0.5rem 0 1rem; }
h2 {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--secondary);
  margin: 1.5rem 1rem 0.4rem;
}

.group {
  background: var(--card);
  border-radius: 10px;
  margin: 0 0 1.25rem;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

h2 + .group, h2 + section .group { margin-top: 0; }

.group > *, .item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.7rem 1rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.group > :first-child { border-top: 0; }

input, select { outline: none; }
input::placeholder { color: var(--secondary); }


details > summary { cursor: pointer; padding: 0.1rem 0; }
details > input {
  display: block;
  width: 100%;
  margin: 0.5rem 0 0;
  padding: 0.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
}

button { cursor: pointer; }
button:disabled { color: var(--secondary) !important; cursor: default; }
.link { color: var(--accent) !important; }
.center { text-align: center !important; }

.footer {
  font-size: 0.8rem;
  color: var(--secondary);
  margin: -0.9rem 1rem 1.25rem;
}

.footer.error, .error { color: var(--bad); }
.warning { color: var(--warn); }
.good { color: var(--good); }
.secondary { color: var(--secondary); font-size: 0.8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.small { font-size: 0.8rem; user-select: all; }

#members li { display: flex; justify-content: space-between; }
.badge { color: var(--secondary); }
.badge.speaking { color: var(--good); }

.quality { display: flex !important; align-items: center; gap: 0.75rem; }
.quality-text { display: flex; flex-direction: column; flex: 1; }
.chevron { color: var(--secondary); font-size: 1.4rem; }
#quality-icon.good::before { content: "✓"; color: var(--good); font-weight: 700; }
#quality-icon.warning::before { content: "⚠"; color: var(--warn); }
#quality-icon.bad::before { content: "⚠"; color: var(--bad); }

/* Right under the room's content, and still on screen when the window is too short to show it all. */
.actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.75rem;
  padding: 1rem 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}

.actions button {
  flex: 1;
  padding: 0.8rem;
  font: inherit;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--accent);
}

.actions .danger { background: var(--bad); color: #fff; }
.actions .primary { background: var(--accent); color: #fff; }

dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  border: 0;
  border-radius: 14px;
  padding: 1rem;
  background: var(--bg);
  color: var(--fg);
}

dialog::backdrop { background: rgb(0 0 0 / 40%); }
dialog h1 { font-size: 1.25rem; margin: 0.25rem 0 0.75rem; }
#link-dialog .actions { position: static; padding: 0.5rem 0 0; background: none; backdrop-filter: none; }

.volume { display: flex !important; align-items: center; gap: 0.75rem; }
.volume span:first-child { width: 6.5rem; }
.volume input { flex: 1; accent-color: var(--accent); }
/* LED-style level meter: 12 segments of 5 dB from -60 dBFS, green, then yellow from -20, red from -10. */
.meter { display: flex; gap: 3px; margin: 0.5rem 0 0 7.25rem; height: 8px; }
.meter i { flex: 1; border-radius: 2px; background: var(--line); opacity: 0.6; }
.meter i.on { opacity: 1; }
.meter i.green.on { background: #34c759; }
.meter i.yellow.on { background: #ffcc00; }
.meter i.red.on { background: #ff3b30; }
.volume output { width: 3.2rem; text-align: right; color: var(--secondary); font-variant-numeric: tabular-nums; }

.dialog-header { display: flex; justify-content: space-between; align-items: center; }
.dialog-header button { border: 0; background: none; font: inherit; font-weight: 600; }

dl.group > div { display: flex; justify-content: space-between; gap: 1rem; }
dl dt, dl dd { margin: 0; }
dl dd { color: var(--secondary); font-variant-numeric: tabular-nums; text-align: right; }

.toggle { display: flex !important; justify-content: space-between; align-items: center; }
