/* ═══════════════════════════ Djouney — design system ═══════════════════════════ */

:root {
  --font-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --font-hand: "Caveat", "Segoe Script", cursive;
  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 26px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --header-h: 60px;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

/* Mode Flirt — Nébuleuse Nocturne */
:root, :root[data-mode="flirt"], :root[data-mode="paused"] {
  --bg: #0F172A;
  --bg-2: #1E112A;
  --surface: rgba(30, 17, 42, .62);
  --surface-strong: rgba(36, 22, 52, .92);
  --border: rgba(167, 139, 250, .22);
  --text: #F8FAFC;
  --text-2: rgba(248, 250, 252, .66);
  --text-3: rgba(248, 250, 252, .42);
  --accent: #7C3AED;
  --accent-2: #A78BFA;
  --accent-soft: rgba(124, 58, 237, .22);
  --warm: #F59E0B;
  --warm-soft: rgba(245, 158, 11, .18);
  --mine: linear-gradient(135deg, #7C3AED, #5B21B6);
  --mine-text: #FFFFFF;
  --theirs: rgba(255, 255, 255, .08);
  --paper: #2A1C3A;
  --ink: #F5E6C8;
  --input: rgba(255, 255, 255, .06);
  --danger: #F87171;
  --ok: #34D399;
  --aura-1: rgba(124, 58, 237, .45);
  --aura-2: rgba(245, 158, 11, .22);
  --aura-3: rgba(76, 29, 149, .5);
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* Mode Couple — Aurore Chaleureuse (clair) */
:root[data-mode="couple"] {
  --bg: #FAFAF9;
  --bg-2: #FCEFEA;
  --surface: rgba(255, 255, 255, .72);
  --surface-strong: rgba(255, 255, 255, .96);
  --border: rgba(225, 29, 72, .16);
  --text: #18181B;
  --text-2: rgba(24, 24, 27, .64);
  --text-3: rgba(24, 24, 27, .42);
  --accent: #E11D48;
  --accent-2: #FB7185;
  --accent-soft: rgba(253, 164, 175, .32);
  --warm: #D97706;
  --warm-soft: rgba(217, 119, 6, .14);
  --mine: linear-gradient(135deg, #E11D48, #BE123C);
  --mine-text: #FFFFFF;
  --theirs: rgba(255, 255, 255, .9);
  --paper: #FBF3EC;
  --ink: #3F1D24;
  --input: #FFFFFF;
  --danger: #DC2626;
  --ok: #059669;
  --aura-1: rgba(253, 164, 175, .55);
  --aura-2: rgba(217, 119, 6, .2);
  --aura-3: rgba(225, 29, 72, .18);
  --shadow: 0 18px 46px rgba(63, 29, 36, .14);
  color-scheme: light;
}

/* Mode Couple — Aurore Chaleureuse (sombre) */
@media (prefers-color-scheme: dark) {
  :root[data-mode="couple"] {
    --bg: #18181B;
    --bg-2: #2A1A1E;
    --surface: rgba(39, 24, 28, .66);
    --surface-strong: rgba(44, 28, 32, .95);
    --border: rgba(253, 164, 175, .2);
    --text: #FAFAF9;
    --text-2: rgba(250, 250, 249, .66);
    --text-3: rgba(250, 250, 249, .42);
    --theirs: rgba(255, 255, 255, .08);
    --paper: #33211F;
    --ink: #FBE7DC;
    --input: rgba(255, 255, 255, .06);
    --aura-1: rgba(225, 29, 72, .35);
    --aura-3: rgba(217, 119, 6, .2);
    --shadow: 0 18px 50px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: linear-gradient(170deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  overflow: hidden;
  overscroll-behavior: none;
  transition: background .5s var(--ease), color .3s;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Auras organiques d'arrière-plan */
.aura-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aura-bg i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9; animation: drift 22s ease-in-out infinite alternate; }
.aura-bg i:nth-child(1) { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--aura-1); }
.aura-bg i:nth-child(2) { width: 45vmax; height: 45vmax; right: -18vmax; top: 20vh; background: var(--aura-2); animation-duration: 28s; }
.aura-bg i:nth-child(3) { width: 50vmax; height: 50vmax; left: 10vw; bottom: -30vmax; background: var(--aura-3); animation-duration: 34s; }
@keyframes drift { to { transform: translate3d(6vmax, 4vmax, 0) scale(1.08); } }

#app { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; max-width: 720px; margin: 0 auto; }

/* Boot */
.boot { flex: 1; display: grid; place-content: center; justify-items: center; gap: 14px; }
.boot-name { font-family: var(--font-display); font-size: 28px; margin: 0; letter-spacing: .5px; }
.logo-mark { position: relative; width: 64px; height: 44px; }
.logo-mark span { position: absolute; top: 0; width: 44px; height: 44px; border-radius: 50%; mix-blend-mode: screen; animation: breathe 2.6s ease-in-out infinite; }
.logo-mark span:first-child { left: 0; background: var(--accent); }
.logo-mark span:last-child { right: 0; background: var(--warm); animation-delay: -1.3s; }
:root[data-mode="couple"] .logo-mark span { mix-blend-mode: multiply; }
@keyframes breathe { 50% { transform: scale(.88); } }

/* ─── Écrans d'accueil (auth, jumelage) ─── */
.onboard { flex: 1; overflow-y: auto; padding: calc(32px + var(--safe-top)) 20px calc(32px + var(--safe-bottom)); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.onboard .brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.onboard h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 8vw, 40px); margin: 0; letter-spacing: -.3px; }
.onboard .lede { color: var(--text-2); margin: 0; max-width: 34ch; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 22px 20px;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--shadow);
}
.card h2 { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin: 0 0 6px; }
.card p { margin: 0 0 14px; color: var(--text-2); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .textarea {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 13px 14px;
  font-size: 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: none; min-height: 96px; }
.code-input { text-align: center; font-size: 28px; letter-spacing: 10px; font-weight: 700; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--text-3); }
.phone-row { display: flex; gap: 8px; }
.phone-row .country { flex: none; width: 112px; padding-left: 10px; padding-right: 6px; }
.phone-row input { flex: 1; min-width: 0; letter-spacing: .5px; }
.counter { font-size: 12px; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--input); font-weight: 600; font-size: 15px;
  transition: transform .12s, opacity .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--mine); color: #fff; border-color: transparent; box-shadow: 0 8px 24px var(--accent-soft); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.linkish { background: none; border: 0; color: var(--accent-2); font-weight: 600; padding: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.big-code { font-family: var(--font-display); font-size: 44px; letter-spacing: 10px; text-align: center; padding: 18px 0 8px; font-variant-numeric: tabular-nums; }
.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warm); margin-right: 8px; animation: breathe 1.6s infinite; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Shell de l'app ─── */
.shell { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  min-height: calc(var(--header-h) + var(--safe-top));
  background: linear-gradient(180deg, var(--bg) 30%, transparent);
}
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--mine); position: relative; font-size: 16px; }
.avatar .presence { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--bg); background: var(--text-3); }
.avatar .presence.on { background: var(--ok); }
.topbar .who { flex: 1; min-width: 0; }
.topbar .name { font-family: var(--font-display); font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 12.5px; color: var(--text-2); }
.mode-chip { font-size: 12px; font-weight: 700; padding: 6px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--border); }
:root[data-mode="couple"] .mode-chip { color: var(--accent); }
.net-banner { flex: none; margin: 0 16px 6px; font-size: 12.5px; padding: 7px 12px; border-radius: 10px; background: var(--warm-soft); color: var(--warm); text-align: center; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.page { padding: 8px 16px calc(24px + var(--tabbar-h) + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px; }
.page h2.title { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 4px 0 0; }

.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: var(--surface-strong);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 600; position: relative; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { color: var(--accent-2); }
:root[data-mode="couple"] .tab[aria-current="page"] svg { color: var(--accent); }
.tab .badge-dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--warm); border: 2px solid var(--surface-strong); }

/* ─── Chat ─── */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.day-sep { align-self: center; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 14px 0 6px; text-transform: capitalize; }
.msg { display: flex; flex-direction: column; max-width: 82%; animation: msgIn .35s var(--ease); }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg.theirs { align-self: flex-start; align-items: flex-start; }
.msg + .msg.same { margin-top: -1px; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.bubble { padding: 10px 14px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.mine .bubble { background: var(--mine); color: var(--mine-text); border-bottom-right-radius: 6px; }
.theirs .bubble { background: var(--theirs); border: 1px solid var(--border); border-bottom-left-radius: 6px; backdrop-filter: blur(10px); }
.meta { font-size: 11px; color: var(--text-3); padding: 3px 6px 6px; display: flex; gap: 6px; align-items: center; }
.meta .failed { color: var(--danger); font-weight: 600; }
.meta button { background: none; border: 0; color: var(--accent-2); font-size: 11px; font-weight: 700; padding: 0; }
.load-more { align-self: center; margin: 6px 0; }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; border-radius: 20px; background: var(--theirs); border: 1px solid var(--border); margin-top: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 30% { transform: translateY(-4px); background: var(--text-2); } }
/* Messages manuscrits : bulles, écriture en direct et zone de saisie partagent la même plume */
.msg .bubble, .composer textarea {
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.12;
  letter-spacing: .1px;
}
.msg .bubble { padding: 8px 15px 9px; }
.composer textarea { padding: 9px 16px 8px; min-height: 46px; overflow-y: hidden; scrollbar-width: thin; }
.composer textarea::placeholder { font-family: var(--font-hand); font-size: 22px; }

/* ─── Effets de surprise ─── */

/* L'aura complice : les deux halos se rejoignent quand l'autre est là, palpitent quand il écrit */
.aura-bg i { transition: transform 3.2s cubic-bezier(.22, .8, .24, 1), opacity 1.2s; }
body.together .aura-bg i:nth-child(1) { transform: translate3d(18vw, 26vh, 0) scale(.8); animation: none; }
body.together .aura-bg i:nth-child(2) { transform: translate3d(-22vw, 8vh, 0) scale(1.05); animation: none; }
body.partner-typing .aura-bg i:nth-child(2) { animation: auraPulse 1.4s ease-in-out infinite; }
@keyframes auraPulse { 50% { opacity: .45; } }

/* Les mots qui rougissent */
.magic-host { position: relative; }
.magic-layer { position: absolute; inset: -40px -10px 0; pointer-events: none; overflow: visible; z-index: 3; }
.float-heart { position: absolute; bottom: 30%; color: #F472B6; text-shadow: 0 0 10px rgba(244, 114, 182, .7); animation: heartUp 2.8s cubic-bezier(.2, .7, .3, 1) forwards; opacity: 0; }
@keyframes heartUp { 0% { opacity: 0; transform: translate(0, 10px) scale(.4); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--drift, 0), -120px) scale(1.15) rotate(12deg); } }
.twinkle { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #FEF3C7; box-shadow: 0 0 8px 2px rgba(253, 230, 138, .8); animation: twinkle 2.2s ease-in-out forwards; opacity: 0; }
@keyframes twinkle { 30% { opacity: 1; transform: scale(1.6); } 100% { opacity: 0; transform: scale(.2); } }
.msg .bubble.magic-love { box-shadow: 0 0 0 1px rgba(244, 114, 182, .35), 0 6px 22px rgba(244, 114, 182, .22); }
.msg .bubble.magic-night { background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.7), transparent), radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,.55), transparent), radial-gradient(1.5px 1.5px at 85% 20%, rgba(253,230,138,.8), transparent); }
.msg .bubble.magic-heat { box-shadow: 0 0 18px rgba(245, 158, 11, .35); }
.bubble { position: relative; }
.kiss-mark { position: absolute; right: -12px; bottom: -10px; width: 34px; transform: rotate(-14deg); opacity: .85; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.kiss-in .kiss-mark { animation: kissIn .7s cubic-bezier(.3, 1.6, .5, 1) both .25s; }
@keyframes kissIn { from { transform: rotate(-14deg) scale(2.6); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: .85; } }
.shiver { animation: shiver 1.5s ease-in-out; }
@keyframes shiver { 10%, 30%, 50%, 70% { transform: translateX(-2px) rotate(-.4deg); } 20%, 40%, 60% { transform: translateX(2px) rotate(.4deg); } 85% { transform: scale(.98); } }
.heat-wave { animation: heat 2.3s ease-in-out; }
@keyframes heat { 0% { filter: none; } 30% { filter: drop-shadow(0 0 14px rgba(245, 158, 11, .8)) saturate(1.3); transform: scale(1.03); } 60% { filter: drop-shadow(0 0 22px rgba(225, 29, 72, .6)) saturate(1.4); } 100% { filter: none; transform: none; } }
.giggle { animation: giggle 1.1s ease-in-out; }
@keyframes giggle { 20%, 60% { transform: translateY(-4px) rotate(-1.5deg); } 40%, 80% { transform: translateY(0) rotate(1.5deg); } }

/* L'encre invisible */
.ink-bubble { position: relative; overflow: hidden; }
.ink-bubble.ink-sealed { min-width: 190px; min-height: 52px; }
.ink-bubble.ink-sealed .ink-text { color: #F6C77B; text-shadow: 0 0 10px rgba(245, 158, 11, .55); }
.ink-cover { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; border-radius: inherit; }
.ink-hint { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-ui); font-size: 11.5px; font-weight: 600; letter-spacing: .4px; color: rgba(255, 228, 196, .75); pointer-events: none; text-align: center; padding: 0 10px; animation: inkHint 2.6s ease-in-out infinite; }
@keyframes inkHint { 50% { opacity: .45; } }
.ink-bubble.warming .ink-hint { opacity: 0; animation: none; }
.ink-bubble.warming::after { content: ""; position: absolute; left: var(--hx, 50%); top: var(--hy, 50%); width: 90px; height: 90px; margin: -45px; border-radius: 50%; background: radial-gradient(circle, rgba(245, 158, 11, .35), transparent 70%); pointer-events: none; }
.ink-bubble.ink-revealing .ink-text, .ink-bubble.ink-revealed .ink-text { animation: inkWarm 1.6s ease-out both; }
@keyframes inkWarm { 0% { color: #F6C77B; text-shadow: 0 0 14px rgba(245, 158, 11, .9); } 100% { color: inherit; text-shadow: none; } }
.ink-mine .ink-tag { display: block; font-family: var(--font-ui); font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; opacity: .7; margin-top: 2px; }

/* Bouton et feuille des effets */
.icon-btn.magic-btn { color: var(--warm); }
.icon-btn.magic-btn.armed { background: linear-gradient(135deg, #F59E0B, #E11D48); color: #fff; border-color: transparent; box-shadow: 0 0 16px rgba(245, 158, 11, .5); }
.composer textarea.ink-armed { background: linear-gradient(135deg, #2b1d2e, #3a2638); color: #F6C77B; border-color: rgba(245, 158, 11, .45); }
.effect-list { display: flex; flex-direction: column; gap: 10px; }
.effect-item { display: flex; gap: 14px; align-items: center; text-align: left; width: 100%; padding: 14px; border-radius: var(--radius-m); border: 1px solid var(--border); background: var(--input); }
.effect-item .emoji { font-size: 28px; flex: none; width: 40px; text-align: center; }
.effect-item b { display: block; font-size: 15px; }
.effect-item span.desc { font-size: 12.5px; color: var(--text-2); }
.effect-item[aria-pressed="true"] { border-color: var(--warm); background: var(--warm-soft); }
.topbar .touch-btn { flex: none; }

/* L'Effleurement */
.touch-overlay { position: fixed; inset: 0; z-index: 90; background: radial-gradient(circle at 50% 40%, rgba(40, 18, 60, .94), rgba(6, 4, 14, .98)); animation: fadeIn .4s; touch-action: none; overscroll-behavior: none; }
.touch-overlay.is-fused { background: radial-gradient(circle at 50% 40%, rgba(70, 20, 60, .94), rgba(10, 4, 14, .98)); }
.touch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.touch-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: calc(16px + var(--safe-top)) 18px 0; pointer-events: none; color: #F8FAFC; }
.touch-top .touch-close { pointer-events: auto; background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }
.touch-title { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.touch-status { font-family: var(--font-hand); font-size: 22px; color: #FDE68A; min-height: 26px; }
.touch-help { position: absolute; left: 0; right: 0; bottom: calc(26px + var(--safe-bottom)); text-align: center; font-size: 13px; color: rgba(248, 250, 252, .55); padding: 0 24px; pointer-events: none; }
.touch-invite { position: fixed; left: 50%; top: calc(14px + var(--safe-top)); transform: translateX(-50%); z-index: 95; width: min(440px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 20px; background: var(--surface-strong); border: 1px solid color-mix(in srgb, var(--warm) 45%, transparent); box-shadow: 0 14px 40px rgba(0,0,0,.4), 0 0 30px rgba(245, 158, 11, .25); animation: inviteIn .5s cubic-bezier(.3, 1.4, .5, 1); }
.touch-invite .grow { flex: 1; min-width: 0; }
.touch-invite .hint { font-size: 12.5px; }
.touch-invite .linkish svg { width: 18px; height: 18px; }
.touch-invite-glow { width: 16px; height: 16px; border-radius: 50%; background: #F59E0B; box-shadow: 0 0 14px 4px rgba(245, 158, 11, .7); animation: breathe 1.2s ease-in-out infinite; flex: none; }
@keyframes inviteIn { from { transform: translate(-50%, -30px); opacity: 0; } }

/* Écriture en direct */
.msg.live { margin-top: 4px; }
.live-bubble { border-style: dashed !important; opacity: .92; min-width: 44px; transition: opacity .3s, filter .3s; }
.live-bubble.hesitating { animation: hesitate 1.6s ease-in-out infinite; }
.live-bubble.erased .live-text { opacity: .7; }
@keyframes hesitate { 50% { opacity: .55; filter: blur(.3px); } }
.live-del { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 2px; animation: delFade 1.1s ease-out forwards; }
@keyframes delFade { 0% { opacity: 1; } 70% { opacity: .55; } 100% { opacity: 0; } }
.live-caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; vertical-align: -2px; background: var(--warm); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.live-status { font-style: italic; }
.msg.live .typing { margin-top: 0; }
.icon-btn.live-toggle { width: 36px; height: 36px; margin-bottom: 4px; }
.icon-btn.live-toggle svg { width: 19px; height: 19px; }
.live-toggle[aria-pressed="true"] { color: var(--warm); border-color: color-mix(in srgb, var(--warm) 45%, transparent); }
.live-toggle[aria-pressed="false"] { color: var(--text-3); }

.event-card { align-self: center; text-align: center; max-width: 88%; padding: 10px 16px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--border); font-size: 13px; color: var(--text-2); margin: 8px 0; }
.event-card b { color: var(--text); }
.event-card .btn { margin-top: 8px; }
.empty-chat { margin: auto; text-align: center; color: var(--text-2); padding: 30px 20px; max-width: 32ch; }
.empty-chat .logo-mark { margin: 0 auto 14px; }

.composer {
  flex: none; display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: var(--surface-strong); border-top: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.composer textarea {
  flex: 1; resize: none; max-height: 140px; min-height: 44px;
  border-radius: 22px; padding: 11px 16px; border: 1px solid var(--border);
  background: var(--input); outline: none; font-size: 16px; line-height: 1.35;
}
.icon-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--input); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.send { background: var(--mine); color: #fff; border-color: transparent; }
.icon-btn:disabled { opacity: .45; }
.chat-with-tabs .composer { padding-bottom: 8px; }

/* ─── Feuille modale ─── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--surface-strong); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 10px 18px calc(20px + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.3); animation: sheetIn .35s var(--ease);
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 14px; }
.sheet h3 { font-family: var(--font-display); font-weight: 600; font-size: 21px; margin: 0 0 4px; }
.sheet .sub { color: var(--text-2); margin: 0 0 16px; font-size: 14px; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--input); border: 1px solid var(--border); }
.seg button { flex: 1; border: 0; background: none; padding: 9px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button[aria-pressed="true"] { background: var(--mine); color: #fff; }
.photo-pick { position: relative; aspect-ratio: 4 / 5; max-height: 46vh; margin: 0 auto 14px; border-radius: 20px; overflow: hidden; border: 1px dashed var(--border); display: grid; place-items: center; background: var(--input); color: var(--text-2); width: 100%; max-width: 320px; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ─── Photo à double-fond ─── */
.flip { position: relative; width: min(260px, 66vw); aspect-ratio: 4 / 5; border-radius: 22px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.flip .face { position: absolute; inset: 0; border-radius: 22px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--border); will-change: transform, opacity; }
.flip .front { background: #000; }
.flip .front img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.flip .front .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.25), transparent 45%, rgba(0,0,0,.4)); pointer-events: none; }
.flip .badge { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: rgba(15, 10, 25, .55); color: #fff; border: 1px solid rgba(255,255,255,.2); font-size: 11px; font-weight: 700; letter-spacing: .3px; backdrop-filter: blur(8px); }
.flip .badge svg { width: 12px; height: 12px; fill: #F59E0B; }
.flip .hint { position: absolute; right: 14px; bottom: 14px; color: rgba(255,255,255,.92); font-size: 12px; font-weight: 600; pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.flip .corner { position: absolute; right: 0; bottom: 0; border-top-left-radius: 22px; overflow: hidden; pointer-events: none; background: linear-gradient(135deg, var(--paper), var(--accent-soft), var(--warm)); box-shadow: -3px -3px 12px rgba(0,0,0,.3); }
.flip .back { background: var(--paper); color: var(--ink); }
.flip .ruled { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(135deg, var(--paper), var(--accent-soft) 55%, var(--paper)); }
.flip .ruled::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 calc(10% - 1px), color-mix(in srgb, var(--ink) 14%, transparent) calc(10% - 1px) 10%); }
.flip .ruled::after { content: ""; position: absolute; top: 0; bottom: 0; left: 30px; width: 1px; background: var(--accent); opacity: .35; }
.flip .content { position: relative; height: 100%; display: flex; flex-direction: column; padding: 16px 16px 14px 42px; }
.flip .title { font-family: var(--font-hand); font-size: 22px; color: var(--accent-2); }
:root[data-mode="couple"] .flip .title { color: var(--accent); }
.flip .slot { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; overflow: hidden; }
.flip .secret-text { font-family: var(--font-hand); font-size: 26px; line-height: 1.12; overflow-wrap: anywhere; }
.flip .close { align-self: flex-end; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 700; color: var(--ink); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; }
.flip .loc { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.flip .loc .name { font-family: var(--font-hand); font-size: 26px; }
.flip .loc a { background: var(--accent); color: #fff; text-decoration: none; font-size: 13px; font-weight: 700; padding: 8px 18px; border-radius: 999px; margin-top: 4px; }
.flip .mini-player { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.flip .mini-player button { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; }
.flip .mini-player button svg { width: 24px; height: 24px; }
.track { width: 100%; height: 4px; border-radius: 2px; background: var(--accent-soft); overflow: hidden; }
.track i { display: block; height: 100%; width: 0; background: var(--warm); }
.tnum { font-variant-numeric: tabular-nums; font-size: 12px; }
.flip.loading .front { background: linear-gradient(90deg, var(--theirs) 25%, var(--accent-soft) 50%, var(--theirs) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.flip .peel-zone { position: absolute; right: 0; bottom: 0; width: 58%; height: 46%; touch-action: none; cursor: grab; z-index: 2; }
.flip .peel-zone:active { cursor: grabbing; }
.flip .peel-zone.anywhere { width: 100%; height: 100%; }

.demo-flip { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.demo-flip .flip { width: min(230px, 62vw); }
.demo-flip .hint { margin: 0; }
.empty-chat.demo-flip { gap: 16px; }

/* ─── Capsule vocale (sceau) ─── */
.seal-card { width: min(280px, 72vw); padding: 14px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(14px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mine .seal-card { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.seal-wrap { position: relative; width: 170px; height: 170px; display: grid; place-items: center; }
.seal-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.seal {
  position: relative; width: 92px; height: 92px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--warm) 80%, #fff), var(--warm) 45%, color-mix(in srgb, var(--warm) 60%, #000));
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.25), inset 0 4px 10px rgba(255,255,255,.35), 0 8px 24px var(--warm-soft);
  color: #3b2200; font-family: var(--font-display); font-size: 30px; font-weight: 600;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .2s var(--ease);
}
.seal.holding { transform: scale(.94); }
.seal-card .label { font-size: 12.5px; color: var(--text-2); text-align: center; }
.seal-card .amb { font-size: 11.5px; font-weight: 700; color: var(--warm); text-transform: uppercase; letter-spacing: .8px; }

/* Enregistreur */
.recorder { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--mine); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 30px var(--accent-soft); }
.rec-btn svg { width: 32px; height: 32px; }
.rec-btn.recording { background: var(--danger); animation: breathe 1.4s infinite; }
.rec-time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rec-wave { width: 100%; height: 56px; }
.amb-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; }
.amb-choices button { border: 1px solid var(--border); background: var(--input); border-radius: 14px; padding: 10px 4px; font-size: 12px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.amb-choices button span { font-size: 20px; }
.amb-choices button[aria-pressed="true"] { border-color: var(--warm); background: var(--warm-soft); }

/* ─── Question du jour ─── */
.prompt-hero { text-align: center; padding: 26px 20px; }
.prompt-hero .eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--warm); }
.prompt-hero .q { font-family: var(--font-display); font-size: clamp(22px, 6vw, 28px); line-height: 1.25; margin: 12px 0 0; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; position: relative; }
.answer { min-height: 150px; padding: 16px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.answer .who { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .8px; }
.answer .txt { font-family: var(--font-hand); font-size: 23px; line-height: 1.15; overflow-wrap: anywhere; }
.answer.sealed .txt { filter: blur(9px); user-select: none; }
.answer .wax { position: absolute; right: 12px; bottom: 12px; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--warm) 80%, #fff), var(--warm) 50%, color-mix(in srgb, var(--warm) 60%, #000)); color: #3b2200; font-size: 18px; box-shadow: 0 4px 12px var(--warm-soft); }
.answer.waiting { align-items: center; justify-content: center; text-align: center; color: var(--text-2); border-style: dashed; }
.answers.fusing .answer:first-child { animation: fuseL 1.3s var(--ease) both; }
.answers.fusing .answer:last-child { animation: fuseR 1.3s var(--ease) both; }
.answers.fusing::after { content: ""; position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px; border-radius: 50%; background: var(--warm); filter: blur(4px); animation: flash 1.3s var(--ease) both; pointer-events: none; }
@keyframes fuseL { 0% { transform: translateX(0); } 40% { transform: translateX(46%) scale(.92); filter: blur(2px); } 100% { transform: none; } }
@keyframes fuseR { 0% { transform: translateX(0); } 40% { transform: translateX(-46%) scale(.92); filter: blur(2px); } 100% { transform: none; } }
@keyframes flash { 0%, 25% { transform: scale(0); opacity: 0; } 42% { transform: scale(14); opacity: .85; } 100% { transform: scale(20); opacity: 0; } }
.history-item { padding: 14px 16px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--border); }
.history-item .q { font-weight: 600; margin-bottom: 8px; }
.history-item .a { font-size: 14px; color: var(--text-2); margin: 4px 0; }
.history-item .a b { color: var(--text); }
audio.inline { width: 100%; height: 36px; }

/* ─── Salon ─── */
.player-box { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-m); overflow: hidden; background: #000; border: 1px solid var(--border); box-shadow: var(--shadow); }
.player-box > div, .player-box iframe { width: 100%; height: 100%; border: 0; display: block; }
.player-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: rgba(255,255,255,.7); gap: 8px; padding: 20px; }
.controls { display: flex; gap: 10px; align-items: center; justify-content: center; }
.controls .icon-btn { width: 52px; height: 52px; }
.controls .icon-btn.main { width: 64px; height: 64px; background: var(--mine); color: #fff; border-color: transparent; }
.salon-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.salon-status div { padding: 10px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-align: center; }
.salon-status b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.salon-status span { font-size: 11px; color: var(--text-3); }
.voice-bar { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--border); }
.voice-bar .lvl { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.meter { height: 6px; border-radius: 3px; background: var(--accent-soft); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.duck-tag { font-size: 11px; font-weight: 800; letter-spacing: .8px; color: var(--warm); }

/* ─── Réglages ─── */
.settings-group { border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--border); overflow: hidden; }
.settings-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); margin: 0; padding: 14px 16px 6px; }
.settings-row { padding: 12px 16px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--border); }
.settings-row:first-of-type { border-top: 0; }
.settings-row .grow { flex: 1; min-width: 0; }
.settings-row .label { font-weight: 600; }
.settings-row .desc { font-size: 12.5px; color: var(--text-2); }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 16px 16px; }
.mode-cards button { border: 1px solid var(--border); border-radius: 16px; padding: 12px 6px; background: var(--input); font-size: 12.5px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mode-cards button i { width: 28px; height: 28px; border-radius: 50%; }
.mode-cards button[aria-pressed="true"] { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ─── Accueil : liste des duos ─── */
.home-title { flex: 1; font-family: var(--font-display); font-weight: 600; font-size: 24px; }
a.avatar { text-decoration: none; }
.back-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 0; background: transparent; color: var(--text); margin-left: -8px; text-decoration: none; font-size: 22px; }
.conv-list { display: flex; flex-direction: column; gap: 4px; }
.conv { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius-m); color: inherit; text-decoration: none; transition: background .15s; }
.conv:hover, .conv:focus-visible { background: var(--surface); }
.conv:active { transform: scale(.99); }
.conv .avatar { width: 52px; height: 52px; font-size: 20px; }
.avatar.mode-couple { background: linear-gradient(135deg, #E11D48, #FDA4AF); }
.avatar.mode-paused { background: linear-gradient(135deg, #334155, #64748B); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top, .conv-bottom { display: flex; align-items: center; gap: 8px; }
.conv-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { flex: none; font-size: 12px; color: var(--text-3); }
.conv-preview { flex: 1; min-width: 0; font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-preview { color: var(--text); font-weight: 600; }
.conv.unread .conv-time { color: var(--warm); font-weight: 700; }
.conv-badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--warm); color: #1b1200; font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.conv-chip { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--warm); color: var(--warm); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.conv-mode { font-size: 11px; color: var(--text-3); font-weight: 600; }
.pending-invite { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface); border: 1px dashed var(--border); }
.pending-invite .grow { flex: 1; min-width: 0; }
.pending-invite .label { font-weight: 600; }
.pending-invite .linkish svg { width: 18px; height: 18px; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.share-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--input); font-size: 11.5px; font-weight: 600; text-align: center; }
.share-tile span { font-size: 22px; }
.invite-banner { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-m); background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent); }
.invite-banner .avatar { width: 46px; height: 46px; }
@media (max-width: 380px) { .share-grid { grid-template-columns: repeat(3, 1fr); } }

/* ─── Squelettes, toasts ─── */
.skeleton { border-radius: 18px; background: linear-gradient(90deg, var(--theirs) 25%, var(--accent-soft) 50%, var(--theirs) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-msg { height: 40px; width: 55%; margin: 6px 0; }
.sk-msg.r { align-self: flex-end; width: 42%; }
#toasts { position: fixed; left: 0; right: 0; top: calc(12px + var(--safe-top)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; max-width: 440px; padding: 11px 16px; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; font-weight: 500; animation: toastIn .3s var(--ease); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.toast.error::before { content: "⚠ "; color: var(--danger); }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } }
.notice { padding: 14px 16px; border-radius: var(--radius-m); background: var(--warm-soft); border: 1px solid color-mix(in srgb, var(--warm) 35%, transparent); font-size: 14px; }
.notice code { font-size: 12.5px; background: rgba(0,0,0,.15); padding: 1px 5px; border-radius: 5px; }

@media (min-width: 721px) {
  #app { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
