/* ── Social feed — Apple-grade design language ──────────────────────────────
   SF-stack typography, liquid-glass surfaces, hairline separators, iOS
   segmented control, springy micro-interactions. Action glyphs are Vertex-
   generated assets (assets/gamification/social/) with emoji fallbacks. */

.feed-screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 0 24px;
  font-family: var(--font-ui, -apple-system, 'SF Pro Text', sans-serif);
  letter-spacing: -0.01em;
  /* Stable scroll: no sticky sub-header competing with the docked nav */
  transform: none;
  contain: none;
}

/* Top bar removed — Create + Chat live in the bottom tab bar */
.feed-topbar { display: none !important; }
.feed-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 25px; letter-spacing: .045em; text-transform: uppercase;
  color: var(--text);
}
.feed-logo span { color: var(--violet); }
.feed-top-btn { display: none !important; }

/* ── Post card: clean liquid glass (stable, no float jitter) ── */
.feed-card {
  /* Single authority for the card's horizontal gutter. Header, actions and
     body previously hardcoded 16px / 12px / 18px, so their content edges
     stair-stepped down the card instead of lining up with the image. */
  --feed-gutter: 16px;
  margin: 12px 12px 24px;
  border-radius: 24px;
  overflow: hidden;
  background: oklch(0.15 0.02 268 / 0.55);
  backdrop-filter: blur(20px) saturate(1.45);
  -webkit-backdrop-filter: blur(20px) saturate(1.45);
  border: none;
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.14),
    inset 0 0 0 0.5px oklch(1 0 0 / 0.12),
    0 8px 24px oklch(0 0 0 / 0.22);
  transform: translateZ(0);
  will-change: auto;
}

/* ── Vertex glyphs + fallbacks ── */
.sicon { display: block; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.sicon-fb { display: block; line-height: 1; }

.feed-head {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  display: flex; align-items: center; gap: 11px;
  padding: 14px var(--feed-gutter);
}
.feed-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: oklch(0.12 0.01 270); flex-shrink: 0; overflow: hidden;
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.25), 0 1px 4px oklch(0 0 0 / 0.3);
}
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-head-meta { flex: 1; min-width: 0; }
.feed-author {
  font-weight: 650; font-size: 14px; color: #fff; letter-spacing: -0.015em;
  text-shadow: 0 1px 3px oklch(0 0 0 / 0.55);
}
.feed-sub {
  font-size: 11.5px; font-weight: 500; color: oklch(1 0 0 / 0.72);
  text-shadow: 0 1px 3px oklch(0 0 0 / 0.5);
  margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-transform: capitalize;
}
.feed-msg-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: none;
  background: oklch(0.14 0.02 270 / 0.5);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  box-shadow: inset 0 0.5px 0 oklch(1 0 0 / 0.2);
  color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: none; flex-shrink: 0;
  transition: transform .22s var(--glass-spring-press, ease), background .18s ease;
}
.feed-msg-btn:hover { background: oklch(1 0 0 / 0.12); transform: scale(1.08); }
.feed-msg-btn:active { transform: scale(0.92); }
.feed-msg-btn .sicon { width: 17px; height: 17px; }
.feed-3d-chip {
  position: absolute; z-index: 2;
  right: var(--feed-gutter); bottom: 12px;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-labels); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 100px;
  background: oklch(0.12 0.02 270 / 0.6); color: var(--lime);
  border: 1px solid oklch(0.88 0.24 135 / 0.32);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: inset 0 0.5px 0 oklch(1 0 0 / 0.18);
  cursor: none; flex-shrink: 0;
  transition: background .18s ease, border-color .18s ease;
}
.feed-3d-chip:hover {
  background: oklch(0.88 0.24 135 / 0.16);
  border-color: oklch(0.88 0.24 135 / 0.5);
}

/* Scrim: keeps overlaid identity legible on any render, light or dark. */
.feed-media-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, oklch(0 0 0 / 0.55) 0%, oklch(0 0 0 / 0.12) 24%, transparent 42%),
    linear-gradient(to top,    oklch(0 0 0 / 0.45) 0%, transparent 30%);
}

/* ── Media + iOS segmented Before/After ── */
.feed-media {
  position: relative;
  width: 100%; aspect-ratio: 4 / 3;
  background: oklch(0.09 0.02 270);
  cursor: none; user-select: none;
}
.feed-media img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
.feed-media-empty {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); opacity: .5;
}
.feed-ba {
  position: absolute; z-index: 2; left: var(--feed-gutter); bottom: 12px;
  display: flex; gap: 2px; padding: 2px;
  background: oklch(0.12 0.02 270 / 0.62);
  border-radius: 9px;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: inset 0 0.5px 0 oklch(1 0 0 / 0.12);
}
.feed-ba-btn {
  border: none; border-radius: 7px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  font-family: inherit;
  background: transparent; color: oklch(1 0 0 / 0.62); cursor: none;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.feed-ba-btn.on {
  background: oklch(1 0 0 / 0.16);
  color: #fff;
  box-shadow: inset 0 0.5px 0 oklch(1 0 0 / 0.25), 0 1px 4px oklch(0 0 0 / 0.35);
}
.feed-heart-burst {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  filter: drop-shadow(0 6px 40px oklch(0.68 0.26 340 / 0.85));
  pointer-events: none;
  animation: heart-pop .9s cubic-bezier(.17,.89,.32,1.28) both;
}
@keyframes heart-pop {
  0%   { opacity: 0; transform: scale(.3); }
  25%  { opacity: 1; transform: scale(1.15); }
  55%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05) translateY(-14px); }
}

/* ── Action row ── */
.feed-actions {
  display: flex; align-items: center; gap: 2px;
  padding: 14px 0 0;
  margin-top: 14px;
  border-top: 1px solid oklch(1 0 0 / 0.07);
}
.feed-actions-spacer { flex: 1; }
.feed-act {
  border: none; background: transparent;
  font-size: 22px; line-height: 1; color: var(--text);
  min-width: 44px; min-height: 44px;
  padding: 7px; border-radius: 12px; cursor: none;
  display: flex; align-items: center; justify-content: center;
  transition: transform .22s var(--glass-spring-press, ease), background .18s ease;
}
.feed-act .sicon { width: 26px; height: 26px; }
.feed-act:hover { transform: scale(1.12); background: oklch(1 0 0 / 0.05); }
.feed-act:active { transform: scale(0.9); }
.feed-act.liked { color: oklch(0.68 0.26 340); animation: like-pop .3s ease; }
@keyframes like-pop { 50% { transform: scale(1.35); } }
.feed-act-3d {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 0 18px;
  font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  color: #fff; cursor: none;
  background: linear-gradient(135deg, oklch(0.68 0.28 295), oklch(0.60 0.26 288));
  border: none; border-radius: 100px;
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.22),
    0 4px 14px oklch(0.68 0.28 295 / 0.35);
  transition: filter .18s ease, box-shadow .18s ease, transform .18s ease;
}
.feed-act-3d:hover {
  filter: brightness(1.1);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.28), 0 6px 20px oklch(0.68 0.28 295 / 0.5);
}
.feed-act-3d:active { transform: scale(0.97); }

/* Keyboard users get a ring the custom cursor never has to draw. */
.feed-card :is(button, input, select):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 10px;
}

/* ── Body: what it is → how funded → what you can do → the conversation ── */
.feed-body { padding: 14px var(--feed-gutter) 16px; }

.feed-card-title {
  margin: 0 0 5px; font-size: 17px; font-weight: 650; line-height: 1.25;
  letter-spacing: -0.02em; color: var(--text);
}
.feed-caption {
  margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-dim);
  max-width: 62ch;
}
.feed-caption strong { color: var(--text); font-weight: 600; }

.feed-likes {
  font-weight: 600; font-size: 13px; color: var(--text-dim);
  margin-top: 12px; letter-spacing: -0.01em;
}

/* Funding reads as a figure with context, not a caption under a hairline. */
.feed-funding { margin-top: 14px; }
.feed-funding-head {
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px;
}
.feed-funding-raised {
  font-family: var(--font-labels); font-size: 15px; font-weight: 600;
  color: var(--lime); letter-spacing: -0.01em;
}
.feed-funding-goal { font-size: 11.5px; font-weight: 500; color: var(--text-faint); }
.feed-funding-pct {
  margin-left: auto;
  font-family: var(--font-labels); font-size: 11.5px; font-weight: 600;
  color: var(--text-dim);
}
.feed-funding-bar {
  height: 4px; border-radius: 4px; overflow: hidden;
  background: oklch(1 0 0 / 0.08); margin-bottom: 6px;
}
.feed-funding-bar span {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--violet), var(--lime, #9be23a));
}

.feed-viewall {
  border: none; background: transparent; padding: 0;
  margin-top: 9px; font-size: 13px; font-weight: 500; color: var(--text-faint);
  cursor: none; font-family: inherit; letter-spacing: -0.01em;
}
.feed-viewall:hover { color: var(--text-dim); }
.feed-comment { font-size: 13px; line-height: 1.5; color: var(--text-dim); margin-top: 7px; }
.feed-comment strong { color: var(--text); font-weight: 600; }
.feed-comment-time { color: var(--text-faint); font-size: 11px; }
.feed-comment-row { display: flex; align-items: flex-start; gap: 10px; }
.feed-comment-list { margin-top: 8px; max-height: 260px; overflow-y: auto; }
.feed-comment-empty { font-size: 12.5px; color: var(--text-faint); margin-top: 9px; }
.feed-comment-like {
  border: none; background: transparent; font-size: 12px;
  color: var(--text-faint); cursor: none; flex-shrink: 0; padding: 2px 4px;
  font-family: inherit;
}
.feed-comment-like.on { color: oklch(0.68 0.26 340); }

.feed-compose {
  display: flex; align-items: center; gap: 10px;
  margin-top: 13px; padding-top: 11px;
  border-top: 1px solid oklch(1 0 0 / 0.06);
}
.feed-compose-input {
  flex: 1; border: none; background: transparent; outline: none;
  font-size: 13.5px; color: var(--text);
  font-family: inherit; letter-spacing: -0.01em;
}
.feed-compose-input::placeholder { color: var(--text-faint); }
.feed-compose-post {
  border: none; background: transparent; font-weight: 600; font-size: 13.5px;
  color: var(--violet); cursor: none; padding: 4px 2px; font-family: inherit;
  transition: opacity .15s ease, transform .15s ease;
}
.feed-compose-post:active { transform: scale(0.94); }
.feed-compose-post:disabled { opacity: .3; }

.feed-loading { display: flex; justify-content: center; padding: 34px 0; }
.feed-empty { text-align: center; padding: 56px 24px; color: var(--text-dim); }
.feed-empty p { margin: 14px 0 18px; font-size: 14.5px; letter-spacing: -0.01em; }
.feed-empty-art {
  width: min(300px, 78%); border-radius: 20px; margin: 0 auto;
  box-shadow: 0 12px 34px oklch(0 0 0 / 0.4);
}
.feed-error { text-align: center; padding: 16px; color: oklch(0.68 0.26 340); font-size: 13px; }
.feed-more { display: block; margin: 8px auto 0; font-size: 12.5px; }

/* ═══════════════════════════════════════════════════════════
   Messages — mobile-first responsive chat
   Full-width column · docked under header / above tab bar
   ═══════════════════════════════════════════════════════════ */
.chat-studio {
  --msg-blue: #0a84ff;
  --msg-fill: oklch(1 0 0 / 0.08);
  --msg-fill-hi: oklch(1 0 0 / 0.12);
  --msg-stroke: oklch(1 0 0 / 0.12);
  --msg-stroke-hi: oklch(1 0 0 / 0.22);
  --msg-label: oklch(0.93 0.01 260);
  --msg-secondary: oklch(0.72 0.015 260);
  --msg-tertiary: oklch(0.55 0.012 260);
  --msg-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --msg-spring: cubic-bezier(0.22, 1, 0.36, 1);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  /* Clear the docked header; height fills remaining viewport above the tab bar */
  margin-top: var(--nav-h, 58px);
  height: calc(100dvh - var(--nav-h, 58px) - var(--mobile-nav-h, 0px));
  min-height: calc(100dvh - var(--nav-h, 58px) - var(--mobile-nav-h, 0px));
  max-height: calc(100dvh - var(--nav-h, 58px) - var(--mobile-nav-h, 0px));
  font-family: var(--font-ui), -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  color: var(--msg-label);
  background:
    radial-gradient(90% 45% at 50% -6%, oklch(0.42 0.06 250 / 0.22), transparent 55%),
    oklch(0.09 0.015 260);
}
.chat-studio__fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.chat-studio__aurora {
  position: absolute;
  inset: -20% -12% auto;
  height: 50%;
  background:
    radial-gradient(42% 50% at 30% 40%, oklch(0.55 0.08 250 / 0.18), transparent 70%),
    radial-gradient(36% 42% at 72% 28%, oklch(0.58 0.04 200 / 0.08), transparent 68%);
  filter: blur(40px);
}
.chat-studio__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 14px 10px;
  box-sizing: border-box;
}

/* Hero — compact on mobile */
.chat-hero {
  display: grid;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 10px;
}
.chat-hero__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.chat-hero__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: 980px;
  background: oklch(1 0 0 / 0.08);
  box-shadow: inset 0 0 0 0.5px var(--msg-stroke), inset 0 1px 0 oklch(1 0 0 / 0.12);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--msg-secondary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.2s var(--msg-ease), color 0.2s ease;
}
.chat-hero__back:hover {
  background: var(--msg-fill-hi);
  color: var(--msg-label);
}
.chat-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 980px;
  border: none;
  box-shadow: inset 0 0 0 0.5px var(--msg-stroke);
  background: var(--msg-fill);
  color: var(--msg-secondary);
  font-size: 12px;
  font-weight: 560;
}
.chat-hero__badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--msg-blue);
  box-shadow: 0 0 0 3px oklch(0.55 0.18 250 / 0.25);
}
.chat-hero__copy { display: grid; gap: 4px; max-width: 460px; }
.chat-hero__title {
  margin: 0;
  font-size: clamp(26px, 7vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--msg-label);
}
.chat-hero__sub {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--msg-secondary);
  letter-spacing: -0.01em;
}

/* Conversation list — fills remaining height */
.chat-list-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 18px;
  border: none;
  background: oklch(0.16 0.018 260 / 0.5);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.12),
    inset 0 0 0 0.5px oklch(1 0 0 / 0.1),
    0 10px 28px oklch(0 0 0 / 0.2);
  padding: 4px;
}
.chat-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border: none;
  border-radius: 14px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.18s ease;
  animation: none;
}
.chat-row + .chat-row { position: relative; }
.chat-row + .chat-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 66px;
  right: 10px;
  height: 1px;
  background: oklch(1 0 0 / 0.06);
}
.chat-row:hover { background: oklch(1 0 0 / 0.06); }
.chat-row:active { background: oklch(1 0 0 / 0.1); }
.chat-row.unread .chat-row-name { font-weight: 700; }
.chat-row.unread .chat-row-last { color: var(--msg-label); font-weight: 560; }
.chat-row.unread .chat-row-time { color: var(--msg-blue); }

.chat-ava {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: oklch(0.12 0.02 260);
  letter-spacing: -0.02em;
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.35),
    0 0 0 2px oklch(0.12 0.02 260),
    0 4px 10px oklch(0 0 0 / 0.22);
}
.chat-row-meta { flex: 1; min-width: 0; }
.chat-row-name {
  font-weight: 650;
  font-size: 15px;
  color: var(--msg-label);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-row-last {
  font-size: 13px;
  color: var(--msg-tertiary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.chat-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.chat-row-time {
  font-size: 11px;
  font-weight: 500;
  color: var(--msg-tertiary);
  font-variant-numeric: tabular-nums;
}
.chat-unread {
  min-width: 20px;
  height: 20px;
  border-radius: 100px;
  padding: 0 6px;
  background: linear-gradient(180deg, #409cff, #0a84ff);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Empty / loading */
.chat-empty {
  text-align: center;
  max-width: 360px;
  margin: auto;
  padding: 28px 20px;
  border-radius: 20px;
  border: none;
  background: oklch(0.16 0.02 260 / 0.45);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.1), inset 0 0 0 0.5px oklch(1 0 0 / 0.1);
}
.chat-empty__ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--msg-blue);
  background: oklch(0.55 0.14 250 / 0.16);
  box-shadow: inset 0 0 0 0.5px oklch(0.55 0.14 250 / 0.28);
}
.chat-empty__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--msg-label);
}
.chat-empty__sub {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--msg-secondary);
}
.chat-empty__btn {
  margin-top: 18px;
  min-height: 40px;
  padding: 0 20px;
  border: none;
  border-radius: 980px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
  background: linear-gradient(180deg, #409cff, #0a84ff);
  box-shadow: 0 8px 20px oklch(0.5 0.16 250 / 0.35);
  cursor: pointer;
}
.chat-empty__btn:active { transform: scale(0.97); }

.chat-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex: 1;
  padding: 48px 20px;
  color: var(--msg-tertiary);
  font-size: 13px;
  font-weight: 500;
}
.chat-loading__orb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid oklch(0.55 0.14 250 / 0.25);
  border-top-color: var(--msg-blue);
  animation: chat-spin 0.8s linear infinite;
}
@keyframes chat-spin {
  to { transform: rotate(360deg); }
}

/* ── Thread shell — full column under header / above tab bar ── */
.chat-studio--thread {
  padding: 0;
}
.chat-studio--thread .chat-studio__inner,
.chat-thread-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: 8px 10px 8px;
  gap: 8px;
  box-sizing: border-box;
}
.chat-thread-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 16px;
  border: none;
  background: oklch(0.16 0.018 260 / 0.65);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.12),
    inset 0 0 0 0.5px oklch(1 0 0 / 0.1);
  flex-shrink: 0;
}
.chat-thread-head .chat-ava { width: 36px; height: 36px; font-size: 11px; }
.chat-back {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--msg-fill);
  box-shadow: inset 0 0 0 0.5px var(--msg-stroke);
  color: var(--msg-label);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.chat-back:active { transform: scale(0.9); }
.chat-thread-id { min-width: 0; }
.chat-thread-name {
  font-weight: 650;
  font-size: 16px;
  color: var(--msg-label);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-thread-sub {
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--msg-tertiary);
}
.chat-thread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #30d158;
}

.chat-msgs {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.chat-day {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.chat-day span {
  padding: 4px 12px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  color: var(--msg-tertiary);
  background: oklch(1 0 0 / 0.06);
}

.chat-empty-thread {
  text-align: center;
  margin: auto 0;
  padding: 24px 16px 40px;
}
.chat-empty-thread__ava {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: oklch(0.12 0.02 260);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.35), 0 8px 20px oklch(0 0 0 / 0.28);
}
.chat-empty-thread__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--msg-label);
}
.chat-empty-thread__sub {
  margin: 6px auto 0;
  max-width: 260px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--msg-secondary);
}

.chat-bubble-row {
  display: flex;
  max-width: 100%;
}
.chat-bubble-row.mine { justify-content: flex-end; }
.chat-bubble {
  max-width: min(82%, 420px);
  padding: 9px 13px 7px;
  border-radius: 18px 18px 18px 6px;
  background: oklch(1 0 0 / 0.09);
  border: none;
  box-shadow: inset 0 0.5px 0 oklch(1 0 0 / 0.12), inset 0 0 0 0.5px oklch(1 0 0 / 0.06);
  color: var(--msg-label);
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
  letter-spacing: -0.01em;
}
.chat-bubble.mine {
  border-radius: 18px 18px 6px 18px;
  background: linear-gradient(160deg, #409cff, #0a84ff 70%, #0071e3);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.3);
  color: #fff;
}
.chat-bubble__text { display: inline; }
.chat-time {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 500;
  opacity: 0.55;
  vertical-align: bottom;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chat-bubble.mine .chat-time { opacity: 0.7; }

/* Compose — docked at bottom of thread column */
.chat-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 6px 6px 8px;
  border-radius: 100px;
  border: none;
  background: oklch(0.16 0.018 260 / 0.72);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.12),
    inset 0 0 0 0.5px oklch(1 0 0 / 0.12),
    0 8px 24px oklch(0 0 0 / 0.22);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}
.chat-compose:focus-within {
  box-shadow:
    inset 0 1px 0 oklch(1 0 0 / 0.12),
    0 0 0 2px oklch(0.55 0.16 250 / 0.28),
    0 8px 24px oklch(0 0 0 / 0.22);
}
.chat-input {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 100px;
  padding: 11px 12px;
  background: transparent;
  box-shadow: none;
  color: var(--msg-label);
  font-size: 16px; /* avoid iOS zoom */
  outline: none;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.chat-input::placeholder { color: var(--msg-tertiary); }
.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #409cff, #0a84ff);
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.28);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-send .sicon { width: 18px; height: 18px; }
.chat-send:active:not(:disabled) { transform: scale(0.92); }
.chat-send:disabled { opacity: 0.32; cursor: default; }

@media (min-width: 769px) {
  .chat-studio {
    height: auto;
    min-height: calc(100dvh - var(--nav-h, 58px) - 24px);
    max-height: none;
    margin-top: var(--nav-h, 58px);
    padding-bottom: 24px;
  }
  .chat-studio__inner {
    padding: 20px 24px 0;
  }
  .chat-studio--thread .chat-studio__inner,
  .chat-thread-shell {
    height: calc(100dvh - var(--nav-h, 58px) - 40px);
    min-height: 420px;
    max-height: 820px;
  }
}

@media (max-width: 768px) {
  /* Chat screens already account for header + tab bar — don't double-pad */
  .user-screen:has(.chat-studio) {
    padding-bottom: 0;
    overflow: hidden;
  }
  .chat-studio__inner { padding-left: 12px; padding-right: 12px; }
  .chat-bubble { max-width: 86%; }
  .chat-hero__sub { display: none; }
}

@media (max-width: 380px) {
  .chat-hero__title { font-size: 24px; }
  .chat-row-name { font-size: 14px; }
  .chat-ava { width: 40px; height: 40px; }
}

@media (max-width: 600px) {
  .feed-card { margin: 10px 8px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .feed-heart-burst, .feed-act.liked,
  .chat-loading__orb { animation: none !important; }
  .glass-tabbar-pill.is-morphing .glass-bg-chrome { transform: none; }
}

/* Legacy hook if anything still references chat-screen */
.chat-screen { display: contents; }
.chat-list { display: contents; }
.chat-title { display: contents; }
.chat-sub { display: contents; }
.chat-list-head { display: contents; }


/* Unread DM badge on the top-bar messages button */
.feed-top-btn--msg { position: relative; }
.feed-unread-badge {
  position: absolute; top: -4px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 100px;
  background: oklch(0.62 0.24 25);
  color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 5px oklch(0 0 0 / 0.4), inset 0 0.5px 0 oklch(1 0 0 / 0.3);
  pointer-events: none;
}

/* SVG icon alignment in social controls */
.feed-comment-like { display: inline-flex; align-items: center; gap: 4px; }
.feed-act svg, .feed-top-btn svg, .feed-msg-btn svg { display: block; }
