/* ═══════════════════════════════════════════
   OmeFree — Stylesheet
   Design system basé sur le logo :
     Violet  #8068f8  — couleur principale
     Or      #f0c800  — accent chaud
     Teal    #08c8a8  — accent froid / succès
   ═══════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);

  /* ── Backgrounds ── */
  --bg:             #0c0a14;
  --bg-card:        rgba(128, 104, 248, 0.04);
  --bg-glass:       rgba(128, 104, 248, 0.08);
  --bg-glass-hover: rgba(128, 104, 248, 0.14);

  /* ── Borders ── */
  --border:         rgba(128, 104, 248, 0.12);
  --border-focus:   rgba(128, 104, 248, 0.55);

  /* ── Text ── */
  --text:       #f0eef8;
  --text-dim:   #9088b0;
  --text-muted: #5c5478;

  /* ── Violet (primary) ── */
  --accent:       #8068f8;
  --accent-light: #9a88ff;
  --accent-dark:  #6a50e0;
  --accent-glow:  rgba(128, 104, 248, 0.35);

  /* ── Teal (success / online) ── */
  --green:      #08c8a8;
  --green-light:#2ae0c0;
  --green-glow: rgba(8, 200, 168, 0.35);

  /* ── Or / Gold (warning / highlights) ── */
  --yellow:      #f0c800;
  --yellow-light:#ffd83a;
  --yellow-glow: rgba(240, 200, 0, 0.3);

  /* ── Rouge (danger / stop) ── */
  --red:      #f04050;
  --red-glow: rgba(240, 64, 80, 0.3);

  /* ── Layout ── */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Sora', -apple-system, sans-serif;
}

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&display=swap');

html, body {
  height: 100%;
  /* iOS PWA: extend behind notch and home indicator */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Screens ── */
.screen {
  display: none;
  height: 100%;
  width: 100%;
}
.screen.active {
  display: flex;
}

/* ═══════════════════════════════════════
   LANDING SCREEN
   ═══════════════════════════════════════ */
#landing {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #1e1440 0%, #2a1a5e 40%, #1a1238 100%);
}

/* Scattered logos background */
.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.landing-bg .bg-logo {
  position: absolute;
}

/* ── Hero Navbar ── */
.hero-navbar {
  position: fixed;
  top: 0;
  left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 56px;
  background: none;
  border-bottom: none;
}
.hero-nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.hero-nav-logo-img {
  height: 64px;
  width: auto;
  object-fit: contain;
}
.hero-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Burger Button ── */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.burger-btn span {
  display: block;
  width: 26px;
  height: 3px;
  background: #fff;
  border-radius: 3px;
}

/* ── Backdrop ── */
.burger-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
}
.burger-backdrop.open {
  display: block;
}

/* ── Dropdown ancré en haut à droite (desktop) ── */
.burger-menu {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 200;
  width: 260px;
  background: #120c28;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.burger-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ── Mobile : panneau pleine largeur qui slide depuis le haut ── */
@media (max-width: 640px) {
  .burger-menu {
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-radius: 0 0 24px 24px;
    transform: translateY(-100%);
    opacity: 1;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  }
  .burger-menu.open {
    transform: translateY(0);
    opacity: 1;
  }
  .burger-link {
    padding: 18px 24px;
    font-size: 17px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .burger-link:last-child {
    border-bottom: none;
  }
  .burger-menu-header {
    padding: 20px 20px 16px;
  }
  .burger-menu-title {
    font-size: 17px;
  }
  .burger-nav {
    padding: 4px 0 16px;
  }
  .burger-lang-row {
    padding: 14px 24px 18px;
  }
  .lang-pill-opt {
    padding: 7px 16px;
    font-size: 14px;
  }
}

.burger-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  flex-shrink: 0;
}
.burger-menu-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex: 1;
  text-align: center;
  margin-left: 24px; /* compense le ✕ à droite */
}
.burger-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 18px;
  cursor: pointer;
  transition: color var(--transition);
  flex-shrink: 0;
}
.burger-close:hover {
  color: #fff;
}

.burger-menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0;
}

.burger-nav {
  display: flex;
  flex-direction: column;
  padding: 6px 0 10px;
}

.burger-link {
  display: block;
  padding: 13px 24px;
  font-size: 15px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color var(--transition);
}
.burger-link:hover {
  color: #fff;
}

/* ── Language switcher inside burger menu ── */
.burger-lang-divider {
  margin-top: 4px;
}
.burger-lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px 16px;
  gap: 12px;
}
.burger-lang-label {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: rgba(255,255,255,0.45);
}
.burger-lang-label svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Pill container */
.lang-pill {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  cursor: default;
}

/* Each option */
.lang-pill-opt {
  padding: 5px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.45);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.lang-pill-opt:hover {
  color: rgba(255,255,255,0.8);
}

/* Active state */
.lang-pill-opt.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(128, 104, 248, 0.45);
}

.burger-divider { display: none; }
.burger-menu-footer { display: none; }

/* ── Landing Content ── */
.landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px;
  flex: 1;
  min-height: 100%;
}

/* ── Hero Section (2 colonnes desktop) ── */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
  width: 100%;
}

/* ── Colonne texte ── */
.hero-text-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}

.hero-title {
  font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -1.5px;
  color: #fff;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  color: rgba(255,255,255,0.6);
  line-height: 1.65;
  max-width: 400px;
}

/* ── Hero Actions ── */
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

/* ── Colonne visuelle ── */
.hero-visual-col {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: visible;
  padding-top: 12px;
}

.hero-screenshots {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
}

/* Screenshot du dessous — décalé en haut à gauche, légèrement tourné */
.hero-shot-back {
  position: absolute;
  width: 98%;
  border-radius: 16px;
  object-fit: cover;
  top: 0;
  left: 0;
  transform: rotate(-3deg) translate(-4%, -6%);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.08);
  z-index: 1;
}

/* Screenshot du dessus — décalé plus à droite et bas pour exposer la fille */
.hero-shot-front {
  position: absolute;
  width: 86%;
  border-radius: 16px;
  object-fit: cover;
  bottom: 0;
  right: 0;
  transform: rotate(2.5deg) translate(28%, 66%);
  box-shadow: 0 24px 70px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.1);
  z-index: 2;
}

.hero-title-accent {
  background: linear-gradient(135deg, var(--yellow-light), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-title-accent2 {
  color: var(--accent-light);
  text-shadow: 0 0 40px var(--accent-glow);
}

.hero-interests {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.hero-interests-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin-bottom: 8px;
}
.hero-interests .interests-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.interests-icon {
  position: absolute;
  left: 14px;
  color: rgba(255,255,255,0.4);
  pointer-events: none;
  flex-shrink: 0;
}
.hero-interests .interests-input {
  padding-left: 44px;
}

/* ── Hero Feature Pills ── */
.hero-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.hero-feature-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  transition: var(--transition);
}
.hero-feature-pill:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}
.hero-feature-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-teal { background: var(--green-light); box-shadow: 0 0 8px var(--green-glow); }
.dot-gold { background: var(--yellow-light); box-shadow: 0 0 8px var(--yellow-glow); }
.dot-violet { background: #fff; box-shadow: 0 0 8px rgba(255,255,255,0.4); }

/* ── Mobile Screenshots ── */
.hero-mobile-screenshots {
  display: none; /* masqué par défaut sur desktop */
}

/* ── Mobile Hero Responsive ── */
@media (max-width: 900px) {
  .hero-navbar {
    padding: 12px 20px;
  }
  .hero-nav-logo-img {
    height: 56px;
  }
  .landing-content {
    padding: 0 24px;
    max-width: 520px;
  }
  .hero-section {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .hero-visual-col {
    display: none;
  }
  .hero-text-col {
    align-items: center;
    text-align: center;
    transform: translateY(10%);
  }
  .hero-actions {
    align-items: stretch;
    max-width: 100%;
  }
  .hero-subtitle {
    max-width: 100%;
  }
  .legal-note {
    transform: translateY(-33%);
  }

  /* Screenshots mobiles */
  .hero-mobile-screenshots {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    width: 100%;
    height: 260px;
    margin-top: 28px;
    flex-shrink: 0;
    transform: translateY(15%);
  }
  .mobile-shot-wrap {
    position: absolute;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.08);
  }
  /* Ratio réel de mnf.jpg : 1536×2752 ≈ 9:16 portrait */
  .mobile-shot-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
  }
  .mobile-shot-back {
    width: 140px;
    height: 249px; /* 140 × 16/9 */
    left: calc(50% - 128px);
    bottom: 0;
    transform: rotate(-5deg);
    z-index: 1;
    opacity: 0.85;
  }
  .mobile-shot-front {
    width: 148px;
    height: 263px; /* 148 × 16/9 */
    left: calc(50% - 20px);
    bottom: 0;
    transform: rotate(4deg);
    z-index: 2;
    box-shadow: 0 24px 70px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.12);
  }
}

@media (max-width: 480px) {
  .hero-navbar {
    padding: 10px 16px;
  }
  .hero-nav-logo-img {
    height: 52px;
  }
  .online-badge {
    font-size: 11px;
    padding: 6px 12px;
  }
  .hero-title {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }
  .hero-mobile-screenshots {
    height: 220px;
    margin-top: 22px;
  }
  .mobile-shot-back {
    width: 118px;
    height: 210px;
    left: calc(50% - 108px);
  }
  .mobile-shot-front {
    width: 124px;
    height: 220px;
    left: calc(50% - 16px);
  }
}

/* Interests */
.interests-input-wrap {
  position: relative;
}
.interests-input {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.50);
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
.interests-input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}
.interests-input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(128, 104, 248, 0.2);
  background: rgba(255, 255, 255, 0.34);
}
.interests-input:focus::placeholder {
  color: rgba(255, 255, 255, 0.55);
}
.interests-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  min-height: 0;
}
.interest-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 13px;
  background: rgba(128, 104, 248, 0.22);
  border: 1px solid rgba(128, 104, 248, 0.45);
  color: #e8e0ff;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  animation: tag-in 0.18s ease-out;
}
.interest-tag .remove-tag {
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}
.interest-tag .remove-tag:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

@keyframes tag-in {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Start Button */
.btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 32px;
  background: linear-gradient(135deg, var(--yellow-light), var(--yellow));
  color: #1a1000;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 24px var(--yellow-glow);
  position: relative;
  overflow: hidden;
}
.btn-start-icon {
  flex-shrink: 0;
}
.btn-start::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255,255,255,0.12), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}
.btn-start:hover::before {
  transform: translateX(100%);
}
.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px var(--yellow-glow);
}
.btn-start:active {
  transform: translateY(0) scale(0.98);
}

/* Online Badge */
.online-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 20px;
  font-size: 13px;
  color: #fff;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  box-shadow: 0 0 8px var(--green-glow);
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.legal-note {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  text-align: center;
  line-height: 1.6;
  margin-top: 2px;
}

/* ═══════════════════════════════════════
   CHAT SCREEN
   ═══════════════════════════════════════ */
#chat-screen {
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(12, 10, 20, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  flex-shrink: 0;
}

.logo-small {
  display: flex;
  align-items: center;
}
.logo-img-sm {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-glass);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}
.connection-status.searching .status-dot {
  background: var(--yellow);
  animation: pulse 1s ease-in-out infinite;
}
.connection-status.connected .status-dot {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
}
.connection-status.disconnected .status-dot {
  background: var(--red);
}

.online-badge-sm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
}
.pulse-dot-sm {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

/* Main Chat Layout */
.chat-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Video Area */
.video-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #000;
  min-width: 0;
}

.video-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.video-box {
  position: relative;
  overflow: hidden;
  background: #000;
}

.video-box video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Partner video = full area */
.partner-video-box {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* When partner sends portrait video, adapt container */
.partner-video-box.portrait video {
  object-fit: contain;
}

.partner-video-box.landscape video {
  object-fit: contain;
}

/* Local video = PiP overlay — direct child of chat-main */
/* NE PAS définir top/bottom/left/right ici — le JS les contrôle entièrement via snapToCorner() */
.local-video-box {
  position: absolute;
  top: auto;
  bottom: auto;
  left: auto;
  right: auto;
  width: 200px;
  height: 150px;
  border-radius: 14px;
  border: none;
  z-index: 50;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
  overflow: hidden;
  opacity: 0; /* masqué jusqu'au premier snap calculé par JS */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55), 0 0 0 1.5px rgba(255,255,255,0.08);
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1),
              height 0.3s cubic-bezier(0.4,0,0.2,1),
              top 0.3s cubic-bezier(0.4,0,0.2,1),
              left 0.3s cubic-bezier(0.4,0,0.2,1),
              opacity 0.25s ease,
              box-shadow 0.2s ease;
}

/* Local PiP adapts to portrait mode */
.local-video-box.portrait {
  width: 112px;
  height: 200px;
}

.local-video-box.landscape {
  width: 200px;
  height: 150px;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  z-index: 2;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

/* Animated TV static noise — only on partner placeholder */
/* Use background-position shift instead of transform to avoid any layout movement */
#partner-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.16;
  animation: static-flicker 0.07s steps(1) infinite;
  pointer-events: none;
  z-index: 0;
  will-change: background-position;
}

/* Second layer — finer grain, slightly different rhythm */
#partner-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n2'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='3' seed='8' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n2)'/%3E%3C/svg%3E");
  background-size: 100px 100px;
  opacity: 0.10;
  mix-blend-mode: screen;
  animation: static-flicker2 0.11s steps(1) infinite;
  pointer-events: none;
  z-index: 0;
  will-change: background-position;
}

@keyframes static-flicker {
  0%   { background-position:   0px   0px; }
  10%  { background-position: -32px  17px; }
  20%  { background-position:  21px -41px; }
  30%  { background-position: -58px  29px; }
  40%  { background-position:  44px -13px; }
  50%  { background-position: -19px  52px; }
  60%  { background-position:  63px  -8px; }
  70%  { background-position: -47px  35px; }
  80%  { background-position:  15px -57px; }
  90%  { background-position: -71px  11px; }
  100% { background-position:  38px  44px; }
}

@keyframes static-flicker2 {
  0%   { background-position:   0px   0px; }
  12%  { background-position:  27px -19px; }
  25%  { background-position: -43px  31px; }
  37%  { background-position:  55px  -7px; }
  50%  { background-position: -12px  48px; }
  62%  { background-position:  39px -36px; }
  75%  { background-position: -61px  22px; }
  87%  { background-position:  18px  53px; }
  100% { background-position: -34px -28px; }
}

.video-placeholder .placeholder-content {
  position: relative;
  z-index: 1;
}

.video-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}
.placeholder-content {
  text-align: center;
}
.placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.placeholder-text {
  font-size: 14px;
  color: var(--text-muted);
}
.local-video-box .placeholder-icon {
  font-size: 24px;
  margin-bottom: 4px;
}
.local-video-box .placeholder-text {
  font-size: 11px;
}

.video-label {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  z-index: 5;
}
.local-video-box .video-label {
  bottom: 6px;
  left: 6px;
  font-size: 10px;
  padding: 2px 8px;
}

/* Le label "Inconnu(e)" est remplacé par le logo watermark */
.partner-label {
  display: none;
}

/* Watermark logo sur la vidéo partenaire */
.video-watermark {
  position: absolute;
  bottom: 12px;
  left: 14px;
  top: auto;
  height: 72px;
  width: auto;
  opacity: 0.32;
  z-index: 4;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Video Controls */
.video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 20px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  background: rgba(12, 10, 20, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  position: relative; /* pour le pseudo-element barré */
  overflow: hidden;
}
.ctrl-btn:hover {
  background: var(--bg-glass-hover);
  border-color: rgba(128, 104, 248, 0.2);
}

/* État désactivé : même fond, un seul trait blanc en diagonale sur tout le bouton */
.ctrl-btn.off {
  background: var(--bg-glass);
  border-color: var(--border);
  color: var(--text);
}
.ctrl-btn.off::after {
  content: '';
  position: absolute;
  /* Diagonale qui traverse tout le bouton de coin à coin */
  width: 140%;
  height: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  pointer-events: none;
}

.ctrl-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-next {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: transparent;
  padding: 12px 24px;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-next:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-stop {
  background: rgba(240, 64, 80, 0.1);
  border-color: rgba(240, 64, 80, 0.2);
  color: var(--red);
}
.btn-stop:hover {
  background: rgba(240, 64, 80, 0.2);
  border-color: rgba(240, 64, 80, 0.4);
}

/* Flip cam button — desktop hidden, mobile only */
.btn-flip-cam {
  display: none;
}

.ctrl-label {
  display: inline;
}

/* ═══════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════ */
.chat-area {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: rgba(12, 10, 20, 0.95);
  backdrop-filter: blur(20px);
}

.chat-toggle-mobile {
  display: none;
}

/* Bouton hide chat — supprimé */

.chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.chat-close-mobile {
  display: none;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
}

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.system-message {
  text-align: center;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.system-message strong {
  color: var(--accent-light);
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  animation: msg-in 0.2s ease-out;
  word-wrap: break-word;
}
.message.sent {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.message.received {
  align-self: flex-start;
  background: #00b896;
  color: white;
  border-bottom-left-radius: 4px;
  border: none;
}

@keyframes msg-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Typing Indicator */
.typing-indicator {
  padding: 8px 18px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.typing-dots span {
  animation: typing-bounce 1.4s ease-in-out infinite;
  font-weight: bold;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* Chat Input */
.chat-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(72px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}
.chat-input::placeholder {
  color: var(--text-muted);
}
.chat-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.chat-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover:not(:disabled) {
  background: var(--accent-light);
}
.chat-send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Unread badge */
.unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════
   RESPONSIVE — Tablet
   ═══════════════════════════════════════ */
@media (max-width: 900px) {
  .chat-area {
    width: 300px;
  }
  .local-video-box {
    width: 160px;
    height: 120px;
    right: 316px; /* 300px chat + 16px */
  }
  .local-video-box.portrait {
    width: 90px;
    height: 160px;
  }
  .ctrl-label {
    display: none;
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE — Mobile
   ═══════════════════════════════════════ */
@media (max-width: 640px) {
  /* Landing */
  .landing-content { padding: 0 16px; }

  /* ─── Chat screen: video fullscreen, controls + chat over it ─── */
  #chat-screen {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
  }

  .topbar {
    padding: 6px 12px;
    flex-shrink: 0;
    z-index: 10;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(12, 10, 20, 0.95);
  }

  /* Main = stacking context */
  .chat-main {
    flex: 1;
    position: relative;
    overflow: hidden;
  }

  /* ── Video: absolute fullscreen background ── */
  .video-area {
    position: absolute;
    inset: 0;
    z-index: 1;
  }

  .video-container {
    width: 100%;
    height: 100%;
  }

  /* Hide desktop video-controls — we move them inline */
  .video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 28px 16px 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    /* Halo diffus : dégradé sombre qui monte du bas, sans démarcation */
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.72) 0%,
      rgba(0, 0, 0, 0.45) 50%,
      transparent 100%
    );
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-top: none;
  }
  .ctrl-btn {
    padding: 10px 14px;
    background: rgba(15, 12, 28, 0.88);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .ctrl-btn:hover, .ctrl-btn:active {
    background: rgba(30, 24, 55, 0.95);
  }
  .ctrl-btn.off {
    background: rgba(15, 12, 28, 0.88);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .ctrl-label {
    display: none;
  }
  /* Flip cam visible sur mobile */
  .btn-flip-cam {
    display: flex;
  }

  /* Local PiP — direct child of chat-main, highest z-index, always touchable */
  .local-video-box {
    position: absolute;
    width: 133px;
    height: 100px;
    /* NE PAS définir top/bottom/left/right ici — le JS les contrôle entièrement */
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
    z-index: 100;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none; /* activé par JS après le premier snap */
    border-radius: 12px;
    border: none;
    box-shadow: 0 3px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.07);
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4,0,0.2,1),
                height 0.3s cubic-bezier(0.4,0,0.2,1),
                top 0.3s cubic-bezier(0.4,0,0.2,1),
                left 0.3s cubic-bezier(0.4,0,0.2,1),
                opacity 0.25s ease,
                box-shadow 0.2s ease;
  }
  .local-video-box.portrait {
    width: 73px;
    height: 121px;
  }

  /* Sur mobile, le tap sur le PiP ne provoque plus d'expand */
  .local-video-box.expanded {
    width: 133px !important;
    height: 100px !important;
    box-shadow: 0 3px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.07) !important;
  }
  .local-video-box.expanded.portrait {
    width: 73px !important;
    height: 121px !important;
  }
  .local-video-box.expanded.landscape {
    width: 133px !important;
    height: 100px !important;
  }

  /* Hide partner label */
  .partner-label {
    display: none;
  }

  /* Watermark masqué sur mobile */
  .video-watermark {
    display: none;
  }

  /* ── Chat: absolute overlay, NO background, pass-through ── */
  .chat-toggle-mobile {
    display: none !important;
  }

  .chat-area {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    z-index: 6;
    background: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-left: none;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    transform: none !important;
    opacity: 1 !important;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  }

  .chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    padding-left: 22px;
    /* Laisser la place aux boutons contrôles en bas */
    padding-bottom: 56px;
  }

  .chat-header {
    display: none !important;
  }

  .chat-close-mobile {
    display: none !important;
  }

  /* ── Messages: TikTok Live — bottom-anchored, left-aligned ── */
  .chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow-y: auto;
    overflow-x: hidden;
    /* Hauteur max = ~8 messages (chaque bulle ~36px + gap 3px) */
    max-height: calc(8 * 39px);
    padding: 8px 4px 6px 0;
    padding-right: 108px;
    gap: 3px;
    background: transparent;
    pointer-events: auto;    /* scroll touch activé */
    position: relative;
    /* Aligne le contenu en bas — les nouveaux messages arrivent par le bas */
    margin-top: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .chat-messages::-webkit-scrollbar { display: none; }

  .chat-messages::before {
    display: none;
  }

  /* ── Bulle message ── */
  .chat-messages .message {
    align-self: flex-start;
    max-width: 82%;
    font-size: 13px;
    line-height: 1.4;
    padding: 4px 10px 4px 8px;
    border-radius: 18px;
    background: rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    color: #fff;
    word-break: break-word;
    pointer-events: auto;
    animation: tikMsgIn 0.22s cubic-bezier(0.22,1,0.36,1) both;
  }

  @keyframes tikMsgIn {
    from { opacity: 0; transform: translateX(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
  }

  .chat-messages .message .msg-author {
    font-size: 12px;
    font-weight: 700;
    margin-right: 5px;
    white-space: nowrap;
  }
  .chat-messages .message.sent  .msg-author { color: var(--accent-light); }
  .chat-messages .message.received .msg-author { color: var(--green-light); }

  .chat-messages .message .msg-text {
    color: rgba(255, 255, 255, 0.92);
    font-size: 13px;
  }

  .chat-messages .message.sent     { border-left: 2px solid rgba(128,104,248,0.7); }
  .chat-messages .message.received { border-left: 2px solid rgba(8,200,168,0.6); }

  .chat-messages .system-message {
    font-size: 10px;
    padding: 2px 8px;
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    text-align: center;
    align-self: center;
    color: rgba(255,255,255,0.5);
    max-width: 85%;
    pointer-events: auto;
  }

  .typing-indicator {
    padding: 2px 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    background: transparent;
    pointer-events: none;
    flex-shrink: 0;
  }

  /* ── Input bar ── */
  .chat-input-form {
    display: flex;
    gap: 6px;
    padding: 5px 8px 5px 0;
    border-top: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: auto;
    flex-shrink: 0;
  }
  .chat-input {
    flex: 1;
    padding: 8px 14px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px;
    color: white;
  }
  .chat-input::placeholder { color: rgba(255,255,255,0.35); }
  .chat-input:focus {
    border-color: rgba(128,104,248,0.5);
    box-shadow: none;
    background: rgba(0, 0, 0, 0.85);
  }
  .chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════
   EXIT MODAL
   ═══════════════════════════════════════ */
.exit-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
}
.exit-modal-backdrop.open {
  display: flex;
  animation: exitModalIn 0.2s cubic-bezier(0.4,0,0.2,1);
}
@keyframes exitModalIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.exit-modal {
  background: rgba(22, 18, 42, 0.98);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 32px 28px 24px;
  width: min(340px, 88vw);
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  animation: exitModalSlide 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes exitModalSlide {
  from { transform: scale(0.88) translateY(16px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.exit-modal-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.exit-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.exit-modal-text {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 24px;
  line-height: 1.5;
}
.exit-modal-actions {
  display: flex;
  gap: 10px;
}
.exit-modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.exit-modal-btn:active {
  transform: scale(0.96);
}
.exit-modal-cancel {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
}
.exit-modal-cancel:hover {
  background: rgba(255,255,255,0.13);
}
.exit-modal-confirm {
  background: var(--red);
  color: white;
}
.exit-modal-confirm:hover {
  opacity: 0.88;
}

/* ═══════════════════════════════════════
   ANIMATIONS & UTILITIES
   ═══════════════════════════════════════ */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Searching animation on partner video */
.searching-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.searching-animation .spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Selection styling */
::selection {
  background: var(--accent);
  color: white;
}
