/* Glimpse: a single 470px column like a phone feed, centered on desktop. */
:root {
  --bg: #ffffff;
  --fg: #1d1a1a;
  --muted: #7a7171;
  --line: #ecebea;
  --soft: #f6f4f3;
  --coral: #ff6b4a;
  --amber: #ffb547;
  --heart: #ef3e5c;
  --cta: #ff6b4a;
  --cta-ink: #ffffff;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f0e0e; --fg: #f4f1f0; --muted: #a59d9c; --line: #2a2726; --soft: #1b1918; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-inner { max-width: 470px; margin: 0 auto; height: 54px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 700; font-size: 22px; letter-spacing: -0.03em; }
.brand svg { width: 28px; height: 28px; }
.brand svg rect { fill: var(--coral); }
.brand svg circle:first-of-type { fill: none; stroke: #fff; stroke-width: 3; }
.brand svg circle:last-of-type { fill: #fff; }
.top-icons { display: flex; gap: 18px; }
.top-icons svg, .act svg, .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

.page { max-width: 470px; margin: 0 auto; }

/* Profile */
.profile { padding: 16px max(16px, env(safe-area-inset-left, 0px)) 4px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.profile-head { display: flex; align-items: center; gap: 24px; }
.ring { padding: 3px; border-radius: 50%; background: conic-gradient(from 210deg, var(--amber), var(--coral), #ff3d7f, var(--amber)); flex: none; }
.ring img { width: 86px; height: 86px; border-radius: 50%; object-fit: cover; border: 3px solid var(--bg); }
.stats { display: flex; flex: 1; justify-content: space-around; text-align: center; }
.stats b { display: block; font-size: 17px; }
.stats span { color: var(--muted); font-size: 13px; }
.bio h1 { font-size: 14px; margin: 0; }
.bio div p { margin: 0; }
.profile-actions { display: flex; gap: 8px; }
.profile-actions button { flex: 1; border: 0; border-radius: 9px; padding: 8px 0; font-weight: 600; cursor: pointer; }
.follow { background: var(--coral); color: #fff; }
.follow.on { background: var(--soft); color: var(--fg); }
.ghost { background: var(--soft); }
.highlights { display: flex; gap: 16px; overflow-x: auto; padding: 6px 0 8px; scrollbar-width: none; }
.highlights::-webkit-scrollbar { display: none; }
.hl { display: grid; justify-items: center; gap: 4px; font-size: 12px; flex: none; }
.hl span { padding: 2px; border-radius: 50%; border: 1px solid var(--line); }
.hl img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; }

/* Tabs */
.tabs { display: flex; border-top: 1px solid var(--line); }
.tab { flex: 1; background: none; border: 0; padding: 11px 0; cursor: pointer; color: var(--muted); border-top: 1px solid transparent; margin-top: -1px; display: grid; place-items: center; }
.tab.active { color: var(--fg); border-top-color: var(--fg); }

/* Posts */
.feed { display: grid; grid-template-columns: minmax(0, 1fr); }
.post { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.post-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.who { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.who .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { color: var(--muted); letter-spacing: 1px; }
.media { position: relative; background: var(--soft); aspect-ratio: 1 / 1; overflow: hidden; user-select: none; }
.media.tall { aspect-ratio: 4 / 5; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; }
.mute { position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.mute svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.burst { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.burst svg { width: 96px; height: 96px; fill: #fff; filter: drop-shadow(0 4px 12px rgba(0,0,0,.35)); animation: pop .8s ease forwards; }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 30% { transform: scale(.95); } 70% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.actions { display: flex; gap: 14px; padding: 8px 14px 4px; align-items: center; }
.act { background: none; border: 0; padding: 2px; cursor: pointer; display: grid; }
.act.save { margin-left: auto; }
.like[aria-pressed="true"] svg { fill: var(--heart); stroke: var(--heart); animation: thump .35s ease; }
.save[aria-pressed="true"] svg { fill: currentColor; }
@keyframes thump { 50% { transform: scale(1.25); } }
.meta { padding: 0 14px; display: grid; gap: 3px; }
.caption { margin: 0; overflow-wrap: anywhere; }
.comments, .when { color: var(--muted); font-size: 13px; }
.when { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }

/* Ads */
.ad .who .sub { color: var(--fg); }
.ad-placeholder { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px; padding: 24px; background: linear-gradient(145deg, #fde8e4, #fbd3c8 55%, #f6c1cf); color: #5a2b2b; }
.ad-placeholder .mark { font: 700 13px/1 var(--font); letter-spacing: .28em; text-transform: uppercase; opacity: .8; }
.ad-placeholder .prod { font: 600 26px/1.15 Georgia, "Times New Roman", serif; }
.ad-placeholder .note { font-size: 12px; opacity: .75; }
.shop { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: var(--cta); color: var(--cta-ink); text-decoration: none; font-weight: 600; }
.shop:hover { filter: brightness(1.05); }
.shop svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.grid button { border: 0; padding: 0; aspect-ratio: 1; background: var(--soft); cursor: pointer; position: relative; overflow: hidden; }
.grid img { width: 100%; height: 100%; object-fit: cover; }
.grid .reel { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; fill: #fff; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }

.sentinel { display: grid; place-items: center; padding: 28px 0; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--coral); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.end { text-align: center; color: var(--muted); padding: 24px 0 8px; margin: 0; }
.foot { max-width: 470px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 11px; text-align: center; }
[hidden] { display: none !important; }
