:root {
  --bg: #070910;
  --panel: #101522;
  --panel2: #151b2b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f7f8fb;
  --muted: #aeb6c5;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
  --green: #20d7a4;
  --blue: #3ea6ff;
  --violet: #9d6cff;
  --pink: #ff5fa2;
  --orange: #ff9f43;
  --yellow: #ffd34d;
  --cyan: #44d7e8;
  --red: #ff5d69;
}
html[data-theme="light"] {
  --bg: #f2f5f9;
  --panel: #fff;
  --panel2: #f6f8fb;
  --line: rgba(20, 31, 50, 0.14);
  --text: #242629;
  --muted: #45494f;
  --shadow: 0 12px 32px rgba(31, 45, 69, 0.08);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(
      circle at 50% -20%,
      rgba(74, 94, 255, 0.09),
      transparent 32%
    ),
    var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  font-weight: 500;
  transition:
    background 0.2s,
    color 0.2s;
}
html[data-theme="light"] body,
html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] button {
  color: #242629;
}
html[data-theme="light"] .post-text,
html[data-theme="light"] .comment-body,
html[data-theme="light"] .side-card > a,
html[data-theme="light"] .person-card,
html[data-theme="light"] .story-tile,
html[data-theme="light"] .post-actions button {
  font-weight: 600;
}
html[data-theme="light"] small,
html[data-theme="light"] .muted,
html[data-theme="light"] .post-meta small,
html[data-theme="light"] .post-stats,
html[data-theme="light"] .empty {
  color: #45494f;
}
.home-top {
  position: fixed;
  top: 0;
  inset-inline: 0;
  width: 100%;
  z-index: 1000;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.home-nav {
  max-width: 1540px;
  margin: auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.home-brand {
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.home-search {
  flex: 1;
  max-width: 520px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  outline: 0;
}
.home-search:focus {
  border-color: rgba(62, 166, 255, 0.55);
}
.top-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 7px;
  direction: ltr;
}
.top-actions a,
.top-actions button {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-size: 17px;
  transition:
    transform 0.16s,
    filter 0.16s;
}
.top-actions a:hover,
.top-actions button:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
.action-reels {
  background: linear-gradient(135deg, #ff477e, #8a5cff);
}
.action-chat {
  background: linear-gradient(135deg, #925dff, #d45cff);
}
.action-mail {
  background: linear-gradient(135deg, #198cff, #3bb6ff);
}
.action-call {
  background: linear-gradient(135deg, #16c7a3, #1fd58f);
}
.action-friends {
  background: linear-gradient(135deg, #ffad33, #ffd34d);
}
.action-settings {
  background: linear-gradient(135deg, #65758b, #9aa6b6);
}
.action-theme {
  background: linear-gradient(135deg, #ffb347, #7d68ff);
}
.action-logout {
  background: linear-gradient(135deg, #ff5d69, #d93f53);
}
.home-grid {
  max-width: 1540px;
  margin: 80px auto 18px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  grid-template-areas: "ads feed menu";
  gap: 18px;
  align-items: start;
}
.left-side {
  grid-area: menu;
}
.feed {
  grid-area: feed;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.right-side {
  grid-area: ads;
}
.side-card,
.compact-panel,
.composer,
.post-card,
.paid-ads {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.side-card {
  padding: 12px;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 94px);
  overflow: auto;
}
.side-card > a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 12px;
  color: var(--text);
  text-decoration: none;
  border-radius: 12px;
  font-size: 14px;
}
.side-card > a:hover {
  background: var(--panel2);
}
.right-side {
  position: sticky;
  top: 78px;
  display: grid;
  gap: 12px;
}
.compact-panel {
  padding: 13px;
  overflow: hidden;
}
.people-head,
.section-head,
.paid-ads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.people-head h3,
.section-head h3,
.paid-ads-head h3 {
  margin: 0;
  font-size: 15px;
}
.people-head a,
.section-head a {
  color: var(--cyan);
  text-decoration: none;
  font-size: 12px;
}
.people-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 9px 2px 3px;
}
.person-card {
  flex: 0 0 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.person-card .avatar {
  width: 50px;
  height: 50px;
}
.person-card span:last-child {
  width: 100%;
  text-align: center;
  min-width: 0;
}
.person-card strong {
  display: block;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-card small {
  display: none;
}
.stories-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 10px;
}
.stories-list {
  display: flex;
  gap: 10px;
}
.story-tile {
  position: relative;
  flex: 0 0 82px;
  min-height: 102px;
  border-radius: 17px;
  background: var(--panel2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
}
.story-avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff7a45, #ff4f91);
  font-weight: 900;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.75);
}
.story-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story-plus {
  position: absolute;
  bottom: 26px;
  right: 11px;
  background: linear-gradient(135deg, #198cff, #8a5cff);
  color: #fff;
  border: 2px solid var(--panel);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.story-tile strong {
  font-size: 11px;
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reels-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 10px;
}
.reel-card {
  position: relative;
  flex: 0 0 122px;
  height: 176px;
  border-radius: 18px;
  overflow: hidden;
  background: #05070b;
  border: 1px solid var(--line);
  color: #fff;
  text-decoration: none;
}
.reel-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #05070b;
}
.reel-card:after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 52%;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  pointer-events: none;
}
.reel-meta {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  right: 8px;
  left: 8px;
  font-size: 11px;
}
.reel-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer {
  padding: 15px;
}
.composer-top {
  display: flex;
  gap: 10px;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3ea6ff, #9d6cff);
  display: grid;
  place-items: center;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.composer textarea {
  flex: 1;
  min-height: 78px;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  resize: vertical;
  outline: 0;
}
.composer-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tool-btn {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 11px;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
}
.tool-photo {
  color: #ff8d3a;
}
.tool-video {
  color: #ff557d;
}
.tool-audio {
  color: #9d6cff;
}
.tool-reel {
  color: #3ea6ff;
}
.publish {
  margin-inline-start: auto;
  color: #fff;
  background: linear-gradient(135deg, #198cff, #8a5cff);
  border: 0;
}
.post-card {
  overflow: hidden;
}
.post-head {
  padding: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.post-head a {
  color: var(--text);
  text-decoration: none;
}
.post-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.post-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-meta small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-text {
  padding: 0 16px 14px;
  line-height: 1.9;
  white-space: pre-wrap;
}
.post-media img,
.post-media video {
  display: block;
  width: 100%;
  max-height: 80vh;
  object-fit: contain;
  background: #05070b;
}
.post-media audio {
  display: block;
  width: calc(100% - 28px);
  margin: 14px;
}
.post-stats {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 9px 18px;
  padding: 10px 15px;
  color: var(--muted);
}
.post-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.post-actions button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 12px;
  cursor: pointer;
  font-weight: 700;
}
.post-actions .post-like.is-active { color: var(--pink); }
.comments {
  padding: 12px;
}
.comment {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.comment-body {
  background: var(--panel2);
  border-radius: 12px;
  padding: 8px 10px;
  flex: 1;
}
.comment-body p {
  margin: 4px 0;
}
.comment-form {
  display: flex;
  gap: 7px;
}
.comment-form input {
  flex: 1;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 10px;
}
.comment-form button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #198cff, #8a5cff);
  color: #fff;
  padding: 0 14px;
}
.paid-ads {
  padding: 14px;
}
.paid-label {
  font-size: 11px;
  color: var(--orange);
}
.paid-ad-stage {
  margin-top: 10px;
  min-height: 250px;
  background: var(--panel2);
  border-radius: 15px;
}
.paid-ad-slide {
  padding: 18px;
}
.paid-ad-slide .ad-icon {
  font-size: 48px;
}
.paid-ad-slide a {
  display: block;
  background: linear-gradient(135deg, #ff9f43, #ff5d69);
  color: #fff;
  text-align: center;
  text-decoration: none;
  padding: 9px;
  border-radius: 10px;
}
.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}
.inline-empty {
  padding: 22px 12px;
}
.upload-progress {
  position: fixed;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 12px;
  color: var(--text);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.upload-progress-bar {
  width: 140px;
  height: 6px;
  background: var(--panel2);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #198cff, #8a5cff, #ff5fa2);
  width: 0%;
}
.mobile-bar {
  display: none;
}
@media (max-width: 1100px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr) 270px;
    grid-template-areas: "feed menu";
  }
  .right-side {
    display: none;
  }
}
@media (max-width: 760px) {
  .home-nav {
    padding: 8px;
  }
  .home-brand {
    font-size: 15px;
  }
  .home-search {
    display: none;
  }
  .top-actions {
    gap: 5px;
  }
  .top-actions a,
  .top-actions button {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }
  .top-actions a:nth-child(n + 5) {
    display: none;
  }
  .home-grid {
    display: block;
    margin: 8px auto;
    padding: 0 7px 74px;
  }
  .left-side,
  .right-side {
    display: none;
  }
  .feed {
    gap: 8px;
  }
  .compact-panel,
  .composer,
  .post-card {
    border-radius: 15px;
  }
  .person-card {
    flex-basis: 76px;
  }
  .story-tile {
    flex-basis: 76px;
    min-height: 96px;
  }
  .reel-card {
    flex-basis: 112px;
    height: 162px;
  }
  .tool-btn span {
    display: none;
  }
  .composer {
    padding: 12px;
  }
  .post-media img,
  .post-media video {
    max-height: 72vh;
  }
  .mobile-bar {
    display: grid;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    grid-template-columns: repeat(5, 1fr);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .mobile-bar a {
    padding: 9px 2px;
    color: var(--text);
    text-decoration: none;
    text-align: center;
    font-size: 11px;
  }
  .mobile-bar b {
    display: block;
    font-size: 18px;
  }
  .post-actions button {
    font-size: 12px;
    padding: 11px 4px;
  }
}

/* Post details and natural mobile media sizing. */
.post-card[data-post-id] {
  cursor: pointer;
  touch-action: pan-y;
}
.post-card[data-post-id] :is(button, a, input, textarea, select, video, audio) {
  cursor: auto;
  touch-action: manipulation;
}
.post-media {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  line-height: 0;
}
.post-video {
  display: grid;
  place-items: center;
  background: #05070b;
}
.post-video video {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: min(66svh, 620px) !important;
  aspect-ratio: var(--video-ratio, auto);
  object-fit: contain !important;
  background: #05070b !important;
}
.post-video video.is-portrait {
  width: min(100%, 420px) !important;
  height: auto !important;
  max-height: min(62svh, 580px) !important;
}
@media (max-width: 760px) {
  .post-video video { max-height: min(58svh, 520px) !important; }
  .post-video video.is-portrait { width: min(78vw, 360px) !important; max-height: min(56svh, 500px) !important; }
  .post-stats { font-size: 12px; gap: 7px 12px; }
  .post-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .post-actions button { white-space: nowrap; }
}
.post-image img {
  height: auto !important;
}
.post-audio {
  line-height: normal;
  background: transparent;
}
.post-detail-close {
  display: none;
  position: sticky;
  z-index: 4;
  top: 8px;
  float: left;
  margin: 8px 8px -50px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--text);
  font-size: 27px;
  line-height: 1;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.post-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(7px);
}
.post-card.is-post-open {
  position: fixed !important;
  z-index: 9991;
  inset: 4svh max(12px, calc((100vw - 760px) / 2));
  width: auto !important;
  max-width: 760px !important;
  max-height: 92svh;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 22px !important;
  cursor: default;
  overscroll-behavior: contain;
}
.post-card.is-post-open .post-detail-close {
  display: grid;
  place-items: center;
}
.post-card.is-post-open .comments {
  display: block;
}
body.post-detail-active {
  overflow: hidden;
}
@media (max-width: 760px) {
  .post-video video {
    max-height: min(58svh, 520px) !important;
  }
  .post-video video.is-portrait {
    width: min(78vw, 360px) !important;
    height: auto !important;
    max-width: 78vw !important;
    max-height: min(56svh, 500px) !important;
  }
  .post-card.is-post-open {
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    max-height: 100svh !important;
    border: 0 !important;
    border-radius: 0 !important;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .post-card.is-post-open .post-detail-close {
    top: calc(8px + env(safe-area-inset-top));
  }
}
