:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #0b0b0e;
  color: #f4f4f8;
  font-synthesis: none;
  --muted: #a1a2b0;
  --panel: #141419;
  --line: #272832;
  --blue: #335bf3;
  --blue-hover: #2947c6;
  --blue-light: #a0afff;
  --focus: #9daeff;
  --radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 0; margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button, input, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
h1, h2, p { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

.skip-link {
  position: fixed;
  z-index: 4;
  top: 16px;
  left: 16px;
  padding: 12px 18px;
  border-radius: 10px;
  background: #eef0ff;
  color: #131423;
  transform: translateY(-170%);
}
.skip-link:focus { transform: translateY(0); }

.page-width {
  width: min(100% - 96px, 1456px);
  margin-inline: auto;
}
.site-header { border-bottom: 1px solid #22222a; }
.navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 18px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #f9f9fc;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.047em;
}

.brand-icon {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #7189ff;
  border-radius: 10px;
  background: linear-gradient(145deg, #6c83f9, #3459ef 59%, #2039a9);
  box-shadow: inset 0 1px 0 #ffffff40, 0 3px 12px #2a4de847;
}
.brand-icon::after {
  content: "";
  width: 15px;
  height: 14px;
  background: #fff;
  clip-path: polygon(5% 0, 100% 0, 41% 78%, 100% 78%, 100% 100%, 0 100%, 60% 22%, 5% 22%);
}

.share-button, .chat-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding-inline: 14px;
  border: 1px solid #30313b;
  border-radius: 11px;
  background: #17171e;
  color: #ebebf2;
  font-weight: 600;
  font-size: .84rem;
  white-space: nowrap;
  transition: background .18s, border-color .18s;
}
.share-button:hover, .chat-link:hover { background: #20212c; border-color: #444655; }

.icon { position: relative; display: inline-block; flex: none; width: 16px; height: 16px; }
.icon-share::before {
  position: absolute;
  content: "";
  inset: 6px 2px 0;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 2px;
}
.icon-share::after {
  position: absolute;
  content: "";
  top: 1px;
  left: 4px;
  width: 8px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 40%, 88% 53%, 60% 27%, 60% 100%, 40% 100%, 40% 27%, 12% 53%, 0 40%);
}

main { padding-block: 42px 44px; }
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
h1 {
  color: #f8f8fc;
  font-size: clamp(2.25rem, 3.9vw, 3.5rem);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -.062em;
}
.chat-link { display: none; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(286px, 27vw, 368px);
  gap: 21px;
  align-items: stretch;
}
.broadcast, .chat {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.broadcast { overflow: hidden; }

.stage {
  position: relative;
  display: grid;
  z-index: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #020204;
}
.stage video, .stage-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.stage video {
  object-fit: contain;
  color: #fff;
}
.stage[data-player="playing"] .stage-overlay { visibility: hidden; opacity: 0; pointer-events: none; }

.stage-overlay {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 14px;
  padding: clamp(23px, 4.2vw, 62px);
  background:
    linear-gradient(0deg, #090a13bd, #090a1320 64%),
    linear-gradient(90deg, #080911cf, #08091155 61%, #08091100),
    #111421 url("/standby.webp") center / cover no-repeat;
  transition: opacity .24s, visibility .24s;
}
.stage h2 {
  max-width: 15ch;
  color: #fbfbff;
  font-size: clamp(1.85rem, 4vw, 4rem);
  line-height: 1.04;
  font-weight: 680;
  letter-spacing: -.062em;
  text-wrap: balance;
}
.stage p {
  margin-top: 13px;
  max-width: 33ch;
  color: #d0d2e2;
  font-size: clamp(.83rem, 1.25vw, 1rem);
  line-height: 1.5;
  text-wrap: pretty;
}
.stage-button { margin-top: 2px; }

.broadcast-status {
  position: absolute;
  top: clamp(16px, 2vw, 26px);
  left: clamp(16px, 2vw, 26px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #ffffff28;
  border-radius: 8px;
  background: #10111bbd;
  color: #eeeef7;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .075em;
  text-transform: uppercase;
  pointer-events: none;
}
.status-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9899aa;
}
.broadcast-status[data-live="true"] { background: #a52246; border-color: #e45276; }
.broadcast-status[data-live="true"] .status-dot { background: #fff; }

.broadcast-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 19px 22px;
  border-top: 1px solid var(--line);
}
.channel { display: flex; align-items: center; gap: 12px; }
.channel-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 39px;
  height: 39px;
  border: 1px solid #3b4378;
  border-radius: 50%;
  background: linear-gradient(155deg, #343b71, #202344);
  color: #dbdeff;
  font-weight: 700;
  font-size: 1rem;
}
.channel-name { font-size: .97rem; color: #f0f0f7; font-weight: 650; letter-spacing: -.019em; }
.channel-caption { margin-top: 3px; color: var(--muted); font-size: .78rem; }
.quality {
  padding: 6px 9px;
  border: 1px solid #343544;
  border-radius: 7px;
  color: #cbccdb;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  contain: size;
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 7px;
  min-height: 64px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.chat-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .99rem;
  font-weight: 640;
  letter-spacing: -.023em;
}
.icon-chat { color: var(--blue-light); }
.icon-chat::before {
  position: absolute;
  content: "";
  inset: 1px 1px 3px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
}
.icon-chat::after {
  position: absolute;
  content: "";
  bottom: 1px;
  left: 5px;
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  background: var(--icon-surface, var(--panel));
  transform: skewY(-36deg);
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}
.chat-status .status-dot { width: 6px; height: 6px; }
.chat-status[data-connected="true"] .status-dot { background: #5bd8aa; }

.conversation { position: relative; min-height: 0; }
.chat-empty {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 18px;
  text-align: center;
  color: #b0b1c1;
  font-size: .86rem;
  pointer-events: none;
}
.empty-symbol {
  --icon-surface: #242743;
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  border: 1px solid #353a63;
  border-radius: 15px;
  background: var(--icon-surface);
}
.empty-symbol .icon { transform: scale(1.2); }

.messages {
  height: 100%;
  margin: 0;
  padding: 8px 17px;
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-color: #46495c var(--panel);
  list-style: none;
}
.messages:focus-visible { outline-offset: -3px; }
.message {
  padding-block: 9px;
  overflow-wrap: anywhere;
  line-height: 1.44;
}
.message-header { display: flex; align-items: baseline; gap: 7px; }
.message-author { color: var(--blue-light); font-size: .8rem; font-weight: 650; }
.message-time { color: var(--muted); font-size: .69rem; white-space: nowrap; }
.message-text { margin-top: 3px; color: #edecf5; font-size: .87rem; }

.jump-button {
  position: absolute;
  right: 15px;
  bottom: 12px;
  left: 15px;
  padding: 9px;
  border: 1px solid #525eaa;
  border-radius: 8px;
  background: #252e68;
  color: #f1f2ff;
  font-size: .78rem;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 15px 16px 17px;
  border-top: 1px solid var(--line);
}
.nickname-label { color: #b8b9c8; font-size: .75rem; }
.chat-form input, .share-dialog input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding-inline: 11px;
  border: 1px solid #32333e;
  border-radius: 9px;
  background: #1d1e26;
  color: #f5f5fb;
  font-size: 1rem;
}
.chat-form input::placeholder { color: #989aac; }
.chat-form input:disabled { opacity: .65; }
.compose { display: flex; align-items: stretch; gap: 7px; margin-top: 3px; }
.compose input { flex: 1; }
.send-button, .primary-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #6b84ff;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  transition: background .18s, border-color .18s;
}
.primary-button { padding-inline: 15px; font-size: .86rem; font-weight: 650; }
.send-button:hover:not(:disabled), .primary-button:hover { background: var(--blue-hover); }
.send-button:disabled { border-color: #424763; background: #2a2d43; color: #9c9fb5; }
.icon-send {
  background: currentColor;
  clip-path: polygon(50% 0, 100% 50%, 87% 64%, 59% 36%, 59% 100%, 41% 100%, 41% 36%, 13% 64%, 0 50%);
}
.chat-feedback { color: #ff9db4; font-size: .76rem; line-height: 1.35; }

.noscript { margin-top: 16px; color: var(--muted); }
.toast {
  position: fixed;
  z-index: 2;
  inset: auto 18px 22px auto;
  padding: 12px 17px;
  border: 1px solid #46485b;
  border-radius: 12px;
  background: #232432;
  color: #f1f1f9;
  box-shadow: 0 12px 26px #0005;
  font-size: .88rem;
}
.share-dialog {
  width: min(calc(100% - 32px), 380px);
  padding: 24px;
  border: 1px solid #3d3f4f;
  border-radius: 14px;
  background: #171820;
  color: #f1f1f8;
}
.share-dialog::backdrop { background: #05050ac9; }
.share-dialog form { display: grid; gap: 15px; }
.share-dialog h2 { font-size: 1.25rem; }
.share-dialog button { justify-self: end; }

@media (max-width: 1090px) {
  .page-width { width: calc(100% - 56px); }
  .layout { gap: 16px; }
}
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .chat { height: clamp(430px, 62svh, 560px); scroll-margin-top: 14px; }
  .chat-link { display: inline-flex; }
  .stage h2 { font-size: clamp(1.85rem, 5.4vw, 3.75rem); }
}
@media (max-width: 520px) {
  :root { --radius: 15px; }
  .page-width { width: calc(100% - 30px); }
  .navigation { min-height: 62px; }
  main { padding-block: 26px 30px; }
  .page-heading { margin-bottom: 15px; }
  .stage-overlay { gap: 7px; padding: 17px; }
  .stage h2 { font-size: clamp(1.42rem, 5.5vw, 1.85rem); }
  .stage p { margin-top: 7px; }
  .stage-button { min-height: 34px; padding-inline: 11px; font-size: .76rem; }
  .broadcast-status { top: 12px; left: 13px; padding: 5px 8px; }
  .broadcast-details { padding: 13px 15px; }
  .channel-avatar { width: 34px; height: 34px; }
}
@media (max-width: 350px) {
  .page-heading { flex-wrap: wrap; }
  .stage { aspect-ratio: 4 / 3; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
