/* ============================================================
   INSTA.SONDAGE — DM néo-brutalistes (scope : .insta)
   ============================================================ */
.insta {
  --i-ink: var(--ink, #14101f); --i-cream: var(--cream, #fff7ee); --i-paper: var(--paper, #fffdf8);
  --i-pink: var(--pink, #ff1f8f); --i-violet: var(--violet, #5b21b6); --i-purple: var(--purple, #7c3aed);
  --i-yellow: var(--yellow, #ffe44d); --i-mint: var(--mint, #3ee6b0);
  --i-bd: var(--bd, 3px solid #14101f);
  display: flex; height: 100%; width: 100%; overflow: hidden; position: relative;
  font-family: var(--f-ui, "Space Grotesk", system-ui, sans-serif); color: var(--i-ink); background: var(--i-cream);
  -webkit-tap-highlight-color: transparent;
}
.insta * { box-sizing: border-box; }
.insta button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- avatars ---------- */
.insta-av {
  width: var(--av); height: var(--av); flex: none; border-radius: 50%; padding: 2px;
  background: var(--i-ink); display: grid; place-items: center;
}
.insta-av img, .insta-av span {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; object-fit: cover;
  color: #fff; font-weight: 800; font-size: calc(var(--av) * .34);
}
.insta-av img[src^="data:"] { image-rendering: pixelated; }
.insta-av--ring {
  padding: 3px; background: conic-gradient(from 200deg, #ffb020, var(--i-pink), var(--i-violet), #ffb020);
  box-shadow: 0 0 0 2px var(--i-ink);
}
.insta-av--ring img, .insta-av--ring span { box-shadow: 0 0 0 2px var(--i-cream); }

/* ---------- liste ---------- */
.insta-list {
  width: 300px; flex: none; display: flex; flex-direction: column; border-right: var(--i-bd);
  background: var(--i-paper); min-height: 0;
}
.insta-list__head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px;
  font-family: var(--f-title, "Archivo Black", sans-serif); font-size: 18px;
}
.insta-list__new { font-size: 20px; }
.insta-stories {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 14px 12px; border-bottom: var(--i-bd);
  scrollbar-width: none;
}
.insta-stories::-webkit-scrollbar { display: none; }
.insta-story {
  background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 58px; flex: none;
}
.insta-story span { font-size: 10px; max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insta-convs { overflow-y: auto; flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.insta-conv {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px;
  background: transparent; border: 2px solid transparent; border-radius: var(--r, 10px);
  transition: transform .12s, background .12s;
}
.insta-conv:hover { background: var(--i-cream); border-color: var(--i-ink); }
.insta-conv.is-on { background: var(--i-yellow); border: var(--i-bd); box-shadow: 3px 3px 0 var(--i-ink); }
.insta-conv__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.insta-conv__txt b { font-size: 14px; }
.insta-conv__txt small { font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insta-conv.is-unread .insta-conv__txt small { opacity: 1; font-weight: 700; }
.insta-conv__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.insta-conv__meta small { font-size: 11px; opacity: .6; }
.insta-conv__meta i {
  font-style: normal; font-size: 11px; font-weight: 800; color: #fff; background: var(--i-pink);
  border: 2px solid var(--i-ink); border-radius: 99px; min-width: 22px; text-align: center; padding: 0 5px;
}

/* ---------- fil ---------- */
.insta-thread { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--i-cream); }
.insta-thread::before { /* trame de points façon 25H */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: radial-gradient(rgba(20, 16, 31, .18) 1px, transparent 1.2px); background-size: 14px 14px;
}
.insta-empty {
  margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--f-title, "Archivo Black", sans-serif); font-size: 18px; position: relative;
}
.insta-empty svg { width: 92px; height: 92px; filter: drop-shadow(4px 4px 0 var(--i-ink)); }
.insta-thread__head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: var(--i-bd);
  background: var(--i-paper); position: relative; z-index: 2;
}
.insta-thread__head span { display: flex; flex-direction: column; line-height: 1.15; }
.insta-thread__head b { font-size: 15px; }
.insta-thread__head small { font-size: 12px; opacity: .6; }
.insta-back {
  display: none; width: 34px; height: 34px; border: var(--i-bd); border-radius: 8px; background: var(--i-yellow);
  font-size: 22px; line-height: 1; box-shadow: 2px 2px 0 var(--i-ink); padding: 0 0 3px;
}
.insta-msgs {
  flex: 1; overflow-y: auto; padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 6px;
  position: relative; z-index: 1; scroll-behavior: smooth;
}
.insta-row { display: flex; align-items: flex-end; gap: 6px; max-width: 78%; }
.insta-row--me { align-self: flex-end; flex-direction: row-reverse; }
.insta-row.is-new { animation: insta-pop .25s cubic-bezier(.2, 1.4, .4, 1); }
.insta-msg {
  position: relative; padding: 8px 12px; border: var(--i-bd); border-radius: 16px 16px 16px 4px;
  background: var(--i-paper); font-size: 14px; line-height: 1.35; box-shadow: 3px 3px 0 var(--i-ink);
  word-wrap: break-word; min-width: 0;
}
.insta-row--me .insta-msg {
  border-radius: 16px 16px 4px 16px; color: #fff;
  background: linear-gradient(135deg, var(--i-pink), var(--i-violet));
}
.insta-msg--auto { background: var(--i-ink) !important; color: var(--i-mint) !important; font-weight: 800; letter-spacing: 2px; }
.insta-auto { display: block; font-style: normal; font-size: 10px; letter-spacing: .5px; font-weight: 600; opacity: .8; margin-bottom: 2px; text-transform: uppercase; }
.insta-msg--del { background: transparent; box-shadow: none; border-style: dashed; font-style: italic; opacity: .75; font-size: 13px; }
.insta-react {
  position: absolute; bottom: -12px; right: 8px; background: var(--i-paper); border: 2px solid var(--i-ink);
  border-radius: 99px; padding: 0 4px; font-size: 13px; line-height: 18px;
}
.insta-row:has(.insta-react) { margin-bottom: 10px; }
.insta-sys {
  align-self: center; font-size: 11px; font-weight: 700; text-align: center; max-width: 86%;
  background: var(--i-yellow); border: 2px solid var(--i-ink); border-radius: 99px; padding: 3px 10px; margin: 4px 0;
}
.insta-vu { align-self: flex-end; font-size: 11px; opacity: .6; margin-top: -2px; }
.insta-typing .insta-msg { display: flex; gap: 4px; padding: 11px 12px; }
.insta-typing .insta-msg i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: insta-dot 1s infinite; }
.insta-typing .insta-msg i:nth-child(2) { animation-delay: .15s; }
.insta-typing .insta-msg i:nth-child(3) { animation-delay: .3s; }
.insta-row--me.insta-typing .insta-msg { color: #fff; }

.insta-input {
  display: flex; gap: 8px; padding: 10px 12px; border-top: var(--i-bd); background: var(--i-paper); position: relative; z-index: 2;
}
.insta-input input {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; padding: 10px 14px; border: var(--i-bd); border-radius: 99px;
  background: var(--i-cream); color: var(--i-ink); outline: none;
}
.insta-input input:focus { box-shadow: 3px 3px 0 var(--i-pink); }
.insta-input button {
  width: 44px; flex: none; border: var(--i-bd); border-radius: 50%; background: var(--i-pink); color: #fff;
  font-size: 18px; box-shadow: 2px 2px 0 var(--i-ink);
}
.insta-input button:active { transform: translate(2px, 2px); box-shadow: none; }

/* ---------- téléphone / fenêtre étroite : la liste, puis la discussion en plein écran ---------- */
.insta--narrow .insta-list { width: 100%; border-right: 0; }
.insta--narrow .insta-thread { display: none; }
.insta--narrow.is-thread .insta-list { display: none; }
.insta--narrow.is-thread .insta-thread { display: flex; width: 100%; }
.insta--narrow .insta-msgs { overscroll-behavior: contain; }
.insta:not(.insta--narrow) .insta-back { display: none; }
.insta--narrow .insta-back { display: grid; place-items: center; flex: none; color: var(--i-ink); cursor: pointer; }
