@font-face {
  font-family: Inter;
  src: url(assets/inter.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --muted: #98989d;
  --line: rgb(255 255 255 / .1);
  --live: #ff4245;
  --live-text: #ff6165;
  --warn: #ff9230;
  --ease: cubic-bezier(.23, 1, .32, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/20px -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.009em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
h1 { margin: 0; font-size: 34px; line-height: 41px; font-weight: 600; letter-spacing: -.022em; text-wrap: balance; }
h2 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.021em; }
h3 { margin: 0; font-size: 20px; line-height: 25px; font-weight: 600; letter-spacing: -.017em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.muted { color: var(--muted); }
.foot { font-size: 13px; line-height: 18px; letter-spacing: -.003em; color: var(--muted); white-space: nowrap; }
.cap { font-size: 12px; line-height: 16px; letter-spacing: 0; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }

button {
  font: inherit; letter-spacing: inherit; color: inherit; border: 0; background: none; cursor: pointer;
  transition: transform 120ms var(--ease), background-color 120ms ease;
}
button:active:not(:disabled) { transform: scale(.96); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
button:disabled { opacity: .4; cursor: default; }
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 600;
}
.primary { background: var(--text); color: #000; }
.secondary { background: var(--surface-2); }
.glass {
  background: rgb(22 22 23 / .8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 1px var(--line);
}
@media (prefers-contrast: more) { .glass { background: rgb(22 22 23); -webkit-backdrop-filter: none; backdrop-filter: none; } }

#view { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: auto; }
.center { flex: 1; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px 64px; }
.center .logo { margin-bottom: 24px; }
.center p { margin-top: 8px; color: var(--muted); }
.center .primary { margin-top: 24px; }
.center .cap { margin-top: 8px; }
.logo { display: block; height: 40px; width: 70px; color: var(--text); }
.credit { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.credit img { display: block; height: 12px; width: 18.3px; }
.get-app {
  display: inline-flex; align-items: center; justify-content: center; align-self: center; min-height: 44px; padding: 0 12px; margin-top: 8px;
  font-size: 13px; line-height: 18px; color: var(--text); text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 3px;
  transition: text-decoration-color 160ms ease;
}
@media (hover: hover) and (pointer: fine) { .get-app:hover { text-decoration-color: var(--text); } }

.entry { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; max-width: 420px; width: 100%; margin: 0 auto; padding: 24px 16px calc(16px + env(safe-area-inset-bottom)); }
.entry .logo { height: 32px; width: 56px; margin-bottom: 24px; }
.entry p { margin-top: 8px; color: var(--muted); }
.entry label { display: block; margin: 24px 0 8px; font-size: 13px; line-height: 18px; color: var(--muted); }
.entry input {
  display: block; width: 100%; height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: inherit; font: inherit; font-size: 17px; letter-spacing: -.013em;
}
.entry input::placeholder { color: var(--muted); }
.entry .primary { width: 100%; min-height: 50px; margin-top: 8px; font-size: 17px; letter-spacing: -.013em; }
.entry .error { color: var(--live-text); min-height: 18px; margin-top: 8px; font-size: 13px; line-height: 18px; }
.entry .credit { position: static; margin-top: 8px; }
@media (min-width: 768px) { .entry { justify-content: center; } }

.list { flex: 1; max-width: 560px; width: 100%; margin: 0 auto; padding: calc(32px + env(safe-area-inset-top)) 16px 24px; }
.list h1 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px; text-align: left; border-bottom: 1px solid var(--line); }
.row .text { flex: 1; min-width: 0; }
.row .name { font-size: 17px; line-height: 22px; letter-spacing: -.013em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .chev { width: 20px; height: 20px; }
.list .cap { margin-top: 16px; }

.picker { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 24px; padding: 32px; }
.picker-top, .picker-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.segmented { display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--surface); }
.segmented button { min-height: 36px; padding: 0 16px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.segmented button.on { background: var(--surface-2); color: var(--text); font-weight: 600; }
.sources { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-content: start; padding: 2px; }
.source { padding: 0; text-align: left; }
.source img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.source.on img { box-shadow: 0 0 0 2px var(--text); }
.source span { display: block; margin-top: 8px; font-size: 13px; line-height: 18px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source.on span { color: var(--text); font-weight: 600; }
.picker-foot .actions { display: flex; gap: 8px; }
.notice { font-size: 13px; line-height: 18px; color: var(--muted); }

#stage { position: fixed; inset: 0; background: #000; }
#video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
#bar {
  position: absolute; left: 16px; right: 16px; bottom: 16px; min-height: 52px; padding: 4px; border-radius: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: opacity 160ms ease;
}
#bar .side { display: flex; align-items: center; gap: 8px; min-width: 0; }
#bar .side:last-child { gap: 0; }
#bar .side:last-child .foot { margin-right: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; font-weight: 600; background: rgb(255 255 255 / .12); max-width: 180px; }
#switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 14px; height: 14px; display: block; }
.icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; }
.icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#stage.idle { cursor: none; }
#stage.idle #bar { opacity: 0; pointer-events: none; }
#menu {
  position: absolute; left: 16px; bottom: 76px; width: 300px; max-height: calc(100% - 92px); overflow-y: auto; padding: 4px; border-radius: 16px;
  transform-origin: left bottom; transition: transform 160ms var(--ease), opacity 160ms var(--ease);
}
@starting-style { #menu { transform: scale(.96); opacity: 0; } }
#menu .title { padding: 8px 12px; font-size: 13px; line-height: 18px; color: var(--muted); }
#menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 12px; border-radius: 12px; text-align: left; }
#menu button.on { background: rgb(255 255 255 / .1); }
#menu .name { display: block; }
#menu .text { flex: 1; min-width: 0; }
#menu .check { width: 16px; height: 16px; }
#unmute { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); }
#unmute:active { transform: translateX(-50%) scale(.96); }

body.small #bar { left: 8px; right: 8px; bottom: 8px; border-radius: 12px; background: rgb(22 22 23 / .92); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.small #quality, body.small #count, body.small #leave { display: none; }
body.small #menu { left: 8px; right: 8px; bottom: 68px; width: auto; background: rgb(22 22 23 / .96); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.small #unmute { top: 8px; }

#toast {
  position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; translate: -50% 0; z-index: 5;
  max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 18px;
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
}
@starting-style { #toast { opacity: 0; transform: translateY(-4px); } }
#dialog { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px; background: rgb(0 0 0 / .6); }
.card { width: 100%; max-width: 400px; padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.card p { margin-top: 8px; color: var(--muted); }
.card .buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; }
.card .primary, .card .secondary { width: 100%; }

@media (max-width: 767px) {
  #stage { display: flex; flex-direction: column; overflow-y: auto; }
  #video { height: auto; aspect-ratio: 16/9; flex: none; }
  #bar { position: static; margin: 16px 16px calc(16px + env(safe-area-inset-bottom)); flex-wrap: wrap; background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  #small { display: none; }
  #menu { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: auto; background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; z-index: 6; }
  #unmute { position: static; transform: none; margin: 0 16px; min-height: 50px; font-size: 17px; flex: none; }
  #unmute:active { transform: scale(.96); }
  #bar { order: 2; }
  .picker { padding: 16px; }
}
@media (hover: hover) and (pointer: fine) {
  .secondary:hover { background: #3a3a3c; }
  .icon:hover { background: rgb(255 255 255 / .1); }
  .pill:hover { background: rgb(255 255 255 / .18); }
  #menu button:hover, .row:hover { background: rgb(255 255 255 / .06); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
  button:active:not(:disabled) { transform: none; }
}
