:root {
  color-scheme: dark;
  --background: #0b0e14;
  --panel: #131823;
  --input: #0d111a;
  --line: #293241;
  --text: #f2f5fb;
  --muted: #a3aec1;
  --accent: #66e5dc;
  --live: #ff788d;
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
h1, h2, p, ol { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: #0e121b;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto;
  padding: .75rem clamp(1rem, 3vw, 3rem);
  max-width: 101rem;
  min-height: 4.15rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  width: fit-content;
  font-size: 1.2rem;
  font-weight: 730;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.brand strong { color: var(--accent); font-weight: 700; }
.brand-mark, .signal-mark {
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--accent);
}
.brand-mark {
  gap: 3px;
  width: 32px;
  height: 32px;
  border: 1px solid #335557;
  border-radius: 9px;
  background: #173033;
}
.brand-mark i, .signal-mark i { width: 3px; border-radius: 2px; background: currentColor; }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; }

.watch-grid {
  max-width: 101rem;
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 23vw);
  margin: auto;
  padding: clamp(1rem, 3vw, 3rem);
  gap: clamp(1rem, 2vw, 1.5rem);
}
.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: .85rem;
  overflow: hidden;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 3.6rem;
  padding: .65rem 1rem;
}
.panel-heading h1, .panel-heading h2 { font-size: 1rem; font-weight: 680; letter-spacing: -.015em; }

.status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: 2rem;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: .44rem;
  height: .44rem;
  border-radius: 50%;
  background: currentColor;
}
.status[data-state="live"] { color: var(--live); background: #361d2b; border-color: #6e3548; }
.status[data-state="connected"] { color: var(--accent); border-color: #315150; }
.status[data-state="disconnected"] { color: #f2bf85; }

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #030509;
  isolation: isolate;
}
.video-stage:fullscreen, .video-stage:-webkit-full-screen { width: 100%; height: 100%; }
.video-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: .75rem;
  padding: 1rem;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 60%, #132633, transparent 58%),
    #060a11;
  color: var(--muted);
  font-size: clamp(.89rem, 1.8vw, 1rem);
}
.signal-mark {
  gap: 5px;
  width: 3.7rem;
  height: 3.7rem;
  color: #83babb;
  border: 1px solid #304852;
  background: #12212a;
  border-radius: 50%;
}
.signal-mark i { width: 3px; height: 9px; }
.signal-mark i:nth-child(even) { height: 17px; }
.signal-mark i:nth-child(3) { height: 25px; }

.player-controls {
  padding: .7rem 1rem .3rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
button {
  color: var(--text);
  background: #242e3c;
  border: 1px solid #3a4659;
  min-height: 2.55rem;
  border-radius: .45rem;
  padding: .4rem .7rem;
  font-size: .875rem;
  font-weight: 650;
}
button:not(:disabled):hover { background: #344054; }
button.quiet { color: var(--muted); background: transparent; border-color: transparent; }
button.primary { color: #0a191a; background: var(--accent); border-color: var(--accent); }
button.primary:not(:disabled):hover { background: #a2f7ec; }
.volume {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  padding: 0 .3rem;
  font-size: .82rem;
  min-height: 2.55rem;
}
.volume input { min-width: 3.5rem; width: clamp(3.5rem, 9vw, 6.5rem); accent-color: var(--accent); }
.video-help {
  color: var(--muted);
  font-size: .81rem;
  padding: .2rem 1rem .85rem;
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: clamp(31rem, 74dvh, 53rem);
}
.chat .panel-heading, .chat-form { border-bottom: 1px solid var(--line); }
.chat-log { min-height: 0; overflow-y: auto; padding: 1rem; scrollbar-color: #465164 transparent; }
.chat-empty { color: var(--muted); font-size: .875rem; }
.messages { list-style: none; padding: 0; }
.messages li { padding: .65rem 0; overflow-wrap: anywhere; }
.messages li + li { border-top: 1px solid #232c3a; }
.message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; }
.message-meta strong { color: var(--accent); font-size: .85rem; }
.message-meta time { color: var(--muted); font-size: .72rem; }
.message-text { margin-top: .15rem; font-size: .9rem; white-space: pre-wrap; }
.chat-form { padding: .75rem 1rem 1rem; border-top: 1px solid var(--line); }
.chat-form label, .invite-card label { color: var(--muted); font-size: .84rem; font-weight: 650; }
input:not([type="range"]) {
  color: var(--text);
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: .45rem .6rem;
  border: 1px solid #3a4659;
  border-radius: .45rem;
  background: var(--input);
}
input::placeholder { color: #8391a8; }
#display-name { margin-top: .3rem; }
.composer { display: flex; align-items: stretch; gap: .45rem; margin-top: .55rem; }
.form-error { color: #ff9ba9; margin-top: .55rem; font-size: .85rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.invite-page { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.invite-card {
  width: min(100%, 26rem);
  padding: clamp(1.3rem, 5vw, 2rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
}
.invite-card h1 { margin: 1.5rem 0 .3rem; font-size: 1.65rem; letter-spacing: -.04em; }
.invite-card > p { color: var(--muted); }
.invite-card form { margin-top: 1.4rem; }
.invite-card input { margin-top: .35rem; }
.invite-card button { width: 100%; margin-top: .75rem; }

@media (max-width: 760px) {
  .watch-grid { grid-template-columns: minmax(0, 1fr); }
  .chat { height: clamp(24rem, 64dvh, 36rem); }
  .player-controls { padding-inline: .75rem; }
  .video-help { padding-inline: .75rem; }
}
