:root,
[data-theme="blue"] {
  --bg: #0e1014;
  --panel: #161a21;
  --panel-2: #1d222b;
  --line: #2a303b;
  --hover-bg: #232935;
  --hover-line: #3a4250;
  --text: #e7eaf0;
  --muted: #8b93a3;
  --accent: #5b8cff;
  --accent-2: #3f6fe6;
  --on-accent: #ffffff;
  --accent-soft: rgba(91, 140, 255, .14);
  --good: #3ecf8e;
  --warn: #f5b945;
  --bad: #f06363;
  --bad-soft: rgba(240, 99, 99, .15);
  --shadow: 0 20px 60px rgba(0, 0, 0, .5);
  --radius: 12px;
  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --panel: #141414;
  --panel-2: #1c1c1c;
  --line: #2b2b2b;
  --hover-bg: #242424;
  --hover-line: #3d3d3d;
  --text: #ededed;
  --muted: #8e8e8e;
  --accent: #e6e6e6;
  --accent-2: #ffffff;
  --on-accent: #111111;
  --accent-soft: rgba(255, 255, 255, .08);
}

[data-theme="red"] {
  --bg: #130c0d;
  --panel: #1c1315;
  --panel-2: #25191c;
  --line: #3a2529;
  --hover-bg: #2d1e21;
  --hover-line: #4e3137;
  --text: #f1e6e7;
  --muted: #a38c8f;
  --accent: #ef4d5a;
  --accent-2: #d63a47;
  --on-accent: #ffffff;
  --accent-soft: rgba(239, 77, 90, .15);
}

[data-theme="green"] {
  --bg: #0b110e;
  --panel: #121a16;
  --panel-2: #19231e;
  --line: #26352d;
  --hover-bg: #1f2c25;
  --hover-line: #34483d;
  --text: #e5efe9;
  --muted: #86998e;
  --accent: #34c77b;
  --accent-2: #2aa968;
  --on-accent: #04140b;
  --accent-soft: rgba(52, 199, 123, .15);
}

[data-theme="light"] {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --line: #dde1e8;
  --hover-bg: #e8ebf0;
  --hover-line: #c5cbd5;
  --text: #15181d;
  --muted: #5f6776;
  --accent: #3f6fe6;
  --accent-2: #2f5bd0;
  --on-accent: #ffffff;
  --accent-soft: rgba(63, 111, 230, .1);
  --good: #1fa06a;
  --warn: #c98a12;
  --bad: #d64545;
  --bad-soft: rgba(214, 69, 69, .1);
  --shadow: 0 20px 60px rgba(20, 30, 50, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.brand { font-weight: 800; font-size: 20px; letter-spacing: .5px; }
.brand span { color: var(--accent); }
.brand small { font-weight: 500; font-size: 14px; color: var(--muted); margin-left: 6px; }

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

.center-card { max-width: 460px; margin: 8vh auto 0; }

h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 13px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
p.sub { color: var(--muted); margin: 0 0 18px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.badge b { color: var(--text); font-weight: 600; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

input[type=text], select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
input[type=text]:focus, select:focus { border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  transition: background .15s, border-color .15s;
}
button:hover { border-color: var(--hover-line); background: var(--hover-bg); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.danger { color: var(--bad); }
button.danger:hover { border-color: var(--bad); }
button.on { background: var(--accent-soft); border-color: var(--accent); }
button.alert { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
button.big { width: 100%; padding: 12px; font-size: 16px; }
button.small { padding: 5px 10px; font-size: 13px; }
button.icon { padding: 7px 10px; line-height: 1; }
button.listening { border-color: var(--warn); color: var(--warn); }

.meter {
  position: relative;
  height: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--good), var(--warn));
  transition: width 50ms linear;
}
.meter.tall { height: 14px; }
.meter > .mark {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--text);
  opacity: .8;
}
.meter.closed > i { background: var(--muted); }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.muted { color: var(--muted); }
.error { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 10px; }

.who { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; }

.room { display: grid; grid-template-columns: 1fr 340px; gap: 16px; }
.room.no-stage { grid-template-columns: minmax(0, 560px); justify-content: center; }

.stage {
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.stage video { width: 100%; flex: 1; min-height: 0; background: #000; object-fit: contain; aspect-ratio: 16 / 9; }
.stage .bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); flex-wrap: wrap; }
.stage .bar label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.people { list-style: none; margin: 0; padding: 0; }
.person {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel-2);
  font-weight: 700; font-size: 14px;
  border: 2px solid transparent;
  transition: border-color .1s;
}
.person.speaking .avatar { border-color: var(--good); box-shadow: 0 0 0 3px rgba(62, 207, 142, .18); }
.person .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .name small { color: var(--muted); margin-left: 6px; }
.person .tags { display: flex; gap: 6px; align-items: center; }
.person .vol { grid-column: 2 / 4; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.person .vol input { flex: 1; }
.tag { font-size: 12px; color: var(--muted); }
.tag.muted-mic { color: var(--bad); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.controls .meter { flex: 1; min-width: 80px; }

.share-opts { display: flex; gap: 8px; align-items: center; }
.share-opts select { width: auto; padding: 8px 10px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: inherit; }

.regions { display: grid; gap: 10px; }
.region {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  cursor: pointer; text-align: left; width: 100%;
}
.region.selected { border-color: var(--accent); background: var(--accent-soft); }
.region .ms { font-variant-numeric: tabular-nums; color: var(--muted); }

.themes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; font-size: 12px; }
.theme-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .4); }

.theme-select { width: auto; padding: 6px 10px; font-size: 13px; }

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal section + section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.gate-row { display: flex; align-items: center; gap: 10px; }
.gate-row input[type=range] { flex: 1; }
.gate-val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }

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

@media (max-width: 440px) {
  .themes { grid-template-columns: repeat(3, 1fr); }
}
