:root {
  --primary: #e8567a;
  --accent: #4f8ff7;
  --bg: #0f1220;
  --bg-soft: #171b2e;
  --card: #1d2238;
  --card-2: #262c47;
  --text: #eef1f8;
  --muted: #9aa3c0;
  --good: #37d399;
  --bad: #ff6b6b;
  --warn: #ffb454;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --glass: rgba(255,255,255,.06);
  --hairline: rgba(255,255,255,.08);
  --appbar-h: 58px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --spring: cubic-bezier(.34,1.56,.64,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Animated ambient background ---- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; width: 55vmax; height: 55vmax; border-radius: 50%;
  filter: blur(70px); opacity: .40; will-change: transform;
}
.bg-orbs span:nth-child(1) { background: var(--primary); top: -20vmax; left: -10vmax; animation: drift1 22s var(--ease) infinite alternate; }
.bg-orbs span:nth-child(2) { background: var(--accent);  bottom: -25vmax; right: -15vmax; animation: drift2 26s var(--ease) infinite alternate; }
.bg-orbs span:nth-child(3) { background: #7b4dff; top: 30vmax; right: -20vmax; opacity: .25; animation: drift3 30s var(--ease) infinite alternate; }
@keyframes drift1 { to { transform: translate3d(12vmax, 14vmax, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-14vmax, -10vmax, 0) scale(1.1); } }
@keyframes drift3 { to { transform: translate3d(-10vmax, 12vmax, 0) scale(1.2); } }

.app {
  max-width: 580px;
  margin: 0 auto;
  padding: calc(var(--appbar-h) + max(10px, env(safe-area-inset-top))) 16px calc(30px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.loader { text-align: center; padding: 40vh 0; color: var(--muted); font-size: 24px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---- App bar (fixed, glass) ---- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--appbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(15,18,32,.82), rgba(15,18,32,.35));
  backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--hairline);
  animation: fadeDown .5s var(--ease) both;
}
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } }

/* ---- Language switch (segmented) ---- */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 4px;
  background: var(--glass); border: 1px solid var(--hairline); border-radius: 999px;
}
.lang-switch button {
  position: relative; background: transparent; color: var(--muted);
  border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 800; cursor: pointer;
  transition: color .25s var(--ease), transform .2s var(--spring);
}
.lang-switch button.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 4px 14px rgba(232,86,122,.45); transform: scale(1.03); }

/* ---- Profile button in appbar ---- */
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.25);
  background: linear-gradient(135deg, var(--primary), var(--accent)); background-size: cover; background-position: center;
  color: #fff; font-weight: 800; font-size: 16px; cursor: pointer; overflow: hidden;
  display: grid; place-items: center; transition: transform .25s var(--spring), box-shadow .25s var(--ease);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.avatar-btn:active { transform: scale(.9); }
.avatar-btn:hover { box-shadow: 0 6px 22px rgba(79,143,247,.5); }

/* ---- View entrance (staggered rise) ---- */
.app > * { animation: rise .55s var(--ease) both; }
.app > *:nth-child(2) { animation-delay: .05s; }
.app > *:nth-child(3) { animation-delay: .10s; }
.app > *:nth-child(4) { animation-delay: .15s; }
.app > *:nth-child(5) { animation-delay: .20s; }
.app > *:nth-child(n+6) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ---- Typography ---- */
h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.4px; font-weight: 800; }
h2 { font-size: 19px; margin: 22px 0 12px; letter-spacing: -.2px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- Cards (glass) ---- */
.card {
  background: linear-gradient(180deg, rgba(38,44,71,.55), rgba(29,34,56,.75));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--hairline);
  margin-bottom: 14px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.985); }

/* ---- Buttons ---- */
.btn {
  position: relative; display: block; width: 100%; border: 0; border-radius: 15px;
  padding: 16px; font-size: 16px; font-weight: 700; cursor: pointer; overflow: hidden;
  background: var(--card-2); color: var(--text);
  transition: transform .18s var(--spring), box-shadow .3s var(--ease), opacity .2s, filter .2s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, var(--primary), #c23f63); color: #fff; box-shadow: 0 10px 26px rgba(232,86,122,.4); }
.btn.accent { background: linear-gradient(135deg, var(--accent), #2f6fd8); color: #fff; box-shadow: 0 10px 26px rgba(79,143,247,.4); }
.btn.primary:hover, .btn.accent:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--glass); border: 1px solid rgba(255,255,255,.15); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #ff6b6b, #c23f3f); color: #fff; box-shadow: 0 10px 26px rgba(255,107,107,.35); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn.small { padding: 10px 14px; font-size: 14px; width: auto; }
/* sheen sweep on primary buttons */
.btn.primary::after, .btn.accent::after {
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.35), transparent);
  transform: skewX(-18deg); animation: sheen 4.5s ease-in-out infinite;
}
@keyframes sheen { 0%,55% { left: -60%; } 80%,100% { left: 130%; } }

/* ---- Forms ---- */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
input, select, textarea {
  width: 100%; padding: 14px; border-radius: 13px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(23,27,46,.7); color: var(--text); font-size: 16px; font-family: inherit;
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), background .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79,143,247,.18); background: rgba(23,27,46,.95); }

/* ---- Login ---- */
.login-wrap { padding-top: 10vh; }
.heart { font-size: 50px; text-align: center; animation: beat 1.8s var(--spring) infinite; }
@keyframes beat { 0%,100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
.brand { text-align: center; margin-bottom: 22px; }
.error-msg { color: var(--bad); font-size: 14px; margin-top: 10px; min-height: 18px; }

/* ---- Chips / segmented ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid rgba(255,255,255,.14); background: var(--glass); color: var(--text);
  padding: 10px 15px; border-radius: 999px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .2s var(--spring), background .25s var(--ease), border-color .25s var(--ease), color .2s;
}
.chip:active { transform: scale(.94); }
.chip.active { background: linear-gradient(135deg, var(--primary), var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(232,86,122,.35); transform: scale(1.04); }

/* ---- Header row ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--accent)); background-size: cover; background-position: center;
  font-weight: 800; color: #fff;
}

/* ---- Pending banner ---- */
.banner {
  background: linear-gradient(135deg, rgba(58,33,64,.85), rgba(42,35,80,.85));
  backdrop-filter: blur(12px); border: 1px solid var(--primary);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(232,86,122,.2);
}

/* ---- Quiz ---- */
.progress { height: 9px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; margin: 8px 0 18px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .4s var(--ease); border-radius: 99px; }
.qimg { width: 100%; max-height: 240px; object-fit: contain; border-radius: 14px; margin-bottom: 12px; background: #000; }
.option {
  display: block; width: 100%; text-align: left; margin-bottom: 11px;
  padding: 16px; border-radius: 15px; border: 1px solid rgba(255,255,255,.12);
  background: rgba(23,27,46,.6); color: var(--text); font-size: 16px; cursor: pointer;
  transition: transform .18s var(--spring), border-color .25s var(--ease), background .25s var(--ease);
}
.option:active { transform: scale(.98); }
.option.selected { border-color: var(--accent); background: rgba(79,143,247,.18); transform: scale(1.01); }
.option.correct { border-color: var(--good); background: rgba(55,211,153,.18); animation: pop .4s var(--spring); }
.option.wrong { border-color: var(--bad); background: rgba(255,107,107,.18); animation: shake .4s ease; }
.option:disabled { cursor: default; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---- Bilingual text ---- */
.bi { display: block; }
.bi-1 { display: block; }
.bi-2 { display: block; font-style: italic; color: var(--muted); font-size: .86em; margin-top: 3px; font-weight: 500; }
.option .bi-1 { font-weight: 600; }

.hint-box { background: var(--card-2); border-radius: 13px; padding: 12px; margin: 10px 0; font-size: 15px; animation: rise .35s var(--ease); }

/* ---- Result ---- */
.score-big { font-size: 58px; font-weight: 800; text-align: center; margin: 6px 0; letter-spacing: -1px; animation: pop .5s var(--spring); }
.vs { display: flex; gap: 12px; }
.vs > div { flex: 1; text-align: center; background: var(--card-2); border-radius: 15px; padding: 14px; }

/* ---- Lists / stats ---- */
.row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.row:last-child { border-bottom: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { background: var(--card-2); border-radius: 15px; padding: 16px; text-align: center; }
.stat b { font-size: 26px; display: block; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: var(--card-2); color: var(--muted); }

/* ---- Profile page ---- */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 4px; }
.avatar-xl {
  width: 108px; height: 108px; border-radius: 50%; overflow: hidden; position: relative;
  background: linear-gradient(135deg, var(--primary), var(--accent)); background-size: cover; background-position: center;
  display: grid; place-items: center; font-size: 42px; font-weight: 800; color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.45); border: 3px solid rgba(255,255,255,.14);
}
.avatar-xl .cam { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 0; font-size: 15px;
  background: rgba(0,0,0,.45); text-align: center; }
.seg { display: flex; gap: 6px; background: var(--glass); border: 1px solid var(--hairline); border-radius: 14px; padding: 5px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; white-space: nowrap; border: 0; background: transparent; color: var(--muted);
  padding: 9px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: color .2s, background .25s var(--ease); }
.seg button.active { color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 6px 16px rgba(232,86,122,.35); }

/* ---- Admin tabs ---- */
.admin-tabs {
  flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  margin: 4px -16px 14px; padding: 0 16px 4px; scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tabs .chip { flex: 0 0 auto; }
input[type="color"] { height: 48px; padding: 4px; cursor: pointer; }
input[type="file"] { font-size: 13px; color: var(--muted); padding: 8px; }
input[type="radio"] { width: auto; accent-color: var(--good); }

/* ---- Overlay ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(8,10,20,.7); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .3s ease;
}
.overlay .card { width: 100%; max-width: 340px; animation: pop .4s var(--spring); }
@keyframes fade { from { opacity: 0; } }

.spacer { height: 8px; }
.link { color: var(--accent); background: none; border: 0; cursor: pointer; font-size: 14px; padding: 8px; font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--card-2); color: var(--text); padding: 12px 18px; border-radius: 14px; z-index: 200;
  box-shadow: var(--shadow); border: 1px solid var(--hairline); animation: toastIn .4s var(--spring); font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px); } }

/* ================= BIOMÉTRIE (séparateur) ================= */
.or-sep { text-align: center; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em;
  margin: 16px 0 12px; position: relative; text-transform: uppercase; }
.or-sep::before, .or-sep::after { content: ''; position: absolute; top: 50%; width: 36%; height: 1px; background: var(--hairline); }
.or-sep::before { left: 0; } .or-sep::after { right: 0; }

/* ================= MESSAGERIE ================= */
.chat {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 2px;
  min-height: 48vh; max-height: calc(100dvh - var(--appbar-h) - 150px); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Vue messagerie : colonne pleine hauteur (en-tête / messages / saisie) — responsive tous écrans */
.app.chat-mode {
  display: flex; flex-direction: column;
  height: 100dvh; padding-bottom: 0; overflow: hidden;
}
.app.chat-mode .topbar { flex: 0 0 auto; }
.app.chat-mode .chat {
  flex: 1 1 auto; min-height: 0; max-height: none;
}
.app.chat-mode .chat-input {
  position: static; flex: 0 0 auto;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.bubble {
  max-width: 80%; padding: 10px 13px; border-radius: 17px; font-size: 15px;
  word-break: break-word; animation: rise .25s var(--ease) both; box-shadow: 0 4px 12px rgba(0,0,0,.22);
}
.bubble .bd { display: block; }
.bubble .bt { display: block; font-size: 10px; opacity: .55; text-align: right; margin-top: 3px; }
.bubble.me { align-self: flex-end; background: linear-gradient(135deg, var(--primary), #c23f63); color: #fff; border-bottom-right-radius: 5px; }
.bubble.them { align-self: flex-start; background: var(--card-2); border-bottom-left-radius: 5px; }
.chat-input { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 10px 0 calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg) 55%, transparent); }
.chat-input input { flex: 1; }
.chat-input .btn { width: auto; padding: 0 20px; }

/* ================= LOCALISATION ================= */
.map-frame { width: 100%; height: 240px; border: 0; border-radius: 14px; background: #10131f; display: block; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: var(--good);
  text-transform: uppercase; letter-spacing: .05em; }
.live-dot::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--good);
  box-shadow: 0 0 0 0 rgba(55,211,153,.6); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 70%,100% { box-shadow: 0 0 0 8px rgba(55,211,153,0); } }
/* Interrupteur */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { display: none; }
.switch .sl { position: absolute; inset: 0; background: var(--card-2); border: 1px solid var(--hairline);
  border-radius: 999px; transition: background .25s var(--ease); cursor: pointer; }
.switch .sl::before { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform .25s var(--spring); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch input:checked + .sl { background: linear-gradient(135deg, var(--good), #2fb37f); border-color: transparent; }
.switch input:checked + .sl::before { transform: translateX(20px); }

/* ================= GALERIE ================= */
.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.gal-cell { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 12px; overflow: hidden;
  cursor: pointer; background: var(--card-2); }
.gal-cell img, .gal-cell video { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.gal-cell:active img, .gal-cell:active video { transform: scale(.95); }
.gal-play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; color: #fff;
  background: rgba(0,0,0,.28); text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none; }

/* ================= NOTRE INSTANT (défi photo) ================= */
.ch-photos { display: grid; gap: 14px; margin-top: 12px; }
.ch-photo { margin: 0; animation: rise .4s var(--ease) both; }
.ch-photo img { width: 100%; border-radius: 18px; display: block; box-shadow: var(--shadow); }
.ch-photo figcaption { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 7px; font-weight: 700; }

/* ================= HUB PORTAIL ================= */
.hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 14px; }
.hub-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 16px; cursor: pointer;
  background: linear-gradient(180deg, rgba(38,44,71,.55), rgba(29,34,56,.75));
  backdrop-filter: blur(14px); box-shadow: var(--shadow); color: var(--text); text-align: left;
  transition: transform .18s var(--spring), box-shadow .3s var(--ease); min-height: 104px;
}
.hub-tile:active { transform: scale(.96); }
.hub-tile:hover { box-shadow: 0 14px 34px rgba(79,143,247,.28); }
.hub-tile .hi { font-size: 32px; line-height: 1; }
.hub-tile .ht { font-weight: 800; font-size: 16px; margin-top: 4px; }
.hub-tile .hs { font-size: 12.5px; color: var(--muted); }
.hbadge {
  position: absolute; top: 10px; right: 10px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: linear-gradient(135deg, var(--primary), #c23f63); color: #fff;
  font-size: 12px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(232,86,122,.5);
}
.hub-tile:first-child { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 14px; min-height: 0; }
.hub-tile:first-child .hi { font-size: 34px; }
.hub-tile:first-child .ht { margin-top: 0; }

/* ================= PERROQUET INSÉPARABLE ================= */
.pet-stage {
  position: relative; display: grid; place-items: center;
  padding: 18px 0 6px; overflow: hidden; border-radius: var(--radius);
}
.pet-aura {
  position: absolute; width: 260px; height: 260px; border-radius: 50%;
  filter: blur(38px); opacity: .5; z-index: 0; animation: auraPulse 4s var(--ease) infinite;
}
@keyframes auraPulse { 50% { transform: scale(1.12); opacity: .72; } }
.parrot-wrap { position: relative; z-index: 1; width: 210px; height: 232px; }
.parrot { width: 100%; height: 100%; transform-origin: 50% 90%; animation: petBob 3.2s var(--ease) infinite; }
@keyframes petBob { 0%,100% { transform: translateY(0) rotate(-1.2deg); } 50% { transform: translateY(-9px) rotate(1.2deg); } }
.parrot.sick { animation-duration: 5s; filter: saturate(.55) brightness(.92); }
.parrot.sad  { animation-duration: 4.4s; }
.p-eye { transform-box: fill-box; transform-origin: center; animation: petBlink 4.5s infinite; }
@keyframes petBlink { 0%,92%,100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.p-wing { transform-box: fill-box; transform-origin: 82% 30%; animation: petFlap 3.2s var(--ease) infinite; }
@keyframes petFlap { 0%,72%,100% { transform: rotate(0); } 84% { transform: rotate(-13deg); } }
.pet-accessory {
  position: absolute; top: 6px; right: 20px; font-size: 30px; z-index: 3;
  animation: floatEmoji 2.6s var(--ease) infinite; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4));
}
@keyframes floatEmoji { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
.pet-bubble {
  position: relative; margin: 2px auto 12px; max-width: 300px; text-align: center;
  background: var(--card-2); border: 1px solid var(--hairline); border-radius: 16px;
  padding: 11px 14px; font-weight: 600; box-shadow: var(--shadow); animation: rise .4s var(--ease) both;
}
.pet-bubble::after { content: ''; position: absolute; top: -8px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 14px; height: 14px; background: var(--card-2); border-left: 1px solid var(--hairline); border-top: 1px solid var(--hairline); }
.pet-name { font-size: 22px; font-weight: 800; text-align: center; letter-spacing: -.3px; }
.pet-name button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; }

.statgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 6px 0 4px; }
.statline .lab { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; font-weight: 600; }
.statline .bar { height: 10px; border-radius: 99px; background: rgba(255,255,255,.09); overflow: hidden; }
.statline .bar > span { display: block; height: 100%; border-radius: 99px; transition: width .6s var(--ease); }
.bar.food > span { background: linear-gradient(90deg,#ffb454,#ff8a3d); }
.bar.clean > span { background: linear-gradient(90deg,#4fd0f7,#4f8ff7); }
.bar.happy > span { background: linear-gradient(90deg,#ff6f91,#e8567a); }
.bar.water > span { background: linear-gradient(90deg,#5ee0c8,#37d399); }
.bar.low > span { background: linear-gradient(90deg,#ff6b6b,#c23f3f) !important; }

.pet-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 4px 0; }
.pet-act { position: relative; border: 1px solid var(--hairline); background: var(--glass); border-radius: 15px;
  padding: 12px 4px 8px; text-align: center; cursor: pointer; transition: transform .18s var(--spring), background .2s; }
.pet-act:active { transform: scale(.93); }
.pet-act .ic { font-size: 26px; display: block; }
.pet-act .lb { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.pet-act.cool { opacity: .5; }
.pet-act .cd { font-size: 10px; color: var(--warn); font-weight: 700; }

.pet-particle { position: absolute; z-index: 5; font-size: 24px; pointer-events: none; will-change: transform, opacity;
  animation: petParticle 1.1s ease-out forwards; }
@keyframes petParticle { to { transform: translateY(-90px) scale(1.3) rotate(var(--r,20deg)); opacity: 0; } }

.pet-feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.pet-feed-item:last-child { border-bottom: 0; }
.pet-feed-item .pic { font-size: 20px; }
.pet-feed-item .note { color: var(--muted); font-style: italic; font-size: 13.5px; margin-top: 2px; }

/* Carte perroquet sur l'accueil */
.pet-home { display: flex; align-items: center; gap: 14px; }
.pet-home .mini { font-size: 40px; animation: petBob 3.2s var(--ease) infinite; }

/* ---- Connexion / hors-ligne ---- */
.conn-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--appbar-h) + env(safe-area-inset-top) + 8px); z-index: 55;
  padding: 7px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  box-shadow: var(--shadow); animation: toastIn .35s var(--spring); white-space: nowrap;
}
.conn-pill.off { background: rgba(58,35,48,.95); color: #ffd0d9; border: 1px solid var(--bad); }
.conn-pill.sync { background: rgba(34,49,79,.95); color: #cfe0ff; border: 1px solid var(--accent); }

/* ---- Countdown big number ---- */
.count-num { font-size: 78px; font-weight: 800; animation: pop .5s var(--spring); }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .05s !important; }
  .bg-orbs span { animation: none; }
}
