:root {
  --bg: #0a0c10;
  --card: #131722;
  --input: #0d1017;
  --border: #232a3a;
  --text: #e8eaf2;
  --muted: #8b93a8;
  --accent: #ff3b5c;
  --ok: #2ecc71;
  --warn: #f4b942;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2 { margin: 0 0 6px; }
h2 { font-size: 18px; }
p { margin: 6px 0; }

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

/* ---------- Boutons ---------- */
.btn {
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--accent); color: #fff; width: 100%; font-size: 16px; }
.btn-danger { background: transparent; border-color: var(--accent); color: var(--accent); width: 100%; }
.btn-ghost { background: #1a2030; border-color: var(--border); color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-text {
  background: none; border: none; padding: 10px 0 0;
  color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer;
}
.btn-text:hover { color: var(--text); }

/* ---------- Page régie (streamer) ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 680px; margin: 0 auto; padding: 22px 20px 8px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 12px rgba(255, 59, 92, .8);
}

.pill {
  padding: 6px 14px; border-radius: 99px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted);
}
.pill-ok   { color: var(--ok);   border-color: rgba(46, 204, 113, .4);  background: rgba(46, 204, 113, .08); }
.pill-warn { color: var(--warn); border-color: rgba(244, 185, 66, .4);  background: rgba(244, 185, 66, .08); }
.pill-err  { color: var(--accent); border-color: rgba(255, 59, 92, .45); background: rgba(255, 59, 92, .08); }
.pill-live { color: #fff; background: var(--accent); border-color: var(--accent); }

.studio {
  max-width: 680px; margin: 0 auto;
  padding: 12px 20px 10px;
  display: grid; gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}

.linkrow { display: flex; gap: 10px; margin: 12px 0 2px; }
.linkrow input {
  flex: 1; min-width: 0;
  background: var(--input);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 13px;
  font: 13px/1.4 ui-monospace, Consolas, monospace;
}

.options { display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0 18px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
select {
  background: var(--input); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font: inherit; font-size: 14px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); padding-bottom: 10px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }

.live-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 600; }
.live-label { color: var(--accent); letter-spacing: .5px; }
#preview {
  width: 100%; aspect-ratio: 16 / 9;
  background: #000; border-radius: 10px;
  margin-bottom: 14px;
}

.dot-live {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, .5); }
  50%      { box-shadow: 0 0 0 7px rgba(255, 59, 92, 0); }
}

.stats-line { margin: -6px 0 12px; font-variant-numeric: tabular-nums; }
.stats-line.stats-alerte { color: var(--warn); }

.status { font-size: 13px; color: var(--warn); margin: 12px 0 0; }
.status-err { color: var(--accent); }

.foot { max-width: 680px; margin: 0 auto; padding: 4px 20px 30px; text-align: center; }

/* ---------- Page spectateur ---------- */
.page-watch { background: #000; overflow: hidden; }
.page-watch video {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
}

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.overlay-card { text-align: center; max-width: 420px; padding: 32px 24px; }
.overlay-card h1 { font-size: 22px; margin: 18px 0 8px; }

.spinner {
  width: 42px; height: 42px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.watchbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8));
  transition: opacity .4s;
}
.watchbar.bar-cachee { opacity: 0; pointer-events: none; }
.badge-live {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  font-weight: 700; font-size: 12px; letter-spacing: .6px;
  padding: 5px 11px; border-radius: 7px;
}
.badge-live .dot-live { width: 7px; height: 7px; background: #fff; animation: none; }
.spacer { flex: 1; }
