:root {
  --ink: #000;
  --muted: #737373;
  --line: #dbdbdb;
  --blue: #3897f0;
  --dot: #a8a8a8;
  --btn: #efefef;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #e9e9ee;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  display: grid;
  grid-template-columns: 280px 1fr;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.sidebar-head { padding: 24px 20px 16px; border-bottom: 1px solid var(--line); }
.sidebar-head img { width: 150px; height: auto; display: block; }
.sidebar-head p { margin-top: 10px; font-size: 13px; color: var(--muted); }
.list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 14px; }
.group { display: flex; flex-direction: column; gap: 4px; }
.group h2 {
  padding: 6px 8px 2px; font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 8px; border-radius: 10px; transition: background .15s;
}
.item:hover { background: #f4f4f6; }
.item.on { background: #fdf6b0; }
.item img {
  width: 44px; height: 55px; object-fit: cover; border-radius: 4px; flex-shrink: 0;
  background: #eee; box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}
.item strong { display: block; font-size: 14px; font-weight: 600; line-height: 1.25; }
.item span { font-size: 12px; color: var(--muted); }

/* ---------- Scène ---------- */
.stage {
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; min-width: 0; min-height: 0; overflow: hidden;
}

/* ---------- Téléphone ---------- */
.phone {
  position: relative;
  width: 390px;
  height: 844px;
  border-radius: 56px;
  background: #111;
  padding: 12px;
  box-shadow: 0 0 0 2px #2a2a2a, 0 30px 80px rgba(0,0,0,.25);
  flex-shrink: 0;
}
.phone::before { /* bouton latéral */
  content: ""; position: absolute; right: -4px; top: 190px;
  width: 4px; height: 96px; border-radius: 0 3px 3px 0; background: #2a2a2a;
}
.phone::after { /* boutons volume */
  content: ""; position: absolute; left: -4px; top: 170px;
  width: 4px; height: 60px; border-radius: 3px 0 0 3px; background: #2a2a2a;
  box-shadow: 0 76px 0 #2a2a2a;
}
.screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 44px;
  overflow: hidden;
  background: #fff;
  display: flex; flex-direction: column;
}
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 34px; border-radius: 20px; background: #000; z-index: 5;
}

/* ---------- Barre de statut ---------- */
.status {
  height: 54px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 30px 0 40px;
  font-weight: 600; font-size: 16px;
}
.status .time { display: flex; align-items: center; gap: 4px; }
.status .right { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- En-tête "Publications" ---------- */
.topbar {
  height: 56px; flex-shrink: 0;
  display: grid; grid-template-columns: 56px 1fr 96px; align-items: center;
  padding: 0 12px 0 8px;
  border-bottom: 1px solid var(--line);
}
.topbar .title { text-align: center; line-height: 1.15; }
.topbar .title strong { display: block; font-size: 16px; font-weight: 700; }
.topbar .title span { font-size: 12px; color: var(--ink); }
.follow {
  justify-self: end;
  background: var(--btn); border-radius: 8px;
  padding: 7px 14px; font-size: 14px; font-weight: 600;
}
.follow.on { background: var(--blue); color: #fff; }

/* ---------- Fil ---------- */
.feed { flex: 1; overflow-y: auto; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }

.post-head {
  height: 54px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 26px; height: auto; }
.username { font-weight: 600; font-size: 14px; flex: 1; }

/* ---------- Carrousel ---------- */
.carousel { position: relative; width: 100%; aspect-ratio: 4 / 5; background: #000; }
.track {
  display: flex; width: 100%; height: 100%;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.track::-webkit-scrollbar { display: none; }
.track img {
  flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover;
  scroll-snap-align: start; user-select: none; -webkit-user-drag: none;
}
.counter {
  position: absolute; top: 12px; right: 12px;
  background: rgba(18,18,18,.72); color: #fff;
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 12px;
  transition: opacity .3s;
}
.counter.hide { opacity: 0; }
.heart-burst {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  opacity: 0;
}
.heart-burst.play { animation: burst .8s ease-out; }
@keyframes burst {
  0% { opacity: 0; transform: scale(.3); }
  20% { opacity: 1; transform: scale(1.1); }
  35% { transform: scale(.95); }
  75% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1); }
}

.dots { display: flex; justify-content: center; height: 28px; align-items: center; }
.dots span {
  width: 6px; height: 6px; box-sizing: content-box; padding: 6px 2px; background-clip: content-box;
  border-radius: 50%; background-color: var(--dot); opacity: .5; cursor: pointer;
  transition: background-color .2s, opacity .2s;
}
.dots span.on { background-color: var(--blue); opacity: 1; }

/* ---------- Actions ---------- */
.actions {
  display: flex; align-items: center; gap: 14px;
  padding: 0 12px 6px; height: 44px;
}
.actions .grow { flex: 1; }
.act { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; }
.act.liked svg path { fill: #ff3040; stroke: #ff3040; }
.act.saved svg path { fill: #000; }
.act:active svg { transform: scale(.85); }

.caption { padding: 0 12px; font-size: 14px; line-height: 1.4; }
.caption b { font-weight: 600; }
.caption .body { white-space: pre-line; }
.caption .more { color: var(--muted); }
.caption .more[hidden] { display: none; }
.date { padding: 6px 12px 18px; font-size: 12px; color: var(--muted); }

.next-post .placeholder { height: 120px; background: linear-gradient(#cfd4da, #e6e9ec); }

/* ---------- Barre d'accueil ---------- */
.home-ind {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px; background: #000; z-index: 5;
}

/* Petits écrans : le téléphone devient l'écran */
/* Écrans étroits : la sidebar devient une barre défilante en haut */
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: 100dvh; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-head { display: none; }
  .list { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 8px 12px; scrollbar-width: none; }
  .list::-webkit-scrollbar { display: none; }
  .group { flex-direction: row; flex-wrap: wrap; width: max-content; flex: 0 0 auto; }
  .group h2 { flex-basis: 100%; padding: 0 6px 2px; font-size: 10px; white-space: nowrap; }
  .item { flex: 0 0 auto; max-width: 220px; padding: 6px 10px 6px 6px; }
  .item img { width: 32px; height: 40px; }
}
/* Petits écrans : le téléphone devient l'écran */
@media (max-width: 430px) {
  body { background: #fff; }
  .stage { padding: 0; align-items: stretch; }
  .phone { width: 100%; height: 100%; border-radius: 0; padding: 0; box-shadow: none; }
  .phone::before, .phone::after, .island { display: none; }
  .screen { border-radius: 0; }
}
