:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5f6670;
  --accent: #1f7a5a;
  --danger: #c2412d;
  --border: #ddd8cf;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

video { background: #000; border-radius: 12px; object-fit: cover; }
.pip {
  position: absolute; right: 16px; bottom: 16px;
  width: 22%; max-width: 280px; aspect-ratio: 4 / 3;
  border: 2px solid rgba(255, 255, 255, .7);
  transform: scaleX(-1);
}

/* --- Page famille --- */

.famille main { max-width: 720px; margin: 0 auto; padding: 24px 16px; }
.famille h1 { font-size: 1.6rem; margin: 0 0 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; display: grid; gap: 14px;
}
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input, select {
  font: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
button {
  font: inherit; font-weight: 600; padding: 12px 18px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.status { color: var(--muted); margin: 0; min-height: 1.3em; }

.call-panel { display: grid; gap: 12px; }
.videos { position: relative; }
.videos .remotes { aspect-ratio: 16 / 9; }

/* Une vidéo par correspondant : 1 = plein cadre, 2 et plus = grille */
.remotes { display: grid; gap: 4px; width: 100%; grid-auto-rows: 1fr; }
.remotes:has(> :nth-child(2)) { grid-template-columns: 1fr 1fr; }
.remotes video { width: 100%; height: 100%; min-height: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.stats-inline { font-size: .75rem; color: var(--muted); margin: 0; white-space: pre-wrap; }

/* --- Page boîtier TV (toujours sombre, plein écran) --- */

.box { background: #101418; color: #f2f2f2; overflow: hidden; cursor: none; }
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.start { cursor: pointer; font-size: 2rem; text-align: center; padding: 16px; }

.clock { font-size: 18vw; font-weight: 200; line-height: 1; }
.date { font-size: 4vw; text-transform: capitalize; color: #b9c0c7; margin-top: 2vh; }
.waiting { position: absolute; bottom: 5vh; display: flex; align-items: center; gap: 12px; font-size: 2.4vw; color: #b9c0c7; }
.dot { width: 1.6vw; height: 1.6vw; border-radius: 50%; background: #c2412d; }
.dot.online { background: #3fbf7f; }

.ring { animation: pulse 1.5s ease-in-out infinite; text-align: center; }
.ring-title { font-size: 4vw; }
.caller { font-size: 11vw; font-weight: 700; margin: 2vh 0 4vh; }
.ring-hint { font-size: 3vw; background: rgba(0, 0, 0, .25); padding: 1.5vh 3vw; border-radius: 99px; }
@keyframes pulse {
  0%, 100% { background: #1f7a5a; }
  50% { background: #2fa877; }
}

.call { background: #000; }
.call .remotes { position: absolute; inset: 0; }
.call .remotes video { border-radius: 0; object-fit: contain; }
.call .pip { right: 2vw; bottom: 2vw; }
.call-info { position: absolute; font-size: 3vw; }
.stats {
  position: absolute; top: 1vw; left: 1vw; margin: 0;
  background: rgba(0, 0, 0, .65); padding: 10px 14px; border-radius: 8px;
  font-size: 14px; line-height: 1.4;
}
