*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #0b0d10;
  color: #e8eaed;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100%;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #12151a;
  border-bottom: 1px solid #1e242d;
  flex-wrap: wrap;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-right: 0.5rem;
}

.room-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #9aa3ad;
}

.room-field input {
  width: 11rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #2a323d;
  border-radius: 6px;
  background: #0b0d10;
  color: inherit;
}

.room-field input:disabled {
  opacity: 0.6;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.btn {
  border: 0;
  border-radius: 6px;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-start {
  background: #1a7f4b;
  color: #fff;
}

.btn-start:not(:disabled):hover {
  background: #159653;
}

.btn-stop {
  background: #8b2e2e;
  color: #fff;
}

.btn-stop:not(:disabled):hover {
  background: #a33636;
}

.status-group {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  font-size: 0.8125rem;
  color: #9aa3ad;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #555;
}

.dot[data-status='connected'],
.dot[data-status='live'] {
  background: #2ecc71;
}

.dot[data-status='connecting'],
.dot[data-status='reconnecting'] {
  background: #f1c40f;
}

.dot[data-status='failed'],
.dot[data-status='disconnected'] {
  background: #e74c3c;
}

.stream-status span[data-status='live'] {
  color: #2ecc71;
  font-weight: 600;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

.screen-wrap {
  position: absolute;
  inset: 0;
}

.screen-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.screen-wrap .placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #5f6b78;
  font-size: 0.95rem;
  pointer-events: none;
}

.screen-wrap.has-preview .placeholder {
  display: none;
}

.camera-pip {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  width: min(22vw, 280px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  background: #111;
  z-index: 2;
}

.error {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  max-width: min(90vw, 520px);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(139, 46, 46, 0.95);
  color: #fff;
  font-size: 0.875rem;
  z-index: 10;
}

@media (max-width: 720px) {
  .status-group {
    width: 100%;
    margin-left: 0;
  }

  .camera-pip {
    width: 36vw;
    right: 0.75rem;
    bottom: 0.75rem;
  }
}
