:root {
  --bg: #050507;
  --surface: #0f1014;
  --surface-2: #171820;
  --surface-3: #20222c;
  --text: #f4f5f7;
  --muted: #9a9ca8;
  --line: #2b2d38;
  --brand: #ef3b68;
  --brand-2: #ff8a3d;
  --accent: #7c5cff;
  --ok: #2bd576;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: clamp(96px, 13vh, 132px);
  background:
    radial-gradient(circle at top left, rgba(239, 59, 104, 0.16), transparent 30rem),
    radial-gradient(circle at top right, rgba(124, 92, 255, 0.13), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 max(18px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 5, 7, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  width: clamp(170px, 22vw, 300px);
  min-height: 58px;
  text-decoration: none;
}

.brand img {
  width: 100%;
  max-height: 62px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.42));
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-only {
  display: none !important;
}

body.is-authenticated .auth-only {
  display: inline-grid !important;
}

.top-action {
  width: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 63, 164, 0.18), transparent 1.7rem),
    radial-gradient(circle at 78% 82%, rgba(21, 200, 255, 0.14), transparent 1.8rem),
    rgba(12, 13, 19, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 18px rgba(138, 61, 255, 0.22);
}

.top-action .rgb-icon {
  width: 24px;
  height: 24px;
  fill: none;
  overflow: visible;
  filter: drop-shadow(0 0 10px rgba(255, 63, 164, 0.28));
}

.rgb-stroke,
.story-dash {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.15;
}

.story-dash {
  stroke-width: 2.8;
  stroke-dasharray: 5 4.2;
}

.rgb-fill {
  stroke: none;
}

.reel-action { color: #36f279; }
.story-action { color: #ff4ecb; }
.carousel-action { color: #b45cff; }

.shell {
  width: min(1180px, calc(100% - 28px));
  margin: 26px auto 64px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
  gap: 0;
}

.sidebar {
  position: static;
  display: grid;
  align-content: start;
  gap: 16px;
  max-height: none;
  margin-bottom: 18px;
}

.stream {
  min-width: 0;
}

.panel,
.post-card,
.stories-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 16, 20, 0.92);
  box-shadow: var(--shadow);
}

.welcome {
  padding: 20px;
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

.welcome h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1;
}

.welcome-logo {
  display: block;
  width: min(100%, 520px);
  margin: -12px auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.52));
}

.welcome p {
  margin: 0 0 18px;
  color: var(--muted);
}

.interest-panel {
  display: grid;
  gap: 12px;
}

.section-title {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: var(--surface-2);
  color: var(--text);
}

.chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}

.welcome-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button,
.action-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 850;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 750;
}

.text-button {
  background: transparent;
  color: var(--text);
  font-weight: 850;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  place-items: center;
  padding: 0;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.08rem;
}

.primary-button:hover,
.secondary-button:hover,
.text-button:hover,
.icon-button:hover,
.action-button:hover {
  transform: translateY(-1px);
}

.stories-row {
  display: flex;
  gap: 14px;
  min-height: 112px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding: 16px;
}

.story-bubble {
  display: grid;
  gap: 7px;
  justify-items: center;
  min-width: 72px;
  border: 0;
  background: transparent;
  color: var(--text);
}

.avatar-ring {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(var(--brand), var(--brand-2), var(--accent), var(--brand));
}

.avatar,
.avatar-fallback {
  width: 100%;
  height: 100%;
  border: 3px solid var(--surface);
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 900;
}

.story-name {
  max-width: 76px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.empty-story-note {
  display: flex;
  align-items: center;
  min-width: 190px;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-panel,
.panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.feed {
  display: grid;
  gap: 20px;
}

.post-card {
  overflow: hidden;
}

.post-head,
.post-actions,
.post-body {
  padding: 14px 16px;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.post-author-button {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.post-head .avatar-ring {
  width: 46px;
  height: 46px;
}

.post-author {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.post-author strong {
  line-height: 1.1;
}

.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.media-frame {
  position: relative;
  background: #000;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.views-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 850;
  backdrop-filter: blur(8px);
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.carousel-controls button {
  pointer-events: auto;
  margin: 10px;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
}

.post-body h2 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.post-body p {
  margin: 0;
  color: #d7d8df;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  border-radius: 999px;
  background: rgba(239, 59, 104, 0.13);
  padding: 4px 9px;
  color: #ff9db2;
  font-size: 0.78rem;
  font-weight: 750;
}

.post-actions {
  display: block;
  border-top: 1px solid var(--line);
}

.social-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.social-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background:
    linear-gradient(var(--surface-2), var(--surface-2)) padding-box,
    linear-gradient(135deg, #15c8ff, #8a3dff, #ff3fa4, #ff9c18) border-box;
  color: var(--text);
  font-weight: 850;
}

.social-icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(255, 63, 164, 0.24));
}

.social-icon-button span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.like-button.liked {
  border-color: rgba(255, 48, 84, 0.55);
  background: rgba(255, 48, 84, 0.12);
  color: #ff3054;
  animation: likePulse 0.8s ease-in-out infinite alternate;
}

.like-button.liked svg,
.favorite-button.favorited svg {
  fill: currentColor;
}

.favorite-button.favorited {
  border-color: rgba(255, 226, 58, 0.7);
  background: rgba(255, 226, 58, 0.12);
  color: #ffe23a;
}

@keyframes likePulse {
  from {
    box-shadow: 0 0 0 rgba(255, 48, 84, 0);
    transform: translateY(0);
  }
  to {
    box-shadow: 0 0 18px rgba(255, 48, 84, 0.32);
    transform: translateY(-1px);
  }
}

.action-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 750;
}

.action-button.active {
  border-color: rgba(239, 59, 104, 0.45);
  background: rgba(239, 59, 104, 0.16);
  color: #ff7d9a;
}

.comment-box {
  display: flex;
  gap: 8px;
  width: 100%;
}

.comment-box input {
  min-width: 0;
  flex: 1;
}

.modal {
  width: min(560px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--surface);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #090a0d;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segment {
  min-height: 38px;
  border: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 850;
}

.segment.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.form-error {
  margin: 0;
  color: #ff8ca3;
  font-weight: 750;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.preview-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-2);
}

.preview-card img,
.preview-card video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}

.camera-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, #ff4ecb 55%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 78, 203, 0.13), rgba(54, 242, 121, 0.11)),
    var(--surface-2);
  color: var(--text);
  font-weight: 850;
}

.camera-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #ff4ecb;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  filter: drop-shadow(0 0 9px rgba(255, 78, 203, 0.45));
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  color: #d7d8df;
  font-size: 0.9rem;
}

.story-modal {
  width: min(430px, calc(100% - 28px));
}

.story-viewer {
  min-height: 520px;
  display: grid;
  place-items: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.story-viewer img,
.story-viewer video {
  width: 100%;
  height: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.story-media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.comments-modal {
  width: min(620px, calc(100% - 20px));
}

.comments-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.comments-sheet {
  max-height: min(78vh, 720px);
}

.comments-list {
  display: grid;
  gap: 12px;
  max-height: 48vh;
  overflow: auto;
  padding-right: 2px;
}

.comment-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: start;
}

.comment-item .avatar-ring {
  width: 42px;
  height: 42px;
}

.comment-content {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.comment-content p {
  margin: 0;
  color: #d7d8df;
}

.comment-like-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 800;
}

.comment-like-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.comment-like-button.active {
  color: #ff3054;
}

.comment-like-button.active svg {
  fill: currentColor;
}

.comment-drawer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding-top: 4px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 34px;
  text-align: center;
  color: var(--muted);
  background: rgba(15, 16, 20, 0.72);
}

.setup-error {
  display: grid;
  gap: 10px;
  text-align: left;
}

.setup-error strong {
  color: var(--text);
}

.filter-normal { filter: none; }
.filter-amaro { filter: contrast(1.08) brightness(1.08) saturate(1.25); }
.filter-mayfair { filter: contrast(1.08) saturate(1.12) sepia(0.16); }
.filter-valencia { filter: contrast(0.95) brightness(1.08) sepia(0.22); }
.filter-xpro2 { filter: contrast(1.28) saturate(1.25) sepia(0.18); }
.filter-aden { filter: contrast(0.9) brightness(1.14) saturate(0.85) hue-rotate(-12deg); }
.filter-brooklyn { filter: contrast(0.9) brightness(1.1) saturate(1.08) sepia(0.12); }
.filter-lofi { filter: contrast(1.32) saturate(1.22); }

.app-screen {
  display: none;
}

.app-screen.active {
  display: block;
}

.bottom-tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  width: min(720px, 100%);
  transform: translateX(-50%);
  padding: 8px max(6px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(239, 59, 104, 0.16), transparent 8rem),
    radial-gradient(circle at 88% 70%, rgba(37, 136, 255, 0.14), transparent 9rem),
    rgba(5, 5, 7, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
}

.tab-button {
  position: relative;
  display: grid;
  grid-template-rows: 30px auto;
  gap: 4px;
  min-width: 0;
  min-height: 58px;
  place-items: center;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: transparent;
  color: #fff;
  text-transform: uppercase;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
  filter: drop-shadow(0 0 10px color-mix(in srgb, currentColor 38%, transparent));
  transition: transform 0.15s ease;
}

.tab-button span {
  max-width: 100%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-button.active {
  background: transparent;
}

.tab-button.active svg {
  transform: translateY(-2px) scale(1.08);
}

.tab-profile { color: #8a3dff; }
.tab-search { color: #ff3d3d; }
.tab-home { color: #fff23a; }
.tab-reels { color: #36f279; }
.tab-share { color: #ff5b9d; }
.tab-notifications { color: #ff3fa4; }

.mini-avatar {
  display: grid;
  width: clamp(28px, 8vw, 34px);
  height: clamp(28px, 8vw, 34px);
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--surface-3);
  color: #fff;
  font-weight: 900;
}

.mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reels-screen,
.messages-screen,
.search-screen,
.profile-screen {
  width: min(430px, 100%);
  min-height: calc(100vh - 80px);
  margin: 0 auto;
  padding: 18px 12px 92px;
}

.reel-card {
  position: relative;
  min-height: calc(100vh - 110px);
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}

.reel-media {
  width: 100%;
  height: calc(100vh - 110px);
  object-fit: cover;
  display: block;
}

.reel-overlay {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 14px 26px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
}

.reel-overlay p {
  margin: 6px 0 0;
  color: #fff;
}

.reel-views {
  display: inline-block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  font-weight: 800;
}

.reel-actions {
  display: grid;
  gap: 10px;
}

.round-action,
.icon-plain {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 900;
}

.screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.screen-head h2 {
  margin: 0;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-card,
.message-share {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.message-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.message-card p {
  margin: 0;
  color: var(--muted);
}

.message-share {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 8px;
  text-align: left;
}

.message-thumb {
  width: 62px;
  height: 62px;
  border-radius: 8px;
  object-fit: cover;
}

.message-share small {
  display: block;
  color: var(--muted);
}

.search-bar {
  position: sticky;
  top: 72px;
  z-index: 5;
  margin-bottom: 14px;
  padding: 6px 0;
  background: var(--bg);
}

.search-profiles {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.profile-result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.profile-result .avatar-ring {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
}

.profile-result span:last-child {
  display: grid;
  min-width: 0;
}

.profile-result small {
  color: var(--muted);
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.search-tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  background: #111;
  color: #fff;
  padding: 0;
}

.search-media,
.profile-grid-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-tile span {
  position: absolute;
  inset: auto 0 0;
  padding: 18px 6px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-size: 0.78rem;
}

.profile-top {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
}

.profile-top strong {
  text-align: center;
  font-size: 1.3rem;
}

.profile-hero {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 16px;
}

.profile-avatar-wrap {
  position: relative;
}

.profile-avatar-wrap .avatar,
.profile-avatar-wrap .avatar-fallback {
  width: 104px;
  height: 104px;
  border: 4px solid var(--surface-3);
}

.profile-avatar-wrap button {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 30px;
  height: 30px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: #fff;
  color: #050507;
  font-weight: 900;
}

.profile-name-block {
  display: grid;
  gap: 10px;
}

.profile-name-block > strong {
  font-size: 1.25rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.profile-stats span {
  display: grid;
  gap: 2px;
  font-size: 0.88rem;
}

.profile-stats b {
  font-size: 1.2rem;
}

.profile-bio {
  margin: 18px 0 12px;
  color: #f1f1f4;
  font-size: 1rem;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.profile-actions .is-following {
  border-color: var(--line);
  background: var(--surface-2);
}

.post-card {
    cursor: pointer;
  }

  .profile-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    margin-top: 22px;
    border-bottom: 1px solid var(--line);
  }

  .profile-tabs button {
    min-height: 48px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 1.5rem;
    transition: background 0.2s ease, color 0.2s ease;
  }

  .profile-tabs button:hover,
  .profile-tabs button.active {
    border-bottom-color: transparent;
    color: #fff;
    background: linear-gradient(135deg, #15c8ff 0%, #8a3dff 35%, #ff2fa7 68%, #ff9c18 100%);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), 0 0 20px rgba(255, 75, 231, 0.18);
    border-radius: 14px;
  }

  .profile-tabs svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    filter: drop-shadow(0 0 12px rgba(255, 72, 219, 0.35));
  }

  .profile-tabs button:hover svg,
  .profile-tabs button.active svg {
    filter: drop-shadow(0 0 16px rgba(255, 100, 180, 0.45));
  }

  .profile-post-preview {
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .profile-post-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
  }

  .profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }

  .profile-post-preview {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    color: inherit;
    display: grid;
    place-items: center;
    cursor: pointer;
  }

  .profile-post-preview img,
  .profile-post-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .hashtag {
    display: inline-block;
    margin: 0 4px 4px 0;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.86rem;
  }

  .post-viewer .post-body {
    margin-top: 14px;
  }

  .post-viewer-content {
    display: grid;
    gap: 14px;
  }

  .dialog-media-wrap {
    display: grid;
    gap: 8px;
  }

  .dialog-media {
    width: 100%;
    max-height: 68vh;
    object-fit: contain;
    border-radius: 16px;
    background: #000;
  }

  .dialog-post-body h3 {
    margin: 0;
    font-size: 1.2rem;
  }

  .dialog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--muted);
    font-size: 0.9rem;
}

.profile-grid > * {
  aspect-ratio: 1;
  background: #111;
}

.profile-login {
  display: grid;
  min-height: 70vh;
  place-content: center;
  gap: 14px;
  text-align: center;
}

.brand-large {
  font-size: 2rem;
  font-weight: 950;
}

.media-placeholder {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: minmax(0, 620px);
  }

  .sidebar {
    position: static;
    max-height: none;
    order: 2;
  }
}

@media (min-width: 981px) {
  .sidebar-profile,
  .sidebar-notifications {
    display: none !important;
  }
}

@media (max-width: 620px) {
  body {
    background: #050507;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 64px;
    padding: 0 12px;
  }

  .brand {
    width: min(38vw, 150px);
    min-height: 48px;
  }

  .brand img {
    max-height: 48px;
  }

  .shell {
    width: 100%;
    margin-top: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .stream {
    width: 100%;
  }

  .stories-row {
    min-height: 106px;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    background: #08090d;
  }

  .post-card {
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
    background: #050507;
  }

  .feed {
    gap: 0;
  }

  .media-frame {
    aspect-ratio: 4 / 5;
  }

  .sidebar {
    padding: 12px;
  }

  body[data-view="home"] .sidebar {
    display: grid;
  }

  body[data-view="home"].interests-ready .sidebar {
    display: none;
  }

  body[data-view="home"] .sidebar-profile,
  body[data-view="home"] .sidebar-notifications {
    display: none !important;
  }

  .bottom-tabs {
    width: 100%;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    border-left: 0;
    border-right: 0;
    border-radius: 16px 16px 0 0;
  }

  .tab-button {
    grid-template-rows: 27px auto;
    min-height: 54px;
    padding: 0 2px;
  }

  .tab-button svg {
    width: 25px;
    height: 25px;
  }

  .tab-button span {
    font-size: 0.46rem;
    letter-spacing: 0.01em;
  }

  .nav {
    gap: 5px;
  }

  .icon-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .top-action .rgb-icon {
    width: 21px;
    height: 21px;
  }

  #authToggle {
    min-height: 36px;
    padding: 0 8px;
    font-size: 0.92rem;
  }

  .post-actions,
  .comment-box {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .social-actions {
    gap: 6px;
  }

  .social-icon-button {
    gap: 4px;
    min-height: 40px;
    padding: 0 5px;
  }

  .social-icon-button svg {
    width: 20px;
    height: 20px;
  }

  .social-icon-button span {
    font-size: 0.76rem;
  }

  .comments-modal {
    width: 100%;
    max-width: none;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
  }

  .comments-sheet {
    max-height: 82vh;
  }

  .comment-box,
  .primary-button,
  .secondary-button,
  .text-button,
  .action-button {
    width: 100%;
  }
}
