:root {
  color-scheme: dark;
  --bg: #0b1117;
  --panel: #111a23;
  --panel-light: #15212b;
  --line: #25323d;
  --text: #eef4f7;
  --muted: #81909c;
  --blue: #54b8f1;
  --green: #50d09d;
  --green-dark: #173e36;
  --orange: #f1ae62;
  --shadow: 0 28px 70px rgb(0 0 0 / 25%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgb(51 102 128 / 13%), transparent 32rem),
    radial-gradient(circle at 90% 45%, rgb(35 85 73 / 8%), transparent 28rem),
    var(--bg);
}

button, a { font: inherit; }

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d7e2e8;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .14em;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #315269;
  border-radius: 9px;
  color: var(--blue);
  background: #132431;
}

.brand-mark svg { width: 24px; }
.brand-mark path, .brand-mark circle { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.live-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .13em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px rgb(241 174 98 / 10%);
}

.live-status.online { color: #9db4ae; }
.live-status.online .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgb(80 208 157 / 10%); }
.live-status.error .status-dot { background: #ef6b69; box-shadow: 0 0 0 4px rgb(239 107 105 / 10%); }
.topbar-meta { display: flex; align-items: center; gap: 22px; }

.eyebrow {
  margin: 0 0 8px;
  color: #6f8491;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .18em;
}

h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }

.population {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 9px;
  color: #8fa0aa;
  font-size: 16px;
  line-height: 1;
}

.population strong { color: var(--text); }
.population span { white-space: nowrap; }
.population svg { width: 18px; fill: none; stroke: var(--green); stroke-linecap: round; stroke-width: 1.5; }

.server-uptime { display: flex; align-items: center; gap: 7px; color: #788b97; font-size: 14px; font-weight: 750; }
.server-uptime span { white-space: nowrap; }
.server-uptime strong { color: #cbd7dd; font-weight: 750; }
.server-uptime svg { width: 17px; fill: none; stroke: var(--blue); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

.viewer-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgb(16 25 33 / 92%);
  box-shadow: 0 20px 55px rgb(0 0 0 / 17%);
}

.toolbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.channel-toolbar {
  display: flex;
  min-height: 79px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 28px;
  border-bottom: 1px solid var(--line);
}

.toolbar-actions { gap: 12px; }

.channel-toggle {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 7px;
  color: #748792;
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  user-select: none;
}
.channel-toggle:hover { color: #b3c0c7; background: #17232c; }
.channel-toggle input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.toggle-track { display: flex; width: 25px; height: 14px; align-items: center; padding: 2px; border-radius: 999px; background: #34434d; transition: background 140ms ease; }
.toggle-track span { width: 10px; height: 10px; border-radius: 50%; background: #8a99a2; transition: transform 140ms ease, background 140ms ease; }
.channel-toggle input:checked + .toggle-track { background: #236b72; }
.channel-toggle input:checked + .toggle-track span { background: var(--green); transform: translateX(11px); }
.channel-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--blue); outline-offset: 2px; }

.refresh-button {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  color: #768894;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.refresh-button:hover { color: #b8c6ce; background: #17232c; }
.refresh-button:disabled { cursor: wait; opacity: .55; }
.refresh-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.refresh-button.loading svg { animation: spin 800ms linear infinite; }

.channel-list { min-height: 240px; padding: 12px 0 17px; }
.channel { --depth: 0; }
.channel-row, .client-row { display: flex; align-items: center; min-height: 42px; padding-right: 25px; padding-left: calc(27px + var(--depth) * 25px); transition: background-color 120ms ease; }
.channel-row { cursor: pointer; user-select: none; }
.channel-row:hover { background: rgb(255 255 255 / 1.8%); }
.client-row:hover { background: rgb(84 184 241 / 4%); }
.channel.empty > .channel-row { cursor: default; }
.channel-row:focus-visible { outline: 1px solid var(--blue); outline-offset: -2px; }

.chevron {
  width: 14px;
  margin-right: 8px;
  fill: none;
  stroke: #50616c;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
  transition: transform 130ms ease;
}

.channel.open > .channel-row .chevron { transform: rotate(90deg); }
.channel.empty > .channel-row .chevron { visibility: hidden; }
.channel-icon { width: 18px; margin-right: 11px; fill: none; stroke: #6b7e89; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.4; }
.channel-name { overflow: hidden; color: #c7d3d9; font-size: 17px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.channel-count { margin-left: auto; color: #536570; font-size: 14px; font-variant-numeric: tabular-nums; }
.lock-icon { width: 13px; margin-left: 8px; fill: none; stroke: #8e774f; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.2; }
.channel:not(.locked) .lock-icon { display: none; }
.channel-contents { display: none; }
.channel.open > .channel-contents { display: block; }

.client-row { min-height: 44px; padding-left: calc(61px + var(--depth) * 25px); }
.client-row + .client-row { margin-top: 10px; }
.client-presence { display: inline-grid; width: 30px; height: 28px; flex: 0 0 30px; place-items: center; margin-right: 8px; color: #cf817b; }
.client-presence::before { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgb(80 208 157 / 13%), 0 0 11px rgb(80 208 157 / 45%); content: ""; }
.client-row.away .client-presence::before { background: var(--orange); box-shadow: 0 0 0 4px rgb(241 174 98 / 13%), 0 0 11px rgb(241 174 98 / 40%); }
.client-row.muted .client-presence::before, .client-row.deafened .client-presence::before { display: none; }
.client-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.client-identity { display: flex; min-width: 0; align-items: center; gap: 6px; }
.client-country { flex: 0 0 auto; font-size: 16px; line-height: 1; }
.client-country:empty { display: none; }
.client-name { overflow: hidden; color: #9eacb4; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.client-time { overflow: hidden; color: #748793; font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: .025em; text-overflow: ellipsis; white-space: nowrap; }
.audio-icon { display: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.client-row.muted .client-presence .muted-icon, .client-row.deafened .client-presence .deafened-icon { display: block; }
.client-state { margin-left: auto; padding-left: 14px; color: #687984; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.client-state:empty { display: none; }
.channel-spacer {
  display: flex;
  min-height: 31px;
  align-items: center;
  padding-right: 25px;
  padding-left: calc(27px + var(--depth) * 25px);
  overflow: hidden;
  color: #61737e;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.channel-spacer.spacer-center { justify-content: center; text-align: center; }
.channel-spacer.spacer-right { justify-content: flex-end; text-align: right; }
.channel-spacer.spacer-repeat { min-height: 22px; color: #344650; font-size: 12px; letter-spacing: .18em; white-space: nowrap; }
.channel-spacer.spacer-empty { min-height: 18px; }
.spacer-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer-repeat .spacer-text { flex: 1; text-overflow: clip; }

.empty-state, .error-state { display: grid; min-height: 220px; place-items: center; padding: 35px; color: #748590; text-align: center; }
.error-state strong { display: block; margin-bottom: 7px; color: #d4dee3; }
.error-state p { max-width: 520px; margin: 0; line-height: 1.6; }

.loading-row { display: flex; min-height: 220px; align-items: center; justify-content: center; gap: 6px; }
.loading-row span { width: 6px; height: 6px; border-radius: 50%; background: #617783; animation: pulse 1s ease-in-out infinite; }
.loading-row span:nth-child(2) { animation-delay: 120ms; }
.loading-row span:nth-child(3) { animation-delay: 240ms; }

footer {
  display: flex;
  justify-content: center;
  gap: 9px;
  padding: 23px 0 0;
  color: #3f505a;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
}

.footer-separator { color: #2c3941; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 700px) {
  .shell { width: min(100% - 22px, 920px); padding-top: 14px; }
  .topbar { margin-bottom: 20px; }
  .channel-toolbar { padding-inline: 20px; }
  .channel-row, .client-row { padding-right: 17px; }
}

@media (max-width: 430px) {
  .brand { font-size: 14px; }
  .topbar-meta { align-items: flex-end; flex-direction: column; gap: 5px; }
  .topbar .server-uptime, .topbar .live-status { font-size: 12px; }
  .channel-toolbar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px 18px; padding-inline: 16px; }
  .channel-toolbar > div:first-child { grid-column: 1; grid-row: 1; }
  .toolbar-actions { display: contents; }
  .refresh-button { grid-column: 2; grid-row: 1; justify-self: end; }
  .population { grid-column: 1; grid-row: 2; justify-self: start; }
  .uptime-label { display: none; }
  .channel-toggle { grid-column: 2; grid-row: 2; justify-self: end; }
  footer { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
