:root {
  /* Couleurs de marque (identiques en clair et en sombre) */
  --orange: #ff8c1a;
  --red: #f5384e;
  --grad: linear-gradient(135deg, #ff8c1a 0%, #f5384e 100%);
  --danger: #f5384e;
  --ok: #16b364;
  --radius: 18px;

  /* --- Thème CLAIR (par défaut) --- */
  --grad-soft: linear-gradient(135deg, rgba(255, 140, 26, 0.12), rgba(245, 56, 78, 0.12));
  --bg: #ffffff;
  --bg-warm: #fff6f1;
  --card: #ffffff;
  --field: #ffffff;        /* fond des champs, pastilles, boutons ronds */
  --line: #f1e8e3;
  --text: #1c1b1f;
  --muted: #837b84;
  --badge-text: #c43b1f;   /* texte du badge "chiffré" et des intérêts en commun */
  --disabled-bg: #ece4df;  /* bouton d'appel désactivé */
  --toast-bg: #1c1b1f;
  --toast-text: #ffffff;

  --shadow-sm: 0 2px 10px rgba(245, 80, 50, 0.07);
  --shadow: 0 14px 36px rgba(245, 80, 50, 0.16);
}

/* --- Thème SOMBRE --- */
/* Appliqué soit explicitement (choix utilisateur), soit automatiquement selon le
   réglage du système quand l'utilisateur n'a pas forcé le mode clair. */
:root[data-theme="dark"] {
  --grad-soft: linear-gradient(135deg, rgba(255, 140, 26, 0.18), rgba(245, 56, 78, 0.18));
  --bg: #16121a;
  --bg-warm: #1d1822;
  --card: #211b29;
  --field: #2a2330;
  --line: #38303f;
  --text: #f4eff6;
  --muted: #a89eb0;
  --badge-text: #ff9e6e;
  --disabled-bg: #2a2330;
  --toast-bg: #2e2735;
  --toast-text: #f4eff6;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --grad-soft: linear-gradient(135deg, rgba(255, 140, 26, 0.18), rgba(245, 56, 78, 0.18));
    --bg: #16121a;
    --bg-warm: #1d1822;
    --card: #211b29;
    --field: #2a2330;
    --line: #38303f;
    --text: #f4eff6;
    --muted: #a89eb0;
    --badge-text: #ff9e6e;
    --disabled-bg: #2a2330;
    --toast-bg: #2e2735;
    --toast-text: #f4eff6;

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* L'attribut [hidden] doit toujours masquer, meme sur les elements en display:flex. */
[hidden] { display: none !important; }

/* Écran de démarrage : plein écran, logo + slogan, fondu de sortie après 3 s (CSS pur,
   robuste même si le JS échoue ; visibility:hidden le rend non cliquable à la fin). */
.splash {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
  animation: splashFade 0.6s ease 3s forwards;
}
.splash-logo { width: min(72vw, 300px); height: auto; animation: splashPop 0.7s ease both; }
.splash-slogan {
  margin: 0; max-width: 340px;
  font-size: 21px; font-weight: 700; line-height: 1.3; letter-spacing: -0.2px;
  color: var(--text);
  animation: splashRise 0.7s ease 0.15s both;
}
@keyframes splashPop { from { transform: scale(0.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes splashRise { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes splashFade { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .splash-logo, .splash-slogan { animation: none; }
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.app {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
}

/* Barre du haut */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 0;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Bouton de bascule clair / sombre */
.theme-toggle {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, border-color 0.2s ease;
}
.theme-toggle:hover { border-color: var(--orange); }
.theme-toggle:active { transform: scale(0.92); }

/* Hero (ecran d'accueil) : grand logo centre + slogan aleatoire */
.hero { text-align: center; margin: 16px 0 24px; }
.hero-logo { width: min(72vw, 268px); height: auto; margin: 0 auto 4px; display: block; }
.hero h1, .hero-slogan { font-size: 24px; margin: 6px 0 8px; line-height: 1.25; }
.hero-slogan { font-weight: 700; letter-spacing: -0.2px; }
.hero .subtitle { margin: 0; }

/* Carte du formulaire */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px 18px 10px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}
.secure-badge {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--badge-text);
  background: var(--grad-soft);
  border: 1px solid rgba(245, 56, 78, 0.18);
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.online-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ok);
  white-space: nowrap;
}
.online-count.offline { color: var(--muted); }

/* Ecrans */
.screen { display: none; flex: 1; flex-direction: column; }
.screen.active { display: flex; }

h1 { font-size: 30px; line-height: 1.15; margin: 6px 0 6px; letter-spacing: -0.5px; }
h2 { font-size: 23px; margin: 18px 0 4px; text-align: center; letter-spacing: -0.3px; }
.subtitle { color: var(--muted); margin: 0 0 26px; font-size: 15px; }
#screen-search .subtitle, #screen-call .subtitle { text-align: center; }

/* Champs */
.field { margin-bottom: 20px; }
.field > label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 15px; }

/* En-tete du champ "centres d'interet" : libelle + bouton Modifier/Replier */
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.field-head label { margin: 0; font-weight: 600; font-size: 15px; }
.link-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  color: var(--red);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }
.interest-summary { margin-top: 2px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 3px; }
.hint b { color: var(--red); }

.select {
  width: 100%;
  padding: 14px;
  background-color: var(--field);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px;
  box-shadow: var(--shadow-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23837b84' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
.select:focus { outline: none; border-color: var(--orange); }

/* Pastilles d'interet */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  padding: 10px 15px;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  box-shadow: var(--shadow-sm);
}
.chip:hover { border-color: var(--orange); }
.chip.selected {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 16px rgba(245, 56, 78, 0.28);
}
.chip.disabled { opacity: 0.4; pointer-events: none; box-shadow: none; }
.chips-static .chip { cursor: default; pointer-events: none; background: var(--grad-soft); border-color: transparent; color: var(--badge-text); box-shadow: none; }

/* Boutons */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 17px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.btn:active { transform: scale(0.985); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  margin-top: auto;
  box-shadow: 0 12px 28px rgba(245, 56, 78, 0.32);
}
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--line);
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}
.legal { color: var(--muted); font-size: 12px; text-align: center; margin: 16px 0 0; }
.legal-links { text-align: center; margin: 8px 0 0; font-size: 12px; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--red); text-decoration: underline; }
.legal-links span { color: var(--line); margin: 0 4px; }

/* Listes deroulantes des 3 centres d'interet */
.interest-selects { display: flex; flex-direction: column; gap: 10px; }

/* Bouton rond d'appel (CTA principal) */
.call-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 6px;
}
.call-btn {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: none;
  background: var(--grad);
  color: #fff;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(245, 56, 78, 0.45);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.call-btn-icon { font-size: 42px; line-height: 1; }
.call-btn:not(:disabled):active { transform: scale(0.94); }
.call-btn:disabled { background: var(--disabled-bg); box-shadow: none; cursor: not-allowed; }
.call-btn.available { animation: availablePulse 1.8s infinite ease-out; }
@keyframes availablePulse {
  0% { box-shadow: 0 16px 34px rgba(245, 56, 78, 0.45), 0 0 0 0 rgba(245, 56, 78, 0.4); }
  100% { box-shadow: 0 16px 34px rgba(245, 56, 78, 0.45), 0 0 0 26px rgba(245, 56, 78, 0); }
}
.call-cta-label { font-weight: 700; font-size: 17px; color: var(--text); }
.call-btn:disabled ~ .call-cta-label { color: var(--muted); }

/* Ecran de recherche */
#screen-search { align-items: center; justify-content: center; }
.pulse {
  width: 118px; height: 118px; border-radius: 50%;
  background: var(--card);
  display: grid; place-items: center;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  animation: pulse 1.6s infinite ease-out;
}
.pulse-logo { width: 84px; height: auto; display: block; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 56, 78, 0.4); }
  100% { box-shadow: 0 0 0 40px rgba(245, 56, 78, 0); }
}

/* Ecran d'appel */
#screen-call { align-items: center; justify-content: center; }
.call-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.connected { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.failed { background: var(--danger); }
.avatar-anon {
  font-size: 60px; font-weight: 800;
  margin: 22px 0 8px;
  width: 132px; height: 132px;
  display: grid; place-items: center;
  background: var(--grad);
  color: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow);
}
.shared { text-align: center; margin: 18px 0; }
.shared-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 9px; }
.timer { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 10px 0 30px; letter-spacing: 1px; }

.call-actions { display: flex; gap: 24px; align-items: center; }
.btn-round {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 24px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--text);
}
.btn-round.muted { background: var(--grad-soft); border-color: transparent; }
.btn-danger { background: var(--danger); color: #fff; border: none; transform: rotate(135deg); box-shadow: 0 10px 24px rgba(245, 56, 78, 0.4); }
.btn-danger:active { transform: rotate(135deg) scale(0.95); }

/* Toast */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 13px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.3s ease;
  max-width: 88%;
  text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* --- Vérification d'âge (18+) : superposition opaque bloquante --- */
.age-gate {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
html[data-age-ok] .age-gate { display: none; }  /* masquée une fois l'âge validé */
.age-card {
  max-width: 380px; width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.age-logo { width: 116px; height: auto; margin-bottom: 4px; }
.age-card h2 { margin: 6px 0 10px; }
.age-card .subtitle { margin-bottom: 22px; }
.age-field { width: 100%; text-align: left; margin-bottom: 12px; }
.age-field > span { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.age-card .btn-primary { width: 100%; margin-top: 8px; }
.age-error { color: var(--danger); font-size: 14px; font-weight: 600; margin: 4px 0 8px; }

/* --- Bouton "Signaler" (sous les actions d'appel) --- */
.report-link {
  margin-top: 22px;
  background: none; border: none;
  color: var(--muted);
  font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 8px 12px; border-radius: 999px;
}
.report-link:hover { color: var(--danger); }

/* --- Modale (feuille du bas) : motifs de signalement --- */
.modal {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-card {
  background: var(--card);
  width: 100%; max-width: 460px;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
  animation: sheetUp 0.22s ease;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-card h2 { text-align: center; }
.modal-card .subtitle { text-align: center; margin-bottom: 18px; }
.report-reasons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.report-reason {
  width: 100%; text-align: left;
  padding: 15px 16px;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.report-reason:hover { border-color: var(--danger); color: var(--danger); }
.modal-card .btn-ghost { width: 100%; margin-top: 0; }

/* --- Monétisation : verrou région, statut forfait, écran d'achat --- */
.region-hint {
  display: block; width: 100%;
  margin: 8px 0 0; padding: 8px 4px;
  background: none; border: none; text-align: left;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.region-hint:hover { color: var(--red); }

.plan-status {
  margin: 4px 0 0; padding: 6px 12px;
  background: none; border: none;
  color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer;
}
.plan-status:hover { color: var(--red); }
.plan-status.is-premium { color: var(--ok); cursor: default; }

.premium-badge-lg {
  align-self: center;
  background: var(--grad); color: #fff;
  font-weight: 800; font-size: 13px; letter-spacing: 0.3px;
  padding: 5px 14px; border-radius: 999px; margin-bottom: 4px;
}
.premium-feats { list-style: none; padding: 0; margin: 4px 0 18px; }
.premium-feats li { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 15px; font-weight: 500; }
.premium-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--grad-soft); color: var(--ok);
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.modal-card .btn-primary { width: 100%; margin-top: 0; }
#premium-later { margin-top: 10px; }
