/* ============ Glimpse design system ============ */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7fa;
  --card: #ffffff;
  --border: #e8e8ee;
  --text: #17171f;
  --muted: #6e6e82;
  --accent1: #7C3AED;
  --accent2: #06B6D4;
  --gradient: linear-gradient(135deg, #7C3AED 0%, #06B6D4 100%);
  --danger: #f43f5e;
  --nav-bg: rgba(255, 255, 255, 0.94);
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 4px 16px rgba(20, 20, 40, 0.06);
  --topbar-h: 56px;
  --tabbar-h: 60px;
  --sidebar-w: 244px;
  --radius: 14px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f0f14;
  --bg-soft: #14141b;
  --card: #17171f;
  --border: #26262f;
  --text: #f2f2f7;
  --muted: #9a9aad;
  --nav-bg: rgba(15, 15, 20, 0.94);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  transition: background 0.2s, color 0.2s;
}
a { color: var(--text); text-decoration: none; }
button { font-family: inherit; }
img, video { max-width: 100%; }

/* ============ app shell ============ */
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.topbar-actions { display: flex; gap: 6px; align-items: center; }
.app-main { min-height: 100dvh; }
.wrap {
  max-width: 480px; margin: 0 auto;
  padding: 14px 12px calc(var(--tabbar-h) + 28px);
}

.logo { display: inline-flex; align-items: center; gap: 9px; }
.logo svg { width: 30px; height: 30px; display: block; }
.logo .wordmark {
  font-size: 21px; font-weight: 800; letter-spacing: -0.6px;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ============ bottom tab bar (mobile) ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex;
}
.tabbar a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; color: var(--text);
}
.tabbar a svg { width: 27px; height: 27px; }
.tabbar a.active { color: var(--accent1); }
.tabbar a.active .tab-avatar { outline: 2px solid var(--accent1); outline-offset: 2px; }
.tab-avatar { border-radius: 50%; overflow: hidden; width: 27px; height: 27px; display: block; }
.tab-avatar img, .tab-avatar .initial { width: 100%; height: 100%; }

/* ============ icon buttons & badges ============ */
.icon-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  padding: 8px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 25px; height: 25px; display: block; }
.badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 12px; min-width: 17px; text-align: center;
  border: 2px solid var(--bg);
}
.badge.inline-badge { position: static; display: inline-block; margin-left: 6px; border: none; }

/* ============ desktop sidebar ============ */
@media (min-width: 1024px) {
  .topbar, .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30;
    width: var(--sidebar-w);
    background: var(--bg);
    border-right: 1px solid var(--border);
    padding: 22px 14px 18px;
  }
  .sidebar .logo { padding: 0 12px 20px; }
  .sidebar .logo svg { width: 34px; height: 34px; }
  .sidebar .logo .wordmark { font-size: 24px; }
  .side-link {
    display: flex; align-items: center; gap: 14px;
    padding: 11px 12px; border-radius: 12px; font-size: 16px;
    position: relative; color: var(--text);
  }
  .side-link:hover { background: var(--bg-soft); }
  .side-link.active { font-weight: 700; }
  .side-link.active svg { color: var(--accent1); }
  .side-link svg { width: 26px; height: 26px; flex-shrink: 0; }
  .side-link .badge { position: static; margin-left: auto; border: none; }
  .side-link .tab-avatar { width: 26px; height: 26px; }
  .side-spacer { flex: 1; }
  .create-wrap { position: relative; }
  .create-menu {
    display: none; position: absolute; left: 0; bottom: calc(100% + 6px);
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); min-width: 190px; padding: 6px; z-index: 40;
  }
  .create-wrap.open .create-menu { display: block; }
  .create-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 9px; font-size: 15px;
  }
  .create-menu a:hover { background: var(--bg-soft); }
  .create-menu a svg { width: 20px; height: 20px; }
  .app-main { margin-left: var(--sidebar-w); }
  .wrap { padding-bottom: 60px; max-width: 500px; }
}

/* ============ avatars ============ */
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
  background: var(--gradient);
}
.avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 88px; height: 88px; font-size: 32px; }

/* ============ post cards ============ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: 10px; padding: 11px 13px; }
.card-head .who { display: flex; flex-direction: column; min-width: 0; }
.card-head .who a { font-weight: 600; font-size: 14px; }
.time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.card-head .time { margin-left: auto; }
.card-head .follow-mini {
  margin-left: auto; font-size: 13px; font-weight: 700; color: var(--accent1);
  background: none; border: none; cursor: pointer; padding: 6px 4px;
}
.media { width: 100%; display: block; max-height: 72vh; object-fit: contain; background: #000; }
.card-actions { padding: 4px 8px; display: flex; gap: 2px; align-items: center; }
.card-actions .spacer { flex: 1; }
.action-btn {
  background: none; border: none; cursor: pointer; color: var(--text);
  padding: 8px; border-radius: 50%; display: inline-flex;
}
.action-btn:hover { background: var(--bg-soft); }
.action-btn svg { width: 26px; height: 26px; display: block; }
.action-btn.liked { color: var(--danger); }
.action-btn.liked svg { fill: var(--danger); }
@keyframes heartpop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
.action-btn.pop svg { animation: heartpop 0.35s ease; }
.likes { font-weight: 700; font-size: 14px; padding: 2px 14px; }
.caption { padding: 4px 14px 12px; font-size: 14px; overflow-wrap: anywhere; line-height: 1.45; }
.caption .uname { font-weight: 700; margin-right: 6px; }
.view-comments {
  display: block; padding: 0 14px 12px; font-size: 14px; color: var(--muted);
}

/* ============ stories tray & rings ============ */
.tray {
  display: flex; gap: 14px; overflow-x: auto;
  padding: 14px 6px; margin-bottom: 14px;
  scrollbar-width: none;
}
.tray::-webkit-scrollbar { display: none; }
.tray-item {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  flex-shrink: 0; width: 68px;
}
.tray-item .ring-wrap { width: 64px; height: 64px; }
.tray-name { font-size: 11px; color: var(--muted); max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2.5px; border-radius: 50%; flex-shrink: 0;
  background: var(--gradient);
}
.ring-wrap .avatar, .ring-wrap img.avatar { border: 2.5px solid var(--bg); margin: 0; }
.ring-wrap.lg { padding: 3.5px; }
.ring-wrap.lg .avatar { border-width: 3px; }

/* ============ story viewer ============ */
.viewer {
  position: fixed; inset: 0; z-index: 50; background: #000;
  display: flex; justify-content: center;
}
.viewer-inner {
  position: relative; width: 100%; max-width: 480px; height: 100dvh;
  display: flex; flex-direction: column;
}
.segments { display: flex; gap: 4px; padding: calc(10px + env(safe-area-inset-top)) 10px 0; z-index: 3; }
.seg { flex: 1; height: 3px; background: rgba(255,255,255,0.35); border-radius: 2px; overflow: hidden; }
.seg-fill { height: 100%; width: 0; background: #fff; border-radius: 2px; }
.seg-fill.done { width: 100%; }
.seg-fill.active { animation: segfill 5s linear forwards; }
.seg-fill.active.novideo { animation: none; width: 100%; }
@keyframes segfill { from { width: 0; } to { width: 100%; } }
.viewer-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; z-index: 3; }
.viewer-name { color: #fff; font-size: 14px; }
.time.light { color: rgba(255,255,255,0.7); }
.viewer-close { margin-left: auto; color: #fff; padding: 6px; display: inline-flex; }
.viewer-close svg { width: 24px; height: 24px; }
.viewer-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.viewer-caption {
  position: absolute; bottom: 84px; left: 0; right: 0; z-index: 3;
  color: #fff; text-align: center; font-size: 15px; padding: 0 24px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8); overflow-wrap: anywhere;
}
.tapzone { position: absolute; top: 0; bottom: 0; z-index: 2; }
.tapzone.left { left: 0; width: 30%; }
.tapzone.right { left: 30%; right: 0; }
.viewer-tools {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 4;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.55));
}
.tool-link {
  color: #fff; font-size: 15px; font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  display: inline-flex; align-items: center; gap: 6px;
}
.tool-link.danger { color: #ff8a8a; }
.tool-link svg { width: 20px; height: 20px; }

/* ============ profile ============ */
.profile-top { padding: 6px 2px 0; }
.profile-head { display: flex; gap: 22px; align-items: center; padding: 8px 2px 14px; }
.profile-info { flex: 1; min-width: 0; }
.profile-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.profile-name-row h2 { font-size: 19px; font-weight: 600; }
.stats { display: flex; gap: 20px; font-size: 14px; }
.stats b { font-weight: 700; }
.bio { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 8px; line-height: 1.45; }
.profile-actions { display: flex; gap: 8px; margin: 4px 2px 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.grid-item { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: var(--bg-soft); border-radius: 2px; }
.grid-item img, .grid-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-badge {
  position: absolute; top: 6px; right: 8px; z-index: 2;
  color: #fff; display: inline-flex;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6));
}
.video-badge svg { width: 18px; height: 18px; }
.tabs {
  display: flex; gap: 4px; margin-bottom: 3px;
  border-top: 1px solid var(--border);
}
.tabs a {
  flex: 1; text-align: center; padding: 11px 4px; font-size: 13px; font-weight: 600;
  color: var(--muted); border-top: 2px solid transparent; margin-top: -1px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-transform: uppercase; letter-spacing: 0.6px;
}
.tabs a svg { width: 17px; height: 17px; }
.tabs a.active { color: var(--text); border-top-color: var(--text); }

/* ============ buttons & forms ============ */
.btn {
  background: var(--gradient); color: #fff; border: none; border-radius: 10px;
  padding: 10px 20px; font-weight: 700; cursor: pointer; font-size: 14px;
  display: inline-block; text-align: center;
}
.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn.block { display: block; width: 100%; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.form-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 30px 24px; max-width: 400px; margin: 34px auto;
  box-shadow: var(--shadow); text-align: center;
}
.form-card.wide { max-width: 520px; }
.form-card h1 { margin: 10px 0 6px; font-size: 24px; letter-spacing: -0.4px; }
.form-card .logo { justify-content: center; margin-bottom: 2px; }
.form-card .logo svg { width: 52px; height: 52px; }
.tagline { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; text-align: left; }
.stack label { font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  font-size: 15px; width: 100%; background: var(--bg-soft); color: var(--text); font-family: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--accent1); border-color: transparent; }
input[type="file"] { font-size: 14px; }
.switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.switch a { color: var(--accent1); font-weight: 700; }
.error {
  background: rgba(244, 63, 94, 0.1); color: var(--danger); border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; margin-top: 12px; text-align: left;
}
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 8px; font-size: 20px; }
.empty a { color: var(--accent1); font-weight: 700; }
.empty .big-emoji { font-size: 44px; display: block; margin-bottom: 12px; }
.empty .big-emoji svg { width: 60px; height: 60px; }
.pad { padding: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.inline-form { display: inline; }
.link-btn { background: none; border: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 8px; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin: 4px 2px 14px; }

/* ============ results rows (search, notifications, inbox) ============ */
.results { display: flex; flex-direction: column; gap: 2px; }
.result-row {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 6px; border-radius: 12px;
}
.result-row:hover { background: var(--bg-soft); }
.result-row > div { min-width: 0; }

/* ============ reels ============ */
.reels-feed {
  position: fixed; inset: 0; z-index: 40; background: #000;
  overflow-y: auto; overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}
.reels-feed::-webkit-scrollbar { display: none; }
.reel-slide {
  position: relative; height: 100dvh; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden;
}
.reel-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.reels-close, .reels-new {
  position: fixed; z-index: 45; color: #fff;
  padding: 10px; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  background: rgba(0,0,0,0.35); border-radius: 50%;
  display: inline-flex;
}
.reels-close svg, .reels-new svg { width: 22px; height: 22px; display: block; }
.reels-close { top: calc(10px + env(safe-area-inset-top)); right: 12px; }
.reels-new { top: calc(10px + env(safe-area-inset-top)); left: 12px; }
.reel-overlay {
  position: absolute; inset: auto 0 0 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 18px 14px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,0.6));
  pointer-events: none;
}
.reel-overlay a, .reel-overlay button { pointer-events: auto; }
.reel-meta { flex: 1; min-width: 0; color: #fff; }
.reel-author { color: #fff; font-size: 15px; }
.reel-caption {
  color: #fff; font-size: 14px; margin-top: 6px;
  overflow-wrap: anywhere; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.reel-views { color: rgba(255,255,255,0.85); font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.reel-views svg { width: 15px; height: 15px; }
.reel-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-left: 10px; }
.reel-act {
  background: none; border: none; cursor: pointer; color: #fff; padding: 6px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8); font-family: inherit; display: inline-flex;
}
.reel-act svg { width: 30px; height: 30px; display: block; }
.reel-act.liked { color: var(--danger); }
.reel-act.liked svg { fill: var(--danger); }
.reel-count { color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,0.8); }
.reel-comment-form {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; gap: 8px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.reel-comment-form.hidden { display: none; }
.reel-comment-form input { flex: 1; }

/* ============ inbox & DMs ============ */
.inbox-preview { flex: 1; min-width: 0; }
.inbox-last { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dm-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
  position: sticky; top: var(--topbar-h); background: var(--bg); z-index: 5;
}
@media (min-width: 1024px) { .dm-head { top: 0; } }
.dm-back { padding: 6px; display: inline-flex; color: var(--muted); }
.dm-back svg { width: 22px; height: 22px; }
.dm-thread {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 2px; max-height: 62vh; overflow-y: auto;
}
.dm-msg { display: flex; flex-direction: column; max-width: 80%; }
.dm-msg.mine { align-self: flex-end; align-items: flex-end; }
.dm-msg.theirs { align-self: flex-start; align-items: flex-start; }
.dm-bubble {
  padding: 9px 14px; border-radius: 20px; font-size: 15px;
  overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.4;
}
.dm-msg.mine .dm-bubble { background: var(--gradient); color: #fff; }
.dm-msg.theirs .dm-bubble { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.dm-time { font-size: 11px; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.dm-form { display: flex; gap: 8px; padding: 12px 2px 4px; position: sticky; bottom: calc(var(--tabbar-h) + 8px); }
@media (min-width: 1024px) { .dm-form { bottom: 8px; } }
.dm-form input { flex: 1; border-radius: 22px; }
.small-pad { padding: 20px; }

/* ============ toast ============ */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); z-index: 60;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 11px 20px; border-radius: 24px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap; box-shadow: var(--shadow);
}
@media (min-width: 1024px) { #toast { bottom: 30px; } }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ offline page ============ */
.offline-wrap {
  min-height: 70dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 10px;
  padding: 30px 20px; color: var(--muted);
}
.offline-wrap .logo svg { width: 64px; height: 64px; }

/* ============ small screens ============ */
@media (max-width: 480px) {
  .wrap { padding-left: 0; padding-right: 0; }
  .wrap > :not(.card):not(.tray) { margin-left: 12px; margin-right: 12px; }
  .card { border-radius: 0; border-left: none; border-right: none; box-shadow: none; }
  .tray { margin-left: 0 !important; margin-right: 0 !important; padding-left: 12px; }
  .profile-top { padding-left: 12px; padding-right: 12px; }
}

/* ================= Phase 4 additions ================= */

/* photo filters (pure CSS) */
.filter-normal { filter: none; }
.filter-clarendon { filter: contrast(1.15) saturate(1.25) brightness(1.02); }
.filter-juno { filter: contrast(1.05) saturate(1.3) sepia(0.12) brightness(1.03); }
.filter-lark { filter: contrast(0.95) saturate(1.1) brightness(1.06); }
.filter-gingham { filter: contrast(0.92) saturate(0.85) sepia(0.25) brightness(1.04); }
.filter-moon { filter: grayscale(1) contrast(1.1) brightness(1.05); }
.filter-slumber { filter: saturate(0.7) sepia(0.35) brightness(1.03) contrast(0.95); }
.filter-aden { filter: contrast(0.9) saturate(0.85) brightness(1.05) sepia(0.2); }
.filter-perpetua { filter: contrast(1.08) saturate(1.15) brightness(1.02); }
.filter-preview-wrap { margin: 8px 0; }
.filter-preview-wrap .media { border-radius: 12px; max-height: 320px; width: 100%; object-fit: cover; }

/* carousel */
.carousel { position: relative; overflow: hidden; border-radius: 4px; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: start; }
.carousel-slide .media { width: 100%; display: block; }
.carousel-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.carousel-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.55); transition: background .2s; }
.carousel-dots .dot.active { background: #fff; }

/* hashtag / mention links */
.tag-link { color: var(--accent1); font-weight: 600; text-decoration: none; }
.tag-link:hover { text-decoration: underline; }

/* saved button state */
.action-btn.saved { color: var(--accent1); }

/* highlights row */
.highlights-row { display: flex; gap: 14px; overflow-x: auto; padding: 12px 4px; scrollbar-width: none; }
.highlights-row::-webkit-scrollbar { display: none; }
.highlight-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: inherit; min-width: 72px; }
.highlight-item img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); padding: 2px; }
.highlight-title { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* collections */
.collection { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.collection summary { cursor: pointer; font-size: 15px; }
.grid-item-wrap { position: relative; }
.inline-row-form { display: flex; gap: 8px; margin: 8px 0; }
.inline-row-form input[type="text"] { flex: 1; }

/* group DMs */
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack img, .avatar-stack .avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg); margin-left: -10px; object-fit: cover; }
.avatar-stack img:first-child, .avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.group-menu { position: relative; margin-left: auto; }
.group-menu-body { position: absolute; right: 0; top: 110%; width: 260px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.member-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.member-row a { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
.dm-sender { font-size: 11px; font-weight: 700; color: var(--accent1); margin-bottom: 2px; }

/* report / admin */
.report-wrap { margin: 0 0 12px; }
.report-form { max-width: 320px; }
.linklike { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--accent1); }
.linklike.danger { color: #dc2626; }
.linklike.small { font-size: 13px; }
.danger-btn { background: #dc2626; color: #fff; border: none; }
.danger-btn:hover { background: #b91c1c; }
.admin-badge { color: var(--accent1); display: inline-flex; vertical-align: middle; }
.admin-badge svg { width: 18px; height: 18px; }
.banned-badge { background: #dc2626; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.admin-report { align-items: flex-start; }
.admin-row-actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.section-title { margin: 20px 0 10px; font-size: 17px; }
.tool-details { position: relative; }
.tool-details .highlight-form { position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); width: 230px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.18); }

/* dark mode variable fallbacks for phase-4 bits */
[data-theme="dark"] .collection { border-color: #333; }
[data-theme="dark"] .group-menu-body { background: #1c1c22; border-color: #333; }
[data-theme="dark"] .tool-details .highlight-form { background: #1c1c22; border-color: #333; }
[data-theme="dark"] .highlight-item img { border-color: #444; }
