:root {
  color-scheme: dark;
  --bg: #07142a;
  --bg-2: #0b1f3f;
  --panel: #0f2547;
  --panel-2: #14305a;
  --line: #22426f;
  --text: #e8eef8;
  --muted: #9fb2cf;
  --accent: #4b8df0;
  --accent-2: #8fc0ff;
  --ok: #41c98a;
  --warn: #f0b44b;
  --bad: #ef6b6b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -120px, #1b4a8a55, transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 480px);
  background-color: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent-2); }

.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 16px; z-index: 10; background: var(--panel); padding: 8px 12px; border-radius: 8px; }

.muted { color: var(--muted); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: #07142acc;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #ffffff10;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
nav { display: flex; gap: 4px; }
nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 15px; }
nav a:hover { color: var(--text); background: #ffffff0d; }

/* Hero */
.hero { padding: 32px 0 8px; }
.banner {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px #0008, 0 0 0 1px #ffffff14;
}

.card {
  background: linear-gradient(180deg, var(--panel), #0d2142);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.connect {
  margin-top: 20px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.connect p { margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent-2); font-weight: 700; }
.address { font-size: clamp(24px, 4vw, 32px); font-weight: 700; margin: 2px 0 4px !important; }
.address code { font-family: var(--mono); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  font: 600 15px var(--font); text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #3d7fe4; }
.btn:focus-visible, nav a:focus-visible, input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* Sections */
.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 24px; }
h3 { margin: 0 0 12px; font-size: 17px; }

.status { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status[data-state="online"]::before { background: var(--ok); box-shadow: 0 0 0 4px #41c98a26; }
.status[data-state="offline"]::before { background: var(--bad); }
.status[data-state="stale"]::before { background: var(--warn); }

/* Viewer */
.viewer { padding: 0; overflow: hidden; }
.viewer-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line); background: #0b1d3a;
}
.stats { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 14px; color: var(--muted); }
.stats strong { color: var(--text); }
.search input {
  width: min(280px, 100%); min-height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: 15px var(--font);
}
.search { flex: 1 1 200px; display: flex; justify-content: flex-end; }

.tree { padding: 10px 8px; max-height: 70vh; overflow-y: auto; font-size: 15px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-left: 20px; border-left: 1px solid #ffffff12; margin-left: 9px; }

.row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 7px; min-height: 30px;
  overflow-wrap: anywhere;
}
.row:hover { background: #ffffff08; }
.row .ico { flex: none; width: 16px; height: 16px; display: grid; place-items: center; color: var(--muted); }
.row .ico svg { width: 16px; height: 16px; }
.row .name { flex: 1 1 auto; min-width: 0; }
.row .tags { display: flex; gap: 6px; flex: none; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; background: #ffffff12; color: var(--muted); }

.channel.has-people > .row .ico { color: var(--accent-2); }
.channel > .row .name { font-weight: 500; }
.spacer > .row { justify-content: flex-start; color: var(--accent-2); font-weight: 700; letter-spacing: .04em; padding-top: 10px; }
.spacer.center > .row { justify-content: center; }
.spacer.right > .row { justify-content: flex-end; }
.spacer > .row .name { flex: 0 1 auto; }
.divider > .row { min-height: 14px; padding: 6px 8px; }
.divider > .row::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.client > .row .name { color: var(--text); }
.client > .row .ico { color: var(--ok); }
.client.away > .row { opacity: .6; }
.client.talking > .row .ico { color: var(--accent-2); filter: drop-shadow(0 0 4px var(--accent)); }
.client.muted > .row .ico { color: var(--warn); }

.tree .hidden { display: none; }
.tree mark { background: #4b8df055; color: inherit; border-radius: 3px; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.viewer-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }

/* Community */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.embed iframe { display: block; width: 100%; height: 420px; border: 0; border-radius: 10px; background: var(--bg); }
.twitch { min-height: 200px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.twitch p { margin: 0; color: var(--muted); }
.twitch iframe { aspect-ratio: 16 / 9; height: auto; }

.footer { padding: 40px 0 32px; font-size: 14px; text-align: center; }

@media (max-width: 600px) {
  .hero { padding-top: 16px; }
  .connect .actions, .connect .btn { width: 100%; }
  .search { justify-content: stretch; }
  .search input { width: 100%; }
  nav a { padding: 8px; }
  .brand span { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
.server > .row { font-weight: 700; }
