*,
*::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;
}

.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;
  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;
}

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

.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-watch {
  background: #1565c0;
  color: #fff;
}

.btn-leave {
  background: #455a64;
  color: #fff;
}

.btn-fullscreen {
  background: #263238;
  color: #e8eaed;
}

.status-group {
  display: flex;
  align-items: center;
  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'] {
  background: #2ecc71;
}

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

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

#playbackState[data-status='playing'] {
  color: #2ecc71;
  font-weight: 600;
}

.quality-badge {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #1e242d;
  color: #b0bec5;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.stage:fullscreen {
  width: 100%;
  height: 100%;
}

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

#mainVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transform: translateZ(0);
}

.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);
  z-index: 2;
  transform: translateZ(0);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  color: #cfd8dc;
  font-size: 1rem;
  pointer-events: none;
  z-index: 1;
}

.stage:not(.has-stream) .overlay.waiting {
  display: grid;
}

.stage[data-reconnecting='true'] .overlay.reconnecting {
  display: grid;
}

.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;
  }
}
