:root {
  --bg: #0e0f13;
  --panel: #16181e;
  --panel-2: #1d2028;
  --line: #2a2e38;
  --text: #eceef2;
  --muted: #9097a6;
  --faint: #626a7a;
  --accent: #e5484d;
  --accent-soft: rgba(229, 72, 77, 0.14);
  --blue: #5b8def;
  --blue-soft: rgba(91, 141, 239, 0.15);
  --green: #3fbf7f;
  --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: 0.92em; }

.btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #3a404d; background: #232733; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #d63b40; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8a8d; }
.btn.small { padding: 4px 9px; font-size: 13px; }
input[type=text], input[type=search], input[type=url], input[type=password], input[type=number], select, textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: #ff9b9e; }

/* En-tête */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark { display: inline-grid; place-items: center; width: 56px; height: 40px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 800; letter-spacing: 0.5px; }
.brand-mark.sm { width: 34px; height: 24px; border-radius: 6px; font-size: 12px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.me img { width: 28px; height: 28px; border-radius: 50%; background: var(--panel-2); }

/* Accès refusé */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.gate-card { max-width: 440px; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.gate-card h1 { font-size: 22px; margin: 16px 0 8px; }

/* Mise en page */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; padding: 20px; max-width: 1500px; margin: 0 auto; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); padding: 12px; } }

/* Lecteur */
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.embed { position: absolute; inset: 0; z-index: 1; background: #000; }
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.player .reactions, .player .live-badge, .player .unmute { z-index: 3; }
.blocked-card { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,.82)), var(--thumb, none) center / cover no-repeat, #000; }
.blocked-inner { max-width: 460px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.blocked-inner b { font-size: 17px; }
.blocked-inner p { margin: 0 0 6px; color: #c9ced8; font-size: 14px; }
.blocked-inner .row { justify-content: center; }
.link-form { display: flex; gap: 8px; margin-top: 14px; }
.link-form input { flex: 1; min-width: 0; }
.kind { font-size: 11px; padding: 1px 6px; border-radius: 4px; margin-right: 6px; font-weight: 600; }
.kind.youtube { background: rgba(255,0,51,.18); color: #ff7a8f; }
.kind.twitch { background: rgba(145,70,255,.2); color: #c3a2ff; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); background: rgba(0,0,0,.55); pointer-events: none; }
.overlay:empty { display: none; }
.spinner { width: 34px; height: 34px; border: 3px solid #444; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-badge { position: absolute; top: 12px; left: 12px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .6px; padding: 3px 8px; border-radius: 5px; }
.unmute { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; border: 1px solid #555; border-radius: 999px; padding: 9px 18px; cursor: pointer; }
.reactions { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.reaction { position: absolute; bottom: 8%; display: flex; flex-direction: column; align-items: center; animation: floatUp 2.6s ease-out forwards; }
.reaction .e { font-size: 34px; line-height: 1; }
.reaction .n { font-size: 11px; color: #fff; background: rgba(0,0,0,.55); padding: 1px 6px; border-radius: 6px; margin-top: 2px; }
@keyframes floatUp { 0% { transform: translateY(0) scale(.6); opacity: 0; } 12% { opacity: 1; transform: translateY(-20px) scale(1.1); } 100% { transform: translateY(-260px) scale(1); opacity: 0; } }

.now { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; }
.logo { width: 54px; height: 54px; object-fit: contain; border-radius: 10px; background: var(--panel-2); padding: 6px; flex: none; }
.now-text { flex: 1; min-width: 0; }
.now-ch { font-size: 19px; font-weight: 650; }
.now-prog { color: var(--text); margin-top: 2px; }
.now-next { font-size: 13px; margin-top: 4px; }
.progress { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 8px; max-width: 420px; }
.progress div { height: 100%; background: var(--accent); border-radius: 2px; width: 0; }
.now-actions { display: flex; gap: 8px; }
.react-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.react-bar button { font-size: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; cursor: pointer; transition: transform .1s; }
.react-bar button:active { transform: scale(.9); }
.who { margin-top: 10px; font-size: 13px; }

/* Colonne */
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 100px); position: sticky; top: 76px; }
@media (max-width: 960px) { .side { position: static; max-height: none; } }
.side-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px -4px 4px; padding: 0 4px; overflow-x: auto; }
.side-tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 7px 10px; cursor: pointer; color: var(--muted); font-size: 14px; white-space: nowrap; }
.side-tab.on { color: var(--text); border-bottom-color: var(--accent); }
.pane { display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 0; }
#lists { flex: 1; }
#app-panes { display: contents; }
.app-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-bar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-frame { flex: 1; min-height: 520px; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.app-note { font-size: 12px; color: var(--faint); margin: 0; }
.layout.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.layout.wide .side { max-height: none; }
@media (max-width: 960px) { .layout.wide { grid-template-columns: minmax(0, 1fr); } }
.side h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; margin: 10px 0 2px; display: flex; align-items: center; gap: 6px; }
.hint { font-size: 12px; color: var(--faint); margin: 0; }
#lists { overflow-y: auto; flex: 1; min-height: 120px; margin: 0 -6px; padding: 0 6px; }
.ch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 8px; border: 1px solid transparent; background: none; text-align: left; cursor: pointer; }
.ch:hover { background: var(--panel-2); }
.ch.on { background: var(--accent-soft); border-color: rgba(229,72,77,.35); }
.ch img, .ch .ph { width: 30px; height: 30px; border-radius: 6px; object-fit: contain; background: var(--panel-2); flex: none; }
.ch .ph { display: grid; place-items: center; font-size: 11px; color: var(--faint); font-weight: 700; }
.ch .t { flex: 1; min-width: 0; }
.ch .nm { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .pg { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch .votes { font-size: 11px; background: var(--blue-soft); color: #9fbcff; border-radius: 999px; padding: 1px 7px; }
.heart { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 17px; padding: 2px 4px; display: inline-flex; align-items: center; gap: 3px; }
.heart span { font-size: 12px; }
.heart.on, .heart:hover { color: #ff6b8a; }
.star { background: none; border: none; color: var(--faint); cursor: pointer; font-size: 17px; padding: 2px 4px; }
.star.on { color: #f5c04a; }
.count { background: var(--panel-2); color: var(--muted); border-radius: 999px; padding: 0 7px; font-size: 12px; }
.viewers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; }
.viewers li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.viewers img, .avatar-ph { width: 24px; height: 24px; border-radius: 50%; background: var(--panel-2); flex: none; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100% - 32px); }

/* Admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 20px; background: var(--panel); overflow-x: auto; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 12px 14px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.card p.desc { margin: -6px 0 14px; color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field .help { font-size: 12px; color: var(--faint); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 12px; }
tr.hidden-ch td { opacity: .45; }
.table-wrap { overflow-x: auto; }
pre.logs { background: #0a0b0e; border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 60vh; overflow: auto; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; margin: 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--faint); }
.status-dot.ready { background: var(--green); }
.status-dot.starting { background: #f5c04a; }
.status-dot.error { background: var(--accent); }
.notice { background: var(--blue-soft); border: 1px solid rgba(91,141,239,.35); color: #c7d7ff; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }
.perso-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .perso-layout { grid-template-columns: minmax(0, 1fr); } }
.perso-list { max-height: 420px; overflow-y: auto; }
