:root {
  --bg: #0e1014;
  --surface: #171a20;
  --surface-2: #1e222a;
  --line: #2a2f39;
  --text: #ece8e1;
  --muted: #9aa1ad;
  --accent: #f2a93b;
  --accent-2: #e07a2e;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.glow {
  position: fixed;
  inset: -30vh -20vw auto;
  height: 70vh;
  background:
    radial-gradient(closest-side at 30% 50%, rgba(242, 169, 59, 0.16), transparent),
    radial-gradient(closest-side at 75% 40%, rgba(224, 122, 46, 0.10), transparent);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px 40px;
}

/* ---------- header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

.brand img { border-radius: 11px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(23, 26, 32, 0.8);
  font-size: 0.875rem;
  color: var(--muted);
}

.dot, .service-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

[data-state="ok"] .dot, .service-dot[data-ok="true"] { background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.18); }
[data-state="partial"] .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(210, 153, 34, 0.2); }
[data-state="down"] .dot, .service-dot[data-ok="false"] { background: var(--bad); box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.2); }
[data-state="loading"] .dot { animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- announcement ---------- */

.announcement {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid rgba(242, 169, 59, 0.35);
  border-radius: 14px;
  background: rgba(242, 169, 59, 0.08);
}

.announcement-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.announcement p { margin: 2px 0 0; white-space: pre-line; }

/* ---------- hero ---------- */

.hero { margin: 44px 0 24px; }

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero h1 span {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede { margin: 14px 0 0; color: var(--muted); font-size: 1.05rem; }

/* ---------- actions ---------- */

.actions {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  .action { flex-direction: column; align-items: center; text-align: center; }
  .action-text { align-items: center; }
  .action .service-dot { position: absolute; top: 18px; right: 18px; }
}

.action {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.action:hover { transform: translateY(-2px); border-color: #3a404c; background: var(--surface-2); }
.action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.action-watch {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #16130d;
}
.action-watch:hover { background: linear-gradient(135deg, #f6b649, #e8843a); border-color: transparent; }
.action-watch .action-text small { color: rgba(22, 19, 13, 0.75); }

.action-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  flex: none;
}
.action-icon svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.action-watch .action-icon { background: rgba(22, 19, 13, 0.14); }

.action-text { display: flex; flex-direction: column; flex: 1; }
.action-text strong { font-size: 1.05rem; }
.action-text small { color: var(--muted); font-size: 0.875rem; }

.action .service-dot { margin-left: auto; }
.action-watch .service-dot[data-ok="true"] { background: #1d6b2a; box-shadow: 0 0 0 3px rgba(22, 19, 13, 0.15); }

/* ---------- Wrapped picker ---------- */

.picker {
  width: min(520px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.picker[open] { display: flex; flex-direction: column; animation: pop 0.18s ease-out; }
.picker::backdrop { background: rgba(5, 6, 8, 0.7); backdrop-filter: blur(4px); }

@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

.picker-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.picker-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -0.02em; }
.picker-head p { margin: 2px 0 0; font-size: 0.9rem; }

.picker-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.picker-close:hover { color: var(--text); border-color: #3a404c; }
.picker-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.picker-everyone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #16130d;
  text-decoration: none;
  flex: none;
}
.picker-everyone strong { display: block; font-size: 1.05rem; }
.picker-everyone small { display: block; color: rgba(22, 19, 13, 0.75); font-size: 0.85rem; }
.picker-everyone:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.picker-everyone .picker-avatar { background: rgba(22, 19, 13, 0.14); color: #16130d; }
.picker-everyone .picker-avatar svg { width: 22px; height: 22px; stroke: currentColor; }

.picker-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.picker-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  min-width: 0;
}
.picker-list a:hover { border-color: var(--accent); }
.picker-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.picker-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list .muted { grid-column: 1 / -1; padding: 8px 2px; }

.picker-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(242, 169, 59, 0.14);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  flex: none;
}
.picker-everyone .picker-avatar { width: 40px; height: 40px; }

.get-app {
  margin: 12px 2px 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- home panel ---------- */

.home-panel {
  margin-top: 28px;
  padding: 18px;
  border: 1px dashed #3a404c;
  border-radius: var(--radius);
  background: rgba(23, 26, 32, 0.6);
}

.home-head h2 { margin: 0; font-size: 1.1rem; }
.home-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }

.home-block { margin-top: 18px; }
.home-block h3 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sessions li {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 0.925rem;
}
.sessions .who { font-weight: 600; }
.sessions .meta { color: var(--muted); font-size: 0.825rem; }
.sessions .bar { height: 3px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.sessions .bar span { display: block; height: 100%; background: var(--accent); }
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(63, 185, 80, 0.15);
  color: #7ee08c;
}
.tag-transcode { background: rgba(210, 153, 34, 0.18); color: #f0c35a; }

.announce-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.announce-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.announce-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.announce-row #announce-msg { flex: 1; }

.btn {
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #16130d;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.home-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.home-links a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.875rem;
}
.home-links a:hover { border-color: var(--accent); }

/* ---------- help ---------- */

.help { margin-top: 40px; }
.help h2 { font-size: 1.25rem; margin: 0 0 12px; }

details {
  border-top: 1px solid var(--line);
}
details:last-of-type { border-bottom: 1px solid var(--line); }

summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px 2px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
details[open] summary::after { transform: rotate(45deg); }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.answer { padding: 0 2px 14px; color: #cfcbc4; }
.answer p { margin: 0 0 10px; }

/* ---------- footer ---------- */

.foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  font-size: 0.85rem;
  color: var(--muted);
}

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

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
