:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #000000;
  --muted: #737373;
  --line: #dbdbdb;
  --chip: #efefef;
  --accent: #0095f6;
  --tile-aspect: 3 / 4;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}
.ig-profile {
  position: relative;
  z-index: 10;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(16px);
}
.ig-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 32px;
  margin-bottom: 10px;
}
.ig-nav strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 760;
  letter-spacing: 0;
}
.ig-icons {
  display: flex;
  gap: 18px;
  align-items: center;
}
.ig-icons span {
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
}
.ig-icons span:first-child {
  border-radius: 6px;
  position: relative;
}
.ig-icons span:first-child::before,
.ig-icons span:first-child::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.ig-icons span:first-child::before {
  left: 4px;
  right: 4px;
  top: 9px;
  height: 2px;
}
.ig-icons span:first-child::after {
  top: 4px;
  bottom: 4px;
  left: 9px;
  width: 2px;
}
.ig-icons span:last-child {
  border-radius: 50%;
  border-width: 0;
  box-shadow: inset 0 0 0 2px var(--ink);
  position: relative;
}
.ig-icons span:last-child::before,
.ig-icons span:last-child::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  height: 2px;
  background: var(--ink);
}
.ig-icons span:last-child::before { top: 6px; }
.ig-icons span:last-child::after { bottom: 6px; }
.profile-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}
.avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(#feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
}
.avatar::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--avatar-image, linear-gradient(145deg, #111, #777)) center / cover;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  text-align: center;
}
.stats strong,
.stats span {
  display: block;
}
.stats strong {
  font-size: 17px;
  line-height: 1.15;
}
.stats span {
  margin-top: 2px;
  font-size: 13px;
}
.bio {
  padding-top: 10px;
  font-size: 14px;
  line-height: 1.28;
}
.bio strong {
  display: block;
  font-weight: 650;
}
.bio p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr 36px;
  gap: 6px;
  padding-top: 10px;
}
button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--chip);
  color: var(--ink);
  padding: 0 11px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.icon-button {
  position: relative;
  padding: 0;
}
.icon-button::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 9px;
  width: 12px;
  height: 12px;
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-45deg);
}
.toolbar {
  position: sticky;
  top: 0;
  z-index: 9;
  display: grid;
  gap: 8px;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}
.segmented {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  border-color: var(--line);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
}
button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.feed {
  width: min(100%, 640px);
  margin: 0 auto;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}
.section {
  padding-top: 12px;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 8px;
}
.section-header h2 {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}
.section-header span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.grid {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: 3px;
  background: var(--line);
}
.tile {
  position: relative;
  display: block;
  aspect-ratio: var(--tile-aspect);
  background: #e7e3da;
  overflow: hidden;
  text-decoration: none;
}
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile:active img {
  opacity: .82;
}
.badge {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .58);
  color: white;
  font-size: 11px;
}
.pswp__img {
  user-select: none;
  -webkit-user-select: none;
}
.video-overlay[hidden] {
  display: none;
}
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background: #000;
}
.video-overlay video {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.close-video {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 28px;
  line-height: 1;
}
@media (min-width: 700px) {
  .ig-profile, .toolbar { padding-left: calc((100% - 640px) / 2); padding-right: calc((100% - 640px) / 2); }
  .feed { padding-top: 0; }
  .grid { gap: 4px; background: transparent; }
  .tile { border-radius: 0; }
}
