:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --fir: #1B4332;        /* vert sapin : l'identite */
  --fir-soft: #2D5A45;
  --fir-title: #2C6E49;   /* vert plus lisible pour les titres d'ecran */
  --live: #10B981;       /* emeraude : presence "ici, maintenant" */
  --ink: #1A1A17;
  --muted: #6B7066;
  --line: #E8E6DF;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* En-tete */
.topbar { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.brand { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 600; font-size: 22px; color: var(--fir); letter-spacing: -0.01em; }
.topbar .ctx { font-size: 13px; color: var(--muted); }

/* Titres d'ecran */
.screen-title { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-weight: 500; font-size: 27px; line-height: 1.15; color: var(--fir-title); letter-spacing: -0.02em; margin-bottom: 6px; }
.screen-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }

/* Groupes (ex: villes) */
.group-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 22px 0 10px; }
.group-label:first-of-type { margin-top: 0; }

/* Cartes de lieu / personne */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(27,67,50,.04), 0 1px 2px rgba(0,0,0,.03);
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.card:active { transform: scale(0.99); }
.card:hover { border-color: #CFD4CC; box-shadow: 0 2px 8px rgba(27,67,50,.07); }
.card-body { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 16px; color: var(--ink); }
.card-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-aside { font-size: 18px; color: var(--fir); white-space: nowrap; opacity: .55; }

/* Point de presence — la signature */
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; position: relative; }
.dot.live { background: var(--live); }
.dot.live::after {
  content: ''; position: absolute; inset: -5px; border-radius: 50%;
  background: var(--live); opacity: .35; animation: halo 2s ease-out infinite;
}
.dot.idle { background: #C9CCC4; }
@keyframes halo { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot.live::after { animation: none; opacity: .3; } }

/* Boutons */
.btn {
  display: block; width: 100%; border: none; border-radius: var(--radius);
  padding: 16px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: background .15s ease;
}
.btn-primary { background: var(--fir); color: #fff; }
.btn-primary:active { background: var(--fir-soft); }
.btn-ghost { background: transparent; color: var(--fir); border: 1px solid var(--line); }

/* Etat vide */
.empty { text-align: center; padding: 48px 20px; }
.empty-mark { width: 14px; height: 14px; border-radius: 50%; background: #C9CCC4; margin: 0 auto 20px; }
.empty-title { font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 20px; color: var(--fir); margin-bottom: 8px; }
.empty-text { font-size: 14px; color: var(--muted); max-width: 280px; margin: 0 auto 24px; }

.spacer { flex: 1; }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Champs de saisie (ecran bulle) */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 7px; }
.field input { width: 100%; padding: 14px 16px; font-size: 16px; font-family: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); outline: none; transition: border-color .15s ease; }
.field input:focus { border-color: var(--fir); }

/* Bouton poke (ecran liste) */
.person { gap: 12px; }
.poke-btn { flex: none; border: 1px solid var(--fir); background: transparent; color: var(--fir); font-family: inherit; font-size: 14px; font-weight: 600; padding: 9px 18px; border-radius: 999px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.poke-btn:hover { background: var(--fir); color: #fff; }
.poke-btn:disabled { border-color: var(--live); color: var(--live); background: transparent; cursor: default; }

.loading { text-align: center; color: var(--muted); font-size: 14px; padding: 32px 0; }

/* Bandeau "ma bulle" — en tete de l'ecran liste */
.mybubble-card { background: #F2F7F4; border: 1px solid #DCEAE2; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 24px; display: flex; align-items: center; gap: 12px; }
.mybubble-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--fir); margin-bottom: 3px; }
.mybubble-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.mini-btn { font-family: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--fir); cursor: pointer; white-space: nowrap; }
.mini-btn.danger { color: var(--muted); }
.mini-btn:hover { border-color: var(--fir); }

/* Banniere de match — surgit en tete de liste */
.match-banner { background: var(--fir); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; animation: matchpop .35s cubic-bezier(.2,.8,.2,1); }
.match-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #9FE8C5; margin-bottom: 12px; }
.match-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.match-row .card-title { color: #fff; }
.match-row .card-meta { color: #C5D6CD; }
.match-cta { background: #fff; color: var(--fir); }
.match-cta:active { background: #EAF3EE; }
@keyframes matchpop { from { opacity: 0; transform: scale(.96) translateY(-6px); } to { opacity: 1; transform: none; } }

/* Ecran 5 — phare synchronise */
.beacon-stage { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; text-align: center; }
.beacon-sign { font-size: 96px; line-height: 1; transition: transform .2s ease; }
.beacon-sign.idle { opacity: .35; }
.beacon-sign.pulsing { animation: beaconpulse 1s ease-in-out infinite; }
@keyframes beaconpulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: .55; } }
.beacon-hint { font-size: 14px; color: var(--muted); max-width: 280px; margin-top: 24px; }
@media (prefers-reduced-motion: reduce) { .beacon-sign.pulsing { animation: none; opacity: 1; } }
