:root {
  color-scheme: dark;
  --canvas: #101318;
  --panel: #191e26;
  --screen: #090c11;
  --input: #11151b;
  --border: #424b5b;
  --line: #2d3542;
  --text: #f4f6fa;
  --subtle: #b3bece;
  --accent: #d7f575;
  --accent-hover: #e7ffa1;
  --on-accent: #172005;
  --error: #ffb1ad;
  --warning: #f8d394;
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.25rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s10: 2.5rem;
  --s12: 3rem;
  --radius: 0.75rem;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  background: var(--canvas);
  color: var(--text);
  line-height: 1.55;
}

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

.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner, .layout { width: min(calc(100% - var(--s12) * 2), 76rem); margin-inline: auto; }
.topbar-inner { min-height: 4.5rem; display: flex; align-items: center; justify-content: space-between; gap: var(--s6); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); font-size: 1.125rem; font-weight: 700; }
.brand-icon {
  width: var(--s8);
  height: var(--s8);
  display: grid;
  place-items: center;
  border-radius: var(--s2);
  background: var(--accent);
  color: var(--on-accent);
}
.brand-icon > span { width: var(--s4); height: var(--s3); border: 2px solid; border-radius: var(--s1); }
nav { display: flex; gap: var(--s6); color: var(--subtle); }
nav a:hover { color: var(--text); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.35fr) minmax(18.5rem, 1fr);
  gap: var(--s8);
  align-items: start;
  padding-block: var(--s12);
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); }
h1, h2 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: 1.25rem; }
.state {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  border-radius: 99px;
  background: var(--input);
  color: var(--subtle);
  font-size: 0.875rem;
  white-space: nowrap;
}
.state::before { content: ""; width: var(--s2); height: var(--s2); border-radius: 50%; background: currentColor; }
.state[data-state="live"] { color: var(--accent); }
.state:is([data-state="offline"], [data-state="unavailable"]) { color: var(--warning); }

.screen {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--screen);
}
video { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen-message {
  display: grid;
  justify-items: center;
  gap: var(--s4);
  padding: var(--s4);
  color: var(--subtle);
  text-align: center;
  pointer-events: none;
}
.play-icon {
  width: var(--s12);
  height: var(--s12);
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
}
.play-icon::before {
  content: "";
  border-block: 0.375rem solid transparent;
  border-left: 0.5625rem solid var(--text);
  transform: translateX(1px);
}
.watch-form { margin-top: var(--s6); }

.broadcast { padding: var(--s6); background: var(--panel); border-radius: var(--radius); }
.broadcast .section-heading { flex-wrap: wrap; }
.broadcast-form { display: grid; gap: var(--s4); }
.field + .field { margin-top: var(--s5); }
label { display: block; margin-bottom: var(--s2); font-size: 0.875rem; font-weight: 600; }
.field-row { display: flex; gap: var(--s2); align-items: stretch; }
input {
  min-width: 0;
  width: 100%;
  min-height: 2.75rem;
  padding: var(--s2) var(--s3);
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--s2);
}
input::placeholder { color: var(--subtle); }
.help, .error { color: var(--subtle); font-size: 0.875rem; }
.field-row + .help, .notice:not(:empty), .error:not(:empty) { margin-top: var(--s2); }
.error { color: var(--error); }
.notice:empty, .error:empty { display: none; }
.button {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: var(--s2) var(--s4);
  border: 1px solid transparent;
  border-radius: var(--s2);
  font-weight: 600;
}
.button-primary { color: var(--on-accent); background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { color: var(--text); background: var(--input); border-color: var(--border); }
.button-secondary:hover { background: var(--line); }
.button-danger { color: var(--error); background: transparent; }
.button-danger:hover { background: var(--input); }
.broadcast-actions { display: flex; gap: var(--s1); flex-wrap: wrap; margin-top: var(--s5); }

@media (max-width: 58rem) {
  .topbar-inner, .layout { width: calc(100% - var(--s8) * 2); }
  .layout { grid-template-columns: minmax(0, 1fr); padding-block: var(--s8); }
}

@media (max-width: 30rem) {
  .topbar-inner, .layout { width: calc(100% - var(--s4) * 2); }
  .topbar-inner { min-height: 4rem; }
  .layout, .broadcast { padding-block: var(--s5); }
  .broadcast { padding-inline: var(--s4); }
  .watch-form .field-row { flex-direction: column; }
}
