:root {
  --bg-top: #1b1f2a;
  --bg-bottom: #0c0e14;
  --panel: #161a24;
  --border: #2c3242;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent-hover: #3d78ec;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
}

/* Full-height column: header bits keep their natural size, the video grid
   flexes to fill whatever vertical space is left. */
.wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.5rem, 1.5vh, 1rem);
  padding: clamp(0.6rem, 2vw, 1.5rem);
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-size: clamp(1rem, 3.5vw, 1.3rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0.2rem 0 0;
  text-align: center;
}

#status {
  font-size: clamp(0.8rem, 2.6vw, 0.95rem);
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  min-height: 1.2rem;
  text-align: center;
}

/* The fluid area: both frames share it equally. Stacked by default
   (remote above, local below), side-by-side on wide/landscape screens. */
.videos {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(0.5rem, 1.5vmin, 1rem);
}

.frame {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  border: 2px solid var(--border);
  border-radius: clamp(10px, 2vw, 16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.frame.remote video {
  border-color: var(--accent);
}

@media (min-width: 760px) and (min-aspect-ratio: 1 / 1) {
  .videos { flex-direction: row; }
}

.badge {
  position: absolute;
  left: 0.7rem;
  bottom: 0.7rem;
  font-size: clamp(0.7rem, 2vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  background: rgba(12, 14, 20, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
}

button {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  padding: 0.7rem 1.6rem;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

button:hover:not(:disabled) { background: var(--accent-hover); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; }
