:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  --bg: #101211;
  --panel: #171a18;
  --stage: #0d100e;
  --line: #303630;
  --text: #f2f4ef;
  --muted: #a5b0a6;
  --accent: #b7f68b;
  --alert: #ffaaa0;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  max-width: 1440px;
  margin: auto;
  padding: 0 clamp(18px, 4vw, 56px);
}
.brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.18rem;
  font-weight: 750;
  letter-spacing: -.04em;
  text-decoration: none;
}
.brand-live { color: var(--accent); margin-left: 3px; }
.signal {
  display: inline-flex;
  gap: 3px;
  align-items: flex-end;
  margin-right: 11px;
  color: var(--accent);
}
.signal i { width: 4px; background: currentColor; border-radius: 1px; }
.signal i:nth-child(1) { height: 6px; }
.signal i:nth-child(2) { height: 11px; }
.signal i:nth-child(3) { height: 16px; }
.topbar-label { color: var(--muted); font-size: .86rem; }

.shell { max-width: 1440px; margin: auto; padding: clamp(32px, 5vw, 72px) clamp(18px, 4vw, 56px) 48px; }
.page-heading { margin: 0 0 30px; }
h1 { margin: 0; font-size: clamp(2.25rem, 5vw, 4.25rem); line-height: 1; letter-spacing: -.065em; }
.page-heading p { margin: 15px 0 0; color: var(--muted); line-height: 1.5; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 370px); align-items: start; gap: 20px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.panel-header {
  min-height: 57px;
  padding: 10px 18px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
h2 { margin: 0; font-size: .92rem; font-weight: 650; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}
.pill::before { content: ""; background: currentColor; width: 6px; height: 6px; border-radius: 50%; }
.pill[data-state="live"] { color: var(--accent); background: #21331d; border-color: #385333; }
.pill:is([data-state="busy"], [data-state="retry"], [data-state="stopping"]) { color: #f3d58d; }
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 230px;
  display: grid;
  place-items: center;
  background-color: var(--stage);
  background-image: linear-gradient(#94b08c0c 1px, transparent 1px), linear-gradient(90deg, #94b08c0c 1px, transparent 1px);
  background-size: 28px 28px;
}
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-message { display: grid; justify-items: center; gap: 9px; padding: 16px; text-align: center; }
.stage-message strong { font-size: 1rem; font-weight: 650; }
.stage-message > span:not(.monitor-icon) { color: var(--muted); font-size: .85rem; }
.monitor-icon { position: relative; width: 42px; height: 29px; margin-bottom: 12px; color: var(--accent); border: 2px solid currentColor; border-radius: 5px; }
.monitor-icon::before, .monitor-icon::after { content: ""; position: absolute; background: currentColor; left: 50%; transform: translateX(-50%); }
.monitor-icon::before { width: 2px; height: 7px; bottom: -8px; }
.monitor-icon::after { width: 21px; height: 2px; bottom: -9px; border-radius: 2px; }
.telemetry { display: grid; grid-template-columns: 1.25fr 1fr 1fr; border-top: 1px solid var(--line); margin: 0; }
.telemetry div { min-width: 0; padding: 14px 18px; }
.telemetry div + div { border-left: 1px solid var(--line); }
.telemetry dt, .hint { color: var(--muted); font-size: .78rem; }
.telemetry dd { width: max-content; max-width: 100%; margin: 4px 0 0; font-size: .88rem; font-variant-numeric: tabular-nums; }

.setup form, .share { padding: 18px; }
fieldset { display: grid; gap: 17px; min-width: 0; margin: 0 0 17px; padding: 0; border: none; }
fieldset:disabled { opacity: .63; }
.field { display: grid; gap: 7px; font-size: .85rem; font-weight: 650; }
.field input, .field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--stage);
  color: var(--text);
  font-size: .88rem;
  font-weight: 400;
}
.field input::placeholder { color: #8e988f; }
.toggles { display: grid; gap: 14px; padding: 15px 0; border-block: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 12px; justify-content: space-between; cursor: pointer; }
.toggle strong { display: block; font-weight: 600; font-size: .85rem; }
.toggle small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.4; margin-top: 4px; }
.toggle input {
  appearance: none;
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 34px;
  margin: 0;
  border: 1px solid #69736b;
  border-radius: 20px;
  background: #373e39;
  cursor: pointer;
}
.toggle input::after { content: ""; position: absolute; inset: 3px auto 3px 3px; width: 12px; border-radius: 50%; background: #d4ddd4; }
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { left: 17px; background: #192914; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.button:disabled { opacity: .5; cursor: default; }
.setup .button { width: 100%; }
.primary { color: #14200e; background: var(--accent); }
.primary:hover:enabled { background: #cbffa9; }
.secondary { color: var(--text); background: #242923; border-color: #384238; }
.secondary:hover:enabled { background: #2c342b; }
.stop { color: var(--alert); background: #311f1c; border-color: #62403a; }
.stop:hover:enabled { background: #412925; }
.record-icon { display: grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; }
.record-icon::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.notice, .hint { line-height: 1.5; }
.notice { margin: 11px 0 0; font-size: .8rem; color: var(--muted); }
.notice.error { color: var(--alert); }
.share { border-top: 1px solid var(--line); }
.share .button { margin-top: 9px; }
.share .hint { margin: 8px 0 0; }

.watch-shell { max-width: 1130px; }
.watch-heading h1 { font-size: clamp(2rem, 4.8vw, 3.15rem); }
.watch-stage .button { margin-top: 12px; }
.player-actions { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; gap: 10px; min-height: 58px; border-top: 1px solid var(--line); }
.player-buttons { display: flex; justify-content: end; flex-wrap: wrap; gap: 8px; }
.player-buttons .button { min-height: 36px; }

@media (max-width: 860px) {
  .studio-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .topbar-inner { min-height: 56px; }
  .page-heading { margin-bottom: 22px; }
  .panel-header { padding-inline: 12px; }
  .telemetry div { padding-inline: 9px; }
  .telemetry dd { font-size: .78rem; }
  .stage { min-height: 190px; }
}
