*{box-sizing:border-box;font-family:Arial,Helvetica,sans-serif}
html,body{margin:0;height:100%;background:#111;color:#fff;overflow:hidden}
[hidden]{display:none!important}

/* ---------- Système de skins (?skin=blue|green|yellow|red|black dans l'URL) ----------
   Couleurs reprises pixel pour pixel des vrais fichiers CSS de skins du 123 Flash Chat
   historique (css/skin/<nom>/topcmm-123flashchat-skin-<nom>.css), pas des approximations. */
:root{
  --accent-light:#7ec2f0;
  --accent:#2f5bff;
  --accent2:#8b3bff;
  --accent-dark:#123577;
}
:root[data-skin="blue"]{
  --accent-light:#aebfdd;
  --accent:#4b71b4;
  --accent2:#6d9dea;
  --accent-dark:#172233;
}
:root[data-skin="green"]{
  --accent-light:#9ed6c0;
  --accent:#29a475;
  --accent2:#117682;
  --accent-dark:#03191c;
}
:root[data-skin="yellow"]{
  --accent-light:#f1d88d;
  --accent:#e2a902;
  --accent2:#b88d0d;
  --accent-dark:#281f02;
}
:root[data-skin="red"]{
  --accent-light:#e1a098;
  --accent:#be2d1c;
  --accent2:#921e11;
  --accent-dark:#200603;
}
:root[data-skin="black"]{
  --accent-light:#c7d695;
  --accent:#83a415;
  --accent2:#bbd239;
  --accent-dark:#292e0c;
}

#topInstallBar{position:fixed;top:0;left:0;right:0;height:48px;display:flex;align-items:center;gap:10px;padding:0 14px;background:#181b22;z-index:5;border-bottom:1px solid #242833}
#topInstallBar .logo{width:26px;height:26px;border-radius:7px}
#topInstallBar .brand{font-weight:700;font-size:14px}
#topInstallBar .spacer{flex:1}
.icon-btn{background:transparent;border:0;color:#fff;font-size:22px;cursor:pointer;padding:4px 8px;border-radius:8px}
.icon-btn:hover{background:#242833}

#landing{display:flex;align-items:center;justify-content:center;min-height:100vh;padding-top:48px;
  background:radial-gradient(ellipse at 50% 20%,var(--accent-light) 0%,var(--accent) 45%,var(--accent-dark) 100%);}
#landing .box{width:92%;max-width:420px;background:rgba(24,27,34,.75);backdrop-filter:blur(10px);
  padding:30px 26px;border-radius:18px;box-shadow:0 10px 40px rgba(0,0,0,.5);border:1px solid rgba(255,255,255,.08)}
#landing .brand-title{margin:0 0 4px;font-size:32px;text-align:center;font-weight:800;letter-spacing:.3px;
  background:linear-gradient(90deg,var(--accent-light),var(--accent),var(--accent2));-webkit-background-clip:text;background-clip:text;color:transparent}
#landing .tagline{margin:0 0 14px;text-align:center;font-size:15px;font-weight:600;color:#fff}
#landing .muted{color:#c7c9d6;font-size:13px;text-align:center;margin:0 0 18px;line-height:1.4}
#landing input{width:100%;padding:13px;margin:6px 0;border:0;border-radius:8px;background:#242833;color:#fff;font-size:15px}
#landing .row{display:flex;gap:8px}
#landing .row input{flex:1}
#landing .or{text-align:center;color:#9aa4b2;font-size:12px;margin:10px 0}
#landing .hint{font-size:12px;color:#c7c9d6;text-align:center;margin:18px 0 14px;line-height:1.4}
#landing .hint strong{color:#fff}
#landing .features{display:flex;justify-content:center;gap:8px;flex-wrap:wrap;margin-bottom:16px}
#landing .features div{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.14);
  padding:6px 11px;border-radius:20px;font-size:12px;white-space:nowrap;color:#fff}
#landing .privacy{font-size:11px;color:#9aa4b2;text-align:center;margin:0;line-height:1.4}
#landing .everyone-section{margin:6px 0 16px;padding:16px 14px;background:rgba(255,255,255,.06);
  border-radius:12px;border:1px solid rgba(255,255,255,.1)}
#landing .everyone-section h2{margin:0 0 10px;font-size:16px;text-align:center;color:#fff}
#landing .everyone-section p{margin:0 0 8px;font-size:13px;color:#dfe4ee;text-align:center;line-height:1.5}
#landing .everyone-section p:last-of-type{margin-bottom:0}
#landing .tags-line{margin-top:12px;font-size:12px;text-align:center;color:var(--accent-light);font-weight:600;line-height:1.6}
#landing .embedLink{display:block;text-align:center;margin-top:16px;font-size:12.5px;color:var(--accent-light);text-decoration:none}
#landing .embedLink:hover{text-decoration:underline}

#camBlocked{display:flex;align-items:center;justify-content:center;min-height:100vh;background:#0f1116;padding-top:48px}
#camBlocked .box{width:92%;max-width:420px;background:#181b22;padding:28px;border-radius:14px;box-shadow:0 0 30px rgba(0,0,0,.5)}
#camBlocked h1{margin:0 0 6px;font-size:24px;text-align:center}
#camBlocked .muted{color:#9aa4b2;font-size:13px;text-align:center;margin:0 0 18px;line-height:1.4}
#camBlocked .howto{background:#242833;border-radius:8px;padding:14px 18px;margin-bottom:18px;font-size:13px;line-height:1.6}
#camBlocked .howto ol{margin:8px 0 0;padding-left:20px}
#camBlocked .btn{width:100%;margin-bottom:8px}
.btn{padding:13px;border:0;border-radius:8px;background:var(--accent);color:#fff;font-size:15px;cursor:pointer;font-weight:600}
.btn:hover{opacity:.88}
.btn.small{padding:8px 12px;font-size:16px;background:#242833}
.btn.toggle-off{background:#c0392b;position:relative}
.btn.toggle-off::after{content:"";position:absolute;left:15%;right:15%;top:50%;height:2px;background:#fff;transform:rotate(-45deg)}
.btn.danger{background:#c0392b}
.btn.primary{width:100%;background:linear-gradient(90deg,var(--accent),var(--accent2))}
.err{color:#ff7676;font-size:13px;margin-top:8px;min-height:16px}

#room{display:flex;flex-direction:column;height:100vh}
#topbar{height:48px;background:#181b22;display:flex;align-items:center;gap:8px;padding:0 12px;flex:0 0 auto}
#topbar .spacer{flex:1}
#roomLabel{font-size:13px;color:#9aa4b2}

#videoGrid{flex:1;display:grid;gap:6px;padding:6px;min-height:0;position:relative}
.tile{position:relative;background:#000;border-radius:8px;overflow:hidden;min-height:0}
.tile#tile-local{position:absolute;right:12px;bottom:12px;width:110px;height:150px;z-index:3;border:2px solid var(--accent);box-shadow:0 4px 14px rgba(0,0,0,.5)}
@media (max-width:500px){.tile#tile-local{width:82px;height:112px;right:8px;bottom:8px}}
.tile video{width:100%;height:100%;object-fit:cover;display:block}
.tile .label{position:absolute;left:0;bottom:0;right:0;padding:5px 8px;background:linear-gradient(transparent,rgba(0,0,0,.7));font-size:13px}
.tile.muted-audio .label::after{content:" 🔇"}
.camOffOverlay{position:absolute;inset:0;background:#1c1f29;display:flex;align-items:center;justify-content:center;font-size:48px;z-index:2}
.camOffOverlay[hidden]{display:none}
.camOffOverlay span{opacity:.5}
.displayLockedOverlay{position:absolute;inset:0;z-index:4;display:flex;align-items:center;justify-content:center;padding:18px;background:#171a21;color:#fff;text-align:center;font-size:14px;line-height:1.4}
.displayLockedOverlay[hidden]{display:none}

/* Grilles adaptatives par nombre de participants */
#videoGrid[data-count="1"]{grid-template-columns:1fr;grid-template-rows:1fr}
#videoGrid[data-count="2"]{grid-template-columns:1fr 1fr;grid-template-rows:1fr}
#videoGrid[data-count="3"]{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}
/* #tile-local est en position absolute (hors flux), donc la 1ère tuile du flux
   grid normal est celle-ci : le 2e enfant DOM (local est toujours ajouté en 1er) */
#videoGrid[data-count="3"] .tile:nth-child(2){grid-column:1/3}
#videoGrid[data-count="4"]{grid-template-columns:1fr 1fr;grid-template-rows:1fr 1fr}
#videoGrid[data-count="5"],#videoGrid[data-count="6"]{grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr}
#videoGrid[data-count="7"],#videoGrid[data-count="8"],#videoGrid[data-count="9"]{grid-template-columns:1fr 1fr 1fr;grid-template-rows:1fr 1fr 1fr}

@media (max-width:700px){
  #videoGrid[data-count="2"]{grid-template-columns:1fr;grid-template-rows:1fr 1fr}
  #videoGrid[data-count="3"]{grid-template-columns:1fr;grid-template-rows:1fr 1fr 1fr}
  #videoGrid[data-count="3"] .tile:first-child{grid-column:1}
  #videoGrid[data-count="4"]{grid-template-columns:1fr;grid-template-rows:repeat(4,1fr)}
}
/* Thème clair aligné sur l’interface APK publiée 1.8.18/code39. */
:root{--accent-light:#c7d2fe;--accent:#4f46e5;--accent2:#4338ca;--accent-dark:#312e81;--ui-ink:#0f172a;--ui-slate:#64748b;--ui-surface:#fff;--ui-canvas:#f1f5f9;--ui-line:#e2e8f0}
html,body{background:var(--ui-canvas);color:var(--ui-ink)}
#topInstallBar,#topbar{background:var(--ui-surface);color:var(--ui-ink);border-bottom:1px solid var(--ui-line);box-shadow:0 1px 3px rgba(15,23,42,.06)}
#topInstallBar .brand,#roomLabel{color:var(--ui-ink)}
.icon-btn{color:var(--ui-slate)}.icon-btn:hover{background:var(--ui-canvas)}
#landing{background:linear-gradient(145deg,#4f46e5 0%,#4338ca 55%,#312e81 100%);padding:64px 16px 24px}
#landing .box,#camBlocked .box{background:var(--ui-surface);color:var(--ui-ink);border:1px solid var(--ui-line);box-shadow:0 16px 40px rgba(15,23,42,.18);backdrop-filter:none}
#landing .brand-title{background:none;color:var(--ui-ink)}
#landing .tagline,#landing .everyone-section h2,#landing .hint strong{color:var(--ui-ink)}
#landing .muted,#landing .hint,#landing .privacy,#landing .everyone-section p{color:var(--ui-slate)}
#landing input{background:#f8fafc;color:var(--ui-ink);border:1px solid var(--ui-line)}
#landing .or{color:var(--ui-slate)}
#landing .features div,#landing .everyone-section{background:#f8fafc;color:var(--ui-ink);border:1px solid var(--ui-line)}
#landing .tags-line,#landing .embedLink{color:var(--accent)}
#camBlocked{background:var(--ui-canvas);color:var(--ui-ink)}
#camBlocked .muted{color:var(--ui-slate)}#camBlocked .howto{background:#f8fafc;color:var(--ui-ink);border:1px solid var(--ui-line)}
.btn{background:var(--accent)}.btn.primary{background:var(--accent)}.btn.small{background:#eef2ff;color:#3730a3;border:1px solid #c7d2fe}
.btn.danger,.btn.toggle-off{background:#dc2626;color:#fff}.err{color:#dc2626}
#room{background:var(--ui-canvas)}#topbar{padding:0 14px}
#videoGrid{gap:10px;padding:10px;background:var(--ui-canvas)}
.tile{border:1px solid #cbd5e1;border-radius:12px;box-shadow:0 2px 8px rgba(15,23,42,.08)}
.tile#tile-local{border:2px solid var(--accent);box-shadow:0 6px 18px rgba(15,23,42,.22)}
.camOffOverlay{background:#e2e8f0;color:var(--ui-slate)}
.displayLockedOverlay{background:rgba(248,250,252,.96);color:var(--ui-ink)}
@media(max-width:700px){#topbar{gap:5px;padding:0 8px}.btn.small{padding:7px 8px;font-size:14px}}
/* Keep the information page scrollable; long copy must not be clipped by the viewport. */
html,body{height:auto;min-height:100%;overflow-x:hidden;overflow-y:auto}
#topInstallBar{z-index:10}
#landing{min-height:100svh;height:auto;align-items:flex-start;padding:72px 16px 40px;overflow:visible}
#landing .box{margin:auto;max-width:560px;padding:28px clamp(20px,4vw,34px);border-radius:24px}
#landing .row{flex-wrap:wrap}
#landing .row input{min-width:0;flex:1 1 170px}
#landing .row .btn{flex:1 1 160px}
#room{height:100vh;height:100dvh;min-height:0;overflow:hidden}
#topbar{min-height:56px;height:auto;flex-wrap:wrap;justify-content:flex-start}
#roomLabel{flex:1 1 120px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#videoGrid{flex:1 1 auto;min-height:0}
@media(max-width:700px){
 #landing{padding:64px 12px 24px}
 #landing .box{width:100%;padding:24px 18px;border-radius:20px}
 #topbar{gap:4px;padding:7px 8px}
 #roomLabel{order:-1;flex:1 0 100%;padding:3px 2px}
 #topbar .spacer{display:none}
 #topbar .btn.small{flex:1 1 auto;min-width:42px;padding:8px 5px;font-size:13px}
 #topbar #btnShare{flex:1 1 88px}
 #topbar #btnLeave{flex:1 1 72px}
}
@media(max-width:480px){#landing .row{display:flex;flex-direction:column}#landing .row input,#landing .row .btn{width:100%;min-width:0;flex:1 1 auto}}
#bottomControls{flex:0 0 auto;display:flex;justify-content:center;align-items:center;gap:14px;padding:10px 16px calc(10px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid var(--ui-line)}
#bottomControls .btn{min-width:112px;min-height:46px;border-radius:14px;box-shadow:0 2px 5px rgba(15,23,42,.1)}
@media(max-width:700px){#bottomControls{gap:12px;padding:8px 12px calc(8px + env(safe-area-inset-bottom))}#bottomControls .btn{flex:1;max-width:180px;min-height:48px}}
#bottomControls #btnRemoteAudio{min-width:168px;max-width:260px;font-size:13px;white-space:normal;line-height:1.2}
@media(max-width:700px){#bottomControls #btnRemoteAudio{min-width:0;flex:1.3;max-width:220px;font-size:12px}}
