/* ============================================================
   FRANKLY — DESIGN SYSTEM
   Dark editorial. Ink-black base. Electric amber accent.
   DM Serif Display + DM Sans.
   ============================================================ */

/* ==================== TOKENS ==================== */
:root {
  /* Colors */
  --bg:            #000505;
  --bg-2:          #000c0c;
  --bg-3:          #000806;
  --bg-4:          #001b1c;
  --surface:       #000e0c;
  --surface-2:     #001b17;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.13);

  --text:          #ffffff;
  --text-secondary:#ededed;
  --text-muted:    #918f8e;

  --accent:        #00ccff;
  --accent-dim:    rgba(35, 245, 217, 0.082);
  --accent-hover:  #00ff9de2;

  --danger:        #e05252;
  --danger-dim:    rgba(224,82,82,0.15);
  --success:       #4caf7d;
  --success-dim:   rgba(76,175,125,0.15);
  --warning:       #e8a838;
  --info:          #5b9cf6;

  --online:        #4caf7d;

  /* Typography */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.7);

  /* Layout */
  --nav-width:    220px;
  --nav-width-sm: 64px;
  --header-h:     56px;
}

/* ==================== RESET ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, video { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ==================== GRAIN ==================== */
.grain {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }

/* ==================== LAYOUT ==================== */
#nav { position: fixed; left: 0; top: 0; bottom: 0; width: var(--nav-width); z-index: 100; }
#app {
  margin-left: var(--nav-width);
  min-height: 100dvh;
  transition: margin-left 0.3s;
}

@media (max-width: 900px) {
  #nav { width: var(--nav-width-sm); }
  #app { margin-left: var(--nav-width-sm); }
}



@media (max-width: 600px) {
  #nav {
    top: auto; bottom: 0; left: 0; right: 0;
    width: auto; height: 60px;
    border-top: 1px solid var(--border);
  }
  #app { margin-left: 0; margin-bottom: 60px; }
}

/* ==================== NAVBAR ==================== */
.navbar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: radial-gradient(circle at 18% 8%, #0020225a 0%, rgb(0, 21, 20) 22%, rgba(0, 43, 48, 0.95) 45%, rgba(0,0,0,1) 75%),
                    radial-gradient(circle at 80% 120%, rgba(0,120,120,0.08) 0%, rgba(0,0,0,0) 60%),
                    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.35));
  border-right: 1px solid var(--border);
  padding: var(--space-6) 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-6);
  cursor: pointer;
}
.nav-logo {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}
.nav-app-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.nav-tagline { display: none; }

.nav-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  padding: 0 var(--space-3);
  overflow: hidden;
}

.nav-spacer {
  flex: 1;
  min-height: var(--space-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
  text-decoration: none;
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}
.nav-item svg { flex-shrink: 0; }

.nav-notif { position: relative; }
.nav-badge {
  position: absolute;
  top: 6px; right: 6px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* Collapsed nav (≤900px) */
@media (max-width: 900px) {
  .nav-app-name, .nav-tagline, .nav-label { display: none; }
  .nav-brand { padding: 0 0 var(--space-6); justify-content: center; }
  .nav-links { padding: 0 var(--space-2); }
  .nav-item { justify-content: center; padding: var(--space-3); }
  .nav-item span:not(.nav-badge) { display: none; }
}

@media (min-width: 601px) and (max-width: 900px) {
  #nav {
    transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    z-index: 200;
  }
  #nav:hover {
    width: var(--nav-width);
    box-shadow: var(--shadow-xl);
  }
  #nav:hover .nav-app-name,
  #nav:hover .nav-label { display: block; }
  #nav:hover .nav-brand { padding: 0 var(--space-5) var(--space-6); justify-content: flex-start; }
  #nav:hover .nav-links { padding: 0 var(--space-3); }
  #nav:hover .nav-item { justify-content: flex-start; padding: var(--space-3); gap: var(--space-3); }
  #nav:hover .nav-item span:not(.nav-badge) { display: inline; }
}

/* Bottom nav (mobile) */
@media (max-width: 600px) {
  .navbar {
    flex-direction: row;
    padding: 0;
    height: 100%;
    border-right: none;
  }
  .nav-brand { display: none; }
  .nav-links {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    padding: 0;
    gap: 0;
  }
  .nav-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 500;
    flex: 1;
    gap: 3px;
    min-width: 0;
  }
  .nav-item svg { width: 20px; height: 20px; }
 /* Hide desktop-only items on mobile */
  .nav-item[data-view="explore"],
  .nav-item[data-view="notifications"],
  .nav-item[data-view="settings"],
  .nav-spacer { display: none !important; }

  /* Re-show labels under icons (overrides the ≤900px hide) */
  .nav-label { display: block !important; font-size: 10px; font-weight: 500; line-height: 1.2; margin-top: 2px; }

  /* Correct order: Feed → Messages → Reels → News → Profile */
  .nav-item[data-view="feed"]    { order: 1; }
  .nav-item[data-view="chat"]    { order: 2; }
  .nav-item[data-view="reels"]   { order: 3; }
  .nav-item[data-view="news"]    { order: 4; }
  .nav-item[data-view="profile"] { order: 5; }
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.15s, color 0.15s, opacity 0.15s, transform 0.1s;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn--primary  { background: var(--accent); color: #0d0d0d; font-weight: 600; }
.btn--primary:hover { background: var(--accent-hover); }

.btn--outline  { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn--outline:hover { border-color: var(--text-muted); background: var(--bg-3); }

.btn--ghost    { background: transparent; color: var(--text-secondary); }
.btn--ghost:hover { background: var(--bg-3); color: var(--text); }

.btn--danger   { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #c84444; }

.btn--google {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn--google:hover { background: var(--surface-2); }

.btn--full { width: 100%; }
.btn--sm   { padding: 6px 12px; font-size: 13px; }
.btn--icon { padding: 8px; }

.btn--loading { opacity: 0.7; }
.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

.icon-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

/* ==================== FORMS ==================== */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.form-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

.form-input {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input--error { border-color: var(--danger); }
.form-input--error:focus { box-shadow: 0 0 0 3px var(--danger-dim); }
.form-input--code {
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 22px;
  font-weight: 600;
}
textarea.form-input { resize: vertical; min-height: 80px; }

.form-error { font-size: 12px; color: var(--danger); min-height: 16px; }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 44px; }
.input-toggle-pw {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted);
  transition: color 0.15s;
}
.input-toggle-pw:hover { color: var(--text); }

.input-status {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 12px;
}

/* Password strength */
.password-strength { margin-top: var(--space-2); }
.strength-bars { display: flex; gap: 4px; margin-bottom: 4px; }
.strength-bar {
  height: 3px; flex: 1; border-radius: 2px;
  background: var(--bg-4);
  transition: background 0.3s;
}
.strength--weak       .strength-bar { background: var(--danger); }
.strength--fair       .strength-bar { background: var(--warning); }
.strength--good       .strength-bar { background: var(--info); }
.strength--strong     .strength-bar { background: var(--success); }
.strength--very-strong .strength-bar { background: var(--accent); }
.strength-label { font-size: 11px; }
.strength--weak       { color: var(--danger);  }
.strength--fair       { color: var(--warning); }
.strength--good       { color: var(--info);    }
.strength--strong     { color: var(--success); }
.strength--very-strong { color: var(--accent); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg-4);
  border-radius: var(--radius-full);
  transition: background 0.25s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.25s, background 0.25s;
}
.toggle-input:checked + .toggle-slider { background: var(--accent-dim); }
.toggle-input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent);
}

/* Radio options */
.radio-options { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.radio-option {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 14px;
}
.radio-option:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.radio-option input { accent-color: var(--accent); }

/* ==================== AUTH ==================== */
/* ==================== AUTH ==================== */

/* Hide nav on auth screens */
body:has(.auth-split) #nav  { display: none !important; }
body:has(.auth-split) #app  { margin-left: 0 !important; }

/* ── Outer split container ── */
.auth-split {
  display: flex;
  min-height: 100dvh;
  width: 100%;
  background: var(--bg);
}

/* ═══════════════════════════════════════
   LEFT VISUAL PANEL
═══════════════════════════════════════ */
.auth-visual {
  position: relative;
  width: 52%;
  min-height: 100dvh;
  overflow: hidden;
  flex-shrink: 0;
}

/* Slides */
.auth-slides { position: absolute; inset: 0; }

.auth-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.4s cubic-bezier(0.4,0,0.2,1);
  will-change: opacity;
}
.auth-slide--active { opacity: 1; }

.auth-slide-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom,
      rgba(0,0,0,0.18) 0%,
      rgba(0,0,0,0.05) 45%,
      rgba(0,0,0,0.72) 100%);
}

/* UI layer on top of slides */
.auth-visual-ui {
  position: relative;
  z-index: 2;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px 48px;
}

/* Brand top-left */
.auth-visual-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-visual-logo {
  font-size: 26px;
  color: var(--accent);
  filter: drop-shadow(0 0 14px rgba(245,166,35,0.55));
  line-height: 1;
}
.auth-visual-name {
  font-family: var(--font-display);
  font-size: 24px;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Quote copy */
.auth-visual-copy {
  max-width: 400px;
}
.auth-visual-quote {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.12;
  color: #fff;
  letter-spacing: -0.025em;
  text-shadow: 0 3px 24px rgba(0,0,0,0.45);
}
.auth-visual-sub {
  margin-top: 12px;
  font-size: 16px;
  color: rgba(255,255,255,0.72);
  text-shadow: 0 1px 8px rgba(0,0,0,0.4);
  line-height: 1.5;
}

/* Slide dots */
.auth-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 28px;
}
.auth-dot {
  height: 4px;
  width: 28px;
  border-radius: 2px;
  background: rgba(255,255,255,0.3);
  border: none;
  cursor: pointer;
  transition: background 0.35s, width 0.35s cubic-bezier(0.4,0,0.2,1);
  padding: 0;
}
.auth-dot--active {
  background: #fff;
  width: 52px;
}
.auth-dot:hover:not(.auth-dot--active) {
  background: rgba(255,255,255,0.6);
}

/* Subtle edge glow */
.auth-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  right: 0;
  width: 2px;
  background: linear-gradient(to bottom,
    transparent 0%,
    rgba(245,166,35,0.18) 40%,
    rgba(245,166,35,0.06) 70%,
    transparent 100%);
  z-index: 3;
}

/* ═══════════════════════════════════════
   RIGHT FORM PANEL
═══════════════════════════════════════ */
.auth-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--bg);
  padding: 48px 40px;
  overflow-y: auto;
}

.auth-panel-scroll {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Heading block */
.auth-panel-heading {
  margin-bottom: 36px;
}
.auth-h1 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.15;
}
.auth-h1-sub {
  margin-top: 8px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Glassy inputs ── */
.auth-split .form-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  padding: 13px 16px;
  font-size: 15px;
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.auth-split .form-input::placeholder {
  color: rgba(255,255,255,0.2);
}
.auth-split .form-input:focus {
  background: rgba(255,255,255,0.07);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.12), 0 0 18px rgba(245,166,35,0.08);
}
.auth-split .form-input--error {
  border-color: var(--danger);
}

/* ── Primary button ── */
.auth-split .btn--primary {
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-lg);
  letter-spacing: 0.01em;
  box-shadow: 0 4px 22px rgba(245,166,35,0.28);
  transition: box-shadow 0.2s, background 0.15s, transform 0.1s;
}
.auth-split .btn--primary:hover {
  box-shadow: 0 6px 32px rgba(245,166,35,0.42);
}

/* ── OAuth button ── */
.auth-split .btn--google {
  padding: 12px 18px;
  font-size: 15px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  transition: background 0.15s, border-color 0.15s;
}
.auth-split .btn--google:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
}

/* ── Divider ── */
.auth-split .auth-divider {
  color: rgba(255,255,255,0.2);
  font-size: 12px;
}
.auth-split .auth-divider::before,
.auth-split .auth-divider::after {
  background: rgba(255,255,255,0.08);
}

/* ── Footer links ── */
.auth-split .auth-footer {
  margin-top: 28px;
}

/* ─────────────────────────────────────
   OLD single-card path (kept as fallback)
───────────────────────────────────── */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-8);
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.4s cubic-bezier(0.22,1,0.36,1);
}

.auth-brand { text-align: center; margin-bottom: var(--space-8); }
.auth-logo  { font-size: 36px; color: var(--accent); line-height: 1; }
.auth-title {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-top: var(--space-2);
}
.auth-tagline { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }

.auth-divider {
  display: flex; align-items: center; gap: var(--space-3);
  color: var(--text-muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-footer {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-2); margin-top: var(--space-5);
  font-size: 13px; color: var(--text-secondary);
}
.auth-link { color: var(--accent); font-weight: 500; }
.auth-link:hover { color: var(--accent-hover); }
.auth-sep { color: var(--text-muted); }

/* Recovery */
.recovery-header { margin-bottom: var(--space-6); }
.recovery-title  { font-size: 20px; font-weight: 600; margin-top: var(--space-3); }
.recovery-sub    { color: var(--text-secondary); font-size: 13px; margin-top: var(--space-2); }
.btn-back {
  display: inline-flex; align-items: center; gap: var(--space-2);
  color: var(--text-secondary); font-size: 13px;
  padding: 0; background: none; border: none;
  cursor: pointer; transition: color 0.15s;
}
.btn-back:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .auth-visual { width: 46%; }
  .auth-visual-quote { font-size: 36px; }
  .auth-visual-ui { padding: 32px 36px 40px; }
}

@media (max-width: 768px) {
  .auth-split { flex-direction: column; }
  .auth-visual {
    width: 100%;
    min-height: 260px;
    max-height: 300px;
  }
  .auth-visual::after { display: none; }
  .auth-visual-ui {
    min-height: 260px;
    padding: 24px 28px 28px;
    justify-content: flex-end;
  }
  .auth-visual-brand { display: none; }
  .auth-visual-quote { font-size: 26px; }
  .auth-visual-sub   { font-size: 14px; }
  .auth-panel {
    min-height: unset;
    padding: 36px 28px 48px;
  }
  .auth-h1 { font-size: 30px; }
}

@media (max-width: 480px) {
  .auth-visual { display: none; }
  .auth-panel  { min-height: 100dvh; padding: 48px 24px; }
  .auth-panel-scroll::before {
    content: '✦  Frankly';
    display: block;
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--accent);
    margin-bottom: 28px;
    letter-spacing: -0.01em;
  }
}

/* ==================== TOAST ==================== */
.toast-container {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  z-index: 10000;
  display: flex; flex-direction: column; gap: var(--space-3);
  max-width: 360px; width: calc(100% - 32px);
  pointer-events: none;
}

.toast {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 12px var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: all;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast--visible { opacity: 1; transform: translateX(0); }
.toast__icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.toast__msg  { flex: 1; line-height: 1.4; }
.toast__close {
  color: var(--text-muted); font-size: 13px; flex-shrink: 0;
  padding: 2px 4px; border-radius: 4px; transition: color 0.15s;
}
.toast__close:hover { color: var(--text); }

.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--danger);  }
.toast--warning .toast__icon { color: var(--warning); }
.toast--info    .toast__icon { color: var(--info);    }

/* ==================== LOADER ==================== */
.loader-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(13,13,13,0.8);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
.loader-overlay--out { animation: fadeOut 0.2s forwards; }
.loader-box { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.loader-msg { color: var(--text-secondary); font-size: 14px; }

/* ==================== MODAL ==================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay--visible { opacity: 1; }
.modal-open { overflow: hidden; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  animation: scaleIn 0.2s cubic-bezier(0.22,1,0.36,1);
  overflow: hidden;
}
.modal--sm { max-width: 360px; }
.modal--md { max-width: 520px; }
.modal--lg { max-width: 860px; }
.modal--story { max-width: 380px; padding: 0; background: #000; }

.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal__title { font-size: 16px; font-weight: 600; }
.modal__close { color: var(--text-muted); font-size: 16px; padding: 4px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.modal__close:hover { color: var(--text); background: var(--bg-3); }

.modal__body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.modal--story .modal__body { padding: 0; }

.modal__footer {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ==================== BOTTOM SHEET ==================== */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-end;
  opacity: 0; transition: opacity 0.2s;
}
.sheet-overlay--visible { opacity: 1; }
.sheet-overlay--visible .sheet { transform: translateY(0); }

.sheet {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-height: 80dvh;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) var(--space-8);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
}
.sheet__handle {
  width: 40px; height: 4px;
  background: var(--bg-4);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-4);
}
.sheet__header { margin-bottom: var(--space-4); }
.sheet__title  { font-size: 15px; font-weight: 600; }
.sheet__body   { display: flex; flex-direction: column; }

/* ==================== ACTION LIST ==================== */
.action-list { display: flex; flex-direction: column; gap: var(--space-1); }
.action-list-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text);
  transition: background 0.15s;
  width: 100%;
  text-align: left;
}
.action-list-item:hover { background: var(--bg-3); }
.action-list-item--danger { color: var(--danger); }

/* ==================== SKELETON ==================== */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 25%, var(--bg-4) 50%, var(--bg-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-md);
}
.skeleton--circle { border-radius: 50%; width: 44px; height: 44px; }
.skeleton--line   { height: 14px; border-radius: var(--radius-full); }
.skeleton--block  { border-radius: var(--radius-md); }

.skeleton-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); background: var(--surface); border-radius: var(--radius-lg);
}
.skeleton-header { display: flex; align-items: center; gap: var(--space-3); }
.skeleton-lines  { display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.skeleton-chat-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.skeleton-profile {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3);
  padding: var(--space-10);
  text-align: center;
  min-height: 240px;
}
.empty-state__icon  { font-size: 48px; line-height: 1; }
.empty-state__title { font-size: 18px; font-weight: 600; }
.empty-state__subtitle { color: var(--text-secondary); font-size: 14px; max-width: 260px; }
.empty-state__action { margin-top: var(--space-2); }

/* ==================== AVATAR ==================== */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-4);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}
.avatar--group { border-radius: var(--radius-md); background: var(--accent-dim); color: var(--accent); }

.verified-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: var(--accent);
  color: #0d0d0d;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
}
.verified-badge--lg { width: 20px; height: 20px; font-size: 11px; }

.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px;
  background: var(--online);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}
.online-text { color: var(--online); font-size: 12px; }

/* ==================== HASHTAG / MENTION ==================== */
.hashtag { color: var(--accent); }
.mention  { color: var(--info); }

/* ==================== FEED ==================== */
.feed-layout {
  max-width: 640px; margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-5);
}

/* Stories */
.stories-section { overflow: hidden; }
.stories-scroll  { display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-2); scrollbar-width: none; }
.stories-scroll::-webkit-scrollbar { display: none; }

.story-item { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); cursor: pointer; flex-shrink: 0; }
.story-item--viewed { opacity: 0.6; }

.story-ring {
  padding: 2px;
  border-radius: 50%;
  position: relative;
}
.story-ring--unseen {
  background: conic-gradient(var(--accent) 0%, var(--accent) 100%);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}
.story-ring--viewed {
  background: var(--bg-4);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--bg-4);
}
.story-ring--add {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent-dim);
}
.story-name { font-size: 11px; color: var(--text-secondary); max-width: 60px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.story-add-icon {
  position: absolute; bottom: 0; right: 0;
  width: 18px; height: 18px;
  background: var(--accent);
  color: #0d0d0d;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid var(--bg-2);
}

/* Story viewer */
.story-viewer {
  position: relative;
  width: 100%; height: 560px;
  display: flex; flex-direction: column;
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.story-progress-row { display: flex; gap: 3px; padding: var(--space-3); position: relative; z-index: 2; }
.story-progress-bar { flex: 1; height: 3px; background: rgba(255,255,255,0.3); border-radius: 2px; }
.story-progress-bar--done   { background: rgba(255,255,255,0.9); }
.story-progress-bar--active { background: rgba(255,255,255,0.9); animation: storyProgress 5s linear forwards; }
@keyframes storyProgress { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0% 0 0); } }

.story-top-bar { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-3) var(--space-3); position: relative; z-index: 2; }
.story-user-info { display: flex; flex-direction: column; }
.story-username { font-size: 14px; font-weight: 600; color: #fff; }
.story-time     { font-size: 11px; color: rgba(255,255,255,0.6); }

.story-text-content {
  flex: 1; display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600; color: #fff;
  text-align: center; padding: var(--space-8);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.story-media   { flex: 1; width: 100%; object-fit: cover; }
.story-caption { padding: var(--space-3); color: rgba(255,255,255,0.9); font-size: 14px; text-align: center; }
.story-nav     { position: absolute; inset: 0; display: flex; }
.story-nav-prev, .story-nav-next { flex: 1; cursor: pointer; }

/* Create post bar */
.create-post-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.create-post-bar__inner {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4);
}
.create-post-trigger {
  flex: 1; text-align: left; color: var(--text-muted); font-size: 14px;
  padding: 8px 14px;
  background: var(--bg-3);
  border-radius: var(--radius-full);
  transition: background 0.15s;
}
.create-post-trigger:hover { background: var(--bg-4); color: var(--text-secondary); }
.create-post-media-btn { color: var(--text-muted); transition: color 0.15s; }
.create-post-media-btn:hover { color: var(--accent); }

/* Create post modal */
.create-post-form    { display: flex; flex-direction: column; gap: var(--space-4); }
.create-post-header  { display: flex; align-items: center; gap: var(--space-3); }
.create-post-name    { font-size: 14px; font-weight: 600; }
.create-post-visibility { font-size: 12px; color: var(--text-muted); }
.create-post-textarea {
  min-height: 100px; resize: none;
  font-size: 16px; line-height: 1.5;
}
.media-preview-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.media-preview-item { position: relative; }
.media-preview-thumb {
  width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-md);
}
.media-preview-remove {
  position: absolute; top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--danger); color: #fff;
  border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.media-upload-bar { border-top: 1px solid var(--border); padding-top: var(--space-3); }

/* Post card */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}
.post-card:hover { border-color: var(--border-strong); }

.post-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4); }
.post-author { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.post-author-info { display: flex; flex-direction: column; }
.post-author-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.post-time { font-size: 12px; color: var(--text-muted); }

.post-caption { padding: 0 var(--space-4) var(--space-3); font-size: 14px; line-height: 1.6; }
.post-media   { display: grid; }
.post-media--grid { grid-template-columns: 1fr 1fr; gap: 2px; }
.post-media-item { width: 100%; max-height: 480px; object-fit: cover; }
video.post-media-item { max-height: 480px; }

.post-actions {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}
.post-action-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-md);
  font-size: 14px; color: var(--text-secondary);
  transition: color 0.15s, background 0.15s;
}
.post-action-btn:hover { background: var(--bg-3); color: var(--text); }
.post-action-btn--liked { color: var(--danger); }
.post-action-btn--saved { color: var(--accent); }

.post-menu { position: relative; }
.post-menu-btn { color: var(--text-muted); padding: 6px; border-radius: var(--radius-md); transition: background 0.15s; }
.post-menu-btn:hover { background: var(--bg-3); }

/* Comments */
.comments-list { display: flex; flex-direction: column; gap: var(--space-4); max-height: 320px; overflow-y: auto; }
.comment-item  { display: flex; gap: var(--space-3); }
.comment-bubble { flex: 1; background: var(--bg-3); border-radius: var(--radius-md); padding: var(--space-3); }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-text   { font-size: 14px; margin-top: 2px; line-height: 1.5; }
.comment-time   { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }
.comment-input-row { display: flex; gap: var(--space-3); align-items: center; padding-top: var(--space-4); border-top: 1px solid var(--border); margin-top: var(--space-4); }
.no-comments { color: var(--text-muted); font-size: 14px; text-align: center; padding: var(--space-6); }

/* ==================== CHAT ==================== */
.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100dvh;
}
@media (max-width: 768px) {
  .chat-layout {
    grid-template-columns: 1fr;
    position: relative;
  }

  /* Default: show sidebar (chat list), hide thread */
  .chat-sidebar {
    display: flex;
    width: 100%;
    height: 100dvh;
    border-right: none;
  }

  .chat-main {
    display: none !important;
    position: absolute;
    inset: 0;
    z-index: 50;
    background: var(--bg);
  }

  /* When a thread is open: hide list, show thread */
  .chat-layout--open .chat-sidebar { display: none !important; }
  .chat-layout--open .chat-main    { display: flex !important; }

  /* Back button — only meaningful on mobile */
  .chat-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-3);
    border: none;
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
  }
  .chat-back-btn:hover { background: var(--bg-4); }
}

@media (min-width: 769px) {
  .chat-back-btn { display: none; }
  /* Always show both panels on desktop */
  .chat-sidebar { display: flex !important; }
  .chat-main    { display: flex !important; position: static !important; }
}

.chat-sidebar {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.chat-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-5) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.chat-sidebar-title { font-size: 18px; font-weight: 700; }
.chat-search-wrap { padding: var(--space-3) var(--space-4); }
.chat-search-input {
  width: 100%; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: var(--radius-full);
  color: var(--text); font-size: 14px;
  padding: 8px 14px; outline: none; transition: border-color 0.15s;
}
.chat-search-input:focus { border-color: var(--accent); }

.chat-tabs { display: flex; padding: 0 var(--space-4) var(--space-2); gap: var(--space-1); }
.chat-tab {
  flex: 1; padding: 6px; border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.chat-tab:hover { background: var(--bg-3); }
.chat-tab--active { background: var(--accent-dim); color: var(--accent); }

.chat-list { flex: 1; overflow-y: auto; }
.chat-list-empty { color: var(--text-muted); font-size: 14px; text-align: center; padding: var(--space-8); }

.chat-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer; transition: background 0.15s;
  position: relative;
}
.chat-row:hover { background: var(--bg-3); }
.chat-row--active { background: var(--accent-dim); }
.chat-row--unread .chat-row-name { font-weight: 700; }

.chat-row-avatar { position: relative; flex-shrink: 0; }
.chat-row-body { flex: 1; min-width: 0; }
.chat-row-top { display: flex; justify-content: space-between; align-items: center; }
.chat-row-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.chat-row-bottom { display: flex; align-items: center; gap: var(--space-2); margin-top: 2px; }
.chat-row-last { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.unread-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }
.mute-icon  { font-size: 12px; flex-shrink: 0; }
.pin-badge  { position: absolute; top: -4px; right: -4px; font-size: 10px; }

.chat-row-menu-btn {
  opacity: 0; color: var(--text-muted); padding: 4px; border-radius: 4px;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.chat-row:hover .chat-row-menu-btn { opacity: 1; }

/* Chat main / thread */
.chat-main { display: flex; flex-direction: column; overflow: hidden; }
.chat-empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--space-4);
  color: var(--text-muted);
}
.chat-empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text); }
.chat-empty-state p  { font-size: 14px; }

.chat-thread { display: flex; flex-direction: column; height: 100dvh; }

.chat-thread-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.thread-header-user { display: flex; align-items: center; gap: var(--space-3); flex: 1; cursor: pointer; }
.thread-header-name { font-size: 15px; font-weight: 600; }
.thread-header-status { font-size: 12px; color: var(--text-muted); }
.thread-header-actions { display: flex; gap: var(--space-1); }

.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }

.message-row { display: flex; align-items: flex-end; gap: var(--space-2); }
.message-row--mine    { flex-direction: row-reverse; }
.message-row--call    { justify-content: center; }
.call-message { font-size: 12px; color: var(--text-muted); background: var(--bg-3); padding: 6px 14px; border-radius: var(--radius-full); }

.message-bubble-wrap { display: flex; flex-direction: column; max-width: 68%; gap: 4px; }
.message-row--mine .message-bubble-wrap { align-items: flex-end; }

.message-bubble {
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: 14px; line-height: 1.5;
  position: relative;
}
.bubble--mine   { background: var(--accent); color: #0d0d0d; border-bottom-right-radius: 4px; }
.bubble--theirs { background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px; }

.msg-text { margin: 0; word-break: break-word; }
.msg-time { font-size: 10px; opacity: 0.6; margin-top: 4px; display: block; text-align: right; }

.msg-img   { max-width: 240px; border-radius: var(--radius-md); }
.msg-video { max-width: 240px; border-radius: var(--radius-md); }
.msg-file-link { font-size: 13px; padding: 6px 10px; background: rgba(0,0,0,0.2); border-radius: var(--radius-md); display: block; }
.msg-files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }

.reply-preview {
  background: rgba(0,0,0,0.2); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 4px 8px;
  font-size: 12px; margin-bottom: 4px;
}
.reply-author { font-weight: 600; display: block; }
.reply-text   { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-pill {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--radius-full); padding: 2px 8px; font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.reaction-pill:hover { background: var(--bg-4); }

.msg-actions {
  display: none; gap: 4px;
  opacity: 0; transition: opacity 0.15s;
}
.message-bubble-wrap:hover .msg-actions { display: flex; opacity: 1; }
.msg-action-btn {
  padding: 4px 6px; border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border); transition: background 0.15s;
}
.msg-action-btn:hover { background: var(--bg-4); }
.msg-action-btn--danger:hover { background: var(--danger-dim); color: var(--danger); }

.messages-empty { color: var(--text-muted); font-size: 14px; text-align: center; padding: var(--space-8); }

/* Chat input */
.chat-input-area { flex-shrink: 0; border-top: 1px solid var(--border); padding: var(--space-3) var(--space-4); background: var(--bg-2); }
.reply-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-3); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2);
  font-size: 13px;
}
.reply-bar-inner { display: flex; align-items: center; gap: var(--space-2); overflow: hidden; }
.reply-bar-icon  { color: var(--accent); }
.reply-bar-text  { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-bar-close { color: var(--text-muted); font-size: 13px; }

.typing-indicator { font-size: 12px; color: var(--text-muted); margin-bottom: var(--space-2); }

.chat-input-row { display: flex; align-items: flex-end; gap: var(--space-2); }
.chat-input {
  flex: 1; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  color: var(--text); font-size: 14px; padding: 10px 14px;
  outline: none; resize: none; max-height: 140px; overflow-y: auto; line-height: 1.5;
  transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.send-btn { color: var(--accent); }
.send-btn:disabled { color: var(--text-muted); }

/* User search modal */
.user-result {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius-md);
  cursor: pointer; transition: background 0.15s;
}
.user-result:hover, .user-result--selected { background: var(--bg-3); }
.user-result--selected { border: 1px solid var(--accent); background: var(--accent-dim); }
.user-result-info { display: flex; flex-direction: column; }
.user-result-name { font-size: 14px; font-weight: 600; }
.user-result-username { font-size: 12px; color: var(--text-muted); }
.search-hint { color: var(--text-muted); font-size: 14px; text-align: center; padding: var(--space-4); }
.user-search-results { display: flex; flex-direction: column; gap: var(--space-1); max-height: 320px; overflow-y: auto; }

/* Emoji picker */
.emoji-picker-row { display: flex; justify-content: space-around; padding: var(--space-4); }
.emoji-btn { font-size: 28px; padding: var(--space-2); border-radius: var(--radius-md); transition: background 0.15s, transform 0.15s; }
.emoji-btn:hover { background: var(--bg-3); transform: scale(1.2); }


/* ==================== NEW CHAT DROPDOWN ==================== */

.nc-trigger-btn {
  position: relative;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.nc-trigger-btn[aria-expanded="true"] {
  background: var(--accent-dim);
  color: var(--accent);
}
.nc-icon-compose, .nc-icon-close {
  transition: opacity 0.15s, transform 0.2s;
}

.nc-dropdown {
  position: fixed;
  width: 300px;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 12px 40px rgba(0,0,0,0.35),
    0 4px 12px rgba(0,0,0,0.2);
  overflow: hidden;
  transform-origin: top right;
  animation: nc-in 0.18s cubic-bezier(0.22,1,0.36,1) both;
}
.nc-dropdown--out {
  animation: nc-out 0.14s ease forwards;
}
@keyframes nc-in {
  from { opacity: 0; transform: scale(0.94) translateY(-8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);    }
}
@keyframes nc-out {
  to { opacity: 0; transform: scale(0.95) translateY(-5px); }
}

.nc-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.nc-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-3);
  border-radius: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.nc-search-row:focus-within {
  border-color: var(--accent);
  background: var(--bg-3);
}
.nc-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  min-width: 0;
}
.nc-input::placeholder { color: var(--text-muted); }

.nc-new-group-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.nc-new-group-row:hover { background: var(--bg-3); }
.nc-group-icon-wrap {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg-4);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.nc-group-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.nc-group-arrow { color: var(--text-muted); flex-shrink: 0; }

.nc-sep {
  height: 1px;
  background: var(--border);
}
.nc-section-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 14px 3px;
}
.nc-list {
  max-height: 260px;
  overflow-y: auto;
  padding-bottom: 6px;
}

.nc-user-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.nc-user-row:hover { background: var(--bg-3); }
.nc-user-row:hover .nc-dm-arrow { opacity: 1; }

.nc-avatar-wrap { position: relative; flex-shrink: 0; }
.nc-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-2);
}
.nc-user-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.nc-uname {
  font-size: 13px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-uhandle {
  font-size: 11.5px;
  color: var(--text-muted);
}
.nc-dm-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s;
}

.nc-shimmer-list { display: flex; flex-direction: column; gap: 0; }
.nc-shimmer-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
}
.nc-empty {
  font-size: 13px; color: var(--text-muted);
  text-align: center; padding: 20px; margin: 0;
}

/* ==================== NEW GROUP MODAL ==================== */

.ng-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Group name row */
.ng-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}
.ng-name-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.ng-name-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-4);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}
.ng-name-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  font-family: inherit;
}
.ng-name-input::placeholder { color: var(--text-muted); }

/* Search row */
.ng-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color 0.15s;
}
.ng-search-row:focus-within { border-color: var(--accent); }
.ng-search-input {
  flex: 1;
  background: none; border: none; outline: none;
  font-size: 13px; color: var(--text);
  font-family: inherit; min-width: 0;
}
.ng-search-input::placeholder { color: var(--text-muted); }

/* People scroll area */
.ng-people-scroll {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-2);
  overflow: hidden;
  overflow-y: auto;
}

/* Section label (Selected / Suggested) */
.ng-section-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 14px 4px;
  position: sticky;
  top: 0;
  background: var(--bg-2);
  z-index: 1;
}

/* Person row */
.ng-person-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.ng-person-row:hover { background: var(--bg-3); }
.ng-person-row--selected { background: rgba(255, 157, 0, 0.05); }
.ng-person-row--selected:hover { background: rgba(255, 157, 0, 0.09); }

.ng-person-avatar { position: relative; flex-shrink: 0; }
.ng-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success);
  border: 2px solid var(--bg-2);
}
.ng-person-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.ng-person-name {
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ng-person-handle {
  font-size: 12px;
  color: var(--text-muted);
}

/* Check circle */
.ng-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-4);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.ng-check--on {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
  transform: scale(1.12);
}

/* Shimmer rows */
.ng-shimmer-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px;
}

/* Footer */
.ng-footer-left {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  flex: 1;
  display: flex;
  align-items: center;
}

/* Empty hint */
.ng-empty-hint {
  font-size: 13px; color: var(--text-muted);
  text-align: center; padding: 24px 16px; margin: 0;
}

/* ==================== PROFILE ==================== */
.profile-page { max-width: 900px; margin: 0 auto; }

.profile-cover {
  height: 200px; background: linear-gradient(135deg, var(--bg-3) 0%, var(--bg-4) 100%);
  background-size: cover; background-position: center;
  position: relative; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  overflow: hidden;
}
.cover-edit-btn {
  position: absolute; top: var(--space-4); right: var(--space-4);
  background: rgba(0,0,0,0.6); color: #fff;
  padding: 6px 12px; border-radius: var(--radius-md); font-size: 13px;
  display: flex; align-items: center; gap: var(--space-2);
  backdrop-filter: blur(4px); transition: background 0.15s;
}
.cover-edit-btn:hover { background: rgba(0,0,0,0.8); }

.profile-top {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 var(--space-6) var(--space-4);
  margin-top: -44px;
}
.profile-avatar-wrap { position: relative; }
.profile-avatar {
  width: 88px; height: 88px; border-radius: 50%;
  border: 3px solid var(--bg-2);
  overflow: hidden;
}
.avatar-edit-btn {
  position: absolute; bottom: 0; right: 0;
  width: 28px; height: 28px;
  background: var(--accent); color: #0d0d0d;
  border-radius: 50%; border: 2px solid var(--bg-2);
  display: flex; align-items: center; justify-content: center;
}
.profile-actions { display: flex; gap: var(--space-2); padding-bottom: var(--space-2); }
/* Settings cog in own-profile: mobile only (desktop has it in the sidebar nav) */
.profile-settings-btn { display: none; }
@media (max-width: 600px) {
  .profile-settings-btn { display: inline-flex !important; }
}

.profile-info { padding: var(--space-3) var(--space-6) var(--space-6); }
.profile-name-row { display: flex; align-items: center; gap: var(--space-2); }
.profile-name     { font-size: 22px; font-weight: 700; }
.profile-username { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.profile-bio      { margin-top: var(--space-3); font-size: 14px; line-height: 1.6; }
.profile-meta     { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); margin-top: var(--space-4); }
.meta-item        { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }
.meta-item a      { color: var(--accent); }

.profile-stats {
  display: flex; gap: var(--space-8); margin-top: var(--space-5);
}
.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-num   { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.profile-tabs {
  display: flex; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
}
.profile-tab {
  flex: 1; padding: var(--space-4) var(--space-3);
  font-size: 14px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}
.profile-tab:hover { color: var(--text); }
.profile-tab--active { color: var(--accent); border-bottom-color: var(--accent); }

.posts-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; }
.post-grid-item {
  aspect-ratio: 1; overflow: hidden; position: relative;
  cursor: pointer; background: var(--bg-3);
}
.post-grid-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.post-grid-item:hover .post-grid-thumb { transform: scale(1.05); }
.post-grid-text-thumb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-3); font-size: 13px; text-align: center;
  color: var(--text-secondary);
}
.post-grid-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; gap: var(--space-4);
  opacity: 0; transition: opacity 0.2s;
  font-size: 14px; font-weight: 600; color: #fff;
}
.post-grid-item:hover .post-grid-overlay { opacity: 1; }

.post-modal-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 0; height: 500px; }
.post-modal-media  { background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.post-modal-media-item { max-width: 100%; max-height: 100%; object-fit: contain; }
.post-modal-text-only { padding: var(--space-6); font-size: 18px; color: var(--text); }
.post-modal-side { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); overflow-y: auto; }
.post-modal-author { display: flex; align-items: center; gap: var(--space-3); }
.post-modal-caption { font-size: 14px; line-height: 1.6; }
.post-modal-actions { display: flex; gap: var(--space-4); font-size: 14px; color: var(--text-secondary); margin-top: auto; }
.post-modal-comments { display: flex; flex-direction: column; gap: var(--space-3); flex: 1; overflow-y: auto; }

.user-list-modal   { display: flex; flex-direction: column; gap: var(--space-1); }
.user-list-item    { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s; }
.user-list-item:hover { background: var(--bg-3); }
.user-list-info    { display: flex; flex-direction: column; }
.user-list-name    { font-size: 14px; font-weight: 600; }
.user-list-username { font-size: 12px; color: var(--text-muted); }

/* ==================== EXPLORE ==================== */
.explore-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.explore-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.explore-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.explore-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.explore-tab {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.explore-tab:hover {
  background: var(--hover);
  color: var(--text);
}
.explore-tab--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* Reels redirect tab gets a subtle arrow hint */
.explore-tab--redirect::after {
  content: ' ↗';
  font-size: 11px;
  opacity: 0.7;
}

/* Search — compact, right-aligned, not full width */
.explore-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 220px;
  flex-shrink: 0;
  transition: width 0.25s ease;
}
.explore-search-wrap:focus-within {
  width: 300px;
}

.explore-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-secondary);
  pointer-events: none;
}

.explore-search-input {
  width: 100%;
  padding: 8px 32px 8px 34px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
}
.explore-search-input:focus {
  border-color: var(--accent);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.explore-search-input::placeholder { color: var(--text-muted); }

@media (max-width: 700px) {
  .explore-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px 8px;
  }
  .explore-tabs {
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .explore-tabs::-webkit-scrollbar { display: none; }
  .explore-search-wrap,
  .explore-search-wrap:focus-within {
    width: 100%;
  }
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
  line-height: 1;
}

.explore-body {
  flex: 1;
  overflow-y: auto;
}

.explore-body { flex: 1; overflow-y: auto; padding: var(--space-5); }

/* Trending */
.trending-page { display: flex; flex-direction: column; gap: var(--space-5); }
.section-title { font-size: 16px; font-weight: 700; }
.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
}
.trending-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}
.trending-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.trending-rank {
  position: absolute; top: var(--space-3); left: var(--space-3);
  background: rgba(0,0,0,0.7); color: var(--accent);
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}
.trending-thumb { width: 100%; height: 140px; object-fit: cover; }
.trending-text-thumb {
  width: 100%; height: 140px;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); font-size: 13px; color: var(--text-secondary);
  background: var(--bg-3); text-align: center;
}
.trending-info { padding: var(--space-3); }
.trending-author { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; }
.trending-caption { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.trending-stats { display: flex; gap: var(--space-3); font-size: 12px; color: var(--text-muted); margin-top: var(--space-2); }
.trending-video-badge {
  position: absolute; bottom: var(--space-3); right: var(--space-3);
  background: rgba(0,0,0,0.7); color: #fff;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
}

/* Search results */
.search-section { margin-bottom: var(--space-6); }
.search-section-title { font-size: 14px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-3); }
.user-results { display: flex; flex-direction: column; gap: var(--space-1); }
.user-result-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border-radius: var(--radius-md);
  cursor: pointer; transition: background 0.15s;
}
.user-result-row:hover { background: var(--bg-3); }
.search-posts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.mini-post-card { aspect-ratio: 1; background: var(--bg-3); border-radius: var(--radius-sm); overflow: hidden; cursor: pointer; }
.mini-post-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.mini-post-card:hover .mini-post-thumb { transform: scale(1.05); }
.mini-post-text { padding: var(--space-2); font-size: 12px; color: var(--text-secondary); }

/* Reels */
.reels-feed { display: flex; flex-direction: column; gap: var(--space-4); }
.reel-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  background: #000; max-width: 420px; margin: 0 auto;
}
.reel-video { width: 100%; max-height: 580px; object-fit: cover; display: block; }
.reel-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.reel-play-btn {
  width: 64px; height: 64px; background: rgba(0,0,0,0.5); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); transition: transform 0.15s;
}
.reel-play-btn:hover { transform: scale(1.1); }
.reel-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: var(--space-4);
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
}
.reel-author { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; font-weight: 600; color: #fff; cursor: pointer; }
.reel-caption { font-size: 13px; color: rgba(255,255,255,0.85); margin-top: var(--space-2); }
.reel-actions { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.reel-action-btn { font-size: 13px; color: #fff; background: rgba(255,255,255,0.15); padding: 6px 12px; border-radius: var(--radius-full); backdrop-filter: blur(4px); transition: background 0.15s; }
.reel-action-btn:hover { background: rgba(255,255,255,0.25); }
.reel-action-btn--liked { color: var(--danger); }

/* Shorts */
.shorts-container { position: relative; max-width: 380px; margin: 0 auto; }
.shorts-feed { display: flex; flex-direction: column; }
.short-card { position: relative; height: 100dvh; max-height: 680px; border-radius: var(--radius-xl); overflow: hidden; background: #000; display: none; }
.short-card--active { display: block; }
.short-video { width: 100%; height: 100%; object-fit: cover; }
.short-overlay { position: absolute; top: var(--space-4); right: var(--space-4); }
.short-mute-btn { background: rgba(0,0,0,0.5); border-radius: 50%; width: 36px; height: 36px; font-size: 16px; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.short-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: var(--space-4);
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
}
.short-creator { font-size: 13px; color: rgba(255,255,255,0.8); margin-bottom: var(--space-3); }
.short-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.short-action-btn {
  font-size: 13px; color: #fff; background: rgba(255,255,255,0.15);
  padding: 6px 12px; border-radius: var(--radius-full);
  backdrop-filter: blur(4px); transition: background 0.15s;
  text-decoration: none;
}
.short-action-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }
.short-action-btn--active { background: var(--accent-dim); color: var(--accent); }
.shorts-controls { display: flex; flex-direction: column; gap: var(--space-3); position: fixed; right: var(--space-4); top: 50%; transform: translateY(-50%); z-index: 10; }
.shorts-nav-btn { width: 44px; height: 44px; background: var(--surface-2); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text); border: 1px solid var(--border); transition: background 0.15s; }
.shorts-nav-btn:hover { background: var(--bg-4); }
.shorts-nav-btn:disabled { opacity: 0.3; pointer-events: none; }


/* ==================== EXPLORE SHORTS (reels-style) ==================== */

.exs-shell {
  position: relative;
  width: 100%;
  height: calc(100vh - 100px); /* account for explore header */
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exs-track {
  width: min(100%, 680px);
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
}
.exs-track::-webkit-scrollbar { display: none; }

.exs-slide {
  flex-shrink: 0;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  box-sizing: border-box;
}

.exs-card {
  position: relative;
  flex-shrink: 0;
  width: 340px;
  height: 100%;
  max-height: calc(100% - 0px);
  border-radius: 14px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.exs-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.exs-tap-zone {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.exs-pause-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.exs-pf--show { opacity: 1; }

.exs-gradient {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 38%;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  z-index: 1;
  pointer-events: none;
}

.exs-info {
  position: absolute;
  bottom: 14px;
  left: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exs-creator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.exs-source-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
}
.exs-source-link:hover { color: #fff; }

/* Right actions */
.exs-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.exs-action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.exs-action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  color: white;
}
.exs-action-btn:active { transform: scale(0.88); }
.exs-action-btn--liked { background: rgba(255,59,92,0.3); }

.exs-action-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}

.exs-share-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* Nav arrows */
.exs-arrows {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
}

.exs-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.13);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s;
}
.exs-arrow:hover { background: rgba(255,255,255,0.25); }
.exs-arrow:disabled { opacity: 0.25; pointer-events: none; }

.exs-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: rgba(255,255,255,0.4);
  font-size: 15px;
}

@media (max-width: 768px) {
  .exs-track { width: 100%; }
  .exs-slide { padding: 0; gap: 0; }
  .exs-card { width: 100%; border-radius: 0; }
  .exs-actions {
    position: absolute;
    right: 10px;
    bottom: 90px;
    z-index: 10;
  }
  .exs-arrows { display: none; }
}

/* ==================== NOTIFICATIONS ==================== */
.notif-page { max-width: 640px; margin: 0 auto; padding: var(--space-6) var(--space-4); }
.notif-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-5); }
.notif-title  { font-size: 22px; font-weight: 700; }
.notif-group  { margin-bottom: var(--space-5); }
.notif-group-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); padding: 0 var(--space-2); }

.notif-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  cursor: pointer; transition: background 0.15s;
  position: relative;
}
.notif-item:hover { background: var(--bg-3); }
.notif-item--unread { background: var(--accent-dim); }
.notif-item--unread:hover { background: rgba(245,166,35,0.2); }
.notif-avatar-wrap { position: relative; flex-shrink: 0; }
.notif-type-icon {
  position: absolute; bottom: -2px; right: -4px;
  font-size: 13px; background: var(--bg-2); border-radius: 50%; padding: 1px;
}
.notif-body { flex: 1; }
.notif-text { font-size: 14px; line-height: 1.5; }
.notif-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; display: block; }
.notif-dot  { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; flex-shrink: 0; }

/* ==================== NEWS ==================== */
.news-page { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.news-header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border); background: var(--bg-2); flex-shrink: 0; }
.news-search-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-3);
  border-radius: var(--radius-full);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.news-search-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.news-search-wrap svg {
  flex-shrink: 0;
  color: var(--text-muted);
}
.news-search-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 0;
  min-width: 0;
}
.news-search-wrap input::placeholder { color: var(--text-muted); }

/* Mobile: full-width header stack */
@media (max-width: 600px) {
  .news-header {
    padding: var(--space-3) var(--space-4);
  }
  .news-search-wrap {
    padding: 0 var(--space-3);
  }
  .news-search-wrap input {
    font-size: 14px;
    padding: 10px 0;
  }
}

.news-categories { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.news-cats-scroll { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.news-cats-scroll::-webkit-scrollbar { display: none; }
.news-cat-btn {
  padding: 6px 16px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500;
  color: var(--text-secondary); background: var(--bg-3); border: 1px solid var(--border);
  white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.news-cat-btn:hover { color: var(--text); border-color: var(--border-strong); }
.news-cat-btn--active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* Scrollable articles container */
.news-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5);
}

/* ── Desktop grid: photo articles left, text articles right ── */
.news-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-5);
  align-items: start;
}

/* Left column: stacked photo cards */
.news-col-photo {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Right column: stacked text-only cards */
.news-col-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── PHOTO CARD (left column) ── */
.news-card-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-3);
  min-height: 300px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}
.news-card-photo:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.news-card-photo .news-thumb {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.news-card-photo .news-card-body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
  background: var(--surface);
}

/* ── TEXT CARD (right column) ── */
.news-card-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color 0.2s, background 0.2s;
  min-height: 100px;
}
.news-card-text:hover { border-color: var(--border-strong); background: var(--surface-2); }

/* ── SHARED card internals ── */
.news-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.news-source { font-size: 12px; font-weight: 600; color: var(--accent); }
.news-dot    { color: var(--text-muted); font-size: 12px; }
.news-time   { font-size: 12px; color: var(--text-muted); }

.news-card-photo .news-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.35;
  color: var(--text);
  font-weight: 400;
}
.news-card-text .news-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-photo .news-card-desc { -webkit-line-clamp: 3; }

.news-card-footer { margin-top: auto; padding-top: var(--space-2); }
.news-read-more { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: 0.01em; }

.news-load-more {
  display: flex; justify-content: center; align-items: center;
  padding: var(--space-6) 0;
  grid-column: 1 / -1;
}
.news-load-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--bg-4);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
#news-sentinel { height: 1px; width: 100%; }

/* ── Fallback: single-column list (used on mobile + search results) ── */
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.news-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.news-card-inner { display: flex; gap: 0; min-height: 110px; }
.news-thumb-wrap { flex-shrink: 0; width: 120px; height: 110px; overflow: hidden; }
.news-thumb-wrap .news-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card .news-card-body {
  flex: 1; padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
  min-height: 110px;
}

/* ── Responsive: collapse to single column on tablet/mobile ── */
@media (max-width: 1024px) {
  .news-grid {
    grid-template-columns: 1fr 280px;
  }
}

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
  .news-col-text {
    display: none; /* stack text cards below on mobile — JS handles order */
  }
  .news-list { padding: var(--space-3); }
  .news-card-photo .news-thumb { height: 180px; }
  .news-card-photo .news-card-title { font-size: 16px; }
}

/* ==================== SETTINGS ==================== */
.settings-page {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}

@media (max-width: 768px) {
  .settings-page {
    grid-template-columns: 1fr;
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
  }

  /* Default: show sidebar nav list */
  .settings-sidebar {
    width: 100%;
    min-height: 100dvh;
    border-right: none;
  }

  /* Default: hide section */
  .settings-main {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 40;
    background: var(--bg);
    overflow-y: auto;
    padding: var(--space-5) var(--space-4);
  }

  /* When section is open: flip visibility */
  .settings-page--open .settings-sidebar { display: none; }
  .settings-page--open .settings-main    { display: block; }

  .settings-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0 var(--space-5) 0;
    opacity: 1;
    transition: opacity 0.15s;
  }
  .settings-back-btn:hover { opacity: 0.7; }
}

@media (min-width: 769px) {
  .settings-sidebar { display: flex !important; }
  .settings-main    { display: block !important; position: static !important; padding: var(--space-8); }
  .settings-back-btn { display: none !important; }
}

.settings-sidebar {
  background: var(--bg-2); border-right: 1px solid var(--border);
  padding: var(--space-6) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.settings-user-card { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.settings-user-name   { font-size: 15px; font-weight: 600; }
.settings-user-handle { font-size: 13px; color: var(--text-muted); }

.settings-nav { display: flex; flex-direction: column; gap: var(--space-1); flex: 1; }
.settings-nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-3); border-radius: var(--radius-md);
  font-size: 14px; color: var(--text-secondary); text-align: left;
  transition: background 0.15s, color 0.15s;
}
.settings-nav-item:hover { background: var(--bg-3); color: var(--text); }
.settings-nav-item--active { background: var(--accent-dim); color: var(--accent); }
.settings-logout-btn { margin-top: auto; width: 100%; }

.settings-main { padding: var(--space-8); overflow-y: auto; }
.settings-section { max-width: 560px; display: flex; flex-direction: column; gap: var(--space-6); }
.settings-section-title { font-size: 22px; font-weight: 700; padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.settings-section-desc { font-size: 14px; color: var(--text-secondary); }

.settings-form { display: flex; flex-direction: column; gap: var(--space-4); }
.settings-group { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.settings-group--danger { border-color: var(--danger-dim); }
.settings-group-title { font-size: 15px; font-weight: 600; }
.settings-group-desc  { font-size: 13px; color: var(--text-secondary); }
.settings-toggle-row  { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.settings-toggle-info { flex: 1; }
.settings-toggle-label { font-size: 14px; }
.settings-info-box { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); font-size: 14px; color: var(--text-secondary); }

.account-info-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.account-info-row:last-child { border-bottom: none; }
.account-info-label { font-size: 13px; color: var(--text-muted); }
.account-info-value { font-size: 14px; font-weight: 500; }

/* Safe folder */
.safe-folder-setup { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-6); text-align: center; }
.safe-folder-icon  { font-size: 52px; }
.safe-folder-status { display: flex; align-items: center; gap: var(--space-3); }
.sf-type { font-size: 13px; color: var(--text-muted); }
.sf-actions { display: flex; flex-direction: column; gap: var(--space-3); }
.sf-unlocked-msg { font-size: 14px; color: var(--success); }
.sf-setup-form { display: flex; flex-direction: column; gap: var(--space-5); }
.sf-type-selector { display: flex; gap: var(--space-2); }
.status-badge { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: var(--radius-full); }
.status-badge--green { background: var(--success-dim); color: var(--success); }

/* Account deletion */
.delete-account-form { display: flex; flex-direction: column; gap: var(--space-4); }
.delete-warn { font-size: 14px; line-height: 1.6; color: var(--text-secondary); padding: var(--space-3); background: var(--danger-dim); border-radius: var(--radius-md); border: 1px solid rgba(224,82,82,0.3); }
.confirm-msg { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

/* Edit profile */
.edit-profile-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* ==================== CALL OVERLAY ==================== */
.call-overlay {
  position: fixed; inset: 0; z-index: 9998;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, #0a0a0a 0%, #1a1000 100%);
  animation: fadeIn 0.3s;
}
.call-overlay--closing { animation: fadeOut 0.3s forwards; }

.call-bg { position: absolute; inset: 0; overflow: hidden; }
.call-remote-video { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.call-avatar-bg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }

.call-local-video {
  position: absolute; top: var(--space-5); right: var(--space-5);
  width: 120px; height: 160px; border-radius: var(--radius-lg);
  object-fit: cover; border: 2px solid rgba(255,255,255,0.2);
  box-shadow: var(--shadow-lg); z-index: 2;
}

.call-info {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 80px; gap: var(--space-3);
}
.call-display-name { font-size: 28px; font-weight: 700; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,0.5); }
.call-status   { font-size: 15px; color: rgba(255,255,255,0.7); }
.call-duration { font-size: 22px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }

.call-controls {
  position: absolute; bottom: 60px; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: var(--space-5);
}
.call-btn {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; transition: transform 0.15s, background 0.15s;
  backdrop-filter: blur(8px);
}
.call-btn:hover { transform: scale(1.08); }
.call-btn:active { transform: scale(0.95); }
.call-btn--end     { background: var(--danger); color: #fff; }
.call-btn--decline { background: var(--danger); color: #fff; }
.call-btn--accept  { background: var(--success); color: #fff; }
.call-btn--mute    { background: rgba(255,255,255,0.2); color: #fff; }
.call-btn--cam     { background: rgba(255,255,255,0.2); color: #fff; }
.call-btn--active  { background: rgba(255,255,255,0.5); }

/* ==================== STATUS CREATE ==================== */
.status-create { display: flex; flex-direction: column; gap: var(--space-4); }
.status-type-tabs { display: flex; gap: var(--space-2); }
.tab-btn {
  padding: 6px 16px; border-radius: var(--radius-full);
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg-3); border: 1px solid var(--border);
  transition: all 0.15s;
}
.tab-btn--active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.status-textarea { min-height: 120px; font-size: 16px; transition: background 0.3s; }
.color-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.color-dot {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.15s, border-color 0.15s;
}
.color-dot:hover, .color-dot.active { transform: scale(1.2); border-color: #fff; }
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: var(--space-8); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); color: var(--text-muted); }
.upload-placeholder svg { opacity: 0.5; }
.upload-placeholder p { font-size: 14px; }

/* ==================== MISC ==================== */
.tab-error   { color: var(--danger); font-size: 14px; text-align: center; padding: var(--space-4); }
.tab-loading { padding: var(--space-4); }
.error-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); height: 100dvh; color: var(--text-secondary); }

/* ==================== ANIMATIONS ==================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
  .feed-layout { padding: var(--space-4) var(--space-3); }
  .form-row    { grid-template-columns: 1fr; }
  .post-modal-layout { grid-template-columns: 1fr; height: auto; }
  .post-modal-media  { border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 300px; }
  .chat-layout { grid-template-columns: 1fr; }
  .settings-page { grid-template-columns: 1fr; }
  .trending-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: var(--space-6) var(--space-5); }
  .settings-main { padding: var(--space-5) var(--space-4); }
  .profile-cover { height: 140px; }
  .profile-top { padding: 0 var(--space-4) var(--space-3); margin-top: -36px; }
  .profile-info { padding: var(--space-3) var(--space-4) var(--space-4); }
}

/* ==================== ONBOARDING — INTEREST PERSONALIZATION ==================== */

/* Hide nav during onboarding */
body:has(.ob-page) #nav  { display: none !important; }
body:has(.ob-page) #app  { margin-left: 0 !important; }

/* ── Page shell ── */
.ob-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #080808;
  position: relative;
  overflow-x: hidden;
  animation: ob-fadein 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
.ob-page--out {
  animation: ob-fadeout 0.42s cubic-bezier(0.4,0,1,1) both !important;
}

/* ── Header ── */
.ob-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8,8,8,0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ob-header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 32px 14px;
}

.ob-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  text-decoration: none;
}
.ob-brand-logo {
  font-size: 20px;
  color: var(--accent);
  filter: drop-shadow(0 0 10px rgba(245,166,35,0.6));
}
.ob-brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: #fff;
  letter-spacing: -0.015em;
}

.ob-header-copy {
  flex: 1;
}
.ob-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: #f0ede8;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.ob-subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.42);
  margin-top: 2px;
}

.ob-counter {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 2px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background 0.25s, border-color 0.25s;
}
#ob-count {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s cubic-bezier(0.34,1.56,0.64,1);
}
.ob-counter-label { color: rgba(245,166,35,0.65); font-weight: 500; }

/* Progress bar */
.ob-progress-track {
  height: 2px;
  background: rgba(255,255,255,0.05);
}
.ob-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #ffca5e 100%);
  border-radius: 1px;
  transition: width 0.4s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 12px rgba(245,166,35,0.4);
}

/* ── Grid ── */
.ob-grid-wrap {
  flex: 1;
  padding: 28px 28px 100px;
}
.ob-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  grid-auto-rows: 180px;
  gap: 12px;
  max-width: 1160px;
  margin: 0 auto;
}

/* Span variants for visual rhythm */
.ob-card--tall  { grid-row: span 2; }
.ob-card--wide  { grid-column: span 2; }

/* ── Individual card ── */
.ob-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.07);
  background: var(--bg-3);
  padding: 0;
  text-align: left;
  transition:
    border-color 0.22s,
    box-shadow   0.22s,
    transform    0.18s cubic-bezier(0.22,1,0.36,1);
  animation: ob-cardin 0.55s cubic-bezier(0.22,1,0.36,1) both;
  -webkit-tap-highlight-color: transparent;
}

.ob-card:hover {
  transform: translateY(-3px) scale(1.015);
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}
.ob-card:active {
  transform: scale(0.97);
}

/* Background photo layer */
.ob-card-bg {
  position: absolute;
  inset: 0;
  background-image: var(--card-img);
  background-size: cover;
  background-position: center;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1), opacity 0.3s;
  opacity: 0.82;
}
.ob-card:hover .ob-card-bg {
  transform: scale(1.06);
  opacity: 0.92;
}

/* Dark gradient overlay */
.ob-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    170deg,
    rgba(0,0,0,0.12) 0%,
    rgba(0,0,0,0.55) 60%,
    rgba(0,0,0,0.82) 100%
  );
  transition: background 0.25s;
}
.ob-card--selected .ob-card-overlay {
  background: linear-gradient(
    170deg,
    rgba(245,166,35,0.14) 0%,
    rgba(0,0,0,0.35) 55%,
    rgba(245,166,35,0.22) 100%
  );
}

/* Glassmorphic inner sheen */
.ob-card-glass {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.07) 0%,
    rgba(255,255,255,0.01) 50%,
    rgba(0,0,0,0) 100%
  );
  pointer-events: none;
}

/* Text body */
.ob-card-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ob-card-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.ob-card:hover .ob-card-icon { transform: scale(1.18) translateY(-2px); }
.ob-card--selected .ob-card-icon { transform: scale(1.1); }

.ob-card-label {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

/* Checkmark badge */
.ob-card-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1.5px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.5);
  backdrop-filter: blur(8px);
  transition:
    background 0.22s,
    border-color 0.22s,
    color 0.22s,
    transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

/* Selected state */
.ob-card--selected {
  border-color: var(--accent) !important;
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 28px rgba(245,166,35,0.35),
    0 8px 32px rgba(0,0,0,0.6);
}
.ob-card--selected .ob-card-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
  transform: scale(1.12);
}
.ob-card--selected .ob-card-label {
  color: #ffe8a8;
}

/* Pop animation on select */
.ob-card--pop {
  animation: ob-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── Footer ── */
.ob-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  padding: 12px 28px 6px;
  background: linear-gradient(to top, rgba(8,8,8,0.97) 70%, transparent 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.ob-footer-inner {
  max-width: 480px;
  margin: 0 auto;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ob-footer-hint {
  font-size: 13px;
  color: rgba(255,255,255,0.42);
  text-align: center;
  transition: color 0.25s;
  text-align: left;
}
.ob-footer-hint strong {
  color: var(--accent);
  font-size: 15px;
}

.ob-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  padding: 10px 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.3);
  cursor: not-allowed;
  transition:
    background 0.3s,
    border-color 0.3s,
    color 0.3s,
    box-shadow 0.3s,
    transform 0.15s;
}
.ob-cta--ready {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0d;
  cursor: pointer;
  box-shadow:
    0 0 0 0 rgba(245,166,35,0),
    0 6px 28px rgba(245,166,35,0.38);
  animation: ob-cta-pulse 2.4s ease-in-out infinite;
}
.ob-cta--ready:hover {
  background: #ffb83d;
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(245,166,35,0.5);
  animation: none;
}
.ob-cta--ready:active { transform: scale(0.98); }

.ob-cta-text { line-height: 1; }

/* ── Animations ── */
@keyframes ob-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes ob-fadeout {
  from { opacity: 1; transform: scale(1);      }
  to   { opacity: 0; transform: scale(0.97);   }
}
@keyframes ob-cardin {
  from { opacity: 0; transform: translateY(22px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes ob-pop {
  0%   { transform: scale(1);    }
  45%  { transform: scale(1.06); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1);    }
}
@keyframes ob-cta-pulse {
  0%, 100% { box-shadow: 0 6px 28px rgba(245,166,35,0.38); }
  50%       { box-shadow: 0 6px 44px rgba(245,166,35,0.62), 0 0 0 6px rgba(245,166,35,0.08); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .ob-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: 160px; }
  .ob-header-inner { padding: 14px 20px 12px; gap: 14px; }
  .ob-grid-wrap { padding: 20px 16px 100px; gap: 10px; }
}
@media (max-width: 600px) {
  .ob-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 130px; gap: 8px; }
  .ob-card--wide  { grid-column: span 2; }
  .ob-card--tall  { grid-row: span 2; }
  .ob-title       { font-size: 17px; }
  .ob-subtitle    { display: none; }
  .ob-counter     { padding: 5px 12px; }
  .ob-grid-wrap   { padding: 14px 12px 100px; }
  .ob-header-inner { flex-wrap: wrap; gap: 10px; }
  .ob-brand       { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .ob-grid { grid-template-columns: repeat(2, 1fr); }
  .ob-card--wide  { grid-column: span 2; }
  .ob-card--tall  { grid-row: span 2; }
}


/* Cold-start feed header */
.cold-start-header {
  background: linear-gradient(135deg, var(--bg-3) 0%, rgba(245,166,35,0.06) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 16px;
}
.cold-start-header__eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cold-start-header__title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.cold-start-accent { color: var(--accent); }
.cold-start-header__sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.cold-start-cta {
  text-align: center;
  padding: 20px 0 8px;
}



/* ==================== FEED STICKY LAYOUT ==================== */

/* Feed top bar — mobile only */
.feed-topbar {
  display: none;
}

@media (max-width: 600px) {
  .feed-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px 8px;
  }
  .feed-brand {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--accent);
    letter-spacing: -0.01em;
  }
  .feed-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .feed-topbar-btn {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
  }
  .feed-topbar-btn:hover { background: var(--bg-4); color: var(--text); }
  .feed-topbar-badge {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg);
  }
}

.feed-layout-outer {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Sticky top: stories + discover/reels */
.feed-sticky-top {
  flex-shrink: 0;
  background: var(--bg);
  padding: 16px 16px 0;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  /* Full-width background behind max-width content */
  position: relative;
  z-index: 10;
}

/* Wrapper that provides full-width bg for sticky area */
.feed-layout-outer::before {
  content: '';
  position: fixed;
  top: 0; left: var(--nav-width); right: 0;
  height: 0; /* grows dynamically — handled by flex */
  background: var(--bg);
  z-index: 9;
  pointer-events: none;
}

/* Scrollable content area */
.feed-scroll-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Keep the inner feed-layout centered */
.feed-scroll-body .feed-layout {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Shortcut bar hide/show on scroll */
.feed-shortcut-bar {
  display: flex;
  gap: 10px;
  padding: 0 0 8px 0;
  overflow: hidden;
  max-height: 48px;
  opacity: 1;
  transform: translateY(0);
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity     0.22s cubic-bezier(0.4, 0, 0.2, 1),
              transform   0.28s cubic-bezier(0.4, 0, 0.2, 1),
              padding     0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.feed-shortcut-bar--hidden {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px);
  padding: 0;
  pointer-events: none;
}

/* On mobile nav (bottom bar), adjust left offset */
@media (max-width: 600px) {
  .feed-layout-outer::before {
    left: 0;
  }
  .feed-sticky-top {
    padding: 12px 12px 0;
  }
}

/* On collapsed nav (≤900px) */
@media (max-width: 900px) {
  .feed-layout-outer::before {
    left: var(--nav-width-sm);
  }
}


/* ==================== REELS VIEW ==================== */

.rv-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: var(--bg, #0a0a0a);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Center column: card + actions side by side */
.rv-track {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* card left, actions right via slide layout */
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  /* Center the whole track */
  margin: 0 auto;
  /* Width = card + actions gap */
  width: min(100%, 700px);
}
.rv-track::-webkit-scrollbar { display: none; }

/* ── Slide: card + actions in a row ── */
.rv-slide {
  flex-shrink: 0;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  box-sizing: border-box;
  background: transparent;
}

/* ── Card (the actual video box) ── */
.rv-card {
  position: relative;
  flex-shrink: 0;
  width: 380px;
  height: 100%;
  max-height: calc(100dvh - 40px);
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.rv-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rv-tap-zone {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

/* Pause flash */
.rv-pause-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.rv-pause-flash--show { opacity: 1; }

/* ── Right actions — sits OUTSIDE the card ── */
.rv-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  /* No position:absolute — it's in normal flow next to the card */
}

/* Avatar + follow button */
.rv-avatar-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  margin-bottom: 4px;
}

.rv-avatar-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #fff;
  overflow: visible;
  position: relative;
}

.rv-avatar-ring img,
.rv-avatar-ring .avatar {
  width: 48px !important;
  height: 48px !important;
  border-radius: 50%;
  display: block;
}

.rv-follow-btn {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ff3b5c;
  border: 2px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.2s, transform 0.15s;
}
.rv-follow-btn:active { transform: translateX(-50%) scale(0.88); }
.rv-follow-btn--following { background: var(--accent, #4ade80); }
/* Tick badge is purely visual — no hover/pointer effects */
.rv-follow-btn--tick {
  cursor: default;
  pointer-events: none;
}
.rv-follow-btn--tick:active { transform: translateX(-50%); }

/* Action group (icon + label) */
.rv-action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.rv-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(6px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  color: white;
}
.rv-action-btn:active { transform: scale(0.88); }
.rv-action-btn--liked  { background: rgba(255,59,92,0.25); }
.rv-action-btn--saved  { background: rgba(255,255,255,0.28); }

.rv-action-count {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* Like pop animation */
@keyframes rv-like-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.rv-like-pop { animation: rv-like-pop 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97); }

/* Share spinner — inline, doesn't cover content */
.rv-share-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* ── Bottom info — overlaid on card ── */
.rv-info {
  position: absolute;
  bottom: 20px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none; /* children re-enable as needed */
}

.rv-info > * { pointer-events: auto; }

.rv-author {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  min-width: 0; /* allow flex children to shrink */
}

.rv-author-avatar {
  flex-shrink: 0;
}

.rv-author-avatar img,
.rv-author-avatar .avatar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.6);
  display: block;
}

.rv-author-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.rv-verified {
  font-size: 11px;
  color: var(--accent, #4ade80);
  flex-shrink: 0;
}

.rv-caption-wrap {
  max-width: 100%;
  overflow: hidden;
}

.rv-caption {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 5px rgba(0,0,0,0.8);
  line-height: 1.4;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.rv-caption--clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rv-more-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: inline;
  vertical-align: baseline;
}

/* Caption full overlay — transparent, doesn't hide video */
.rv-caption-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
  padding: 32px 20px 90px;
  backdrop-filter: blur(2px);
}

.rv-caption-overlay-inner {
  position: relative;
  width: 100%;
  max-height: 55vh;
  overflow-y: auto;
}

.rv-cap-close {
  position: absolute;
  top: -36px;
  right: 0;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-caption-full {
  font-size: 14px;
  color: #fff;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Mute pill ── */
.rv-mute-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  z-index: 15;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.rv-mute-pill--show { opacity: 1; }

/* ── Up/Down arrows — fixed at far right edge ── */
.rv-arrows {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rv-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
}
.rv-arrow:hover   { background: rgba(255,255,255,0.28); }
.rv-arrow:active  { transform: scale(0.9); }
.rv-arrow:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* Bottom gradient lives on the card, not the slide */
.rv-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* ── Mobile: back to fullscreen card with overlaid actions ── */
@media (max-width: 768px) {
  .rv-track { width: 100%; }

  .rv-slide {
    flex-direction: column;
    padding: 0;
    gap: 0;
  }

  .rv-card {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  .rv-actions {
    position: absolute;
    right: 10px;
    bottom: 100px;
  }

  .rv-arrows { display: none; }
}


/* ==================== REEL COMMENT PANEL ==================== */

/*
  Desktop: panel sits between the card and action buttons —
  a tall frosted column that slides in from the left (card side).
  It's a flex sibling of rv-card, inserted before rv-actions.
  Width is fixed so action buttons are never pushed off screen.

  Mobile: falls back to bottom sheet inside the card.
*/

/* ── Desktop layout ── */
@media (min-width: 769px) {
  .rv-comment-panel {
    /* In normal flow between rv-card and rv-actions */
    position: relative;
    width: 0;
    height: calc(100dvh - 40px);
    align-self: center;
    z-index: 20;
    pointer-events: none;
    overflow: visible;
    flex-shrink: 0;
    /* No backdrop on desktop — reel is still fully visible */
  }

  .rv-comment-panel--open {
    pointer-events: auto;
    width: 300px; /* reserves space without pushing action buttons off */
  }

  .rv-cp-backdrop {
    display: none; /* no backdrop on desktop */
  }

  .rv-cp-sheet {
    position: absolute;
    top: 0;
    left: 12px; /* gap between card edge and panel */
    width: 288px;
    height: 100%;
    max-height: 100%;
    min-height: unset;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(10, 10, 14, 0.88);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.04),
      0 24px 64px rgba(0,0,0,0.7),
      inset 0 1px 0 rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    /* Slides in from left (toward card) */
    transform: translateX(-24px);
    opacity: 0;
    transition:
      transform 0.34s cubic-bezier(0.32, 0.72, 0, 1),
      opacity 0.28s ease;
  }

  .rv-comment-panel--open .rv-cp-sheet {
    transform: translateX(0);
    opacity: 1;
  }

  /* No drag handle on desktop */
  .rv-cp-handle { display: none; }

  /* Also hide the transition width change smoothly */
  .rv-comment-panel {
    transition: width 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  }
}

/* ── Mobile layout: bottom sheet inside card ── */
@media (max-width: 768px) {
  .rv-comment-panel {
    position: absolute;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  .rv-comment-panel--open {
    pointer-events: auto;
  }

  .rv-cp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(1px);
    opacity: 0;
    transition: opacity 0.32s ease;
    cursor: pointer;
  }

  .rv-comment-panel--open .rv-cp-backdrop {
    opacity: 1;
  }

  .rv-cp-sheet {
    position: relative;
    z-index: 2;
    background: rgba(10, 10, 14, 0.92);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    max-height: 72%;
    min-height: 200px;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow:
      0 -1px 0 rgba(255,255,255,0.06),
      0 -20px 60px rgba(0,0,0,0.5);
  }

  .rv-comment-panel--open .rv-cp-sheet {
    transform: translateY(0);
  }
}

/* Drag handle — mobile only */
.rv-cp-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

/* Header */
.rv-cp-header {
  display: flex;
  align-items: center;
  padding: 12px 16px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.rv-cp-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  flex: 1;
}

.rv-cp-count {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.4);
  margin-right: 12px;
}

.rv-cp-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.rv-cp-close:hover { background: rgba(255,255,255,0.15); }

/* Comments list */
.rv-cp-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.rv-cp-list::-webkit-scrollbar { width: 3px; }
.rv-cp-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Individual comment */
.rv-cp-comment {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: rv-comment-in 0.28s ease both;
}
.rv-cp-comment:last-child { border-bottom: none; }

@keyframes rv-comment-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.rv-cp-comment--sending {
  opacity: 0.55;
}

.rv-cp-comment-avatar {
  flex-shrink: 0;
}
.rv-cp-comment-avatar img,
.rv-cp-comment-avatar .avatar {
  width: 34px !important;
  height: 34px !important;
  border-radius: 50%;
  display: block;
}

.rv-cp-comment-body {
  flex: 1;
  min-width: 0;
}

.rv-cp-comment-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}

.rv-cp-comment-name {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.rv-cp-comment-time {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.rv-cp-comment-text {
  font-size: 13px;
  color: rgba(255,255,255,0.82);
  line-height: 1.45;
  margin: 0;
  word-break: break-word;
}

/* Loading spinner */
.rv-cp-loading {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.rv-cp-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.6);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* Empty state */
.rv-cp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  color: rgba(255,255,255,0.35);
  text-align: center;
}
.rv-cp-empty p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* Error */
.rv-cp-err {
  font-size: 12px;
  color: rgba(255,100,100,0.7);
  text-align: center;
  padding: 16px;
}

/* Composer */
.rv-cp-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  /* Extra bottom padding for mobile home bar */
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.rv-cp-composer-avatar {
  flex-shrink: 0;
}
.rv-cp-composer-avatar img,
.rv-cp-composer-avatar .avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 50%;
  display: block;
}

.rv-cp-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 0 6px 0 14px;
  transition: border-color 0.18s;
}
.rv-cp-input-wrap:focus-within {
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.1);
}

.rv-cp-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: #fff;
  padding: 9px 0;
  min-width: 0;
}
.rv-cp-input::placeholder { color: rgba(255,255,255,0.3); }

.rv-cp-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent, #f59e0b);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #000;
  transition: opacity 0.18s, transform 0.15s, background 0.18s;
}
.rv-cp-send:disabled {
  opacity: 0.3;
  cursor: default;
}
.rv-cp-send:not(:disabled):hover { background: #fbbf24; }
.rv-cp-send:not(:disabled):active { transform: scale(0.9); }


/* ==================== GROUP AVATAR STACK (header) ==================== */

.group-avatar-stack {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.group-avatar-item {
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}
.group-avatar-item:first-child { margin-left: 0; }

.group-member-count { font-size: 12px; color: var(--text-muted); }

.thread-header-user--clickable { cursor: pointer; border-radius: var(--radius-md); transition: background 0.15s; padding: 4px 6px; margin: -4px -6px; }
.thread-header-user--clickable:hover { background: var(--bg-3); }

/* ==================== GROUP INFO SHEET ==================== */

.gi-wrap { display: flex; flex-direction: column; gap: 0; }

.gi-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.gi-avatar-stack {
  display: flex;
  align-items: center;
  justify-content: center;
}
.gi-avatar-item {
  margin-left: -10px;
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}
.gi-avatar-item:first-child { margin-left: 0; }

.gi-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.gi-meta { font-size: 13px; color: var(--text-muted); }

.gi-section-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 4px 6px;
}
.gi-members { display: flex; flex-direction: column; gap: 0; }
.gi-member-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s;
}
.gi-member-row:hover { background: var(--bg-3); }
.gi-member-av { flex-shrink: 0; }
.gi-member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gi-member-name { font-size: 14px; font-weight: 600; color: var(--text); }
.gi-member-handle { font-size: 12px; color: var(--text-muted); }
.gi-you { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.gi-admin-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.gi-actions { padding: 16px 0 4px; border-top: 1px solid var(--border); margin-top: 8px; }
.gi-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 8px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}
.gi-action-btn--danger { color: var(--danger); }
.gi-action-btn--danger:hover { background: var(--danger-dim); }

/* ==================== GROUP CALL SHEET ==================== */

.gc-wrap { display: flex; flex-direction: column; gap: 14px; }
.gc-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--bg-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin: 0;
}
.gc-members { display: flex; flex-direction: column; gap: 2px; }
.gc-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 4px;
  border-radius: var(--radius-md);
  transition: background 0.12s;
}
.gc-member-row:hover { background: var(--bg-3); }
.gc-member-left { display: flex; align-items: center; gap: 11px; }
.gc-online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--bg-2);
}
.gc-member-info { display: flex; flex-direction: column; gap: 2px; }
.gc-member-name { font-size: 14px; font-weight: 600; color: var(--text); }
.gc-member-status { font-size: 12px; color: var(--text-muted); }
.gc-online { color: var(--success); }

.gc-member-actions { display: flex; gap: 6px; }
.gc-call-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-4);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gc-call-btn:hover:not(:disabled) { background: var(--success-dim); color: var(--success); border-color: var(--success); }
.gc-call-btn--video:hover:not(:disabled) { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.gc-call-btn:disabled { opacity: 0.3; cursor: not-allowed; }