/* Prévia mobile-first — mock do feed do Instagram para aprovação */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #fafafa;
  --card: #ffffff;
  --line: #dbdbdb;
  --ink: #262626;
  --muted: #8e8e8e;
  --blue: #1068F8;       /* link/hashtag + MJ */
  --campitelli: #b21f5c; /* framboesa */
  --mjes: #0a8f6e;       /* verde */
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  /* cor do perfil ativo (trocada via JS) */
  --accent: var(--blue);
}

html, body { background: #000; height: 100%; }
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  color: var(--ink);
  display: flex; justify-content: center;
}

/* moldura "celular": cheia no mobile, centrada no desktop */
#phone {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── topo (header + tabs num bloco sticky único) ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.ig-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top));
}
.ig-top .back {
  font-size: 26px; line-height: 1; color: var(--ink);
  text-decoration: none; width: 30px; text-align: center; font-weight: 300;
}
.ig-top-mid { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.ig-top-mid strong { font-size: 15px; }
.week-label { font-size: 12px; color: var(--muted); }
.week-select {
  align-self: flex-start;
  margin-top: 1px;
  max-width: 100%;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.week-select:focus { outline: none; color: var(--fg, #fff); }
.refresh {
  border: none; background: none; font-size: 20px; color: var(--ink);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
}
.refresh:active { background: #efefef; }
.refresh.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── tabs de perfil (3 botões fixos, dividem a largura) ── */
.tabs {
  display: flex; gap: 6px; padding: 8px 10px 10px;
}
.tab {
  flex: 1 1 0; min-width: 0; border: 1px solid var(--line); background: #fff;
  border-radius: 20px; padding: 8px 6px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; white-space: nowrap;
  display: flex; gap: 5px; align-items: center; justify-content: center;
}
.tab .dot { width: 8px; height: 8px; border-radius: 50%; }
.tab.active { color: #fff; border-color: transparent; }
.tab[data-i="0"] .dot { background: var(--campitelli); }
.tab[data-i="1"] .dot { background: var(--blue); }
.tab[data-i="2"] .dot { background: var(--mjes); }
.tab.active[data-i="0"] { background: var(--campitelli); }
.tab.active[data-i="1"] { background: var(--blue); }
.tab.active[data-i="2"] { background: var(--mjes); }
.tab.active .dot { background: #fff; }
.tab .count { font-size: 11px; opacity: .7; }

/* ── feed ── */
.feed { flex: 1; padding-bottom: 40px; }
.loading, .empty {
  padding: 60px 24px; text-align: center; color: var(--muted); font-size: 14px;
}
.feed-meta {
  padding: 14px 16px 6px; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.feed-meta .acc { color: var(--accent); font-weight: 600; }

/* ── card de post ── */
.post { background: var(--card); border-top: 1px solid var(--line); margin-top: 10px; }
.post:first-of-type { margin-top: 0; }

/* faixa do dia (bem evidente) */
.day-ribbon {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px; color: #fff; background: var(--accent);
}
.day-ribbon .d { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.day-ribbon .t {
  font-weight: 700; font-size: 13px; background: rgba(255,255,255,.22);
  padding: 2px 9px; border-radius: 10px;
}

.post-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px;
  background: var(--accent);
}
.post-head .who { flex: 1; line-height: 1.2; }
.post-head .who b { font-size: 13px; }
.post-head .who small { display: block; font-size: 11px; color: var(--muted); }
.post-head .when {
  font-size: 11px; color: var(--accent); font-weight: 600; background: color-mix(in srgb, var(--accent) 12%, #fff);
  padding: 3px 8px; border-radius: 10px;
}
.post-head .dots { color: var(--ink); font-size: 18px; letter-spacing: 1px; padding-left: 4px; }

/* mídia */
.media {
  position: relative; width: 100%; background: #000;
  overflow: hidden;
}
.media.ratio-45 { aspect-ratio: 4 / 5; }
.media.ratio-916 { aspect-ratio: 9 / 16; }

/* trilho do carrossel */
.rail {
  display: flex; width: 100%; height: 100%;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail .slide {
  flex: 0 0 100%; height: 100%; scroll-snap-align: center; position: relative;
}
.rail .slide img, .media > img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* badge contador + dots */
.count-badge {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 12px; backdrop-filter: blur(2px);
}
.dots-ind {
  position: absolute; bottom: 10px; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: center; gap: 5px;
}
.dots-ind i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.55); transition: background .2s; }
.dots-ind i.on { background: #fff; }

/* badge de tipo */
.type-badge {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  font-size: 11px; font-weight: 600; color: #fff;
  background: rgba(0,0,0,.55); padding: 3px 9px; border-radius: 12px;
  display: flex; align-items: center; gap: 4px; backdrop-filter: blur(2px);
}

/* capa do reel (poster de vídeo do Drive é instável → fundo escuro garantido) */
.reel-cover {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #2a2a2e, #050505);
  display: grid; place-items: center;
}
.reel-cover img { width: 100%; height: 100%; object-fit: cover; }
.reel-cover .reel-player { width: 100%; height: 100%; border: 0; display: block; }
.reel-name {
  position: absolute; bottom: 14px; left: 0; right: 0; z-index: 3; text-align: center;
  color: rgba(255,255,255,.7); font-size: 11px; padding: 0 16px; pointer-events: none;
}

/* play do reel */
.play {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center;
  border: none; background: rgba(0,0,0,.1); cursor: pointer;
}
.play span {
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(0,0,0,.55); display: grid; place-items: center;
  color: #fff; font-size: 24px; padding-left: 4px; backdrop-filter: blur(2px);
}

/* placeholder de arte pendente */
.pending {
  width: 100%; height: 100%; display: grid; place-items: center; text-align: center;
  background: repeating-linear-gradient(45deg, #f2f2f2, #f2f2f2 12px, #ececec 12px, #ececec 24px);
  color: var(--muted);
}
.pending div { font-size: 13px; }
.pending b { display: block; font-size: 26px; margin-bottom: 6px; }

/* barra de ações IG */
.actions { display: flex; align-items: center; gap: 16px; padding: 8px 12px 2px; font-size: 22px; }
.actions .ic { color: var(--ink); }
.actions .spacer { flex: 1; }

/* legenda */
.caption { padding: 2px 12px 14px; font-size: 13px; line-height: 1.45; }
.caption .handle { font-weight: 700; margin-right: 6px; }
.caption .txt { white-space: pre-wrap; }
.caption .tag { color: var(--accent); }
.caption .more { color: var(--muted); cursor: pointer; }
.caption.clamp .txt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.caption .nolegend { color: var(--muted); font-style: italic; }
.caption .file { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }

/* rodapé */
.ig-foot {
  position: sticky; bottom: 0; padding: 8px 16px; padding-bottom: max(8px, env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); text-align: center;
}
.status { font-size: 11px; color: var(--muted); }

.err { padding: 40px 24px; text-align: center; color: #c0392b; font-size: 13px; line-height: 1.5; }
