:root {
  --bg: #000000;
  --surface: #262626;
  --surface-soft: #1a1a1a;
  --border: #262626;
  --text-primary: #f5f5f5;
  --text-secondary: #a8a8a8;
  --blue: #0095f6;
  --blue-soft: #4c7cf3;
  --red: #ff3040;
  --bubble-me: linear-gradient(135deg, #6f30e6 0%, #8b3dff 100%);
  --bubble-them: #262626;
  --story-grad: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background: #0b0b0b;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  user-select: none;
}

#app-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}

@media (min-width: 500px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #1b1b22 0%, #070709 70%);
  }
  #app-shell {
    height: min(92dvh, 860px);
    border-radius: 28px;
    border: 1px solid #26262a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  }
}

button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* ==================== SCREENS ==================== */
.screen {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 2;
}

.slide-screen {
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10;
}

.slide-screen.open {
  transform: translateX(0);
  pointer-events: auto;
}

#chat-screen {
  z-index: 20;
}

/* ==================== 1. SPLASH SCREEN ==================== */
#splash-screen {
  z-index: 50;
  justify-content: space-between;
  align-items: center;
  padding: 36px 20px calc(28px + env(safe-area-inset-bottom));
}

.splash-center {
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.splash-logo-wrap {
  width: 82px;
  height: 82px;
  animation: splashPulse 1.4s ease-in-out infinite alternate;
}

.splash-ig-icon {
  width: 100%;
  height: 100%;
}

.splash-loader {
  display: flex;
  gap: 6px;
}

.splash-loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #555;
  animation: dotBounce 1s infinite ease-in-out;
}

.splash-loader span:nth-child(2) { animation-delay: 0.15s; }
.splash-loader span:nth-child(3) { animation-delay: 0.3s; }

.splash-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.splash-from {
  font-size: 12px;
  color: var(--text-secondary);
}

.splash-meta {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: var(--story-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes splashPulse {
  from { transform: scale(0.96); opacity: 0.9; }
  to { transform: scale(1.03); opacity: 1; }
}

@keyframes dotBounce {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.15); background: #d62976; }
}

/* ==================== TOP BAR & ICONS ==================== */
.top-bar, .dm-header, .chat-header, .profile-top-bar {
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  flex-shrink: 0;
}

.insta-wordmark {
  font-family: "Grand Hotel", "Segoe Script", "Brush Script MT", cursive;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.3px;
  color: #fff;
  padding-top: 2px;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  position: relative;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.red-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid var(--bg);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==================== SCROLLABLE BODY & TABS ==================== */
.tab-view {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.tab-view.active {
  display: flex;
}

.scroll-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}

.scroll-content::-webkit-scrollbar {
  display: none;
}

/* ==================== STORIES BAR ==================== */
.stories-bar {
  display: flex;
  gap: 14px;
  padding: 10px 14px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid #161616;
}

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

.story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  flex-shrink: 0;
  cursor: pointer;
}

.story-ring {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--story-grad);
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-ring.seen {
  background: #3a3a3a;
}

.story-ring.no-ring {
  background: transparent;
  padding: 0;
}

.story-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
}

.story-ring.no-ring img {
  border: none;
}

.story-plus-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #000;
  border: 2px solid #fff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.story-label {
  font-size: 11.5px;
  color: var(--text-primary);
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-item.your-story .story-label {
  color: var(--text-secondary);
}

/* ==================== FEED POSTS (IMAGE-ONLY) ==================== */
.post-card {
  padding-bottom: 14px;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
}

.post-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.post-avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 2px;
  background: var(--story-grad);
  flex-shrink: 0;
}

.post-avatar-ring.no-ring {
  padding: 0;
  background: transparent;
}

.post-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg);
}

.post-avatar-ring.no-ring img {
  border: none;
}

.post-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.post-username {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

.post-subtitle {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.post-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 4.4;
  background: #121212;
  overflow: hidden;
}

.post-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.double-tap-heart {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 88px;
  height: 88px;
  color: rgba(255, 255, 255, 0.94);
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.double-tap-heart.pop {
  animation: heartPop 0.75s ease forwards;
}

@keyframes heartPop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  25% { transform: translate(-50%, -50%) scale(1.18); opacity: 1; }
  55% { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.25); opacity: 0; }
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

.post-actions-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.like-btn.liked svg {
  color: var(--red);
  fill: var(--red);
}

.save-btn.saved svg {
  fill: #fff;
}

.post-meta {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.post-likes {
  font-size: 13.5px;
  font-weight: 600;
}

.post-caption {
  font-size: 13.5px;
  line-height: 1.38;
}

.post-caption strong {
  font-weight: 600;
  margin-right: 5px;
}

.post-comments-link {
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.post-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ==================== BOTTOM NAVIGATION ==================== */
.bottom-nav {
  height: calc(52px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid #1c1c1c;
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
}

.nav-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4d4d4;
}

.nav-btn.active {
  color: #fff;
}

.nav-btn svg {
  width: 24px;
  height: 24px;
}

.nav-avatar-wrap {
  position: relative;
  width: 26px;
  height: 26px;
}

.nav-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid transparent;
}

.nav-btn.active .nav-avatar-wrap img {
  border-color: #fff;
}

.small-dot {
  width: 7px;
  height: 7px;
  top: -1px;
  right: -2px;
}

/* ==================== EXPLORE & PROFILE TABS ==================== */
.search-tab-header {
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
}

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

.explore-tile {
  aspect-ratio: 1;
  overflow: hidden;
  background: #141414;
}

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

.profile-username-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 19px;
  font-weight: 700;
}

.profile-header-block {
  padding: 14px 16px;
}

.profile-stats-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.profile-avatar-lg {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-stats {
  flex: 1;
  display: flex;
  justify-content: space-around;
  text-align: center;
}

.stat-num {
  font-size: 17px;
  font-weight: 700;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-primary);
}

.profile-bio-block {
  margin-top: 12px;
  font-size: 13.5px;
  line-height: 1.4;
}

.profile-bio-name {
  font-weight: 600;
}

.profile-bio-text {
  white-space: pre-line;
  color: #e5e5e5;
  margin-top: 2px;
}

.profile-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.profile-pill-btn {
  flex: 1;
  background: var(--surface);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
}

/* ==================== 3. DM / MESSAGES LIST SCREEN ==================== */
.dm-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dm-username-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 19px;
  font-weight: 700;
}

.inline-red-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  margin-left: 2px;
}

.dm-search-wrap {
  padding: 6px 14px 10px;
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--text-secondary);
}

.search-pill svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.search-pill input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
  width: 100%;
}

.search-pill input::placeholder {
  color: var(--text-secondary);
}

/* Notes Row */
.notes-row {
  display: flex;
  gap: 18px;
  padding: 16px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.notes-row::-webkit-scrollbar {
  display: none;
}

.note-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 72px;
  flex-shrink: 0;
}

.note-bubble {
  position: relative;
  background: #262626;
  color: #e5e5e5;
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 14px;
  max-width: 78px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: -14px;
  z-index: 2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.note-item.self-note .note-bubble {
  color: var(--text-secondary);
}

.note-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  object-fit: cover;
}

.note-name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 72px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 8px;
}

.messages-heading {
  font-size: 16px;
  font-weight: 700;
}

.requests-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--blue-soft);
}

.chat-list {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.chat-row:active {
  background: #141414;
}

.chat-row-avatar-ring {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--story-grad);
  flex-shrink: 0;
}

.chat-row-avatar-ring.no-ring {
  padding: 0;
  background: transparent;
}

.chat-row-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--bg);
}

.chat-row-avatar-ring.no-ring img {
  border: none;
}

.chat-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chat-row-name {
  font-size: 15px;
  font-weight: 400;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-row.unread .chat-row-name {
  font-weight: 600;
  color: #ffffff;
}

.chat-row-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.chat-row.unread .chat-row-sub-text {
  font-weight: 600;
  color: #f5f5f5;
}

.chat-row-sub-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-blue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex-shrink: 0;
}

/* ==================== 4. INDIVIDUAL CHAT SCREEN ==================== */
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.chat-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.chat-header-avatar-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 1.5px;
  background: var(--story-grad);
  flex-shrink: 0;
}

.chat-header-avatar-ring.no-ring {
  padding: 0;
  background: transparent;
}

.chat-header-avatar-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--bg);
}

.chat-header-name {
  font-size: 15.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 185px;
  display: block;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
}

.chat-body::-webkit-scrollbar {
  display: none;
}

.chat-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 16px 26px;
  gap: 6px;
}

.chat-profile-card img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 6px;
}

.chat-profile-title {
  font-size: 16px;
  font-weight: 700;
}

.chat-profile-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.view-profile-btn {
  margin-top: 8px;
  background: var(--surface);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 10px;
}

.chat-timestamp {
  align-self: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin: 12px 0 14px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 10px;
}

.msg-row.grouped {
  margin-bottom: 3px;
}

.msg-row.me {
  justify-content: flex-end;
}

.msg-row.them {
  justify-content: flex-start;
}

.msg-them-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.msg-avatar-spacer {
  width: 28px;
  flex-shrink: 0;
}

.msg-bubble-wrap {
  position: relative;
  max-width: 74%;
  display: flex;
  flex-direction: column;
}

.msg-bubble {
  padding: 10px 15px;
  font-size: 15px;
  line-height: 1.35;
  word-wrap: break-word;
  border-radius: 20px;
  cursor: pointer;
}

.msg-row.me .msg-bubble {
  background: var(--bubble-me);
  color: #fff;
}

.msg-row.them .msg-bubble {
  background: var(--bubble-them);
  color: #f5f5f5;
}

.msg-reaction {
  align-self: flex-start;
  margin-top: -6px;
  margin-left: 8px;
  background: #1f1f1f;
  border: 2px solid #000;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 12px;
}

.msg-row.me .msg-reaction {
  align-self: flex-end;
  margin-right: 8px;
}

.msg-seen {
  align-self: flex-end;
  font-size: 11px;
  color: var(--text-secondary);
  margin: 2px 4px 8px 0;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  flex-shrink: 0;
}

.chat-input-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px 5px 6px;
}

.chat-cam-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4267f5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-cam-btn svg {
  width: 19px;
  height: 19px;
}

#chat-message-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 15px;
}

#chat-message-input::placeholder {
  color: var(--text-secondary);
}

.chat-input-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.mini-icon-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-icon-btn svg {
  width: 21px;
  height: 21px;
}

.chat-send-btn {
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  padding: 4px 6px;
}

/* ==================== OVERLAYS & MODALS ==================== */
.overlay-modal {
  position: absolute;
  inset: 0;
  background: #000;
  z-index: 60;
  display: flex;
  flex-direction: column;
}

.story-progress-track {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  overflow: hidden;
  z-index: 3;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
}

.story-modal-header {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
}

.story-modal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}

.story-modal-user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.story-modal-time {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
}

.story-modal-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Comments Sheet */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 55;
  display: flex;
  align-items: flex-end;
}

.bottom-sheet {
  width: 100%;
  max-height: 60%;
  background: #1c1c1e;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: #555;
  align-self: center;
}

.sheet-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid #2c2c2e;
}

.sheet-comments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.sheet-comment-row {
  font-size: 14px;
  line-height: 1.4;
}

.sheet-comment-row strong {
  margin-right: 6px;
}

/* Call Overlay */
.call-overlay {
  justify-content: space-between;
  align-items: center;
  padding: 90px 24px 64px;
  background: radial-gradient(circle at top, #1f1938 0%, #060608 75%);
}

.call-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.call-avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 8px rgba(124, 58, 237, 0.25);
}

.call-name {
  font-size: 22px;
  font-weight: 700;
}

.call-status {
  font-size: 14px;
  color: var(--text-secondary);
}

.end-call-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-call-btn svg {
  width: 28px;
  height: 28px;
}

/* ==================== NOTIFICATIONS SCREEN ==================== */
.notif-scroll {
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.notif-section-title {
  font-size: 15px;
  font-weight: 700;
  padding: 14px 16px 8px;
  color: #fff;
}

.notif-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
}

.notif-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.notif-text {
  flex: 1;
  font-size: 13.5px;
  line-height: 1.35;
  color: #f5f5f5;
}

.notif-text strong {
  font-weight: 600;
}

.notif-time {
  color: var(--text-secondary);
  margin-left: 4px;
}

.notif-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.notif-follow-btn {
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 8px;
  flex-shrink: 0;
}

.notif-follow-btn.following {
  background: var(--surface);
  color: #fff;
}

/* ==================== NEW POST / CREATE SCREEN ==================== */
.create-next-btn {
  color: var(--blue);
  font-size: 15.5px;
  font-weight: 700;
}

.create-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.create-preview-box {
  width: 100%;
  aspect-ratio: 1 / 0.92;
  background: #111;
  overflow: hidden;
  flex-shrink: 0;
}

.create-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.create-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  background: #000;
  border-top: 1px solid #1b1b1b;
  border-bottom: 1px solid #1b1b1b;
}

.create-recents-label {
  font-size: 15px;
  font-weight: 600;
}

.create-hint-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.create-gallery-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  align-content: start;
  scrollbar-width: none;
}

.create-gallery-grid::-webkit-scrollbar {
  display: none;
}

.gallery-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
}

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

.gallery-tile.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid #fff;
}

.create-caption-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
}

.caption-top-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid #222;
}

.caption-top-row img {
  width: 68px;
  height: 68px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.caption-top-row textarea {
  flex: 1;
  height: 76px;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font: inherit;
  font-size: 14.5px;
  resize: none;
}

.caption-option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #1b1b1b;
  font-size: 14.5px;
  color: #f5f5f5;
}

.caption-share-wrap {
  margin-top: auto;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.share-post-primary-btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
}

/* ==================== REELS / PHOTO FEED TAB ==================== */
.reels-snap-container {
  flex: 1;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.reels-snap-container::-webkit-scrollbar {
  display: none;
}

.reel-slide {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  background: #0a0a0a;
  overflow: hidden;
}

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

.reel-gradient-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.1) 42%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
}

.reel-top-title {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.reel-overlay-bottom {
  position: absolute;
  left: 14px;
  right: 68px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reel-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reel-user-row img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #fff;
}

.reel-user-row span {
  font-size: 14px;
  font-weight: 600;
}

.reel-follow-pill {
  border: 1px solid rgba(255, 255, 255, 0.75);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 7px;
}

.reel-caption {
  font-size: 13.5px;
  line-height: 1.35;
}

.reel-audio {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.88);
}

.reel-actions-side {
  position: absolute;
  right: 12px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.reel-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}

.reel-action-item svg {
  width: 27px;
  height: 27px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.reel-action-item.liked svg {
  color: var(--red);
  fill: var(--red);
}

/* ==================== PARTY DM & CHAT ENHANCEMENTS ==================== */
.dm-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dm-extra-icon {
  color: #f5f5f5;
}

.note-bubble-multi {
  background: #262626;
  color: #e5e5e5;
  font-size: 11px;
  line-height: 1.25;
  padding: 6px 9px;
  border-radius: 14px;
  max-width: 86px;
  text-align: center;
  margin-bottom: -14px;
  z-index: 2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.note-bubble-sub {
  color: var(--text-secondary);
  font-size: 10.5px;
  display: block;
  white-space: pre-line;
}

.note-sublabel {
  font-size: 11px;
  color: #e5e5e5;
  margin-top: -4px;
}

.dm-filter-pills {
  display: flex;
  gap: 8px;
  padding: 6px 14px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dm-filter-pills::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  background: #262626;
  color: #f5f5f5;
  font-size: 13.5px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-pill.active {
  background: #ffffff;
  color: #000000;
}

.dm-active-pill {
  background: #262626;
  width: 56px;
  height: 36px;
  border-radius: 18px;
  color: #fff;
}

.chat-header-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat-header-handle {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shared Reel / Post Cards inside Chat */
.msg-reel-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.msg-reel-row.me {
  justify-content: flex-end;
}

.msg-reel-row.them {
  justify-content: flex-start;
}

.msg-reel-group {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 82%;
}

.msg-reel-row.me .msg-reel-group {
  flex-direction: row-reverse;
}

.msg-reel-card-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
}

.msg-reel-card {
  width: 196px;
  border-radius: 16px;
  overflow: hidden;
  background: #1b1b1d;
  cursor: pointer;
}

.msg-reel-card.post-card-wide {
  width: 248px;
}

.msg-reel-card img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.msg-reel-side-btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reel-side-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #222;
  color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-side-circle svg {
  width: 15px;
  height: 15px;
}

.msg-reel-reaction {
  align-self: flex-start;
  margin-top: -10px;
  margin-left: 8px;
  background: #222;
  border: 2px solid #000;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 13px;
  z-index: 2;
}

.msg-reel-row.me .msg-reel-reaction {
  align-self: flex-end;
  margin-right: 8px;
}

.msg-double-tap-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-left: 2px;
}

/* Reply Thread Quotes */
.reply-thread-wrap {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.reply-thread-wrap.me {
  align-items: flex-end;
}

.reply-thread-wrap.them {
  align-items: flex-start;
  padding-left: 36px;
}

.reply-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.reply-quote-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 5px;
}

.reply-thread-wrap.me .reply-quote-row {
  flex-direction: row-reverse;
}

.reply-vert-bar {
  width: 3px;
  border-radius: 3px;
  background: #3a3a3c;
  flex-shrink: 0;
}

.reply-thumb {
  width: 82px;
  height: 118px;
  border-radius: 14px;
  object-fit: cover;
  cursor: pointer;
}

.reply-quote-bubble {
  background: #262626;
  color: #b5b5b5;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 16px;
  max-width: 210px;
}

.reply-quote-bubble.from-me {
  background: #4e239c;
  color: rgba(255, 255, 255, 0.85);
}

.msg-emoji-only {
  font-size: 30px;
  line-height: 1.1;
  margin-top: 4px;
}

/* Fullscreen Media Preview */
.media-close-btn {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: 16px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  width: 36px;
  height: 36px;
}

.media-preview-full {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Toast */
.toast {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(38, 38, 38, 0.96);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 80;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
