* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: #111;
  color: #ddd;
  font: 14px system-ui, sans-serif;
}

button, input {
  font: inherit;
  color: inherit;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 7px 12px;
}
button { cursor: pointer; }
button:hover { background: #383838; }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: #2563eb; border-color: #2563eb; color: #fff; }
button.primary:hover { background: #1d4ed8; }
button.active { background: #b91c1c; border-color: #b91c1c; color: #fff; }

/* Lobby */
#lobby {
  max-width: 480px;
  margin: 15vh auto 0;
  padding: 0 16px;
  text-align: center;
}
#lobby .row { display: flex; gap: 8px; margin: 16px 0; }
#lobby input { flex: 1; min-width: 0; }
#joinBtn { padding: 10px 40px; font-size: 16px; }
.error { color: #f87171; }

/* Call */
#app { height: 100%; display: flex; flex-direction: column; }
#main { flex: 1; min-height: 0; position: relative; display: flex; background: #000; }
video { background: #000; display: block; }

/* No screen shared: friend fills the view, you sit in the corner */
#stage { display: none; flex: 1; min-width: 0; }
#cams { flex: 1; position: relative; min-width: 0; }
#remoteCam { width: 100%; height: 100%; object-fit: contain; }
#localCam {
  position: absolute; right: 16px; bottom: 16px;
  width: 200px; border-radius: 8px; border: 1px solid #333;
}

/* Screen shared: call goes to the side... */
#main.has-screen #stage { display: block; }
#screenVideo { width: 100%; height: 100%; object-fit: contain; }
#main.has-screen #cams {
  flex: none; width: 280px; padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  background: #181818;
}
#main.has-screen #cams video {
  position: static; width: 100%; height: auto;
  aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: 8px; border: 1px solid #333;
}

/* ...or floats over the video (drag to move, scroll to resize) */
#main.has-screen.overlay #cams {
  position: absolute; right: 16px; bottom: 16px; z-index: 2;
  width: 240px; padding: 0; background: none;
  cursor: move; touch-action: none;
}

#banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 3; max-width: 90%;
  background: rgba(185, 28, 28, .9); color: #fff;
  padding: 6px 14px; border-radius: 6px;
}

#controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 12px; background: #1a1a1a; border-top: 1px solid #333;
}
#controls label { display: flex; align-items: center; gap: 6px; }
#controls input[type=range] { width: 90px; padding: 0; }
#status { margin-left: auto; color: #999; }

#countdown {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  font-size: 22vh; font-weight: 700; color: #fff;
  background: rgba(0, 0, 0, .45); pointer-events: none;
}
