/* ========================= */
/* 🎨 THEME */
/* ========================= */

:root {
  --bg: #0f0f10;
  --card: #1a1a1c;
  --border: #2a2a2d;
  --text: #eaeaea;
  --sub: #9a9a9a;
  --accent: #ff3040;
}

body.light {
  --bg: #ffffff;
  --card: #f5f5f7;
  --border: #e0e0e0;
  --text: #111;
  --sub: #666;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: sans-serif;
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .post-page {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    background: #000 !important;
  }

  .post-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: var(--bg) !important;
  }

  .post-image-wrap {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    line-height: 0 !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-info {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border) !important;
    background: var(--card) !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .username,
  #postUsername,
  .caption-name {
    font-size: 35px !important;
    line-height: 1.12 !important;
  }

  .post-author span,
  .caption span {
    font-size: 30px !important;
    line-height: 1.18 !important;
  }

  .action-item,
  .meta,
  .caption {
    font-size: 35px !important;
    line-height: 1.32 !important;
  }

  .caption-text,
  .meta-row,
  .comment-username,
  .comment-text {
    font-size: 33px !important;
    line-height: 1.34 !important;
  }

  .profile-username,
  .profile-private h3 {
    font-size: 58px !important;
    line-height: 1.05 !important;
  }

  .profile-stat b {
    font-size: 50px !important;
    line-height: 1 !important;
  }

  .profile-stat span {
    font-size: 34px !important;
    line-height: 1.08 !important;
  }

  .profile-bio,
  .profile-archive-note,
  .profile-private p {
    font-size: 43px !important;
    line-height: 1.22 !important;
  }

  .post-image-wrap .nav {
    width: 96px !important;
    height: 96px !important;
    min-width: 96px !important;
    min-height: 96px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.42) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #fff !important;
    font-size: 58px !important;
    line-height: 1 !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 8 !important;
  }

  .post-image-wrap .prev {
    left: 18px !important;
  }

  .post-image-wrap .next {
    right: 18px !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .profile {
    padding: 18px 14px 36px !important;
    overflow-x: hidden !important;
  }

  .profile-top {
    display: grid !important;
    grid-template-columns: 132px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 132px !important;
    height: 132px !important;
  }

  .profile-info {
    min-width: 0 !important;
    gap: 14px !important;
  }

  .profile-username {
    font-size: 44px !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere !important;
  }

  .profile-stats {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .profile-stat {
    min-width: 0 !important;
    padding: 12px 4px !important;
    overflow: hidden !important;
  }

  .profile-stat b {
    display: block !important;
    font-size: 28px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
  }

  .profile-stat span {
    display: block !important;
    margin-top: 5px !important;
    font-size: 15px !important;
    line-height: 1.12 !important;
    white-space: nowrap !important;
  }

  .profile-bio {
    font-size: 36px !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  #postUsername,
  .caption-name {
    font-size: 22px !important;
    line-height: 1.2 !important;
  }

  .caption-text {
    font-size: 20px !important;
    line-height: 1.42 !important;
  }

  .meta-row,
  .comment-username,
  .comment-text {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  .post-info .post-header {
    padding: 14px 16px !important;
    gap: 12px !important;
  }

  .post-avatar,
  .comment-avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .post-description {
    padding: 16px !important;
  }

  .post-meta {
    padding: 12px 16px !important;
  }

  .post-comments {
    padding: 14px 16px !important;
  }

  .post-image-wrap .nav {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    min-height: 64px !important;
    font-size: 38px !important;
    background: rgba(0, 0, 0, 0.34) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
  }

  .post-image-wrap .prev {
    left: 12px !important;
  }

  .post-image-wrap .next {
    right: 12px !important;
  }

  .close-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 32px !important;
  }
}

.home {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 16px 32px;
  box-sizing: border-box;
}

.home-banner {
  max-width: 680px;
  margin: 0 auto 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,48,64,0.1), transparent 42%),
    var(--card);
  padding: 18px 20px;
  box-sizing: border-box;
}

.home-banner-text {
  min-width: 0;
}

.home-banner-text p {
  margin: 0 0 5px;
  color: var(--sub);
  font-size: 12px;
  line-height: 1.2;
}

.home-banner-text h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.home-banner-text span {
  display: block;
  max-width: 460px;
  margin-top: 9px;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.4;
}

.home-banner-avatars {
  display: flex;
  align-items: center;
  padding-left: 10px;
}

.home-banner-avatars img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--card);
  margin-left: -12px;
  box-shadow: 0 0 0 1px var(--border);
}

.home-banner-avatars img:first-child {
  margin-left: 0;
}

.home-panel {
  margin: 0 auto 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.home-panel-main {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 280px);
  gap: 14px;
  align-items: center;
}

.home-kicker {
  margin: 0 0 2px;
  color: var(--sub);
  font-size: 12px;
  letter-spacing: 0;
}

.home-panel h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.home-search {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  padding: 0 11px;
  box-sizing: border-box;
}

.home-search .icon {
  width: 17px;
  height: 17px;
  color: var(--sub);
  flex-shrink: 0;
}

.home-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.stories {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-top: 14px;
  scrollbar-width: none;
}

.stories::-webkit-scrollbar {
  display: none;
}

.story {
  width: 58px;
  flex: 0 0 58px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  font-size: 12px;
}

.story img {
  width: 52px;
  height: 52px;
  display: block;
  margin: 0 auto 6px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.story span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .home {
    padding: 14px 10px 28px;
  }

  .home-banner {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .home-banner-text h1 {
    font-size: 21px;
  }

  .home-banner-avatars {
    padding-left: 0;
  }

  .home-panel-main {
    grid-template-columns: 1fr;
  }

  .home-search {
    width: 100%;
  }

  .post {
    border-radius: 0;
    margin-left: -10px;
    margin-right: -10px;
    border-left: 0;
    border-right: 0;
  }

  .post-text-card {
    min-height: 310px;
    padding: 24px;
  }

  .post-text-card p {
    font-size: 24px;
  }
}




/* ========================= */
/* 📱 FEED */
/* ========================= */

.feed {
  max-width: 520px;
  margin: auto;
  padding: 0;
}

.post {
  background: var(--card);
  border-radius: 14px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
body:not(.light) .post {
  border: 1px solid #3a3a3f;
}

.post-image {
  aspect-ratio: 4/5;
  position: relative;
  overflow: hidden;
}

.post-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.62);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 7px 9px;
}

.post-text-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 360px;
  padding: 28px;
  box-sizing: border-box;
  background:
    linear-gradient(145deg, rgba(255,48,64,0.88), rgba(31,31,33,0.96)),
    var(--card);
}

.post-text-card p {
  margin: 0;
  max-width: 360px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  color: #fff;
}

.post-text-card span {
  margin-top: 14px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
}


/* ========================= */
/* ❤️ LIKE */
/* ========================= */

.like-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.like-btn svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s ease;
}

.heart-filled {
  display: none;
  fill: var(--accent);
}

.like-btn.liked .heart-outline {
  display: none;
}

.like-btn.liked .heart-filled {
  display: block;
}

.like-btn.liked svg {
  animation: likePop 0.35s ease;
}

@keyframes likePop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.4); }
  100% { transform: scale(1.2); }
}


/* ========================= */
/* 💬 ACTIONS */
/* ========================= */

.actions {
  padding: 10px 12px 0;
  display: flex;
  justify-content: space-between;
}

.left-actions {
  display: flex;
  gap: 14px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}


/* ========================= */
/* 👤 HEADER */
/* ========================= */

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.avatar-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  display: block;
  flex-shrink: 0;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.username {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
}

.post-author {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.post-author span {
  color: var(--sub);
  font-size: 12px;
}


/* ========================= */
/* 📊 META */
/* ========================= */

.meta {
  padding: 0 12px;
  margin-top: 6px;
}

.caption {
  padding: 0 12px 12px;
  margin-top: 6px;
  line-height: 1.35;
}

.caption span {
  display: block;
  margin-top: 20px;
  color: var(--sub);
}


/* ========================= */
/* ❤️ BIG HEART */
/* ========================= */

.big-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  pointer-events: none;
  animation: heartPop 0.6s ease forwards;
}

.big-heart svg {
  width: 90px;
  height: 90px;
  fill: var(--accent);
}

@keyframes heartPop {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  40% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}


/* ========================= */
/* 💥 BURST */
/* ========================= */

.burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 120px;

  border-radius: 50%;
  border: 2px solid var(--accent);

  transform: translate(-50%, -50%) scale(0.5);
  opacity: 1;

  animation: burstAnim 0.6s ease-out forwards;
}

@keyframes burstAnim {
  100% {
    transform: translate(-50%, -50%) scale(1.8);
    opacity: 0;
  }
}


.profile-disabled {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  text-align: center;
  padding: 60px 20px;
}

.disabled-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;

  margin-bottom: 20px;
}

/* профиль */
.profile {
  max-width: 600px;
  margin: auto;
  padding: 16px;
}

/* верх */
.profile-top {
  display: flex;
  gap: 20px;
  align-items: center;
}

.profile-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
}



.profile-top {
  display: flex;
  align-items: center;
  gap: 32px; /* было ~20 */
}
/* био */
.profile-bio {
  margin-top: 16px;
}

/* кнопка */
.profile-actions {
  margin-top: 12px;
}

.follow-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

/* закрытый аккаунт */
.profile-private {
  text-align: center;
  margin-top: 40px;
}

.profile-private h3 {
  margin-bottom: 8px;
}




.profile-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.profile-name {
  font-weight: 600;
  font-size: 15px;
}

.profile-stats div {
  text-align: center;
  min-width: 60px;
}

/* профиль */
.profile {
  max-width: 600px;
  margin: auto;
  padding: 16px;
}

/* верх */
.profile-top {
  display: flex;
  align-items: center;
  gap: 20px;
}



/* username (как в IG — сверху) */
.profile-username {
  font-weight: 600;
  font-size: 16px;
}

/* stats */
.profile-stats {
  display: flex;
  justify-content: space-between;
  max-width: 360px;
}


/* линия */

.profile-divider {
  margin-top: 60px;   /* усиливаем паузу перед линией */
  margin-bottom: 12px;

  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border),
    transparent
  );
}


.profile-divider {
  margin-top: 32px;
  margin-bottom: 12px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--border),
    transparent
  );
}

body:not(.light) .profile-divider {
  background: linear-gradient(
    to right,
    transparent,
    #3a3a3f,
    transparent
  );
}

.profile-bio {
  margin-top: 12px;
  line-height: 1.4;
  max-width: 420px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px; /* увеличили расстояние */
}

.grid-item {
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 8px; /* делаем заметнее */
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
}

.photo-page img {
  max-width: 90%;
  max-height: 90%;
}


.post-page {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);

  display: flex;
  align-items: center;
  justify-content: center;
}

.post-image-wrap {
  flex: 1;
  background: black;

  display: flex;
  align-items: center;
  justify-content: center;
}

.post-image-wrap img {
  width: 100%;
  height: auto;
  max-height: none;
}

.post-info {
  width: 350px;
  background: var(--card);
  border-left: 1px solid var(--border);

  display: flex;
  flex-direction: column;
}

/* header */
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

/* описание */
.post-description {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-top: 16px;
}

/* комментарии */
.post-comments {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.comment {
  margin-bottom: 10px;
}

.comment b {
  margin-right: 6px;
}

.post-page {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);

  display: flex;
  align-items: center;
  justify-content: center;
}

.post-container {
  display: flex;
  background: var(--card);

  max-width: 1000px;
  width: 100%;
  height: 80vh;

  border-radius: 12px;
  overflow: hidden;
}


.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 28px;
  
  width: 40px;
  height: 40px;
  border-radius: 50%;
  
  cursor: pointer;
}

.prev { left: 20px; }
.next { right: 20px; }


.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;

  background: none;
  border: none;
  color: white;

  font-size: 28px;
  cursor: pointer;
  z-index: 10;
}

@media (max-width: 768px) {

  .post-container {
    flex-direction: column; /* было row → стало column */
    height: auto;
    max-width: 100%;
    border-radius: 0;
  }

  .post-image-wrap {
    width: 100%;
    height: auto;
  }

  .post-image-wrap img {
    max-height: 60vh; /* чтобы не занимало весь экран */
  }

  .post-info {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  .post-page {
    align-items: flex-start; /* чтобы пост был сверху */
    padding-top: 20px;
  }

}



.post-image-wrap {
  position: relative; /* ВАЖНО */
}



/* ========================= */
/* 📸 POST VIEW (FIXED) */
/* ========================= */

.post-page {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);

  display: flex;
  align-items: center;
  justify-content: center;
}

/* контейнер поста */
.post-container {
  display: flex;
  background: var(--card);

  max-width: 1000px;
  width: 100%;
  height: 80vh;

  border-radius: 12px;
  overflow: hidden;
}

/* блок с фото */
.post-image-wrap {
  flex: 1;
  background: black;

  display: flex;
  align-items: center;
  justify-content: center;

  position: relative; /* КЛЮЧ */
}

.post-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* стрелки (ТОЛЬКО внутри фото) */
.post-image-wrap .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  background: rgba(0,0,0,0.5);
  border: none;
  color: white;

  width: 40px;
  height: 40px;
  border-radius: 50%;

  font-size: 24px;
  cursor: pointer;
  z-index: 5;
}

.post-image-wrap .prev {
  left: 12px;
}

.post-image-wrap .next {
  right: 12px;
}

/* правая часть */
.post-info {
  width: 350px;
  background: var(--card);
  border-left: 1px solid var(--border);

  display: flex;
  flex-direction: column;
}

/* header */
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.post-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}


/* комментарии */
.post-comments {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.comment {
  margin-bottom: 10px;
}

/* крестик */
.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;

  background: none;
  border: none;
  color: white;

  font-size: 28px;
  cursor: pointer;
  z-index: 10;
}

/* ========================= */
/* 📱 MOBILE */
/* ========================= */

@media (max-width: 768px) {

  .post-page {
    align-items: flex-start;
  }

  .post-container {
    flex-direction: column;
    height: auto;
    max-width: 100%;
    border-radius: 0;
  }

  .post-image-wrap img {
    max-height: 60vh;
  }

  .post-info {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
  }

}


/* комментарий как блок */
.comment {
  display: flex;
  gap: 12px;

  padding-top: 10px;
  margin-bottom: 18px;

  border-top: 1px solid rgba(255,255,255,0.04); /* лёгкое разделение */
}


.comment:first-child {
  border-top: none;
  padding-top: 0;
}


/* аватар */
.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* тело комментария */
.comment-body {
  display: flex;
  flex-direction: column;
  gap: 4px; /* расстояние имя ↔ текст */
}

/* имя */
.comment-username {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}

/* текст */
.comment-text {
  font-size: 13px;
  line-height: 1.4;
}


.caption-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.caption-text {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-line;
}

.caption-text a {
  color: #7aa7ff;
  font-weight: 700;
  text-decoration: none;
}

.caption-text a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .post-page {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    padding-bottom: 20px;
  }

  .post-container {
    overflow: visible;
  }

  .post-image-wrap,
  .post-info,
  .post-comments {
    flex: 0 0 auto;
  }

  .post-comments {
    overflow: visible;
  }
}


.post-meta {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.meta-row {
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.meta-row b {
  font-weight: 600;
}

.meta-date {
  margin-top: 6px;
  font-size: 12px;
  color: var(--sub);
}


/* вся строка метрик */
.meta-row span {
  transition: color 0.2s ease, opacity 0.2s ease;
  opacity: 0.7;
  cursor: pointer;
}

/* при наведении */
.meta-row span:hover {
  opacity: 1;
  color: rgba(255,255,255,0.95);
}

/* цифры внутри */
.meta-row span b {
  transition: color 0.2s ease;
}

.meta-row span:hover b {
  color: white;
}


.meta-row {
  display: flex;
  gap: 20px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  opacity: 0.7;
  transition: 0.2s;
}

.meta-item:hover {
  opacity: 1;
}

.meta-item .icon {
  width: 18px;
  height: 18px;
}

/* лайк активный */
.like-item.liked .icon {
  color: #ff3040;
  fill: #ff3040; /* ВОТ ЭТО ГЛАВНОЕ */
}

.like-item.liked svg {
  stroke: #ff3040;
  fill: #ff3040;
}
.big-heart {
  position: absolute;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  pointer-events: none;
}

.big-heart svg {
  width: 90px;
  height: 90px;
  fill: white;

  opacity: 0;
  transform: scale(0.5);

  animation: heartPop 0.6s ease forwards;
}

@keyframes heartPop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  40% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* Profile pages */
.profile {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  box-sizing: border-box;
}

.profile-top {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 34px;
  align-items: center;
}

.profile-avatar {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.profile-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.profile-username {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(92px, 1fr));
  gap: 12px;
  max-width: 460px;
}

.profile-stat {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
  background: var(--card);
}

.profile-stat b,
.profile-stat span {
  display: block;
}

.profile-stat b {
  font-size: 18px;
  line-height: 1.1;
}

.profile-stat span {
  margin-top: 4px;
  color: var(--sub);
  font-size: 13px;
  line-height: 1.2;
}

.profile-divider {
  margin: 34px 0 28px;
  height: 1px;
  background: var(--border);
}

.profile-private {
  max-width: 420px;
  margin: 0 auto;
  padding: 20px 0;
  text-align: center;
}

.profile-private h3 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.25;
}

.profile-private p {
  margin: 0;
  color: var(--sub);
  line-height: 1.45;
}

.profile-message {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px;
}

.profile-bio {
  margin-top: 18px;
  line-height: 1.45;
  max-width: 520px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.grid-item {
  display: block;
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--card);
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-archive-note {
  max-width: 420px;
  margin: 22px auto 0;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

@media (max-width: 640px) {
  .profile {
    padding: 20px 14px 36px;
  }

  .profile-top {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 18px;
  }

  .profile-avatar {
    width: 96px;
    height: 96px;
  }

  .profile-username {
    font-size: 19px;
  }

  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .profile-stat {
    padding: 9px 4px;
  }

  .profile-stat b {
    font-size: 15px;
  }

  .profile-stat span {
    font-size: 11px;
  }

  .profile-divider {
    margin: 24px 0 22px;
  }
}

/* Mobile-first refinements for phone-sized Socialgram views */
@media (max-width: 768px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
  }

  .home {
    width: 100%;
    padding: 12px 0 28px;
  }

  .home-banner {
    display: none;
  }

  .feed {
    max-width: none;
    width: 100%;
  }

  .post {
    width: 100%;
    margin: 0 0 14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .post-header {
    min-height: 46px;
    padding: 10px 12px;
    box-sizing: border-box;
  }

  .username,
  .caption,
  .meta,
  .action-item,
  .post-author span {
    font-size: 14px;
  }

  .caption {
    padding-bottom: 16px;
    line-height: 1.45;
  }

  .caption span {
    margin-top: 12px;
    font-size: 12px;
  }

  .actions {
    padding: 12px 12px 0;
  }

  .left-actions {
    gap: 16px;
  }

  .post-image {
    aspect-ratio: 1 / 1;
    background: #000;
  }

  .post-image img {
    object-fit: cover;
  }

  .profile {
    width: 100%;
    padding: 16px 10px 34px;
  }

  .profile-top {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
  }

  .profile-avatar {
    width: 84px;
    height: 84px;
  }

  .profile-info {
    gap: 12px;
  }

  .profile-username {
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  .profile-stats {
    gap: 4px;
  }

  .profile-stat {
    padding: 8px 3px;
  }

  .profile-stat b {
    font-size: 15px;
  }

  .profile-stat span {
    font-size: 11px;
    line-height: 1.15;
  }

  .profile-bio {
    margin-top: 14px;
    font-size: 14px;
  }

  .profile-divider {
    margin: 20px 0 3px;
  }

  .profile-grid {
    gap: 2px;
    margin-left: -10px;
    margin-right: -10px;
  }

  .grid-item {
    border-radius: 0;
  }

  .profile-archive-note {
    margin-top: 18px;
    padding: 0 8px;
    font-size: 13px;
  }

  .post-page {
    position: fixed;
    inset: 0;
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    background: #000;
    -webkit-overflow-scrolling: touch;
  }

  .post-container {
    min-height: 100svh;
    width: 100%;
    max-width: none;
    height: auto;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    overflow: visible;
    background: var(--bg);
  }

  .post-image-wrap {
    width: 100%;
    min-height: 58svh;
    max-height: 68svh;
    flex: 0 0 auto;
    background: #000;
  }

  .post-image-wrap img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 68svh;
    object-fit: contain;
  }

  .post-image-wrap .nav {
    width: 38px;
    height: 38px;
    font-size: 23px;
  }

  .post-image-wrap .prev {
    left: 8px;
  }

  .post-image-wrap .next {
    right: 8px;
  }

  .close-btn {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    font-size: 30px;
    line-height: 1;
  }

  .post-info {
    width: 100%;
    min-height: 0;
    flex: 0 0 auto;
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .post-description {
    margin-top: 0;
    padding: 15px 14px;
  }

  .caption-name {
    font-size: 15px;
  }

  .caption-text {
    font-size: 15px;
    line-height: 1.48;
    overflow-wrap: anywhere;
  }

  .post-meta {
    padding: 12px 14px;
  }

  .meta-row {
    gap: 18px;
    flex-wrap: wrap;
    font-size: 14px;
  }

  .meta-item .icon {
    width: 20px;
    height: 20px;
  }

  .post-comments {
    flex: 0 0 auto;
    max-height: none;
    overflow: visible;
    padding: 14px;
  }

  .comment {
    gap: 10px;
    margin-bottom: 16px;
  }

  .comment-avatar {
    width: 34px;
    height: 34px;
  }

  .comment-username,
  .comment-text {
    font-size: 14px;
  }

  .comment-text {
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 380px) {
  .logo {
    width: 205px;
    height: 55px;
  }

  .profile-top {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }

  .profile-avatar {
    width: 76px;
    height: 76px;
  }

  .profile-stat span {
    font-size: 10px;
  }
}

@media (min-width: 769px) {
  .home {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 18px 16px 32px;
  }

  .home-banner {
    display: grid;
  }

  .feed {
    max-width: 520px;
    width: 100%;
    margin: auto;
  }

  .post {
    width: auto;
    margin-bottom: 24px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 14px;
  }

  body:not(.light) .post {
    border-left-color: #3a3a3f;
    border-right-color: #3a3a3f;
  }

  .post-image {
    aspect-ratio: 4 / 5;
  }
}

@media (max-width: 1100px), (hover: none), (pointer: coarse) {
  .home {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 12px 0 28px;
  }

  .home-banner {
    display: none;
  }

  .feed {
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .post {
    width: 100%;
    margin: 0 0 14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .post-header {
    min-height: 58px;
    padding: 10px 14px;
    gap: 11px;
  }

  .avatar-wrap,
  .avatar-wrap img {
    width: 36px;
    height: 36px;
  }

  .post-author {
    gap: 2px;
  }

  .username {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 700;
  }

  .post-author span {
    font-size: 13px;
    line-height: 1.2;
  }

  .post-image {
    aspect-ratio: 1 / 1;
  }

  .actions {
    padding: 12px 14px 0;
  }

  .left-actions {
    gap: 20px;
  }

  .action-item {
    font-size: 15px;
    line-height: 1.2;
  }

  .action-item .icon,
  .like-btn svg {
    width: 30px;
    height: 30px;
  }

  .meta {
    padding: 9px 14px 0;
    font-size: 15px;
    line-height: 1.35;
  }

  .caption {
    padding: 4px 14px 20px;
    font-size: 15px;
    line-height: 1.42;
  }

  .caption b {
    font-weight: 700;
  }

.caption span {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.25;
  color: var(--muted);
}
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .post-page {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #000 !important;
    -webkit-overflow-scrolling: touch;
  }

  .post-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: var(--bg) !important;
  }

  .post-image-wrap {
    width: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    line-height: 0 !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-image-wrap .nav {
    top: 50% !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 23px !important;
    line-height: 1 !important;
  }

  .post-info {
    width: 100% !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border) !important;
  }

  .post-description {
    margin-top: 0 !important;
  }
}

@media (min-width: 769px) {
  .post-page {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    padding: 40px 56px !important;
    background: #000 !important;
  }

  .post-container {
    width: min(92vw, 1120px) !important;
    max-width: 1120px !important;
    height: min(82vh, 760px) !important;
    min-height: 520px !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    background: var(--card) !important;
  }

  .post-image-wrap {
    width: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: normal !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-info {
    width: 380px !important;
    min-width: 380px !important;
    max-width: 380px !important;
    height: 100% !important;
    min-height: 0 !important;
    flex: 0 0 380px !important;
    display: flex !important;
    flex-direction: column !important;
    border-left: 1px solid var(--border) !important;
    border-top: 0 !important;
    background: var(--card) !important;
  }

  .post-info .post-header {
    flex: 0 0 auto !important;
  }

  .post-description,
  .post-meta {
    flex: 0 0 auto !important;
  }

  .post-comments {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }

  .close-btn {
    position: fixed !important;
    top: 16px !important;
    right: 24px !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: #fff !important;
    font-size: 30px !important;
    line-height: 1 !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .username {
    font-size: 23px !important;
    line-height: 1.18 !important;
  }

  .post-author span {
    font-size: 20px !important;
    line-height: 1.2 !important;
  }

  .action-item,
  .meta,
  .caption {
    font-size: 23px !important;
    line-height: 1.42 !important;
  }

  .caption span {
    font-size: 20px !important;
    line-height: 1.28 !important;
  }

  .profile-username {
    font-size: 39px !important;
    line-height: 1.12 !important;
  }

  .profile-stat b {
    font-size: 33px !important;
    line-height: 1.05 !important;
  }

  .profile-stat span {
    font-size: 23px !important;
    line-height: 1.12 !important;
  }

  .profile-bio,
  .profile-archive-note,
  .profile-private p {
    font-size: 29px !important;
    line-height: 1.35 !important;
  }

  .profile-private h3 {
    font-size: 39px !important;
    line-height: 1.15 !important;
  }

  #postUsername,
  .caption-name {
    font-size: 23px !important;
    line-height: 1.18 !important;
  }

  .caption-text,
  .meta-row,
  .comment-username,
  .comment-text {
    font-size: 22px !important;
    line-height: 1.45 !important;
  }

  .post-page {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    background: #000 !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .post-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: var(--bg) !important;
  }

  .post-image-wrap {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    line-height: 0 !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-info {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border) !important;
    background: var(--card) !important;
  }

  .post-comments {
    flex: 0 0 auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .close-btn {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: 12px !important;
  }
}

@media (max-width: 1200px), (hover: none), (pointer: coarse) {
  .profile,
  .profile-message {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .profile {
    padding: 18px 16px 36px !important;
  }

  .profile-top {
    grid-template-columns: 112px minmax(0, 1fr) !important;
    gap: 20px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 112px !important;
    height: 112px !important;
  }

  .profile-username {
    font-size: 26px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 9px !important;
    max-width: none !important;
  }

  .profile-stat {
    padding: 13px 7px !important;
  }

  .profile-stat b {
    font-size: 22px !important;
    line-height: 1.1 !important;
  }

  .profile-stat span {
    font-size: 15px !important;
    line-height: 1.15 !important;
  }

  .profile-bio {
    margin-top: 20px !important;
    font-size: 19px !important;
    line-height: 1.45 !important;
  }

  .profile-divider {
    margin: 24px 0 6px !important;
  }

  .profile-grid {
    width: calc(100% + 32px) !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    gap: 3px !important;
  }

  .profile-archive-note {
    margin-top: 22px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  .profile-private {
    padding: 34px 18px !important;
  }

  .profile-private h3 {
    font-size: 26px !important;
    line-height: 1.2 !important;
  }

  .profile-private p {
    font-size: 19px !important;
    line-height: 1.35 !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .post-page {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    background: #000 !important;
  }

  .post-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: var(--bg) !important;
  }

  .post-image-wrap {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    line-height: 0 !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-info {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border) !important;
    background: var(--card) !important;
  }
}

@media (hover: hover) and (pointer: fine) {
  .profile,
  .profile-message {
    width: min(100%, 980px) !important;
    max-width: 980px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  .profile {
    padding: 36px 28px 56px !important;
  }

  .profile-top {
    grid-template-columns: 190px minmax(0, 1fr) !important;
    gap: 44px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 190px !important;
    height: 190px !important;
  }

  .profile-username {
    font-size: 34px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .profile-stats {
    max-width: 640px !important;
    grid-template-columns: repeat(3, minmax(140px, 1fr)) !important;
    gap: 16px !important;
  }

  .profile-stat {
    padding: 18px 14px !important;
  }

  .profile-stat b {
    font-size: 28px !important;
    line-height: 1.1 !important;
  }

  .profile-stat span {
    font-size: 17px !important;
    line-height: 1.2 !important;
  }

  .profile-bio {
    max-width: 760px !important;
    margin-top: 26px !important;
    font-size: 22px !important;
    line-height: 1.45 !important;
  }

  .profile-divider {
    margin: 42px 0 30px !important;
  }

  .profile-grid {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 10px !important;
  }

  .profile-archive-note {
    max-width: 640px !important;
    margin-top: 28px !important;
    font-size: 18px !important;
    line-height: 1.4 !important;
  }

  .profile-private {
    max-width: 700px !important;
    padding: 48px 24px !important;
  }

  .profile-private h3 {
    font-size: 34px !important;
    line-height: 1.2 !important;
  }

  .profile-private p {
    font-size: 22px !important;
    line-height: 1.4 !important;
  }
}

@media (max-width: 1200px), (hover: none), (pointer: coarse) {
  .post-header {
    min-height: 76px !important;
    padding: 14px 18px !important;
    gap: 14px !important;
  }

  .avatar-wrap,
  .avatar-wrap img {
    width: 52px !important;
    height: 52px !important;
  }

  .username {
    font-size: 22px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .post-author span {
    font-size: 18px !important;
    line-height: 1.25 !important;
  }

  .actions {
    padding: 16px 18px 0 !important;
  }

  .left-actions {
    gap: 26px !important;
  }

  .action-item {
    font-size: 20px !important;
    line-height: 1.2 !important;
  }

  .action-item .icon,
  .like-btn svg {
    width: 44px !important;
    height: 44px !important;
  }

  .meta {
    padding: 13px 18px 0 !important;
    font-size: 20px !important;
    line-height: 1.35 !important;
  }

  .caption {
    padding: 7px 18px 26px !important;
    font-size: 20px !important;
    line-height: 1.45 !important;
  }

  .caption span {
    margin-top: 12px !important;
    font-size: 17px !important;
    line-height: 1.3 !important;
  }

  .profile,
  .profile-message {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .profile {
    padding: 18px 16px 36px !important;
  }

  .profile-top {
    grid-template-columns: 108px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 108px !important;
    height: 108px !important;
  }

  .profile-username {
    font-size: 24px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    max-width: none !important;
  }

  .profile-stat {
    padding: 12px 6px !important;
  }

  .profile-stat b {
    font-size: 20px !important;
    line-height: 1.1 !important;
  }

  .profile-stat span {
    font-size: 14px !important;
    line-height: 1.15 !important;
  }

  .profile-bio {
    margin-top: 18px !important;
    font-size: 18px !important;
    line-height: 1.45 !important;
  }

  .profile-divider {
    margin: 22px 0 6px !important;
  }

  .profile-grid {
    width: calc(100% + 32px) !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    gap: 3px !important;
  }

  .profile-archive-note {
    margin-top: 22px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  .profile-private h3 {
    font-size: 24px !important;
    line-height: 1.2 !important;
  }

  .profile-private p {
    font-size: 17px !important;
    line-height: 1.35 !important;
  }
}

@media (max-width: 1100px), (hover: none), (pointer: coarse) {
  .home {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 12px 0 28px;
  }

  .home-banner {
    display: none;
  }

  .feed {
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .post {
    width: 100%;
    margin: 0 0 14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .post-header {
    min-height: 58px;
    padding: 10px 14px;
    gap: 11px;
  }

  .avatar-wrap,
  .avatar-wrap img {
    width: 36px;
    height: 36px;
  }

  .post-author {
    gap: 2px;
  }

  .username {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 700;
  }

  .post-author span {
    font-size: 13px;
    line-height: 1.2;
  }

  .post-image {
    aspect-ratio: 1 / 1;
  }

  .actions {
    padding: 12px 14px 0;
  }

  .left-actions {
    gap: 20px;
  }

  .action-item {
    font-size: 15px;
    line-height: 1.2;
  }

  .action-item .icon,
  .like-btn svg {
    width: 30px;
    height: 30px;
  }

  .meta {
    padding: 9px 14px 0;
    font-size: 15px;
    line-height: 1.35;
  }

  .caption {
    padding: 4px 14px 20px;
    font-size: 15px;
    line-height: 1.42;
  }

  .caption b {
    font-weight: 700;
  }

  .caption span {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.25;
    color: var(--muted);
  }
}

@media (max-width: 768px) {
  .post-header {
    min-height: 54px;
    padding: 9px 12px;
    gap: 10px;
  }

  .avatar-wrap,
  .avatar-wrap img {
    width: 32px;
    height: 32px;
  }

  .post-author {
    gap: 2px;
  }

  .username {
    font-size: 14px;
    line-height: 1.15;
    font-weight: 700;
  }

  .post-author span {
    font-size: 12px;
    line-height: 1.2;
  }

  .actions {
    padding: 10px 12px 0;
  }

  .left-actions {
    gap: 18px;
  }

  .action-item {
    font-size: 14px;
    line-height: 1.2;
  }

  .action-item .icon,
  .like-btn svg {
    width: 26px;
    height: 26px;
  }

  .meta {
    padding: 8px 12px 0;
    font-size: 13px;
    line-height: 1.35;
  }

  .caption {
    padding: 3px 12px 18px;
    font-size: 14px;
    line-height: 1.42;
  }

  .caption b {
    font-weight: 700;
  }

  .caption span {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.25;
    color: var(--muted);
  }
}

@media (max-width: 768px) {
  .profile,
  .profile-message,
  .post-container {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .post-page {
    width: 100%;
  }

  .close-btn {
    right: max(12px, env(safe-area-inset-right));
  }

  .post-container {
    min-height: 0;
  }

  .post-image-wrap {
    min-height: 0;
    max-height: none;
    display: flex;
    align-items: center;
  }

  .post-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
  }
}

@media (min-width: 769px) {
  .home {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 18px 16px 32px;
  }

  .home-banner {
    display: grid;
  }

  .feed {
    max-width: 520px;
    width: 100%;
    margin: auto;
  }

  .post {
    width: auto;
    margin-bottom: 24px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 14px;
  }

  body:not(.light) .post {
    border-left-color: #3a3a3f;
    border-right-color: #3a3a3f;
  }

  .post-image {
    aspect-ratio: 4 / 5;
  }
}

/* Force the site to behave like a phone app even in desktop browsers */
html {
  background: #050505;
}

body {
  min-height: 100vh;
}

.header,
.profile,
.profile-message {
  width: min(100%, 430px);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.header {
  padding: 8px 12px;
}

.logo {
  width: 240px;
  height: 64px;
}

.home {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  padding: 12px 0 28px;
}

.home-banner {
  display: none;
}

.feed {
  max-width: none;
  width: 100%;
}

.post {
  width: 100%;
  margin: 0 0 14px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.post-header {
  min-height: 46px;
  padding: 10px 12px;
  box-sizing: border-box;
}

.post-image {
  aspect-ratio: 1 / 1;
  background: #000;
}

.post-image img {
  object-fit: cover;
}

.username,
.caption,
.meta,
.action-item,
.post-author span {
  font-size: 14px;
}

.caption {
  padding-bottom: 16px;
  line-height: 1.45;
}

.caption span {
  margin-top: 12px;
  font-size: 12px;
}

.actions {
  padding: 12px 12px 0;
}

.left-actions {
  gap: 16px;
}

.profile {
  padding: 16px 10px 34px;
}

.profile-top {
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.profile-avatar {
  width: 84px;
  height: 84px;
}

.profile-info {
  gap: 12px;
}

.profile-username {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.profile-stats {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.profile-stat {
  padding: 8px 3px;
}

.profile-stat b {
  font-size: 15px;
}

.profile-stat span {
  font-size: 11px;
  line-height: 1.15;
}

.profile-bio {
  margin-top: 14px;
  font-size: 14px;
}

.profile-divider {
  margin: 20px 0 3px;
}

.profile-grid {
  gap: 2px;
  margin-left: -10px;
  margin-right: -10px;
}

.grid-item {
  border-radius: 0;
}

.profile-archive-note {
  margin-top: 18px;
  padding: 0 8px;
  font-size: 13px;
}

.post-page {
  position: fixed;
  inset: 0;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  background: #000;
  -webkit-overflow-scrolling: touch;
}

.post-container {
  min-height: 100svh;
  width: min(100%, 430px);
  max-width: none;
  height: auto;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: visible;
  background: var(--bg);
}

.post-image-wrap {
  width: 100%;
  min-height: 58svh;
  max-height: 68svh;
  flex: 0 0 auto;
  background: #000;
}

.post-image-wrap img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 68svh;
  object-fit: contain;
}

.post-image-wrap .nav {
  width: 38px;
  height: 38px;
  font-size: 23px;
}

.post-image-wrap .prev {
  left: 8px;
}

.post-image-wrap .next {
  right: 8px;
}

.close-btn {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  font-size: 30px;
  line-height: 1;
}

.post-info {
  width: 100%;
  min-height: 0;
  flex: 0 0 auto;
  border-left: 0;
  border-top: 1px solid var(--border);
}

.post-description {
  margin-top: 0;
  padding: 15px 14px;
}

.caption-name {
  font-size: 15px;
}

.caption-text {
  font-size: 15px;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.post-meta {
  padding: 12px 14px;
}

.meta-row {
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
}

.meta-item .icon {
  width: 20px;
  height: 20px;
}

.post-comments {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  padding: 14px;
}

.comment {
  gap: 10px;
  margin-bottom: 16px;
}

.comment-avatar {
  width: 34px;
  height: 34px;
}

.comment-username,
.comment-text {
  font-size: 14px;
}

.comment-text {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

@media (max-width: 380px) {
  .logo {
    width: 205px;
    height: 55px;
  }

  .profile-top {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
  }

  .profile-avatar {
    width: 76px;
    height: 76px;
  }

  .profile-stat span {
    font-size: 10px;
  }
}

@media (min-width: 769px) {
  .home {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 18px 16px 32px;
  }

  .home-banner {
    display: grid;
  }

  .feed {
    max-width: 520px;
    width: 100%;
    margin: auto;
  }

  .post {
    width: auto;
    margin-bottom: 24px;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 14px;
  }

  body:not(.light) .post {
    border-left-color: #3a3a3f;
    border-right-color: #3a3a3f;
  }

  .post-image {
    aspect-ratio: 4 / 5;
  }
}

@media (max-width: 1100px), (hover: none), (pointer: coarse) {
  .home {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding: 12px 0 28px;
  }

  .home-banner {
    display: none;
  }

  .feed {
    max-width: none;
    width: 100%;
    margin: 0;
  }

  .post {
    width: 100%;
    margin: 0 0 14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .post-header {
    min-height: 58px;
    padding: 10px 14px;
    gap: 11px;
  }

  .avatar-wrap,
  .avatar-wrap img {
    width: 36px;
    height: 36px;
  }

  .post-author {
    gap: 2px;
  }

  .username {
    font-size: 15px;
    line-height: 1.15;
    font-weight: 700;
  }

  .post-author span {
    font-size: 13px;
    line-height: 1.2;
  }

  .post-image {
    aspect-ratio: 1 / 1;
  }

  .actions {
    padding: 12px 14px 0;
  }

  .left-actions {
    gap: 20px;
  }

  .action-item {
    font-size: 15px;
    line-height: 1.2;
  }

  .action-item .icon,
  .like-btn svg {
    width: 30px;
    height: 30px;
  }

  .meta {
    padding: 9px 14px 0;
    font-size: 15px;
    line-height: 1.35;
  }

  .caption {
    padding: 4px 14px 20px;
    font-size: 15px;
    line-height: 1.42;
  }

  .caption b {
    font-weight: 700;
  }

  .caption span {
    display: block;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.25;
    color: var(--muted);
  }
}
@media (max-width: 1200px), (hover: none), (pointer: coarse) {
  .profile,
  .profile-message {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .profile {
    padding: 18px 16px 36px !important;
  }

  .profile-top {
    grid-template-columns: 112px minmax(0, 1fr) !important;
    gap: 20px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 112px !important;
    height: 112px !important;
  }

  .profile-username {
    font-size: 26px !important;
    line-height: 1.15 !important;
    font-weight: 700 !important;
  }

  .profile-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 9px !important;
    max-width: none !important;
  }

  .profile-stat {
    padding: 13px 7px !important;
  }

  .profile-stat b {
    font-size: 22px !important;
    line-height: 1.1 !important;
  }

  .profile-stat span {
    font-size: 15px !important;
    line-height: 1.15 !important;
  }

  .profile-bio {
    margin-top: 20px !important;
    font-size: 19px !important;
    line-height: 1.45 !important;
  }

  .profile-divider {
    margin: 24px 0 6px !important;
  }

  .profile-grid {
    width: calc(100% + 32px) !important;
    margin-left: -16px !important;
    margin-right: -16px !important;
    gap: 3px !important;
  }

  .profile-archive-note {
    margin-top: 22px !important;
    padding: 0 16px !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  .profile-private {
    padding: 34px 18px !important;
  }

  .profile-private h3 {
    font-size: 26px !important;
    line-height: 1.2 !important;
  }

  .profile-private p {
    font-size: 19px !important;
    line-height: 1.35 !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .post-page {
    display: block !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    background: #000 !important;
  }

  .post-container {
    width: 100% !important;
    max-width: none !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    border-radius: 0 !important;
    overflow: visible !important;
    background: var(--bg) !important;
  }

  .post-image-wrap {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    flex: 0 0 auto !important;
    display: block !important;
    line-height: 0 !important;
    background: #000 !important;
  }

  .post-image-wrap img {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
  }

  .post-info {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 0 auto !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border) !important;
    background: var(--card) !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .username,
  #postUsername,
  .caption-name {
    font-size: 35px !important;
    line-height: 1.12 !important;
  }

  .post-author span,
  .caption span {
    font-size: 30px !important;
    line-height: 1.18 !important;
  }

  .action-item,
  .meta,
  .caption {
    font-size: 35px !important;
    line-height: 1.32 !important;
  }

  .caption-text,
  .meta-row,
  .comment-username,
  .comment-text {
    font-size: 33px !important;
    line-height: 1.34 !important;
  }

  .profile-username,
  .profile-private h3 {
    font-size: 58px !important;
    line-height: 1.05 !important;
  }

  .profile-stat b {
    font-size: 50px !important;
    line-height: 1 !important;
  }

  .profile-stat span {
    font-size: 34px !important;
    line-height: 1.08 !important;
  }

  .profile-bio,
  .profile-archive-note,
  .profile-private p {
    font-size: 43px !important;
    line-height: 1.22 !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .post-image-wrap .nav {
    width: 96px !important;
    height: 96px !important;
    min-width: 96px !important;
    min-height: 96px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.42) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #fff !important;
    font-size: 58px !important;
    line-height: 1 !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 8 !important;
  }

  .post-image-wrap .prev {
    left: 18px !important;
  }

  .post-image-wrap .next {
    right: 18px !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  .profile {
    padding: 18px 14px 36px !important;
    overflow-x: hidden !important;
  }

  .profile-top {
    display: grid !important;
    grid-template-columns: 132px minmax(0, 1fr) !important;
    gap: 18px !important;
    align-items: center !important;
  }

  .profile-avatar {
    width: 132px !important;
    height: 132px !important;
  }

  .profile-info {
    min-width: 0 !important;
    gap: 14px !important;
  }

  .profile-username {
    font-size: 44px !important;
    line-height: 1.08 !important;
    overflow-wrap: anywhere !important;
  }

  .profile-stats {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .profile-stat {
    min-width: 0 !important;
    padding: 12px 4px !important;
    overflow: hidden !important;
  }

  .profile-stat b {
    display: block !important;
    font-size: 28px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
  }

  .profile-stat span {
    display: block !important;
    margin-top: 5px !important;
    font-size: 15px !important;
    line-height: 1.12 !important;
    white-space: nowrap !important;
  }

  .profile-bio {
    font-size: 36px !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere !important;
  }
}

@media (max-width: 768px), (hover: none), (pointer: coarse) {
  #postUsername,
  .caption-name {
    font-size: 22px !important;
    line-height: 1.2 !important;
  }

  .caption-text {
    font-size: 20px !important;
    line-height: 1.42 !important;
  }

  .meta-row,
  .comment-username,
  .comment-text {
    font-size: 18px !important;
    line-height: 1.35 !important;
  }

  .post-info .post-header {
    padding: 14px 16px !important;
    gap: 12px !important;
  }

  .post-avatar,
  .comment-avatar {
    width: 34px !important;
    height: 34px !important;
  }

  .post-description {
    padding: 16px !important;
  }

  .post-meta {
    padding: 12px 16px !important;
  }

  .post-comments {
    padding: 14px 16px !important;
  }

  .post-image-wrap .nav {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    min-height: 64px !important;
    font-size: 38px !important;
    background: rgba(0, 0, 0, 0.34) !important;
    border-color: rgba(255, 255, 255, 0.16) !important;
  }

  .post-image-wrap .prev {
    left: 12px !important;
  }

  .post-image-wrap .next {
    right: 12px !important;
  }

  .close-btn {
    width: 44px !important;
    height: 44px !important;
    font-size: 32px !important;
  }
}
