/* ─────────────────────────────────────────────────────────────────
   Moonkees — Dark Social Stylesheet
   Strategy: ONE responsive layout. No "switch app" between mobile and
   desktop — pure fluid CSS-grid + named areas so every page lands
   in the right column even if it omits a rail.
   ───────────────────────────────────────────────────────────────── */

:root {
  --bg:           #0b0d12;
  --bg-1:         #11141b;
  --bg-2:         #161a23;
  --bg-3:         #1d2230;
  --bg-hover:     #232938;
  --border:       #232938;
  --border-soft:  #1a1e29;

  --text:         #e7eaf1;
  --text-muted:   #8a93a6;
  --text-dim:     #5a6275;

  --primary:      #7c5cff;
  --primary-2:    #a78bfa;
  --primary-soft: rgba(124, 92, 255, .15);
  --accent:       #22d3ee;
  --like:         #ec4899;
  --repost:       #10b981;
  --flipcash:     #f59e0b;
  --danger:       #ef4444;

  --grad:         linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --grad-soft:    linear-gradient(135deg, rgba(124,92,255,.18), rgba(34,211,238,.10));

  --shadow:       0 6px 28px rgba(0,0,0,.45);
  --shadow-soft:  0 2px 10px rgba(0,0,0,.30);
  --radius:       16px;
  --radius-sm:    10px;
  --radius-pill:  9999px;

  color-scheme: dark;
}

* { box-sizing: border-box; min-width: 0; }
html, body {
  background: var(--bg);
  /* Hard guard against any descendant accidentally overflowing the
     viewport — long URLs, wide images, runaway flex children, etc. */
  overflow-x: hidden;
  max-width: 100%;
}
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  margin: 0; padding: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

a { color: var(--primary-2); text-decoration: none; transition: color .12s; }
a:hover { color: var(--accent); }
hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
img { max-width: 100%; }
button { font-family: inherit; }

/* Form controls — same look everywhere, expand inside flex rows */
input, textarea, select {
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; outline: none;
  font-size: .95rem;
  width: 100%; min-width: 0;       /* min-width:0 lets flex items shrink */
  transition: border-color .15s, box-shadow .15s;
}
form > input, form > textarea, form > select { flex: 1 1 auto; }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type=checkbox], input[type=radio] { width: auto; }

::selection { background: var(--primary-soft); }

/* Custom scrollbar (subtle) */
::-webkit-scrollbar        { width: 10px; height: 10px; }
::-webkit-scrollbar-track  { background: var(--bg); }
::-webkit-scrollbar-thumb  { background: var(--bg-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ── NAVBAR ─────────────────────────────────────────────────────── */
.navbar {
  background: rgba(11,13,18,.85);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000;
  padding: 8px 0;
}
.navbar-brand {
  font-weight: 900; font-size: 1.4rem;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: -.02em;
  display: inline-flex; align-items: center; gap: 4px;
}
.nav-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  position: relative;
  font-size: 1.05rem;
}
.nav-icon-btn:hover { background: var(--bg-3); color: var(--primary-2); }
.notification-count {
  position: absolute; top: -2px; right: -3px;
  background: var(--like); color: #fff;
  font-size: .65rem; font-weight: 900;
  border-radius: 9999px; padding: 1px 5px;
  min-width: 16px; text-align: center; line-height: 1.3;
  border: 2px solid var(--bg);
}
.nav-profile-thumb {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
  transition: border-color .15s;
}
.nav-profile-thumb:hover { border-color: var(--primary); }

/* ── DROPDOWN ──────────────────────────────────────────────────── */
.dropdown-menu {
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 6px;
  color: var(--text);
}
.dropdown-item {
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-weight: 600;
  font-size: .92rem;
  transition: background .12s;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--bg-3);
  color: var(--primary-2);
}
.dropdown-divider { border-color: var(--border); margin: 4px 6px; }
.dropdown-header  {
  color: var(--text-dim); font-size: .68rem; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 10px 12px 4px;
}

.acct-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text);
  transition: background .12s;
}
.acct-row:hover { background: var(--bg-3); }
.acct-row img   { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.acct-row .acct-name { font-weight: 800; font-size: .9rem; line-height: 1.2; }
.acct-row .acct-handle { color: var(--text-muted); font-size: .76rem; }
.acct-row .acct-active { margin-left: auto; color: var(--accent); font-size: .9rem; }

/* ── CATEGORY PILLS ────────────────────────────────────────────── */
.category-nav {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }
.category-nav-inner {
  display: inline-flex; gap: 6px;
  padding: 10px 14px; white-space: nowrap;
}
.cat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; font-size: .82rem; font-weight: 800;
  background: var(--bg-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  transition: all .15s;
}
.cat-pill:hover { color: var(--primary-2); border-color: var(--primary); }
.cat-pill.active {
  background: var(--grad-soft); color: var(--text);
  border-color: var(--primary);
}

/* ── PAGE LAYOUT (named grid areas — order-independent) ──────────
   Mobile (default): main column on top, right rail stacked below
                     (so trending hashtags + flipcash trending are
                     reachable without losing the timeline-first feed).
   Tablet ≥800: main + right side-by-side.
   Desktop ≥1100: left + main + right three columns.
*/
.page-content-wrapper {
  display: grid;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "main"
    "right";
}
@media (min-width: 800px) {
  .page-content-wrapper {
    grid-template-columns: minmax(0, 1fr) 320px;
    grid-template-areas: "main right";
  }
}
@media (min-width: 1100px) {
  .page-content-wrapper {
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    grid-template-areas: "left main right";
  }
}
.page-content-wrapper > main         { grid-area: main; min-width: 0; }
.page-content-wrapper > .left-rail   { grid-area: left;  display: none; }
.page-content-wrapper > .right-rail  { grid-area: right; display: block; }
@media (min-width: 1100px) { .page-content-wrapper > .left-rail  { display: block; } }

/* Single-column variant for auth / settings */
.page-content-wrapper.narrow {
  grid-template-columns: minmax(0, 560px);
  grid-template-areas: "main";
  justify-content: center;
}
.page-content-wrapper.narrow > .left-rail,
.page-content-wrapper.narrow > .right-rail { display: none !important; }

/* Sticky only kicks in once we have side-by-side columns (≥800).
   On mobile the rails scroll with the page. */
.left-rail, .right-rail { align-self: start; }
@media (min-width: 800px) {
  .left-rail, .right-rail { position: sticky; top: 80px; }
}

.rail-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.rail-card h3 {
  font-size: .72rem; font-weight: 900;
  color: var(--text-dim); letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 12px;
  display: flex; align-items: center; gap: 6px;
}

/* ── COMPOSER ──────────────────────────────────────────────────── */
.composer {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
}
.composer .composer-avatar {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border);
}
.composer textarea {
  width: 100%; min-height: 84px; resize: vertical;
  background: transparent; border: none; padding: 8px 0;
  color: var(--text); font-size: 1.1rem; line-height: 1.45;
}
.composer textarea:focus { box-shadow: none; }
.composer textarea::placeholder { color: var(--text-dim); }
.composer-actions {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px;
}
.composer-actions .icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--primary-2); background: transparent; border: none;
  cursor: pointer; transition: background .15s;
}
.composer-actions .icon-btn:hover { background: var(--primary-soft); }
.composer-preview { font-size: .78rem; color: var(--text-muted); }

/* ── BUTTONS ───────────────────────────────────────────────────── */
.btn-primary-mk {
  margin-left: auto;
  background: var(--grad); color: #fff;
  border: none; border-radius: var(--radius-pill);
  padding: 9px 22px; font-weight: 900; font-size: .9rem;
  cursor: pointer; transition: filter .15s, transform .05s;
  box-shadow: 0 4px 14px rgba(124,92,255,.35);
}
.btn-primary-mk:hover { filter: brightness(1.08); }
.btn-primary-mk:active { transform: translateY(1px); }
.btn-primary-mk:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost-mk {
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 7px 16px; font-weight: 800; font-size: .85rem;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.btn-ghost-mk:hover { border-color: var(--primary); color: var(--primary-2); }

.btn-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-3); color: var(--text-muted);
  border: 1px solid var(--border); cursor: pointer;
  transition: all .15s;
}
.btn-icon:hover { color: var(--primary-2); border-color: var(--primary); }

/* ── POST CARD ─────────────────────────────────────────────────── */
.post-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color .15s, transform .05s;
}
.post-card:hover { border-color: var(--bg-hover); }
.post-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 6px;
}
.post-head .av {
  width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); flex-shrink: 0;
}
.post-head .who { line-height: 1.25; min-width: 0; flex: 1; }
.post-head .who-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0; }
.post-head .name { font-weight: 900; color: var(--text); font-size: .96rem; }
.post-head .handle { color: var(--text-muted); font-size: .82rem; }
.post-head .dot { color: var(--text-dim); margin: 0 4px; }
.post-head .verified { color: var(--accent); font-size: .85rem; margin-left: 2px; }
.post-head time { color: var(--text-muted); font-size: .82rem; }
.post-head .tagline {
  color: var(--text-muted); font-size: .8rem; font-weight: 600;
  margin-top: 1px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis;
}

/* Profile-page tagline — bigger / more prominent */
.profile-tagline {
  color: var(--primary-2);
  font-size: .95rem; font-weight: 700;
  margin: 2px 0 4px;
  line-height: 1.35;
}

.post-body {
  margin: 4px 0 0;
  padding-left: 58px;
  font-size: 1rem; line-height: 1.55;
  color: var(--text);
  word-wrap: break-word; white-space: pre-wrap;
}
.post-photo {
  margin: 10px 0 0 58px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  display: block;
  max-height: 600px;
}
.post-photo img { width: 100%; display: block; max-height: 600px; object-fit: cover; }

.repost-tag {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; color: var(--text-muted);
  margin-bottom: 8px; padding-left: 30px;
}
.repost-tag a { color: var(--text-muted); }

.mk-link { color: var(--accent); word-break: break-all; overflow-wrap: anywhere; }
/* Make sure every kind of link inside post / comment / quote / message
   bodies wraps at any character — long URLs, hashes, file paths.        */
.post-body, .comment .body, .quote-body, .message-bubble {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.post-body a, .comment .body a, .quote-body a, .message-bubble a {
  word-break: break-all;
  overflow-wrap: anywhere;
}
.mk-link-flipcash {
  color: var(--flipcash);
  background: rgba(245,158,11,.12);
  padding: 1px 8px; border-radius: 6px;
  font-weight: 800; border: 1px solid rgba(245,158,11,.3);
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
  display: inline-block;
}
.mk-link-locked {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  text-decoration: none;
  background: rgba(124,92,255,.12);
  border-color: rgba(124,92,255,.4);
  color: var(--primary-2);
  user-select: none;
}
.mk-link-locked:hover {
  background: rgba(124,92,255,.22);
  color: var(--text);
  border-color: var(--primary);
}
.mk-link-locked i { font-size: .78em; }
.mk-tag, .mk-mention { color: var(--primary-2); font-weight: 700; }
.mk-tag:hover, .mk-mention:hover { color: var(--accent); }

.post-actions {
  display: flex; gap: 4px; padding-left: 58px;
  margin-top: 10px;
}
.post-action {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; color: var(--text-muted);
  border: none; padding: 8px 0; border-radius: var(--radius-sm);
  cursor: pointer; font-size: .85rem; font-weight: 700;
  transition: background .12s, color .12s;
  max-width: 120px;
}
.post-action:hover { background: var(--bg-3); color: var(--primary-2); }
.post-action.liked    { color: var(--like); }
.post-action.liked:hover { background: rgba(236,72,153,.12); }

/* Split like action: heart toggles, count opens likers modal */
.post-action.like-action {
  flex: 1; max-width: 120px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0;
  color: var(--text-muted);
}
.post-action.like-action.liked { color: var(--like); }
.post-action.like-action button {
  background: transparent; border: none; cursor: pointer;
  color: inherit; font: inherit; font-weight: 700;
  padding: 8px 6px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s, color .12s;
}
.post-action.like-action button:hover { background: var(--bg-3); }
.post-action.like-action.liked button:hover { background: rgba(236,72,153,.12); color: var(--like); }
.post-action.like-action .like-toggle i { font-size: 1rem; }
.post-action.like-action .like-count    { font-size: .85rem; }
.post-action.reposted { color: var(--repost); }
.post-action.reposted:hover { background: rgba(16,185,129,.12); }
.post-action i { font-size: 1rem; }

.flipcash-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 900;
  color: var(--flipcash);
  background: rgba(245,158,11,.12);
  border: 1px solid rgba(245,158,11,.4);
  padding: 2px 9px; border-radius: var(--radius-pill);
  margin-left: 6px; vertical-align: middle;
}

/* ── EMBEDDED QUOTE CARD (quote-repost) ───────────────────────── */
.quote-card {
  display: block;
  margin: 10px 0 0 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  padding: 12px 14px;
  color: var(--text);
  transition: border-color .12s, background .12s;
}
.quote-card.embedded:hover { border-color: var(--primary); background: var(--bg-3); }
.quote-head {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; line-height: 1.2;
}
.quote-head .qav {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.quote-head .qwho { display: flex; align-items: center; gap: 0; flex-wrap: wrap; min-width: 0; }
.quote-head .qname { font-weight: 900; color: var(--text); margin-right: 4px; }
.quote-head .qhandle { color: var(--text-muted); }
.quote-head .verified { color: var(--accent); font-size: .8rem; margin-left: 2px; }
.quote-head .dot { color: var(--text-dim); margin: 0 4px; }
.quote-body {
  margin-top: 6px;
  color: var(--text); font-size: .92rem; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.quote-photo {
  margin-top: 8px;
  border-radius: var(--radius-sm); overflow: hidden;
  max-height: 280px; background: #000;
}
.quote-photo img { width: 100%; max-height: 280px; object-fit: cover; display: block; }

/* When quote-card sits inside the composer, it's not embedded-link */
.composer .quote-card { margin-left: 0; margin-top: 12px; }

/* ── REPOST DROPDOWN WRAPPER ──────────────────────────────────── */
.post-action-wrap { flex: 1; max-width: 120px; display: inline-flex; }
.post-action-wrap .post-action { width: 100%; max-width: none; }
.post-action-wrap .dropdown-menu .dropdown-item {
  font-size: .88rem;
  display: flex; align-items: center;
}

/* ── INSTAGRAM MODE ────────────────────────────────────────────── */
body.view-instagram .feed-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px;
}
body.view-instagram .post-card {
  padding: 0; border-radius: 4px; margin: 0;
  position: relative; overflow: hidden;
  aspect-ratio: 1 / 1;
}
body.view-instagram .post-head,
body.view-instagram .post-body,
body.view-instagram .post-actions,
body.view-instagram .repost-tag { display: none; }
body.view-instagram .post-photo {
  margin: 0; border: none; border-radius: 0;
  width: 100%; height: 100%;
}
body.view-instagram .post-photo img {
  width: 100%; height: 100%; object-fit: cover; max-height: none;
}
body.view-instagram .post-card.no-photo {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); padding: 18px; text-align: center;
}
body.view-instagram .post-card.no-photo .post-body {
  display: block; color: var(--text);
  font-weight: 800; font-size: .92rem;
  padding-left: 0; max-height: 100%; overflow: hidden;
}
body.view-instagram .post-card:hover {
  transform: scale(1.02); border-color: var(--primary);
}

/* ── COMMENTS ──────────────────────────────────────────────────── */
.comment-form {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px;
}
.comment-form .av {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.comment-form input { flex: 1 1 auto; min-width: 0; }
.comment-form button.send {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--grad); color: #fff; border: none;
  cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: filter .15s;
}
.comment-form button.send:hover { filter: brightness(1.1); }

.comment-list { margin-top: 4px; }
.comment {
  display: flex; gap: 12px; padding: 12px 0;
  border-top: 1px solid var(--border-soft);
}
.comment:first-child { border-top: none; padding-top: 0; }
.comment .av { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment .who { flex: 1; min-width: 0; }
.comment .body { font-size: .92rem; color: var(--text); line-height: 1.45; }
.comment .meta { color: var(--text-muted); font-size: .74rem; margin-top: 2px; }

/* ── PROFILE HEADER ────────────────────────────────────────────── */
.profile-cover {
  height: 200px;
  background: var(--grad);
  border-radius: var(--radius);
  margin-bottom: -56px;
  background-size: cover; background-position: center;
}
.profile-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  margin-bottom: 14px;
}
.profile-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-top: -78px; margin-bottom: 12px;
}
.profile-avatar {
  width: 110px; height: 110px; border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
  background: var(--bg-3);
  box-shadow: var(--shadow-soft);
}
.profile-actions {
  display: flex; gap: 8px; align-items: center; padding-top: 80px;
}
.profile-name {
  font-weight: 900; font-size: 1.5rem; line-height: 1.1;
  margin: 8px 0 2px;
}
.profile-handle { color: var(--text-muted); font-size: .92rem; margin-bottom: 10px; }
.profile-bio { margin: 8px 0 12px; color: var(--text); line-height: 1.5; }
.profile-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  color: var(--text-muted); font-size: .85rem;
}
.profile-meta i { margin-right: 4px; }
.profile-stats { display: flex; gap: 22px; margin-top: 12px; flex-wrap: wrap; }
.profile-stats span, .profile-stats a {
  color: var(--text-muted); font-size: .9rem; text-decoration: none;
  transition: color .12s;
}
.profile-stats span b, .profile-stats a b { color: var(--text); font-weight: 900; margin-right: 4px; }
.profile-stats a:hover { color: var(--primary-2); }
.profile-stats a:hover b { color: var(--primary-2); }

/* Click-to-edit avatar on the profile page */
.profile-avatar-edit {
  position: relative; display: inline-block; cursor: pointer;
  border-radius: 50%;
}
.profile-avatar-edit .profile-avatar { display: block; transition: filter .15s; }
.profile-avatar-edit:hover .profile-avatar { filter: brightness(.7); }
.profile-avatar-overlay {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.6rem;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
  border: 4px solid var(--bg);     /* match the avatar frame */
}
.profile-avatar-edit:hover .profile-avatar-overlay { opacity: 1; }

/* Instant-upload tiles in edit-profile */
.instant-upload {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 4px;
}
.instant-upload-tile {
  position: relative; cursor: pointer; flex-shrink: 0;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: var(--bg-3);
  overflow: hidden;
  border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.instant-upload-tile:hover { border-color: var(--primary); }
.instant-upload-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.instant-upload-tile.cover {
  width: 240px; height: 96px; border-radius: var(--radius);
}
.instant-upload-hint {
  position: absolute; inset: 0;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; color: #fff; font-size: .82rem; font-weight: 800;
  background: rgba(0,0,0,.55); opacity: 0;
  transition: opacity .15s;
}
.instant-upload-tile:hover .instant-upload-hint { opacity: 1; }
/* Always show the hint when there's no image (empty cover) */
.instant-upload-tile img[src=""] + .instant-upload-hint,
.instant-upload-tile img:not([src]) + .instant-upload-hint {
  opacity: 1;
}
.instant-upload-meta { min-width: 0; }

.follow-btn-toggle.following { background: var(--bg-3); color: var(--text); box-shadow: none; }
.follow-btn-toggle.following:hover::after { content: ' (Unfollow)'; color: var(--like); font-size: .85em; }

/* ── BANNERS ───────────────────────────────────────────────────── */
.install-banner {
  background: var(--grad);
  color: #fff; text-align: center;
  padding: 12px 50px 12px 16px;
  font-weight: 800; font-size: .9rem;
  position: relative;
}
.install-banner button.cta {
  background: #fff; color: var(--primary);
  border: none; border-radius: var(--radius-pill);
  padding: 6px 16px; font-weight: 900; margin-left: 12px; cursor: pointer;
  font-size: .85rem;
}
.install-banner button.dismiss {
  background: none; border: none; color: rgba(255,255,255,.85);
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1.3rem; cursor: pointer; line-height: 1;
}

/* ── VIEW-MODE TOGGLE ──────────────────────────────────────────── */
.view-toggle {
  display: inline-flex; gap: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 3px;
}
.view-toggle button {
  background: transparent; border: none;
  padding: 6px 14px; font-size: .85rem; font-weight: 800;
  color: var(--text-muted); border-radius: var(--radius-pill);
  cursor: pointer; transition: all .15s;
}
.view-toggle button:hover { color: var(--text); }
.view-toggle button.active {
  background: var(--grad); color: #fff;
  box-shadow: 0 2px 10px rgba(124,92,255,.4);
}

/* ── AUTH FORMS ────────────────────────────────────────────────── */
.auth-card {
  max-width: 440px; margin: 40px auto;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.auth-card h1 {
  font-weight: 900; font-size: 1.7rem; margin: 0 0 4px;
  background: var(--grad);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-card p.sub { color: var(--text-muted); margin-bottom: 22px; line-height: 1.5; }
.auth-card label {
  font-size: .78rem; font-weight: 800; color: var(--text-muted);
  display: block; margin: 14px 0 6px; letter-spacing: .04em;
  text-transform: uppercase;
}
.auth-card .btn-primary-mk { width: 100%; margin-top: 22px; padding: 13px; font-size: 1rem; }

.auth-error {
  background: rgba(239,68,68,.12); color: #fca5a5;
  border: 1px solid rgba(239,68,68,.4);
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: .88rem; margin-bottom: 14px;
}
.auth-success {
  background: rgba(16,185,129,.12); color: #6ee7b7;
  border: 1px solid rgba(16,185,129,.4);
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: .88rem; margin-bottom: 14px;
}

/* Show/hide password toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; top: 50%; right: 6px;
  transform: translateY(-50%);
  background: transparent; border: none;
  color: var(--text-muted);
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: .95rem;
  transition: color .12s, background .12s;
}
.pw-toggle:hover { color: var(--primary-2); background: var(--bg-3); }

/* ── RAIL ITEMS ────────────────────────────────────────────────── */
.rail-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-weight: 700; font-size: .92rem;
  transition: background .12s, color .12s;
}
.rail-link:hover { background: var(--bg-3); color: var(--primary-2); }
.rail-link i { width: 20px; text-align: center; color: var(--text-muted); font-size: 1rem; }
.rail-link:hover i { color: var(--primary-2); }
.rail-link.active { background: var(--primary-soft); color: var(--text); }
.rail-link.active i { color: var(--primary-2); }

.trend-row {
  display: block; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
.trend-row:last-child { border-bottom: none; padding-bottom: 0; }
.trend-row:hover { color: var(--primary-2); }
.trend-row .trend-handle { color: var(--text-muted); font-size: .78rem; }
.trend-row .trend-snippet {
  color: var(--text); font-weight: 700; font-size: .88rem;
  margin-top: 3px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Trending hashtags list */
.trending-tags { display: flex; flex-direction: column; gap: 2px; }
.trend-tag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background .12s, color .12s;
}
.trend-tag-row:hover { background: var(--bg-3); color: var(--primary-2); }
.trend-tag-rank {
  flex-shrink: 0;
  width: 22px; text-align: right;
  color: var(--text-dim); font-weight: 900; font-size: .82rem;
}
.trend-tag-name {
  flex: 1; min-width: 0;
  font-weight: 800; color: var(--primary-2); font-size: .92rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trend-tag-row:hover .trend-tag-name { color: var(--accent); }
.trend-tag-count {
  flex-shrink: 0;
  color: var(--text-muted); font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

/* ── PAGE TITLES ───────────────────────────────────────────────── */
.page-title {
  font-weight: 900; margin: 0 0 14px;
  font-size: 1.5rem; line-height: 1.2;
  display: flex; align-items: center; gap: 10px;
}
.page-title-sub { color: var(--text-muted); margin: 0 0 16px; font-size: .92rem; }

/* ── EMPTY STATE ───────────────────────────────────────────────── */
.empty {
  text-align: center; color: var(--text-muted);
  padding: 40px 20px; line-height: 1.5;
  background: var(--bg-1); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty i { font-size: 2rem; color: var(--text-dim); margin-bottom: 10px; display: block; }

/* ── MOBILE BOTTOM NAV ─────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(11,13,18,.95);
  backdrop-filter: saturate(140%) blur(10px);
  border-top: 1px solid var(--border);
  padding: 8px 4px env(safe-area-inset-bottom, 8px);
  z-index: 1000;
  justify-content: space-around;
}
.mobile-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; color: var(--text-muted); font-size: .65rem;
  font-weight: 700; border-radius: var(--radius-sm);
  transition: color .15s; min-width: 56px;
}
.mobile-nav a:hover, .mobile-nav a.active { color: var(--primary-2); }
.mobile-nav a i { font-size: 1.25rem; }
.mobile-nav a.compose i {
  background: var(--grad); color: #fff;
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(124,92,255,.4);
}
@media (max-width: 799px) {
  .mobile-nav { display: flex; }
  body { padding-bottom: 80px; }
}

/* ── COMPOSE MODAL (mobile) ────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 2000;
  display: none; align-items: flex-start; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 540px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.modal-close {
  background: var(--bg-3); border: none; color: var(--text);
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; float: right;
}

/* ── FOOTER ────────────────────────────────────────────────────── */
.mk-footer {
  text-align: center; color: var(--text-dim);
  padding: 30px 0 80px; font-size: .8rem;
}
.mk-footer a { color: var(--text-muted); margin: 0 10px; }
.mk-footer a:hover { color: var(--primary-2); }

/* ── NOTIFICATIONS LIST ────────────────────────────────────────── */
.notif-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: border-color .12s, background .12s;
}
.notif-row:hover { border-color: var(--bg-hover); background: var(--bg-2); }
.notif-icon {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-3);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1rem;
}
.notif-avatar { flex-shrink: 0; }
.notif-avatar img {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; display: block;
  border: 2px solid var(--border);
}
.notif-body {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.notif-text {
  flex: 1; min-width: 0;
  font-weight: 700; font-size: .92rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-handle {
  color: var(--primary-2); font-weight: 900;
}
.notif-handle:hover { color: var(--accent); }
.notif-time {
  color: var(--text-muted); font-size: .76rem;
  flex-shrink: 0; white-space: nowrap;
}

/* ── MESSAGES PAGE ─────────────────────────────────────────────── */
.messages-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
}
@media (max-width: 700px) {
  .messages-grid { grid-template-columns: 1fr; }
}
.message-bubble {
  max-width: 75%;
  padding: 10px 14px 6px;
  border-radius: 16px;
  line-height: 1.4; font-size: .94rem;
  word-wrap: break-word;
}
.message-bubble.mine   { background: var(--primary-soft); border: 1px solid var(--primary); }
.message-bubble.theirs { background: var(--bg-3); border: 1px solid var(--border); }
.message-bubble .msg-time {
  color: var(--text-muted); font-size: .68rem;
  margin-top: 4px; text-align: right;
}

/* Conversation list — one-line ellipsised preview */
.acct-row .acct-handle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.acct-row > div { min-width: 0; flex: 1; overflow: hidden; }

/* ── UTILITY ───────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.text-dim   { color: var(--text-dim)   !important; }
code {
  background: var(--bg-3); color: var(--accent);
  padding: 2px 6px; border-radius: 4px; font-size: .85em;
}

/* Hide bootstrap things we don't want */
.dropdown-toggle::after { display: none; }

/* ── MOBILE POLISH (≤ 600 px) — make it feel like a native app ───
   Goal: tight, touch-friendly, never bleeds horizontally. */
@media (max-width: 600px) {
  .page-content-wrapper { padding: 12px 10px; gap: 10px; }
  .navbar .container-fluid { padding-left: 10px !important; padding-right: 10px !important; }

  .post-card { padding: 12px 12px 10px; border-radius: 12px; margin-bottom: 8px; }

  /* Reduce the avatar gutter so 320px screens have more room for text */
  .post-body, .post-actions { padding-left: 0; }
  .post-photo               { margin-left: 0; }
  .quote-card               { margin-left: 0; }
  .repost-tag               { padding-left: 0; }

  /* Stack head into a column-friendly layout */
  .post-head .av { width: 38px; height: 38px; }
  .post-head .name   { font-size: .92rem; }
  .post-head .handle, .post-head time { font-size: .78rem; }
  .post-head .dot { margin: 0 3px; }

  /* Photo never overshoots the card */
  .post-photo, .post-photo img { max-width: 100%; max-height: 480px; }

  /* Comments tighter */
  .comment { gap: 10px; padding: 10px 0; }
  .comment .av { width: 32px; height: 32px; }

  /* Rail cards have less padding on mobile */
  .rail-card { padding: 12px; border-radius: 12px; }

  /* Composer */
  .composer { padding: 12px; grid-template-columns: 40px 1fr; gap: 10px; }
  .composer .composer-avatar { width: 40px; height: 40px; }
  .composer textarea { font-size: 1rem; min-height: 64px; }

  /* Profile header stacks more nicely */
  .profile-card-top { flex-direction: column; align-items: flex-start; gap: 12px; margin-top: -68px; }
  .profile-actions  { padding-top: 0; align-self: flex-end; }
  .profile-avatar   { width: 90px; height: 90px; }
  .profile-name     { font-size: 1.3rem; }
  .profile-cover    { height: 140px; margin-bottom: -46px; }

  /* Make like/repost/comment rows breathe */
  .post-action            { padding: 10px 0; font-size: .82rem; }
  .post-action.like-action button { padding: 10px 6px; }

  /* Auth cards full width */
  .auth-card { margin: 16px 0; padding: 20px; border-radius: 12px; }

  /* Messages — stack the conversation list above the thread on phones */
  .messages-grid { grid-template-columns: 1fr; }

  /* Tablet Bootstrap container paddings can sometimes leak — neutralise */
  .container-fluid { max-width: 100%; padding-left: 10px; padding-right: 10px; }
}

/* Tighten further on really small screens */
@media (max-width: 360px) {
  .post-card { padding: 10px; }
  .rail-card { padding: 10px; }
  .navbar-brand { font-size: 1.2rem; }
}
