/* L'appli, dans la même nuit que le site (06_SITE/src/commun.css) :
   fond chaud presque noir, texte ivoire, une seule lumière, celle d'une lampe, et une touche de rouge vin.
   Titres en Fraunces (empattements doux), texte courant en Instrument Sans. Polices servies ici : aucun appel à Google.
   Contrastes vérifiés en WCAG AA (texte 4,5:1, contours et indicateurs 3:1). Le rouge vin ne sert jamais au texte. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/polices/fraunces-variable.ttf") format("truetype");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/polices/instrument-sans-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/polices/instrument-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --fond: #131209;            /* un noir chaud */
  --surface: #1d1b14;
  --doux: #26231b;
  --barre: #181712;           /* en-têtes et champ d'écriture, comme le téléphone du site */
  --bulle: #24221b;           /* ses bulles à elle */
  --ecran-noir: #0d0c08;      /* stories et photo en grand */
  --encre: #f3ece2;           /* ivoire */
  --gris: #b3a898;            /* texte secondaire : 6,7:1 au pire */
  --clair: #d8cfc2;
  --ligne: #332f26;           /* séparateurs, décoratifs */
  --contour: #756d5e;         /* bords des champs : 3:1 au moins sur toutes les surfaces */
  --placeholder: #9a9182;     /* 5:1 au moins */
  --accent: #D2A86E;          /* l’or de sa bague (avant : la lampe #e8b07f) */
  --accent-survol: #E2BE8A;
  --sur-accent: #1a140d;      /* texte sur l'ambre : 9,5:1 */
  --sur-accent-doux: rgba(26, 20, 13, 0.72); /* heure et méta dans ses bulles à lui : 5:1 */
  --vin: #A8283F;             /* le rouge du sceau, seulement pour dire « elle t’a écrit » : anneaux, points, étapes avancées */
  --vu: #7a2236;              /* ✓✓ vu, sur l'ambre : 5,2:1 */
  --alerte: #f08b7a;          /* erreurs et actions destructives : 7:1 */
  --ombre: 0 16px 48px rgba(0, 0, 0, 0.55);
  --courbe: cubic-bezier(0.22, 1, 0.36, 1);
  --titre: "Fraunces", ui-serif, Georgia, serif;
  --texte: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { background: var(--fond); -webkit-text-size-adjust: 100%; }
body {
  background: var(--fond); color: var(--encre);
  font: 400 16px/24px var(--texte); -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--sur-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 3px; }

/* transform : les panneaux en position fixe restent dans #app (donc dans le cadre du téléphone sur ordinateur).
   --top : la hauteur à laisser libre en haut (encoche du téléphone dessiné, ou barre d'état de l'iPhone installé). */
#app { max-width: 520px; height: 100dvh; margin: 0 auto; background: var(--fond); position: relative; overflow: hidden; transform: translateZ(0); --top: env(safe-area-inset-top, 0px); }
@media (min-width: 560px) { #app { border-inline: 1px solid var(--ligne); box-shadow: var(--ombre); } }
.phone-caption { display: none; }

/* Sur ordinateur : l'appli dans le téléphone du site, posé dans la nuit sous une lampe. */
@media (min-width: 760px) and (min-height: 660px) {
  body {
    background: radial-gradient(1000px 640px at 50% -8%, rgba(210, 168, 110, 0.11), rgba(210, 168, 110, 0) 70%), var(--fond);
    min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  #app {
    width: 393px; max-width: none; height: min(852px, calc(100dvh - 72px)); margin: 0;
    border: 11px solid #050504; border-radius: 56px; --top: 40px;
    box-shadow: 0 0 0 1px #2a2720, 0 32px 96px rgba(210, 168, 110, 0.14), 0 8px 24px rgba(0, 0, 0, 0.6);
  }
  #app::before { content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 112px; height: 32px; border-radius: 20px; background: #050504; z-index: 60; pointer-events: none; }
  .phone-caption { display: block; margin: 16px 0 0; font-size: 12px; line-height: 16px; color: var(--gris); letter-spacing: 0.02em; }
  .sheet { border-radius: 24px 24px 40px 40px; }
}
.screen { height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
.screen, .messages, .sheet, .contact-body { scrollbar-width: thin; scrollbar-color: #4a453b transparent; }

h1, h2 {
  font-family: var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -0.015em; text-wrap: balance;
}
h1 { font-size: 36px; line-height: 40px; font-weight: 350; margin: 0 0 8px; }
h2 { font-size: 24px; line-height: 32px; font-weight: 400; margin: 0 0 12px; }
h3 { font: 600 12px/16px var(--texte); text-transform: uppercase; letter-spacing: 0.08em; color: var(--gris); margin: 24px 0 8px; }
p { text-wrap: pretty; }

/* L'étiquette du site : un point de lumière qui veille */
.kicker {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  margin: 0 0 8px; padding: 4px 12px; border: 1px solid var(--ligne); border-radius: 999px; background: var(--surface);
  font: 600 12px/16px var(--texte); text-transform: uppercase; letter-spacing: 0.08em; color: var(--gris);
}
.kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(210, 168, 110, 0.8); flex: none; }
@media (prefers-reduced-motion: no-preference) { .kicker::before { animation: veille 2.8s var(--courbe) infinite; } }
@keyframes veille { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hint, small { color: var(--gris); font-size: 14px; line-height: 20px; }
.sub { color: var(--gris); margin: 0 0 16px; }

.btn {
  display: inline-block; align-content: center; min-height: 48px; /* pas de flex : certains libellés portent un <span> d'accord */
  border: 0; border-radius: 999px; padding: 12px 24px; font-weight: 600; line-height: 24px; text-decoration: none; text-align: center;
  background: var(--doux); color: var(--encre); box-shadow: inset 0 0 0 1px var(--ligne);
  transition: background-color 300ms var(--courbe), box-shadow 300ms var(--courbe), transform 300ms var(--courbe);
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--sur-accent); box-shadow: none; }
.btn.primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; background: var(--accent); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px #4a453b; }
.btn.danger { background: transparent; color: var(--alerte); box-shadow: inset 0 0 0 1px rgba(240, 139, 122, 0.55); }
.btn.small { min-height: 40px; padding: 10px 16px; font-size: 14px; line-height: 20px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn-row > * { flex: 1; }
.icon-btn { border: 0; background: transparent; color: var(--encre); font-size: 22px; width: 44px; height: 44px; border-radius: 50%; transition: background-color 300ms var(--courbe); }

/* Avant d'entrer : la lumière d'une lampe tombe d'en haut */
#gate, #ident, #code, #profil, #login, #gate-legacy, #scene {
  background: radial-gradient(480px 360px at 50% -6%, rgba(210, 168, 110, 0.14), rgba(210, 168, 110, 0) 70%), var(--fond);
}
.gate-inner, .scene-inner { margin: auto 0; padding: calc(32px + var(--top)) 24px 32px; display: flex; flex-direction: column; gap: 16px; }
.gate-inner h1 {
  font-size: 48px; line-height: 1;
  background: linear-gradient(90deg, #fff7ec, #a89c8c); -webkit-background-clip: text; background-clip: text; color: transparent;
}
#ident h1, #code h1, #profil h1, #login h1 { font-size: 36px; line-height: 40px; margin: 0; }

/* L'écran d'ouverture : l'emblème « chut » et le mot (charte v3). L'emblème ne descend pas sous 64 px. */
.marque-entree { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0 0 16px; }
.marque-chut { width: 104px; height: 104px; }
.marque-mot { width: 160px; height: auto; }
@media (max-height: 640px) { .marque-chut { width: 80px; height: 80px; } .marque-entree { margin-bottom: 8px; } }
@media (prefers-reduced-motion: no-preference) {
  .marque-entree { animation: apparition 900ms var(--courbe) both; }
  .marque-mot { animation: apparition 900ms var(--courbe) 200ms both; }
}
@keyframes apparition { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gate-inner .hint, .auth-form .hint { margin: 0; }
.notice { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.notice li { background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 12px 16px; font-size: 14px; line-height: 20px; color: var(--clair); }
.notice strong { color: var(--encre); font-weight: 600; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 20px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }

/* Choix du personnage */
.plain-head { padding: 32px 24px 8px; }
.plain-head p { color: var(--gris); margin: 0; }
.cards { padding: 16px 24px 32px; display: grid; gap: 12px; }
.pcard {
  display: grid; grid-template-columns: 88px 1fr; gap: 16px; text-align: left; align-items: center; width: 100%;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; padding: 12px;
  transition: border-color 300ms var(--courbe), background-color 300ms var(--courbe);
}
.pcard:disabled { cursor: default; background: transparent; border-style: dashed; }
.pcard:disabled > div:last-child { opacity: 0.75; }
.pcard strong { font: 500 20px/28px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -0.015em; display: block; }
.pcard span { color: var(--gris); font-size: 14px; line-height: 20px; display: block; }
.portrait {
  background: linear-gradient(145deg, #3a3226, #1d1b14); border-radius: 12px; aspect-ratio: 1; display: grid; place-items: center;
  color: var(--accent); font: 400 32px var(--titre); background-size: cover; background-position: center; overflow: hidden;
}
.pcard:disabled .portrait { background: var(--doux); color: var(--gris); }

.back {
  position: absolute; top: calc(12px + var(--top)); left: 12px; z-index: 2; border: 0; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(19, 18, 9, 0.62); color: var(--encre); font-size: 20px; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.card-hero { padding: 0; position: relative; }
.card-hero .portrait { border-radius: 0; aspect-ratio: 4 / 3; font-size: 64px; }
.card-hero::after { content: ""; position: absolute; inset: auto 0 0; height: 96px; background: linear-gradient(rgba(19, 18, 9, 0), var(--fond)); pointer-events: none; }
.card-body { padding: 8px 24px 32px; display: flex; flex-direction: column; gap: 12px; }
.card-body p { margin: 0; }
.card-body > p:not(.sub):not(.hint) { color: var(--clair); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips span { border: 1px solid #4a453b; border-radius: 999px; padding: 4px 12px; font-size: 14px; line-height: 20px; color: var(--gris); }
.field { display: grid; gap: 4px; margin-top: 8px; }
.field span { font-size: 14px; line-height: 20px; color: var(--gris); }
.field input, .inline-form input, textarea, select, input[type=time] {
  background: var(--surface); border: 1px solid var(--contour); border-radius: 12px; padding: 12px 16px; outline: none;
  transition: border-color 300ms var(--courbe);
}
.field input { min-height: 48px; }
.field input:hover, .inline-form input:hover, textarea:hover, select:hover { border-color: #8d8475; }
.field input:focus, .inline-form input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(210, 168, 110, 0.22); }
.field input:focus-visible, .inline-form input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }

/* Scène : on la lit comme une page de roman */
.scene-text { font: 350 20px/30px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; display: grid; gap: 16px; color: var(--encre); }
.scene-text p { margin: 0; }

/* Messagerie */
.chat-head {
  display: flex; align-items: center; gap: 4px; padding: 8px; flex: none;
  padding-top: calc(8px + var(--top)); background: var(--barre); border-bottom: 1px solid var(--doux);
}
.back-btn { font-size: 30px; line-height: 1; width: 36px; padding: 0; }
.avatar { --anneau: var(--fond); }
.chat-head .avatar, .contact-hero .avatar { --anneau: var(--barre); }
.avatar.story { box-shadow: 0 0 0 2px var(--anneau), 0 0 0 4.5px var(--accent); }
.avatar.story.seen { box-shadow: 0 0 0 2px var(--anneau), 0 0 0 4px #6b6455; }
@media (prefers-reduced-motion: no-preference) { .avatar.story:not(.seen) { animation: ring 2.4s var(--courbe) 1; } }
@keyframes ring { 50% { box-shadow: 0 0 0 2px var(--anneau), 0 0 0 6px var(--vin), 0 0 18px 4px rgba(210, 168, 110, 0.35); } }

/* Discussions */
.home-head { padding: calc(16px + var(--top)) 20px 4px; }
.home-head h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 400; }
.stories-row { display: flex; gap: 16px; padding: 12px 20px; overflow-x: auto; flex: none; scrollbar-width: none; }
.stories-row::-webkit-scrollbar { display: none; }
.stories-row:empty { display: none; }
.story-chip { border: 0; background: transparent; display: grid; justify-items: center; gap: 8px; font-size: 12px; line-height: 16px; color: var(--clair); padding: 4px; border-radius: 12px; }
.story-chip .avatar { width: 60px; height: 60px; }
.conv-list { display: grid; border-top: 1px solid var(--ligne); }
.conv-list:empty { display: none; }
.conv {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 12px 20px; width: 100%;
  border: 0; border-bottom: 1px solid var(--ligne); background: transparent; text-align: left; transition: background-color 300ms var(--courbe);
}
.conv .avatar { width: 52px; height: 52px; }
.conv-main { min-width: 0; display: grid; gap: 2px; }
.conv-name { font-weight: 600; }
.conv-last { color: var(--gris); font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-last.is-typing { color: var(--accent); font-style: italic; }
.conv-side { display: grid; justify-items: end; gap: 4px; font-size: 12px; line-height: 16px; color: var(--gris); font-variant-numeric: tabular-nums; }
.conv-badge { min-width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--sur-accent); font: 700 12px/20px var(--texte); text-align: center; padding: 0 6px; }
.conv-side.unread time { color: var(--accent); font-weight: 600; }
.home-sub { margin: 24px 20px 4px; }
.home-foot { margin: auto 20px 20px; padding-top: 24px; font-size: 12px; line-height: 16px; color: var(--gris); text-align: center; }
#home .cards { padding: 8px 20px 16px; }

/* Réponse à une story, dans la bulle */
.story-quote { display: flex; gap: 8px; align-items: center; margin: -2px 0 6px; padding: 4px 6px; border-radius: 10px; background: rgba(243, 236, 226, 0.06); font-size: 12px; line-height: 16px; color: var(--gris); }
.story-quote img { width: 30px; height: 40px; object-fit: cover; border-radius: 5px; flex: none; }
.msg.mine .story-quote { background: rgba(26, 20, 13, 0.08); color: var(--sur-accent-doux); }

/* Visionneuse de stories */
.story-viewer { position: absolute; inset: 0; z-index: 40; background: var(--ecran-noir); color: var(--encre); display: flex; flex-direction: column; padding-top: var(--top); }
.sv-bars { display: flex; gap: 4px; padding: 12px 12px 8px; }
.sv-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(243, 236, 226, 0.3); overflow: hidden; }
.sv-bars i b { display: block; height: 100%; width: 0; background: var(--encre); }
.sv-bars i.done b { width: 100%; }
.sv-bars i.run b { animation: bar var(--d, 5s) linear forwards; }
@keyframes bar { to { width: 100%; } }
.sv-top { display: flex; align-items: center; gap: 8px; padding: 0 12px 8px; z-index: 2; }
.sv-avatar { width: 32px; height: 32px; font-size: 14px; }
.sv-name { font-weight: 600; font-size: 14px; line-height: 20px; }
.sv-time { color: rgba(243, 236, 226, 0.75); font-size: 12px; line-height: 16px; flex: 1; }
.sv-close { border: 0; background: transparent; color: var(--encre); font-size: 20px; width: 40px; height: 40px; border-radius: 50%; }
.sv-media { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; border-radius: 16px; margin: 0 8px; background: var(--fond); }
.sv-media img { width: 100%; height: 100%; object-fit: cover; }
.sv-caption {
  position: absolute; left: 16px; right: 16px; bottom: 84px; margin: 0; text-align: center; z-index: 2; pointer-events: none;
  font: 400 20px/28px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; color: #fff7ec; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8), 0 0 2px rgba(0, 0, 0, 0.6);
}
.sv-prev, .sv-next { position: absolute; top: 18%; bottom: 80px; width: 35%; border: 0; background: transparent; z-index: 1; }
.sv-prev { left: 0; } .sv-next { right: 0; }
.sv-reply { display: flex; gap: 8px; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); z-index: 2; }
.sv-reply input { flex: 1; min-width: 0; background: transparent; border: 1px solid rgba(243, 236, 226, 0.45); border-radius: 999px; padding: 10px 16px; color: var(--encre); outline: none; }
.sv-reply input:focus { border-color: var(--accent); }
.sv-reply input::placeholder { color: rgba(243, 236, 226, 0.68); }

/* Ses publications */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 12px; }
.posts button { position: relative; border: 0; padding: 0; aspect-ratio: 3 / 4; background: var(--doux) center / cover; border-radius: 8px; overflow: hidden; }
.posts button .badge-ia { top: 4px; right: 4px; font-size: 9px; }
.posts .empty { grid-column: 1 / -1; color: var(--gris); text-align: center; padding: 16px; }
.who { flex: 1; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left; padding: 4px; border-radius: 12px; min-width: 0; transition: background-color 300ms var(--courbe); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, #3a3226, #1d1b14); color: var(--accent); font: 400 18px var(--titre);
  background-size: cover; background-position: 50% 20%;
}
.who-text { display: grid; min-width: 0; }
.who-name { font-weight: 600; }
.who-status { font-size: 12px; line-height: 16px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-ia { font: 700 10px/1 var(--texte); letter-spacing: 0.06em; border: 1px solid var(--gris); color: var(--gris); border-radius: 5px; padding: 2px 4px; vertical-align: 2px; }

.messages { flex: 1; overflow-y: auto; padding: 16px 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; font-size: 12px; line-height: 16px; color: var(--gris); margin: 12px 0 8px; }
.msg {
  max-width: 82%; padding: 8px 12px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; position: relative;
  font-size: 15px; line-height: 22px;
}
@media (prefers-reduced-motion: no-preference) { .msg { animation: pop 300ms var(--courbe); } }
@keyframes pop { from { transform: translateY(6px); opacity: 0.4; } }
.msg.hers { align-self: flex-start; background: var(--bulle); color: var(--encre); border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; background: var(--accent); color: var(--sur-accent); border-bottom-right-radius: 4px; }
.msg + .msg.gap { margin-top: 8px; }
.msg time { display: block; font-size: 11px; line-height: 14px; color: var(--gris); margin-top: 2px; text-align: right; font-variant-numeric: tabular-nums; }
.msg.mine time { color: var(--sur-accent-doux); }
.tick { margin-left: 4px; letter-spacing: -0.18em; font-size: 12px; color: inherit; }
.tick.seen { color: var(--vu); font-weight: 700; }
.send.mic.off { opacity: 0.45; }
.msg.note { align-self: center; max-width: 92%; background: transparent; border: 1px dashed #4a453b; color: var(--gris); font-size: 14px; line-height: 20px; text-align: center; border-radius: 16px; }
.msg.note.out { border-style: solid; border-color: var(--accent); color: var(--encre); background: var(--surface); text-align: left; }
.msg.note.out::before { content: "Hors de la fiction"; display: block; font: 700 11px/16px var(--texte); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.msg.tiny { align-self: center; background: transparent; color: var(--gris); font-size: 12px; line-height: 16px; padding: 4px; }
.msg.gift { align-self: flex-end; background: transparent; border: 1px solid #4a453b; font-size: 14px; line-height: 20px; }

.photo { padding: 4px; width: min(74%, 300px); }
.photo .frame { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 5; display: grid; place-items: center; background: linear-gradient(160deg, #3a3226, #1d1b14); }
.photo .frame.naturel { background: linear-gradient(160deg, #5a3e2c, #26231b); }
.photo .frame.preparee { background: linear-gradient(160deg, #3b1f2a, #6e2a3a); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .ph { padding: 16px; text-align: center; color: var(--encre); font: 400 14px/20px var(--titre); text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.photo .ph b { display: block; font: 700 10px/1 var(--texte); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; color: var(--accent); }
.badge-ia {
  position: absolute; top: 8px; right: 8px; background: rgba(13, 12, 8, 0.66); color: #fff; font: 700 10px/1 var(--texte); letter-spacing: 0.06em;
  padding: 4px 6px; border-radius: 6px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.photo .cap { padding: 6px 8px 2px; }

.msg.voice-msg { padding: 8px 10px 6px; min-width: 236px; }
.voice { display: flex; align-items: center; gap: 10px; }
.vplay { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--sur-accent); flex: none; display: grid; place-items: center; position: relative; }
.vplay svg { width: 16px; height: 16px; fill: currentColor; }
.vplay:disabled { opacity: 0.5; }
.vplay.unheard::after { content: ""; position: absolute; top: 0; right: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--vin); border: 2px solid var(--bulle); }
.vbody { flex: 1; min-width: 0; display: grid; gap: 2px; }
.vwave { display: flex; align-items: center; gap: 2px; height: 28px; cursor: pointer; touch-action: none; }
.vwave i { flex: 1; min-width: 2px; height: var(--h); border-radius: 2px; background: #7d7466; transition: background-color 100ms linear; }
.vwave i.on { background: var(--accent); }
.vrow { display: flex; justify-content: space-between; align-items: center; font-size: 11px; line-height: 16px; color: var(--gris); font-variant-numeric: tabular-nums; }
.vspeed { border: 1px solid #6b6455; background: transparent; color: var(--gris); border-radius: 999px; font: 600 11px/1 var(--texte); padding: 3px 7px; }
.voice-meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 11px; line-height: 16px; color: var(--gris); margin-top: 4px; }
.voice-meta button { border: 0; background: transparent; color: var(--accent); font: 600 11px/16px var(--texte); padding: 0; }
.voice-text { font-size: 14px; line-height: 20px; color: var(--clair); margin-top: 6px; padding-top: 6px; border-top: 1px dashed #4a453b; white-space: pre-wrap; }
.msg.mine .vplay { background: var(--sur-accent); color: var(--accent); }
.msg.mine .vplay.unheard::after { display: none; }
.msg.mine .vwave i { background: rgba(26, 20, 13, 0.5); }
.msg.mine .vwave i.on { background: var(--sur-accent); }
.msg.mine .vrow, .msg.mine .voice-meta { color: var(--sur-accent-doux); }
.msg.mine .vspeed { border-color: rgba(26, 20, 13, 0.55); color: var(--sur-accent); }
.msg.mine .voice-meta button { color: var(--sur-accent); text-decoration: underline; text-underline-offset: 2px; }
.msg.mine .voice-text { color: var(--sur-accent); border-color: rgba(26, 20, 13, 0.25); }
.msg.pending { opacity: 0.7; }

.typing { align-self: flex-start; margin: 0 12px 8px; background: var(--bulle); border-radius: 18px; border-bottom-left-radius: 4px; padding: 12px 14px; display: flex; gap: 4px; width: max-content; flex: none; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--gris); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; } .typing span:nth-child(3) { animation-delay: 0.4s; }
.typing-label { font: italic 12px/1 var(--texte); color: var(--gris); align-self: center; margin-left: 6px; }
.typing-label:empty { display: none; }
.typing.vocal span { background: var(--accent); }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px; background: var(--barre); border-top: 1px solid var(--doux); flex: none; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.composer textarea { flex: 1; resize: none; max-height: 140px; min-height: 44px; border-radius: 22px; padding: 10px 16px; line-height: 22px; background: var(--fond); scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { display: none; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--sur-accent); font-size: 17px; flex: none; transition: background-color 300ms var(--courbe), opacity 300ms var(--courbe); }
.send:disabled { opacity: 0.35; cursor: default; }
.send svg { width: 22px; height: 22px; fill: currentColor; vertical-align: middle; }
.recorder { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--barre); border-top: 1px solid var(--doux); flex: none; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--vin); box-shadow: 0 0 10px rgba(194, 72, 94, 0.7); animation: blink 1.2s infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 2.6em; }
.rec-level { width: 56px; height: 6px; border-radius: 3px; background: #4a453b; position: relative; overflow: hidden; flex: none; }
.rec-level::after { content: ""; position: absolute; inset: 0; width: var(--l, 0%); background: var(--accent); transition: width 80ms linear; }
.rec-hint { flex: 1; min-width: 0; font-size: 12px; line-height: 16px; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Panneaux */
.scrim { position: fixed; inset: 0; background: rgba(5, 5, 4, 0.62); z-index: 10; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(520px, 100%); max-height: 70dvh; overflow-y: auto; overflow-x: hidden; z-index: 11;
  background: var(--surface); border-top: 1px solid rgba(243, 236, 226, 0.08); border-radius: 24px 24px 0 0;
  padding: 24px 20px max(24px, env(safe-area-inset-bottom)); box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.5);
}
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up 400ms var(--courbe); } }
.sheet.tall { max-height: 88dvh; }
@keyframes up { from { transform: translate(-50%, 32px); opacity: 0.6; } }
.sheet .hint { color: var(--gris); }
.row {
  display: flex; justify-content: space-between; gap: 12px; width: 100%; background: transparent; border: 0; border-bottom: 1px solid var(--ligne);
  padding: 16px 4px; text-align: left; font-size: 16px; line-height: 24px; transition: color 300ms var(--courbe);
}
.row > span:last-child { color: var(--gris); }
.stage-name { font: 400 30px/36px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -0.015em; margin: 0 0 12px; }
.dots { display: flex; gap: 6px; margin-bottom: 16px; }
.dots i { height: 6px; flex: 1; border-radius: 3px; background: #4a453b; }
.dots i.on { background: var(--accent); box-shadow: 0 0 10px rgba(210, 168, 110, 0.35); }
.dots i.on:nth-child(n+4) { background: var(--vin); box-shadow: 0 0 10px rgba(194, 72, 94, 0.4); } /* comme les chapitres 4 et 5 du site */
.memory { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.memory li { display: flex; gap: 8px; align-items: center; background: var(--doux); border: 1px solid var(--ligne); border-radius: 12px; padding: 8px 8px 8px 12px; font-size: 15px; line-height: 22px; }
.memory li span { flex: 1; }
.memory li button { border: 0; background: transparent; color: var(--gris); font-size: 16px; width: 36px; height: 36px; border-radius: 50%; flex: none; }
.memory .empty { justify-content: center; color: var(--gris); border-style: dashed; background: transparent; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; background: var(--fond); }
.setting { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--ligne); }
.setting > div:first-child { flex: 1 1 12rem; min-width: 0; }
.setting strong { font-weight: 600; }
.setting small { display: block; margin-top: 2px; }
.setting select, .setting input[type=time] { background: var(--fond); padding: 8px 12px; }
.switch { appearance: none; -webkit-appearance: none; margin: 0; width: 48px; height: 28px; border-radius: 999px; background: #3d382e; box-shadow: inset 0 0 0 1px var(--contour); position: relative; flex: none; cursor: pointer; transition: background-color 300ms var(--courbe), box-shadow 300ms var(--courbe); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--encre); transition: transform 300ms var(--courbe), background-color 300ms var(--courbe); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.switch:checked { background: var(--accent); box-shadow: none; } .switch:checked::after { transform: translateX(20px); background: var(--sur-accent); }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.stepper { display: flex; align-items: center; gap: 8px; flex: none; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--contour); background: var(--doux); color: var(--encre); }
.stepper output { min-width: 20px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.times { display: flex; align-items: center; gap: 4px; flex: none; color: var(--gris); }
.times input { padding: 6px 10px; color: var(--encre); font-size: 15px; }
.gifts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.gifts button { background: var(--doux); border: 1px solid var(--ligne); border-radius: 16px; padding: 12px; text-align: left; display: flex; gap: 10px; align-items: center; font-size: 14px; line-height: 20px; transition: border-color 300ms var(--courbe); }
.gifts button b { font-size: 22px; }
.gauges { display: grid; gap: 10px; margin: 12px 0; }
.gauge { display: grid; grid-template-columns: 6.5rem 1fr 2.2rem; gap: 10px; align-items: center; font-size: 14px; line-height: 20px; }
.gauge i { height: 8px; border-radius: 4px; background: #4a453b; position: relative; overflow: hidden; }
.gauge i::after { content: ""; position: absolute; inset: 0; width: var(--v); background: var(--accent); }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 14px; line-height: 20px; }
.log li { border-left: 2px solid #4a453b; padding-left: 10px; color: var(--gris); }
.log li b { color: var(--encre); font-weight: 600; }
.error { color: var(--alerte); font-size: 14px; line-height: 20px; font-weight: 600; }

/* Réactions, réponse à un message */
.msg.has-react { margin-bottom: 12px; }
.react { position: absolute; bottom: -14px; right: 8px; background: var(--doux); border: 1px solid var(--fond); border-radius: 999px; font-size: 13px; line-height: 1; padding: 3px 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.msg.hers .react { right: auto; left: 10px; }
.msg.flash { animation: flash 1.2s var(--courbe); }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent), 0 0 24px rgba(210, 168, 110, 0.4); } }
.msg-more { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--doux); color: var(--gris); font-size: 11px; opacity: 0; transition: opacity 120ms linear; padding: 0; }
.msg:hover > .msg-more, .msg-more:focus-visible { opacity: 0.95; }
@media (hover: none) { .msg-more { display: none; } }
.quote { border-left: 3px solid var(--accent); background: rgba(243, 236, 226, 0.06); border-radius: 8px; padding: 4px 8px; margin: -2px 0 6px; font-size: 13px; line-height: 18px; color: var(--gris); cursor: pointer; display: grid; max-height: 4.2em; overflow: hidden; }
.quote b { color: var(--accent); font-size: 12px; }
.msg.mine .quote { border-left-color: rgba(26, 20, 13, 0.55); background: rgba(26, 20, 13, 0.08); color: var(--sur-accent-doux); }
.msg.mine .quote b { color: var(--sur-accent); }
.msg-menu { position: absolute; z-index: 35; background: #2c2920; border: 1px solid #3d382e; border-radius: 18px; box-shadow: var(--ombre); padding: 6px; display: grid; gap: 4px; }
.mm-reacts { display: flex; gap: 2px; }
.mm-reacts:empty { display: none; }
.mm-reacts button { border: 0; background: transparent; font-size: 22px; width: 40px; height: 40px; border-radius: 50%; transition: transform 200ms var(--courbe), background-color 200ms var(--courbe); }
.mm-reacts button:hover, .mm-reacts button.on { transform: scale(1.18); background: #3d382e; }
.mm-reply { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 10px; font-size: 14px; line-height: 20px; }
.reply-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; background: var(--barre); border-top: 1px solid var(--doux); flex: none; }
.reply-bar > div { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 10px; display: grid; font-size: 13px; line-height: 18px; }
.reply-bar b { color: var(--accent); font-size: 12px; }
.reply-bar span { color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo img { cursor: zoom-in; }

/* Fiche contact */
.contact { position: absolute; inset: 0; z-index: 9; background: var(--fond); display: flex; flex-direction: column; }
.contact-head { display: flex; align-items: center; gap: 4px; padding: 8px; padding-top: calc(8px + var(--top)); background: var(--barre); border-bottom: 1px solid var(--doux); font-weight: 600; flex: none; }
.contact-body { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.contact-hero {
  display: grid; justify-items: center; text-align: center; padding: 24px 20px 20px; border-bottom: 1px solid var(--ligne);
  background: radial-gradient(260px 200px at 50% 34%, rgba(210, 168, 110, 0.13), rgba(210, 168, 110, 0) 70%), var(--barre);
}
.contact-photo { border: 0; background: transparent; padding: 6px; border-radius: 50%; }
.avatar.big { width: 128px; height: 128px; font-size: 44px; }
.contact-hero h2 { margin: 12px 0 0; font-size: 30px; line-height: 36px; }
.contact-status { margin: 0; color: var(--accent); font-size: 14px; line-height: 20px; }
.contact-ia { margin: 12px 0 0; font-size: 12px; line-height: 16px; color: var(--gris); max-width: 30ch; }
.contact-block { background: var(--surface); border-block: 1px solid var(--ligne); margin-top: 12px; padding: 12px 16px 4px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; line-height: 20px; margin-bottom: 8px; }
.block-head strong { font-weight: 600; }
.block-head span { color: var(--gris); font-size: 12px; line-height: 16px; }
.contact-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding-bottom: 12px; }
.contact-media button { position: relative; border: 0; padding: 0; aspect-ratio: 1; background: var(--doux) center / cover; border-radius: 8px; overflow: hidden; }
.contact-media button .badge-ia { top: 4px; right: 4px; font-size: 9px; }
.contact-media button em { position: absolute; left: 4px; bottom: 4px; font: 600 10px/1 var(--texte); font-style: normal; background: rgba(13, 12, 8, 0.66); color: #fff; padding: 3px 5px; border-radius: 4px; }
.contact-media .empty { grid-column: 1 / -1; color: var(--gris); font-size: 14px; line-height: 20px; padding: 4px 0 8px; }
.stage-name.small { font-size: 20px; line-height: 28px; margin: 0 0 8px; }
.contact-block .row:last-child { border-bottom: 0; }
.danger-row, .row.danger-row > span:last-child { color: var(--alerte); }

/* Photo en grand */
.lightbox { position: absolute; inset: 0; z-index: 45; background: var(--ecran-noir); color: var(--encre); display: flex; flex-direction: column; justify-content: center; padding-top: var(--top); }
.lightbox .sv-close { position: absolute; top: calc(12px + var(--top)); right: 12px; z-index: 3; }
.lb-media { position: relative; margin: 0 8px; }
.lb-media img { width: 100%; max-height: 70vh; object-fit: contain; display: block; border-radius: 12px; }
.lb-caption { text-align: center; padding: 12px 20px; margin: 0; font: 400 18px/26px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; color: var(--clair); }

/* Comptes */
.link-back { align-self: flex-start; border: 0; background: transparent; color: var(--gris); padding: 4px 0; font-size: 14px; line-height: 20px; font-weight: 600; transition: color 300ms var(--courbe); }
.auth-form { display: grid; gap: 8px; }
.auth-form .btn { margin-top: 8px; }
.auth-form .error { margin: 4px 0 0; }
.hint a { color: var(--accent); }
.hint a:hover { color: var(--accent-survol); }
.field input[type=date] { min-height: 48px; }
.field small { color: var(--gris); }

/* Entrer : Google, Face ID ou un code par e-mail */
.ident-choix { display: grid; gap: 12px; }
.ident-choix .auth-form { margin-top: 4px; }
/* Le bouton de Google : logo officiel en couleurs, thème sombre de ses consignes (fond #131314, bord #8E918F, texte #E3E3E3). */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 12px 16px; border-radius: 999px;
  background: #131314; color: #e3e3e3; border: 1px solid #8e918f; font-weight: 500; line-height: 24px; text-decoration: none; text-align: center;
  transition: background-color 300ms var(--courbe), transform 300ms var(--courbe);
}
.btn-google img { width: 20px; height: 20px; flex: none; }
.btn-google:active { transform: scale(0.98); }
.ou { display: flex; align-items: center; gap: 12px; margin: 0; color: var(--gris); font-size: 14px; line-height: 20px; }
.ou::before, .ou::after { content: ""; flex: 1; height: 1px; background: var(--ligne); }
.link-back.discret { align-self: center; min-height: 44px; padding: 8px 4px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ligne); }
.link-back { min-height: 44px; }

/* Les six chiffres du code */
.code-champs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 8px 0 4px; }
.code-champs input {
  min-width: 0; width: 100%; min-height: 56px; padding: 0; text-align: center; font: 500 26px/1 var(--titre); letter-spacing: 0; color: var(--encre);
  background: var(--surface); border: 1px solid var(--contour); border-radius: 12px; caret-color: var(--accent);
  transition: border-color 300ms var(--courbe), box-shadow 300ms var(--courbe);
}
.code-champs input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(210, 168, 110, 0.22); outline: none; }
.code-champs input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.code-champs.faux input { border-color: var(--alerte); }
@media (prefers-reduced-motion: no-preference) { .code-champs.faux { animation: secousse 360ms var(--courbe); } }
@keyframes secousse { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* Les deux accords de l'inscription, réunis */
.accords { margin: 8px 0 0; padding: 12px 16px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--ligne); border-radius: 16px; }
.accords legend { padding: 0 6px; font-size: 14px; line-height: 20px; color: var(--gris); }
.accords .check { min-height: 44px; }
.accords .check input { width: 24px; height: 24px; margin-top: 0; }
#bloc-passkey .btn { flex: none; }
#passkey-bar p { flex: 1 1 100%; }
#passkey-bar .btn { flex: 1 1 8rem; }

/* Proposition de notifications, dans la conversation, au-dessus du champ d'écriture */
.push-offer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--doux); flex: none; }
.push-offer p { flex: 1 1 14rem; margin: 0; font-size: 14px; line-height: 20px; }
.push-offer-actions { display: flex; gap: 6px; }

/* Survols : seulement avec une souris (sur un téléphone, un survol resterait collé après le toucher) */
@media (hover: hover) {
  .btn:hover { background: #2e2a21; }
  .btn.primary:not(:disabled):hover { background: var(--accent-survol); box-shadow: 0 8px 32px rgba(210, 168, 110, 0.25); }
  .btn.ghost:hover { background: var(--doux); box-shadow: inset 0 0 0 1px #5c564a; }
  .btn.danger:hover { background: rgba(240, 139, 122, 0.08); }
  .icon-btn:hover { background: var(--doux); }
  .pcard:not(:disabled):hover { border-color: #4a453b; background: #211f17; }
  .conv:hover { background: var(--surface); }
  .who:hover { background: var(--doux); }
  .row:hover { color: var(--accent); }
  .row.danger-row:hover { color: var(--alerte); }
  .gifts button:hover { border-color: var(--accent); }
  .send:not(:disabled):hover { background: var(--accent-survol); }
  .stepper button:hover { border-color: var(--accent); }
  .memory li button:hover { background: #332f26; color: var(--encre); }
  .mm-reply:hover { background: #3d382e; }
  .link-back:hover { color: var(--encre); }
}

/* Bandeau « Confirme ton adresse » : discret, en haut des discussions */
.confirm-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 16px 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--doux); border-radius: 12px; flex: none; }
.confirm-bar p { flex: 1 1 12rem; margin: 0; font-size: 14px; line-height: 20px; color: var(--clair); }

/* Guide d'ajout à l'écran d'accueil */
.sheet.guide { padding-top: 28px; }
.sheet.guide:focus { outline: none; }
.sheet.guide h2 { font: 400 26px/32px var(--titre); font-variation-settings: "SOFT" 100, "WONK" 0; letter-spacing: -0.015em; margin: 0 0 8px; color: var(--encre); }
.guide-texte { margin: 0 0 16px; color: var(--clair); font-size: 16px; line-height: 24px; }
.guide-etapes { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.guide-etapes li { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--ligne); font-size: 15px; line-height: 22px; }
.guide-etapes li:last-child { border-bottom: 0; }
.guide-etapes strong { color: var(--encre); font-weight: 600; }
.guide-pic { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--doux); box-shadow: inset 0 0 0 1px var(--ligne); color: var(--accent); }
.guide-pic svg { width: 24px; height: 24px; }
.guide-ajouter { width: 100%; margin-bottom: 4px; }
.guide-actions { margin-top: 8px; }
.guide-actions .btn { min-height: 48px; }
