/* parloir — one page, two faces: the station kiosk at licorne and a visitor's
   browser. Dark throughout: the station lives in a room where a bright screen
   at night is a nuisance, and the visitor is mostly looking at video. */

:root {
  --bg: #0b0d10;
  --surface: #14181d;
  --line: #262d35;
  --text: #e6e9ed;
  --muted: #8c97a3;
  --accent: #4da3ff;
  --live: #ff4d4d;
  --danger: #b3332f;
  --radius: 10px;
  --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

[hidden] { display: none !important; }

/* --- panels (gate, lobby) ------------------------------------------------ */

.panel {
  max-width: 26rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 100%;
  justify-content: center;
}

.panel h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: -6px;
}

.hint { color: var(--muted); font-size: 0.85rem; }

input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
}

input:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  padding: 0.75rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

button:hover { border-color: var(--accent); }
button.danger { border-color: var(--danger); }
button[aria-pressed="true"] { background: var(--accent); color: #06121f; border-color: var(--accent); }

#connect-button, #enrol-button {
  padding: 1rem;
  font-size: 1.05rem;
  border-color: var(--accent);
}

.error {
  color: #ff8f8f;
  background: rgba(179, 51, 47, 0.15);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  margin: 0;
  font-size: 0.9rem;
}

.error.floating {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%);
  max-width: min(90vw, 30rem);
  z-index: 30;
}

/* --- room ---------------------------------------------------------------- */

#room {
  position: fixed;
  inset: 0;
  background: #000;
}

.grid {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 2px;
  grid-template-columns: 1fr;
  background: #000;
}

.grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.grid[data-count="3"], .grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }

.grid figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #000;
}

.grid video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.grid figcaption {
  position: absolute;
  left: 0.6rem;
  bottom: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 0.85rem;
}

/* Self-view is always visible while transmitting: whoever is in the room can
   see exactly what is being sent. That is the point, not decoration. */
.selfview {
  position: absolute;
  right: 12px;
  top: 12px;
  width: clamp(96px, 18vw, 220px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #000;
  z-index: 20;
}

/* The room's only unmissable notice that the camera and mic are live. */
.banner {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--live);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.banner .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .banner .dot { animation: none; }
}

/* A visitor alone in the room needs to know it is working. The station never
   shows this — its idle face is deliberately nothing. */
.waiting {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  margin: 0;
  z-index: 15;
  color: var(--muted);
  text-align: center;
  font-size: 1rem;
}

/* Idle: the station shows nothing at all. */
.idle {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 25;
}

.controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: var(--gap);
}

/* At the station nobody may have a pointer, so the controls are big enough to
   hit with anything at all. */
body[data-role="station"] .controls button {
  padding: 1.1rem 1.8rem;
  font-size: 1.15rem;
}

body[data-role="station"] .controls { bottom: 28px; }
