/* ============================================================
   Social Links — black & white design system
   Same language as ReviewRates: off-white canvas, white cards, soft
   shadows (no hard edges), hairline borders, pill buttons, system font.
   Color is reserved for two meanings only — red for "liked", green for
   "success/online" — everything else is ink, white, and gray.
   ============================================================ */
:root {
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-display: var(--font-body);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-hard: 0 14px 34px rgba(20,20,26,.10);
  --shadow-hard-sm: 0 6px 16px rgba(20,20,26,.06);
  --border-w: 1.5px;
  --bg: #f3f2ee;
  --surface: #ffffff;
  --surface-light: #ffffff;
  --surface-dark: #eae8e2;
  --input-bg: #fbfbf9;
  --ink: #15151a;
  --on-ink: #ffffff;
  --ink-75: rgba(21, 21, 26, .78);
  --ink-70: rgba(21, 21, 26, .7);
  --ink-50: rgba(21, 21, 26, .46);
  --primary: #15151a;
  --primary-light: #3a3a42;
  --primary-dark: #000000;
  --secondary: #6f6f79;
  --secondary-light: #a6a6ae;
  --secondary-dark: #4a4a52;
  --tertiary: #1c8a4a;
  --danger: #e0483f;
  --accent-pink: var(--danger);
  --accent-purple: var(--ink);
  --accent-yellow: var(--ink);
  --accent-cyan: var(--ink);
  --accent-lime: var(--tertiary);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214;
    --surface: #1c1c20;
    --surface-light: #232328;
    --surface-dark: #302f35;
    --input-bg: #232328;
    --ink: #f2f1ee;
    --on-ink: #15151a;
    --ink-75: rgba(242, 241, 238, .78);
    --ink-70: rgba(242, 241, 238, .7);
    --ink-50: rgba(242, 241, 238, .46);
    --primary: #f2f1ee;
    --primary-light: #c9c8c4;
    --primary-dark: #ffffff;
    --secondary: #a6a6b0;
    --secondary-light: #6f6f79;
    --secondary-dark: #dcdbd8;
    --tertiary: #3ddc84;
    --danger: #ff6b60;
    --accent-pink: var(--danger);
    --accent-purple: var(--ink);
    --accent-yellow: var(--ink);
    --accent-cyan: var(--ink);
    --accent-lime: var(--tertiary);
    --shadow-hard: 0 14px 34px rgba(0,0,0,.45);
    --shadow-hard-sm: 0 6px 16px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #121214;
  --surface: #1c1c20;
  --surface-light: #232328;
  --surface-dark: #302f35;
  --input-bg: #232328;
  --ink: #f2f1ee;
  --on-ink: #15151a;
  --ink-75: rgba(242, 241, 238, .78);
  --ink-70: rgba(242, 241, 238, .7);
  --ink-50: rgba(242, 241, 238, .46);
  --primary: #f2f1ee;
  --primary-light: #c9c8c4;
  --primary-dark: #ffffff;
  --secondary: #a6a6b0;
  --secondary-light: #6f6f79;
  --secondary-dark: #dcdbd8;
  --tertiary: #3ddc84;
  --danger: #ff6b60;
  --accent-pink: var(--danger);
  --accent-purple: var(--ink);
  --accent-yellow: var(--ink);
  --accent-cyan: var(--ink);
  --accent-lime: var(--tertiary);
  --shadow-hard: 0 14px 34px rgba(0,0,0,.45);
  --shadow-hard-sm: 0 6px 16px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color 200ms ease, color 200ms ease;
}

/* ---------- Theme toggle ---------- */
.theme-toggle-fab {
  position: fixed; top: 14px; right: 14px; z-index: 70;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface); border: var(--border-w) solid var(--surface-dark); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-hard-sm);
}
.theme-toggle-fab svg { width: 18px; height: 18px; }
.theme-toggle-fab path, .theme-toggle-fab circle { stroke: var(--ink); }
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  border: none;
  outline: none;
  background: var(--input-bg);
}

/* ---------- Surface mixins (as classes; CSS has no mixins) ---------- */
.clay-raised {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: var(--border-w) solid var(--surface-dark);
  box-shadow: var(--shadow-hard-sm);
}
.clay-raised-primary {
  background: var(--ink);
  border-radius: 999px;
  color: var(--on-ink);
  border: none;
  transition: opacity 150ms;
}
.clay-raised-primary:hover { opacity: 0.88; }
.clay-raised-secondary {
  background: transparent;
  border-radius: 999px;
  color: var(--ink-75);
  border: var(--border-w) solid var(--surface-dark);
}
.clay-raised-secondary:hover { border-color: var(--ink); color: var(--ink); }
.clay-inset {
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  border: var(--border-w) solid var(--surface-dark);
}

/* ---------- Motion ---------- */
.tap {
  transition: transform 120ms ease-out, opacity 120ms ease-out;
  cursor: pointer;
}
.tap:active { transform: scale(0.94); }
.tap-release {
  animation: tapRelease 220ms var(--ease-out-back);
}
@keyframes tapRelease {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes wobble {
  0% { transform: rotate(0); }
  25% { transform: rotate(-6deg); }
  60% { transform: rotate(6deg); }
  100% { transform: rotate(0); }
}
@keyframes foldIn {
  0% { transform: translateY(24px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.anim-pop { animation: popIn 260ms var(--ease-out-back); }
.anim-wobble { animation: wobble 400ms ease-in-out; }
.anim-fold { animation: foldIn 260ms ease-out; }
@media (prefers-reduced-motion: reduce) {
  .anim-pop, .anim-wobble, .anim-fold, .tap-release { animation: fadeIn 150ms ease !important; }
  .tap:active { transform: none; }
}

/* ---------- Layout ---------- */
#bgCanvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: block; }
#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.app-shell { display: flex; flex: 1; max-width: 1080px; margin: 0 auto; width: 100%; }
.main-col { flex: 1; min-width: 0; padding: 16px 12px 88px; }
.side-nav {
  display: none;
  width: 220px;
  padding: 24px 12px;
  flex-direction: column;
  gap: 4px;
}
@media (min-width: 900px) {
  .side-nav {
    display: flex;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
  }
  .main-col { padding-bottom: 24px; }
}
.brand {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 8px 14px 20px;
}
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 999px;
  color: var(--ink-75); font-weight: 600; font-size: 15px;
  transition: background-color 150ms;
}
.side-link.active { background: var(--ink); color: var(--on-ink); }
.side-link.active .icon path, .side-link.active .icon rect, .side-link.active .icon circle { fill: var(--on-ink); opacity: 1; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--surface);
  border-top: var(--border-w) solid var(--surface-dark);
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
}
.nav-btn {
  background: none; border: none; padding: 7px 14px; border-radius: 999px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform 150ms var(--ease-out-back), background-color 150ms;
}
.nav-btn.active { background: var(--ink); }
.nav-btn.active .icon path, .nav-btn.active .icon rect, .nav-btn.active .icon circle { fill: var(--on-ink); opacity: 1; }
.nav-btn .icon { width: 23px; height: 23px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px 16px;
}
.topbar h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin: 0; }
@media (max-width: 899px) {
  /* Clears the fixed theme-toggle-fab pinned to the viewport's top-right
     corner, which otherwise sits on top of any right-aligned topbar button. */
  .topbar { padding-right: 54px; }
}

/* ---------- Icons ---------- */
.icon { width: 23px; height: 23px; flex-shrink: 0; }
.icon path, .icon circle, .icon ellipse, .icon rect { fill: var(--ink); opacity: 0.62; }
.icon.active path, .icon.active circle, .icon.active ellipse, .icon.active rect { fill: var(--ink); opacity: 1; }
.icon.icon-like.active path, .icon.icon-like.active circle { fill: var(--danger); opacity: 1; }
.icon.icon-online circle { fill: var(--tertiary); opacity: 1; }
.icon-sm { width: 17px; height: 17px; }

/* ---------- Buttons ---------- */
.btn {
  font-weight: 700; font-size: 14px; padding: 12px 22px;
  cursor: pointer; transition: transform 120ms ease-out, opacity 120ms;
}
.btn:active { transform: scale(0.96); }
.btn-block { width: 100%; text-align: center; }
.btn-ghost {
  background: transparent; color: var(--ink-75);
  border-radius: 999px;
  border: var(--border-w) solid var(--surface-dark); font-weight: 700; padding: 11px 18px; cursor: pointer;
  transition: border-color 150ms, color 150ms;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: var(--border-w) solid var(--surface-dark);
  box-shadow: var(--shadow-hard-sm);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
}
.auth-card { width: 100%; max-width: 380px; padding: 36px 28px; text-align: center; }
.auth-card .brand { padding: 0 0 4px; font-size: 26px; font-weight: 800; }
.auth-sub { color: var(--secondary); font-size: 14px; font-weight: 500; margin-bottom: 24px; }
.field {
  padding: 12px 16px; margin-bottom: 12px; width: 100%;
}
.field input { width: 100%; background: transparent; }
.auth-toggle { margin-top: 18px; font-size: 13px; font-weight: 500; color: var(--secondary); cursor: pointer; }
.auth-toggle b { color: var(--ink); text-decoration: underline; }
.auth-error { color: var(--danger); font-weight: 600; font-size: 12.5px; margin-bottom: 10px; min-height: 16px; }
.field-row { display: flex; gap: 10px; }
.field-row .clay-inset { flex: 1; }
.field select { width: 100%; background: transparent; cursor: pointer; }

/* ---------- Stories tray ---------- */
.stories-tray { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 14px; }
.story-item { display: flex; flex-direction: column; align-items: center; gap: 5px; flex-shrink: 0; width: 60px; cursor: pointer; }
.story-ring {
  width: 56px; height: 56px; border-radius: 50%;
  padding: 2.5px;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.story-ring.viewed { background: var(--surface-dark); }
.story-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--surface-dark); border: 2.5px solid var(--surface); }
.story-item span { font-size: 10.5px; font-weight: 600; color: var(--ink-75); max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add-badge {
  width: 20px; height: 20px; border-radius: 50%; background: var(--ink);
  display: flex; align-items: center; justify-content: center; color: var(--on-ink); font-size: 14px; font-weight: 700;
  margin-top: -18px; margin-left: 38px; border: 2px solid var(--surface);
}

/* ---------- Feed tabs ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; background: var(--surface-dark); border-radius: 999px; padding: 4px; }
.tab-btn {
  flex: 1; text-align: center; padding: 9px; border-radius: 999px;
  background: transparent; color: var(--secondary); font-weight: 600; font-size: 13px; cursor: pointer;
  border: none; transition: background-color 150ms, color 150ms;
}
.tab-btn.active { background: var(--ink); color: var(--on-ink); }

/* ---------- Composer ---------- */
.composer-trigger { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.composer-trigger .clay-inset { flex: 1; padding: 12px 16px; color: var(--ink-50); position: relative; overflow: hidden; border-radius: 999px; }
.sl-watermark {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-weight: 800; font-size: 30px; color: var(--ink);
  opacity: 0.05; pointer-events: none; line-height: 1; user-select: none;
}
.avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--surface-dark); flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 80px; height: 80px; border: 3px solid var(--surface); background: var(--surface-dark); box-shadow: var(--shadow-hard-sm); }
/* Shown instead of a broken/missing <img> — same box as .avatar so it drops
   into every avatar slot (feed, comments, story tray, profile...) cleanly. */
.avatar-placeholder { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.avatar-placeholder .icon { width: 60%; height: 60%; }
.avatar-placeholder .icon path, .avatar-placeholder .icon circle { fill: var(--ink-50); opacity: 1; }

/* ---------- Post card ---------- */
.post-card { padding: 16px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.post-head .meta { flex: 1; min-width: 0; }
.post-head .name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.post-head .time { font-size: 12px; font-weight: 500; color: var(--ink-50); }
.verified-badge { color: var(--tertiary); }
.post-content { font-size: 14px; font-weight: 400; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; color: var(--ink-75); }
.post-content .tag { color: var(--ink); font-weight: 700; }
.post-media { border-radius: var(--radius-md); overflow: hidden; margin-bottom: 10px; background: var(--bg); }
.post-media img, .post-media video { width: 100%; max-height: 480px; object-fit: cover; display: block; }
.post-media.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.post-media.grid-2 img { max-height: 240px; }
.post-stats { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 500; color: var(--ink-50); padding: 3px 2px 8px; border-bottom: var(--border-w) solid var(--surface-dark); margin-bottom: 4px; }
.post-actions { display: flex; }
.post-action {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 8px 4px; border-radius: var(--radius-sm); background: none; border: none;
  cursor: pointer; transition: background-color 120ms;
}
.post-action .icon { width: 21px; height: 21px; }
.post-action:hover { background: var(--bg); }
.post-action-like.liked .icon path, .post-action-like.liked .icon circle { fill: var(--danger); opacity: 1; }

/* ---------- Reaction picker ---------- */
.reaction-picker {
  position: absolute; display: flex; gap: 4px; padding: 6px 8px;
  background: var(--surface); border-radius: 999px;
  border: var(--border-w) solid var(--surface-dark); box-shadow: var(--shadow-hard);
  transform: translateY(-56px);
}
.reaction-picker button { background: none; border: none; font-size: 22px; cursor: pointer; transition: transform 150ms var(--ease-out-back); }
.reaction-picker button:hover { transform: scale(1.25) translateY(-4px); }

/* ---------- Comments ---------- */
.comment-row { display: flex; gap: 10px; margin-bottom: 12px; }
.comment-bubble { background: var(--bg); border-radius: 16px; padding: 9px 14px; flex: 1; }
.comment-bubble .name { font-weight: 700; font-size: 13px; }
.comment-bubble .text { font-size: 13.5px; font-weight: 400; color: var(--ink-75); }
.comment-meta { font-size: 11px; font-weight: 500; color: var(--ink-50); display: flex; gap: 12px; margin-top: 4px; padding-left: 4px; }
.comment-replies { margin-left: 40px; margin-top: 8px; }

/* ---------- Profile ---------- */
.profile-cover { height: 140px; border-radius: var(--radius-lg); background: var(--surface-dark); background-size: cover; background-position: center; margin-bottom: -44px; border: var(--border-w) solid var(--surface-dark); }
.profile-head { padding: 0 16px; }
.profile-avatar-row { display: flex; align-items: flex-end; justify-content: space-between; padding-top: 0; }
.profile-name { font-size: 19px; font-weight: 800; margin: 10px 0 2px; display:flex; align-items:center; gap:6px; letter-spacing: -0.01em; }
.profile-username { color: var(--ink-50); font-size: 13px; font-weight: 500; margin-bottom: 10px; }
.profile-bio { font-size: 14px; font-weight: 400; color: var(--ink-75); margin-bottom: 12px; white-space: pre-wrap; }
.profile-stats { display: flex; gap: 20px; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--ink-75); }
.profile-stats b { font-size: 14px; font-weight: 800; }
.profile-stats span { color: var(--ink-50); }
.profile-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.social-links-block { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.social-link-chip { display: flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-75); }
.about-row { display: flex; gap: 10px; padding: 10px 4px; font-size: 13.5px; font-weight: 500; color: var(--ink-75); border-bottom: var(--border-w) solid var(--surface-dark); }
.about-row:last-child { border-bottom: none; }
.profile-tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; background: var(--surface-dark); border-radius: 999px; padding: 4px; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.media-grid > div { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-dark); }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Explore ---------- */
.hashtag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.hashtag-chip { padding: 8px 14px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.suggested-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 18px; }
.suggested-card { flex-shrink: 0; width: 130px; padding: 14px 10px; text-align: center; }
.suggested-card .avatar { margin: 0 auto 8px; }
.suggested-card .name { font-weight: 700; font-size: 12.5px; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explore-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.explore-grid > div { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-dark); }
.explore-grid img, .explore-grid video { width: 100%; height: 100%; object-fit: cover; }
.search-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; margin-bottom: 16px; border-radius: 999px; }
.search-bar input { flex: 1; }

/* ---------- Notifications ---------- */
.notif-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.notif-row.unread { background: var(--bg); }
.notif-row .text { flex: 1; font-size: 13.5px; font-weight: 400; color: var(--ink-75); }
.notif-row .text b { font-weight: 700; color: var(--ink); }
.notif-row .time { font-size: 11px; color: var(--ink-50); }

/* ---------- Messages ---------- */
.convo-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 2px; }
.convo-row:hover { background: var(--bg); }
.convo-row .meta { flex: 1; min-width: 0; }
.convo-row .name { font-weight: 700; font-size: 14px; }
.convo-row .last { font-size: 12.5px; font-weight: 500; color: var(--ink-50); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }

.chat-view { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 8px; }
.msg-bubble { max-width: 75%; padding: 10px 14px; border-radius: 18px; font-size: 14px; font-weight: 400; }
.msg-bubble.mine { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--bg); color: var(--ink); border-bottom-left-radius: 6px; }
.chat-input-row { display: flex; gap: 10px; padding: 10px 4px; align-items: center; }
.chat-input-row .clay-inset { flex: 1; padding: 12px 16px; border-radius: 999px; }
.chat-input-row input { width: 100%; }
.typing-indicator { font-size: 11px; color: var(--ink-50); padding: 0 8px; height: 16px; }

/* ---------- Reels ---------- */
.reels-feed { height: calc(100vh - 100px); overflow-y: auto; scroll-snap-type: y mandatory; }
.reel-item { height: calc(100vh - 100px); scroll-snap-align: start; position: relative; display: flex; align-items: center; justify-content: center; background: #000; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 12px; }
.reel-item video { width: 100%; height: 100%; object-fit: cover; }
.reel-overlay { position: absolute; bottom: 16px; left: 16px; right: 70px; color: #fff; font-size: 13px; background: rgba(0,0,0,0.5); padding: 8px 10px; border-radius: var(--radius-sm); }
.reel-rail { position: absolute; right: 10px; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.reel-rail .post-action { flex-direction: column; color: #fff; font-size: 11px; font-weight: 700; gap: 2px; }
.reel-rail .post-action .icon path, .reel-rail .post-action .icon circle { fill: #fff; opacity: 1; }
.reel-rail .post-action-like.liked .icon path, .reel-rail .post-action-like.liked .icon circle { fill: var(--danger); }

/* ---------- Modal / composer ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,15,20,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 60; animation: fadeIn 150ms ease; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal-sheet { background: var(--surface); border-radius: 28px 28px 0 0; padding: 20px 20px 26px; width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; animation: foldIn 200ms ease-out; box-shadow: var(--shadow-hard); }
@media (min-width: 640px) { .modal-sheet { border-radius: 24px; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.close-x { background: var(--bg); width: 32px; height: 32px; border-radius: 50%; border: none; font-size: 14px; cursor: pointer; color: var(--ink-75); }
.composer-textarea { width: 100%; min-height: 110px; border: none; resize: vertical; padding: 14px 16px; font-size: 14.5px; font-weight: 400; }
.visibility-select { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.vis-chip { padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; background: transparent; color: var(--ink-75); border: var(--border-w) solid var(--surface-dark); }
.vis-chip.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.media-preview-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; }
.media-preview-row img, .media-preview-row video { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; }

/* ---------- Edit-profile photo pickers ---------- */
.edit-cover-wrap {
  height: 110px; border-radius: var(--radius-md); background: var(--bg) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; cursor: pointer; margin-bottom: -36px;
  border: var(--border-w) solid var(--surface-dark);
}
.edit-cover-hint {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--ink-75);
  background: var(--surface); padding: 7px 12px; border-radius: 999px; box-shadow: var(--shadow-hard-sm);
}
.edit-avatar-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.edit-photo-badge {
  position: absolute; bottom: 0; right: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink); display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}
.edit-photo-badge svg { width: 15px; height: 15px; }

/* ---------- Story viewer ---------- */
.story-viewer { position: fixed; inset: 0; background: #000; z-index: 80; display: flex; flex-direction: column; }
.story-viewer-bars { display: flex; gap: 4px; padding: 10px 10px 0; }
.story-viewer-bars > div { flex: 1; height: 3px; background: rgba(255,255,255,0.3); border-radius: 2px; overflow: hidden; }
.story-viewer-bars > div > span { display: block; height: 100%; background: #fff; width: 0%; }
.story-viewer-head { display: flex; align-items: center; gap: 10px; padding: 12px; color: #fff; }
.story-viewer-media { flex: 1; display: flex; align-items: center; justify-content: center; }
.story-viewer-media img, .story-viewer-media video { max-width: 100%; max-height: 100%; }

/* ---------- Empty / loading ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-50); font-weight: 500; font-size: 13.5px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 2.5px solid var(--surface-dark); border-top-color: var(--ink); animation: spin 700ms linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%) translateY(-60px);
  background: var(--ink); color: var(--on-ink); padding: 11px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 100; opacity: 0;
  transition: transform 250ms var(--ease-out-back), opacity 250ms;
  box-shadow: var(--shadow-hard);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ---------- Badge dot for nav ---------- */
.badge-dot {
  position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; padding: 0 3px;
  background: var(--danger); border-radius: 999px; color: #fff; font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; animation: popIn 260ms var(--ease-out-back);
}
.nav-btn { position: relative; }
@media (min-width: 900px) {
  .bottom-nav { display: none; }
}

/* ---------- Settings ---------- */
.settings-section { font-weight: 800; font-size: 13px; margin: 20px 0 10px; color: var(--secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: var(--border-w) solid var(--surface-dark); }
.settings-row:last-child { border-bottom: none; }
.settings-row .label { font-weight: 700; font-size: 14px; }
.settings-row .sub { font-size: 12px; font-weight: 500; color: var(--ink-50); }
.bg-preview { width: 100%; height: 100px; border-radius: var(--radius-sm); border: var(--border-w) solid var(--surface-dark); background: var(--bg) center/cover no-repeat; margin-bottom: 12px; }

/* ---------- Profile background (user-uploadable) ---------- */
.profile-bg-wrap { position: relative; margin: -16px -12px 16px; overflow: hidden; }
.profile-bg-wrap::before {
  content: ''; position: absolute; inset: 0; background: rgba(0,0,0,0.38);
}
.profile-bg-wrap .profile-bg-inner { position: relative; padding: 16px 12px 0; }
.profile-bg-wrap .profile-bg-inner { color: #fff; }
.profile-bg-wrap .profile-name, .profile-bg-wrap .profile-username,
.profile-bg-wrap .profile-bio, .profile-bg-wrap .profile-stats span { color: #fff; }
.profile-bg-wrap .profile-stats b { color: #fff; }
.profile-bg-wrap .btn-ghost { background: rgba(255,255,255,0.92); border-color: transparent; }

/* ---------- Saved posts ---------- */
.saved-hint { font-size: 12.5px; font-weight: 500; color: var(--ink-50); margin-bottom: 14px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-dark); border-radius: 8px; }
