/* Ninouland sur téléphone : la messagerie d'Instagram, gravure de Doré en fond, violet pour ce qui vient de moi.
   Couleurs et polices reprises de l'écran PC (app/ui/app.slint, piste A « façon Insta »). */
@font-face { font-family: Roboto; src: url(polices/roboto-400.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: Roboto; src: url(polices/roboto-500.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: Roboto; src: url(polices/roboto-700.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Grenze; src: url(polices/grenze-gotisch-600.ttf); font-weight: 600; font-display: swap; }

:root {
  --blanc: #FFFFFF;
  --moi-haut: #7A55D6;
  --moi-bas: #9C3DB8;
  --moi: #8B48C8;
  --moi-appui: #7637B0;
  --bulle: #25292E;
  --bulle-appui: #2E3338;
  --gris: #CCCCCC;
  --gris-2: #A8A8A8;
  --pilule: #262A2F;
  --rouge: #FFBAC0;
  --vert: #78DE45;
  --bande: #050408;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--blanc);
  font: 400 15px/1.35 Roboto, system-ui, sans-serif; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

#fond { position: fixed; inset: 0; background: #000 url(images/fond.jpg) center / cover no-repeat; }
#fond::after { content: ""; position: absolute; inset: 0; background: linear-gradient(#000a, #0006 30%, #0006 70%, #000c); }

.ecran { position: fixed; inset: 0; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.ecran.plein { align-items: center; justify-content: center; padding: 24px; }

/* ---- liaison ---- */
.carte-liaison { width: 100%; max-width: 360px; text-align: center; }
.logo { font: 600 52px/1 Grenze, serif; margin: 0 0 18px; letter-spacing: .5px; }
.carte-liaison p { color: var(--gris); margin: 0 0 22px; }
#form-code { display: flex; flex-direction: column; gap: 12px; }
#champ-code { background: var(--pilule); border: 1px solid #ffffff22; border-radius: 16px; color: var(--blanc);
  font: 500 34px/1 Roboto, sans-serif; letter-spacing: 10px; text-align: center; padding: 16px 0 16px 10px; outline: none; }
#champ-code:focus { border-color: var(--moi); }
.bouton-plein { background: var(--moi); border-radius: 14px; padding: 14px; font-weight: 700; }
.bouton-plein:active { background: var(--moi-appui); }
.erreur { color: var(--rouge) !important; min-height: 1.4em; margin-top: 14px !important; }

/* ---- en-tête ---- */
.entete { display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 16px;
  background: linear-gradient(#000d, #0000); }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.qui { flex: 1; min-width: 0; }
.nom { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sous { font-size: 12px; color: var(--gris); display: flex; align-items: center; gap: 5px; }
.sous.en-ligne::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--vert); }
.icone { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.icone:active { background: #ffffff1a; }
.bandeau { margin: 0 12px 6px; padding: 10px 14px; border-radius: 14px; background: var(--pilule); font-size: 13px; color: var(--gris); }
.bandeau button { color: #CDBDFF; font-weight: 700; margin-left: 6px; }

/* ---- le fil ---- */
.fil { flex: 1; overflow-y: auto; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 3px;
  -webkit-overflow-scrolling: touch; }
.fil::before { content: ""; flex: 1; }
.jour { align-self: center; font-size: 12px; color: var(--gris); margin: 14px 0 8px; }
.ligne { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.ligne.moi { justify-content: flex-end; }
.ligne .mini { width: 28px; height: 28px; border-radius: 50%; flex: none; visibility: hidden; }
.ligne.dernier .mini { visibility: visible; }
.ligne.groupe-fin { margin-bottom: 8px; }
.bulle { max-width: min(76%, 520px); padding: 9px 14px; border-radius: 22px; background: var(--bulle);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.moi .bulle { background: linear-gradient(var(--moi-haut), var(--moi-bas)); background-attachment: fixed; }
.bulle.emoji { background: none !important; font-size: 40px; padding: 0 2px; line-height: 1.1; }
.heure { font-size: 11px; color: var(--gris); padding: 2px 44px 6px; }
.moi + .heure, .heure.moi { text-align: right; padding: 2px 4px 6px; }

.media { border-radius: 22px; overflow: hidden; background: var(--bande); max-width: min(64%, 300px); position: relative; }
.media img, .media video { display: block; width: 100%; max-height: 380px; object-fit: cover; }
.media .attente { width: 220px; height: 280px; display: grid; place-items: center; color: var(--gris-2); font-size: 13px; }
.media .lecture { position: absolute; inset: 0; display: grid; place-items: center; }
.media .lecture span { width: 52px; height: 52px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.media .lecture svg { fill: var(--moi); stroke: none; margin-left: 3px; }

.snap { display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; border-radius: 22px;
  background: var(--bulle); font-weight: 700; }
.snap:active { background: var(--bulle-appui); }
.snap .tri { width: 0; height: 0; border-left: 11px solid var(--moi); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.snap.vu { background: transparent; border: 1px solid #363636; color: var(--gris-2); font-weight: 500; }
.snap.vu .tri { border-left-color: var(--gris-2); }
.moi .snap { background: var(--bulle); }
.systeme { align-self: center; color: var(--gris); font-size: 12px; margin: 6px 0; }

/* ---- saisie ---- */
.saisie { display: flex; align-items: center; gap: 6px; margin: 6px 10px calc(10px + env(safe-area-inset-bottom));
  padding: 5px 6px; border-radius: 26px; background: var(--pilule); }
.rond-violet { width: 40px; height: 40px; border-radius: 50%; background: var(--moi); display: grid; place-items: center; flex: none; }
.rond-violet:active { background: var(--moi-appui); }
.rond-violet svg { width: 22px; height: 22px; }
#champ { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--blanc); font: inherit; font-size: 16px; padding: 8px 4px; }
#champ::placeholder { color: var(--gris-2); }
.envoyer { color: #CDBDFF; font-weight: 700; padding: 0 12px; }

/* ---- visionneuse ---- */
.visionneuse { position: fixed; inset: 0; background: #000; z-index: 10; display: grid; place-items: center; }
#contenu-visionneuse { width: 100%; height: 100%; display: grid; place-items: center; }
#contenu-visionneuse img, #contenu-visionneuse video { max-width: 100%; max-height: 100%; object-fit: contain; }
.minuteur { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 16px; right: 72px; height: 3px; border-radius: 2px; background: #ffffff40; z-index: 2; }
.minuteur div { height: 100%; border-radius: 2px; background: #fff; width: 100%; }
.fermer { position: absolute; top: calc(6px + env(safe-area-inset-top)); right: 10px; z-index: 2; }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #262A2Fee; border-radius: 14px; padding: 10px 16px; font-size: 14px; max-width: 86%; text-align: center; z-index: 20; }
.toast.erreur-toast { color: var(--rouge); }

/* ping reçu : l'écran tremble et s'allume */
@keyframes secousse { 0%,100% { transform: none } 20% { transform: translateX(-7px) } 40% { transform: translateX(6px) }
  60% { transform: translateX(-4px) } 80% { transform: translateX(3px) } }
.secoue { animation: secousse .45s ease; }
@keyframes eclair { from { box-shadow: inset 0 0 0 4px var(--moi) } to { box-shadow: inset 0 0 0 0 transparent } }
.secoue .fil { animation: eclair .9s ease-out; }
@media (prefers-reduced-motion: reduce) { .secoue { animation: none; } }
