:root {
  --bg: #0e0f13;
  --panel: #171922;
  --panel-2: #1f2230;
  --text: #e8eaf0;
  --muted: #9aa0b4;
  --accent: #7c5cff;
  --accent-2: #00d6a4;
  --danger: #ff5470;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1c1740 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.view { padding: 36px 20px 60px; max-width: 1100px; margin: 0 auto; }
.center { text-align: center; }

.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin: 4px 0 6px; }
textarea {
  width: 100%;
  background: #0c0d12;
  border: 1px solid #2c2f3e;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  margin-bottom: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid #262a39;
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
}

h2 { margin: 0 0 10px; font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
p { line-height: 1.5; }

.btn {
  appearance: none;
  border: 1px solid #353a4d;
  background: var(--panel-2);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: transparent; font-weight: 600; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Bloc challenge */
.challenge-card { padding: 16px 22px; }
.challenge-head { display: flex; align-items: center; justify-content: space-between; }
.challenge-text { margin: 4px 0 0; font-size: 1.25rem; font-weight: 600; }
.timer { background: #2a1a3a; border-color: #463056; color: #d7b8ff; font-variant-numeric: tabular-nums; }

.btn-sm { padding: 6px 10px; font-size: 0.8rem; }
.overlay-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.overlay-line input {
  flex: 1 1 200px;
  background: #0c0d12;
  border: 1px solid #2c2f3e;
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* Vue session */
.share { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.share-text { flex: 1 1 320px; }
.link-row { display: flex; gap: 8px; margin-top: 6px; }
.link-row input {
  flex: 1;
  background: #0c0d12;
  border: 1px solid #2c2f3e;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}
.qr-wrap { text-align: center; }
#qrcode {
  background: #fff;
  padding: 10px;
  border-radius: 12px;
  display: inline-block;
  line-height: 0;
}
#qrcode img, #qrcode canvas { display: block; }

.join-card .controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status { margin: 0 0 14px; color: var(--muted); }
.pill {
  margin-left: auto;
  background: var(--panel-2);
  border: 1px solid #2c2f3e;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Grille caméra */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.tile {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid #262a39;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.tile.me { border-color: var(--accent-2); }
.tile .label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  padding: 3px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
}
.tile.connecting::after {
  content: "connexion…";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .pill { margin-left: 0; }
}

/* --- Mode overlay OBS : fond transparent, grille plein cadre --- */
body.mode-overlay { background: transparent; }
body.mode-overlay #landing,
body.mode-overlay #session { display: none; }

.overlay-grid {
  margin: 0;
  padding: 60px 12px 12px;
  max-width: none;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.overlay-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(12, 13, 18, 0.72);
  backdrop-filter: blur(6px);
  z-index: 10;
}
.ob-challenge { font-weight: 700; font-size: 1.1rem; }
.ob-countdown {
  font-variant-numeric: tabular-nums;
  background: #2a1a3a;
  color: #d7b8ff;
  padding: 4px 12px;
  border-radius: 999px;
}
