/* ══════════════════════════════════════════════════════════════
   WINGED — Complete Stylesheet
   Mobile-first, iOS-native feel, dark/light adaptive
══════════════════════════════════════════════════════════════ */

:root {
    --bg: #ffffff;
    --bg2: #f7f7f8;
    --bg3: #efefef;
    --surface: #ffffff;
    --surface2: rgba(247,247,248,0.95);
    --border: rgba(0,0,0,0.08);
    --border2: rgba(0,0,0,0.05);
    --text: #0d0d0d;
    --text2: #5c5c6e;
    --text3: #9898a8;
    --accent: #6c47ff;
    --accent2: #8b6fff;
    --accent-soft: rgba(108,71,255,0.12);
    --red: #ff3b5c;
    --red-soft: rgba(255,59,92,0.12);
    --green: #00c48c;
    --green-soft: rgba(0,196,140,0.12);
    --gold: #ffb800;
    --nav-h: 74px;
    --header-h: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 20px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
    --font: 'Noto Sans JP', -apple-system, sans-serif;
    --font-display: 'Noto Sans JP', sans-serif;
  }
  
  [data-theme="dark"] {
    --bg: #0a0a0f;
    --bg2: #13131a;
    --bg3: #1c1c26;
    --surface: #13131a;
    --surface2: rgba(19,19,26,0.97);
    --border: rgba(255,255,255,0.08);
    --border2: rgba(255,255,255,0.04);
    --text: #f0f0f8;
    --text2: #9898b8;
    --text3: #5c5c7a;
    --accent-soft: rgba(108,71,255,0.2);
    --shadow: 0 2px 20px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  }
  
  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
  
  html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    font-family: var(--font);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
  }
  
  /* Allow text selection only in input fields */
  input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
  }

  img, video {
    display: block; max-width: 100%;
    -webkit-touch-callout: none;
    pointer-events: auto;
    -webkit-user-drag: none;
    user-drag: none;
  }
  /* Global avatar rule — all avatars are round, no exceptions */
  [class*="avatar"] { border-radius: 50% !important; }
  button { background: none; border: none; cursor: pointer; font-family: var(--font); color: var(--text); }
  a { text-decoration: none; color: inherit; }
  textarea, input { font-family: var(--font); outline: none; border: none; background: none; }
  
  /* ── UTILITIES ── */
  .hidden { display: none !important; }
  .loading-pulse {
    background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius);
  }
  @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
  
  /* ══════════════════════════════════════════
     AUTH SCREEN
  ══════════════════════════════════════════ */
  .auth-screen {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: #0d0d18;
    overflow: hidden;
  }
  .auth-bg { position: absolute; inset: 0; pointer-events: none; }
  .auth-orb {
    position: absolute; border-radius: 50%;
    filter: blur(60px); opacity: 0.4;
    animation: orbFloat 8s ease-in-out infinite;
  }
  .auth-orb-1 { width: 300px; height: 300px; background: #6c47ff; top: -100px; right: -60px; animation-delay: 0s; }
  .auth-orb-2 { width: 250px; height: 250px; background: #ff3b5c; bottom: -80px; left: -60px; animation-delay: -3s; }
  .auth-orb-3 { width: 200px; height: 200px; background: #00c48c; top: 40%; left: 30%; animation-delay: -5s; }
  @keyframes orbFloat {
    0%,100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(20px,-20px) scale(1.05); }
  }
  
  .auth-content {
    position: relative; z-index: 1;
    width: 90%; max-width: 360px;
    display: flex; flex-direction: column; align-items: center; gap: 20px;
  }
  .auth-logo {
    width: 80px; height: 80px; border-radius: 24px;
    background: rgba(255,255,255,0.1); backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.15), inset 0 0 20px rgba(108,71,255,0.3);
    animation: logoPop 0.6s cubic-bezier(0.34,1.56,0.64,1) both;
  }
  @keyframes logoPop { from { transform: scale(0) rotate(-10deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
  
  .auth-title {
    font-family: var(--font-display); font-size: 38px; font-weight: 800; color: white;
    letter-spacing: -1px;
  }
  .auth-sub { font-size: 15px; color: rgba(255,255,255,0.5); text-align: center; }
  
  .auth-tabs {
    display: flex; background: rgba(255,255,255,0.08); border-radius: 12px; padding: 4px;
    width: 100%; gap: 4px;
  }
  .auth-tab {
    flex: 1; padding: 10px; border-radius: 9px; font-size: 15px; font-weight: 600;
    color: rgba(255,255,255,0.5); transition: all 0.2s;
  }
  .auth-tab.active { background: white; color: #0d0d18; }
  
  .auth-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
  .auth-input-wrap {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.08); border-radius: 14px;
    padding: 0 16px; border: 1.5px solid transparent;
    transition: border-color 0.2s, background 0.2s;
  }
  .auth-input-wrap:focus-within {
    border-color: var(--accent); background: rgba(108,71,255,0.1);
  }
  .auth-input-icon { font-size: 16px; opacity: 0.6; flex-shrink: 0; }
  .auth-input { flex: 1; padding: 16px 0; font-size: 15px; color: white; }
  .auth-input::placeholder { color: rgba(255,255,255,0.3); }
  .auth-error { color: var(--red); font-size: 13px; min-height: 16px; }
  
  .auth-submit-btn {
    padding: 17px; border-radius: 14px; font-size: 16px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ff3b5c);
    color: white; position: relative; overflow: hidden;
    box-shadow: 0 4px 20px rgba(108,71,255,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
  }
  .auth-submit-btn:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(108,71,255,0.3); }
  .btn-loader {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }
  
  /* ══════════════════════════════════════════
     APP SHELL
  ══════════════════════════════════════════ */
  .app {
    position: fixed; inset: 0;
    display: flex; flex-direction: column;
    background: var(--bg);
    overflow: hidden;
  }
  
  /* ── PAGES ── */
  .page {
    position: absolute; inset: 0;
    background: var(--bg);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .page.active { opacity: 1; pointer-events: all; }
  .page.slide-page {
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0s;
    opacity: 1;
    pointer-events: none; /* never intercept taps when off screen */
  }
  .page.slide-page.active { transform: translateX(0); pointer-events: all; }
  
  /* ── BOTTOM NAV ── */
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    height: calc(var(--nav-h) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex; align-items: center; justify-content: space-around;
    background: var(--surface2);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border-top: 1px solid var(--border);
  }
  .nav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    flex: 1; padding: 8px 4px;
    color: var(--text3); font-size: 10px; font-weight: 500;
    transition: color 0.2s, transform 0.15s;
  }
  .nav-btn.active { color: var(--accent); }
  .nav-btn:active { transform: scale(0.9); }
  .nav-btn svg { transition: transform 0.2s; }
  .nav-btn.active svg { transform: scale(1.1); }
  
  .nav-btn-compose {
    width: 52px; height: 52px; border-radius: 16px; flex: none;
    background: linear-gradient(135deg, var(--accent), #ff3b5c);
    color: white; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(108,71,255,0.4);
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .nav-btn-compose:active { transform: scale(0.92); box-shadow: 0 2px 8px rgba(108,71,255,0.3); }
  
  .nav-bell-wrap, .nav-avatar-wrap { position: relative; }
  .notif-dot {
    position: absolute; top: -2px; right: -2px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--red); border: 2px solid var(--surface);
  }
  .nav-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
  #nav-avatar-icon { opacity: 0.6; }
  
  /* ── HEADERS ── */
  .page-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    background: var(--surface2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
  }
  .transparent-header { background: transparent; backdrop-filter: none; border-bottom: none; }
  .page-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  .back-btn {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text2); background: var(--bg3);
    transition: background 0.2s, transform 0.15s;
  }
  .back-btn:active { transform: scale(0.9); background: var(--border); }
  .header-action {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text2);
    transition: background 0.2s;
  }
  .header-action:active { background: var(--bg3); }
  
  /* ══ FEED HEADER ══════════════════════════════ */
  .feed-header {
    height: 56px; padding: 0;
    background: var(--surface2);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: none; /* tab bar sits flush at bottom instead */
    flex-direction: row;
    align-items: stretch; /* stretch inner to full height so tab bar reaches bottom */
  }
  .feed-header-inner {
    width: 100%; height: 100%;
    display: flex; align-items: center;
    padding: 0 14px 0 14px;
    gap: 0;
  }
  /* Logo — left */
  .feed-logo {
    display: flex; align-items: center; flex-shrink: 0;
  }
  /* Tabs group — 30px gap from logo */
  .feed-tabs-group {
    position: relative;
    display: flex; align-items: center;
    margin-left: 30px;
    gap: 10px;
    height: 100%;
  }
  .feed-tab {
    padding: 0 2px; height: 100%;
    font-size: 15px; font-weight: 700;
    color: var(--text3); border: none; background: transparent;
    cursor: pointer; transition: color 0.18s; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .feed-tab.active { color: var(--text); }
  /* Sliding underline bar */
  .feed-tab-bar {
    position: absolute; bottom: 0; left: 0;
    height: 2.5px; border-radius: 99px;
    background: linear-gradient(90deg, #6C47FF, #a78bfa);
    box-shadow: 0 0 6px rgba(108,71,255,0.45);
    transition: left 0.28s cubic-bezier(0.34,1.2,0.64,1),
                width 0.28s cubic-bezier(0.34,1.2,0.64,1);
  }
  /* DM button — pushed to far right */
  .feed-dm-btn {
    margin-left: auto; flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 50%;
    background: transparent; border: none;
    display: flex; align-items: center; justify-content: center;
    color: var(--text2); cursor: pointer;
    transition: color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
  }
  .feed-dm-btn:active { background: var(--bg3); color: var(--accent); }
  
  /* ══════════════════════════════════════════
     STORIES ROW
  ══════════════════════════════════════════ */
  /* ══════════════════════════════════════════
     MOMENTS ROW — MistyNote signature stories
     Wide cards, not circles. Social + commerce ready.
  ══════════════════════════════════════════ */
  .stories-row {
    display: flex; gap: 10px; overflow-x: auto;
    padding: 14px 16px 16px;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .stories-row:empty { display: none; }
  .stories-row::-webkit-scrollbar { display: none; }

  /* Each moment card — tall pill, not a circle */
  .story-item {
    flex-shrink: 0;
    width: 76px; height: 116px;
    border-radius: 18px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s cubic-bezier(0.34,1.4,0.64,1),
                box-shadow 0.18s ease;
  }
  .story-item:active {
    transform: scale(0.93);
  }

  /* Background — gradient fill for no-image cards, image for real ones */
  .story-bg {
    position: absolute; inset: 0;
    background: linear-gradient(160deg, var(--accent) 0%, var(--red) 100%);
    border-radius: inherit;
  }
  .story-bg img {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: inherit;
  }

  /* Dark vignette so text is always readable */
  .story-item::after {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: linear-gradient(
      to bottom,
      transparent 30%,
      rgba(0,0,0,0.55) 100%
    );
    pointer-events: none;
  }

  /* Seen state — desaturated border */
  .story-item.seen .story-bg {
    opacity: 0.55;
  }

  /* Unseen — glowing accent border */
  .story-item:not(.seen):not(.story-add-item) {
    box-shadow:
      0 0 0 2.5px var(--accent),
      0 4px 16px rgba(108,71,255,0.3);
  }

  /* Name at bottom */
  .story-name {
    position: absolute; bottom: 8px; left: 0; right: 0; z-index: 2;
    font-size: 10px; font-weight: 700; color: #fff;
    text-align: center; padding: 0 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  }

  /* Avatar — top of card */
  .story-avatar-wrap {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    z-index: 2;
  }
  .story-avatar {
    width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  }

  /* Commerce badge — shows 🛍️ for product moments */
  .story-commerce-badge {
    position: absolute; top: 6px; right: 6px; z-index: 3;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--gold);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  }

  /* Live badge */
  .story-live-badge {
    position: absolute; top: 6px; left: 6px; z-index: 3;
    background: var(--red); color: #fff;
    font-size: 8px; font-weight: 800; letter-spacing: 0.05em;
    padding: 2px 5px; border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 1px 4px rgba(255,59,92,0.4);
    animation: livePulse 1.8s ease-in-out infinite;
  }
  @keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
  }

  /* Add story card */
  .story-add-item {
    background: var(--bg2);
    border: 1.5px dashed var(--border);
    box-shadow: none;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 6px;
  }
  .story-add-item::after { display: none; }
  .story-add-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent);
  }
  .story-add-label {
    font-size: 10px; font-weight: 700; color: var(--text3);
    text-align: center; line-height: 1.2;
  }
  
  /* ══════════════════════════════════════════
     FEED POSTS
  ══════════════════════════════════════════ */
  .feed-list { display: flex; flex-direction: column; }
  .feed-post {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    transition: background 0.15s;
  }
  .feed-post:active { background: var(--bg2); }
  .feed-post.is-repost { padding-top: 12px; }
  
  .repost-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: var(--text3);
    margin-bottom: 10px; padding-left: 42px;
  }
  .repost-label svg { color: var(--green); }
  
  .post-header { display: flex; align-items: flex-start; gap: 11px; }
  .post-avatar-wrap { position: relative; flex-shrink: 0; }
  .post-avatar {
    width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--border);
  }
  .post-avatar-ring {
    position: absolute; inset: -3px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--red));
    z-index: -1; opacity: 0;
    transition: opacity 0.2s;
  }
  .post-avatar-wrap.has-story .post-avatar-ring { opacity: 1; }
  
  .post-meta { flex: 1; min-width: 0; }
  .post-name-row { display: flex; align-items: center; gap: 5px; }
  .post-name {
    font-size: 14px; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 160px;
  }
  .verified-badge { color: var(--accent); flex-shrink: 0; }
  .post-time { font-size: 13px; color: var(--text3); }
  .post-more-btn {
    width: 32px; height: 32px; border-radius: 50%; color: var(--text3);
    display: flex; align-items: center; justify-content: center;
    margin-left: auto; flex-shrink: 0;
    transition: background 0.2s;
  }
  .post-more-btn:active { background: var(--bg3); }
  
  .post-content { padding: 10px 0 0 53px; }
  .post-text {
    font-size: 16px; line-height: 1.55; color: var(--text);
    white-space: pre-wrap; word-break: break-word;
  }
  .see-more { color: var(--accent); font-weight: 600; cursor: pointer; }
  
  .post-media { margin: 10px 0 0 53px; border-radius: var(--radius); overflow: hidden; }
  .post-media img { width: 100%; max-height: 400px; object-fit: cover; }
  .post-media video { width: 100%; max-height: 400px; }
  
  .video-thumb-wrap { position: relative; cursor: pointer; }
  .video-play-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.15);
  }
  .play-circle {
    width: 52px; height: 52px; border-radius: 50%;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
  }
  
  /* Original post card (nested in repost) */
  .original-card {
    margin: 10px 0 0 53px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg2);
    transition: background 0.2s;
  }
  .original-card:active { background: var(--bg3); }
  .original-card-inner { padding: 12px; }
  .original-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .original-card-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
  .original-card-name { font-size: 13px; font-weight: 700; }
  .original-card-time { font-size: 12px; color: var(--text3); }
  .original-card-text { font-size: 14px; line-height: 1.5; color: var(--text2); }
  .original-card img.original-card-img { width: 100%; max-height: 200px; object-fit: cover; }
  
  /* Post actions */
  .post-actions {
    display: flex; align-items: center;
    padding: 10px 0 0 42px; gap: 0;
  }
  .post-action {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 10px; border-radius: 999px; flex: 1;
    color: var(--text3); font-size: 13px; font-weight: 500;
    transition: all 0.2s;
  }
  .post-action:active { background: var(--bg3); transform: scale(0.95); }
  .post-action.liked { color: var(--red); }
  .post-action.liked .action-heart path { fill: var(--red); stroke: var(--red); }
  .post-action.reposted { color: var(--green); }
  .post-action svg { transition: transform 0.15s; }
  .post-action:active svg { transform: scale(0.8); }
  
  @keyframes heartPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.4); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); }
  }
  .heart-pop { animation: heartPop 0.35s cubic-bezier(0.34,1.56,0.64,1); }
  
  /* Skeleton */
  .skeleton-post { padding: 16px; border-bottom: 1px solid var(--border); }
  .sk-header { display: flex; gap: 11px; align-items: center; margin-bottom: 12px; }
  .sk-circle { width: 42px; height: 42px; border-radius: 50%; }
  .sk-line { border-radius: 6px; height: 13px; margin-bottom: 6px; }
  
  /* Load more trigger */
  .load-more-trigger { height: 20px; }
  
  /* ══════════════════════════════════════════
     DISCOVER
  ══════════════════════════════════════════ */
  .discover-search-wrap { padding: 12px 16px 8px; position: sticky; top: 56px; z-index: 50; background: var(--bg); }
  .search-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg3); border-radius: var(--radius);
    padding: 12px 16px; color: var(--text3);
  }
  .search-input { flex: 1; font-size: 15px; color: var(--text); }
  .search-input::placeholder { color: var(--text3); }
  
  .section-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
    text-transform: uppercase; color: var(--text3);
    padding: 16px 16px 8px;
  }
  
  .discover-posts {
    display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 0 3px 3px;
  }
  .discover-tile {
    aspect-ratio: 4/5; overflow: hidden; cursor: pointer; position: relative;
    background: var(--bg3);
  }
  .discover-tile img, .discover-tile video {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s ease;
  }
  .discover-tile:active img { transform: scale(0.97); }
  .discover-tile-overlay {
    position: absolute; inset: 0; padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 60%);
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .discover-tile-text { font-size: 12px; color: white; line-height: 1.3; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .discover-tile-author { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
  .discover-tile-avatar { width: 18px; height: 18px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,0.4); }
  .discover-tile-username { font-size: 11px; color: rgba(255,255,255,0.8); font-weight: 600; }
  
  /* ══════════════════════════════════════════
     NOTIFICATIONS
  ══════════════════════════════════════════ */
  .notif-list { display: flex; flex-direction: column; }
  .notif-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; border-bottom: 1px solid var(--border2);
    cursor: pointer; transition: background 0.15s;
  }
  .notif-item:active { background: var(--bg2); }
  .notif-item.unread { background: var(--accent-soft); }
  .notif-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
  .notif-icon-wrap {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
  }
  .notif-body { flex: 1; min-width: 0; }
  .notif-text { font-size: 14px; line-height: 1.4; color: var(--text); }
  .notif-text strong { font-weight: 700; }
  .notif-time { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .notif-thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
  
  .empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 80px 24px; gap: 10px; text-align: center;
  }
  .empty-icon { font-size: 48px; margin-bottom: 4px; }
  .empty-state p { font-size: 17px; font-weight: 700; color: var(--text); }
  .empty-state span { font-size: 14px; color: var(--text3); line-height: 1.5; }
  
  /* ══════════════════════════════════════════
     PROFILE PAGE
  ══════════════════════════════════════════ */
  .profile-cover {
    width: 100%; height: 180px; object-fit: cover; background: var(--bg3);
    position: relative;
  }
  .profile-cover-img { width: 100%; height: 180px; object-fit: cover; }
  .profile-avatar-outer {
    width: 78px; height: 78px;
    border-radius: 50%; padding: 3px;
    background: linear-gradient(135deg, var(--accent), var(--red));
    margin-top: -40px; margin-left: 16px;
    position: relative; z-index: 10;
  }
  .profile-avatar {
    width: 100%; height: 100%; border-radius: 50%;
    object-fit: cover; border: 3px solid var(--bg);
  }
  .profile-info-section { padding: 12px 16px 16px; }
  .profile-name-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
  .profile-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  .profile-buttons { display: flex; gap: 8px; }
  .profile-btn {
    padding: 8px 18px; border-radius: 999px; font-size: 14px; font-weight: 700;
    background: var(--accent); color: #fff; border: 2px solid var(--accent);
    transition: transform 0.15s, opacity 0.15s;
  }
  .profile-btn:active { transform: scale(0.95); opacity: 0.9; }
  .profile-btn.outline { background: transparent; color: var(--text); border: 2px solid var(--border); }
  .profile-btn.follow-btn-active { background: var(--accent); color: #fff; border: none; }
  .profile-btn.following { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
  
  .profile-username { font-size: 14px; color: var(--text3); margin-bottom: 10px; }
  .profile-bio { font-size: 15px; line-height: 1.55; color: var(--text); margin-bottom: 12px; }
  .profile-location {
    display: flex; align-items: center; gap: 5px;
    font-size: 13px; color: var(--text3); margin-bottom: 14px;
  }
  .profile-stats { display: flex; gap: 20px; margin-bottom: 0; }
  .profile-stat { display: flex; flex-direction: column; }
  .profile-stat-n { font-size: 17px; font-weight: 800; color: var(--text); }
  .profile-stat-l { font-size: 12px; color: var(--text3); margin-top: 1px; }
  
  .profile-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    background: var(--surface2); backdrop-filter: blur(12px);
  }
  .profile-tab {
    flex: 1; padding: 14px 0; font-size: 14px; font-weight: 600;
    color: var(--text3); border-bottom: 2.5px solid transparent;
    transition: all 0.2s;
  }
  .profile-tab.active { color: var(--text); border-bottom-color: var(--accent); }
  
  /* Masonry grid */
  .masonry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px 3px; }
  .masonry-tile {
    aspect-ratio: 3/4; overflow: hidden; cursor: pointer;
    border-radius: var(--radius-sm); background: var(--bg3);
    position: relative;
  }
  .masonry-tile img, .masonry-tile video {
    width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s;
  }
  .masonry-tile:active img { transform: scale(0.97); }
  .masonry-tile-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    display: flex; flex-direction: column; justify-content: flex-end; padding: 8px;
  }
  .masonry-tile-likes {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: white; font-weight: 600;
  }
  .masonry-tile-text { font-size: 11px; color: rgba(255,255,255,0.85); line-height: 1.3; margin-top: 3px; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  
  .profile-posts-list { display: flex; flex-direction: column; }
  
  /* ══════════════════════════════════════════
     POST DETAIL
  ══════════════════════════════════════════ */
  #detail-body {
    padding-bottom: 100px;
  }
  .detail-post {
    padding: 16px;
    border-bottom: 1px solid var(--border);
  }
  .detail-header { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
  .detail-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; cursor: pointer; }
  .detail-meta { flex: 1; }
  .detail-name { font-size: 16px; font-weight: 700; cursor: pointer; }
  .detail-username { font-size: 13px; color: var(--text3); }
  .detail-follow-btn {
    padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
    background: var(--accent); color: #fff; border: 2px solid var(--accent);
    transition: transform 0.15s;
  }
  .detail-follow-btn.following { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
  .detail-follow-btn:active { transform: scale(0.95); }

  /* ══ Unified Quote / Repost Card — used on both feed and detail page ══ */
  .quote-card {
    border: 1.5px solid var(--border);
    border-radius: 16px; overflow: hidden;
    background: var(--bg2);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    margin-top: 10px;
  }
  .quote-card:active { background: var(--bg3); border-color: var(--accent); }
  /* Detail page only — add horizontal margin since dp-wrap has no padding */
  .dp-wrap .quote-card { margin-left: 10px; margin-right: 10px; }
  .quote-card-inner { padding: 11px 13px 12px; }
  .quote-card-header {
    display: flex; align-items: center; gap: 7px; margin-bottom: 7px;
  }
  .quote-card-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
  }
  .quote-card-name {
    font-size: 15px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .quote-card-time {
    font-size: 12px; color: var(--text3);
    margin-left: auto; flex-shrink: 0;
  }
  .quote-card-text {
    font-size: 16px; color: var(--text2); line-height: 1.5;
    white-space: pre-wrap; word-break: break-word; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
  }
  .quote-card-img {
    width: 100%; display: block;
    max-height: 200px; object-fit: cover; object-position: top;
  }
  .quote-card-video-wrap {
    position: relative; width: 100%;
    max-height: 200px; overflow: hidden; background: #000;
  }
  .quote-card-video { width: 100%; max-height: 200px; object-fit: cover; display: block; }
  .quote-card-play {
    position: absolute; inset: 0; display: flex;
    align-items: center; justify-content: center;
  }

  /* Mini follow button — sticky scroll header on user profile */
  .mini-follow-btn {
    display: none; opacity: 0;
    height: 30px; padding: 0 14px; border-radius: 20px;
    font-size: 13px; font-weight: 700;
    background: #6C47FF; color: #fff;
    border: 1.5px solid #6C47FF;
    cursor: pointer; transition: opacity .25s ease, transform .15s;
    flex-shrink: 0;
  }
  .mini-follow-btn.following {
    background: transparent; color: #6C47FF; border-color: #6C47FF;
  }
  .mini-follow-btn:active { transform: scale(0.95); }
  
  .detail-text { font-size: 18px; line-height: 1.6; margin-bottom: 14px; white-space: pre-wrap; word-break: break-word; }
  .detail-media { border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
  .detail-media img { width: 100%; }
  
  .detail-stats {
    display: flex; gap: 16px; padding: 12px 0;
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }
  .detail-stat { display: flex; gap: 5px; align-items: baseline; }
  .detail-stat-n { font-size: 16px; font-weight: 800; }
  .detail-stat-l { font-size: 13px; color: var(--text3); }
  
  .detail-actions { display: flex; justify-content: space-around; padding: 8px 0; }
  .detail-action {
    display: flex; align-items: center; gap: 7px;
    padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
    color: var(--text2); transition: background 0.2s, color 0.2s;
  }
  .detail-action:active { background: var(--bg3); }
  .detail-action.liked { color: var(--red); }
  .detail-action.liked path { fill: var(--red); stroke: var(--red); }
  .detail-action.reposted { color: var(--green); }

  /* ══════════════════════════════════════════════════
     COMMENT SECTION — Clean Premium Rebuild
  ══════════════════════════════════════════════════ */

  /* Section wrapper */
  #comments-container {
    margin-top: 24px;
    border-top: 1px solid var(--border);
  }

  /* Header row */
  .comments-header {
    padding: 0;
  }
  .comments-title {
    display: block;
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--text3);
    margin-top: 16px; padding: 0 16px 20px;
  }
  .comments-title-line { display: none; }

  /* List */
  .comments-list { padding-bottom: 120px; }

  /* ── TOP-LEVEL COMMENT ── */
  .comment-item {
    display: flex;
    padding: 5px 16px;
    animation: cmtIn .22s ease both;
    position: relative;
  }
  @keyframes selfPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.08); }
    70%  { transform: scale(0.96); }
    100% { transform: scale(1); }
  }
  .self-pulse { animation: selfPulse 0.35s ease; }
  .comment-item + .comment-item:not(.reply) {
    border-top: 1px solid var(--border2);
  }

  /* Left col */
  .comment-thread-col {
    flex-shrink: 0; width: 38px; margin-right: 12px;
    display: flex; flex-direction: column; align-items: center;
  }
  .comment-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    object-fit: cover; cursor: pointer; flex-shrink: 0;
  }
  .thread-trunk { display: none !important; }

  /* Right col */
  .comment-body { flex: 1; min-width: 0; padding-bottom: 5px; }

  /* Name + time */
  .comment-meta-row {
    display: flex; align-items: center;
    gap: 6px; margin-bottom: 6px;
  }
  .comment-name {
    font-size: 15px; font-weight: 600; color: var(--text);
    cursor: pointer; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .comment-name:active { opacity: 0.65; }
  .comment-time {
    font-size: 12px; color: var(--text3);
    margin-left: 2px;
  }

  /* Text */
  .comment-text {
    font-size: 16px; line-height: 1.6;
    color: var(--text); white-space: pre-wrap;
    word-break: break-word; margin-bottom: 2px;
  }

  /* Sticker slot */
  .comment-sticker-slot {
    margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px;
  }

  /* Comment image */
  .comment-media {
    margin-top: 8px; border-radius: 12px; overflow: hidden;
    max-width: 260px;
  }
  .comment-img {
    width: 100%; max-height: 220px;
    object-fit: cover; object-position: top;
    display: block; cursor: pointer;
    transition: opacity .15s;
    border-radius: 12px;
  }
  .comment-img:active { opacity: 0.85; }

  /* Comment sticker */
  .comment-sticker {
    width: 80px; height: 80px;
    object-fit: contain; display: block;
  }

  /* Actions */
  .comment-actions-row {
    display: flex; align-items: center;
    gap: 0; margin-top: 6px; margin-left: -8px;
  }
  .comment-action {
    display: flex; align-items: center; gap: 5px;
    font-size: 13px; font-weight: 600; color: var(--text3);
    padding: 6px 8px; border-radius: 10px;
    border: none; background: transparent; cursor: pointer;
    transition: background .12s, color .12s;
    -webkit-tap-highlight-color: transparent;
  }
  .comment-action:active { background: var(--bg3); }
  .comment-action.liked { color: var(--red); }
  .comment-action.liked .cmt-heart-path { fill: var(--red); stroke: var(--red); }
  .comment-action.reply-btn { color: var(--accent); font-size: 13px; }
  .comment-action.reply-btn:active { background: rgba(108,71,255,.08); }
  .comment-action.delete-comment-btn { color: var(--text3); margin-left: auto; }
  .comment-action.delete-comment-btn:active { color: var(--red); }

  /* Expand / collapse replies */
  .replies-ctrl {
    display: flex; align-items: center; gap: 8px;
    margin-top: 8px; margin-bottom: 2px;
  }
  .expand-replies-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 700;
    color: var(--accent); background: rgba(108,71,255,.08);
    border: none; border-radius: 20px;
    padding: 4px 12px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
  }
  .expand-replies-btn:active { background: rgba(108,71,255,.18); }
  .collapse-replies-btn {
    display: inline-flex;
    align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; color: var(--text3);
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: 20px; padding: 4px 12px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
    transition: background .15s, color .15s;
  }
  .collapse-replies-btn.hidden { display: none !important; }
  .collapse-replies-btn:active { color: var(--accent); background: var(--bg3); }

  /* Replies block */
  .replies-block { margin-left: -20px; margin-top: 4px; }

  /* ── REPLY ROW ── */
  .comment-item.reply {
    padding: 5px 16px 0 0;
    animation: cmtIn .18s ease both;
  }
  .comment-item.reply .comment-thread-col {
    width: 30px; margin-right: 10px; align-items: center;
  }
  .comment-item.reply .comment-avatar { width: 30px; height: 30px; }
  .comment-item.reply .comment-name { font-size: 14px; }
  .comment-item.reply .comment-text { font-size: 15px; }
  .comment-item.reply .comment-body { padding-bottom: 5px; }

  /* Reply composer */
  .reply-composer {
    margin: 10px 0 4px;
    background: var(--bg2);
    border-radius: 16px;
    border: 1.5px solid var(--border);
    overflow: hidden; display: none;
    transition: border-color .15s;
  }
  .reply-composer.open { display: block; }
  .reply-composer:focus-within { border-color: var(--accent); }
  .reply-composer-inner { display: flex; gap: 10px; padding: 12px 14px 8px; }
  .reply-composer-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0; margin-top: 2px;
  }
  .reply-textarea {
    flex: 1; font-size: 15px; resize: none;
    color: var(--text); background: transparent;
    border: none; outline: none;
    font-family: inherit; line-height: 1.5;
  }
  .reply-textarea::placeholder { color: var(--text3); }
  .reply-composer-footer {
    display: flex; align-items: center;
    gap: 8px; padding: 6px 14px 12px;
  }
  .reply-sticker-btn {
    font-size: 18px; background: none; border: none;
    cursor: pointer; padding: 4px; opacity: 0.4;
    transition: opacity .15s, transform .15s;
  }
  .reply-sticker-btn:active { opacity: 1; transform: scale(1.2); }
  .reply-cancel {
    font-size: 13px; font-weight: 600; color: var(--text3);
    padding: 6px 12px; background: none;
    border: none; cursor: pointer; margin-left: auto;
    border-radius: 20px; transition: background .15s;
  }
  .reply-cancel:active { background: var(--bg3); }
  .reply-submit {
    font-size: 13px; font-weight: 700; padding: 7px 18px;
    background: var(--accent); color: #fff;
    border-radius: 20px; border: none; cursor: pointer;
    transition: opacity .15s, transform .15s;
  }
  .reply-submit:disabled { opacity: 0.3; cursor: not-allowed; }
  .reply-submit:active:not(:disabled) { transform: scale(0.95); }

  /* Empty state */
  .comments-empty {
    padding: 56px 24px 40px; text-align: center;
  }
  .comments-empty-icon { font-size: 36px; margin-bottom: 12px; }
  .comments-empty-text {
    font-size: 16px; font-weight: 700;
    color: var(--text2); margin-bottom: 6px;
  }
  .comments-empty-sub { font-size: 14px; color: var(--text3); line-height: 1.5; }
  .comment-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
    display: none; /* shown only on detail page via JS */
    flex-direction: column;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    background: #f0f0f5;
    border-top: 1px solid rgba(0,0,0,0.08);
  }
  .comment-bar-input {
    width: 100%; border: none; outline: none;
    background: transparent; resize: none;
    font-size: 16px; line-height: 1.4; color: var(--text);
    font-family: inherit; max-height: 120px;
    margin-bottom: 8px;
  }
  .comment-bar-input::placeholder { color: #999; }
  .cb-actions {
    display: flex; align-items: center; justify-content: space-between;
  }
  .cb-left { display: flex; align-items: center; gap: 0; }
  .cb-right { display: flex; align-items: center; gap: 0; }
  .cb-action-btn {
    width: 40px; height: 40px; border-radius: 50%;
    border: none; background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #333; transition: transform 0.15s;
    -webkit-tap-highlight-color: transparent; flex-shrink: 0;
  }
  .cb-action-btn:active { transform: scale(0.85); }
  .cb-like-btn { width: auto; padding: 0 6px; gap: 10px; border-radius: 20px; }
  .cb-like-count { font-size: 14px; font-weight: 400; color: #000000; transition: color 0.25s, font-weight 0.25s; }
  .cb-action-btn.cb-liked { color: rgb(244,7,82); }
  .cb-action-btn.cb-liked .cb-heart-path { fill: rgb(244,7,82); stroke: rgb(244,7,82); }
  .cb-action-btn.cb-liked .cb-like-count { color: rgb(244,7,82); font-weight: 500; }
  .cb-action-btn.cb-reposted { color: #6C47FF; }
  .cb-action-btn.cb-reposted .cb-repost-svg { stroke: #6C47FF; stroke-width: 2.5; }
  .cb-heart-path { transition: all 0.25s; }
  .cb-send-btn {
    width: 46px; height: 46px;
    background: rgb(244,7,82); color: #fff; border-radius: 50%;
  }
  .cb-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .cb-send-btn:active:not(:disabled) { transform: scale(0.88); }

  .comment-bar-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
  
  /* comment section uses CSS vars — no dark mode overrides needed */
  
  /* ══════════════════════════════════════════
     COMPOSER
  ══════════════════════════════════════════ */
  .composer-overlay {
    position: fixed; inset: 0; z-index: 800;
    background: rgba(0,0,0,0.4);
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .composer-sheet {
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    max-height: 90vh; display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34,1.2,0.64,1);
  }
  .composer-sheet.open { transform: translateY(0); }
  
  .composer-handle {
    width: 36px; height: 4px; border-radius: 999px;
    background: var(--bg3); margin: 12px auto 0; flex-shrink: 0;
  }
  .composer-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .composer-cancel { font-size: 15px; color: var(--text2); padding: 4px; }
  .composer-user-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
  .composer-post-btn {
    padding: 9px 20px; border-radius: 999px; font-size: 15px; font-weight: 800;
    background: var(--accent); color: white;
    transition: opacity 0.2s, transform 0.15s;
  }
  .composer-post-btn:disabled { opacity: 0.35; }
  .composer-post-btn:active:not(:disabled) { transform: scale(0.95); }
  
  .composer-body { flex: 1; overflow-y: auto; padding: 0 16px; }
  .composer-input-row { padding: 14px 0; }
  .composer-textarea {
    width: 100%; font-size: 18px; line-height: 1.5; resize: none; color: var(--text);
    min-height: 120px;
  }
  .composer-textarea::placeholder { color: var(--text3); }
  
  .composer-repost-preview {
    margin-bottom: 10px; border: 1.5px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
  }
  .composer-repost-card { padding: 12px; background: var(--bg2); position: relative; }
  .composer-repost-label { font-size: 12px; font-weight: 700; color: var(--green); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
  .composer-repost-author { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
  .composer-repost-text { font-size: 13px; color: var(--text2); }
  .composer-repost-remove {
    position: absolute; top: 8px; right: 8px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--bg3); color: var(--text2); font-size: 18px;
    display: flex; align-items: center; justify-content: center;
  }
  
  .composer-media-preview
  .media-preview-item {
    position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 10px;
  }
  .media-preview-item img { width: 100%; max-height: 280px; object-fit: cover; }
  .media-preview-remove {
    position: absolute; top: 8px; right: 8px; width: 30px; height: 30px;
    border-radius: 50%; background: rgba(0,0,0,0.6); color: white; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
  }
  
  .composer-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0 calc(12px + var(--safe-bottom));
    border-top: 1px solid var(--border); flex-shrink: 0; padding: 12px 16px;
  }
  .composer-tools { display: flex; gap: 4px; }
  .composer-tool-btn {
    width: 40px; height: 40px; border-radius: 50%; color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
  }
  .composer-tool-btn:active { background: var(--accent-soft); }
  .composer-char-count { font-size: 14px; font-weight: 600; color: var(--text3); }
  .composer-char-count.low { color: var(--gold); }
  .composer-char-count.critical { color: var(--red); }
  
  /* ══════════════════════════════════════════
     MODALS
  ══════════════════════════════════════════ */
  .modal-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(0,0,0,0.5);
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .modal-sheet {
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    max-height: 92vh; display: flex; flex-direction: column;
    overflow: hidden;
    animation: sheetUp 0.35s cubic-bezier(0.34,1.2,0.64,1);
  }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  
  .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
  }
  .modal-cancel { font-size: 15px; color: var(--text2); }
  .modal-title { font-size: 17px; font-weight: 700; }
  .modal-save { font-size: 15px; font-weight: 800; color: var(--accent); }
  .modal-body { flex: 1; overflow-y: auto; }
  
  .edit-cover-wrap { position: relative; height: 140px; background: var(--bg3); }
  .edit-cover-preview { width: 100%; height: 140px; object-fit: cover; }
  .edit-cover-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3); cursor: pointer;
  }
  .edit-avatar-section { padding: 0 16px; margin-top: -30px; margin-bottom: 10px; }
  .edit-avatar-wrap {
    width: 64px; height: 64px; border-radius: 50%; padding: 2px;
    background: linear-gradient(135deg, var(--accent), var(--red));
    position: relative;
  }
  .edit-avatar-preview { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); }
  .edit-avatar-overlay {
    position: absolute; inset: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.35); cursor: pointer;
  }
  
  .edit-fields { padding: 8px 16px 40px; }
  .edit-field-group { margin-bottom: 20px; }
  .edit-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text3); margin-bottom: 8px; display: block; }
  .edit-input {
    width: 100%; padding: 13px 14px;
    background: var(--bg2); border-radius: var(--radius-sm);
    font-size: 15px; color: var(--text); border: 1.5px solid transparent;
    transition: border-color 0.2s;
  }
  .edit-input:focus { border-color: var(--accent); background: var(--bg); }
  .edit-textarea { resize: none; }
  
  /* ══════════════════════════════════════════
     WALLET
  ══════════════════════════════════════════ */
  .wallet-page { padding: 16px; }
  .wallet-card-hero {
    position: relative; border-radius: 20px; overflow: hidden;
    background: linear-gradient(135deg, #1a0a3d 0%, #2d1060 50%, #1a0a3d 100%);
    padding: 28px 24px; min-height: 180px; color: white;
    box-shadow: 0 12px 40px rgba(108,71,255,0.4);
    margin-bottom: 20px;
  }
  .wallet-card-shine {
    position: absolute; top: -40px; right: -40px;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(255,255,255,0.06); pointer-events: none;
  }
  .wallet-card-chip {
    width: 40px; height: 30px; background: linear-gradient(135deg, var(--gold), #ffd54f);
    border-radius: 6px; margin-bottom: 20px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 4px;
  }
  .wallet-balance-label { font-size: 13px; opacity: 0.7; margin-bottom: 6px; }
  .wallet-balance-amount { font-family: var(--font-display); font-size: 42px; font-weight: 800; letter-spacing: -1px; margin-bottom: 20px; }
  .wallet-points-row { display: flex; align-items: center; justify-content: space-between; }
  .wallet-points-badge { background: rgba(255,255,255,0.15); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
  .wallet-card-number { font-size: 13px; opacity: 0.6; letter-spacing: 2px; }
  
  .wallet-actions-row { display: flex; gap: 10px; margin-bottom: 24px; }
  .wallet-action-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 14px 8px; background: var(--bg2); border-radius: var(--radius);
    font-size: 12px; font-weight: 700; color: var(--text2);
    transition: background 0.2s, transform 0.15s;
  }
  .wallet-action-btn:active { transform: scale(0.95); background: var(--bg3); }
  .wallet-action-icon {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
  }
  
  .wallet-txns 
  .txn-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--border2);
  }
  .txn-icon {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .txn-in { background: var(--green); }
  .txn-out { background: var(--red); }
  .txn-info { flex: 1; }
  .txn-title { font-size: 14px; font-weight: 600; color: var(--text); }
  .txn-date { font-size: 12px; color: var(--text3); margin-top: 2px; }
  .txn-amount { font-size: 15px; font-weight: 800; }
  .txn-positive { color: var(--green); }
  .txn-negative { color: var(--red); }
  
  /* ══════════════════════════════════════════
     SETTINGS
  ══════════════════════════════════════════ */
  .settings-body { padding: 0 16px 40px; }
  .settings-section { margin-top: 8px; }
  .settings-item {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 0; border-bottom: 1px solid var(--border2);
    font-size: 15px; font-weight: 500; cursor: pointer;
  }
  .settings-item-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: var(--bg3); display: flex; align-items: center; justify-content: center;
    color: var(--accent); flex-shrink: 0;
  }
  .settings-chevron { margin-left: auto; color: var(--text3); }
  .danger-item { color: var(--red); }
  .danger-item .settings-item-icon { color: var(--red); background: var(--red-soft); }
  
  .toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; margin-left: auto; }
  .toggle-switch input { opacity: 0; width: 0; height: 0; }
  .toggle-slider {
    position: absolute; inset: 0; cursor: pointer;
    background: var(--bg3); border-radius: 999px; transition: 0.3s;
  }
  .toggle-slider::before {
    position: absolute; content: "";
    height: 22px; width: 22px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%;
    transition: 0.3s; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  }
  input:checked + .toggle-slider { background: var(--accent); }
  input:checked + .toggle-slider::before { transform: translateX(22px); }
  
  /* ══════════════════════════════════════════
     ACTION SHEET (context menu)
  ══════════════════════════════════════════ */
  .action-sheet-overlay {
    position: fixed; inset: 0; z-index: 950;
    background: rgba(0,0,0,0.4);
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .action-sheet {
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 8px 0 calc(8px + var(--safe-bottom));
    animation: sheetUp 0.25s cubic-bezier(0.34,1.2,0.64,1);
  }
  .action-sheet-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; font-size: 16px; font-weight: 500; cursor: pointer;
    transition: background 0.15s;
  }
  .action-sheet-item:active { background: var(--bg2); }
  .action-sheet-item.danger { color: var(--red); }
  .action-sheet-divider { height: 8px; background: var(--bg2); margin: 4px 0; }
  
  /* ══════════════════════════════════════════
     TOAST
  ══════════════════════════════════════════ */
  .toast {
    position: fixed; bottom: calc(var(--nav-h) + 16px + var(--safe-bottom)); left: 50%; z-index: 9999;
    transform: translateX(-50%) translateY(20px);
    background: var(--text); color: var(--bg);
    padding: 11px 20px; border-radius: 999px;
    font-size: 14px; font-weight: 600;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    white-space: nowrap; max-width: 280px;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  
  /* ══════════════════════════════════════════
     VIDEO FULLSCREEN
  ══════════════════════════════════════════ */
  .video-fs-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: black;
    display: flex; align-items: center; justify-content: center;
  }
  .video-fs-close {
    position: absolute; top: 20px; right: 16px; z-index: 10;
    width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center;
  }
  #video-fs-player { width: 100%; max-height: 100vh; object-fit: contain; }
  
  /* ══════════════════════════════════════════
     LONG PRESS MENU (inline)
  ══════════════════════════════════════════ */
  .long-press-menu {
    position: absolute; z-index: 200;
    background: var(--surface); border-radius: 16px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
    padding: 6px; display: flex; flex-direction: column; gap: 2px;
    min-width: 160px;
    animation: menuPop 0.2s cubic-bezier(0.34,1.56,0.64,1);
  }
  @keyframes menuPop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .lp-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 10px; font-size: 15px; cursor: pointer;
    transition: background 0.15s;
  }
  .lp-item:active { background: var(--bg3); }
  .lp-item.danger { color: var(--red); }
  
  /* ══════════════════════════════════════════
     SLIDE-IN PAGE ANIMATION
  ══════════════════════════════════════════ */
  .slide-in { animation: slideIn 0.35s cubic-bezier(0.4,0,0.2,1) both; }
  @keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
  .slide-out { animation: slideOut 0.35s cubic-bezier(0.4,0,0.2,1) both; }
  @keyframes slideOut { from { transform: translateX(0); } to { transform: translateX(-30%); } }
  
  /* ══════════════════════════════════════════
     MISCELLANEOUS
  ══════════════════════════════════════════ */
  .separator { height: 8px; background: var(--bg2); }
  
  /* Prevent context menu on images */
  img { -webkit-touch-callout: none; user-select: none; }
  
  /* Scrollbar hide */
  *::-webkit-scrollbar { display: none; }
  * { scrollbar-width: none; }
  
  /* Safe area handling */
  .page-header { padding-top: calc(var(--safe-top) + 10px); padding-bottom: 10px; height: calc(var(--header-h) + var(--safe-top)); align-items: flex-end; }
  .page { padding-top: calc(var(--header-h) + var(--safe-top)); }
  .page.no-header-page { padding-top: var(--safe-top); }
  
  /* Feed needs extra for sticky header + tabs */
  #page-feed { padding-top: 0; }
  
  /* ══════════════════════════════════════════
     ANIMATIONS
  ══════════════════════════════════════════ */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .fade-up { animation: fadeUp 0.3s ease both; }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .fade-in { animation: fadeIn 0.25s ease both; }
  /* ── PROFILE SHARE SHEET ── */
  .share-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.45);
    display: flex; flex-direction: column; justify-content: flex-end;
  }
  .share-sheet {
    background: var(--surface);
    border-radius: 24px 24px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.38s cubic-bezier(0.34,1.1,0.64,1);
    overflow-y: auto;
  }
  .share-sheet.open { transform: translateY(0); }
  .share-sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px 10px;
  }
  .share-sheet-title { font-size: 16px; font-weight: 600; color: var(--text); }
  .share-sheet-close {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--bg3); border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text2);
  }
  .share-section { padding: 10px 16px; }
  .share-section-label { font-size: 12px; color: var(--text3); font-weight: 500; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .04em; }
  .share-divider { height: 1px; background: var(--border); margin: 4px 0; }

  /* Followers row */
  .share-followers-row {
    display: flex; gap: 16px; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
    padding-bottom: 4px;
  }
  .share-followers-row::-webkit-scrollbar { display: none; }
  .share-person {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; cursor: pointer; flex-shrink: 0; width: 60px;
    -webkit-tap-highlight-color: transparent;
  }
  .share-person:active { opacity: 0.7; }
  .share-person-avatar {
    width: 52px; height: 52px; border-radius: 50%;
    object-fit: cover; border: 2px solid var(--border);
  }
  .share-person-name {
    font-size: 11px; color: var(--text2); text-align: center;
    max-width: 60px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; line-height: 1.2;
  }
  .share-person-skeleton {
    width: 52px; height: 52px; border-radius: 50%;
    background: var(--bg3); flex-shrink: 0;
    animation: pulse 1.2s ease-in-out infinite;
  }

  /* Apps row */
  .share-apps-row {
    display: flex; gap: 8px; overflow-x: auto;
    scrollbar-width: none; padding-bottom: 4px;
    justify-content: space-between;
  }
  .share-apps-row::-webkit-scrollbar { display: none; }
  .share-app-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; cursor: pointer; flex-shrink: 0;
    background: none; border: none; padding: 4px;
    -webkit-tap-highlight-color: transparent;
  }
  .share-app-btn:active { opacity: 0.7; transform: scale(0.93); }
  .share-app-icon {
    width: 52px; height: 52px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
  }
  .share-app-name { font-size: 11px; color: var(--text2); }

  /* Action rows */
  .share-actions-section { padding: 6px 8px; }
  .share-action-row {
    display: flex; align-items: center; gap: 14px;
    width: 100%; padding: 14px 10px; border-radius: 12px;
    background: none; border: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }
  .share-action-row:active { background: var(--bg3); }
  .share-action-icon {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--bg3);
    display: flex; align-items: center; justify-content: center;
    color: var(--text); flex-shrink: 0;
  }
  .share-action-icon.share-action-danger { background: rgba(244,7,82,0.1); color: rgb(244,7,82); }
  .share-action-label { font-size: 15px; font-weight: 500; color: var(--text); }
  .share-action-danger-text { color: rgb(244,7,82); }

/* ══════════════════════════════════════════
   FOLLOW LIST MODAL
══════════════════════════════════════════ */
#follow-list-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end;
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
#follow-list-overlay.visible {
  opacity: 1; pointer-events: auto;
}
.follow-list-sheet {
  width: 100%; max-height: 75vh;
  background: var(--bg); border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,1,.6,1);
  overflow: hidden;
}
#follow-list-overlay.visible .follow-list-sheet {
  transform: translateY(0);
}
.follow-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.follow-list-title {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.follow-list-close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg2); border: none; cursor: pointer;
  color: var(--text2); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.follow-list-body {
  overflow-y: auto; flex: 1;
  padding: 8px 0 calc(20px + env(safe-area-inset-bottom));
}
.follow-list-loading,
.follow-list-empty {
  text-align: center; padding: 40px 20px;
  color: var(--text3); font-size: 15px;
}
.follow-list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.follow-list-row:active { background: var(--bg2); }
.follow-list-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.follow-list-info {
  flex: 1; min-width: 0;
}
.follow-list-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 4px;
}
.follow-list-btn {
  height: 32px; padding: 0 16px; border-radius: 20px;
  font-size: 13px; font-weight: 700; cursor: pointer;
  background: #6C47FF; color: #fff;
  border: 1.5px solid #6C47FF;
  transition: all .18s; flex-shrink: 0;
  font-family: inherit;
}
.follow-list-btn.following {
  background: transparent; color: #6C47FF; border-color: #6C47FF;
}
.follow-list-btn:active { transform: scale(.93); }

/* ══════════════════════════════════════════
   PROFILE MOMENT BANNER
══════════════════════════════════════════ */
.prf-moment-banner {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  padding: 6px 12px 6px 10px;
  border-radius: 20px;
  background: var(--mb-bg);
  color: var(--mb-color);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  border: 1px solid currentColor;
  opacity: 0.9;
}
.prf-moment-banner:active { transform: scale(0.95); opacity: 1; }
.prf-moment-banner-text { line-height: 1; }

/* ══════════════════════════════════════════
   SAVE / BOOKMARK BUTTON
══════════════════════════════════════════ */
[data-theme="dark"] .save-btn .save-icon {
  stroke: #9898b8; /* match other icons in dark mode */
}
[data-theme="dark"] .save-btn.saved .save-icon {
  fill: #6C47FF !important;
  stroke: #6C47FF !important;
}
