:root {
  color-scheme: dark;
  --page: #111214;
  --surface: #1a1c20;
  --surface-raised: #202329;
  --field: #15171b;
  --line: #30343b;
  --line-strong: #464b54;
  --text: #f0f1f3;
  --muted: #999fa9;
  --soft: #c3c7ce;
  --accent: #ff6a68;
  --accent-hover: #ff7b78;
  --focus: #8ab4ff;
  --warn: #e8b85b;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
}
.app-shell { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 20px 0 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.1rem; font-weight: 780; letter-spacing: -.02em; text-decoration: none; }
.brand-mark { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 2px solid var(--accent); border-radius: 7px; }
.brand-mark::before { position: absolute; width: 8px; height: 3px; border-radius: 99px; background: var(--accent); content: ""; }
.brand-mark i { position: absolute; top: -5px; width: 2px; height: 6px; border-radius: 4px; background: var(--accent); }
.brand-mark i:first-child { left: 6px; transform: rotate(-18deg); }
.brand-mark i:last-child { right: 6px; transform: rotate(18deg); }
.topbar > p { margin: 0; color: var(--muted); font-size: .86rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 28px; align-items: start; }
.viewer-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-kicker { margin: 0 0 6px; color: var(--muted); font-size: .73rem; font-weight: 700; letter-spacing: .08em; }
h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -.04em; line-height: 1.08; }
.stage { position: relative; aspect-ratio: 16 / 9; display: grid; overflow: hidden; border: 1px solid #292c31; border-radius: 8px; background: #060708; box-shadow: 0 18px 42px rgb(0 0 0 / 22%); }
video { display: block; width: 100%; height: 100%; background: #020304; object-fit: contain; }
.video-empty { position: absolute; z-index: 1; inset: 0; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--soft); pointer-events: none; }
.video-empty[hidden] { display: none; }
.empty-symbol { display: grid; place-items: center; width: 34px; height: 34px; padding-left: 2px; border: 1px solid #3d424a; border-radius: 50%; color: var(--accent); font-size: .8rem; }
.video-empty strong { font-size: .95rem; }
.video-empty small { color: var(--muted); font-size: .78rem; }
#video-hint { position: absolute; z-index: 2; right: 12px; bottom: 12px; left: 12px; padding: 8px 10px; border: 1px solid rgb(255 255 255 / 8%); border-radius: 5px; background: rgb(10 11 13 / 80%); color: #d5d8dd; font-size: .88rem; pointer-events: none; }
.mute-button { position: absolute; z-index: 3; top: 12px; right: 12px; min-height: 30px; border: 1px solid rgb(255 255 255 / 16%); border-radius: 5px; background: rgb(10 11 13 / 72%); color: #e5e7eb; padding: 5px 8px; font-size: .76rem; font-weight: 650; }
.mute-button:hover:not(:disabled) { background: rgb(32 35 41 / 92%); }
.mute-button:disabled { opacity: 0; pointer-events: none; }
.status-panel { margin-top: 12px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.status-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h2 { margin: 0; font-size: .84rem; color: var(--soft); font-weight: 700; }
.status-source { color: var(--muted); font-size: .78rem; }
#mode-badge { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--soft); padding: 5px 9px; font-size: .78rem; white-space: nowrap; }
#mode-badge::before { width: 6px; height: 6px; border-radius: 50%; background: #747a84; content: ""; }
#mode-badge.is-live::before { background: var(--accent); }
#mode-badge.is-connecting::before { background: var(--warn); }
#status { min-height: 1.5em; margin: 8px 0 5px; color: #e2e4e7; font-size: .92rem; line-height: 1.55; word-break: break-word; }
.fine-print { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.control-panel { position: sticky; top: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 20px; }
.panel-heading { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.panel-heading .section-kicker { color: var(--soft); }
.panel-heading > p:last-child { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
form { display: grid; gap: 15px; padding-top: 18px; }
.form-field { display: grid; gap: 7px; }
label { color: var(--soft); font-size: .84rem; font-weight: 700; }
input[type="text"], input:not([type]), select { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--field); color: var(--text); padding: 9px 11px; font: inherit; font-size: .9rem; }
input#room { width: 100%; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--field); color: var(--text); padding: 10px 11px; font: inherit; font-size: .94rem; }
input::placeholder { color: #707680; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.extreme-row { display: grid; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.toggle-label, .tier-label, .consent { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.toggle-label { justify-content: space-between; }
.toggle-label > span { display: grid; gap: 3px; margin-right: auto; }
.toggle-label strong { color: var(--text); font-size: .88rem; }
.toggle-label small { color: var(--muted); font-size: .76rem; font-weight: 500; }
.tier-label { justify-content: space-between; color: var(--soft); }
.tier-label select { width: 112px; min-height: 34px; padding: 5px 8px; font-size: .82rem; }
.consent { align-items: flex-start; color: var(--muted); font-size: .76rem; font-weight: 500; line-height: 1.5; }
.consent input, .toggle-label input { flex: 0 0 auto; accent-color: var(--accent); margin-top: .16rem; transform: scale(1.08); }
.actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; align-items: center; }
button { min-height: 40px; border: 1px solid transparent; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; padding: 9px 13px; font: inherit; font-size: .88rem; font-weight: 760; }
button:hover:not(:disabled) { background: var(--accent-hover); }
button:disabled { cursor: not-allowed; opacity: .42; }
#start { grid-column: 1 / -1; }
.secondary { border-color: var(--line-strong); background: transparent; color: var(--soft); }
.secondary:hover:not(:disabled) { border-color: #6a7079; background: var(--surface-raised); color: var(--text); }
.text-link { justify-self: end; color: var(--muted); font-size: .78rem; text-decoration: none; }
.text-link:hover { color: var(--text); text-decoration: underline; }
footer { margin-top: 26px; color: #777d86; font-size: .75rem; }
@media (max-width: 920px) {
  .workspace { grid-template-columns: 1fr; }
  .control-panel { position: static; order: -1; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 24px, 1440px); padding-top: 12px; }
  .topbar { min-height: 42px; margin-bottom: 22px; padding-bottom: 13px; }
  .topbar > p { font-size: .76rem; }
  .workspace { gap: 20px; }
  .control-panel { padding: 16px; }
  .viewer-heading { align-items: center; }
  h1 { font-size: 1.45rem; }
  .stage { border-radius: 6px; }
  #video-hint { font-size: .78rem; }
  .actions { grid-template-columns: 1fr 1fr; }
  .text-link { justify-self: start; }
}
