:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #737373;
  --line: #dbdbdb;
  --soft: #f5f5f5;
  --accent: #0095f6;
  --danger: #ed4956;
  --story: linear-gradient(45deg, #f9ce34, #ee2a7b 48%, #6228d7);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  border-right: 1px solid var(--line);
  padding: 28px 12px 20px;
  display: flex;
  flex-direction: column;
  background: #fff;
  z-index: 10;
}

.brand {
  color: var(--text);
  text-decoration: none;
  padding: 0 12px 27px;
  display: block;
}

.brand-script {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  height: 50px;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 16px;
  text-align: left;
}

.nav-item:hover, .nav-item.active {
  background: var(--soft);
}

.nav-item.active span:not(.avatar) {
  font-weight: 700;
}

.nav-item svg, .icon-button svg, .mobile-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.9;
}

.more {
  margin-top: auto;
}

.main {
  margin-left: 244px;
  min-height: 100vh;
}

.view {
  display: none;
  min-height: 100vh;
  padding: 30px 24px 70px;
}

.view.active {
  display: block;
}

.content-grid {
  width: min(100%, 1030px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 630px) 320px;
  gap: 46px;
}

.feed-column {
  min-width: 0;
}

.stories-strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px 0 22px;
  scrollbar-width: none;
}

.story {
  width: 74px;
  flex: 0 0 auto;
  text-align: center;
}

.story button {
  display: grid;
  gap: 6px;
  justify-items: center;
  width: 100%;
}

.story-ring, .avatar {
  background: var(--story);
  border-radius: 50%;
  padding: 2px;
  display: inline-grid;
  place-items: center;
}

.story-ring img, .avatar::after {
  width: 60px;
  height: 60px;
  border: 2px solid white;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  content: "";
  background: #fff url("assets/profile/jasif-dp.jpeg") center 18%/78% auto no-repeat;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.story span {
  width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.post {
  border-bottom: 1px solid var(--line);
  margin: 0 auto 18px;
  padding-bottom: 18px;
  max-width: 470px;
}

.post-header, .post-actions, .profile-row, .suggestion {
  display: flex;
  align-items: center;
}

.post-header {
  gap: 10px;
  height: 48px;
}

.post-header div {
  display: grid;
  gap: 1px;
}

.post-header strong {
  font-size: 14px;
}

.post-header span {
  color: var(--muted);
  font-size: 14px;
}

.post-header button {
  margin-left: auto;
}

.avatar.tiny::after {
  width: 24px;
  height: 24px;
}

.avatar.small::after {
  width: 32px;
  height: 32px;
}

.avatar.large::after {
  width: 44px;
  height: 44px;
}

.avatar.profile-avatar::after {
  width: 150px;
  height: 150px;
}

.profile-avatar {
  pointer-events: none;
}

.media-frame {
  width: 100%;
  aspect-ratio: 1 / 1.12;
  background: #0c0c0c;
  border: 1px solid var(--line);
  overflow: hidden;
}

.carousel {
  position: relative;
}

.post .carousel {
  margin-bottom: 16px;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.86);
  color: #111;
  transform: translateY(-50%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
  z-index: 2;
}

.carousel-arrow.left {
  left: 10px;
}

.carousel-arrow.right {
  right: 10px;
}

.carousel-count {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  color: white;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 2;
}

.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -29px;
  height: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.carousel-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c7c7c7;
}

.carousel-dots .active {
  background: var(--accent);
}

.media-frame img, .media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-actions {
  height: 46px;
  gap: 14px;
}

.post-actions button:last-child {
  margin-left: auto;
}

.liked svg {
  fill: var(--danger);
  stroke: var(--danger);
}

.likes, .caption, .comments, .place-tag {
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 6px;
}

.place-tag {
  color: var(--muted);
}

.caption strong {
  margin-right: 5px;
}

.comments, .time {
  color: var(--muted);
}

.time {
  font-size: 11px;
  text-transform: uppercase;
}

.right-rail {
  padding-top: 26px;
  display: grid;
  align-content: start;
  gap: 18px;
}

.profile-row {
  gap: 12px;
}

.profile-row div, .suggestion div {
  display: grid;
  gap: 2px;
  flex: 1;
}

.profile-row span, .suggestion span {
  color: var(--muted);
  font-size: 14px;
}

.profile-row button, .rail-heading button, .suggestion button, .share-button {
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.rail-heading {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
}

.suggestions {
  display: grid;
  gap: 14px;
}

.suggestion {
  gap: 10px;
}

.suggestion-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

footer {
  color: #c7c7c7;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 18px;
}

.panel {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px 0;
}

.panel.narrow {
  width: min(100%, 620px);
}

h1 {
  margin: 0 0 24px;
  font-size: 24px;
  letter-spacing: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  background: #efefef;
  border-radius: 8px;
  padding: 0 14px;
}

.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
}

.search-results, #activityList {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.result-row, .activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.result-row img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
}

.explore-header {
  width: min(100%, 940px);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.primary, .ghost {
  height: 34px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-button {
  height: 34px;
  border-radius: 8px;
  padding: 0 14px;
  background: #25d366;
  color: white;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.whatsapp-button svg {
  width: 18px;
  height: 18px;
}

.ghost {
  background: #efefef;
  color: var(--text);
}

.explore-grid, .profile-grid {
  width: min(100%, 940px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  background: #111;
  overflow: hidden;
}

.tile.wide {
  grid-row: span 2;
  aspect-ratio: auto;
}

.tile img, .tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-title {
  position: absolute;
  left: 9px;
  bottom: 8px;
  color: white;
  font-weight: 800;
  font-size: 13px;
  text-shadow: 0 1px 4px rgba(0,0,0,.55);
  z-index: 1;
}

.pinned-label {
  position: absolute;
  left: 10px;
  top: 10px;
  height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.58);
  color: white;
  font-size: 12px;
  font-weight: 800;
  z-index: 2;
}

.pinned-label svg {
  width: 14px;
  height: 14px;
}

.tile::after {
  content: attr(data-kind);
  position: absolute;
  right: 8px;
  top: 8px;
  color: white;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,.45);
}

.tile:hover .tile-overlay {
  opacity: 1;
}

.tile-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: rgba(0,0,0,.35);
  color: white;
  font-weight: 800;
  opacity: 0;
  transition: opacity .18s ease;
}

.reels-stack {
  height: calc(100vh - 60px);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  display: grid;
  gap: 18px;
  justify-content: center;
  scrollbar-width: none;
}

.reel-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  height: calc(100vh - 92px);
  min-height: 590px;
  border-radius: 8px;
  overflow: hidden;
  background: #070707;
  scroll-snap-align: start;
}

.reel-card img, .reel-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reel-info {
  position: absolute;
  left: 16px;
  right: 78px;
  bottom: 18px;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,.45);
}

.reel-info p {
  margin: 8px 0 0;
}

.reel-actions {
  position: absolute;
  right: 14px;
  bottom: 24px;
  display: grid;
  gap: 18px;
  color: white;
}

.reel-actions button {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 12px;
}

.empty-state {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-state svg {
  width: 72px;
  height: 72px;
  color: var(--text);
}

.profile-header {
  width: min(100%, 940px);
  margin: 0 auto 36px;
  display: flex;
  gap: 72px;
  align-items: center;
  padding: 0 34px;
}

.profile-meta {
  flex: 1;
}

.profile-meta a {
  color: #00376b;
  font-weight: 700;
  text-decoration: none;
}

.profile-title, .stats, .profile-tabs {
  display: flex;
  align-items: center;
}

.profile-title {
  gap: 10px;
  margin-bottom: 22px;
}

.profile-title h1 {
  margin: 0 10px 0 0;
  font-size: 20px;
  font-weight: 500;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
}

.icon-button:hover {
  background: var(--soft);
}

.stats {
  gap: 36px;
  margin-bottom: 20px;
}

.profile-tabs {
  width: min(100%, 940px);
  margin: 0 auto;
  justify-content: center;
  border-top: 1px solid var(--line);
}

.profile-tabs button {
  height: 52px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: .4px;
}

.profile-tabs .active {
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--text);
}

.upload-modal, .viewer-modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.upload-modal::backdrop, .viewer-modal::backdrop {
  background: rgba(0,0,0,.62);
}

.modal-card {
  width: min(92vw, 900px);
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.modal-card header {
  height: 44px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 44px 1fr 70px;
  align-items: center;
  text-align: center;
}

.upload-body {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  min-height: 520px;
}

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  border-right: 1px solid var(--line);
  cursor: pointer;
  color: var(--muted);
}

.drop-zone svg {
  width: 80px;
  height: 80px;
  color: var(--text);
}

.drop-zone input {
  display: none;
}

.composer {
  display: grid;
  grid-template-rows: auto 1fr auto 170px;
}

.place-input {
  height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  outline: 0;
}

.composer textarea {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  resize: none;
  outline: 0;
}

.composer label {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
}

.composer select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: white;
}

.preview {
  background: #fafafa;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  overflow: hidden;
}

.preview img, .preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer-modal {
  width: min(96vw, 980px);
}

.viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: white;
  z-index: 3;
}

.viewer-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  background: white;
  min-height: min(82vh, 760px);
}

.viewer-media {
  position: relative;
  background: #050505;
  display: grid;
  place-items: center;
}

.viewer-media img, .viewer-media video {
  width: 100%;
  height: 100%;
  max-height: 82vh;
  object-fit: contain;
}

.viewer-side {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 520px;
}

.viewer-side header, .viewer-side footer {
  color: var(--text);
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.viewer-side footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.viewer-caption {
  padding: 18px 14px;
  font-size: 14px;
  line-height: 1.55;
}

.story-viewer {
  position: relative;
  width: min(430px, 92vw);
  height: min(82vh, 760px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #050505;
  box-shadow: var(--shadow);
}

.story-viewer img, .story-viewer video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-bars {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  z-index: 2;
}

.story-bars span {
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
}

.story-bars .active {
  background: white;
}

.story-caption {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 16px;
  color: white;
  display: grid;
  gap: 4px;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.54);
  z-index: 2;
}

.story-caption span {
  font-size: 14px;
}

.story-tap {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 1;
}

.story-tap.left {
  left: 0;
}

.story-tap.right {
  right: 0;
}

.mobile-nav {
  display: none;
}

@media (max-width: 1130px) {
  .sidebar {
    width: 76px;
  }

  .brand-script, .nav-item span:not(.avatar) {
    display: none;
  }

  .main {
    margin-left: 76px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 630px);
    justify-content: center;
  }

  .right-rail {
    display: none;
  }
}

@media (max-width: 760px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  .view {
    padding: 16px 0 74px;
  }

  .content-grid {
    display: block;
    width: 100%;
  }

  .stories-strip {
    padding: 4px 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .post {
    max-width: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
  }

  .post-header, .post-actions, .caption, .likes, .comments, .place-tag, .time {
    padding-left: 12px;
    padding-right: 12px;
  }

  .media-frame {
    border-left: 0;
    border-right: 0;
  }

  .explore-header, .panel {
    padding-left: 14px;
    padding-right: 14px;
  }

  .explore-grid, .profile-grid {
    gap: 2px;
  }

  .profile-header {
    gap: 24px;
    padding: 0 14px;
    align-items: flex-start;
  }

  .avatar.profile-avatar::after {
    width: 78px;
    height: 78px;
  }

  .profile-title {
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .stats {
    gap: 16px;
    font-size: 14px;
  }

  .profile-tabs button {
    flex: 1;
    justify-content: center;
    padding: 0 4px;
  }

  .mobile-nav {
    position: fixed;
    inset: auto 0 0 0;
    height: 52px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    background: white;
    border-top: 1px solid var(--line);
    z-index: 10;
  }

  .mobile-item {
    height: 52px;
    display: grid;
    place-items: center;
  }

  .upload-body, .viewer-content {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .viewer-side {
    min-height: 240px;
  }
}
