:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #151b23;
  --panel-strong: #1e2631;
  --text: #f3f6fb;
  --muted: #9ba7b8;
  --accent: #60d394;
  --accent-dark: #2d7d55;
  --danger: #ff6b6b;
  --border: #303a46;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

p {
  margin: 0;
}

.topbar p,
.status,
.warning,
.mode-control label {
  color: var(--muted);
}

.mode-control {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.mode-control label {
  font-size: 0.78rem;
}

select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.stage {
  position: relative;
  min-height: 420px;
  display: grid;
}

.video-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #05070a;
  box-shadow: var(--shadow);
}

.remote-frame {
  min-height: min(68vh, 720px);
}

.local-frame {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(28vw, 280px);
  aspect-ratio: 16 / 10;
  background: var(--panel-strong);
}

video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #05070a;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(21, 27, 35, 0.94), rgba(5, 7, 10, 0.94));
  pointer-events: none;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 44px;
  min-width: 92px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 16px;
  cursor: pointer;
}

button.primary {
  border-color: transparent;
  background: var(--accent);
  color: #06130b;
  font-weight: 700;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button.primary:hover:not(:disabled) {
  background: #79e4aa;
}

button[aria-pressed="true"] {
  border-color: var(--danger);
  color: #ffdede;
}

button:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status,
.warning {
  min-height: 1.45em;
  line-height: 1.45;
}

.warning {
  color: #ffd166;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 640px);
    padding: 10px 0;
    gap: 10px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .mode-control {
    width: 100%;
  }

  .stage {
    min-height: 60vh;
  }

  .remote-frame {
    min-height: 60vh;
  }

  .local-frame {
    width: min(42vw, 190px);
    right: 10px;
    bottom: 10px;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  button {
    min-width: 0;
    padding: 0 10px;
  }
}
