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

html, body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: #000;
  overflow: hidden;
  touch-action: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

.hidden { display: none !important; }

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Every video panel — remote and local — same treatment ───────────────── */
.vid-panel {
  position: fixed;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 4px 28px rgba(0,0,0,0.85);
  z-index: 10;
  overflow: hidden;
}
.vid-panel:active { cursor: grabbing; }

/* soft inset shadow at edges */
.vid-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 22px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 1;
}

.vid-panel video {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  /* no object-fit, no background — panel is sized exactly to video ratio */
}

/* local self-view: no mirror — shows what others actually see */
#local-panel video { transform: none; }

/* ── Panel fullscreen (double-tap on panel) ──────────────────────────────── */
.panel-focused {
  /* position overridden via JS; just handle the video inside */
  z-index: 900 !important;
}
.panel-focused video {
  object-fit: contain !important;
  background: #000 !important;
}
.panel-hidden {
  display: none !important;
}

/* ── Waiting message ─────────────────────────────────────────────────────── */
#waiting-msg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  font-size: 15px;
  z-index: 4;
  pointer-events: none;
}

/* ── Participant status bar ──────────────────────────────────────────────── */
#status-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(14, 14, 26, 0.82);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 5px 16px;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  z-index: 40;
  pointer-events: none;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Voice-only fullscreen overlay (tap to exit) ────────────────────────── */
#voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  touch-action: manipulation;
}
.vo-icon  { font-size: 88px; line-height: 1; }
.vo-label { font-size: 26px; font-weight: 500; color: rgba(255,255,255,0.75); letter-spacing: 0.06em; }
.vo-hint  { font-size: 13px; color: rgba(255,255,255,0.3); margin-top: 4px; }


/* ── Control panel (opens on double-tap) ─────────────────────────────────── */
#ctrl-panel {
  position: fixed;
  /* left/top set dynamically by JS based on tap position */
  display: flex;
  gap: 16px;
  background: rgba(14, 14, 26, 0.94);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 28px;
  padding: 18px 28px;
  z-index: 500;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 16px;
  transition: background 0.15s;
  color: #e8e8f0;
  min-width: 64px;
  touch-action: manipulation;
}
.ctrl-btn:hover, .ctrl-btn:active { background: rgba(255,255,255,0.1); }
.ctrl-btn.off    { opacity: 0.45; }
.ctrl-btn.active { background: rgba(255, 80, 80, 0.25); }
.ci { font-size: 32px; line-height: 1; }
.cl { font-size: 11px; letter-spacing: 0.03em; opacity: 0.7; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,34,0.92);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e8e8f0;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
