:root {
  /* Brand — Aura blue → violet gradient; gold aura + violet vibes accents. */
  --brand: #3b82ff;
  --brand-2: #7c5cff;
  --brand-grad: linear-gradient(135deg, #3b82ff 0%, #7c5cff 100%);
  --blue: #3b6dff;          /* alias kept so existing rules pick up the new brand */
  --blue-dark: #2f5fe6;
  --green: #22c55e;
  --green-dark: #16a34a;
  --aura: #f0a03a;
  --vibe: #9b6bff;

  --bg: #eaeef6;
  --text: #0d1220;
  --text-2: #59606e;
  --border: rgba(20, 24, 40, 0.09);

  /* Frosted-glass surfaces */
  --card: rgba(255, 255, 255, 0.66);
  --sheet: #ffffff;           /* solid surface for slide-up sheets (readable, opaque) */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-blur: saturate(180%) blur(22px);
  --hover: rgba(20, 24, 40, 0.05);

  --radius: 20px;
  --radius-sm: 13px;
  --shadow: 0 8px 30px rgba(20, 24, 40, 0.08), 0 1px 2px rgba(20, 24, 40, 0.04);
  --shadow-lg: 0 24px 60px rgba(20, 24, 40, 0.16);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI',
    Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 620px at 8% -8%, rgba(124, 92, 255, 0.14), transparent 60%),
    radial-gradient(1000px 560px at 100% 2%, rgba(59, 130, 255, 0.13), transparent 55%),
    radial-gradient(900px 720px at 50% 118%, rgba(255, 168, 76, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden; /* safety net: never let a wide row cause sideways scroll */
}

/* Sleek inline icons inherit text colour + size crisply. */
.ic { display: inline-block; vertical-align: middle; flex: none; }
.svg-defs { position: absolute; width: 0; height: 0; pointer-events: none; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 2px 20px rgba(20, 24, 40, 0.05);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-mark { display: inline-flex; filter: drop-shadow(0 2px 6px rgba(124, 92, 255, 0.35)); }
.nav-links { display: flex; gap: 4px; }
.nav-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 22px;
  border-radius: 14px;
  color: var(--text-2);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-icon span { font-size: 11px; margin-top: 3px; font-weight: 600; }
.nav-icon:hover { background: var(--hover); color: var(--text); }
.nav-icon.active { color: var(--brand); }
.nav-icon.active .ic { filter: drop-shadow(0 2px 8px rgba(59, 109, 255, 0.35)); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-me { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 20px; }
.nav-me:hover { background: var(--hover); }
.nav-me-name { font-weight: 600; font-size: 14px; }

/* ---------- Layout ---------- */
.app-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.auth-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}
.container { max-width: 1100px; margin: 0 auto; }
.narrow { max-width: 680px; }

/* ---------- Sidebars ---------- */
.sidebar { position: sticky; top: 72px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--text);
}
.side-link:hover { background: #e4e6e9; }
.side-title { font-size: 16px; color: var(--text-2); margin: 4px 0 12px; }
.sidebar-right { background: transparent; }

/* ---------- Cards ---------- */
.card {
  /* NOTE: intentionally no backdrop-filter here — a filtered ancestor becomes
     the containing block for position:fixed descendants, which would trap the
     post's slide-up comment sheet inside the card. Translucency + border +
     shadow over the tinted background already reads as frosted glass. */
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.section-title { margin: 0 0 16px; font-size: 20px; }
.empty { text-align: center; padding: 32px 16px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }

/* ---------- Composer ---------- */
.composer-top { display: flex; gap: 10px; align-items: flex-start; }
.composer textarea {
  flex: 1;
  border: 1px solid transparent;
  resize: none;
  background: rgba(20, 24, 40, 0.05);
  border-radius: 18px;
  padding: 11px 15px;
  font: inherit;
  outline: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.composer textarea:focus {
  background: var(--glass-strong);
  border-color: var(--glass-border);
  box-shadow: 0 0 0 3px rgba(59, 109, 255, 0.15);
}
.composer-photo .ic { color: var(--text-2); }
.composer-photo:hover .ic { color: var(--brand); }
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}
.composer-photo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-2);
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}
.composer-photo:hover { background: var(--hover); }
.composer-photo .fname { font-size: 12px; color: var(--blue); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Posts ---------- */
.post-head { display: flex; align-items: center; justify-content: space-between; }
.post-author { display: flex; align-items: center; gap: 10px; }
.post-author-name { display: block; font-weight: 600; }
.post-time { display: block; font-size: 12px; color: var(--text-2); }
.post-content { margin: 12px 0; white-space: pre-wrap; word-wrap: break-word; }
.post-image-link { display: block; margin: 12px -16px 0; }
.post-image { width: 100%; display: block; }
.post-stats {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--text-2);
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.post-actions { display: flex; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.btn-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  border: none;
  background: rgba(20, 24, 40, 0.045);
  color: var(--text-2);
  font-weight: 650;
  font-size: 13.5px;
  line-height: 1;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn-action .ic { width: 20px; height: 20px; }
.btn-action .act-emoji { font-size: 18px; line-height: 1; }
.btn-action:hover { background: rgba(20, 24, 40, 0.08); color: var(--text); }
.btn-action:active { transform: scale(0.96); }
.btn-action.liked { color: var(--brand); background: rgba(59, 109, 255, 0.12); }

/* ---------- Comments ---------- */
.comments { padding-top: 10px; }
.comment { display: flex; gap: 8px; margin-bottom: 10px; }
.comment-main { flex: 1; min-width: 0; }
.comment-bubble { background: rgba(20, 24, 40, 0.055); border-radius: 16px; padding: 9px 13px; display: inline-block; max-width: 100%; }
.comment-author { font-weight: 600; font-size: 13px; display: block; }
.comment-text { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.comment-time { font-size: 11px; color: var(--text-2); margin-top: 2px; }

/* Comment action row (Like · Reply · time · count) */
.comment-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin: 3px 0 0 12px; font-size: 12px; }
.cm-react, .cm-reply { position: relative; display: inline-flex; }
.cm-act { cursor: pointer; font-weight: 700; color: var(--text-2); list-style: none; }
.cm-act::-webkit-details-marker { display: none; }
.cm-act::marker { content: ''; }
.cm-act.active { color: var(--blue); }
.cm-time { color: var(--text-2); }
.cm-count { color: var(--text-2); background: var(--bg); border-radius: 10px; padding: 1px 7px; }
.cm-reply-form { margin-top: 6px; min-width: 220px; }
.comment-replies { margin-left: 40px; }
.mention { color: var(--blue); font-weight: 600; }
.mention:hover { text-decoration: underline; }

.comment-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.comment-form input {
  flex: 1;
  min-width: 0; /* let the input shrink so the Post button never gets pushed off */
  border: 1px solid transparent;
  background: rgba(20, 24, 40, 0.055);
  border-radius: 18px;
  padding: 9px 15px;
  font: inherit;
  outline: none;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.comment-form input:focus { background: var(--glass-strong); box-shadow: 0 0 0 3px rgba(59, 109, 255, 0.14); }
.comment-form .btn { flex: none; white-space: nowrap; }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.avatar-fallback {
  background: linear-gradient(135deg, var(--blue), #00c6ff);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  background: var(--glass-strong);
  color: var(--text);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}
.btn:hover { filter: brightness(1.03); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-primary {
  background: var(--brand-grad); color: #fff; border-color: transparent;
  box-shadow: 0 8px 22px rgba(59, 109, 255, 0.32);
}
.btn-primary:hover { box-shadow: 0 12px 28px rgba(124, 92, 255, 0.4); }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; border-color: transparent; box-shadow: 0 8px 22px rgba(34, 197, 94, 0.28); }
.btn-success:hover { filter: brightness(1.03); }
.btn-ghost { background: var(--hover); color: var(--text); border-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 12px 16px; font-size: 17px; width: 100%; }
.inline { display: inline; }

/* ---------- Auth ---------- */
.auth-card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  padding: 28px;
  width: 100%;
  max-width: 396px;
  text-align: center;
}
.auth-brand { color: var(--blue); font-size: 40px; font-weight: 800; letter-spacing: -1px; }
.auth-tagline { color: var(--text-2); margin: 4px 0 20px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  outline: none;
}
.auth-form input:focus { border-color: var(--blue); }
.auth-sep { height: 1px; background: var(--border); margin: 20px 0; }
.auth-link { color: var(--blue); font-weight: 600; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; text-align: left; }
.alert-error { background: #ffebe8; border: 1px solid #ffb3b3; color: #c0392b; }

/* ---------- Profile ---------- */
.cover {
  height: 200px;
  background: linear-gradient(135deg, #1877f2, #00c6ff);
  background-size: cover;
  background-position: center;
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -16px -16px 0;
}
.profile-header { padding-bottom: 16px; }
/* Centered, Facebook-style profile header. */
.profile-top { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 16px; }
.profile-avatar { margin-top: -64px; }
.profile-avatar .avatar { border: 4px solid var(--card); }
.profile-name { margin: 12px 0 2px; font-size: 26px; line-height: 1.15; }
.profile-handle { margin: 0 0 8px; color: var(--text-2); }
.profile-sub { margin: 8px 0 0; color: var(--text-2); }
.profile-bio { margin: 10px 0 0; max-width: 520px; }
.profile-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; width: 100%; max-width: 460px; margin-top: 14px; }
.profile-actions > .btn, .profile-actions > form { flex: 1 1 auto; min-width: 130px; }
.profile-actions > form { display: flex; }
.profile-actions > form > .btn { width: 100%; }

/* ---------- People grid ---------- */
.section { margin-bottom: 16px; }
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.person-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.person-name { font-weight: 600; }
.person-bio { font-size: 12px; color: var(--text-2); margin: 0; }
.person-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: auto; }

/* ---------- Suggestions (right rail) ---------- */
.suggestion { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
.suggestion-user { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }

/* ---------- Misc forms ---------- */
.stacked-form { display: flex; flex-direction: column; gap: 16px; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.stacked-form input[type='text'],
.stacked-form textarea {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
}
.form-actions { display: flex; gap: 10px; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--blue); font-weight: 600; }

/* ---------- Search bar ---------- */
.nav-search { flex: 1; max-width: 300px; position: relative; display: flex; align-items: center; }
.nav-search-ic { position: absolute; left: 14px; color: var(--text-2); pointer-events: none; }
.nav-search input {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(20, 24, 40, 0.055);
  border-radius: 22px;
  padding: 10px 14px 10px 40px;
  font: inherit;
  outline: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.nav-search input:focus {
  background: var(--glass-strong);
  border-color: var(--glass-border);
  box-shadow: 0 0 0 3px rgba(59, 109, 255, 0.18);
}

/* ---------- Nav badges ---------- */
.nav-badge-wrap { position: relative; }
.badge {
  position: absolute;
  top: 2px;
  right: 12px;
  background: #e41e3f;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

/* ---------- Post menu (edit/delete) ---------- */
.post-menu { position: relative; }
.post-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 50%;
  font-size: 18px;
  color: var(--text-2);
}
.post-menu summary::-webkit-details-marker { display: none; }
.post-menu summary:hover { background: var(--hover); }
.post-menu-items {
  position: absolute;
  right: 0;
  top: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 10;
  min-width: 140px;
  overflow: hidden;
}
.post-menu-items a,
.post-menu-items button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}
.post-menu-items a:hover,
.post-menu-items button:hover { background: var(--hover); }

/* ---------- Shared (reshared) post ---------- */
.shared-box {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-top: 10px;
  color: var(--text);
}
.shared-box:hover { background: #fafafa; }
.shared-head { display: flex; align-items: center; gap: 8px; }
.shared-author { font-weight: 600; }
.shared-content { margin-top: 8px; white-space: pre-wrap; word-wrap: break-word; }
.shared-box .post-image { margin-top: 8px; border-radius: 8px; }
.shared-missing { text-align: center; padding: 20px; }

/* ---------- Action row tweaks ---------- */
.action-cell { flex: 1; display: flex; }
.action-cell .btn-action { width: 100%; }
.share-disclosure { position: relative; }
.share-disclosure > summary { list-style: none; cursor: pointer; }
.share-disclosure > summary::-webkit-details-marker { display: none; }
.share-form {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}
.share-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  outline: none;
}

/* ---------- Notifications ---------- */
.notif {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  color: var(--text);
}
.notif:hover { background: var(--hover); }
.notif-unread { background: #e7f3ff; }
.notif-unread:hover { background: #ddecfb; }
.notif-body { flex: 1; }
.notif-time { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* ---------- Messages list ---------- */
.convo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
  color: var(--text);
}
.convo:hover { background: var(--hover); }
.convo-unread { background: #e7f3ff; }
.convo-body { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; gap: 8px; }
.convo-name { font-weight: 600; }
.convo-time { font-size: 12px; color: var(--text-2); }
.convo-preview {
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.convo-unread .convo-preview { color: var(--text); font-weight: 600; }
.convo-badge { position: static; }

/* ---------- Chat thread ---------- */
.chat { padding: 0; overflow: hidden; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-head .back-link { margin: 0; font-size: 22px; }
.chat-peer { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.chat-body {
  height: 60vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f7f8fa;
}
.chat-empty { text-align: center; margin: auto; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
  max-width: 70%;
  padding: 8px 12px;
  border-radius: 16px;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble-row.theirs .bubble { background: #e4e6eb; color: var(--text); border-bottom-left-radius: 4px; }
.bubble-row.mine .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.bubble-time { display: block; font-size: 10px; opacity: 0.7; margin-top: 2px; }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  border: none;
  background: var(--bg);
  border-radius: 20px;
  padding: 10px 14px;
  font: inherit;
  outline: none;
}

/* ---------- Desktop nav active states (Facebook-style) ---------- */
.nav-search-icon { display: none; }
.nav-links .nav-icon.active { color: var(--blue); box-shadow: inset 0 -3px 0 var(--blue); border-radius: 8px 8px 0 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar-left, .sidebar-right { display: none; }
}
.bottomnav { display: none; } /* hidden on desktop; shown in the query below */
@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-search { display: none; }          /* full search bar becomes a compact icon */
  .nav-search-icon { display: inline-flex; padding: 8px; border-radius: 12px; }
  .nav-inner { gap: 8px; padding: 8px 12px; flex-wrap: nowrap; }
  .nav-left { flex: 0 0 auto; min-width: 0; gap: 4px; }
  .brand { font-size: 21px; white-space: nowrap; }
  .nav-right { gap: 6px; flex: 0 0 auto; }
  .nav-chat { display: none; }            /* Chat lives in the bottom bar on mobile */
  .nav-logout { display: none; }          /* Log out moves to the profile page on mobile */
  .nav-me .avatar-ring, .nav-badge-wrap { flex: none; }

  /* Sleek bottom tab bar */
  .bottomnav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-border);
    box-shadow: 0 -8px 30px rgba(20, 24, 40, 0.07);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bottomnav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 0 6px;
    color: var(--text-2);
    line-height: 1;
    transition: color 0.2s var(--ease);
  }
  .bottomnav-item .bn-ic { display: inline-flex; }
  .bottomnav-item .bn-l { font-size: 10.5px; font-weight: 650; letter-spacing: 0.1px; }
  .bottomnav-item.active { color: var(--brand); }
  .bottomnav-item.active .bn-ic { filter: drop-shadow(0 3px 8px rgba(59, 109, 255, 0.4)); }
  .bottomnav-item:active { transform: scale(0.94); }
  .bottomnav .badge { top: 2px; right: 24%; }

  /* Keep page content clear of the fixed bottom bar. */
  .app-main { padding-bottom: 76px; }
  .pwa-install { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); }

  /* Action buttons: icon-only pills so all five fit neatly across the footer. */
  .post-actions { gap: 5px; }
  .act-label { display: none; }
  .post-actions .btn-action { font-size: 17px; padding: 9px 4px; gap: 0; }

  /* Keep the reaction palette compact so it never runs off either edge. */
  .react-palette { gap: 0; padding: 5px 6px; }
  .react-emoji { width: 34px; height: 34px; font-size: 21px; }

  /* Facebook-style: comments slide up as a bottom sheet over the feed. The
     comments are already in the DOM (just off-screen); .open slides them in. */
  .post--compact .comments {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: 9%;
    z-index: 320;
    background: var(--sheet);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
    transform: translateY(102%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
  }
  .post--compact .comments.open { transform: translateY(0); }
  .post--compact .comments-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
  }
  .post--compact .comments-body { flex: 1; overflow-y: auto; padding: 12px 14px; -webkit-overflow-scrolling: touch; }
  .post--compact .comments .comment-form {
    position: sticky; bottom: 0; margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--sheet);
  }

  /* Messenger becomes full-height like a chat app (bottom nav is hidden here, so
     the composer sits right above the keyboard). 100dvh + interactive-widget=
     resizes-content means the layout shrinks when the keyboard opens, keeping the
     newest message and the input in view instead of scrolling them off-screen. */
  .app-main.is-thread { padding: 0; max-width: none; }
  .container.narrow { max-width: none; padding: 0; }
  .chat {
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 53px);
    height: calc(100dvh - 53px);
  }
  .chat-body { height: auto; flex: 1; min-height: 0; }
  .chat-form { position: sticky; bottom: 0; background: var(--card); }
}
@media (max-width: 520px) {
  .nav-icon { padding: 6px 7px; }
  .nav-icon span { display: none; }
  .nav-me-name { display: none; }
  .nav-logout .btn { padding: 6px 10px; }  /* keep logout reachable, just compact */
  .brand { font-size: 22px; }
  .bubble { max-width: 78%; }
  .comment-replies { margin-left: 24px; }
}

/* ============================================================
   Vibes economy UI
   ============================================================ */

.brand-mark { margin-right: 2px; }

/* ---------- Wallet (nav) ---------- */
.wallet {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  padding: 6px 14px;
  font-weight: 750;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(20, 24, 40, 0.06);
}
.wallet-vibes, .wallet-aura { display: inline-flex; align-items: center; gap: 5px; }
.wallet-vibes { color: #7c4bd6; }
.wallet-aura { color: #d98a1f; }
.wallet .ic { filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12)); }

/* ---------- Wallet card (sidebar) ---------- */
.wallet-card { text-align: left; }
.wallet-id { display: flex; align-items: center; gap: 10px; color: var(--text); }
.wallet-name { font-weight: 700; }
.wallet-level { font-size: 12px; color: var(--text-2); }
.wallet-stats { display: flex; gap: 12px; margin: 12px 0 8px; }
.wallet-stats > div { display: flex; flex-direction: column; }
.wallet-num { font-weight: 800; font-size: 17px; }
.side-cta { background: linear-gradient(90deg, #fff1cc, #ffe29a); font-weight: 700; }

/* ---------- Aura progress bar ---------- */
.aura-bar {
  height: 8px;
  background: #e9eaee;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.aura-bar-wide { width: 100%; max-width: 360px; margin-top: 12px; }
.aura-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd36e, #ff8a00);
  border-radius: 6px;
}

/* ---------- Glowing Aura ring ---------- */
.ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 3px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.ring .avatar { border: 2px solid #fff; }
.ring-l1 { background: #c9ccd1; }
.ring-l2 { background: linear-gradient(135deg, #9bdcff, #1877f2); box-shadow: 0 0 6px rgba(24,119,242,.5); }
.ring-l3 { background: linear-gradient(135deg, #ffe29a, #ffb347); box-shadow: 0 0 8px rgba(255,179,71,.6); }
.ring-l4 { background: linear-gradient(135deg, #b5f5c0, #42b72a); box-shadow: 0 0 10px rgba(66,183,42,.6); }
.ring-l5 { background: linear-gradient(135deg, #ffd36e, #ff8a00); box-shadow: 0 0 14px rgba(255,138,0,.7); }
.ring-l6 { background: conic-gradient(#ff9a9e, #fa2a55, #ffd36e, #ff9a9e); box-shadow: 0 0 16px rgba(250,42,85,.7); }
.ring-l7 {
  background: conic-gradient(#ffd700, #ff8a00, #fa2a55, #7a3ff2, #1877f2, #ffd700);
  box-shadow: 0 0 22px rgba(255,200,0,.9);
  animation: spin 6s linear infinite;
}
.ring-l7 .avatar { animation: spin 6s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Level pill + econ chips ---------- */
.level-pill {
  display: inline-block;
  background: linear-gradient(90deg, #fff1cc, #ffe29a);
  color: #8a5a00;
  font-weight: 700;
  font-size: 13px;
  padding: 3px 12px;
  border-radius: 20px;
  margin: 4px 0;
}
.profile-econ { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 12px 0 0; }
.econ-chip {
  background: var(--bg);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
}
.handle { margin: 0; }

/* ---------- Gift button ---------- */
.btn-gift {
  background: linear-gradient(90deg, #ff8a00, #fa2a55);
  color: #fff;
}
.btn-gift:hover { filter: brightness(1.05); }
.post-head-right { display: flex; align-items: center; gap: 6px; }

/* ---------- Reaction palette ---------- */
.react-disclosure { position: relative; }
.react-disclosure > summary { list-style: none; cursor: pointer; }
.react-disclosure > summary::-webkit-details-marker { display: none; }
.react-palette {
  position: absolute;
  bottom: 44px;
  left: 0;              /* anchor to the button's left edge (React sits far-left) */
  display: flex;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  padding: 6px 8px;
  z-index: 10;
}
.react-emoji {
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  transition: transform .1s;
}
.react-emoji:hover { transform: scale(1.3); }
.react-emoji.chosen { background: #e7f3ff; }

/* ---------- Hype badge ---------- */
.hype-badge {
  display: inline-block;
  background: linear-gradient(90deg, #e9d5ff, #c4b5fd);
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

/* ---------- Toasts ---------- */
.toast {
  max-width: 1100px;
  margin: 0 auto 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast-good { border-left-color: var(--green); background: #f0fff4; }
.alert-info { background: #e7f3ff; border: 1px solid #b9dbff; color: #1a4f8a; }

/* ---------- Gift sheet ---------- */
.gift-sheet { overflow: hidden; }
.gift-hero { text-align: center; padding: 8px 0 16px; }
.gift-hero h2 { margin: 6px 0; }
.snake-loop { font-size: 48px; animation: bob 2.5s ease-in-out infinite; }
.snake-loop.big { font-size: 72px; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-8px) rotate(6deg); } }
.gift-balance { margin-top: 8px; color: var(--text-2); }
.gift-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; margin: 0 auto; }
.gift-label { font-weight: 700; margin-top: 6px; }
.gift-select, .gift-amount {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}
.amount-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 700;
}
.chip:hover { background: #ffe29a; }
.gift-send { margin-top: 8px; }
.center { text-align: center; }

/* ---------- Gift success ---------- */
.gift-success { text-align: center; position: relative; overflow: hidden; padding: 36px 16px; }
.gift-success h2 { margin: 10px 0; }
.gift-success-to { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; margin: 10px 0; }
.gift-success-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span {
  position: absolute;
  top: -10px;
  left: calc(var(--i) * 4.16%);
  width: 8px; height: 14px;
  background: hsl(calc(var(--i) * 40), 90%, 60%);
  opacity: .9;
  animation: fall 1.8s linear infinite;
  animation-delay: calc(var(--i) * 0.07s);
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(360px) rotate(360deg); opacity: 0; }
}

/* ---------- Leagues ---------- */
.league-head { text-align: center; margin-bottom: 12px; }
.league-tier { font-size: 22px; font-weight: 800; }
.league-list { list-style: none; padding: 0; margin: 0; }
.league-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  border-bottom: 1px solid #eee;
}
.league-row.me { background: #e7f3ff; }
.league-row.promote { border-left: 4px solid var(--green); }
.league-row.demote { border-left: 4px solid #e41e3f; }
.league-rank { width: 28px; text-align: center; font-weight: 800; color: var(--text-2); }
.league-name { flex: 1; font-weight: 600; }
.league-pulse { font-weight: 800; color: #7a3ff2; }
.you-tag { background: var(--blue); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 6px; }
.zone-tag.up { color: var(--green); font-weight: 800; }
.zone-tag.down { color: #e41e3f; font-weight: 800; }

/* ---------- Pools ---------- */
.section-bar { display: flex; align-items: center; justify-content: space-between; }
.pool-row { display: flex; align-items: center; gap: 12px; color: var(--text); }
.pool-info { flex: 1; }
.pool-title { font-weight: 700; }
.pool-amount { text-align: right; }
.pool-total { font-weight: 800; display: block; }
.pool-status { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 10px; }
.pool-status-open { background: #e7f7ec; color: #1a7a3a; }
.pool-status-paid { background: #eee; color: var(--text-2); }
.pool-header { display: flex; gap: 14px; align-items: center; }
.pool-big-total { font-size: 28px; font-weight: 800; margin: 16px 0; display: flex; align-items: center; gap: 10px; }
.pool-contribute { display: flex; gap: 8px; align-items: center; }
.pool-contribute input { width: 120px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; }
.pool-contrib-amt { font-weight: 700; }

/* ---------- Invites ---------- */
.invite-row { display: flex; flex-direction: column; gap: 10px; }
.invite-link { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.invite-code { background: var(--bg); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.activation-bars { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.activation-bars span { background: var(--bg); padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.activation-bars span.done { background: #e7f7ec; color: #1a7a3a; }

/* ---------- Settings (email notifications) ---------- */
.settings-form { display: flex; flex-direction: column; gap: 6px; }
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.toggle-row:hover { background: var(--hover); }
.toggle-row input[type='checkbox'] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--blue); cursor: pointer; }
.toggle-row span { display: flex; flex-direction: column; }
.toggle-title { font-weight: 600; }
.toggle-sub { font-size: 13px; color: var(--text-2); }
.toggle-master { background: var(--bg); border: 1px solid var(--border); margin-bottom: 8px; }
.toggle-group { display: flex; flex-direction: column; gap: 4px; padding-left: 6px; border-left: 2px solid var(--border); margin-left: 6px; }
.settings-form .form-actions { margin-top: 14px; }

/* ============================================================
   PWA install banner + mobile bottom navigation
   ============================================================ */

/* Install-to-home-screen banner (shown only when the browser offers install) */
.pwa-install {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  max-width: 520px;
  margin: 0 auto;
}
.pwa-install[hidden] { display: none; }
.pwa-install-ic { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.pwa-install-txt { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.pwa-install-txt strong { font-size: 15px; }
.pwa-install-txt span { font-size: 12px; color: var(--text-2); }
.pwa-install-x {
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  flex: none;
}
.pwa-install-x:hover { background: var(--hover); }

/* Bottom tab bar base styles live here; visibility is controlled in the mobile
   media query (.bottomnav is hidden on desktop by the rule placed BEFORE that
   query so source order lets the media rule win). */

/* ============================================================
   Messenger refinements (Facebook-style)
   ============================================================ */
.chat-peer-name { font-weight: 600; }
.chat-head { position: sticky; top: 0; background: var(--card); z-index: 2; }

/* Incoming messages get a small avatar gutter (shown on the last of a run). */
.bubble-row { align-items: flex-end; gap: 6px; margin-bottom: 1px; }
.bubble-row.run-end { margin-bottom: 8px; }
.bubble-av { width: 28px; height: 28px; flex: none; }
.bubble-av img, .bubble-av .avatar { width: 28px; height: 28px; }
.bubble-row.mine { padding-left: 34px; }          /* balance the avatar gutter */

/* Grouped bubble radii, Messenger-style. */
.bubble-row.theirs .bubble { border-radius: 4px 18px 18px 4px; }
.bubble-row.theirs .bubble.bubble-first { border-top-left-radius: 18px; }
.bubble-row.theirs .bubble.bubble-last { border-bottom-left-radius: 18px; }
.bubble-row.mine .bubble { border-radius: 18px 4px 4px 18px; }
.bubble-row.mine .bubble.bubble-first { border-top-right-radius: 18px; }
.bubble-row.mine .bubble.bubble-last { border-bottom-right-radius: 18px; }

/* Rounded input + circular send button. */
.chat-form { align-items: center; gap: 10px; }
.chat-form input { background: var(--bg); border-radius: 20px; }
.chat-send {
  flex: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.chat-send:hover { background: var(--blue-dark); }

/* Conversation list: bump avatar, add an unread dot. */
.convo { padding: 10px 12px; border-radius: 10px; }
.convo-unread { background: #e7f3ff; }
.convo-name { font-size: 15px; }
.convo-unread .convo-name { font-weight: 700; }
.convo-badge {
  min-width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  background: var(--blue);
  font-size: 0;
  align-self: center;
}

/* Slimmer, sleeker install banner. */
.pwa-install { padding: 9px 12px; border-radius: 16px; }
.pwa-install-ic { width: 38px; height: 38px; }
.pwa-install-txt strong { font-size: 14px; }

/* Keep the top-bar chips on one line (sleeker). */
.nav-logout .btn { white-space: nowrap; }
.wallet, .wallet span { white-space: nowrap; }

/* Search page: a visible search bar (the top-bar search is hidden on mobile) */
.search-page-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 6px 6px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.search-page-ic { color: var(--text-2); font-size: 16px; }
.search-page-form input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 16px;
  outline: none;
  padding: 8px 0;
}
.search-page-form .btn { flex: none; border-radius: 20px; }

/* ============================================================
   Comments sheet (mobile slide-up, Facebook-style)
   ============================================================ */
.comments-head { display: none; }               /* only shown in the mobile sheet */
.comments-title { font-weight: 700; font-size: 16px; }
.comments-close {
  border: none; background: none; color: var(--text-2);
  font-size: 18px; cursor: pointer; padding: 4px 10px; border-radius: 8px; line-height: 1;
}
.comments-close:hover { background: var(--hover); }
.comments-note { padding: 6px 2px; }
.comments-backdrop {
  position: fixed; inset: 0; z-index: 310;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0; transition: opacity 0.25s ease; pointer-events: none;
}
.comments-backdrop.show { opacity: 1; pointer-events: auto; }
body.no-scroll { overflow: hidden; }

/* ============================================================
   Slide-out drawer menu + scroll-away bars (mobile)
   ============================================================ */
.nav-left { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav-menu-btn {
  display: none;                       /* shown on mobile/tablet via media query */
  border: none; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text);
  padding: 4px 8px; border-radius: 8px;
}
.nav-menu-btn:hover { background: var(--hover); }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 84%; max-width: 330px;
  z-index: 400;
  background: rgba(248, 250, 253, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 24px 0 60px rgba(20, 24, 40, 0.18);
  transform: translateX(-100%);
  transition: transform 0.34s var(--ease);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 390;
  background: rgba(10, 14, 25, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer-head { padding: 20px 16px 16px; border-bottom: 1px solid var(--border); }
.drawer-user { display: flex; align-items: center; gap: 13px; color: var(--text); }
.drawer-id { display: flex; flex-direction: column; min-width: 0; }
.drawer-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-handle { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.drawer-wallet { display: flex; gap: 10px; margin-top: 14px; }
.dw-stat {
  flex: 1; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 15px;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  color: var(--text); transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.dw-stat:active { transform: scale(0.97); }
.dw-ic { display: inline-flex; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12)); }
.dw-meta { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.dw-num { font-weight: 800; font-size: 17px; }
.dw-lbl { font-size: 11px; color: var(--text-2); white-space: nowrap; }
.drawer-links { display: flex; flex-direction: column; padding: 10px; gap: 2px; flex: 1; }
.drawer-links a {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 13px; border-radius: 13px;
  font-weight: 600; font-size: 15px; color: var(--text);
  transition: background 0.18s var(--ease);
}
.drawer-links a .ic { color: var(--text-2); }
.drawer-links a:hover, .drawer-links a:active { background: var(--hover); }
.drawer-links a:hover .ic { color: var(--brand); }
.drawer-logout { padding: 12px; border-top: 1px solid var(--border); }
.drawer-logout .btn { width: 100%; }

/* Bars slide away on scroll-down, back on scroll-up (set by footer script). */
.navbar { transition: transform 0.25s ease; }
.bottomnav { transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), background 0s; }

@media (max-width: 900px) {
  .nav-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  body.nav-hidden .navbar { transform: translateY(-100%); }
}
@media (min-width: 901px) {
  .drawer, .drawer-backdrop { display: none; }   /* desktop uses the sidebar */
}
@media (max-width: 680px) {
  body.nav-hidden .bottomnav { transform: translateY(100%); }
}

/* ============================================================
   Video posts + Reels
   ============================================================ */
/* Inline video in a normal post */
.post-video-wrap { margin: 12px -16px 0; background: #000; }
.post-video { width: 100%; max-height: 70vh; display: block; }
.post-video-short .post-video { max-height: 80vh; }

/* Composer media pickers */
.composer-pickers { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.composer-reel { color: var(--text-2); }

/* The `hidden` attribute must always win over the `display` values we set on
   classes below (a class selector otherwise overrides the UA [hidden] rule). */
[hidden] { display: none !important; }

/* ---- Create-reel: Snapchat-style camera ---- */
.cam {
  position: fixed; inset: 0; z-index: 300; background: #000; overflow: hidden;
  color: #fff;
}
.cam-view {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; background: #000;
}
.cam-close {
  position: absolute; top: 14px; left: 14px; z-index: 4;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.4); color: #fff; font-size: 20px;
}
.cam-timer {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-weight: 700; font-size: 14px;
  padding: 5px 12px; border-radius: 999px;
}
.cam-timer::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #ff3b30; }
.cam-side {
  position: absolute; top: 96px; right: 12px; z-index: 4;
  display: flex; flex-direction: column; gap: 20px;
}
.cam-side-btn {
  background: none; border: none; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.cam-side-ic { font-size: 26px; }
.cam-side-lbl { font-size: 11px; font-weight: 600; opacity: 0.9; }
.cam-blocked {
  position: absolute; inset: 0; z-index: 3; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; background: #111;
}
.cam-blocked-ic { font-size: 48px; }
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px calc(30px + env(safe-area-inset-bottom, 0px));
}
.cam-gallery, .cam-bar-spacer { width: 46px; height: 46px; }
.cam-gallery {
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  border-radius: 12px; background: rgba(0, 0, 0, 0.35); font-size: 22px;
}
.cam-shutter {
  width: 82px; height: 82px; border-radius: 50%; padding: 0; cursor: pointer;
  background: transparent; border: 5px solid #fff;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s ease;
}
.cam-shutter-ring {
  width: 62px; height: 62px; border-radius: 50%; background: #fff;
  transition: all 0.18s ease;
}
.cam-shutter.recording { border-color: #ff3b30; }
.cam-shutter.recording .cam-shutter-ring { width: 30px; height: 30px; border-radius: 8px; background: #ff3b30; }
.cam-shutter.disabled { opacity: 0.55; }
.cam-review-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  display: flex; flex-direction: column; gap: 12px;
}
.cam-caption {
  width: 100%; border: none; border-radius: 12px; padding: 12px 14px;
  font: inherit; resize: none; outline: none;
  background: rgba(255, 255, 255, 0.14); color: #fff;
}
.cam-caption::placeholder { color: rgba(255, 255, 255, 0.7); }
.cam-review-actions { display: flex; gap: 10px; }
.cam-review-actions .btn { flex: 1; }
.cam-retake { background: rgba(255, 255, 255, 0.18); color: #fff; border: none; }

/* ---- Immersive vertical Reels feed (Facebook-style) ---- */
.reels-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 210;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px calc(12px + 8px);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}
.reels-topbar-left, .reels-topbar-right { display: flex; align-items: center; gap: 14px; pointer-events: auto; }
.reels-top-title { color: #fff; font-size: 22px; font-weight: 800; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
.reels-top-btn {
  background: none; border: none; cursor: pointer; color: #fff; font-size: 21px; line-height: 1;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); padding: 2px;
}
.reels-viewport {
  position: fixed; inset: 0; z-index: 200;
  background: #000;
  overflow-y: auto; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.reels-viewport::-webkit-scrollbar { width: 0; height: 0; display: none; }
.reel {
  position: relative;
  /* Exactly one viewport tall — 100% of the fixed container avoids the mobile
     address-bar (100vh vs visible height) mismatch that left the first reel
     slightly too tall. */
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  /* Force the fling to STOP on each reel — a hard flick advances one video at a
     time instead of coasting through several. */
  scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
/* Contain (not cover) so the whole clip is visible — a wide shot is letterboxed
   instead of zoomed/cropped, and portrait clips still fill the screen. */
.reel-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.reel-play-ind {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 3; font-size: 58px; color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.reel-play-ind.show { opacity: 1; }
.reel-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 42%);
}
.reel-info { pointer-events: auto; flex: 1; min-width: 0; padding: 0 12px calc(20px + env(safe-area-inset-bottom, 0px)); color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7); }
.reel-author { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-weight: 700; margin-bottom: 8px; }
.reel-author .avatar { border: 2px solid rgba(255, 255, 255, 0.85); }
.reel-author-name { font-size: 15px; }
.reel-caption-text { margin: 0 0 8px; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.35; }
.reel-caption-text .mention { color: #9ad0ff; }
.reel-clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reel-audio { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: 0.92; }
.reel-actions { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 0 10px calc(24px + env(safe-area-inset-bottom, 0px)); }
.reel-actions form { margin: 0; }
.reel-act {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.reel-act-ic { font-size: 30px; line-height: 1; }
.reel-act-n, .reel-act-lbl { font-size: 12px; font-weight: 700; }
.reel-act.liked { color: #4d9bff; }
.reel-progress {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
  height: 3px; background: rgba(255, 255, 255, 0.25);
}
.reel-progress-bar { height: 100%; width: 0; background: #fff; }
.reels-empty {
  position: fixed; inset: 0; z-index: 205; background: #000; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center;
}
.reels-empty-ic { font-size: 46px; }

/* Reels comments — same slide-up bottom sheet as the feed. */
.reel-comments {
  position: fixed; left: 0; right: 0; bottom: 0; top: 12%;
  z-index: 320; background: var(--sheet);
  border-radius: 18px 18px 0 0; box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.28);
  display: flex; flex-direction: column; padding: 0; margin: 0;
  transform: translateY(102%); transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}
.reel-comments.open { transform: translateY(0); }
.reel-comments .comments-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.reel-comments .comments-body { flex: 1; overflow-y: auto; padding: 12px 14px; -webkit-overflow-scrolling: touch; }
.reel-comments .comment-form {
  position: sticky; bottom: 0; margin: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border); background: var(--sheet);
}

/* Facebook-style translucent bottom nav over the reels feed. Uses :has() as a
   progressive enhancement — where unsupported the bar simply stays behind the
   feed as before. The overlay content is lifted so nothing hides behind it. */
@media (max-width: 680px) {
  body:has(.reels-viewport) .bottomnav {
    z-index: 220;
    background: rgba(18, 18, 20, 0.55);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
  }
  body:has(.reels-viewport) .bottomnav-item { color: rgba(255, 255, 255, 0.9); }
  body:has(.reels-viewport) .bottomnav-item.active { color: #fff; }

  .reel-info { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .reel-actions { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .reel-progress { bottom: calc(54px + env(safe-area-inset-bottom, 0px)); }

  /* Composer pickers: icons only on mobile so they fit neatly (like post actions). */
  .composer-photo .pick-label, .composer-photo .fname { display: none; }
  .composer-pickers { gap: 14px; }
  .composer-photo { font-size: 22px; padding: 6px 8px; }
}
