/* ===========================================================
   Aurora — liquid glass, professionnel, thème clair/sombre
   =========================================================== */
:root {
  --accent: #5eadff;
  --accent-2: #9a7bff;
  --radius: 24px;
  --radius-sm: 15px;
  --danger: #ff5d6c;
  --ok: #35d99a;
  --warn: #ffca4f;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Thème sombre (défaut) */
[data-theme="dark"] {
  --bg-0: #05050c;
  --bg-1: #0e0e1f;
  --text: #eef1ff;
  --muted: #9aa0c8;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.1);
  --glass-3: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.14);
  --bubble: rgba(255, 255, 255, 0.09);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --blob-o: 0.5;
}
/* Thème clair */
[data-theme="light"] {
  --bg-0: #eef1fb;
  --bg-1: #dfe6fb;
  --text: #10132a;
  --muted: #5a618a;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-2: rgba(255, 255, 255, 0.68);
  --glass-3: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.75);
  --bubble: rgba(255, 255, 255, 0.75);
  --shadow: 0 24px 60px rgba(60, 80, 160, 0.18);
  --blob-o: 0.5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; color: var(--text); background: var(--bg-0); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body { position: relative; transition: background .4s; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.center { text-align: center; }
.flex { flex: 1; }
.full { width: 100%; }
.flex-col { display: flex; flex-direction: column; gap: 6px; flex: 1; }

/* ---------- Fond aurore ---------- */
.bg { position: fixed; inset: 0; z-index: -2; background: radial-gradient(130% 130% at 50% -10%, var(--bg-1), var(--bg-0)); overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: var(--blob-o); animation: float 20s ease-in-out infinite; }
.b1 { width: 460px; height: 460px; background: #4f7cff; top: -100px; left: -80px; }
.b2 { width: 520px; height: 520px; background: #9a5cff; bottom: -140px; right: -90px; animation-delay: -5s; }
.b3 { width: 380px; height: 380px; background: #ff5fae; top: 35%; left: 55%; animation-delay: -9s; }
.b4 { width: 320px; height: 320px; background: #2fd2a6; bottom: 18%; left: 8%; animation-delay: -13s; }
.grain { position: absolute; inset: 0; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes float { 0%,100%{transform:translate(0,0) scale(1)} 33%{transform:translate(45px,-35px) scale(1.09)} 66%{transform:translate(-35px,28px) scale(.94)} }

/* ---------- Verre ---------- */
.glass { background: var(--glass); backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%); border: 1px solid var(--border); box-shadow: var(--shadow); }
.glass-soft { background: var(--glass-2); backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%); border: 1px solid var(--border); }
.floating { animation: bob 7s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }

/* ---------- Boutons & inputs ---------- */
.btn { border: 1px solid var(--border); background: var(--glass-2); color: var(--text); padding: 11px 20px; border-radius: 13px; cursor: pointer; font-size: .95rem; font-weight: 600; transition: transform .12s, background .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; box-shadow: 0 10px 28px rgba(94,173,255,.38); }
.btn.ghost { background: transparent; }
.btn.danger { background: linear-gradient(135deg, #ff5d6c, #ff3860); border: none; color: #fff; }
.btn.small { padding: 8px 14px; font-size: .85rem; }

.glass-input { background: rgba(0,0,0,.22); border: 1px solid var(--border); border-radius: 13px; padding: 12px 15px; color: var(--text); font-size: .95rem; outline: none; transition: border .2s, box-shadow .2s; width: 100%; }
[data-theme="light"] .glass-input { background: rgba(255,255,255,.6); }
.glass-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94,173,255,.22); }
.glass-input::placeholder { color: var(--muted); }
.input-wrap { position: relative; }
.input-icon { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1rem; }

.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; border: 1px solid var(--border); background: var(--glass-2); color: var(--text); cursor: pointer; font-size: 1.05rem; transition: transform .12s, background .2s; flex-shrink: 0; }
.icon-btn:hover { transform: translateY(-2px); background: var(--glass-3); }
.icon-btn.small { width: 34px; height: 34px; font-size: .95rem; }
.icon-btn.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; }

/* ---------- Icônes SVG ---------- */
.ic { width: 20px; height: 20px; display: block; }
.icon-btn.small .ic { width: 17px; height: 17px; }
.btn .ic { width: 17px; height: 17px; display: inline-block; vertical-align: -3px; }
.control .ic { width: 24px; height: 24px; }
.search-ico .ic { width: 16px; height: 16px; }
.input-icon .ic { width: 18px; height: 18px; }
.msg-actions .ic { width: 16px; height: 16px; }
.tick .ic { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }

.error { color: var(--danger); font-size: .85rem; min-height: 1rem; text-align: center; }
.field-label { font-size: .78rem; color: var(--muted); margin: 8px 0 3px; display: block; }

/* ---------- Avatars ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 1px solid var(--border); background-size: cover; background-position: center; cursor: pointer; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; color: #fff; position: relative; }
.avatar.big { width: 84px; height: 84px; font-size: 1.6rem; }
.avatar.huge { width: 116px; height: 116px; font-size: 2.4rem; }
.avatar.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-1); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 rgba(94,173,255,.5)} 50%{box-shadow:0 0 0 16px rgba(94,173,255,0)} }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; }

/* ============================================================
   LOGIN — expérience immersive "Aurora Liquid Glass"
   Palette de marque (indépendante du thème pour un rendu premium constant)
   ============================================================ */
#login {
  --l-1: #7C5CFF; --l-2: #4FA8FF; --l-3: #58F0FF; --l-4: #D89CFF; --l-green: #5cf0c0;
  --l-text: #eef1ff; --l-muted: #a7adde;
  color: var(--l-text);
  background: radial-gradient(130% 120% at 50% -10%, #12102b 0%, #08081a 45%, #040410 100%);
  overflow: hidden;
}

/* ---- Décor (aurore, rayons, étoiles, orbes) ---- */
.login-fx { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.aurora-ribbon { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; mix-blend-mode: screen; will-change: transform; }
.aurora-ribbon.r1 { width: 60vw; height: 40vw; top: -18vw; left: -8vw; background: radial-gradient(circle at 40% 40%, var(--l-1), transparent 62%); animation: ribbon1 22s ease-in-out infinite; }
.aurora-ribbon.r2 { width: 55vw; height: 45vw; bottom: -22vw; right: -10vw; background: radial-gradient(circle at 50% 50%, var(--l-2), transparent 60%); animation: ribbon2 26s ease-in-out infinite; }
.aurora-ribbon.r3 { width: 42vw; height: 42vw; top: 28%; left: 42%; background: radial-gradient(circle at 50% 50%, var(--l-green), transparent 60%); opacity: .4; animation: ribbon3 30s ease-in-out infinite; }
@keyframes ribbon1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vw,4vw) scale(1.12); } }
@keyframes ribbon2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-5vw,-4vw) scale(1.08); } }
@keyframes ribbon3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-4vw,3vw) scale(1.15); } }
.rays { position: absolute; inset: -50%; background: conic-gradient(from 0deg at 50% 40%, transparent 0deg, rgba(124,92,255,.10) 40deg, transparent 80deg, rgba(88,240,255,.08) 160deg, transparent 200deg, rgba(216,156,255,.08) 300deg, transparent 340deg); animation: spin 60s linear infinite; opacity: .8; }
.stars { position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cg fill='white'%3E%3Ccircle cx='15' cy='25' r='1.2'/%3E%3Ccircle cx='80' cy='60' r='.8'/%3E%3Ccircle cx='140' cy='20' r='1'/%3E%3Ccircle cx='210' cy='70' r='1.3'/%3E%3Ccircle cx='280' cy='40' r='.7'/%3E%3Ccircle cx='40' cy='120' r='1'/%3E%3Ccircle cx='120' cy='150' r='.9'/%3E%3Ccircle cx='190' cy='130' r='.7'/%3E%3Ccircle cx='260' cy='170' r='1.1'/%3E%3Ccircle cx='30' cy='210' r='.8'/%3E%3Ccircle cx='100' cy='250' r='1.2'/%3E%3Ccircle cx='170' cy='230' r='.8'/%3E%3Ccircle cx='240' cy='280' r='1'/%3E%3Ccircle cx='300' cy='230' r='.7'/%3E%3Ccircle cx='60' cy='300' r='.9'/%3E%3Ccircle cx='150' cy='300' r='.7'/%3E%3C/g%3E%3C/svg%3E"); opacity: .5; animation: twinkle 6s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .32; } 50% { opacity: .6; } }
.l-orb { position: absolute; border-radius: 50%; filter: blur(2px); background: radial-gradient(circle at 35% 30%, #fff, rgba(124,92,255,.5) 45%, transparent 70%); box-shadow: 0 0 30px rgba(124,92,255,.5); opacity: .5; }
.l-orb.o1 { width: 14px; height: 14px; top: 22%; left: 18%; animation: floatY 9s ease-in-out infinite; }
.l-orb.o2 { width: 9px; height: 9px; top: 68%; left: 30%; animation: floatY 11s ease-in-out infinite reverse; }
.l-orb.o3 { width: 11px; height: 11px; top: 40%; right: 22%; background: radial-gradient(circle at 35% 30%, #fff, rgba(88,240,255,.5) 45%, transparent 70%); box-shadow: 0 0 28px rgba(88,240,255,.5); animation: floatY 13s ease-in-out infinite; }
@keyframes floatY { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }

/* ---- Mise en page ---- */
.login-stage { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(20px, 5vw, 80px); width: min(1120px, 94vw); }

/* ---- Hero (aperçu vivant, desktop) ---- */
.login-hero { display: flex; flex-direction: column; gap: 26px; }
.hero-badge { display: inline-block; align-self: flex-start; padding: 6px 14px; border-radius: 999px; font-size: .8rem; font-weight: 600; letter-spacing: .5px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(10px); }
.hero-title { font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.04; letter-spacing: -1px; margin: 16px 0 12px; font-weight: 800; }
.grad-text { background: linear-gradient(100deg, var(--l-4), var(--l-1) 40%, var(--l-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { color: var(--l-muted); font-size: 1.05rem; max-width: 30ch; line-height: 1.5; }
.hero-chat { margin-top: 6px; width: min(360px, 100%); padding: 16px; border-radius: 26px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow); animation: floatCard 8s ease-in-out infinite; }
@keyframes floatCard { 0%,100% { transform: translateY(0) rotate(-.4deg); } 50% { transform: translateY(-10px) rotate(.4deg); } }
.hero-online { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.hero-online .ha { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); border: 2px solid rgba(10,10,25,.7); margin-left: -8px; }
.hero-online .ha:first-child { margin-left: 0; }
.hero-online-txt { margin-left: 8px; font-size: .76rem; color: var(--l-green); font-weight: 600; }
.hb { max-width: 82%; padding: 9px 13px; border-radius: 16px; font-size: .88rem; line-height: 1.35; opacity: 1; }
.hb-in { align-self: flex-start; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-bottom-left-radius: 5px; animation-delay: .3s; }
.hb-out { align-self: flex-end; background: linear-gradient(135deg, var(--l-1), var(--l-2)); color: #fff; border-bottom-right-radius: 5px; animation-delay: .8s; }
.hb-media { align-self: flex-end; display: flex; flex-direction: column; gap: 5px; animation-delay: 1.3s; padding: 6px; background: linear-gradient(135deg, var(--l-1), var(--l-2)); border-radius: 16px; }
.hb-img { display: block; width: 150px; height: 92px; border-radius: 11px; background: linear-gradient(135deg, #ffd6a5, #ff8fab 45%, #a5b4ff); }
.hb-cap { font-size: .72rem; color: rgba(255,255,255,.9); padding-left: 2px; }
.hb.typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); animation-delay: 1.9s; }
.hb.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--l-3); animation: td 1.3s infinite ease-in-out; }
.hb.typing i:nth-child(2) { animation-delay: .18s; } .hb.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---- Carte de connexion ---- */
.login-card {
  position: relative; z-index: 2; width: 100%; max-width: 420px; margin: 0 auto;
  padding: 40px 36px 26px; border-radius: 32px; overflow: hidden;
  background: linear-gradient(160deg, rgba(255,255,255,.1), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 30px 90px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.25);
  backdrop-filter: blur(34px) saturate(180%); -webkit-backdrop-filter: blur(34px) saturate(180%);
  transform: perspective(1400px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
  transition: transform .25s cubic-bezier(.22,1,.36,1);
  text-align: center;
}
.card-glow { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 0%), rgba(124,92,255,.28), transparent 60%); opacity: .9; transition: background .1s; }
.card-sheen { position: absolute; top: 0; left: -60%; width: 55%; height: 100%; pointer-events: none; background: linear-gradient(105deg, transparent, rgba(255,255,255,.14), transparent); transform: skewX(-18deg); animation: sheen 7s ease-in-out infinite; }
@keyframes sheen { 0%, 65% { left: -60%; } 90%, 100% { left: 140%; } }

.brand { position: relative; z-index: 1; margin-bottom: 26px; }
.brand-orb { width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #fff, var(--l-3) 26%, var(--l-1) 68%, var(--l-4)); box-shadow: 0 0 40px rgba(124,92,255,.65), inset 0 -6px 14px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.5); animation: orbPulse 4s ease-in-out infinite; }
@keyframes orbPulse { 0%,100% { transform: translateY(0) scale(1); box-shadow: 0 0 40px rgba(124,92,255,.55), inset 0 -6px 14px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.5); } 50% { transform: translateY(-4px) scale(1.04); box-shadow: 0 0 60px rgba(88,240,255,.6), inset 0 -6px 14px rgba(0,0,0,.35), inset 0 4px 8px rgba(255,255,255,.6); } }
.brand-name { font-size: 2.2rem; font-weight: 800; letter-spacing: -.5px; margin: 0; background: linear-gradient(100deg, #fff, var(--l-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--l-muted); font-size: .95rem; margin-top: 4px; }

/* ---- Champs (label flottant) ---- */
.login-form { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field { position: relative; }
.field-input { width: 100%; height: 58px; padding: 20px 46px 6px 46px; border-radius: 16px; font-size: .98rem; color: var(--l-text); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.16); outline: none; transition: border-color .2s, background .2s, box-shadow .2s; }
.field-input::placeholder { color: transparent; }
.field-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--l-muted); display: flex; transition: color .2s; }
.field-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; background: none; border: none; color: var(--l-muted); cursor: pointer; border-radius: 10px; transition: color .2s, background .2s; }
.field-toggle:hover { color: var(--l-text); background: rgba(255,255,255,.08); }
.field-float { position: absolute; left: 46px; top: 50%; transform: translateY(-50%); color: var(--l-muted); font-size: .98rem; pointer-events: none; transition: top .2s cubic-bezier(.22,1,.36,1), font-size .2s, color .2s, transform .2s; }
.field-input:focus + .field-float,
.field-input:not(:placeholder-shown) + .field-float { top: 15px; transform: none; font-size: .7rem; color: var(--l-3); letter-spacing: .3px; }
.field:focus-within .field-input { border-color: rgba(88,240,255,.7); background: rgba(255,255,255,.08); box-shadow: 0 0 0 4px rgba(88,240,255,.14), 0 8px 24px rgba(88,240,255,.12); }
.field:focus-within .field-ico { color: var(--l-3); }
.field-line { position: absolute; left: 14px; right: 14px; bottom: 8px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--l-3), var(--l-1)); transform: scaleX(0); transform-origin: left; transition: transform .35s cubic-bezier(.22,1,.36,1); opacity: .8; }
.field:focus-within .field-line { transform: scaleX(1); }
.field.pasted .field-input { animation: pastePulse .5s ease; }
@keyframes pastePulse { 0% { box-shadow: 0 0 0 0 rgba(88,240,255,.5); } 100% { box-shadow: 0 0 0 10px rgba(88,240,255,0); } }
/* Autofill élégant (pas de jaune) */
.field-input:-webkit-autofill, .field-input:-webkit-autofill:focus { -webkit-text-fill-color: var(--l-text); transition: background-color 9999s; box-shadow: 0 0 0 1000px rgba(255,255,255,.06) inset; }

.caps-hint { display: none; align-items: center; gap: 6px; font-size: .78rem; color: var(--warn); padding: 2px 4px; }
.caps-hint.show { display: flex; animation: bubbleIn .25s ease; }

/* ---- Bouton Continuer ---- */
.cta { position: relative; z-index: 1; height: 56px; margin-top: 6px; border: none; border-radius: 16px; cursor: pointer; font-size: 1.02rem; font-weight: 700; color: #fff; overflow: hidden; background: linear-gradient(100deg, var(--l-1), var(--l-2) 55%, var(--l-3)); background-size: 200% 100%; box-shadow: 0 12px 34px rgba(124,92,255,.5); transition: transform .15s cubic-bezier(.22,1,.36,1), box-shadow .2s, filter .2s; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(124,92,255,.62); background-position: 100% 0; filter: brightness(1.05); }
.cta:active { transform: translateY(0) scale(.99); }
.cta:focus-visible { outline: 3px solid rgba(88,240,255,.6); outline-offset: 3px; }
.cta .cta-spinner, .cta .cta-check { position: absolute; inset: 0; margin: auto; display: none; }
.cta .cta-spinner { width: 22px; height: 22px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.cta .cta-check { width: 26px; height: 26px; }
.cta.loading .cta-label { opacity: 0; } .cta.loading .cta-spinner { display: block; }
.cta.loading { pointer-events: none; }
.cta.success { background: linear-gradient(100deg, var(--l-green), var(--l-3)); }
.cta.success .cta-label { opacity: 0; } .cta.success .cta-check { display: block; }
.cta.error { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-8px); } 40%,60% { transform: translateX(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

#login .error { color: #ff8a95; min-height: 1.1rem; text-align: center; font-size: .85rem; margin-top: 2px; }
.login-foot { position: relative; z-index: 1; text-align: center; margin-top: 20px; font-size: .76rem; color: var(--l-muted); opacity: .7; }

/* Révélation des bulles hero uniquement si le mouvement est autorisé (sinon visibles direct) */
@media (prefers-reduced-motion: no-preference) {
  .hb { opacity: 0; animation-name: bubbleIn; animation-duration: .6s; animation-timing-function: ease; animation-fill-mode: forwards; }
}
/* ---- Réduction des animations ---- */
@media (prefers-reduced-motion: reduce) {
  .aurora-ribbon, .rays, .stars, .l-orb, .hero-chat, .brand-orb, .card-sheen, .hb, .cta { animation: none !important; }
  .login-card { transition: none; }
}
/* ---- Responsive ---- */
@media (max-width: 900px) {
  .login-stage { grid-template-columns: 1fr; width: min(440px, 94vw); }
  .login-hero { display: none; }
}

/* ---------- App layout ---------- */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: 320px 1fr; gap: 14px; padding: 14px; }
.app.info-open { grid-template-columns: 320px 1fr 300px; }
.sidebar { border-radius: var(--radius); display: flex; flex-direction: column; padding: 15px; gap: 12px; overflow: hidden; }
.me-bar { display: flex; align-items: center; gap: 11px; }
.me-info { flex: 1; overflow: hidden; }
.me-info .name { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-wrap { position: relative; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .6; font-size: .9rem; }
.search { padding-left: 34px; }
.section-title { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: 1.2px; margin: 4px 2px; }
.sidebar-scroll { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }

/* ---------- Liste conversations ---------- */
.conv-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.conv:hover { background: var(--glass-2); }
.conv.active { background: var(--glass-3); }
.conv-main { flex: 1; overflow: hidden; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .time { font-size: .7rem; color: var(--muted); flex-shrink: 0; }
.conv .preview { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .badge { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: .72rem; font-weight: 700; flex-shrink: 0; }

/* ---------- Chat ---------- */
.chat { border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 20px; }
.big-emoji { font-size: 4rem; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: none; border-bottom: 1px solid var(--border); }
.back-btn { display: none; }
.peer { display: flex; align-items: center; gap: 12px; background: none; border: none; color: var(--text); cursor: pointer; flex: 1; text-align: left; padding: 4px; border-radius: 12px; }
.peer:hover { background: var(--glass-2); }
.peer .name { font-weight: 700; }
.call-actions { display: flex; gap: 8px; }

.messages { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.date-sep { align-self: center; font-size: .72rem; color: var(--muted); background: var(--glass-2); border: 1px solid var(--border); padding: 3px 12px; border-radius: 999px; margin: 12px 0; }

.msg { max-width: min(72%, 560px); display: flex; flex-direction: column; gap: 2px; margin-top: 2px; position: relative; align-self: flex-start; align-items: flex-start; }
.msg.grouped { margin-top: 1px; }
.msg.gap { margin-top: 10px; }
.msg .bubble { padding: 9px 13px; border-radius: 16px; background: var(--bubble); border: 1px solid var(--border); word-wrap: break-word; overflow-wrap: anywhere; line-height: 1.42; position: relative; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.mine .bubble { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; border-bottom-right-radius: 5px; }
.msg.theirs .bubble { border-bottom-left-radius: 5px; }
.msg.grouped.mine .bubble { border-bottom-right-radius: 16px; }
.msg .meta { font-size: .66rem; color: var(--muted); padding: 0 6px; display: flex; gap: 6px; align-items: center; }
.msg.mine .meta { justify-content: flex-end; }
.msg img.media { max-width: 240px; max-height: 280px; border-radius: 12px; display: block; cursor: pointer; }
.msg video.media { max-width: 260px; max-height: 300px; border-radius: 12px; display: block; background: #000; }
.msg audio.audio { display: block; max-width: 260px; margin: 2px 0; }
.msg .deleted { font-style: italic; opacity: .7; }

/* carte fichier / dossier telechargeable */
.file-card { display: flex; align-items: center; gap: 10px; min-width: 190px; max-width: 300px; padding: 9px 11px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .15s; }
.file-card:hover { background: rgba(0,0,0,.28); }
.msg.mine .file-card { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.22); }
.msg.mine .file-card:hover { background: rgba(255,255,255,.25); }
.file-card .file-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.12); }
.file-card .file-ic .ic { width: 18px; height: 18px; }
.file-card .file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-card .file-name { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-card .file-sub { opacity: .8; }
.file-card .file-dl { flex: none; opacity: .8; }
.file-card .file-dl .ic { width: 17px; height: 17px; }

/* overlay glisser-deposer */
#chat-active { position: relative; }
.drop-overlay { position: absolute; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, rgba(0,0,0,.55)); backdrop-filter: blur(4px); border: 3px dashed var(--accent); border-radius: 18px; pointer-events: none; }
.drop-overlay .drop-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 1.05rem; font-weight: 600; color: #fff; text-align: center; }
.drop-overlay .drop-ic { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--accent); }
.drop-overlay .drop-ic .ic { width: 28px; height: 28px; }
.drop-overlay b { color: var(--accent-3, #58f0ff); }
.tick.read { color: #7fe3ff; }
.edited-tag { opacity: .7; }

/* reply quote dans la bulle */
.reply-quote { border-left: 3px solid rgba(255,255,255,.6); padding: 3px 8px; margin-bottom: 5px; font-size: .82rem; opacity: .85; border-radius: 4px; background: rgba(0,0,0,.14); }
.msg.theirs .reply-quote { border-left-color: var(--accent); }

/* barre d'actions au survol */
.msg-actions { position: absolute; top: -14px; display: none; gap: 2px; background: var(--glass-3); border: 1px solid var(--border); border-radius: 12px; padding: 3px; backdrop-filter: blur(12px); z-index: 3; }
.msg.mine .msg-actions { right: 0; }
.msg.theirs .msg-actions { left: 0; }
.msg:hover .msg-actions { display: flex; }
.msg-actions button { background: none; border: none; cursor: pointer; font-size: .95rem; padding: 3px 5px; border-radius: 8px; }
.msg-actions button:hover { background: var(--glass-2); }

/* reactions */
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin: 2px 4px 0; }
.reaction { background: var(--glass-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: .78rem; cursor: pointer; display: flex; gap: 3px; align-items: center; }
.reaction.own { border-color: var(--accent); background: rgba(94,173,255,.18); }

/* mini palette reactions */
.react-pop { position: absolute; top: -46px; display: flex; gap: 2px; background: var(--glass-3); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px; backdrop-filter: blur(14px); z-index: 5; box-shadow: var(--shadow); }
.msg.mine .react-pop { right: 0; } .msg.theirs .react-pop { left: 0; }
.react-pop span { font-size: 1.25rem; cursor: pointer; padding: 1px 3px; border-radius: 8px; transition: transform .1s; }
.react-pop span:hover { transform: scale(1.3); }

.typing { padding: 2px 20px 8px; }
.typing-pill { display: inline-flex; align-items: center; gap: 9px; background: var(--bubble); border: 1px solid var(--border); border-radius: 16px; border-bottom-left-radius: 5px; padding: 8px 13px; font-size: .78rem; color: var(--muted); }
.typing-pill .dots { display: inline-flex; gap: 4px; }
.typing-pill .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; animation: td 1.3s infinite ease-in-out; }
.typing-pill .dots i:nth-child(2) { animation-delay: .18s; }
.typing-pill .dots i:nth-child(3) { animation-delay: .36s; }
@keyframes td { 0%, 65%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-5px); opacity: 1; } }
.reply-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border: none; border-top: 1px solid var(--border); }
.reply-bar-txt { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.reply-to-name { font-size: .78rem; font-weight: 700; color: var(--accent); }
.reply-to-text { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: flex; align-items: center; gap: 7px; padding: 11px 13px; border: none; border-top: 1px solid var(--border); }

/* ---------- Panneau infos ---------- */
.info-panel { border-radius: var(--radius); padding: 18px; overflow-y: auto; position: relative; text-align: center; }
.ip-banner { height: 110px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--accent), var(--accent-2)); background-size: cover; background-position: center; margin-bottom: -50px; }
.ip-avatar { margin: 0 auto; border: 4px solid var(--bg-1); position: relative; }
.ip-actions { display: flex; gap: 10px; margin-top: 18px; }
.ip-actions .btn { flex: 1; }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.5); backdrop-filter: blur(6px); }
.modal-card { width: min(480px, 94vw); max-height: 90vh; overflow-y: auto; padding: 24px; border-radius: var(--radius); position: relative; }
.modal-card h2 { margin-bottom: 14px; }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.profile-banner { height: 120px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--accent), var(--accent-2)); background-size: cover; background-position: center; position: relative; margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px; }
.banner-edit { background: rgba(0,0,0,.45); color: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; cursor: pointer; font-size: .8rem; }
.profile-avatar-row { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.accent-row { display: flex; align-items: center; gap: 12px; }
.color-input { width: 54px; height: 40px; border: none; background: none; cursor: pointer; }
.swatches { display: flex; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch:hover { transform: scale(1.12); }

/* ---------- Panneaux docks (emoji / gif en bas) ---------- */
.dock-panel { position: fixed; z-index: 45; bottom: 84px; left: 352px; width: 374px; max-height: 384px; border-radius: 20px; padding: 12px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; box-shadow: var(--shadow); animation: dockUp .18s ease; }
.dock-wide { width: 448px; }
@keyframes dockUp { from { opacity: 0; transform: translateY(14px); } }
.dock-head { display: flex; flex-direction: column; gap: 8px; }
.dock-search { position: relative; }
.dock-search .search { padding-left: 34px; }
.dock-foot { text-align: right; letter-spacing: .5px; opacity: .5; }
.dock-cat-name { text-transform: uppercase; letter-spacing: 1px; font-size: .68rem; padding: 0 2px; }

.giphy-tabs { display: flex; gap: 8px; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 7px 16px; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.tab.active { background: var(--glass-3); color: var(--text); border-color: var(--accent); }
.giphy-masonry { column-count: 2; column-gap: 8px; overflow-y: auto; flex: 1; }
.giphy-masonry img { width: 100%; border-radius: 12px; cursor: pointer; margin-bottom: 8px; transition: transform .12s, box-shadow .2s; background: var(--glass-2); display: block; }
.giphy-masonry img:hover { transform: scale(1.03); box-shadow: 0 6px 18px rgba(0,0,0,.35); }

.emoji-cats { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.emoji-cats button { background: none; border: none; font-size: 1.25rem; cursor: pointer; padding: 5px 7px; border-radius: 10px; opacity: .55; flex-shrink: 0; transition: opacity .15s, background .15s; }
.emoji-cats button:hover { opacity: .85; }
.emoji-cats button.active { background: var(--glass-3); opacity: 1; box-shadow: inset 0 -2px 0 var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; overflow-y: auto; flex: 1; align-content: start; }
.emoji-grid .emoji { font-size: 1.45rem; cursor: pointer; text-align: center; padding: 3px 0; border-radius: 8px; background: none; border: none; line-height: 1.25; transition: transform .1s, background .12s; }
.emoji-grid .emoji:hover { background: var(--glass-2); transform: scale(1.18); }

/* ---------- Appel ---------- */
/* Fenêtre d'appel : flottante, déplaçable, NON bloquante (le reste de l'app reste utilisable). */
.call-overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.call-window { pointer-events: auto; position: absolute; right: 22px; bottom: 22px; width: min(440px, 92vw); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.call-topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: grab; background: var(--glass-2); border-bottom: 1px solid var(--border); user-select: none; touch-action: none; }
.call-topbar:active { cursor: grabbing; }
.call-live { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: pulse 1.5s infinite; flex-shrink: 0; }
.call-peer-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.call-status { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.call-timer { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; font-size: .85rem; }
.call-topbar-btns { display: flex; gap: 6px; }
.call-videos { position: relative; overflow: hidden; background: #04040a; aspect-ratio: 16/10; }
.remote-video { width: 100%; height: 100%; object-fit: contain; background: #04040a; }
.call-avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.local-video { position: absolute; right: 12px; bottom: 12px; width: 132px; aspect-ratio: 16/10; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); background: #000; }
.call-controls { display: flex; justify-content: center; gap: 12px; padding: 12px; background: var(--glass-2); border-top: 1px solid var(--border); }
.control { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); background: var(--glass-3); color: var(--text); cursor: pointer; transition: transform .12s, background .2s; display: grid; place-items: center; }
.control:hover { transform: translateY(-3px); }
.control.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.control.off { opacity: .5; }
.control.danger { background: linear-gradient(135deg, #ff5d6c, #ff3860); border: none; color: #fff; }
/* Mode réduit */
.call-window.mini { width: 248px; }
.call-window.mini .call-videos { aspect-ratio: 4/3; }
.call-window.mini .call-controls { padding: 8px; gap: 8px; }
.call-window.mini .control { width: 42px; height: 42px; }
.call-window.mini .control .ic { width: 20px; height: 20px; }
.call-window.mini .local-video { width: 80px; }

.incoming { text-align: center; }
.incoming .avatar { margin: 0 auto; }
.incoming h2 { margin: 14px 0 4px; }
.incoming-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }
.incoming-actions .btn { flex: 1; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.85); cursor: zoom-out; padding: 30px; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 14px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 12px 22px; border-radius: 14px; background: var(--glass-3); backdrop-filter: blur(20px); border: 1px solid var(--border); box-shadow: var(--shadow); animation: toastIn .3s ease; max-width: 90vw; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .app.info-open { grid-template-columns: 1fr; }
  .sidebar { position: absolute; inset: 8px; z-index: 20; }
  .app.chat-open .sidebar { display: none; }
  .app:not(.chat-open) .chat { display: none; }
  .info-panel { position: absolute; inset: 8px; z-index: 30; }
  .back-btn { display: grid; }
  .dock-panel { left: 8px; right: 8px; width: auto; bottom: 78px; }
  .msg { max-width: 86%; }
  .local-video { width: 118px; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(150,150,180,.35); border-radius: 8px; }

/* =========================================================================
   AURORA v2 — statuts, groupes, sondages, vocaux, épingles, favoris,
   recherche globale, galerie, appels caméra + partage simultanés.
   ========================================================================= */

/* ---------- Barre latérale : présence, onglets ---------- */
.presence-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--glass-2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; font-size: .72rem; color: var(--muted); cursor: pointer; }
.presence-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok, #35d99a); }
.presence-pill[data-p="away"] .dot { background: #ffca4f; }
.presence-pill[data-p="dnd"] .dot { background: #ff5d6c; }
.presence-pill[data-p="invisible"] .dot { background: #6b7191; }

.tabs { display: flex; gap: 4px; background: rgba(0,0,0,.16); padding: 4px; border-radius: 13px; }
.tab-btn { flex: 1; background: none; border: none; color: var(--muted); font-weight: 650; font-size: .78rem; padding: 7px 4px; border-radius: 10px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.tab-btn.active { background: var(--glass-3); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.pane { display: block; }
.sidebar-foot { display: flex; gap: 8px; align-items: center; }
.sidebar-foot .btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.sidebar-foot .ic { width: 17px; height: 17px; }

/* ---------- Bandeau statuts ---------- */
.stories-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; }
.story-chip { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; flex-shrink: 0; width: 62px; }
.story-ring { width: 56px; height: 56px; border-radius: 50%; padding: 2.5px; background: conic-gradient(from 210deg, var(--accent), var(--accent-2), #58f0ff, var(--accent)); display: grid; place-items: center; }
.story-ring.seen { background: var(--glass-3); }
.story-ring .avatar { width: 100%; height: 100%; border: 2px solid var(--bg-1); }
.story-chip .lbl { font-size: .66rem; color: var(--muted); max-width: 62px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.story-add .story-ring { background: var(--glass-3); position: relative; }
.story-add .plus { position: absolute; right: -1px; bottom: -1px; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #fff; border: 2px solid var(--bg-1); }
.story-add .plus .ic { width: 12px; height: 12px; }

.stories-list { display: flex; flex-direction: column; gap: 6px; }
.story-row { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: var(--radius-sm); cursor: pointer; }
.story-row:hover { background: var(--glass-2); }
.story-row .story-ring { width: 48px; height: 48px; }

/* ---------- Liste conversations : badges ---------- */
.conv .conv-tags { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }
.conv .conv-tags .ic { width: 13px; height: 13px; opacity: .6; }
.conv.muted-conv .preview { opacity: .65; }
.conv .group-badge { font-size: .6rem; background: var(--glass-3); border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; color: var(--muted); }

/* ---------- Recherche globale ---------- */
.search-results { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.sr-item { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 12px; cursor: pointer; background: var(--glass); border: 1px solid var(--border); }
.sr-item:hover { background: var(--glass-2); }
.sr-head { display: flex; justify-content: space-between; gap: 8px; font-size: .76rem; }
.sr-who { font-weight: 700; }
.sr-text { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-text mark { background: color-mix(in srgb, var(--accent) 40%, transparent); color: inherit; border-radius: 3px; }
.sr-empty { padding: 16px; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---------- Favoris ---------- */
.starred-list { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Chat : fond d'écran, épingle, éphémère ---------- */
.chat-wallpaper { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .28; pointer-events: none; z-index: 0; }
/* Le fond d'écran est derrière : on remonte les enfants SANS toucher à leur
   positionnement (sinon les overlays absolus — dépôt de fichiers, bouton "aller
   en bas", suggestions de mention, barre de sélection — se retrouvaient collés
   dans le flux). */
.chat-active > *:not(.chat-wallpaper) { z-index: 1; }
.chat-active > .chat-header,
.chat-active > .pinned-bar,
.chat-active > .ephemeral-bar,
.chat-active > .messages,
.chat-active > .typing,
.chat-active > .reply-bar,
.chat-active > .composer,
.chat-active > .recorder { position: relative; }
.pinned-bar { display: flex; align-items: center; gap: 10px; padding: 7px 14px; background: color-mix(in srgb, var(--accent) 14%, transparent); border-bottom: 1px solid var(--border); cursor: pointer; }
.pinned-bar .ic { width: 16px; height: 16px; color: var(--accent); flex: none; }
.pinned-text { flex: 1; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ephemeral-bar { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 5px; font-size: .74rem; color: var(--muted); background: rgba(0,0,0,.16); }
.ephemeral-bar .ic { width: 14px; height: 14px; }

.scroll-bottom { position: absolute; right: 20px; bottom: 92px; z-index: 6; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-3); border: 1px solid var(--border); backdrop-filter: blur(14px); cursor: pointer; color: var(--text); }
.scroll-bottom .ic { width: 20px; height: 20px; }

/* ---------- Messages : nouveaux blocs ---------- */
.msg.highlight .bubble { animation: hl 1.6s ease; }
@keyframes hl { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.msg .fwd-tag { font-size: .68rem; opacity: .7; display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
.msg .fwd-tag .ic { width: 12px; height: 12px; }
.msg .pin-tag { font-size: .66rem; opacity: .75; display: inline-flex; align-items: center; gap: 3px; }
.msg .pin-tag .ic { width: 11px; height: 11px; }
.mention { background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 5px; padding: 0 3px; font-weight: 650; }
.msg .reply-quote { cursor: pointer; }

/* aperçu de lien */
.link-card { display: block; margin-top: 6px; border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.2); border: 1px solid var(--border); text-decoration: none; color: inherit; max-width: 300px; }
.msg.mine .link-card { background: rgba(255,255,255,.14); }
.link-card img { width: 100%; max-height: 150px; object-fit: cover; display: block; }
.link-card .lc-body { padding: 8px 10px; }
.link-card .lc-title { font-weight: 650; font-size: .84rem; }
.link-card .lc-desc { font-size: .74rem; opacity: .78; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-card .lc-site { font-size: .66rem; opacity: .6; text-transform: uppercase; letter-spacing: .5px; }

/* message vocal */
.voice { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 280px; padding: 2px 0; }
.voice button.vplay { width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(255,255,255,.2); color: inherit; display: grid; place-items: center; cursor: pointer; flex: none; }
.msg.theirs .voice button.vplay { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.voice .vplay .ic { width: 17px; height: 17px; }
.voice .vwave { flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.voice .vwave i { flex: 1; min-width: 2px; background: currentColor; opacity: .3; border-radius: 2px; transition: opacity .1s; }
.voice .vwave i.on { opacity: .95; }
.voice .vtime { font-size: .7rem; opacity: .8; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.voice .vspeed { font-size: .64rem; border: 1px solid currentColor; opacity: .7; border-radius: 6px; padding: 1px 5px; cursor: pointer; background: none; color: inherit; }

/* sondage */
.poll { min-width: 240px; max-width: 320px; }
.poll .pq { font-weight: 700; margin-bottom: 8px; }
.poll .popt { position: relative; border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; margin-bottom: 6px; cursor: pointer; overflow: hidden; font-size: .85rem; }
.poll .popt .fill { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 32%, transparent); width: 0; transition: width .4s ease; }
.msg.mine .poll .popt .fill { background: rgba(255,255,255,.28); }
.poll .popt .lbl, .poll .popt .pct { position: relative; }
.poll .popt { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.poll .popt.voted { border-color: var(--accent); font-weight: 650; }
.poll .pfoot { font-size: .7rem; opacity: .7; }

/* vue unique */
.once-card { display: flex; align-items: center; gap: 10px; padding: 4px 2px; cursor: pointer; }
.once-card .oc-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.once-card .oc-ic .ic { width: 17px; height: 17px; }
.once-card.used { opacity: .6; cursor: default; }

/* enregistreur vocal */
.recorder { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--glass-2); }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger, #ff5d6c); animation: pulse 1.1s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-size: .84rem; min-width: 42px; }
.rec-wave { flex: 1; height: 40px; }

/* menu joindre */
.attach-menu { width: 268px; padding: 8px; gap: 2px; }
.attach-opt { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none; color: var(--text); padding: 9px 10px; border-radius: 12px; cursor: pointer; font-size: .9rem; font-weight: 600; text-align: left; }
.attach-opt:hover { background: var(--glass-2); }
.ao-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; }
.ao-ic .ic { width: 17px; height: 17px; }
.grad1 { background: linear-gradient(135deg, #7C5CFF, #4FA8FF); }
.grad2 { background: linear-gradient(135deg, #34D399, #4FA8FF); }
.grad3 { background: linear-gradient(135deg, #FF6FB5, #FF9D5C); }
.grad4 { background: linear-gradient(135deg, #FBBF24, #FF6FB5); }
.grad5 { background: linear-gradient(135deg, #22D3EE, #7C5CFF); }
.pill { margin-left: auto; font-size: .66rem; background: var(--glass-3); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.pill.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none; }

/* mentions */
.mention-pop { position: absolute; bottom: 74px; left: 18px; z-index: 30; background: var(--glass-3); backdrop-filter: blur(20px); border: 1px solid var(--border); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); min-width: 190px; }
.mention-pop button { display: flex; align-items: center; gap: 9px; width: 100%; background: none; border: none; color: var(--text); padding: 7px 9px; border-radius: 10px; cursor: pointer; text-align: left; }
.mention-pop button:hover, .mention-pop button.sel { background: var(--glass-2); }
.mention-pop .avatar { width: 28px; height: 28px; font-size: .8rem; }

/* menu contextuel générique */
.ctx-menu { position: fixed; z-index: 80; min-width: 210px; background: var(--glass-3); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: 15px; padding: 6px; box-shadow: var(--shadow); animation: dockUp .14s ease; max-height: 80vh; overflow-y: auto; }
.ctx-menu button { display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none; color: var(--text); padding: 9px 11px; border-radius: 11px; cursor: pointer; font-size: .87rem; font-weight: 600; text-align: left; }
.ctx-menu button:hover { background: var(--glass-2); }
.ctx-menu button.danger { color: var(--danger, #ff5d6c); }
.ctx-menu button .ic { width: 17px; height: 17px; flex: none; opacity: .85; }
.ctx-menu .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.ctx-menu .ctx-title { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 6px 11px 3px; }

/* sélecteur de réactions */
.react-picker { position: fixed; z-index: 85; background: var(--glass-3); backdrop-filter: blur(24px); border: 1px solid var(--border); border-radius: 16px; padding: 8px; box-shadow: var(--shadow); width: 300px; }
.react-picker .quick { display: flex; gap: 3px; justify-content: space-between; margin-bottom: 6px; }
.react-picker .quick span { font-size: 1.5rem; cursor: pointer; padding: 2px 4px; border-radius: 9px; transition: transform .1s; }
.react-picker .quick span:hover { transform: scale(1.28); background: var(--glass-2); }
.react-picker .all { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; max-height: 190px; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 6px; }
.react-picker .all span { font-size: 1.25rem; cursor: pointer; text-align: center; padding: 2px 0; border-radius: 7px; }
.react-picker .all span:hover { background: var(--glass-2); }

/* ---------- Panneau infos : onglets + galerie ---------- */
.ip-tabs { display: flex; gap: 4px; background: rgba(0,0,0,.16); padding: 4px; border-radius: 12px; margin-top: 16px; }
.ip-tab { flex: 1; background: none; border: none; color: var(--muted); font-weight: 650; font-size: .74rem; padding: 6px 2px; border-radius: 9px; cursor: pointer; }
.ip-tab.active { background: var(--glass-3); color: var(--text); }
.ip-content { margin-top: 12px; text-align: left; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.media-grid img, .media-grid video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; cursor: pointer; background: #000; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.setting-row:last-child { border-bottom: none; }
.switch { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--glass-3); border: 1px solid var(--border); cursor: pointer; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch.on::after { transform: translateX(18px); }
.mini-select { background: var(--glass-2); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 5px 8px; font-size: .8rem; }

.gp-members { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.gp-member { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); cursor: pointer; }
.gp-member.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.forward-list { display: flex; flex-direction: column; gap: 5px; max-height: 46vh; overflow-y: auto; }
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-options .po-row { display: flex; gap: 6px; }
.poll-options input { flex: 1; }
.toggle-row { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: .86rem; color: var(--muted); }
.full { width: 100%; }

/* ---------- Statuts : composition + visionneuse ---------- */
.story-kinds { display: flex; gap: 8px; margin-bottom: 12px; }
.story-kind { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--glass-2); border: 1px solid var(--border); color: var(--muted); padding: 9px; border-radius: 12px; cursor: pointer; font-weight: 650; font-size: .85rem; }
.story-kind.active { border-color: var(--accent); color: var(--text); background: var(--glass-3); }
.story-preview { margin: 10px 0; border-radius: 14px; overflow: hidden; max-height: 220px; display: grid; place-items: center; background: rgba(0,0,0,.25); }
.story-preview img, .story-preview video { max-width: 100%; max-height: 220px; }

.story-viewer { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.94); display: flex; flex-direction: column; }
.sv-bars { display: flex; gap: 4px; padding: 12px 14px 0; }
.sv-bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.sv-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.sv-head { display: flex; align-items: center; gap: 11px; padding: 12px 14px; }
.sv-meta { flex: 1; display: flex; flex-direction: column; }
.sv-body { flex: 1; display: grid; place-items: center; padding: 10px; overflow: hidden; }
.sv-body img, .sv-body video { max-width: 100%; max-height: 100%; border-radius: 16px; }
.sv-text { width: min(520px, 92vw); min-height: 260px; border-radius: 20px; display: grid; place-items: center; padding: 30px; text-align: center; font-size: 1.5rem; font-weight: 700; color: #fff; }
.sv-foot { padding: 10px 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.sv-reacts { display: flex; gap: 6px; justify-content: center; }
.sv-reacts span { font-size: 1.5rem; cursor: pointer; transition: transform .1s; }
.sv-reacts span:hover { transform: scale(1.3); }
.sv-reply { display: flex; gap: 8px; align-items: center; }
.sv-views { text-align: center; }
.sv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.12); border: none; color: #fff; display: grid; place-items: center; cursor: pointer; }
.sv-prev { left: 14px; } .sv-next { right: 14px; }

/* ---------- Appel v2 : scène + vignettes ---------- */
.call-videos { position: relative; overflow: hidden; background: #04040a; aspect-ratio: 16/10; }
.stage-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #04040a; }
.stage-video.cover { object-fit: cover; }
.call-avatar { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.call-avatar #call-avatar-name { font-weight: 700; }
.tiles { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; z-index: 3; }
.tile { position: relative; width: 128px; aspect-ratio: 16/10; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #000; box-shadow: var(--shadow); display: none; }
.tile.show { display: block; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile#tile-local-screen video, .tile#tile-remote-cam.contain video { object-fit: contain; }
.tile-label { position: absolute; left: 5px; bottom: 4px; font-size: .6rem; background: rgba(0,0,0,.55); border-radius: 5px; padding: 1px 5px; color: #fff; }
.tile-mask { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 8px; border: none; background: rgba(0,0,0,.5); color: #fff; display: grid; place-items: center; cursor: pointer; }
.tile-mask .ic { width: 14px; height: 14px; }
.tile-mask.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.tile.masked video { filter: blur(18px) brightness(.35); }
.tile.masked::after { content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.3rem; }
.mask-notice { position: absolute; left: 10px; top: 10px; z-index: 4; display: flex; gap: 9px; align-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 12px; padding: 8px 11px; max-width: 250px; }
.mask-notice .ic { width: 18px; height: 18px; color: var(--accent); flex: none; }
.mask-notice div { display: flex; flex-direction: column; font-size: .76rem; }
.call-quality { font-size: .68rem; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.call-quality .bars { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 12px; }
.call-quality .bars i { width: 3px; background: currentColor; opacity: .25; border-radius: 1px; }
.call-quality .bars i:nth-child(1) { height: 4px; } .call-quality .bars i:nth-child(2) { height: 7px; }
.call-quality .bars i:nth-child(3) { height: 10px; } .call-quality .bars i:nth-child(4) { height: 12px; }
.call-quality.q1 .bars i:nth-child(-n+1), .call-quality.q2 .bars i:nth-child(-n+2),
.call-quality.q3 .bars i:nth-child(-n+3), .call-quality.q4 .bars i:nth-child(-n+4) { opacity: 1; }
.call-quality.q1 { color: #ff5d6c; } .call-quality.q2 { color: #ffca4f; }
.call-quality.q3, .call-quality.q4 { color: #35d99a; }
.call-window.fullscreen { position: fixed; inset: 0; width: 100vw; height: 100vh; border-radius: 0; }
.call-window.fullscreen .call-videos { aspect-ratio: auto; flex: 1; }
.call-window.mini .tile { width: 74px; }
.call-window.mini .mask-notice { display: none; }

/* ---------- Lightbox v2 ---------- */
.lightbox { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(0,0,0,.9); padding: 30px; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 88vh; border-radius: 14px; }
.lightbox-close { position: absolute; top: 18px; right: 18px; }
.lightbox-dl { position: absolute; top: 18px; right: 70px; text-decoration: none; }

/* ---------- Panneaux dock v2 : ne débordent JAMAIS de l'écran ---------- */
.dock-panel {
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  max-height: min(52vh, 400px);
  height: auto;
}
/* Sur les fenêtres/écrans courts, le panneau se réduit au lieu de sortir en haut. */
@media (max-height: 620px) {
  .dock-panel { max-height: calc(100dvh - 132px); bottom: 78px; }
}
.emoji-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.emoji-cats { flex: none; }
.emoji-grid { grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); overflow: visible; flex: none; }
.emoji-grid .emoji { padding: 4px 0; }
.emoji-grid .emoji.sel { background: var(--glass-3); outline: 1px solid var(--accent); }
.emoji-sec { font-size: .66rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 6px 2px 0; }
#emoji-panel .dock-search { flex: none; }
.giphy-masonry { min-height: 0; }

/* ---------- Formatage riche + spoilers ---------- */
.msg .bubble code { background: rgba(0,0,0,.32); border-radius: 5px; padding: 1px 5px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .86em; }
.msg.mine .bubble code { background: rgba(255,255,255,.22); }
.msg .bubble pre { background: rgba(0,0,0,.32); border-radius: 10px; padding: 9px 11px; overflow-x: auto; margin: 4px 0; }
.msg.mine .bubble pre { background: rgba(255,255,255,.16); }
.msg .bubble pre code { background: none; padding: 0; }
.spoiler { background: currentColor; border-radius: 5px; cursor: pointer; transition: background .18s, color .18s; }
.spoiler > * , .spoiler { color: inherit; }
.spoiler:not(.revealed) { color: transparent !important; background: #6b7191; text-shadow: none; }
.spoiler.revealed { background: rgba(255,255,255,.12); }

/* ---------- Sélection multiple ---------- */
.app.select-mode .msg .msg-actions { display: none !important; }
.msg.selected .bubble { outline: 2px solid var(--accent); }
.select-bar { position: absolute; left: 0; right: 0; top: 0; z-index: 12; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--glass-3); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.select-bar .count { font-weight: 750; flex: 1; }

/* ---------- Lightbox : zoom + navigation ---------- */
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.14); border: none; color: #fff; display: grid; place-items: center; cursor: pointer; }
.lightbox-prev { left: 18px; } .lightbox-next { right: 18px; }
#lightbox-content { display: grid; place-items: center; overflow: hidden; }
#lightbox-content img { transition: transform .12s ease-out; cursor: grab; }
.lightbox-hint { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: .72rem; color: rgba(255,255,255,.55); }

/* ---------- Bandeau réseau + messages en attente ---------- */
.net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 95; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 7px 14px; font-size: .8rem; font-weight: 650; color: #fff; background: linear-gradient(90deg, #ff8a4f, #ff5d6c); box-shadow: 0 4px 18px rgba(0,0,0,.35); animation: netIn .25s ease; }
@keyframes netIn { from { transform: translateY(-100%); } }
.net-banner.ok { background: linear-gradient(90deg, #35d99a, #22d3ee); }
.net-banner .spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .8s linear infinite; }
.net-banner.ok .spin { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.msg.pending .bubble { opacity: .62; }
.msg.failed .bubble { outline: 1.5px solid var(--danger, #ff5d6c); }
.msg .retry { background: none; border: none; color: var(--danger, #ff5d6c); cursor: pointer; font-size: .66rem; text-decoration: underline; padding: 0; }

@media (max-width: 820px) {
  .tabs .tab-btn { font-size: .7rem; padding: 6px 2px; }
  .tile { width: 96px; }
  .mention-pop { left: 8px; right: 8px; }
}

/* ---------- Diagnostic d'appel ---------- */
.call-diag { position: absolute; left: 10px; top: 10px; z-index: 6; background: rgba(0,0,0,.72); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; font-size: .68rem; line-height: 1.55; max-width: 260px; font-variant-numeric: tabular-nums; }
.call-diag .dg-t { font-weight: 800; font-size: .72rem; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.call-diag table { border-collapse: collapse; width: 100%; }
.call-diag td { padding: 1px 4px 1px 0; white-space: nowrap; }
.call-diag .ok { color: #35d99a; } .call-diag .ko { color: #ff5d6c; } .call-diag .na { color: var(--muted); }
.call-diag .dg-foot { margin-top: 5px; color: var(--muted); }
.call-quality { cursor: pointer; }

/* ---------- Sélecteur de thèmes (profil) ---------- */
.theme-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
.theme-dot { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; position: relative; flex: none; }
.theme-dot.sel { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.18); }
.theme-dot:hover { transform: scale(1.08); }

/* =========================================================================
   POLISH v5 — dock d'appel flottant, retours tactiles, surfaces thémées
   ========================================================================= */

/* Le dock de contrôles flotte PAR-DESSUS la vidéo au lieu de couper la
   fenêtre en trois tranches empilées. */
.call-controls {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 6; display: flex; gap: 10px; padding: 9px 13px; border-radius: 999px;
  background: rgba(10,10,22,.55);
  backdrop-filter: blur(22px) saturate(170%); -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 18px 50px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.2);
}
.control { width: 50px; height: 50px; }
.call-controls .control.danger { width: 78px; border-radius: 999px; margin-left: 6px; box-shadow: 0 10px 26px rgba(255,61,96,.5); }
.tiles { bottom: 78px; }
.call-window.mini .call-controls { bottom: 8px; gap: 6px; padding: 6px 9px; }
.call-window.mini .call-controls .control.danger { width: 58px; }
.call-window.mini .tiles { bottom: 62px; }
.call-videos { aspect-ratio: 16/10; }

/* Retour tactile : tous les boutons s'enfoncent à l'appui (indispensable sur
   mobile où :hover reste "collé" après un tap). */
.btn:active, .icon-btn:active, .control:active, .tab-btn:active,
.ip-tab:active, .tab:active, .attach-opt:active, .conv:active,
.theme-dot:active, .emoji:active {
  transform: translateY(0) scale(.94);
  transition-duration: .06s;
}
@media (hover: none) {
  .icon-btn:hover, .btn:hover, .control:hover, .conv:hover { transform: none; }
}

/* Surfaces "creusées" : un jeton par thème au lieu du noir en dur, sinon
   elles deviennent des taches sombres en thème clair. */
:root, [data-theme="dark"] { --sunken: rgba(0,0,0,.20); --sunken-2: rgba(0,0,0,.32); }
[data-theme="light"] { --sunken: rgba(24,30,70,.06); --sunken-2: rgba(24,30,70,.10); }
.tabs, .ip-tabs { background: var(--sunken); }
.file-card { background: var(--sunken); }
.file-card:hover { background: var(--sunken-2); }
.ephemeral-bar { background: var(--sunken); }
.link-card { background: var(--sunken); }
.msg .bubble code, .msg .bubble pre { background: var(--sunken-2); }
.glass-input { background: var(--sunken); }

/* Apparition douce des nouveaux messages. */
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.messages .msg { animation: msgIn .22s cubic-bezier(.2,.8,.3,1); }
@media (prefers-reduced-motion: reduce) { .messages .msg { animation: none; } }

/* Citations `> …` : sans regle dediee le marqueur disparaissait sans rien
   laisser voir, alors que le mobile affiche bien une barre verticale. */
.msg .bubble blockquote {
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: 9px; margin: 3px 0; opacity: .88;
}
.msg.mine .bubble blockquote { border-left-color: rgba(255,255,255,.6); }

/* Camera du correspondant floutee quand elle occupe la SCENE (et pas seulement
   la vignette) : sinon un partage d'ecran entier la lui renvoie en grand. */
.stage-video.masked-stage { filter: blur(26px) brightness(.35); }

/* =========================================================================
   POLISH v5.1 — conversation active, onglets, vignettes, fenetre d'appel
   ========================================================================= */

/* La conversation ACTIVE se distingue franchement du survol : barre d'accent
   animee + fond teinte, au lieu de deux gris quasi identiques. */
.conv { position: relative; transition: background .18s, transform .1s; }
.conv::before {
  content: ""; position: absolute; left: 3px; top: 50%; translate: 0 -50%;
  width: 3px; height: 0; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  transition: height .24s cubic-bezier(.22,1,.36,1);
}
.conv:active { transform: scale(.985); }
.conv.active { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 72%); }
.conv.active::before { height: 58%; }

/* Onglet actif : rappel d'accent + transition de panneau. */
.tab-btn { transition: background .15s, color .15s, transform .12s; }
.tab-btn.active, .ip-tab.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 32%, var(--glass-3)), var(--glass-3));
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.2);
}
@keyframes paneIn { from { opacity: 0; transform: translateY(7px); } }
@media (prefers-reduced-motion: no-preference) {
  .pane:not(.hidden) { animation: paneIn .22s cubic-bezier(.22,1,.36,1); }
}

/* Vignettes d'appel : plus grandes, bordure visible, survol qui invite au clic,
   libelle lisible. */
.tile {
  width: 150px; border-radius: 14px; border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 10px 30px rgba(0,0,0,.55); cursor: pointer;
  transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s, border-color .18s;
}
.tile:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 42px rgba(0,0,0,.65);
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
}
.tile-label {
  font-size: .68rem; font-weight: 600; letter-spacing: .2px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  border-radius: 7px; padding: 2px 7px; color: #fff;
}
.call-window.mini .tile { width: 92px; }

/* La fenetre d'appel entre en scene comme le reste de l'app. */
@keyframes callIn { from { opacity: 0; transform: translateY(26px) scale(.95); } }
.call-window {
  animation: callIn .34s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 30px 90px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.18);
}
@media (prefers-reduced-motion: reduce) {
  .call-window, .pane:not(.hidden) { animation: none; }
}

/* =========================================================================
   CONTRASTE — audit WCAG (texte lisible sur toutes les palettes)
   -------------------------------------------------------------------------
   Probleme de fond : les accents sont des couleurs CLAIRES (bleu, cyan, vert,
   orange). Du texte blanc pose dessus tombait entre 1,7:1 et 2,6:1, tres loin
   du minimum de 4,5:1. On introduit donc une variante ASSOMBRIE de l'accent,
   reservee aux surfaces qui portent du texte, et un jeton --sur-accent.
   ========================================================================= */
:root {
  /* 62 % d'accent + 38 % de noir profond : la teinte reste reconnaissable,
     le blanc repasse au-dessus de 4,5:1 sur les 7 palettes. */
  --accent-txt: color-mix(in srgb, var(--accent) 55%, #05050c);
  --accent-2-txt: color-mix(in srgb, var(--accent-2) 55%, #05050c);
  --sur-accent: #ffffff;
  --degrade-txt: linear-gradient(135deg, var(--accent-txt), var(--accent-2-txt));
  /* Etats : les versions vives sont reservees aux pastilles sans texte. */
  --danger-txt: #b3121f;
  --ok-txt: #0c6b48;
  --warn-txt: #7a5200;
}

/* --- Surfaces porteuses de texte blanc ---------------------------------- */
.msg.mine .bubble { background: var(--degrade-txt); }
.btn.accent, .icon-btn.accent, .btn-accent, .cta { background: var(--degrade-txt); color: var(--sur-accent); }
.attach-opt .grad1, .attach-opt .grad2, .attach-opt .grad3,
.attach-opt .grad4, .attach-opt .grad5,
.grad1, .grad2, .grad3, .grad4, .grad5 { filter: saturate(1.05) brightness(.78); }
.sv-text { text-shadow: 0 2px 10px rgba(0,0,0,.75), 0 0 3px rgba(0,0,0,.6); }

/* Textes secondaires DANS la bulle envoyee : le blanc a 55-70 % tombait a
   1,7:1. On garde du blanc franc, legerement adouci seulement. */
.msg.mine .meta, .msg.mine .bubble .edited-tag,
.msg.mine .bubble small, .msg.mine .bubble .sub { color: rgba(255,255,255,.92); }
.msg.mine .tick, .msg.mine .tick.read { color: #d6f4ff; }
.msg.mine .bubble code, .msg.mine .bubble pre { background: rgba(0,0,0,.30); color: #fff; }
.msg.mine .poll-fill { background: rgba(0,0,0,.32); }
.msg.mine .file-card { background: rgba(0,0,0,.24); border-color: rgba(255,255,255,.45); }
.msg.mine .file-card:hover { background: rgba(0,0,0,.34); }
.msg.mine .file-card .file-ic { background: rgba(0,0,0,.3); }
.msg.mine .ag { background: rgba(0,0,0,.26); }

/* --- Boutons d'action forte -------------------------------------------- */
.btn.danger, .control.danger, .net-banner.err {
  background: linear-gradient(135deg, #d21f34, #a8102a); color: #fff;
}
.net-banner { color: #fff; }
.net-banner.ok { background: linear-gradient(135deg, #0f7a55, #0b5f47); }
.net-banner.warn { background: linear-gradient(135deg, #8a5b00, #6b4400); }

/* --- Elements a faible opacite : le texte doit rester lisible ----------- */
.conv.muted .conv-preview, .edited-tag, .giphy-foot, .diag-na { opacity: 1; color: var(--muted); }
.mask-notice { color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.8); background: rgba(0,0,0,.55); }
.call-diag .val, .call-diag td { color: #fff; }
.tile { border-color: rgba(255,255,255,.55); }
.tile-label { color: #fff; background: rgba(0,0,0,.68); }
.scroll-thumb, ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 32%, transparent); }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 48%, transparent); }

/* --accent-3 n'existait dans aucune palette : la zone de depot restait cyan. */
:root { --accent-3: color-mix(in srgb, var(--accent) 55%, var(--accent-2)); }

/* =========================================================================
   THEME CLAIR — les voiles et bordures BLANCS y sont invisibles.
   S'applique aux DEUX systemes (bouton lune/soleil ET palette « Clair »).
   ========================================================================= */
[data-theme="light"], html[data-atheme="light"] {
  --border: rgba(20, 25, 60, 0.16);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-2: rgba(20, 25, 60, 0.06);
  --glass-3: rgba(20, 25, 60, 0.11);
  --bubble: #ffffff;
  --sunken: rgba(24, 30, 70, 0.07);
  --sunken-2: rgba(24, 30, 70, 0.12);
  --danger: #c81e2e;
  --ok: #0d7a55;
  --warn: #8a5b00;
  --shadow: 0 20px 55px rgba(40, 55, 120, 0.16);
}
[data-theme="light"] .msg .bubble,
html[data-atheme="light"] .msg .bubble { border-color: rgba(20,25,60,.12); }
[data-theme="light"] .switch, html[data-atheme="light"] .switch { background: rgba(20,25,60,.22); }
[data-theme="light"] .switch::after, html[data-atheme="light"] .switch::after { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
[data-theme="light"] .spoiler, html[data-atheme="light"] .spoiler { background: #2a2f4a; color: #2a2f4a; }
[data-theme="light"] .spoiler.shown, html[data-atheme="light"] .spoiler.shown { background: rgba(20,25,60,.10); color: var(--text); }
[data-theme="light"] .theme-dot.sel, html[data-atheme="light"] .theme-dot.sel { border-color: #10132a; box-shadow: 0 0 0 2px rgba(16,19,42,.25); }
[data-theme="light"] .tick.read, html[data-atheme="light"] .tick.read { color: #0b6ea8; }
[data-theme="light"] .star-on, html[data-atheme="light"] .star-on { color: #a86a00; }
[data-theme="light"] .badge-group, html[data-atheme="light"] .badge-group { background: rgba(20,25,60,.10); color: var(--muted); }
/* La fenetre d'appel reste sombre (elle contient de la video) : on y force le
   texte clair meme quand la page est en theme clair. */
[data-theme="light"] .call-window, html[data-atheme="light"] .call-window { color: #eef1ff; }
[data-theme="light"] .call-window .muted, html[data-atheme="light"] .call-window .muted { color: #b9c0e0; }
[data-theme="light"] .story-viewer, html[data-atheme="light"] .story-viewer { color: #fff; }
[data-theme="light"] .story-viewer .sv-name, html[data-atheme="light"] .story-viewer .sv-name { color: #fff; }
[data-theme="light"] .lightbox, html[data-atheme="light"] .lightbox { color: #fff; }
