
/* Jump-to-comment highlight for mention notifications */
.comment{scroll-margin-top:84px}
.comment:target{
  outline:2px solid rgba(59,130,246,.55);
  box-shadow:0 0 0 4px rgba(59,130,246,.18);
}

:root{--vv-bottom:0px;--iosbar:0px;}
:root{
  /* Digg-like clean white feed */
  --bg:#ffffff;
  --card:#ffffff;
  --text:#111;
  --muted:#6b7280;
  --border:#eceef2;
  --primary:#111;
  --accent:#2563eb; /* active vote/save color */
  --pill:#111;
  --pillText:#fff;
  --radius:16px;
  /* Layout width tuning (wider posts, closer to edges) */
  --pageMax:1400px;
  --edgePad:10px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:15.5px;
  line-height:1.4;
  background:var(--bg);
  color:var(--text);
  text-rendering:optimizeLegibility;
}

a{color:inherit;text-decoration:none}
.container{
  max-width:var(--pageMax);
  margin:0 auto;
  /* Leave room for the fixed topbar + iOS safe area */
  padding:calc(72px + env(safe-area-inset-top)) var(--edgePad) 92px;
}

.topbar{
  position:fixed;top:0;left:0;right:0;
  background:rgba(255,255,255,.92);
  backdrop-filter:saturate(180%) blur(14px);
  border-bottom:1px solid rgba(236,238,242,.9);
  z-index:50;
  padding-top: env(safe-area-inset-top);
}
.topbar-inner{
  max-width:var(--pageMax);margin:0 auto;padding:12px var(--edgePad);
  display:flex;align-items:center;justify-content:space-between;
}
.topbar-left{display:flex;align-items:center;gap:10px;min-width:0}
.topbar-logo{width:24px;height:24px;border-radius:8px;object-fit:cover;border:1px solid rgba(229,231,235,.9);background:#fff;flex:0 0 auto}
.topbar-logo.logo-dark{display:none}
:root[data-theme="dark"] .topbar-logo.logo-light{display:none}
:root[data-theme="dark"] .topbar-logo.logo-dark{display:inline-block}
.topbar-aud{font-weight:700;font-size:18px;display:inline-flex;gap:6px;align-items:center}
.topbar-aud .chev{font-size:14px;color:var(--muted)}
.topbar-right{display:flex;gap:10px;align-items:center}
/* Make pill buttons/links always readable in the topbar (Login/Logout). */
.topbar-right .pill{color:#111 !important}
.dark .topbar-right .pill{color:#111 !important;background:#fff;border-color:rgba(0,0,0,.10)}

.topbar-back{
  display:inline-flex;align-items:center;justify-content:center;
  width:44px;height:44px;
  border-radius:12px;
  font-size:22px;
  color:var(--text);
}
.topbar-title{
  font-weight:800;
  font-size:18px;
}

.pill{
  padding:8px 12px;border-radius:999px;border:1px solid var(--border);
  background:var(--card);font-weight:600;font-size:14px;
}
.pill-new{
  display:inline-block;
  padding:2px 8px;
  font-size:12px;
  line-height:18px;
  border-radius:999px;
  border:1px solid rgba(31,111,255,.25);
  color:#1f6fff;
  background:rgba(31,111,255,.08);
  vertical-align:middle;
}
.iconbtn{
  width:36px;height:36px;border-radius:999px;
  border:1px solid var(--border);background:var(--card);
  display:grid;place-items:center;cursor:pointer;
}
.iconbtn svg{width:18px;height:18px;fill:var(--text)}
.iconbtn.ghost{border-color:transparent;background:transparent}
.iconbtn.ghost svg{fill:var(--muted)}
.iconbtn.more{width:32px;height:32px}

.iconbtn-bell{position:relative}
.topbar-badge{
  position:absolute;
  top:6px; right:6px;
  width:10px; height:10px;
  border-radius:99px;
  background:#1f6fff;
  box-shadow:0 0 0 2px rgba(255,255,255,.98);
}

.notice{
  padding:12px 14px;border-radius:14px;margin:10px 0;
  border:1px solid var(--border);background:var(--card);color:var(--text);
  font-size:14px;
}
.notice.err{border-color:#fecaca;background:#fff1f2}
.notice.ok{border-color:#bbf7d0;background:#f0fdf4}
.notice.warn{border-color:#fde68a;background:#fffbeb}

.seg{
  display:flex;
  gap:10px;
  margin:12px 0 16px;
}
.seg-btn{
  flex:1;
  text-align:center;
  padding:12px 12px;
  border-radius:999px;
  border:1px solid transparent;
  background:#e9edf2;
  font-weight:800;
  font-size:14px;
  color:#111;
}
.seg-btn.active{
  background:#111;
  color:#fff;
}

.card{
  background:var(--card);
  border:0;
  border-radius:0;
  padding:0;
  box-shadow:none;
}

.card + .card{margin-top:0}
.post{
  padding:16px 0;
  border-bottom:1px solid var(--border);
}
.post-meta{display:flex;align-items:center;gap:8px;color:var(--muted);font-size:13px;font-weight:600}
.meta-comm{font-weight:700;color:var(--text)}
.dot{color:#c0c4cc}
.post-link{display:block;margin-top:8px}
.post-title{margin:0 0 6px;font-size:20px;line-height:1.22;font-weight:800;letter-spacing:-.02em}
.post-excerpt{margin:0;color:var(--muted);font-size:15px;line-height:1.55;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.preview{
  margin-top:12px;
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px;
  display:flex;gap:10px;align-items:stretch;
  background:#fff;
}
.preview-txt{flex:1;min-width:0}
.preview-domain{color:var(--muted);font-size:12px;font-weight:700}
.preview-title{margin-top:4px;font-weight:700;font-size:14px;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.preview-img{width:76px;height:76px;border-radius:14px;overflow:hidden;border:1px solid var(--border);background:#fff;display:grid;place-items:center}
.preview-img img{width:100%;height:100%;object-fit:cover}
.preview-img.placeholder svg{width:22px;height:22px;fill:var(--muted)}
.media{margin-top:12px;border-radius:18px;overflow:hidden;border:0;background:#fff}
.media img{width:100%;display:block}

.actions{
  margin-top:14px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  color:var(--muted);
}
.digg{display:flex;align-items:center;gap:10px;border:1px solid transparent;border-radius:999px;padding:6px 2px;background:transparent}
.digg.small{padding:4px 6px}
.vbtn{
  border:0;background:transparent;cursor:pointer;padding:4px;border-radius:10px;
  display:grid;place-items:center;
}
.vbtn svg{width:22px;height:22px;fill:var(--muted)}
.vbtn.on{background:#111}
.vbtn.on svg{fill:#fff}
.count{font-weight:800;color:var(--text);font-size:14px;min-width:24px;text-align:center}

.abtn{
  display:inline-flex;align-items:center;gap:6px;
  border:1px solid transparent;background:transparent;color:var(--muted);
  padding:6px 8px;border-radius:12px;cursor:pointer;
}
.abtn svg{width:22px;height:22px;fill:var(--muted)}
.abtn.on svg{fill:#111}
.abtn.on{color:#111}

.bottomnav{
  position:fixed;left:0;right:0;bottom: var(--vv-bottom);
  height:56px;
  background:rgba(255,255,255,.98);
  border-top:1px solid #eceef2;
  backdrop-filter:saturate(180%) blur(14px);
  display:flex;justify-content:space-around;align-items:center;
  padding:8px 10px calc(10px + env(safe-area-inset-bottom) + var(--vv-bottom));
  /* Keep the bottom nav above content, but below modal sheets */
  z-index:80;
  transform: translateZ(0);
}
.bn-item{
  position:relative;
  width:20%;
  display:flex;flex-direction:column;align-items:center;gap:5px;
  font-size:11px;color:var(--muted);
}
.bn-item svg{width:20px;height:20px;fill:var(--muted)}
.bn-item.active{color:#111}
.bn-item.active svg{fill:#111}
.badge{
  position:absolute;top:-2px;right:18px;
  background:#111;color:#fff;border-radius:999px;
  padding:2px 6px;font-style:normal;font-size:10px;font-weight:800;
}

.form{display:flex;flex-direction:column;gap:10px}
.check{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:700;color:#222;user-select:none;margin:2px 0 2px}
.check input{width:18px;height:18px;accent-color:#111}
.input,textarea,select{
  width:100%;
  padding:12px 12px;
  border-radius:14px;border:1px solid var(--border);
  font-size:15px;background:#fff;
}
textarea{min-height:120px;resize:vertical}
.btn{
  padding:12px 14px;border-radius:14px;border:1px solid #111;background:#111;color:#fff;
  font-weight:800;font-size:15px;cursor:pointer;
}
.btn:disabled{opacity:.4;cursor:not-allowed}
.load-more{display:block;width:100%;margin:12px 0}
.infinite-sentinel{height:1px}
.btn.alt{background:#fff;color:#111;border-color:var(--border)}
.btn.danger{background:#b42318;border-color:#b42318;color:#fff}
.row{display:flex;gap:10px}
.row > *{flex:1}

.kicker{color:var(--muted);font-weight:800;font-size:12px;letter-spacing:.02em;text-transform:uppercase}
.h1{margin:2px 0 12px;font-size:20px}
.small{font-size:13px;color:var(--muted)}

.list{display:flex;flex-direction:column;gap:10px}
.item{display:flex;gap:12px;align-items:flex-start}
.avatar{
  width:44px;height:44px;border-radius:14px;border:1px solid var(--border);
  overflow:hidden;background:#fff;flex:0 0 auto;
}
.avatar img{width:100%;height:100%;object-fit:cover}
.avatar.sm{width:34px;height:34px;border-radius:12px}
.item-main{flex:1;min-width:0}
.item-title{font-weight:900}
.item-sub{color:var(--muted);font-size:13px;margin-top:2px}
.tag{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;border:1px solid var(--border);font-size:12px;color:var(--muted);font-weight:800}
.opbadge{font-size:11px;font-weight:900;padding:2px 6px;border-radius:999px;background:#111;color:#fff}

.comment{
  position:relative;
  margin-top:14px;
  padding:10px 0 0;
  background:transparent;
}
/* threaded indent + guide line */
.comment{ padding-left: calc(var(--d,0) * 18px); }
.comment.is-reply{
  margin-left:0;
}
.comment.is-reply::before{
  content:"";
  position:absolute;
  left: calc((var(--d,0) * 18px) - 10px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  opacity: .9;
}
/* reply bubble */
.comment.is-reply{
  background:#f5f6f7;
  border-radius:14px;
  padding:12px;
  padding-left: calc((var(--d,0) * 18px) + 12px);
}
.comment-head{
  display:flex;
  align-items:center;
  gap:6px;
  color:var(--muted);
  font-size:14px;
  line-height:1;
}
.comment-head .av{ flex:0 0 auto; }
.c-user{
  font-weight:900;
  color:#111;
  text-decoration:none;
}
.c-time{ margin-left:4px; font-size:13px; color:var(--muted); }
.comment-body{
  margin-top:10px;
  color:#111;
  line-height:1.45;
  font-size:16px;
}
.comment-bar{
  margin-top:12px;
  display:flex;
  align-items:center;
  gap:14px;
  color:var(--muted);
}
.c-vote{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
}
.c-vote .vbtn{
  width:28px;height:28px;
  border-radius:10px;
}
.c-vote .count{
  min-width:18px;
  text-align:center;
  font-weight:800;
  color:var(--text);
}
.c-reply{
  display:flex;
  align-items:center;
  gap:8px;
  border:0;
  background:transparent;
  color:#111;
  font-weight:800;
  padding:6px 8px;
  border-radius:10px;
}
.c-reply svg{ opacity:.7; }
.comment-bar .more{ margin-left:auto; }

/* Comment media */
.comment-media{ margin-top:10px; }
.comment-media img{ width:100%; max-width:360px; border-radius:14px; border:1px solid var(--border); display:block; }

/* Fixed bottom comment composer (post page) */
body.has-comment-composer #comments{ margin-bottom:120px; }
.comment-composer{
  position:fixed;left:0;right:0;
  bottom: calc(56px + var(--vv-bottom));
  padding:8px 12px calc(8px + env(safe-area-inset-bottom));
  background:#fff;
  border-top:1px solid #e6e8ee;
  z-index:79;
  transform: translateZ(0);
}
.comment-composer__bar{ display:flex; align-items:center; gap:10px; }
.comment-composer__input{ flex:1; position:relative; }
.cc-input{
  width:100%;
  padding:12px 16px;
  border-radius:999px;
  border:1px solid #e6e8ee;
  background:#fff;
  font-size:15px;
}
.cc-btn{
  flex:0 0 auto;
  width:40px;
  height:40px;
  border-radius:12px;
  border:1px solid #e6e8ee;
  background:#fff;
  padding:0;
  display:inline-flex;align-items:center;justify-content:center;
}
.cc-btn svg{ width:20px;height:20px; fill:#111; }
.cc-btn.on{ border-color:#111; }

/* Upload progress (comment media) */
.comment-composer__progress{
  margin-top:8px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 2px;
}
.cc-progress-track{
  flex:1;
  height:6px;
  border-radius:999px;
  background:#eef1f6;
  overflow:hidden;
}
.cc-progress-bar{
  height:100%;
  width:0%;
  background:var(--accent);
}
.cc-progress-pct{
  min-width:38px;
  text-align:right;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

/* Hide the floating compose FAB on post detail pages (it overlaps the comment bar) */
body.is-post .fab-compose{ display:none !important; }

.profile-head{display:flex;gap:12px;align-items:center}
.profile-meta{flex:1}
.profile-name{font-size:18px;font-weight:950;margin:0}
.profile-joined{margin:3px 0 0;color:var(--muted);font-size:13px}
.stats{display:flex;gap:10px;margin-top:12px}

/* =========================
   Digg-like feed (exact-ish)
   ========================= */

/* page background and spacing */
body{background:#fff}
.container{padding:64px var(--edgePad) 96px; max-width:var(--pageMax); margin:0 auto}

/* topbar: flat white */
.topbar{background:#fff; backdrop-filter:none; border-bottom:1px solid #eceef2}
/* Make header taller and let the logo fill the height with 1px top/bottom breathing room */
.topbar-inner{height:64px; padding:0 var(--edgePad)}
.topbar-left{height:100%}
.topbar-logo{
  height:calc(100% - 2px);
  width:auto;
  max-height:calc(100% - 2px);
  object-fit:contain;
  border-radius:10px;
  border:1px solid rgba(229,231,235,.9);
  background:#fff;
}
.topbar-aud{font-size:22px; font-weight:800}

/* feed item: no card, just padding + divider */
.feeditem{padding:12px var(--edgePad) 14px; border-bottom:1px solid #f0f2f5}
.feeditem:last-child{border-bottom:0}
.feeditem[data-open]{cursor:pointer}
.feeditem[data-open]:active{background:rgba(0,0,0,.03)}

.fi-head{display:flex; align-items:center; gap:10px; color:#8b9099; font-size:14px}
.fi-comm{color:#111; font-weight:800}
.fi-dot{opacity:.7}
.fi-time{color:#9aa0a6}
.fi-more{margin-left:auto; border:0; background:transparent; padding:6px; border-radius:10px; color:#9aa0a6}
.fi-more svg{width:18px;height:18px; fill:#9aa0a6}

/* repost label (Twitter-like) */
.fi-repostbar{display:flex; align-items:center; gap:8px; margin:0 0 6px; color:#9aa0a6; font-size:13px; font-weight:800}
.fi-repostbar svg{width:16px;height:16px; fill:currentColor}
.fi-repost-by{color:inherit; text-decoration:none}
.fi-repost-by:active{opacity:.8}
.fi-repost-txt{font-weight:700; opacity:.9}

.fi-body{display:block; margin-top:6px}
.fi-main{position:relative}
.fi-open{position:absolute; inset:0; z-index:1; display:block; text-decoration:none}
.fi-main > *{position:relative; z-index:2}
.fi-titlelink{color:inherit; text-decoration:none}
.fi-titlelink:active{opacity:.85}
.fi-title{margin:0; font-size:20px; line-height:1.22; font-weight:900; letter-spacing:-.01em}
.fi-text{margin:6px 0 0; color:#3b3f46; font-size:16px; line-height:1.45}

/* inline "more…" expansion for truncated text in feeds */
.fi-moretext{border:0; background:transparent; padding:0; margin-left:6px; font-weight:900; color:#111; cursor:pointer}
.fi-moretext:active{opacity:.7}
.fi-text[data-trunc="1"] .fi-text-tail[hidden]{display:none}
.fi-text.is-expanded .fi-ellipsis{display:none}
.fi-text.is-expanded .fi-text-tail{display:inline}

/* Prevent long unbroken strings from overflowing cards (e.g. iOS Safari) */
.fi-title,.fi-text,.fi-link-title,.fi-link-desc{overflow-wrap:anywhere;word-break:break-word;hyphens:auto}

/* big image like Digg */
.fi-media{margin-top:12px; border-radius:22px; overflow:hidden; background:#fff}
.fi-media img{width:100%; display:block}
.fi-media video{width:100%; display:block; max-height:70vh; background:#000}

/* multi-image grid (up to 4) */
.fi-media-grid{display:grid; gap:4px}
.fi-media-grid .fi-media-cell{position:relative; overflow:hidden}
.fi-media-grid .fi-media-cell img{width:100%; height:100%; object-fit:cover; display:block}
.fi-media-grid .fi-media-cell video{width:100%; height:100%; object-fit:cover; display:block; background:#000}

/* 2 images: 2 columns */
.fi-media-grid-2{grid-template-columns:1fr 1fr; aspect-ratio: 1 / 1}

/* 3 images: first spans left, two stacked on right */
.fi-media-grid-3{grid-template-columns:2fr 1fr; grid-template-rows:1fr 1fr; aspect-ratio: 1 / 1}
.fi-media-grid-3 .fi-media-cell:nth-child(1){grid-row:1 / span 2; grid-column:1}
.fi-media-grid-3 .fi-media-cell:nth-child(2){grid-row:1; grid-column:2}
.fi-media-grid-3 .fi-media-cell:nth-child(3){grid-row:2; grid-column:2}

/* 4 images: 2x2 */
.fi-media-grid-4{grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; aspect-ratio: 1 / 1}

/* link preview style */
.fi-link{margin-top:12px; border:1px solid #eceef2; border-radius:18px; padding:12px; display:flex; gap:12px; align-items:stretch; text-decoration:none; color:inherit}
.fi-link:active{opacity:.9}
.fi-link-txt{flex:1; min-width:0}
.fi-domain{font-size:12px; color:#8b9099; font-weight:800; text-transform:lowercase}
.fi-link-title{margin-top:4px; font-size:16px; font-weight:900; line-height:1.2; display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.fi-link-desc{margin-top:4px; color:#8b9099; font-size:14px; line-height:1.25; display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.fi-link-url{display:inline-block; margin-top:8px; font-size:13px; font-weight:800; color:#1d4ed8; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%}
.fi-thumb{width:72px; height:72px; border-radius:16px; overflow:hidden; background:#f6f7f9; display:grid; place-items:center; flex:0 0 auto}
.fi-thumb img{width:100%; height:100%; object-fit:cover}
.fi-thumb svg{width:18px;height:18px; fill:#9aa0a6}

/* actions row like Digg */
.fi-actions{margin-top:10px; display:flex; align-items:center; gap:14px; color:#9aa0a6}
.fi-votes{display:flex; align-items:center; gap:10px}
.fi-ibtn{border:0; background:transparent; padding:6px; border-radius:12px; display:inline-flex; align-items:center; gap:6px; color:#9aa0a6; cursor:pointer}
.fi-ibtn svg{width:18px;height:18px; fill:currentColor}
.fi-ibtn.on svg{fill:currentColor}
/* Active state: highlight vote/save icons */
.fi-ibtn.on{color:var(--accent)}
.fi-count{font-weight:800; color:#111; font-size:14px; min-width:18px; text-align:center}
.fi-num{font-weight:800; color:#111; font-size:14px}
.fi-spacer{flex:1}

/* bottom nav: match lighter digg */
.bottomnav{background:#fff; backdrop-filter:none; border-top:1px solid #eceef2}
.bn-item{font-size:11px}

/* floating compose button (blue pencil) */
.fab{
  position:fixed;
  right:16px;
  bottom: calc(86px + var(--vv-bottom));
  width:54px;
  height:54px;
  border-radius:18px;
  border:0;
  background:#1e6fff;
  box-shadow:0 10px 25px rgba(0,0,0,.18);
  display:grid;
  place-items:center;
  z-index:70;
}
.fab svg{width:22px;height:22px; fill:#fff}

/* empty state */
.empty-state{padding:22px 16px; color:#6b7280; font-size:14px}
.empty-state .illus{width:42px;height:42px; border-radius:14px; background:#f6f7f9; display:grid; place-items:center; margin-bottom:10px}
.empty-state .illus svg{width:18px;height:18px; fill:#9aa0a6}

/* --- Digg-like polish (feed) --- */
body{background:#fff}
:root{
  --bg:#fff;
  --card:#fff;
  --border:#eef0f3;
  --radius:18px;
}

.topbar{background:rgba(255,255,255,.96)}
/* Feed width: match Digg feel (wide list, minimal outer gutter).
   Safe-area handled here; inner items use their own padding. */
.container{
  padding:76px 0 98px;
  padding-left:env(safe-area-inset-left);
  padding-right:env(safe-area-inset-right);
}

.seg{display:flex;gap:10px;margin:12px 16px 16px;}
.seg-btn{
  flex:1;
  text-align:center;
  padding:12px 12px;
  border-radius:999px;
  border:1px solid transparent;
  background:#e9edf2;
  font-weight:800;
  font-size:14px;
  color:#111;
}
.seg-btn.active{
  background:#111;
  color:#fff;
}

.card{
  border:1px solid #eceef2;
  box-shadow:none;
  border-radius:18px;
  margin:12px 16px;
}
.post{padding:16px}
.post-title{font-size:22px;line-height:1.12;margin:0 0 10px;font-weight:900}
.post-excerpt{color:var(--muted);font-size:15px;line-height:1.45;-webkit-line-clamp:4}

.preview{background:#fff;border-radius:18px;padding:12px;border-color:#eceef2}
.preview-title{font-size:16px;line-height:1.2}
.preview-desc{margin-top:6px;color:#6b7280;font-size:13px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.preview-img{width:86px;height:86px;border-radius:16px;border-color:#eceef2}

.media{border:0;border-radius:20px;overflow:hidden;background:#f3f4f6}
.media img{border-radius:20px}

.actions{color:#9aa0a6}
.digg{border-color:#eef0f3;background:#fff}
.abtn{color:#9aa0a6}

/* Digg action row (no pill) */
.digg{border:0;background:transparent;padding:0;gap:10px}
.vbtn{padding:2px}
.vbtn svg{width:18px;height:18px}
.vbtn.on{background:transparent}
.vbtn.on svg{fill:#111}
.count{font-size:14px}

/* Bottom nav closer to Digg */
.bottomnav{background:rgba(255,255,255,.98)}
.bn-item{font-size:11px}

/* Floating compose button */
.fab{
  position:fixed;
  right:16px;
  bottom: calc(86px + var(--vv-bottom));
  width:52px;height:52px;
  border-radius:999px;
  background:#1e74ff;
  display:grid;place-items:center;
  box-shadow:0 12px 28px rgba(0,0,0,.18);
  z-index:70;
}
.fab svg{width:22px;height:22px;fill:#fff}
.stat{flex:1;border:1px solid var(--border);border-radius:14px;padding:10px;background:#fff}
.stat .n{font-weight:950;font-size:18px}

/* Prevent long unbroken strings (e.g., text without spaces) from overflowing cards on mobile */
.post-title,
.post-excerpt,
.preview-title,
.preview-desc,
.comment-body,
.profile-name,
.profile-joined{
  overflow-wrap:anywhere;
  word-break:break-word;
}
.stat .l{color:var(--muted);font-size:12px;font-weight:800}

.tabs{display:flex;gap:8px;margin-top:12px}
.tab{flex:1;text-align:center;padding:10px;border-radius:999px;border:1px solid var(--border);font-weight:900;font-size:13px;color:#111;background:transparent}
.tab.active{background:#111;color:#fff;border-color:#111}

/* Layout/spacing fixes (mobile) */
.row{display:flex;gap:10px;flex-wrap:wrap}
.row > *{flex:0 0 auto}

.card{
  background:#fff !important;
  border:1px solid var(--border) !important;
  border-radius:18px !important;
  padding:14px !important;
}

/* Feed list uses .feeditem (not cards) – keep it clean */
.feeditem{background:transparent}

/* Communities list: keep right-side actions aligned and not floating */
.item-actions{display:flex;flex-direction:column;gap:8px;align-items:stretch;min-width:110px}
.item-actions .btn{width:100%}
.item-actions form{margin:0}

/* Admin: tabs should scroll horizontally instead of squishing */
.is-admin .tabs{overflow:auto;-webkit-overflow-scrolling:touch;gap:10px;padding-bottom:4px}
.is-admin .tab{flex:0 0 auto;padding:10px 14px}

/* Reduce excessive inner spacing on admin blocks */
.is-admin .card{padding:12px !important}

.empty{
  text-align:center;padding:28px 16px;color:var(--muted);
}
.empty .illus{
  width:74px;height:74px;border-radius:24px;border:1px dashed var(--border);
  margin:0 auto 10px;display:grid;place-items:center;background:#fff;
}
.empty .illus svg{width:28px;height:28px;fill:var(--muted)}

/* Composer screen (Digg-like) */
.composer-body{
  background:#fff;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(56px + env(safe-area-inset-bottom) + var(--vv-bottom));
}
.composer-wrap{min-height:100vh}
.composer-top{
  position:sticky;top:0;z-index:70;
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;
  background:#fff;
}
.composer-cancel{color:#6b6f76;font-weight:700}
.composer-postbtn{
  border:0;
  padding:10px 16px;
  border-radius:999px;
  font-weight:800;
  background:#e9eaee;
  color:#9aa0a6;
}
.composer-postbtn:not([disabled]){background:#111;color:#fff}

.composer-main{padding:6px 16px 0}
.composer-audience{display:flex;gap:12px;align-items:center;padding-top:6px}
.composer-audience-icon{
  width:34px;height:34px;border-radius:999px;
  background:#eef2f7;
  box-shadow:0 1px 0 rgba(0,0,0,.06);
  border:1px solid #e7eaf2;
  position:relative;
  overflow:hidden;
}
.composer-audience-icon:after{display:none}
.composer-audience-avatar{width:100%;height:100%;display:block;object-fit:cover}
.composer-audience-pill{
  flex:1;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  border:1px solid #eceef2;
  border-radius:999px;
  padding:10px 12px;
}
.composer-select{
  appearance:none;
  border:0;outline:0;
  width:100%;
  font-size:16px;
  background:transparent;
  color:#6b6f76;
}
.composer-chevron{color:#6b6f76;font-size:14px}

.composer-titlewrap{padding-top:18px}
.composer-title{
  width:100%;
  border:0;outline:0;
  font-size:26px;
  line-height:1.12;
  font-weight:800;
  padding:0;
  background:transparent;
}
.composer-title::placeholder{color:#c7cbd3}
.composer-subhint{margin-top:8px;color:#c7cbd3;font-size:14px;font-weight:700}

.composer-bodytext{
  margin-top:22px;
  width:100%;
  border:0;outline:0;
  resize:none;
  font-size:17px;
  line-height:1.4;
  min-height:44px;
  max-height:45vh;
  overflow:auto;
  background:transparent;
}

.composer-bodytext::placeholder{color:#c7cbd3;opacity:1}

.composer-url-input{display:none;width:100%;border:1px solid #eceef2;border-radius:12px;padding:12px;font-size:16px;margin-top:12px}
/* Keep file input in DOM (iOS Safari may block .click() if display:none). */
.composer-file-input{position:absolute;left:-9999px;width:1px;height:1px;opacity:0;pointer-events:none}

.composer-toolbar{
  position:fixed;left:0;right:0;bottom: var(--vv-bottom);z-index:80;
  height:56px;
  display:flex;align-items:center;gap:10px;
  padding:0 14px;
  background:#fff;
  border-top:1px solid #eceef2;
  padding-bottom: env(safe-area-inset-bottom);
}
.ctool{width:40px;height:40px;border-radius:12px;border:0;background:transparent;display:grid;place-items:center;cursor:pointer}
.ctool svg{width:22px;height:22px;fill:#6b6f76}
.ctool:active{background:#f2f3f6}
.ctool-spacer{flex:1}

.preview-desc{color:#6b6f76;font-size:14px;line-height:1.25;margin-top:6px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.composer-preview{margin:16px 0 0; padding:12px 0 0; border-top:1px solid #eceef2;}
.composer-preview-head{display:flex;align-items:center;justify-content:space-between;margin:0 0 10px;}
.composer-preview-title{font-weight:800;color:#6b6f76;font-size:13px;letter-spacing:.02em;text-transform:uppercase;}
.composer-preview-toggle{border:0;background:transparent;color:#6b6f76;font-weight:800;font-size:13px;padding:6px 10px;border-radius:10px;cursor:pointer;}
.composer-preview-toggle:active{background:#f2f3f6;}

/* composer preview: compact (mini) mode */
.composer-preview-actions{display:flex;align-items:center;gap:8px;}
.composer-preview.is-mini .feeditem-preview{padding:10px;border-radius:16px;max-height:118px;overflow:hidden;position:relative;}
.composer-preview.is-mini .feeditem-preview:after{content:"";position:absolute;left:0;right:0;bottom:0;height:24px;background:linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));pointer-events:none;}
.composer-preview.is-mini .fi-head{font-size:12px;gap:8px;}
.composer-preview.is-mini .av-sm{width:18px;height:18px;}
.composer-preview.is-mini .fi-title{font-size:15px;line-height:1.2;margin-top:6px;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;}
/* In mini mode show only header + title */
.composer-preview.is-mini .fi-text{display:none !important;}
.composer-preview.is-mini .fi-media{display:none !important;}
.composer-preview.is-mini .fi-link{display:none !important;}
.composer-preview.is-mini .fi-moretext{display:none !important;}
.feeditem-preview{pointer-events:none;}
.feeditem-preview .fi-moretext{pointer-events:auto;}

/* --- Composer URL mini preview (Twitter-like card) --- */
.composer-urlpreview{margin:10px 0 0;}
.urlpv-card{display:flex;gap:12px;align-items:stretch;border:1px solid #eceef2;border-radius:16px;overflow:hidden;background:#fff;max-height:92px;}
.urlpv-img{width:92px;min-width:92px;background:#f4f5f8 center/cover no-repeat;}
.urlpv-meta{padding:10px 12px;display:flex;flex-direction:column;justify-content:center;min-width:0;}
.urlpv-title{font-weight:800;color:#121316;font-size:14px;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.urlpv-desc{margin-top:4px;color:#5b6068;font-size:12.5px;line-height:1.25;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
.urlpv-site{margin-top:6px;color:#7a808a;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* Compose: keep preview visible above the bottom toolbar / keyboard */
.composer-body .composer-urlpreview{position:sticky;bottom:calc(var(--bn-h) + 14px + env(safe-area-inset-bottom));z-index:6;}

/* Loading skeleton (used while fetching preview) */
#urlPreview.is-loading .urlpv-site,
#urlPreview.is-loading .urlpv-title,
#urlPreview.is-loading .urlpv-desc,
#urlPreviewEdit.is-loading .urlpv-site,
#urlPreviewEdit.is-loading .urlpv-title,
#urlPreviewEdit.is-loading .urlpv-desc{color:transparent !important;}
#urlPreview.is-loading .urlpv-site,
#urlPreview.is-loading .urlpv-title,
#urlPreview.is-loading .urlpv-desc,
#urlPreviewEdit.is-loading .urlpv-site,
#urlPreviewEdit.is-loading .urlpv-title,
#urlPreviewEdit.is-loading .urlpv-desc{background-image:linear-gradient(90deg,rgba(0,0,0,.06),rgba(0,0,0,.14),rgba(0,0,0,.06));background-size:200% 100%;border-radius:8px;animation:urlpvShimmer 1.2s linear infinite;}
#urlPreview.is-loading .urlpv-site,
#urlPreviewEdit.is-loading .urlpv-site{height:12px;width:42%;}
#urlPreview.is-loading .urlpv-title,
#urlPreviewEdit.is-loading .urlpv-title{height:16px;width:72%;margin-top:8px;}
#urlPreview.is-loading .urlpv-desc,
#urlPreviewEdit.is-loading .urlpv-desc{height:12px;width:92%;margin-top:10px;}
#urlPreview.is-loading .urlpv-desc::after,
#urlPreviewEdit.is-loading .urlpv-desc::after{content:'';display:block;height:12px;width:78%;margin-top:8px;background-image:linear-gradient(90deg,rgba(0,0,0,.06),rgba(0,0,0,.14),rgba(0,0,0,.06));background-size:200% 100%;border-radius:8px;animation:urlpvShimmer 1.2s linear infinite;}
@keyframes urlpvShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}

/* ==========================================================
   Digg-like Bottom Navigation + Blue Compose FAB (FINAL)
   ========================================================== */
:root{
  --bn-h: 64px;
}
/* Reserve space so content never sits under bottom nav */
body{ padding-bottom: calc(var(--bn-h) + env(safe-area-inset-bottom) + var(--nav-shift, 0px)) !important; }
.container{ padding-bottom: calc(var(--bn-h) + 18px + env(safe-area-inset-bottom) + var(--nav-shift, 0px)) !important; }
.bottomnav{
  position: fixed !important;
  left: 0; right: 0;
  bottom: var(--nav-shift, 0px) !important;
  height: var(--bn-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.98);
  border-top: 1px solid #eceef2;
  z-index: 2147483647 !important;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}
.bn-item{
  position: relative;
  text-decoration: none;
  color: #9aa0a6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 8px;
  -webkit-tap-highlight-color: transparent;
}
.bn-ico svg{ width: 22px; height: 22px; display:block; fill: currentColor; }
.bn-label{ font-size: 11px; line-height: 1; font-weight: 600; }
.bn-item.is-active{ color:#111; }

.bn-badge{
  position:absolute;
  top: 6px;
  right: 26%;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background:#111;
  color:#fff;
  font-size: 11px;
  line-height: 18px;
  font-weight: 700;
  text-align:center;
}

.bn-dot{
  position:absolute;
  top: 10px;
  right: 32%;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background:#1f6fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,.98);
}

/* Center compose button inside bottom nav (optional). */
.bn-compose{ gap: 6px; }
.bn-compose .bn-compose-btn{
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background:#1f6fff;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
  transform: translateY(-10px);
}
.bn-compose .bn-compose-btn svg{ width: 22px; height: 22px; fill:#fff; }
.bn-compose .bn-label{ margin-top:-8px; }
.bn-compose:active .bn-compose-btn{ opacity:.9; }

/* Blue pencil compose button (like Digg) */
.fab-compose{
  position: fixed;
  right: 16px;
  bottom: calc(var(--bn-h) + 12px + env(safe-area-inset-bottom) + var(--nav-shift, 0px));
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: #1f6fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483647;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
  text-decoration: none;
  transform: translate3d(0, 0, 0);
}
.fab-compose svg{ width: 24px; height: 24px; fill: #fff; }
.fab-compose:active{ opacity:.85; }

/* Keep FAB hidden on composer screen (uses composer-body on <body>) */
.composer-body .fab-compose{ display:none !important; }
.is-admin .fab-compose{ display:none !important; }

/* =========================
   FINAL bottom-nav + FAB alignment (iOS Safari safe)
   Ensures bar is NOT too high and icons are centered.
   ========================= */

:root{
  --bn-h:56px;          /* visible bar height (without safe-area) */
  --bn-pad-top:8px;
  --bn-pad-bot:10px;
  --bn-gap:12px;        /* gap from nav to FAB */
}

/* Bottom nav: fixed to nav-shift only (no double padding). */
.bottomnav{
  bottom: var(--nav-shift, 0px) !important;
  height: calc(var(--bn-h) + env(safe-area-inset-bottom)) !important;
  padding: var(--bn-pad-top) 10px calc(var(--bn-pad-bot) + env(safe-area-inset-bottom)) !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:0 !important;
}

/* Each icon slot centers perfectly */
.bn-item{
  flex:1 1 0 !important;
  width:auto !important;
  min-width:0 !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:center !important;
  gap:4px !important;
  line-height:1 !important;
}

/* Badge: keep it close to the icon, not drifting with flex */
.bn-item .badge{
  right: 28% !important;
}

/* Container bottom padding matches the bar height (prevents overlap) */
.container{
  padding-bottom: calc(var(--bn-h) + env(safe-area-inset-bottom) + 18px) !important;
}

/* FAB: always sits just above the bar (like the reference photo) */
.fab, .fab-compose{
  bottom: calc(var(--bn-h) + env(safe-area-inset-bottom) + var(--nav-shift, 0px) + var(--bn-gap)) !important;
  right: 16px !important;
}
.is-admin .bottomnav{ display:none !important; }


/* Avatars */
.av{border-radius:999px; object-fit:cover; background:#e9ecf1; flex:0 0 auto; display:inline-block}
.av-sm{width:20px; height:20px}
.av-xs{width:18px; height:18px}
.av-lg{width:44px; height:44px}
.fi-head{gap:8px}
.fi-user{color:#8b9099; font-weight:600; text-decoration:none}
.comment-head{display:flex; align-items:center; gap:8px}

/* =========================
   Action sheet (three dots)
   ========================= */
.sheet-overlay{
  position:fixed; inset:0;
  background:rgba(0,0,0,.25);
  /* Must sit above bottom nav + FAB */
  z-index:10000;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  /*
    Respect iOS safe-area + visual viewport bottom (keyboard / browser chrome)
    AND keep the sheet above the fixed bottom navigation.
    Otherwise the sheet can appear "too low" / overlap the bottom bar on mobile.
  */
  padding:16px 16px calc(16px + env(safe-area-inset-bottom) + var(--vv-bottom) + var(--bn-h) + var(--nav-shift, 0px));
}
.sheet{
  position:relative;
  z-index:10001;
  width:min(520px, 100%);
  background:#fff;
  border-radius:18px;
  border:1px solid var(--border);
  box-shadow:0 18px 50px rgba(0,0,0,.22);
  overflow:hidden;
  /* keep the sheet fully usable on short viewports */
  max-height:calc(100vh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--vv-bottom));
  display:flex;
  flex-direction:column;
}

/* When a sheet is open, hide FAB so it can't overlap the actions */
body.sheet-open .fab,
body.sheet-open .fab-compose{ display:none !important; }

/* =========================
   Post detail top bar
   ========================= */
.post-detail-topbar{
  position:sticky;
  top:0;
  z-index:60;
  display:flex;
  align-items:center;
  gap:10px;
  padding:calc(10px + env(safe-area-inset-top)) 12px 10px;
  background:#fff;
  border-bottom:1px solid var(--border);
}
.post-back{
  border:0;
  background:transparent;
  font-weight:900;
  font-size:20px;
  padding:6px 10px;
  border-radius:12px;
}
.post-back:active{ background:rgba(0,0,0,.06); }
.post-detail-title{ font-weight:900; }

/* =========================
   Lightbox (post detail)
   ========================= */
.lb{
  position:fixed; inset:0;
  z-index:11000;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.lb[hidden]{ display:none !important; }
.lb-backdrop{
  position:absolute; inset:0;
  background:rgba(0,0,0,.72);
}
.lb-panel{
  position:relative;
  width:min(980px, 100%);
  max-height:calc(100vh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display:flex;
  flex-direction:column;
}
.lb-top{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 10px 12px;
  color:#fff;
  font-weight:900;
}
.lb-close{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.35);
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
}
.lb-download{
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.35);
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  text-decoration:none;
}
.lb-body{
  flex:1 1 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  gap:10px;
}
.lb-stage{
  flex:1 1 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:0;
}
.lb-media{
  max-width:100%;
  max-height:calc(100vh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  width:auto;
  height:auto;
  border-radius:14px;
  box-shadow:0 18px 60px rgba(0,0,0,.55);
}

.lb-nav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:44px;
  height:44px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.35);
  background:rgba(0,0,0,.35);
  color:#fff;
  font-size:28px;
  line-height:42px;
  text-align:center;
  cursor:pointer;
  user-select:none;
}
.lb-prev{ left:8px; }
.lb-next{ right:8px; }

@media (max-width: 520px){
  .lb-nav{ width:40px; height:40px; font-size:26px; line-height:38px; }
}

/* Prevent background scroll when lightbox open */
body.lb-open{ overflow:hidden; }

.is-post .js-lightbox-media{ cursor:zoom-in; }
.sheet-title{padding:14px 16px; font-weight:900; border-bottom:1px solid var(--border)}
.sheet-actions{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.sheet-btn,
.sheet-cancel{
  width:100%;
  border:0;
  background:#fff;
  padding:14px 16px;
  font-weight:900;
  text-align:left;
}
.sheet-btn{border-bottom:1px solid var(--border)}
.sheet-btn.danger{color:#b00020}
.sheet-cancel{background:#f5f6f7}

/* =====================================
   Comments – match the reference layout
   ===================================== */
#comments.card{
  background:transparent;
  border:0;
  box-shadow:none;
  padding:0;
}
#comments .row,
#comments .form{padding:0 16px}
#comments .empty{margin:10px 16px}

/* Post page: make comment list as wide as post content */
body.is-post #comments .row{padding-left:8px;padding-right:8px}
body.is-post #comments .empty{margin-left:8px;margin-right:8px}

.comment{
  margin:0;
  padding:14px 16px;
  border-top:1px solid #f0f2f5;
}
.comment:first-of-type{border-top:0}

/* indent for replies */
.comment{ padding-left: calc(16px + (var(--d,0) * 18px)); }

/* vertical thread line */
.comment.is-reply::before{
  left: calc(16px + (var(--d,0) * 18px) - 10px);
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: #e9ecf1;
  opacity: 1;
}

/* reply bubble */
.comment.is-reply{
  background:#f5f6f7;
  border-radius:16px;
  border-top:0;
  margin:10px 16px 0;
  padding:12px;
  padding-left: calc(12px + (var(--d,0) * 18px));
}

.comment-head{color:#8b9099; font-size:13px}
.c-user{font-weight:900}
.c-time{color:#9aa0a6; font-size:14px}

.comment-body{margin-top:8px; font-size:15px; line-height:1.45}

/* comment attachment: smaller like the reference */
.comment-media{ margin-top:10px; max-width:360px; }
.comment-media img{ width:100%; max-width:360px; border-radius:14px; border:1px solid var(--border); display:block; }

.comment-bar{
  margin-top:10px;
  display:flex;
  align-items:center;
  gap:14px;
  color:#9aa0a6;
}
.c-vote{gap:12px}
.c-vote .vbtn{
  width:28px;height:28px;
  border:0;
  background:transparent;
  padding:0;
}
.c-vote .vbtn svg{width:18px;height:18px; opacity:.65}
.c-vote .vbtn.on svg{opacity:1}
.c-vote .vbtn.on svg{fill:var(--accent)}
.c-vote .count{font-weight:900; color:var(--text)}

.c-reply{
  border:0;
  background:transparent;
  padding:0;
  font-weight:900;
  color:#111;
}
.c-reply svg{display:none}

.comment-bar .more{
  margin-left:auto;
  border:0;
  background:transparent;
  padding:6px;
  border-radius:10px;
  color:#9aa0a6;
}
.comment-bar .more svg{width:18px;height:18px; fill:#9aa0a6}

/* deleted comments */
.comment.is-removed .comment-body{ color:#9aa0a6; font-style:italic; }
.comment.is-removed .c-vote{ opacity:.45; }
.comment.is-removed .c-reply{ opacity:.45; }

/* Community page (Digg-like) */
.comm-hero{
  position:relative;
  height:320px;
  border-radius:32px;
  overflow:hidden;
  margin:8px 0 0;
  background-image:
    var(--comm-hero-img, none),
    radial-gradient(1200px 600px at 30% 20%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(180deg, #1f5ed6 0%, #0b2e6f 70%, #071a3a 100%);
  background-size: cover, auto, auto;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
.comm-hero:before{
  content:"";
  position:absolute; inset:0;
  background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="240" height="240" viewBox="0 0 240 240"><g fill="%23ffffff" fill-opacity="0.08"><path d="M28 70c12 0 22-10 22-22S40 26 28 26 6 36 6 48s10 22 22 22zm0-10a12 12 0 1 1 0-24 12 12 0 0 1 0 24z"/><path d="M162 42h52v52h-52z"/><path d="M72 150h70v14H72z"/><path d="M160 164h46v14h-46z"/><path d="M70 190c0-20 16-36 36-36s36 16 36 36-16 36-36 36-36-16-36-36zm36-22a22 22 0 1 0 0 44 22 22 0 0 0 0-44z"/></g></svg>');
  background-size:240px 240px;
  opacity:1;
}
.comm-back{
  position:absolute; top:18px; left:16px;
  width:42px; height:42px;
  display:grid; place-items:center;
  border-radius:999px;
  background:rgba(255,255,255,.92);
  box-shadow:0 10px 25px rgba(0,0,0,.18);
  color:#111;
}
.comm-back svg{width:22px;height:22px; fill:#111}

.comm-actions{
  position:absolute; top:18px; right:16px;
  height:42px;
  padding:0 12px;
  border:0;
  border-radius:999px;
  display:flex; align-items:center; gap:10px;
  background:rgba(255,255,255,.92);
  box-shadow:0 10px 25px rgba(0,0,0,.18);
  color:#111;
}
.comm-actions .ci svg{width:18px;height:18px; fill:#111}
.comm-actions .sep{width:1px;height:18px;background:rgba(0,0,0,.15)}

.comm-hero-title{
  position:absolute; left:50%; bottom:84px;
  transform:translateX(-50%);
  text-align:center;
  color:#fff;
  text-shadow:0 10px 25px rgba(0,0,0,.35);
}
.comm-hero-name{font-size:34px; font-weight:900; letter-spacing:-.02em; line-height:1.05}
.comm-hero-slug{font-size:20px; font-weight:800; opacity:.92; margin-top:4px}

.comm-card{
  /* Do NOT pull the whole row into the hero (causes overlap).
     Only the community icon should overlap the hero like Digg. */
  margin-top:8px;
  padding:0 2px 8px;
  /* Critical: paint a white surface so the hero never shows through
     behind the join row / description / stats. */
  background:#fff;
  position:relative;
  z-index:2;
}
.comm-row{
  display:flex;
  align-items:center;
  gap:14px;
  padding:0 14px;
}
.comm-icon{
  width:74px; height:74px;
  border-radius:999px;
  background:#fff;
  box-shadow:0 14px 28px rgba(0,0,0,.14);
  display:grid; place-items:center;
  overflow:hidden;
  /* Icon overlaps hero, row stays on white background */
  margin-top:-34px;
}
.comm-icon img{width:100%;height:100%;object-fit:cover}
.comm-icon span{font-weight:900; font-size:28px; color:#111}

.comm-cta{flex:1; display:flex; justify-content:center;}
.comm-join{width:100%; display:flex; justify-content:center;}
.comm-join-btn{
  width:min(320px, 100%);
  height:46px;
  border-radius:999px;
  display:flex; align-items:center; justify-content:center;
  font-weight:900;
  background:#111;
  color:#fff;
  text-decoration:none;
  border:0;
}
.comm-join-btn.joined{background:#1f2937}

.comm-mini-actions{display:flex; gap:10px;}
.comm-mini{
  width:42px; height:42px;
  border-radius:999px;
  border:0;
  background:#eef0f3;
  display:grid; place-items:center;
  color:#111;
}

/* Profile page (banner + follow, Digg-ish) */
.profile-hero{
  position:relative;
  height:280px;
  border-radius:32px;
  overflow:hidden;
  margin:8px 0 0;
  background-image:
    var(--profile-hero-img, none),
    radial-gradient(1200px 600px at 30% 20%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(180deg, #1f5ed6 0%, #0b2e6f 70%, #071a3a 100%);
  background-size: cover, auto, auto;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
.profile-hero-title{
  position:absolute; left:18px; bottom:28px;
  color:#fff;
  text-shadow:0 10px 25px rgba(0,0,0,.35);
}
.profile-hero-name{font-size:34px; font-weight:900; letter-spacing:-.02em; line-height:1.05}
.profile-hero-slug{font-size:18px; font-weight:800; opacity:.92; margin-top:4px}
.profile-hero-bar{position:absolute; top:18px; left:16px; right:16px; display:flex; justify-content:space-between; align-items:center;}
.hero-back{width:42px;height:42px;border-radius:999px;display:grid;place-items:center;background:rgba(255,255,255,.92);box-shadow:0 10px 25px rgba(0,0,0,.18); color:#111; text-decoration:none}
.hero-back svg{width:22px;height:22px; fill:#111}

.profile-row{display:flex; gap:14px; align-items:center; margin-top:10px; padding:0 6px; background:#fff; position:relative; z-index:2}
.profile-icon{width:74px;height:74px;border-radius:999px;background:#fff;box-shadow:0 14px 28px rgba(0,0,0,.14);overflow:hidden;display:grid;place-items:center;margin-top:-32px}
.profile-icon img{width:100%;height:100%;object-fit:cover}
.profile-row-main{flex:1}
.profile-row-actions{display:flex; align-items:center; justify-content:flex-end}
.comm-mini svg{width:18px;height:18px; fill:#111}
.comm-mini.on{background:#111;}
.comm-mini.on svg{fill:#fff}

.comm-desc{
  padding:12px 16px 2px;
  color:#333;
  font-size:15px;
  line-height:1.35;
}

.comm-stats{
  display:flex;
  gap:22px;
  padding:14px 16px 4px;
}
.comm-stats .stat .n{font-weight:900; font-size:18px; color:var(--text)}
.comm-stats .stat .l{font-size:12px; color:var(--muted); margin-top:2px}

/* Profile v2 (matches new screenshot layout) */
.p2{max-width:680px;margin:0 auto;}
.p2-top{display:flex;align-items:center;justify-content:space-between;margin:6px 4px 10px;}
.p2-title{font-weight:800;font-size:20px;letter-spacing:-.01em;}
.p2-gear{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;border:1px solid var(--border);background:var(--card);text-decoration:none;color:inherit;}
.p2-gear svg{width:22px;height:22px;fill:currentColor;}

.p2-cover{position:relative;height:180px;border-radius:28px;overflow:hidden;margin:0 4px 10px;
  background-image: var(--p2-cover-img, none),
    radial-gradient(900px 420px at 30% 20%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(180deg, #1f5ed6 0%, #0b2e6f 70%, #071a3a 100%);
  background-size: cover, auto, auto;
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
.p2-back{position:absolute;top:14px;left:14px;width:42px;height:42px;border-radius:999px;display:grid;place-items:center;background:rgba(255,255,255,.92);box-shadow:0 10px 25px rgba(0,0,0,.18); color:#111; text-decoration:none}
.p2-back svg{width:22px;height:22px; fill:#111}
.p2-cover-name{position:absolute;left:18px;bottom:38px;color:#fff;font-size:28px;font-weight:900;text-shadow:0 10px 25px rgba(0,0,0,.35)}
.p2-cover-handle{position:absolute;left:18px;bottom:18px;color:#fff;font-size:16px;font-weight:800;opacity:.92;text-shadow:0 10px 25px rgba(0,0,0,.35)}

.p2-head{display:flex;gap:14px;align-items:flex-start;padding:10px 6px 0;}
.p2-av{width:72px;height:72px;border-radius:999px;object-fit:cover;border:2px solid #fff;background:#fff;box-shadow:0 12px 26px rgba(0,0,0,.12)}
:root[data-theme="dark"] .p2-av{border-color:rgba(255,255,255,.08);background:var(--card)}
.p2-meta{flex:1;min-width:0;}
.p2-handle{font-weight:800;color:var(--muted);display:flex;align-items:center;gap:6px;}
.p2-hbadges{display:flex;gap:6px;flex-wrap:wrap;align-items:center;min-width:0;}
.p2-hbadges .hb{font-size:11px;line-height:1;border:1px solid var(--border);background:var(--card);padding:6px 8px;border-radius:999px;color:var(--muted);font-weight:800;white-space:nowrap;}
.p2-chev{color:var(--muted);font-weight:900;}
.p2-stats{display:flex;flex-wrap:wrap;gap:16px;margin-top:10px;}
.p2-stat{border:0;background:transparent;border-radius:0;padding:2px 0;box-shadow:none;text-align:center;min-width:0;}
.p2-stat .n{font-weight:900;font-size:14px;line-height:1;}
.p2-stat .l{font-size:11px;color:var(--muted);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

@media (max-width: 380px){
  .p2-stats{gap:12px;}
  .p2-stat{padding:1px 0;border-radius:0;}
  .p2-stat .n{font-size:13px;}
  .p2-stat .l{font-size:10px;}
}
.p2-joined{margin-top:10px;color:var(--muted);font-size:13px;}
.p2-joined-inline{color:var(--muted);font-size:13px;font-weight:500;margin-left:6px;}

.p2-bio{margin-top:10px;color:var(--text);font-size:15px;line-height:1.5;white-space:pre-wrap;}

.p2-pins{padding:10px 6px 0;display:flex;flex-direction:column;gap:10px;}
.p2-pin{display:inline-flex;align-items:center;gap:10px;border:1px solid var(--border);background:var(--card);border-radius:999px;padding:10px 14px;text-decoration:none;color:inherit;width:max-content;max-width:100%;overflow:hidden;}
.p2-pin svg{width:18px;height:18px;fill:currentColor;opacity:.9;}
.p2-pin-edit{color:#2563eb;text-decoration:none;font-weight:700;width:max-content;}

.p2-edit{display:block;margin:12px 6px 0;background:#111;color:#fff;text-align:center;padding:14px 16px;border-radius:999px;text-decoration:none;font-weight:900;}

.p2-tabs-wrap{margin-top:12px;}
/* Profile tabs: keep everything on ONE horizontal row (scroll if needed) */
.p2-tabs{
  display:flex;
  gap:8px;
  flex-wrap:nowrap;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  padding:0 6px 6px;
  scrollbar-width:none; /* Firefox */
}
.p2-tabs::-webkit-scrollbar{display:none;} /* iOS/Chrome */
.p2-tabs .seg-btn{
  border-radius:14px; /* less round */
  padding:8px 10px;   /* less padding */
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.p2-tabs .seg-btn .lock svg{width:16px;height:16px;fill:currentColor;opacity:.85;}

.ucom{border:0;background:var(--card);border-radius:18px;padding:12px 14px;box-shadow:var(--shadow);margin:10px 0;}
.ucom-meta{font-size:12px;color:var(--muted);margin-bottom:8px;}
.ucom-meta a{color:inherit;text-decoration:underline;}
.ucom-body{font-size:14px;line-height:1.35;overflow-wrap:anywhere;word-break:break-word;}
.ucom-media{margin-top:10px;}
.ucom-media img{max-width:260px;width:100%;height:auto;border-radius:14px;border:0;display:block;}
.ucom-reply{margin-left:calc(var(--d) * 14px);}

/* Post detail: comments should be as wide as post content (minimal side padding) and without borders */
body.is-post #comments .ucom{position:relative;}
body.is-post #comments .ucom{margin-left:-6px;margin-right:-6px;padding:8px 10px;border:0;box-shadow:none;}

/* Post comment avatars (match overall app avatar style) */
body.is-post #comments .ucom-head{display:flex;align-items:center;gap:10px;margin-bottom:6px;}
body.is-post #comments .ucom-av{display:block;flex:0 0 auto;}
body.is-post #comments .ucom-av img{width:28px;height:28px;border-radius:999px;display:block;object-fit:cover;}
body.is-post #comments .ucom-head .ucom-meta{margin:0;}
#comments .ucom .comment-body{font-size:14px;line-height:1.35;margin-top:0;}
#comments .ucom .comment-bar{margin-top:10px;}
#comments .ucom .comment-media img{max-width:260px;}

/* Replies: slightly narrower + reddit-like thread line */
body.is-post #comments .ucom.is-reply{margin-left:12px;margin-right:-6px;background:rgba(0,0,0,.02);}
body.is-post #comments .ucom.is-reply:before{
  content:"";
  position:absolute;
  left:-8px;
  top:10px;
  bottom:10px;
  width:2px;
  background:rgba(0,0,0,.10);
  border-radius:2px;
}

/* Collapse button */
#comments .comment-bar .c-collapse{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:12px;
  color:var(--muted);
  background:transparent;
  border:0;
  padding:6px 6px;
}
#comments .comment-bar .c-collapse .ccaret{
  width:10px;height:10px;display:inline-block;
  border-right:2px solid rgba(0,0,0,.35);
  border-bottom:2px solid rgba(0,0,0,.35);
  transform:rotate(-45deg);
  margin-top:1px;
}
#comments .comment-bar .c-collapse[aria-expanded="false"] .ccaret{transform:rotate(45deg);}

/* Hidden replies */
#comments .ucom.is-hidden{display:none;}

/* Swipe-to-reply feedback */
#comments .ucom.swipe-reply{background:rgba(0,0,0,.04);}


/* ===== FINAL: bigger site logo in top header ===== */
:root{ --topbar-h:64px; }
.topbar-inner{ height:var(--topbar-h); padding:0 16px; }
.topbar-left{ height:100%; }
.topbar-logo{
  /* keep a tiny breathing room (3px top + 3px bottom) */
  height:calc(100% - 6px);
  width:auto;
  max-height:calc(100% - 6px);
  max-width:220px;
  object-fit:contain;
  border:0 !important;
  background:transparent !important;
  border-radius:0 !important;
}
/* keep existing side/bottom paddings, only sync top with header height */
.container{ padding-top: calc(var(--topbar-h) + 12px) !important; }


/* Dark mode */
:root[data-theme="dark"] {
  --bg: #0b0c10;
  --card: #12141a;
  --text: #e7e9ee;
  --muted: #a8afbf;
  --border: rgba(255,255,255,.10);
  --chip: rgba(255,255,255,.08);
  --shadow: 0 12px 30px rgba(0,0,0,.35);
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--text); }

:root[data-theme="dark"] .actions{color:rgba(231,233,238,.78)}
:root[data-theme="dark"] .vbtn svg{fill:rgba(231,233,238,.82)}
:root[data-theme="dark"] .abtn svg{fill:rgba(231,233,238,.72)}
:root[data-theme="dark"] .count{color:rgba(231,233,238,.92)}
:root[data-theme="dark"] .post-meta{color:rgba(231,233,238,.70)}
:root[data-theme="dark"] .meta-comm{color:rgba(231,233,238,.92)}
:root[data-theme="dark"] .dot{color:rgba(231,233,238,.35)}
:root[data-theme="dark"] .post-excerpt{color:rgba(231,233,238,.66)}
:root[data-theme="dark"] .topbar { background: rgba(18,20,26,.92); border-bottom-color: rgba(255,255,255,.08); }
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .post-card,
:root[data-theme="dark"] .sheet { background: var(--card); border-color: rgba(255,255,255,.10); }
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.10); color: var(--text); }

/* Link preview card in dark mode */
:root[data-theme="dark"] .urlpv-card{border-color:rgba(255,255,255,.10);background:rgba(255,255,255,.04)}
:root[data-theme="dark"] .urlpv-title{color:rgba(231,233,238,.98)}
:root[data-theme="dark"] .urlpv-desc{color:rgba(231,233,238,.70)}
:root[data-theme="dark"] .urlpv-site{color:rgba(231,233,238,.65)}

/* Dark-mode skeleton shimmer */
:root[data-theme="dark"] #urlPreview.is-loading .urlpv-site,
:root[data-theme="dark"] #urlPreview.is-loading .urlpv-title,
:root[data-theme="dark"] #urlPreview.is-loading .urlpv-desc{background-image:linear-gradient(90deg,rgba(255,255,255,.06),rgba(255,255,255,.14),rgba(255,255,255,.06));}
:root[data-theme="dark"] #urlPreview.is-loading .urlpv-desc::after{background-image:linear-gradient(90deg,rgba(255,255,255,.06),rgba(255,255,255,.14),rgba(255,255,255,.06));}

/* Profile tabs + activity */
.profile-tabs {
  display:flex;
  gap:8px;
  margin:12px 0 6px;
  flex-wrap:nowrap;
  overflow-x:auto;
  -webkit-overflow-scrolling: touch;
}
.profile-tabs::-webkit-scrollbar{ display:none; }
.profile-tabs .seg-btn {
  flex:0 0 auto;
  text-align:center;
  padding:8px 10px;
  font-size:12px;
  white-space:nowrap;
}
.profile-feed { min-height:120px; }
.profile-feed .feed-empty { padding:14px 6px; color: var(--muted); }
.activity-item { border:1px solid var(--border); background: var(--card); border-radius:18px; padding:12px 14px; box-shadow: var(--shadow); margin:10px 0; }
.activity-meta { font-size:12px; color: var(--muted); margin-bottom:6px; }
.activity-body a { color: inherit; text-decoration: underline; }

/* Theme button */
.iconbtn.theme-btn{width:42px;height:42px;border-radius:999px;background:rgba(0,0,0,.04);border:1px solid var(--border)}

/* Achievements */
.ach-wrap{padding:10px 6px 24px; display:flex; flex-direction:column; gap:10px;}
.ach-card{display:flex; gap:12px; align-items:flex-start; border:1px solid var(--border); background:var(--card); border-radius:18px; padding:12px; box-shadow:var(--shadow);}
.ach-ic{width:44px;height:44px;border-radius:14px; display:grid; place-items:center; font-size:22px; background:rgba(0,0,0,.04);}
:root[data-theme="dark"] .ach-ic{background:rgba(255,255,255,.06)}
.ach-main{flex:1; min-width:0;}
.ach-title{font-weight:900; letter-spacing:-.01em;}
.ach-desc{color:var(--muted); font-size:13px; margin-top:3px;}
.ach-meta{margin-top:8px; font-size:12px; color:var(--muted);}
.ach-bar{margin-top:6px; height:8px; border-radius:999px; background:rgba(0,0,0,.08); overflow:hidden;}
:root[data-theme="dark"] .ach-bar{background:rgba(255,255,255,.10)}
.ach-bar span{display:block; height:100%; background:#111;}
:root[data-theme="dark"] .ach-bar span{background:#fff;}
.ach-card.unlocked .ach-bar{display:none;}
.ach-card.locked{opacity:.95;}

/* --- Communities Discover (Digg-style) --- */
.communities-page .page-head h1{margin:8px 0 10px;font-size:22px;letter-spacing:-.02em}
.seg-tabs{display:flex;gap:10px;align-items:center;margin:10px 0 14px}
.seg-tabs .seg{flex:1;display:flex;align-items:center;justify-content:center;height:44px;border-radius:999px;border:1px solid #e6e6e6;background:#f2f2f4;color:#111;font-weight:700;text-decoration:none}
.seg-tabs .seg.on{background:#0b0b0f;color:#fff;border-color:#0b0b0f}
.comm-section-head{margin:18px 0 10px}
.comm-section-head .h2row{display:flex;align-items:center;justify-content:space-between}
.comm-section-head h2{margin:0;font-size:18px;letter-spacing:-.02em}
.comm-section-head .chev{text-decoration:none;color:#111;font-weight:800;font-size:22px;line-height:1}

.comm-featured-row{display:flex;gap:14px;overflow-x:auto;padding:2px 2px 10px;scroll-snap-type:x mandatory}
.comm-featured-row::-webkit-scrollbar{display:none}
.comm-featured-card{position:relative;min-width:290px;max-width:290px;height:170px;border-radius:16px;overflow:hidden;background:#101015;background-size:cover;background-position:center;scroll-snap-align:start;text-decoration:none;color:#fff}
.comm-featured-overlay{position:absolute;inset:0;background:linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.65) 60%, rgba(0,0,0,.80) 100%)}
.comm-featured-top{position:relative;z-index:2;display:flex;gap:10px;align-items:center;padding:14px 14px 8px}
.comm-featured-icon{width:40px;height:40px;border-radius:12px;object-fit:cover;background:#222}
.comm-featured-icon.placeholder{display:flex;align-items:center;justify-content:center;font-weight:900}
.comm-featured-title .name{font-weight:900;font-size:18px;letter-spacing:-.02em}
.comm-featured-title .slug{opacity:.85;font-weight:700;margin-top:2px}
.comm-featured-stats{position:relative;z-index:2;display:flex;gap:14px;padding:0 14px}
.comm-featured-stats div{display:flex;flex-direction:column;gap:2px}
.comm-featured-stats b{font-size:16px;letter-spacing:-.02em}
.comm-featured-stats span{font-size:12px;opacity:.8}
.comm-featured-desc{position:relative;z-index:2;padding:10px 14px 0;font-size:13px;opacity:.9;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}


.comm-hrow{display:flex;gap:14px;overflow-x:auto;padding:2px 2px 10px;scroll-snap-type:x mandatory}
.comm-hrow::-webkit-scrollbar{display:none}
.comm-hrow > [role="listitem"]{scroll-snap-align:start;flex:0 0 auto}
.comm-hrow .comm-card{min-width:290px;max-width:290px}
@media (max-width:420px){.comm-hrow .comm-card{min-width:260px;max-width:260px}}

.comm-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media (max-width:420px){.comm-grid{grid-template-columns:1fr}}
.comm-card{display:block;border:1px solid #ececec;border-radius:16px;padding:14px;text-decoration:none;color:#111;background:#fff}
.comm-card-top{display:flex;gap:10px;align-items:center;margin-bottom:10px}
.comm-card-icon{width:44px;height:44px;border-radius:14px;object-fit:cover;background:#f1f1f1}
.comm-card-icon.placeholder{display:flex;align-items:center;justify-content:center;font-weight:900;color:#666}
.comm-card-name{font-weight:900;font-size:16px;letter-spacing:-.02em}
.comm-card-slug{font-weight:700;color:#7a7a7a;margin-top:2px}
.comm-card-desc{color:#444;font-size:14px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;margin-bottom:10px}
.comm-card-stats{display:flex;gap:18px;color:#6b6b6b;font-size:13px;font-weight:600}

.comm-actions-row{display:flex;gap:12px;margin:10px 0 14px}
.comm-actions-row .btn{flex:1}
.comm-list{display:flex;flex-direction:column;gap:12px}
.comm-row{display:flex;gap:12px;align-items:stretch;border:1px solid #ececec;border-radius:16px;background:#fff;overflow:hidden}
.comm-row-left{display:flex;gap:12px;align-items:flex-start;flex:1;padding:14px;text-decoration:none;color:#111}
.comm-row-icon{width:44px;height:44px;border-radius:14px;object-fit:cover;background:#f1f1f1;flex:0 0 auto}
.comm-row-icon.placeholder{display:flex;align-items:center;justify-content:center;font-weight:900;color:#666}
.comm-row-title{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.comm-row-title .name{font-weight:900}
.comm-row-title .slug{font-weight:700;color:#7a7a7a}
.comm-row-desc{margin-top:4px;color:#444}
.comm-row-meta{margin-top:6px;color:#6b6b6b;font-size:13px;font-weight:600}
.comm-row-right{display:flex;flex-direction:column;gap:10px;justify-content:center;padding:14px}
.comm-row-right form{margin:0}


/* Composer: media picker (max 4) – horizontal strip like native apps */
.composer-media{ margin: 10px 16px 0; }
.media-strip-head{display:flex;justify-content:flex-end;align-items:center;margin:2px 2px 8px}
.media-count{font-size:13px;font-weight:800;color:#6b6b6b;background:#f3f4f6;border:1px solid rgba(0,0,0,.08);padding:6px 10px;border-radius:999px}

.media-grid.media-strip{
  display:flex;
  gap: 12px;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x mandatory;
  padding: 2px 2px 10px;
}
.media-grid.media-strip::-webkit-scrollbar{display:none}

.media-grid.media-strip .media-tile,
.media-grid.media-strip .media-add{
  flex:0 0 auto;
  width: clamp(120px, 34vw, 170px);
  scroll-snap-align:start;
}
.media-tile, .media-add{
  position:relative;
  border-radius:14px;
  overflow:hidden;
  background:#f3f4f6;
  border:1px solid rgba(0,0,0,.08);
  aspect-ratio: 1 / 1;
}
.media-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Video thumbnail wrapper in composer */
.media-vidwrap{
  width:100%;
  height:100%;
  position:relative;
}
.media-vidbadge{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:54px;
  height:54px;
  border-radius:999px;
  background:rgba(0,0,0,.45);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  pointer-events:none;
}
.media-x{
  position:absolute;
  top:8px;
  right:8px;
  width:28px;
  height:28px;
  border-radius:999px;
  border:0;
  background:rgba(0,0,0,.55);
  color:#fff;
  font-size:20px;
  line-height:28px;
  cursor:pointer;
}
.media-add{
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  border:2px solid rgba(0,0,0,.15);
}
.media-add-ico{
  font-size:26px;
  color:#666;
}
.media-hint{
  margin-top:8px;
  font-size:12px;
  color:#777;
}

/* Post: image grid (1-4 images) */
.img-grid{
  display:grid;
  gap:6px;
  border-radius:14px;
  overflow:hidden;
}
.img-grid.n1{ grid-template-columns: 1fr; }
.img-grid.n2{ grid-template-columns: 1fr 1fr; }
.img-grid.n3, .img-grid.n4{ grid-template-columns: 1fr 1fr; }

.img-grid a{ display:block; }
.img-grid img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.img-grid.n1 img{ aspect-ratio: 16 / 9; }
.img-grid.n2 img{ aspect-ratio: 1 / 1; }
.img-grid.n3 img, .img-grid.n4 img{ aspect-ratio: 1 / 1; }

/* Optional: make first tile bigger for 3 images */
.img-grid.n3 a:first-child{ grid-column: 1 / span 2; }
.img-grid.n3 a:first-child img{ aspect-ratio: 16 / 9; }


/* Upload progress (composer) */
.upload-progress[hidden]{display:none !important}
.upload-progress{
  position:sticky;
  top:56px;
  z-index:69;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 16px;
  background:#fff;
  border-bottom:1px solid #eceef2;
}
.upload-progress-track{flex:1;height:10px;border-radius:999px;background:rgba(0,0,0,.08);overflow:hidden;}
.upload-progress-bar{height:100%;width:0%;border-radius:999px;background:rgba(0,0,0,.85);transition:width .15s linear;}
.upload-progress-text{min-width:44px;text-align:right;font-weight:800;font-size:13px;opacity:.75;}


.composer-right{display:flex;align-items:center;gap:10px}
.line-counter{
  display:inline-flex;align-items:baseline;gap:2px;
  padding:7px 10px;border-radius:999px;
  background:#f1f3f4;color:#5f6368;
  font-weight:800;font-size:12px;
  border:1px solid #e3e6e8;
}
.line-counter .lc-num{min-width:2ch;text-align:right}
.line-counter.warn{background:#fff7e6;border-color:#ffe0a3;color:#8a5a00}
.line-counter.over{background:#ffecec;border-color:#ffb3b3;color:#8a0000}

/* Floating counter near caret while typing */
.composer-bodywrap{position:relative}
.floating-counter{
  position:absolute;z-index:30;
  display:inline-flex;align-items:baseline;gap:2px;
  padding:6px 9px;border-radius:999px;
  background:#f1f3f4;color:#5f6368;
  font-weight:800;font-size:12px;
  border:1px solid #e3e6e8;
  box-shadow:0 6px 18px rgba(0,0,0,.08);
  pointer-events:none;
  opacity:.98;
  transform:translate(10px, 12px);
}
.floating-counter .lc-num{min-width:2ch;text-align:right}
.floating-counter.warn{background:#fff7e6;border-color:#ffe0a3;color:#8a5a00}
.floating-counter.over{background:#ffecec;border-color:#ffb3b3;color:#8a0000}


/* Post detail topbar (Back) - iOS safe area */
.post-detail-topbar{
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  /* iOS: keep content below the notch while preserving a consistent bar height */
  height: calc(56px + env(safe-area-inset-top));
  padding: 0 14px;
  padding-top: env(safe-area-inset-top);
  background: var(--bg, #fff);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.post-back{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  line-height: 1;
  /* Apple HIG: 44x44 minimum tap target */
  width: 44px;
  height: 44px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--text, #111);
}
.post-back:active{ background: rgba(0,0,0,.06); }
.post-detail-title{
  font-weight: 700;
  font-size: 18px;
}



/* ===== Dark theme refinement (contrast + cards + controls) ===== */
:root[data-theme="dark"]{
  --bg:#0b0f14;
  --card:#111827;
  --card2:#0f172a;
  --text:#e5e7eb;
  --muted:#a3adba;
  --border:rgba(255,255,255,.10);
  --primary:#e5e7eb;
  --pill:#e5e7eb;
  --pillText:#0b0f14;
}

:root[data-theme="dark"] body{
  background:var(--bg);
  color:var(--text);
}

/* Fix any leftover hardcoded white surfaces */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .sheet,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .box,
:root[data-theme="dark"] .search-card,
:root[data-theme="dark"] .activity-card,
:root[data-theme="dark"] .profile-card,
:root[data-theme="dark"] .comm-card,
:root[data-theme="dark"] .comment,
:root[data-theme="dark"] .comment-box,
:root[data-theme="dark"] .comm-row,
:root[data-theme="dark"] .p2,
:root[data-theme="dark"] .fi,
:root[data-theme="dark"] .fi-card{
  background:var(--card) !important;
  color:var(--text);
  border-color:var(--border) !important;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select{
  background:var(--card2) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}
:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder{
  color:rgba(163,173,186,.75) !important;
}

/* Buttons / pills */
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .seg a,
:root[data-theme="dark"] .seg button{
  border-color:var(--border) !important;
}
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .pill.on,
:root[data-theme="dark"] .seg .on{
  background:rgba(229,231,235,.92) !important;
  color:#0b0f14 !important;
}

/* Dark mode: empty states should not render white icon tiles */
:root[data-theme="dark"] .empty .illus,
:root[data-theme="dark"] .empty-state .illus{
  background: rgba(255,255,255,.06) !important;
  border-color: rgba(255,255,255,.12) !important;
}
:root[data-theme="dark"] .empty .illus svg,
:root[data-theme="dark"] .empty-state .illus svg{
  fill: rgba(231,233,238,.72) !important;
}

/* Post actions (vote arrows / counters) */
:root[data-theme="dark"] .fi-ibtn{
  color:rgba(229,231,235,.88) !important;
}
:root[data-theme="dark"] .fi-ibtn svg{opacity:.92}
:root[data-theme="dark"] .fi-count,
:root[data-theme="dark"] .fi-num{
  color:rgba(229,231,235,.92) !important;
  font-weight:700;
}
:root[data-theme="dark"] .fi-ibtn.on{
  color:var(--accent) !important;
}

/* Feed meta (user / community / time) */
:root[data-theme="dark"] .fi-head{color:rgba(229,231,235,.78) !important;}
:root[data-theme="dark"] .fi-user{color:rgba(229,231,235,.80) !important;}
:root[data-theme="dark"] .fi-comm{color:rgba(229,231,235,.95) !important;}
:root[data-theme="dark"] .fi-time{color:rgba(163,173,186,.92) !important;}
:root[data-theme="dark"] .fi-dot{color:rgba(229,231,235,.35) !important; opacity:1;}


/* Comment voting */
:root[data-theme="dark"] .c-vote .vbtn{
  color:rgba(229,231,235,.88) !important;
}
:root[data-theme="dark"] .c-vote .count{
  color:rgba(229,231,235,.92) !important;
  font-weight:700;
}
:root[data-theme="dark"] .c-vote .vbtn.on{
  color:var(--accent) !important;
}
:root[data-theme="dark"] .c-vote .vbtn.on svg{fill:var(--accent) !important;}

/* Community stats contrast */
:root[data-theme="dark"] .comm-stats .stat{
  background:rgba(255,255,255,.03) !important;
  border:1px solid var(--border) !important;
}
:root[data-theme="dark"] .comm-stats .n{color:rgba(229,231,235,.95) !important;}
:root[data-theme="dark"] .comm-stats .l{color:rgba(163,173,186,.88) !important;}

/* Community avatar on banner */
.comm-hero-avatar{
  position:absolute;
  left:50%;
  bottom:150px;
  transform:translateX(-50%);
  width:64px;
  height:64px;
  border-radius:18px;
  overflow:hidden;
  background:rgba(0,0,0,.25);
  border:2px solid rgba(255,255,255,.35);
  box-shadow:0 10px 24px rgba(0,0,0,.35);
  z-index:3;
}
.comm-hero-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.comm-hero-avatar-fallback{
  width:100%;height:100%;
  display:flex;align-items:center;justify-content:center;
  font-weight:900;font-size:26px;color:#fff;
  background:rgba(0,0,0,.25);
}
.comm-hero-title{left:50%;transform:translateX(-50%);bottom:84px;text-align:center;}

/* Make "Joined" pill readable in dark */
:root[data-theme="dark"] .comm-join,
:root[data-theme="dark"] .joined,
:root[data-theme="dark"] .comm-row .btn{
  background:rgba(255,255,255,.06) !important;
  color:rgba(229,231,235,.95) !important;
}


/* === Community banner layout (match Digg-like overlay with avatar + stats on banner) === */
.comm-hero{
  height:280px;
}

.comm-hero-overlay{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  /* compact overlay so the banner image stays visible */
  padding:12px 14px 12px;
  color:#fff;
  background:linear-gradient(180deg,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,.28) 32%,
    rgba(0,0,0,.62) 72%,
    rgba(0,0,0,.78) 100%
  );
}

.comm-hero-head{
  display:flex;
  align-items:flex-start;
  gap:10px;
}

/* override old centered avatar */
.comm-hero-avatar{
  position:relative;
  left:auto;
  bottom:auto;
  transform:none;
  width:44px;
  height:44px;
  border-radius:12px;
  overflow:hidden;
  background:rgba(0,0,0,.22);
  border:2px solid rgba(255,255,255,.28);
  box-shadow:0 10px 22px rgba(0,0,0,.32);
}

/* override old centered title */
.comm-hero-title{
  position:relative;
  left:auto;
  bottom:auto;
  transform:none;
  text-align:left;
  margin-top:1px;
  color:#fff;
  text-shadow:0 10px 24px rgba(0,0,0,.32);
}

/* smaller typography (more banner, less text) */
.comm-hero-name{font-size:22px; font-weight:850; letter-spacing:-.01em; line-height:1.1}
.comm-hero-slug{font-size:13px; font-weight:750; opacity:.90; margin-top:2px}

.comm-hero-stats{
  display:flex;
  gap:18px;
  margin-top:10px;
}
/*
  Community banner stats should be plain text overlay (like the reference screenshot),
  not boxed cards (global .stat styles are card-like).
*/
.comm-hero-stats .stat{
  min-width:0;
  flex:0 0 auto;
  border:0;
  background:transparent;
  padding:0;
  border-radius:0;
}
.comm-hero-stats .n{font-size:18px; font-weight:850; letter-spacing:-.01em; line-height:1.15;}
.comm-hero-stats .l{font-size:11px; opacity:.88; margin-top:1px;}

.comm-hero-desc{
  margin-top:8px;
  font-size:13px;
  line-height:1.25;
  opacity:.90;
}

/* Hide old card description/stats if any CSS leftovers exist */
.comm-card .comm-desc,
.comm-card .comm-stats{display:none !important;}

/* Live search: subtle loading shimmer on input */
#searchInput.is-loading{
  background-image: linear-gradient(90deg, rgba(0,0,0,.05), rgba(0,0,0,.12), rgba(0,0,0,.05));
  background-size: 200% 100%;
  animation: searchShimmer 1.1s linear infinite;
}
@keyframes searchShimmer{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}


/* @mention autosuggest dropdown */
.mention-wrap{ position:relative; }
.mention-suggest{
  position:absolute;
  left:0;
  right:0;
  margin-top:6px;
  background: var(--card, #111);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  overflow:hidden;
  z-index: 60;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.mention-suggest[hidden]{ display:none !important; }
.ms-item{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background: transparent;
  border:0;
  text-align:left;
  color: var(--text, #fff);
}
.ms-item:hover{ background: rgba(255,255,255,0.06); }
.ms-av{
  width:28px; height:28px; border-radius:999px;
  object-fit:cover; flex:0 0 auto;
  background: rgba(255,255,255,0.08);
}
.ms-av-fallback{
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:14px;
}
.ms-name{ font-size:14px; font-weight:700; flex:1 1 auto; min-width:0; }
.ms-badges{ display:flex; gap:6px; flex:0 0 auto; flex-wrap:wrap; justify-content:flex-end; }
.ms-b{
  font-size:11px;
  line-height:1;
  padding:6px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--muted, rgba(255,255,255,0.78));
  font-weight:800;
  white-space:nowrap;
}
.ms-loading{
  display:flex; gap:6px; padding:12px;
}
.ms-loading span{
  width:8px; height:8px; border-radius:999px;
  background: rgba(255,255,255,0.35);
  animation: msPulse 0.9s infinite ease-in-out;
}
.ms-loading span:nth-child(2){ animation-delay: .15s; }
.ms-loading span:nth-child(3){ animation-delay: .30s; }
@keyframes msPulse{
  0%, 80%, 100%{ opacity: .25; transform: translateY(0); }
  40%{ opacity: 1; transform: translateY(-2px); }
}

/* Topbar logout button alignment */
.topbar-logout{display:inline;margin:0;}
.topbar-logout .pill{cursor:pointer;}
.pill-ghost{background:transparent;border:1px solid rgba(255,255,255,.18);} 
[data-theme="light"] .pill-ghost{border-color:rgba(0,0,0,.15);} 

.btn-logout{background:#fff;color:#000;border-radius:12px;padding:8px 14px;border:none;}

/* PWA install prompt */
.pwa-install[hidden]{display:none !important;}
.pwa-install{
  position:fixed;
  inset:0;
  z-index:9999;
}
.pwa-install__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.45);
}
.pwa-install__card{
  position:absolute;
  left:50%;
  /* Sit above the fixed bottom navigation + iOS Safari bars */
  bottom: calc(var(--bn-h, 56px) + env(safe-area-inset-bottom) + var(--nav-shift, 0px) + 12px);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 20px));
  background: var(--card, #111);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}
[data-theme="light"] .pwa-install__card{
  background: #fff;
  border-color: rgba(0,0,0,0.10);
}
.pwa-install__title{
  font-weight: 800;
  font-size: 15px;
  margin-bottom: 6px;
}
.pwa-install__text{
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.35;
}
.pwa-install__actions{
  display:flex;
  gap:10px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* Inline edit modal */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,.45);display:flex;align-items:flex-end;justify-content:center;z-index:9999;padding:12px;}
.modal-sheet{width:min(680px,100%);background:var(--card,#fff);border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,.25);overflow:hidden;}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(0,0,0,.06);}
.modal-title{font-weight:700;}
.modal-btn{background:transparent;border:0;padding:8px 10px;border-radius:10px;font-weight:600;}
.modal-btn.primary{background:#111;color:#fff;}
.modal-body{padding:14px;}
.modal-label{display:block;font-size:12px;color:rgba(0,0,0,.6);margin-bottom:6px;}
.modal-input{width:100%;padding:12px 12px;border:1px solid rgba(0,0,0,.12);border-radius:12px;font-size:16px;outline:none;}
.modal-ta{width:100%;padding:12px 12px;border:1px solid rgba(0,0,0,.12);border-radius:12px;font-size:16px;outline:none;resize:none;}

@media (prefers-color-scheme: dark){
  .modal-sheet{background:#111;}
  .modal-head{border-bottom:1px solid rgba(255,255,255,.08);}
  .modal-label{color:rgba(255,255,255,.55);} 
  .modal-input,.modal-ta{background:#0b0b0b;color:#fff;border:1px solid rgba(255,255,255,.12);} 
  .modal-btn.primary{background:#fff;color:#111;}
}


/* Inline edit modal improvements */
/*
  Keep the sheet ABOVE the bottom nav / safe-area.
  Also hide bottom UI chrome while modal is open.
*/
.modal-overlay{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.35);
  z-index:9999;
  display:flex;
  justify-content:center;
  align-items:flex-end;
  padding:12px;
  padding-bottom: calc(12px + var(--bn-h) + env(safe-area-inset-bottom) + 10px);
}
.modal-sheet{
  width:100%;
  max-width:720px;
  background:#fff;
  border-radius:16px 16px 12px 12px;
  max-height: calc(100vh - (24px + var(--bn-h) + env(safe-area-inset-bottom) + 10px));
  overflow:hidden;
  box-shadow:0 8px 30px rgba(0,0,0,.18);
}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:12px 14px;border-bottom:1px solid rgba(0,0,0,.06);}
.modal-title{font-weight:700;}
.modal-btn{background:transparent;border:0;padding:8px 10px;font-weight:600;}
.modal-btn.primary{background:#111;color:#fff;border-radius:999px;}
.modal-body{padding:12px 14px;overflow:auto;max-height:calc(100vh - 120px);}
.modal-label{display:block;font-size:13px;color:#666;margin-bottom:6px;}
.modal-input{width:100%;padding:12px 12px;border:1px solid rgba(0,0,0,.12);border-radius:12px;font-size:16px;}
.modal-ta{width:100%;padding:12px 12px;border:1px solid rgba(0,0,0,.12);border-radius:12px;font-size:16px;resize:none;}
.modal-urlrow{display:flex;gap:10px;align-items:center;}
.modal-urlrow .modal-input{flex:1;}
.modal-urlbtn{flex:0 0 auto;border:1px solid rgba(0,0,0,.12);background:rgba(0,0,0,.04);padding:10px 12px;border-radius:12px;font-weight:600;}
.modal-sep{height:1px;background:rgba(0,0,0,.06);margin:12px 0;}
.modal-count{font-size:12px;color:#666;}

.modal-media-strip{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding:6px 2px 10px;
  -webkit-overflow-scrolling:touch;
  scroll-snap-type:x proximity;
}

/* Prevent overlap: hide bottom nav + FAB while modal is open */
body.modal-open .bottomnav,
body.modal-open .fab,
body.modal-open .fab-compose{ display:none !important; }
.modal-media-tile{
  position:relative;
  width:120px;
  height:120px;
  flex:0 0 auto;
  border-radius:14px;
  overflow:hidden;
  background:#f2f3f5;
  scroll-snap-align:start;
}
.modal-media-thumb{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.modal-media-x{
  position:absolute;
  top:8px;
  right:8px;
  width:30px;
  height:30px;
  border-radius:999px;
  border:0;
  background:rgba(0,0,0,.55);
  color:#fff;
  font-size:18px;
  line-height:30px;
}
.modal-media-play{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  width:48px;height:48px;border-radius:999px;
  background:rgba(0,0,0,.35);
  color:#fff;
  display:flex;align-items:center;justify-content:center;
  font-size:18px;
}
.modal-media-add{
  width:120px;height:120px;flex:0 0 auto;
  border-radius:14px;
  border:2px dashed rgba(0,0,0,.18);
  background:transparent;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  color:#333;
}
.modal-media-add-ic{font-size:26px;line-height:1;}
.modal-media-add-txt{font-size:12px;margin-top:4px;opacity:.75;}

html, body { touch-action: manipulation; }
input, textarea, select { font-size:16px; }

/* PWA install prompt logo */
.pwa-install__logo{
  display:flex;
  justify-content:center;
  margin: 4px 0 10px;
}
.pwa-install__logo img{
  width: 84px;
  height: 84px;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  background: rgba(255,255,255,0.08);
}

/* Rich text (URLs + @mentions) */
.richtext a{
  color: #3b82f6;
  text-decoration: none;
  word-break: break-word;
}
.richtext a:hover{
  text-decoration: underline;
}
/* Post comments: tighter meta spacing */
body.is-post #comments .ucom-meta{margin-bottom:6px;}
body.is-post #comments .ucom-body{font-size:14px;line-height:1.35;}

.ucom-replyto{color:var(--muted);font-size:12px;margin-top:2px;}
.ucom-replyto a{text-decoration:underline;color:inherit;}

/* Replies: keep full width but make it obvious */
body.is-post #comments .ucom-reply{margin-left:0;}
body.is-post #comments .ucom.is-reply{background:rgba(0,0,0,.03);padding-left:14px;}
body.is-post #comments .ucom.is-reply .ucom-replyto{font-weight:600;}
