:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #0f141a;
  --text: #edf2f7;
  --muted: #99a6b5;
  --line: #263140;
  --accent: #ffffff;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
body { min-height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px;
  background: linear-gradient(180deg, #121821 0%, #0d1117 100%);
  border-right: 1px solid var(--line);
}

.logo {
  max-width: 150px;
  height: auto;
  margin-bottom: 20px;
}

h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
  margin: 0 0 24px;
  line-height: 1.5;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 14px;
  margin: 0 0 8px;
  color: var(--muted);
}

input[type="text"], input[type="range"] {
  width: 100%;
}

input[type="text"] {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  outline: none;
}

input[type="range"]:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #111;
  margin-bottom: 12px;
}

button.secondary {
  background: #232b36;
  color: var(--text);
  border: 1px solid var(--line);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.layoutBtn {
  background: #232b36;
  color: var(--text);
  border: 1px solid var(--line);
  margin-bottom: 0;
  font-size: 13px;
}

.layoutBtn.active {
  background: var(--accent);
  color: #111;
}

.fullscreenBtn.active {
  background: var(--accent);
  color: #111;
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.statusline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14px;
}

.statusline .label {
  color: var(--muted);
}

.senderStatus {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.senderStatus .label {
  color: var(--muted);
  font-size: 14px;
}

.senderBadge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #1b2330;
}

.sliderWrap {
  margin: 16px 0;
}

label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.statusDot,
.inlineStatus {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.senderBadge.connected .statusDot,
.inlineStatus.available {
  background: #62d889;
  box-shadow: 0 0 0 1px rgba(98, 216, 137, 0.3), 0 0 12px rgba(98, 216, 137, 0.35);
}

.senderBadge.disconnected .statusDot,
.inlineStatus.unavailable {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.stage {
  padding: 28px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.videoStage {
  position: relative;
  width: 100%;
  max-width: 1400px;
  min-height: 80vh;
  background: #000;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: grid;
  gap: 1px;
  background-color: #111;
}

.videoStage.single-source {
  grid-template-columns: 1fr;
  min-height: 0;
  aspect-ratio: 16 / 9;
  align-self: flex-start;
}

.videoStage.layout-split {
  grid-template-columns: 1fr 1fr;
}

.videoStage.layout-program {
  grid-template-columns: 1fr 320px;
}

.videoStage.layout-live {
  grid-template-columns: 320px 1fr;
}

.videoPane {
  position: relative;
  background: #000;
  min-height: 300px;
}

.videoStage.single-source .videoPane {
  min-height: 0;
}

.videoPane video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.videoLabel {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
}

.paneActions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
}

.videoOverlay {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
}

.stageActions {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 4;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.stageIconButton {
  width: auto;
  margin-bottom: 0;
  min-width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(10, 14, 20, 0.78);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stageIconButton.active {
  background: var(--accent);
  color: #111;
}

.icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.icon-corners::before,
.icon-corners::after {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.icon-corners::before {
  border-left: 2px solid currentColor;
  clip-path: polygon(0 0, 38% 0, 38% 16%, 16% 16%, 16% 38%, 0 38%, 0 0, 0 100%, 16% 100%, 16% 62%, 38% 62%, 38% 100%, 0 100%);
}

.icon-corners::after {
  border-right: 2px solid currentColor;
  clip-path: polygon(100% 0, 62% 0, 62% 16%, 84% 16%, 84% 38%, 100% 38%, 100% 0, 100% 100%, 84% 100%, 84% 62%, 62% 62%, 62% 100%, 100% 100%);
}

.icon-split::before,
.icon-split::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 6px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.icon-split::before {
  left: 1px;
}

.icon-split::after {
  right: 1px;
}

.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  top: 8px;
  left: 1px;
  width: 16px;
  border-top: 2px solid currentColor;
  transform-origin: center;
}

.icon-close::before {
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

#connectionBadge {
  display: inline-block;
  padding: 10px 14px;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 14px;
}

.hidden { display: none !important; }

.videoStage:fullscreen,
.videoStage:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  min-height: 100vh;
  border-radius: 0;
  border: 0;
}

.videoStage:fullscreen.fullscreen-split,
.videoStage:-webkit-full-screen.fullscreen-split {
  grid-template-columns: 1fr 1fr;
}

.videoStage:fullscreen.fullscreen-program,
.videoStage:-webkit-full-screen.fullscreen-program {
  grid-template-columns: 1fr;
}

.videoStage:fullscreen.fullscreen-program #livePane,
.videoStage:-webkit-full-screen.fullscreen-program #livePane {
  display: none !important;
}

.videoStage:fullscreen.fullscreen-live,
.videoStage:-webkit-full-screen.fullscreen-live {
  grid-template-columns: 1fr;
}

.videoStage:fullscreen.fullscreen-live #programPane,
.videoStage:-webkit-full-screen.fullscreen-live #programPane {
  display: none !important;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .stage {
    padding-top: 0;
  }

  .videoStage,
  .videoStage.layout-split,
  .videoStage.layout-program,
  .videoStage.layout-live,
  .videoStage.single-source {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
    min-height: 60vh;
  }

  .stageActions {
    left: 18px;
    right: 18px;
  }
}
