:root {
  color-scheme: dark;
  --bg: #111416;
  --panel: #1b2024;
  --panel-2: #242b31;
  --text: #f3f6f8;
  --muted: #a7b0b8;
  --accent: #69c6a3;
  --warn: #f4b860;
  --danger: #ef6f6c;
  --line: #34404a;
}

* {
  box-sizing: border-box;
}

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

main {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

h1,
h2 {
  margin: 0 0 12px;
}

p {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

input,
select,
button {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

button {
  cursor: pointer;
  font-weight: 700;
}

button.primary {
  background: var(--accent);
  color: #07120e;
  border-color: transparent;
}

button.danger {
  background: var(--danger);
  color: #190304;
  border-color: transparent;
}

video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 260px);
  background: #050607;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

.status {
  white-space: pre-wrap;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  line-height: 1.45;
}

.active {
  color: var(--accent);
}

.warning {
  color: var(--warn);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.links a {
  color: var(--accent);
}

.call-screen {
  min-height: 100vh;
  overflow: hidden;
  background: #050607;
}

.call-screen main {
  width: 100vw;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.call-layout {
  position: relative;
}

.call-controls {
  position: fixed;
  z-index: 4;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  gap: 10px;
  max-height: 42vh;
  overflow: auto;
  padding: 12px;
  background: rgba(17, 20, 22, 0.86);
  border: 1px solid rgba(243, 246, 248, 0.16);
  border-radius: 8px;
  backdrop-filter: blur(8px);
}

.call-controls h1 {
  font-size: 1rem;
  margin: 0;
}

.call-controls .controls {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.call-controls input,
.call-controls select,
.call-controls button {
  min-height: 38px;
  padding: 6px 8px;
}

.remote-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: #050607;
}

.remote-stage video {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.self-preview {
  position: fixed;
  z-index: 3;
  right: 12px;
  bottom: 12px;
  width: min(26vw, 220px);
  min-width: 120px;
  aspect-ratio: 16 / 9;
  background: rgba(5, 6, 7, 0.82);
  border: 1px solid rgba(243, 246, 248, 0.22);
  border-radius: 8px;
  overflow: hidden;
}

.self-preview video {
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}

.call-status {
  position: fixed;
  z-index: 4;
  left: 12px;
  bottom: 12px;
  width: min(52vw, 520px);
  max-height: 30vh;
  overflow: auto;
  padding: 10px 12px;
  background: rgba(17, 20, 22, 0.82);
  border: 1px solid rgba(243, 246, 248, 0.14);
  border-radius: 8px;
}

@media (max-width: 720px) {
  .call-controls {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 10px;
    max-height: 46vh;
  }

  .call-controls .controls {
    grid-template-columns: 1fr 1fr;
  }

  .call-controls label {
    font-size: 0.78rem;
  }

  .call-controls input,
  .call-controls select,
  .call-controls button {
    min-height: 36px;
    padding: 6px 8px;
  }

  .self-preview {
    right: 8px;
    bottom: 8px;
    width: 34vw;
  }

  .call-status {
    left: 8px;
    bottom: 8px;
    width: calc(66vw - 24px);
    max-height: 22vh;
    font-size: 0.76rem;
  }
}
