:root {
  color-scheme: dark;
  --bg: #0e0f12;
  --panel: #16181d;
  --accent: #3b82f6;
  --danger: #ef4444;
  --text: #e6e8eb;
  --muted: #8a8f98;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app {
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser toolbars resizing the viewport */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #24262c;
  flex-shrink: 0;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.status {
  font-size: 13px;
  color: var(--muted);
}

.status.connected { color: #22c55e; }
.status.error { color: var(--danger); }

.join-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.join-screen label {
  font-size: 14px;
  color: var(--muted);
}

.join-screen input {
  width: min(320px, 90vw);
  padding: 14px 16px;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid #2c2f36;
  background: var(--panel);
  color: var(--text);
}

.join-screen button {
  width: min(320px, 90vw);
  padding: 14px 16px;
  font-size: 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

.join-screen button:active { opacity: 0.85; }

.hint {
  max-width: 340px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.call-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.call-screen.hidden,
.join-screen.hidden {
  display: none;
}

.video-grid {
  flex: 1;
  min-height: 0;
  position: relative;
  background: black;
}

#remoteVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#localVideo {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 30vw;
  max-width: 160px;
  border-radius: 12px;
  border: 2px solid #2c2f36;
  object-fit: cover;
  transform: scaleX(-1); /* mirror selfie view */
}

.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  flex-shrink: 0;
}

.controls button {
  padding: 14px 20px;
  font-size: 16px;
  border-radius: 999px;
  border: 1px solid #2c2f36;
  background: #1f2229;
  color: var(--text);
  cursor: pointer;
  min-width: 96px;
}

.controls button.active {
  background: var(--accent);
  border-color: var(--accent);
}

.controls button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}
