/* Shared styles for every authenticated page (feed, compose, post, profile,
   circles, search, notifications, messages, thread). Expects landing.css
   (tokens + .btn-* from auth.css) loaded first. */

body { padding-bottom: 0; }

/* Visually hides content while keeping it in the accessibility tree - for
   a <label> that duplicates a placeholder a sighted user already reads
   fine, but which a screen reader needs since a placeholder alone isn't
   reliably announced and disappears the moment there's real input (see
   search.html/settings.html's search/muted-keyword/delete-password
   fields). Standard WebAIM pattern - display:none or visibility:hidden
   would hide it from assistive tech too, which defeats the point. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* post.html only (see post.js's applyAuthorAccentBackground) - a soft glow
   in the post author's own accent color instead of the flat --bg every
   other page uses. `background-attachment: fixed` keeps the glow anchored
   to the viewport, not the (much taller) scrolling page, so it doesn't
   scroll away past a long comment thread. Skipped under high-contrast
   mode - that mode exists specifically to flatten everything to pure
   black/white, and a colored glow would work against it. */
body.post-accent-bg {
  background:
    radial-gradient(ellipse 900px 420px at 50% -80px, var(--post-accent-glow, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
:root[data-contrast="high"] body.post-accent-bg { background: var(--bg); }

/* body.ambient-bg - the ambient brand glow behind the Home feed, Notifications,
   Find people, Circles and the Messages inbox (NOT the open chat thread, which
   stays flat: long-form reading with colored bubbles). Add .ambient-calm on
   the list-heavy pages for a 25% gentler glow (--ambient-k). Mirrors Android's WaveLenAmbient: soft, static radial glows (violet top-left, a faint cyan
   hint top-right, magenta bottom-right) instead of a flat near-black. The
   three colors are variables (rgb triplets) so wavelen-util.js's applyAmbientBackground can swap in a viewer's
   own accent color (--ambient-1 main glow, --ambient-3 a hue-shifted second
   glow, --ambient-2-alpha 0 to drop the cyan hint) or add .ambient-flat
   for accents too dark to glow (charcoal); the defaults below ARE the brand
   glow. Everything is scoped to the normal dark theme - light mode (a colored
   wash on white just looks like a tint) and high-contrast mode (which exists
   to flatten everything to pure black/white, same reason post-accent-bg above
   is skipped there) keep the flat --bg and the normal cards. Static (no
   animation, so nothing to gate on reduce-motion). Opacity tops out around
   22% - past ~25% a glow starts competing with the photos. Cards get one step
   above --surface plus a hairline border so they separate from it, and the
   sticky header goes more translucent (it already blurs) so the glow shows
   behind it. */
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg {
  --ambient-1: 123, 74, 234;
  --ambient-2: 0, 229, 253;
  --ambient-2-alpha: 0.09;
  --ambient-3: 217, 63, 192;
  background:
    radial-gradient(ellipse 85% 42% at 0% 0%, rgba(var(--ambient-1), calc(0.22 * var(--ambient-k, 1))), transparent 72%),
    radial-gradient(ellipse 70% 38% at 100% 8%, rgba(var(--ambient-2), calc(var(--ambient-2-alpha) * var(--ambient-k, 1))), transparent 72%),
    radial-gradient(ellipse 75% 42% at 100% 100%, rgba(var(--ambient-3), calc(0.16 * var(--ambient-k, 1))), transparent 72%),
    var(--bg);
  background-attachment: fixed;
  /* html has its own solid background, so this body background is NOT
     propagated to the canvas - it only paints inside the body's own box,
     and on a short page (e.g. the empty-state feed) that stops well above
     the bottom of the window, cutting the glow off in a hard edge. */
  min-height: 100vh;
  min-height: 100dvh;
}
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-calm { --ambient-k: 0.75; }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-flat { background: var(--bg); }
/* A personal accent also becomes the page's "active" color (active nav item, hashtag links,
   focus rings, selected swatches) - dark theme only, like the glow: pastel accents as text on
   white would fail contrast. Gradients defined on :root (the logo, story rings) keep the brand
   violet since they resolve --violet where they're declared. */
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-accent { --violet: rgb(var(--ambient-1)); }
/* Text colors use --violet-text (the contrast-safe violet) since the 2026-09-23 a11y pass, so
   the accent has to override it separately - only when wavelen-util.js found it readable (4.5:1)
   on the dark surface; otherwise active text keeps the readable violet. */
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-accent.ambient-accent-text { --violet-text: rgb(var(--ambient-1)); }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .app-header {
  background: rgba(10, 10, 15, 0.55);
}
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .post-card,
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .composer-card {
  background: #1E1E29;
  border-color: rgba(255, 255, 255, 0.075);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
/* Empty state (the first thing a new tester sees): a glowing orb and a soft
   halo behind it instead of a flat gray circle (no halo when the glow is off). */
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state { position: relative; }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8px;
  width: 300px;
  height: 300px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(var(--ambient-1), calc(0.28 * var(--ambient-k, 1))), transparent 68%);
  pointer-events: none;
}
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-flat .empty-state::before { display: none; }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state .icon {
  position: relative;
  background: radial-gradient(circle at 30% 30%, rgba(var(--ambient-1), 0.55), rgba(var(--ambient-3), 0.3) 60%, rgba(28, 28, 36, 0.9));
  box-shadow: 0 0 46px 10px rgba(var(--ambient-1), 0.38);
}
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-flat .empty-state .icon { background: var(--surface-variant); box-shadow: none; }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state .icon svg { stroke: var(--text); }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg.ambient-flat .empty-state .icon svg { stroke: var(--text-muted); }
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state h3,
:root:not([data-theme="light"]):not([data-contrast="high"]) body.ambient-bg .empty-state p { position: relative; }

/* ---- App shell: header + nav ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.app-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
}
.app-nav-link svg { width: 22px; height: 22px; }
.app-back { background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.app-nav-link:hover { background: var(--surface-variant); color: var(--text); }
.app-nav-link.active { color: var(--violet-text); background: var(--surface-variant); }
/* Account menu (Profile/Edit Profile/Saved/Settings), anchored under the
   avatar at the end of the nav - the standard "your stuff lives under your
   avatar" pattern, always reachable on every page including on a phone.
   Same destinations the left rail (wavelen-sidebars.js, desktop-only, and
   only mounted on feed.html/profile.html to begin with) shows as shortcuts;
   this menu is the one path guaranteed to exist everywhere else. */
.account-menu-wrap { position: relative; }
.app-nav-avatar { background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.account-menu-panel { min-width: 180px; }
.account-menu-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.account-menu-item svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }
.account-menu-item.active { color: var(--violet-text); background: var(--surface-variant); }
.account-menu-item.active svg { color: var(--violet-text); }

/* Shared avatar chip - used in the nav, post cards, user rows, conversation
   rows, comments, notifications (see wavelen-util.js's renderAvatar()).
   Works whether the element is an <img> (real photoUrl) or a <span>
   (initials fallback) - object-fit only matters for the img case. */
.avatar-initial-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  object-fit: cover;
}
.app-nav-link.active .avatar-initial-sm { box-shadow: 0 0 0 2px var(--violet); }
.nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.app-main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}
.app-main.wide { max-width: 900px; }

/* ---- 3-column shell (feed.html + profile.html only) ---- */
.app-shell-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 640px) 280px;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  justify-content: center;
  align-items: start;
}
.app-shell-grid .app-main { max-width: none; margin: 0; padding: 0; }
.left-rail, .right-rail { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
}
.rail-card-title { font-weight: 600; font-size: 0.9rem; margin: 6px 8px 10px; }
.rail-profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  text-decoration: none;
  color: inherit;
}
.rail-profile-link .avatar-initial-sm { width: 40px; height: 40px; font-size: 1rem; }
.rail-profile-name { font-weight: 600; font-size: 0.9rem; }
.rail-profile-handle { color: var(--text-secondary); font-size: 0.78rem; }
.rail-stats {
  display: flex;
  gap: 14px;
  padding: 2px 6px 6px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
}
.rail-stats a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}
.rail-stats a span { color: var(--text-secondary); font-weight: 400; margin-left: 3px; }
.rail-stats a:hover { color: var(--violet-text); }
.rail-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.rail-link:hover { background: var(--surface-variant); }
.rail-link svg { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }

@media (max-width: 1080px) {
  .app-shell-grid { grid-template-columns: 240px minmax(0, 640px); }
  .right-rail { display: none; }
}
@media (max-width: 860px) {
  .app-shell-grid { grid-template-columns: minmax(0, 640px); padding: 20px 16px 80px; }
  .left-rail { display: none; }
}

/* ---- Toast ---- */
.wavelen-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-variant);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.88rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  z-index: 100;
  max-width: 90vw;
}
.wavelen-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.wavelen-toast.error { border-color: rgba(var(--error-rgb), 0.4); color: var(--error-text); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-secondary);
}
.empty-state .icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state .icon svg { width: 26px; height: 26px; stroke: var(--text-muted); }
.empty-state h3 { color: var(--text); font-size: 1rem; margin: 0 0 6px; }
.empty-state p { font-size: 0.88rem; margin: 0; }

/* ---- Loading ---- */
.loading-line { text-align: center; color: var(--text-secondary); font-size: 0.9rem; padding: 40px 0; }

/* ---- Skeleton loaders ----
   Shape-matched placeholders shown in a page's #loading element in place of
   a "Loading..." line, so the content lands where the skeleton was. The
   shimmer is a neutral translucent-text sweep (works on both themes and on
   any card background); the brand gradient stays reserved for real brand
   moments. Static under prefers-reduced-motion and the in-app reduce-motion
   setting (the global rules in landing.css only shorten the animation, which
   would leave it parked at an arbitrary frame, so it's turned off outright
   here). #loading keeps its id and its display:none/block toggling, so no
   page script changed to support this. */
.loading-line.loading-skeleton { padding: 0; text-align: left; }
.skeleton {
  display: block;
  border-radius: 6px;
  background: var(--border);
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--text) 8%, transparent) 30%,
    color-mix(in srgb, var(--text) 16%, transparent) 50%,
    color-mix(in srgb, var(--text) 8%, transparent) 70%
  );
  background-size: 300% 100%;
  animation: skeleton-sweep 1.4s linear infinite;
}
@keyframes skeleton-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
:root[data-motion="reduce"] .skeleton { animation: none; }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.sk-row { display: flex; align-items: center; gap: 10px; }
.sk-col { display: flex; flex-direction: column; gap: 8px; }
.sk-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.sk-avatar.lg { width: 96px; height: 96px; }
.sk-line { height: 12px; }
.sk-line.title { height: 18px; }
.sk-media { width: 100%; aspect-ratio: 4 / 3; border-radius: 12px; margin: 14px 0 12px; }
.sk-actions { display: flex; gap: 10px; }
.sk-pill { width: 58px; height: 28px; border-radius: 999px; }
.skeleton-card.post-card { display: block; }
/* Feed only: while more pages are loading under already-rendered posts, one
   placeholder card is enough. */
#post-list:not(:empty) ~ #loading .skeleton-card + .skeleton-card { display: none; }
.post-card.sk-convo { display: flex; align-items: center; gap: 12px; }
.post-card.sk-convo .sk-avatar { width: 48px; height: 48px; }
.sk-profile { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 0; }
.sk-profile .sk-chips { display: flex; gap: 12px; margin-top: 8px; }
.sk-profile .sk-chip { width: 72px; height: 30px; border-radius: 999px; }

/* ---- Infinite scroll sentinel ---- */
.scroll-sentinel { height: 1px; }

/* ---- Segmented control (Feed: Following/Explore) ---- */
.segmented {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 18px;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 0;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.segmented button.active {
  background: var(--surface-variant);
  color: var(--text);
}

/* ---- Feed controls row: Following/Explore toggle + sort toggle ---- */
.feed-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.feed-controls .segmented { margin-bottom: 0; }
.feed-controls #feed-toggle { flex: 1; }
.sort-toggle { flex: 0 0 auto; }
.sort-toggle button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  white-space: nowrap;
}
.sort-toggle svg { width: 15px; height: 15px; flex-shrink: 0; }
@media (max-width: 640px) {
  .feed-controls { flex-wrap: wrap; }
  .sort-toggle span { display: none; }
  .sort-toggle button { padding: 8px 10px; }
}

/* ---- Small pill badge (pending review, etc.) ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.pill-pending {
  background: rgba(253, 126, 89, 0.15);
  color: #FD9E7E;
  border: 1px solid rgba(253, 126, 89, 0.3);
}

/* ---- Post card (feed / profile grid / post.html) ---- */
.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  color: inherit;
  text-decoration: none;
}
a.post-card:hover { border-color: var(--violet); }
.post-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.post-author-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.post-author-link:hover .post-author-name { text-decoration: underline; }
.post-author-name { font-weight: 600; font-size: 0.88rem; }
.post-time { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }
.post-edited-link { color: var(--text-muted); font-size: 0.78rem; text-decoration: none; }
.post-edited-link:hover { text-decoration: underline; }
.post-text { font-size: 0.92rem; margin: 0 0 10px; white-space: pre-wrap; word-break: break-word; }
.hashtag-link { color: var(--violet-text); font-weight: 600; text-decoration: none; }
.hashtag-link:hover { text-decoration: underline; }
.post-media {
  width: 100%;
  border-radius: 12px;
  display: block;
  margin-bottom: 10px;
  max-height: 480px;
  object-fit: cover;
  /* Media has no stored dimensions, so before it loads the box is 0 tall and
     the whole feed jumps when it lands. "auto 4/3" reserves a 4:3 box until
     the real ratio is known, then switches to it - no cropping change. */
  aspect-ratio: auto 4 / 3;
  background: var(--surface-variant);
}
.post-media-wrap { position: relative; }
.post-media-wrap .post-media { margin-bottom: 10px; }
/* "WaveLen · @author" media stamp - mirrors WaveLenWatermark.kt. */
.post-watermark {
  position: absolute;
  left: 10px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.32);
  pointer-events: none;
}
.watermark-brand {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.watermark-author {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}
.post-badges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.post-badges:empty { display: none; margin: 0; }
.post-actions { display: flex; align-items: center; gap: 20px; }
.post-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.post-action svg { width: 19px; height: 19px; }
.post-action[data-action="save"][aria-pressed="true"] { color: var(--cyan-text); }
.post-action[data-action="save"][aria-pressed="true"] svg { fill: var(--cyan); stroke: var(--cyan); }
.post-action[data-action="repost"][aria-pressed="true"] { color: var(--violet-text); }
.post-repost-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.post-repost-banner svg { width: 14px; height: 14px; }

/* ---- Reactions (Love/Fire/Spark/LOL - see wavelen-posts.js REACTIONS) ---- */
.post-action-wrap { position: relative; display: inline-flex; align-items: center; }
/* Keyboard/screen-reader path into the reaction popover - see its own
   comment in wireCardActions (wavelen-posts.js) for why this exists
   alongside the hold gesture rather than replacing it. */
.reaction-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  margin-left: -4px;
}
.reaction-more-btn svg { width: 14px; height: 14px; }
.reaction-more-btn:focus-visible { outline: 2px solid var(--violet); outline-offset: 1px; border-radius: 4px; }
.reaction-current-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
}
.reaction-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  display: none;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.reaction-popover.visible { display: flex; }
.reaction-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 0.1s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}
.reaction-dot:hover { transform: scale(1.15); }
.reaction-dot:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* ---- Stories bar (feed.html) ---- */
.stories-bar-wrap { margin-bottom: 18px; }
.stories-bar {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.stories-bar::-webkit-scrollbar { height: 0; }
.story-ring-item { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; flex-shrink: 0; cursor: pointer; }
.story-ring-avatar-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
}
.story-own-anchor { position: relative; }
.story-ring-avatar-wrap.unseen { background: var(--brand-gradient); }
.story-ring-avatar-wrap.seen { background: var(--border); }
.story-ring-avatar-wrap.empty { background: var(--surface-variant); border: 1px dashed var(--border); }
.story-ring-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.story-ring-avatar .avatar-initial-sm { width: 100%; height: 100%; font-size: 1.2rem; }
.story-ring-item .story-ring-label { font-size: 0.72rem; color: var(--text-secondary); max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-add-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  border: 2px solid var(--bg);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Story viewer (fullscreen overlay) ---- */
.story-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
}
.story-progress-row { display: flex; gap: 4px; padding: 10px 12px 0; }
.story-progress-track { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.story-progress-fill { height: 100%; background: #fff; width: 0%; }
.story-viewer-header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: #fff; }
.story-header-name { font-weight: 600; font-size: 0.85rem; }
.story-time { color: rgba(255, 255, 255, 0.6); font-size: 0.75rem; margin-left: auto; }
.story-close-btn { background: none; border: none; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 4px; margin-left: 8px; }
.story-media-wrap { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; min-height: 0; }
.story-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.story-tap-zone { position: absolute; top: 0; bottom: 0; cursor: pointer; }
.story-tap-zone-prev { left: 0; width: 30%; }
.story-tap-zone-next { right: 0; width: 70%; }
.story-viewer-footer { display: flex; align-items: center; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); }
.story-reply-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 10px 16px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
}
.story-reply-input::placeholder { color: rgba(255, 255, 255, 0.6); }
.story-reply-input:focus { outline: 2px solid #fff; outline-offset: 1px; border-color: #fff; }
.story-view-count { color: rgba(255, 255, 255, 0.85); font-size: 0.85rem; }
.story-delete-btn {
  margin-left: auto;
  background: rgba(var(--error-rgb), 0.18);
  color: var(--error-text);
  border: 1px solid rgba(var(--error-rgb), 0.4);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.story-pending-banner { text-align: center; color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }

/* ---- Story-reply chip (thread.html message bubble) ---- */
.story-reply-chip { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.story-reply-chip img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.story-reply-chip span { font-size: 0.76rem; opacity: 0.85; }

.shared-post-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.shared-post-chip img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.shared-post-chip span { font-size: 0.85rem; }

/* ---- In-feed composer card (feed.html) ---- */
.composer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.composer-trigger { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.composer-fake-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}
.composer-quick-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.composer-quick-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 0;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
}
.composer-quick-btn:hover { background: var(--surface-variant); }
.composer-quick-btn svg { width: 18px; height: 18px; }
#composer-root .form-error,
#composer-root textarea { margin-top: 12px; }

/* ---- Composer ---- */
.composer textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-size: 0.97rem;
  font-family: inherit;
  resize: vertical;
}
.composer textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }
.photo-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}
.photo-preview-wrap { position: relative; margin-top: 14px; }
.photo-preview { width: 100%; border-radius: 12px; max-height: 360px; object-fit: cover; display: block; }
.photo-remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.field-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 20px 0 10px;
}
.visibility-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.visibility-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-variant);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
}
.visibility-chip.selected { border-color: transparent; background: linear-gradient(var(--surface-variant), var(--surface-variant)) padding-box, var(--brand-gradient) border-box; border: 1.5px solid transparent; color: var(--text); }
.visibility-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.upload-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 14px;
  overflow: hidden;
  display: none;
}
.upload-progress .bar { height: 100%; background: var(--brand-gradient); width: 0%; transition: width 0.2s; }
.upload-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(var(--error-rgb), 0.12);
  border: 1px solid rgba(var(--error-rgb), 0.35);
  color: var(--error-text);
  font-size: 0.88rem;
}

/* ---- Comment list ---- */
.comment-row { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-row:last-child { border-bottom: none; }
.comment-body { flex: 1; }
.comment-author { font-weight: 600; font-size: 0.85rem; margin-right: 6px; }
.comment-time { color: var(--text-muted); font-size: 0.76rem; }
.comment-text { font-size: 0.88rem; margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.comment-flag-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  align-self: flex-start;
}
.comment-flag-btn:hover { color: var(--text-secondary); }
.comment-flag-btn svg { width: 15px; height: 15px; }
.comment-compose { display: flex; gap: 10px; margin-top: 16px; align-items: flex-start; }
.comment-compose input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
}
.comment-compose input:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }
.comment-compose button { flex-shrink: 0; width: auto; padding: 10px 18px; }

/* ---- User row (search results, followers/following) ---- */
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.user-row-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.user-row-name { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-btn { width: auto; padding: 7px 16px; font-size: 0.82rem; flex-shrink: 0; }

/* ---- Send-to-DM picker (wavelen-send-post.js) ---- */
.send-post-results { max-height: 320px; overflow-y: auto; }
.send-post-row {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.send-post-row:last-child { border-bottom: none; }

/* ---- Discover (search.js's taste-based tab) ---- */
.discover-row { border-bottom: 1px solid var(--border); }
.discover-row:last-child { border-bottom: none; }
.discover-row .user-row { border-bottom: none; padding-bottom: 2px; }
.discover-shared { margin: -4px 0 12px 38px; font-size: 0.78rem; color: var(--text-secondary); }

/* ---- Notifications ---- */
.notification-row {
  text-decoration: none;
  color: inherit;
  cursor: default;
}
a.notification-row { cursor: pointer; }
a.notification-row:hover { background: var(--surface-variant); }
.notification-row.unread { background: rgba(123, 74, 234, 0.06); }
.notification-text { flex: 1; font-size: 0.9rem; }
.notification-time { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }
.mark-all-link { font-size: 0.85rem; color: var(--cyan-text); text-decoration: none; cursor: pointer; }
/* collabInvite gets its own taller row (inline Accept/Decline, see
   wavelen-notifications.js) - flex-wrap lets the actions drop to their own
   line under the text instead of squeezing into the single-line row every
   other notification type uses. */
.notification-row.has-actions { flex-wrap: wrap; }
.collab-invite-actions { flex-basis: 100%; display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.collab-invite-actions .btn { width: auto; padding: 6px 14px; font-size: 0.82rem; }
/* Follow requests (private accounts) - a section above the notification list. */
.follow-requests { margin-bottom: 20px; }
.follow-requests-title { font-size: 0.95rem; margin: 0 0 8px; }
a.notification-text { color: inherit; text-decoration: none; font-weight: 600; }
a.notification-text:hover { text-decoration: underline; }

/* ---- Messages ---- */
.conversation-row { text-decoration: none; color: inherit; }
.conversation-row:hover { background: var(--surface-variant); }
.conversation-row.unread .conversation-name,
.conversation-row.unread .conversation-preview { color: var(--text); font-weight: 600; }
.conversation-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conversation-name { font-weight: 600; font-size: 0.9rem; }
.conversation-preview {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Space (group) avatar - a plain icon on a muted fill, distinct from a real
   person's gradient-initial avatar so a Space reads differently at a glance
   in the conversation list, thread header, and member picker. */
.group-avatar { background: var(--surface-variant); color: var(--text-secondary); }
.group-avatar svg { width: 16px; height: 16px; }

.thread-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.thread-header-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* --text-secondary, not --text-muted - both of these carry real meaning
   (the thread's online/typing status; who sent a message in a group
   chat), unlike --text-muted's other uses (timestamps, empty-state icons)
   which are genuinely decorative. --text-muted's ~2.5-3.4:1 contrast
   fails WCAG AA (4.5:1) for text that matters; --text-secondary clears it
   in both themes. */
.thread-header-sub { font-size: 0.76rem; color: var(--text-secondary); }
.thread-messages { display: flex; flex-direction: column; gap: 6px; min-height: 200px; }
.message-row { display: flex; flex-direction: column; align-items: flex-start; }
.message-row.mine { align-items: flex-end; }
.message-sender-label { font-size: 0.74rem; color: var(--text-secondary); margin: 0 2px 2px; }
.message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.message-row.mine .message-bubble {
  background: var(--brand-gradient);
  color: #fff;
  border: none;
}
.message-edited { font-size: 0.72rem; opacity: 0.7; }
/* Photo bubble skips the padded/backgrounded box entirely - the image
   itself reads as the bubble, mirrors ChatScreen.kt's own comment on this. */
.message-image { max-width: 220px; max-height: 280px; display: block; border-radius: 16px; object-fit: cover; }
.message-voice { padding: 6px 10px; }
.message-voice audio { display: block; max-width: 240px; height: 32px; }
.message-flagged-notice { color: var(--text-secondary); font-style: italic; }
.typing-indicator { color: var(--text-secondary); font-size: 0.82rem; padding: 4px 0 12px; min-height: 1.2em; }

.thread-composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding-top: 12px;
  margin-top: 12px;
}
.thread-composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}
.thread-composer textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }
.thread-composer button { width: auto; padding: 10px 20px; flex-shrink: 0; }
.blocked-notice {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 12px;
  background: var(--surface-variant);
  border-radius: 10px;
  margin-top: 12px;
}

/* ---- Circle section (circles.html) ---- */
.circle-section { margin-bottom: 28px; }
.circle-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.circle-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.circle-section-title { font-weight: 600; font-size: 1rem; }
.circle-section-count { color: var(--text-secondary); font-size: 0.82rem; margin-left: auto; }

/* ---- Settings / Edit Profile ---- */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
}
.settings-section-title { font-weight: 600; font-size: 0.95rem; margin: 0 0 4px; }
.settings-section-subtitle { color: var(--text-secondary); font-size: 0.82rem; margin: 0 0 14px; }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row.sub { padding-left: 16px; }
.settings-row.disabled .settings-row-label,
.settings-row.disabled .settings-row-sub { opacity: 0.45; }
.settings-row-label { font-size: 0.9rem; }
.settings-row-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
/* Text size row (Accessibility section) - stacked rather than the
   label+control side-by-side .settings-row shape, since the A-/slider/A+
   control needs the full row width. Same border/padding convention as
   .settings-row for visual consistency with the rows around it. */
.text-scale-block {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.text-scale-block:last-child { border-bottom: none; }
.text-scale-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.text-scale-btn {
  background: none;
  border: none;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-family: inherit;
}
.text-scale-btn.large { font-size: 1.35rem; }
.text-scale-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.text-scale-btn:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
  border-radius: 4px;
}
.text-scale-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.text-scale-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet);
  cursor: pointer;
}
.text-scale-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--violet);
  cursor: pointer;
}
.text-scale-slider:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}
.text-scale-reset {
  display: block;
  background: none;
  border: none;
  color: var(--cyan-text);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0;
  margin-top: 10px;
  font-family: inherit;
}
.text-scale-reset:hover { text-decoration: underline; }

.settings-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
}
.settings-collapse-btn svg { width: 18px; height: 18px; transition: transform 0.15s; color: var(--text-secondary); }
.settings-collapse-btn.expanded svg { transform: rotate(180deg); }
.settings-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.settings-row:last-child, .settings-nav-row:last-child { border-bottom: none; }
.settings-nav-row.danger { color: var(--error-text); }

/* ---- Profile header: banner + overlapping avatar ---- */
/* Fixed full-viewport wallpaper layer (only injected when the viewed
   profile has a custom bannerUrl photo) - mirrors ProfileScreen.kt's
   "background photo covers the whole screen, showing through wherever
   opaque cards don't paint over it" behavior. Sits behind everything
   (negative z-index); page content's own opaque --surface cards
   (.rail-card, .post-card, .app-header, etc.) paint over it as normal, so
   it only peeks through the gaps between cards/rails - EXCEPT plain body
   background beats a negative-z-index descendant in the paint order
   (a static box's own background paints before positioned descendants
   get their turn), so body's own solid --bg would otherwise hide this
   completely. profile.js toggles body.has-wallpaper to punch a
   transparent hole for it to show through. */
body.has-wallpaper { background: transparent; }
.profile-wallpaper {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-size: cover;
  background-position: center;
}
/* No dimming scrim here on purpose - a scrim only ever applied in the
   has-photo case (there's no wallpaper at all otherwise), and a user who
   actively chose a background photo should see it at full strength;
   opting out (no photo, plain theme banner below) is the only case that
   gets an overlay treatment. The blur alone (above) is enough to keep it
   from reading as a foreground element. */
.profile-header { position: relative; }
.profile-banner {
  position: relative;
  width: 100%;
  height: 160px;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-variant);
  overflow: hidden;
}
.profile-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, var(--bg) 100%);
}
/* A real photo shows as the full-page wallpaper right below the banner
   (see .profile-wallpaper), undimmed - the fade above is only for the
   OTHER case (a flat theme gradient banner easing into a plain solid page
   background). The banner itself paints nothing at all here (see
   profile.js - it deliberately skips setting a background-image when a
   photo is in use): painting the same photo a second time, cropped to the
   banner's own small box, produced a visible seam/"box" against the
   wallpaper's independently-cropped rendering of it, no matter how that
   edge was faded or masked. Transparent means there's only ever one
   rendering of the photo to line up with. */
.profile-banner.has-photo::after { display: none; }
.profile-banner.has-photo { background-color: transparent; }
.profile-banner-menu { position: absolute; top: 10px; right: 10px; z-index: 2; }
.profile-banner-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.profile-banner-menu-btn svg { width: 19px; height: 19px; }
.profile-banner-menu .more-menu { top: calc(100% + 6px); right: 0; }
.profile-avatar-wrap {
  position: relative;
  z-index: 2;
  width: 88px;
  height: 88px;
  margin: -44px auto 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-avatar-wrap .avatar-initial-sm { width: 100%; height: 100%; font-size: 2rem; border-radius: 50%; }
.profile-identity { text-align: center; margin: 10px 0 18px; }
/* Profile card: identity, stats, badges, bio, link, interests and the
   Follow/Message row in one panel, pulled up under the avatar. Over a
   background photo it's frosted glass, so text stays readable in either
   theme instead of sitting straight on the photo. */
.profile-card {
  max-width: 620px;
  margin: -34px auto 22px;
  padding: 46px 22px 22px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.profile-card > :last-child { margin-bottom: 0 !important; }
.profile-card .profile-identity { margin-top: 0; }
.profile-card .btn-row { justify-content: center; }
body.has-wallpaper .profile-card {
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-color: color-mix(in srgb, var(--border) 60%, transparent);
}
.profile-section-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
/* All/Photos/Videos tabs, centered under the centered profile card. No
   separate "Posts" heading - the tabs already say what's below. */
.profile-posts-head {
  display: flex;
  justify-content: center;
  margin: 4px 0 12px;
}
.profile-posts-head .profile-tabs { margin-bottom: 0; justify-content: center; }
body.has-wallpaper .profile-posts-head:has(#profile-tabs:not([style*="none"])) {
  padding: 8px 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.profile-identity .name { font-size: 1.15rem; font-weight: 700; }
/* Verified badge (renderVerifiedBadge) - brand violet, distinct from the
   Supporter and milestone badges. */
.verified-badge {
  display: inline-flex;
  width: 1.05em;
  height: 1.05em;
  margin-left: 4px;
  vertical-align: -0.15em;
  color: var(--violet-text, var(--violet));
}
.verified-badge svg { width: 100%; height: 100%; }

/* Profile hover card (wavelen-hovercard.js). */
.hover-card {
  position: absolute;
  z-index: 60;
  width: 300px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}
.hover-card-head { display: flex; gap: 12px; align-items: center; }
.hover-card-avatar .avatar-initial-sm { width: 56px; height: 56px; font-size: 1.4rem; }
.hover-card-who { min-width: 0; }
.hover-card-name { display: block; font-weight: 700; font-size: 1.02rem; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.hover-card-name:hover { text-decoration: underline; }
.hover-card-handle { font-size: 0.85rem; color: var(--text-secondary); }
.hover-card-bio {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hover-card-stats { display: flex; gap: 14px; margin-top: 12px; font-size: 0.88rem; color: var(--text-secondary); }
.hover-card-stats strong { color: var(--text); }
.hover-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.hover-card-actions .btn { flex: 1; text-align: center; }
.chip-list.centered { justify-content: center; }

/* "Active now" presence badge - mirrors PresenceTracker.kt's Android UI
   (small green dot + label). Also reused by thread.js's chat header. */
.presence-row { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 0.85rem; color: var(--text-secondary); }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #4CD964; flex-shrink: 0; }
/* Manual profile status swaps the dot for an emoji (profile.js sets
   display:none on .presence-dot and puts "emoji Label" in the text instead)
   rather than needing a second element - the emoji already carries color. */
.presence-hidden-note { color: var(--text-muted); font-size: 0.8rem; }

/* Featured-song visualizer (see profile.js's mountFeaturedVisualizer) -
   fades out on hover and back in on mouse-leave, purely in CSS. */
.featured-visualizer { width: 100%; height: 100px; border-radius: 12px; margin-top: 8px; opacity: 1; transition: opacity 0.25s ease; }
.featured-visualizer:hover { opacity: 0; }

/* Hero media card (#featured-chip-row) - the featured song/clip promoted
   to the profile's first impression, ahead of stats/bio, instead of being
   one small chip among many. Same content as before, just given a card
   and a brand-gradient top edge to read as the centerpiece. */
.hero-media {
  text-align: center;
  padding: 18px 20px 20px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero-media::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
}
.hero-media-label {
  border: none;
  background: none;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.hero-media-label:disabled { color: var(--text-secondary); cursor: default; font-weight: 600; }

/* ---- Profile post grid (renderProfileGridTile) ----
   Column count is the ONE thing profile.layoutId actually changes (mirrors
   ProfileScreen.kt: layoutId only ever picks gridColumns, nothing else) -
   see profile.js for the class picked per grid/magazine/list. */
.profile-grid { display: grid; gap: 2px; }
.profile-grid.layout-grid { grid-template-columns: repeat(3, 1fr); }
.profile-grid.layout-magazine { grid-template-columns: repeat(2, 1fr); }
.profile-grid.layout-list { grid-template-columns: 1fr; }
.profile-grid-tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-variant);
}
.profile-grid-tile img, .profile-grid-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Over a background photo, tiles and chips are frosted glass instead of
   solid cards, so the photo shows through the way it does on Android
   (ProfileScreen.kt's scrim + translucent tiles) rather than being boxed
   out by opaque grey squares. The selected tab keeps its solid fill so
   its gradient border still reads. */
body.has-wallpaper .profile-grid-tile,
body.has-wallpaper #profile-view .chip,
body.has-wallpaper #profile-tabs .visibility-chip:not(.selected) {
  background: color-mix(in srgb, var(--surface-variant) 55%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
/* Light glass needs more fill than dark to keep dark text readable. */
:root[data-theme="light"] body.has-wallpaper .profile-grid-tile,
:root[data-theme="light"] body.has-wallpaper #profile-view .chip,
:root[data-theme="light"] body.has-wallpaper #profile-tabs .visibility-chip:not(.selected) {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}
.tile-video-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.tile-video-badge svg { width: 34px; height: 34px; fill: rgba(255, 255, 255, 0.92); filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5)); }
.tile-multi-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
}
.tile-multi-badge svg { width: 12px; height: 12px; }
.tile-pending-badge { position: absolute; bottom: 6px; left: 6px; }
/* Text-only post's grid tile - mirrors PostGridTile.kt's text-snippet
   fallback so a text post reads as a small note card instead of a blank
   square. .profile-grid-tile's own background (--surface-variant) already
   does the job of a neutral card fill, this just adds the text and clamps
   it so long posts don't overflow the tile. */
.tile-text-snippet {
  position: absolute;
  inset: 0;
  padding: 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

/* ---- Profile "more" menu (Block/Mute) ---- */
.more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.more-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  font-family: inherit;
}
.more-menu-item:hover { background: var(--surface-variant); }
.more-menu-item.danger { color: var(--error-text); }

.btn-danger {
  background: rgba(var(--error-rgb), 0.12);
  color: var(--error-text);
  border: 1px solid rgba(var(--error-rgb), 0.35);
}

/* ---- Modal (delete account confirmation) ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
}
.modal-card h3 { margin: 0 0 10px; font-size: 1.05rem; }
.modal-card p { color: var(--text-secondary); font-size: 0.88rem; margin: 0 0 18px; line-height: 1.5; }

/* ---- Rate/feedback prompt (wavelen-rate-prompt.js) ---- */
.rate-prompt-feedback-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 0 18px;
  border: none;
  background: none;
  color: var(--violet-text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}
.rate-prompt-feedback-link:hover { text-decoration: underline; }

/* ---- Report / flag content dialog (wavelen-report.js) ---- */
.report-reasons { display: flex; flex-direction: column; gap: 2px; }
.report-reason-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  font-size: 0.92rem;
  cursor: pointer;
}
.report-reason-row input { accent-color: var(--violet); width: 16px; height: 16px; flex-shrink: 0; }
.report-reason-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 10px;
  border-radius: 10px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
}
.report-reason-btn:hover, .report-reason-btn:disabled { background: var(--surface-variant); }
.report-reason-btn:disabled { cursor: default; opacity: 0.6; }
.report-details {
  width: 100%;
  min-height: 70px;
  margin-top: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
}
.report-details:focus { outline: 2px solid var(--violet); outline-offset: 1px; border-color: var(--violet); }

/* ---- Photo upload row (avatar/banner) ---- */
.photo-edit-row { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.photo-edit-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--brand-gradient);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
}
.banner-edit-preview {
  width: 100%;
  height: 100px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-variant);
  display: block;
  margin-bottom: 12px;
}
.swatch-row { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--violet); }
.swatch-auto {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.swatch-auto.selected { border-color: var(--violet); border-style: solid; color: var(--text); }

@media (max-width: 480px) {
  .app-header-inner { padding: 10px 16px; }
  .app-main { padding: 16px 12px 88px; }
}

/* ---- Weekly Digest ---- */
.digest-header {
  border-radius: 20px;
  padding: 20px;
  background: var(--brand-gradient);
  color: #fff;
  margin-bottom: 16px;
}
.digest-header svg { width: 22px; height: 22px; stroke: #fff; }
.digest-header h2 { font-size: 1.1rem; font-weight: 700; margin: 10px 0 4px; }
.digest-header p { font-size: 0.85rem; margin: 0; color: rgba(255, 255, 255, 0.85); }
.digest-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.digest-stat-card {
  border-radius: 16px;
  background: var(--surface-variant);
  padding: 16px;
  text-align: left;
  border: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}
.digest-stat-card svg { width: 20px; height: 20px; stroke: var(--violet); margin-bottom: 10px; }
.digest-stat-card .count { display: block; font-size: 1.4rem; font-weight: 700; color: var(--text); }
.digest-stat-card .label { display: block; font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.digest-footnote { font-size: 0.78rem; color: var(--text-secondary); margin-top: 16px; }

/* First-run coach marks - see assets/wavelen-hints.js. Small floating
   callout, positioned via inline top/left set by JS (getBoundingClientRect
   against its target), not part of normal document flow. */
.wavelen-hint-bubble {
  position: absolute;
  z-index: 500;
  max-width: 260px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text);
  /* Thin brand-gradient accent bar on the left, same idea as the
     notification unread bar - reads as "WaveLen tip" at a glance without
     another icon. */
  border-left: 3px solid transparent;
  border-image: var(--brand-gradient) 1;
}
.wavelen-hint-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.wavelen-hint-close:hover { color: var(--text); }

/* One-time policy-change notice (wavelen-policy-notice.js) - inline at the
   top of <main>, not an overlay, so it never covers content or traps focus. */
.policy-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.policy-notice-text { flex: 1 1 260px; }
.policy-notice h2 { margin: 0 0 4px; font-size: 0.95rem; color: var(--text); }
.policy-notice p { margin: 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45; }
.policy-notice-actions { display: flex; gap: 8px; }
.policy-notice-actions .btn { width: auto; padding: 8px 16px; min-height: 44px; }

/* ---- Account status (account-status.html) ---- */
.notice-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.notice-card.highlight { border-color: var(--violet); }
.notice-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.notice-title { font-size: 0.98rem; margin: 0; color: var(--text); }
.notice-time { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.notice-reason { font-size: 0.9rem; margin: 8px 0 0; color: var(--text); }
.notice-excerpt {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--border);
  background: var(--surface-variant);
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.notice-source { font-size: 0.82rem; color: var(--text-secondary); margin: 10px 0 0; }
.notice-status { font-size: 0.88rem; color: var(--text-secondary); margin: 10px 0 0; }
.notice-status.ok { color: var(--cyan-text); }
.notice-card .notice-appeal-btn { margin-top: 12px; }
.notice-appeal-form { margin-top: 12px; }
.notice-appeal-label { display: block; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.notice-appeal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.notice-appeal-actions .btn { width: auto; padding: 9px 18px; }

/* ---- Quiet hours (settings.html) ---- */
.quiet-hours-times { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-start; }
.quiet-hours-times input[type="time"],
#daily-push-cap,
#usage-limit {
  background: var(--surface-variant);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.88rem;
}

/* ---- Profile tabs (profile.html) ---- */
.profile-tabs { margin-bottom: 14px; }

/* ---- Profile pronouns + link (profile.html) ---- */
.profile-pronouns { font-size: 0.85rem; color: var(--text-secondary); margin-top: 2px; }
.profile-link { font-size: 0.9rem; color: var(--violet-text); text-decoration: none; overflow-wrap: anywhere; }
.profile-link::before { content: "\1F517\FE0E  "; }
.profile-link:hover { text-decoration: underline; }
