/* ===========================================================
   ADDAA — Design System
   Concept: "adda" (Bengali/Hindi) = an easy, unhurried gathering
   of friends to talk. The signature visual idea is warm amber
   lamplight glowing against a deep night backdrop — like a
   circle of people talking after dark — rather than the generic
   neon-on-black look. Communities render as a glowing "ring" of
   circular nodes instead of rectangular carousel cards.
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* --- Color tokens ---
     Default theme is now the clean White + Blue look. Every
     component reads colors through these tokens, and the accent
     colors are kept to a single plain-blue family (no deep/navy
     shades) throughout. --- */
  --bg: #eef1f5;
  --bg-elevated: #ffffff;
  --glass: #ffffff;
  --glass-strong: #f3f6fb;
  --border: #dde3ec;
  --border-soft: #e6eaf1;

  --amber: #2f8fff;        /* primary accent — plain blue */
  --amber-soft: #2f8fff33;
  --violet: #2f8fff;       /* secondary accent — same plain blue, no deep/navy variant */
  --violet-soft: #2f8fff33;

  --text: #1c2530;
  --text-dim: #5b6572;
  --text-faint: #8a93a1;

  --danger: #e0453a;
  --success: #1f9d63;

  /* --- Chrome surfaces that previously used literal colors, now
     theme-aware so the header/nav/backdrop follow light/dark too --- */
  --header-glass: rgba(255, 255, 255, 0.85);
  --nav-glass: rgba(255, 255, 255, 0.92);
  --bg-glow: #dce7fb;
  --accent-mid: #62a6ff;
  --amber-dark: #2f8fff;

  /* --- Type --- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* --- Layout --- */
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --shell-max: 1100px;
}

/* ===========================================================
   Dark / amber theme — the original moody lamplight look, now
   opt-in via the header toggle button instead of the default.
   Every component reads colors through the tokens above, so
   overriding them here re-themes the whole site with no other
   changes needed.
   =========================================================== */
[data-theme="dark"] {
  --bg: #0a0a10;
  --bg-elevated: #101018;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.05);

  --amber: #f2a53c;
  --amber-soft: #f2a53c33;
  --violet: #8b6cf2;
  --violet-soft: #8b6cf233;

  --text: #f4f1ea;
  --text-dim: #a7a6ae;
  --text-faint: #6b6a74;

  --danger: #f2593c;
  --success: #5cc98a;

  --header-glass: rgba(10, 10, 16, 0.72);
  --nav-glass: rgba(16, 16, 24, 0.88);
  --bg-glow: #17131c;
  --accent-mid: #ffd48a;
  --amber-dark: #e08a2e;
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .glass {
  box-shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

/* Safety net: the [hidden] attribute must always win over any component's
   own display rule (display:flex/grid components have repeatedly needed
   this called out explicitly — see .modal-backdrop, .story-viewer, etc). */
[hidden] { display: none !important; }

html { overflow-x: hidden; }
body {
  margin: 0;
  overflow-x: hidden;
  max-width: 100vw;
  background: radial-gradient(120% 60% at 50% -10%, var(--bg-glow) 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 78px; /* room for mobile bottom nav */
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

::selection { background: var(--amber-soft); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------------------------------------
   Glass primitive
   --------------------------------------------------------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
/* Fallback for browsers without backdrop-filter support (older mobile
   webviews) so glass cards never render as a near-invisible sliver —
   this is what could make the login card look "broken" on some devices. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: #14141d; }
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--header-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.2px;
  background: linear-gradient(120deg, var(--amber), var(--accent-mid) 55%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  flex-shrink: 0;
}

.header-search {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-dim);
}
.header-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}
.header-search input::placeholder { color: var(--text-faint); }

.header-icons {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--glass-strong); color: var(--text); border-color: var(--border); }
.icon-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 15px; height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--amber);
  color: #1a1206;
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
}

@media (max-width: 640px) {
  .header-search { display: none; }
  .brand { font-size: 19px; }
}

/* ---------------------------------------------------------
   Hamburger menu + side drawer
   --------------------------------------------------------- */
.hamburger-btn { flex-shrink: 0; }

.side-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
}
.side-drawer {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 61;
  width: 78vw;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 14px calc(18px + env(safe-area-inset-bottom));
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-soft);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  box-shadow: 30px 0 60px -20px rgba(0, 0, 0, 0.6);
}
.side-drawer:not([hidden]) { transform: translateX(0); }
.side-drawer-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 10px 20px;
  margin: 0 -14px 12px;
  background:
    radial-gradient(120% 140% at 0% 0%, var(--amber-soft), transparent 60%),
    linear-gradient(120deg, rgba(139, 108, 242, 0.16), rgba(242, 165, 60, 0.12));
  border-bottom: 1px solid var(--border-soft);
}
.side-drawer-head img, .side-drawer-head .avatar-img {
  border: 2.5px solid var(--amber);
  box-shadow: 0 0 16px -2px var(--amber-soft);
}
.side-drawer-head strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(120deg, var(--amber), var(--accent-mid) 55%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.side-drawer-head .username-sub { font-size: 12.5px; color: var(--text-faint); }
.side-drawer a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  transition: background 0.15s, transform 0.15s;
}
.side-drawer a i {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--glass);
  color: var(--amber);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.side-drawer a:hover { background: var(--glass-strong); transform: translateX(2px); }
.side-drawer a:hover i { background: linear-gradient(135deg, var(--amber), var(--violet)); color: #1a1206; }
.side-drawer hr { border: none; border-top: 1px solid var(--border-soft); margin: 10px 4px; }

/* ---------------------------------------------------------
   Shell / layout
   --------------------------------------------------------- */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 20px 16px 40px;
}
@media (max-width: 640px) {
  .shell { padding: 12px 12px 32px; }
}

/* ---------------------------------------------------------
   Community slider — the "Adda Ring"
   Circular glowing nodes rather than rectangular cards, to
   embody "adda": a circle of people gathered to talk.
   --------------------------------------------------------- */
.adda-ring-section { margin-bottom: 22px; }

/* ---------------------------------------------------------
   Home page boxed sections — every home block (stories,
   communities, feed) sits inside its own glass "card" instead
   of floating on the raw background, and fades/lifts in gently.
   --------------------------------------------------------- */
.home-box {
  padding: 16px 14px 10px;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  animation: homeBoxIn 0.35s ease both;
}
@keyframes homeBoxIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.home-box .section-label { margin-left: 2px; }
.home-box.no-label { padding-top: 6px; }
.home-box .adda-ring,
.home-box .story-tray { padding-bottom: 6px; margin-bottom: -6px; }
.feed.home-box-feed { gap: 18px; }
.feed.home-box-feed .post-card { animation: homeBoxIn 0.3s ease both; }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 12px 4px;
}

.adda-ring {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 4px 16px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.adda-ring::-webkit-scrollbar { display: none; }

.adda-node {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 86px;
  text-align: center;
}
.adda-node-glow {
  width: 70px;
  height: 70px;
  margin: 0 auto 8px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 200deg, var(--amber), var(--violet), var(--amber));
  box-shadow: 0 0 22px -4px var(--amber-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.adda-node:hover .adda-node-glow {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 30px -2px var(--amber-soft);
}
.adda-node-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 2px solid var(--bg);
}
.adda-node-img img { width: 100%; height: 100%; object-fit: cover; }
.adda-node-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adda-node-meta {
  font-size: 10px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ---------------------------------------------------------
   Post feed
   --------------------------------------------------------- */
.feed { display: flex; flex-direction: column; gap: 14px; max-width: 620px; margin: 0 auto; }
.feed > .section-label { margin: 4px 0 0 4px; }

.post-card {
  padding: 16px 18px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.feed.home-box-feed .post-card:hover {
  box-shadow: 0 10px 26px -14px rgba(0,0,0,0.35);
  transform: translateY(-1px);
}
.post-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar-img { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
/* min-width:0 lets this flex child actually shrink instead of forcing
   the follow button / timestamp off the row onto their own line — the
   name truncates with an ellipsis instead. */
.post-head-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1 1 auto; overflow: hidden; gap: 2px; }
.post-head-meta > a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name { font-weight: 600; font-size: 14px; }
.username-sub { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 100%; }
.post-meta-line { display: flex; align-items: center; gap: 5px; overflow: hidden; }
.post-meta-line .username-sub { display: inline; }
.post-dot { font-size: 11px; color: var(--text-faint); opacity: 0.6; flex-shrink: 0; }
.verified-badge { color: var(--amber); font-size: 13px; vertical-align: middle; }

/* Admin / Founder tag — small Telegram-style label that sits right
   next to a name, wherever name_with_badge() is used. */
.admin-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1.5px 7px;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.5;
}
.admin-tag-admin {
  background: linear-gradient(120deg, var(--amber), var(--violet));
  color: #fff;
}
.admin-tag-founder {
  background: linear-gradient(120deg, #ffb23c, var(--amber));
  color: #fff;
}

/* Premium blue "Follow" pill shown on post cards for anyone you
   don't already follow — sits between the name block and the menu
   button, sized and aligned to sit right alongside the username line
   rather than stretching to the full (avatar) height of the row. */
.post-follow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  align-self: center;
  flex-shrink: 0;
  height: 22px;
  border: none;
  border-radius: 999px;
  padding: 0 10px 0 8px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  background: linear-gradient(120deg, var(--amber), var(--amber-dark));
  color: #fff;
  box-shadow: 0 4px 14px -4px var(--amber-soft), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: filter 0.15s ease, transform 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.post-follow-btn i { font-size: 9px; }
.post-follow-btn:hover { filter: brightness(1.08); }
.post-follow-btn:active { transform: scale(0.96); }
.post-follow-btn.is-following {
  background: var(--glass-strong);
  color: var(--text-dim);
  box-shadow: none;
  border: 1px solid var(--border);
  height: 22px;
}
.post-follow-btn.is-following:hover { background: var(--glass); color: var(--text); }

/* Below ~420px there isn't room for the follow button's label next to
   a name + tag + timestamp on one line — collapse it to an icon so
   everything still fits on a single row instead of wrapping. */
@media (max-width: 420px) {
  .post-follow-btn span { display: none; }
  .post-follow-btn { width: 22px; height: 22px; padding: 0; border-radius: 50%; }
}

.post-time {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.post-content { font-size: 14.5px; margin: 0 0 10px; white-space: pre-wrap; }

.post-media {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
  display: grid;
  gap: 2px;
}
/* Square media tiles (Instagram-grid style) instead of a tall rounded
   rectangle — each tile is a fixed 1:1 square with a subtle zoom-in on
   hover/tap for a smoother, more polished feel. */
.post-media img, .post-media video {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.post-media.count-1 img, .post-media.count-1 video { aspect-ratio: 1 / 1; }
.post-media:hover img, .post-media:hover video { transform: scale(1.03); }
.post-media.count-2 { grid-template-columns: 1fr 1fr; }
.post-media.count-3 { grid-template-columns: 1fr 1fr; }
.post-media.count-3 > *:first-child { grid-row: span 2; aspect-ratio: auto; height: 100%; }

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.action-btn:hover { background: var(--glass-strong); color: var(--text); }
.action-btn.liked { color: var(--amber); }
.action-btn.liked i { font-weight: 900; }

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(120deg, var(--amber), var(--amber-dark));
  color: #1a1206;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-outline {
  background: var(--glass);
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--glass-strong); }
.btn-ghost { background: none; color: var(--text-dim); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------
   Forms / auth
   --------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  padding-top: calc(48px + env(safe-area-inset-top));
}
.auth-card {
  width: 100%;
  max-width: 330px;
  padding: 26px 20px 22px;
  text-align: center;
  border-radius: 4px !important;
  animation: authCardIn 0.4s ease both;
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #1a1206;
  background: linear-gradient(135deg, var(--amber), var(--violet));
  box-shadow: 0 0 34px -6px var(--amber-soft);
}
.auth-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  margin: 0 0 6px;
}
.auth-tagline { color: var(--text-faint); font-size: 12.5px; margin: 0 0 20px; }

.field-pill { text-align: left; margin-bottom: 12px; }
.field-pill input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-pill input::placeholder { color: var(--text-faint); }
.field-pill input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.field-pill .pill-error { color: #ff9d84; font-size: 12px; margin: 6px 2px 0; }

.auth-card .btn-block { border-radius: 4px; }
.auth-divider { border: none; border-top: 1px solid var(--border-soft); margin: 18px 0 14px; }

.field {
  text-align: left;
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input, .field textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus { border-color: var(--amber); }

.form-error {
  background: rgba(242, 89, 60, 0.12);
  border: 1px solid rgba(242, 89, 60, 0.35);
  color: #ff9d84;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: left;
}
.auth-switch { margin-top: 0; font-size: 13px; color: var(--text-faint); }
.auth-switch a { color: var(--amber); font-weight: 600; }

/* ---------------------------------------------------------
   Mobile bottom nav
   --------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 40;
  display: none;
  justify-content: space-around;
  align-items: center;
  margin: 0 14px calc(14px + env(safe-area-inset-bottom));
  padding: 10px 8px;
  border-radius: 18px;
  background: var(--nav-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.55);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 9px;
  color: var(--text-faint);
  width: 54px;
}
.bottom-nav a i { font-size: 18px; }
.bottom-nav a.active { color: var(--amber); }

@media (max-width: 780px) {
  .bottom-nav { display: flex; }
  body { padding-bottom: 92px; }
}

/* ---------------------------------------------------------
   Story tray states (no-story / viewed rings)
   --------------------------------------------------------- */
.adda-node-glow.no-story {
  background: var(--border);
  box-shadow: none;
  position: relative;
}
.add-story-plus {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--violet));
  color: #1a1206;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border: 3px solid var(--bg);
  box-shadow: 0 0 10px -1px var(--amber-soft);
}
.adda-node-glow.viewed {
  background: var(--border);
  box-shadow: none;
}
.story-node { cursor: pointer; }
.story-node .adda-node-glow {
  width: 74px;
  height: 74px;
  padding: 3px;
  background: conic-gradient(from 200deg, var(--amber), var(--violet), var(--accent-mid), var(--amber));
  box-shadow: 0 0 26px -4px var(--amber-soft), 0 0 14px -6px var(--violet-soft);
  animation: story-ring-pulse 3.2s ease-in-out infinite;
}
.story-node .adda-node-glow.no-story,
.story-node .adda-node-glow.viewed {
  animation: none;
  box-shadow: none;
}
.story-node .adda-node-img { border-width: 3px; }
.story-node:hover .adda-node-glow { transform: translateY(-4px) scale(1.05); }
.story-node .adda-node-name { font-weight: 700; }
@keyframes story-ring-pulse {
  0%, 100% { box-shadow: 0 0 26px -4px var(--amber-soft), 0 0 14px -6px var(--violet-soft); }
  50% { box-shadow: 0 0 34px -2px var(--amber-soft), 0 0 20px -4px var(--violet-soft); }
}

/* ---------------------------------------------------------
   Create Post composer
   --------------------------------------------------------- */
.composer {
  max-width: 620px;
  margin: 0 auto 24px;
  padding: 18px 20px;
  border-radius: 8px !important; /* squared-off composer box, not the big glass radius */
}
.composer-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.composer-head textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
}
.composer-head textarea::placeholder { color: var(--text-faint); }

.media-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 0 52px;
}
.preview-item {
  position: relative;
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.preview-item img, .preview-item video { width: 100%; height: 100%; object-fit: cover; }
.preview-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.composer-attach {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--glass-strong);
  cursor: pointer;
}
.composer-attach:hover { color: var(--amber); }
.visibility-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  border-radius: 999px;
  padding: 8px 10px;
}
.composer-actions .btn { margin-left: auto; }
.composer-error { color: #ff9d84; font-size: 12.5px; margin: 8px 0 0; min-height: 1em; }
.composer-success { color: var(--success); font-size: 12.5px; margin: 8px 0 0; min-height: 1em; }

/* ---------------------------------------------------------
   Edit Profile (standalone page)
   --------------------------------------------------------- */
.edit-profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.edit-profile-head h1 {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}
.edit-profile-media {
  position: relative;
  padding: 0 0 54px;
  margin-bottom: 20px;
  overflow: visible;
}
.edit-cover {
  height: 130px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(135deg, rgba(230,164,74,0.25), rgba(217,138,46,0.12));
  background-size: cover;
  background-position: center;
  position: relative;
}
.edit-avatar-wrap {
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 84px;
  height: 84px;
}
.edit-avatar-wrap img {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-elevated);
  display: block;
}
.edit-avatar-wrap .avatar-edit-btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
}
.edit-profile-section {
  padding: 18px;
  margin-bottom: 16px;
}
.edit-profile-section .field:last-of-type { margin-bottom: 0; }
#edit-username { opacity: 0.6; cursor: not-allowed; }

/* ---------------------------------------------------------
   Full-screen story viewer
   --------------------------------------------------------- */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
}
.story-viewer[hidden] { display: none; }
.story-viewer-bars {
  display: flex;
  gap: 4px;
  padding: 10px 10px 0;
}
.story-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  overflow: hidden;
}
.story-bar-fill { height: 100%; width: 0; background: #fff; }

.story-viewer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #fff;
}
.story-viewer-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.story-viewer-meta { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; font-weight: 600; }
.story-viewer-meta .username-sub { color: rgba(255,255,255,0.6); font-weight: 400; }
/* Right-corner action group: 3-dot menu (owner only) + close button,
   always together at the top-right. Icons only — no round/white
   button chrome, even on hover or tap. */
.story-viewer-head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.story-viewer-head .icon-btn { color: #fff; background: none; border-color: transparent; }
.story-viewer-head .icon-btn:hover,
.story-viewer-head .icon-btn:active,
.story-viewer-head .icon-btn:focus { background: none; border-color: transparent; }

/* 3-dot owner menu (top right): edit caption / delete story */
.story-owner-menu { position: relative; }
.story-dropdown {
  position: absolute; top: 100%; right: 0; z-index: 20;
  background: rgba(28,28,30,0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.story-dropdown button {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: none; color: #fff;
  padding: 10px 14px; font-size: 13px;
}
.story-dropdown button:hover { background: rgba(255,255,255,0.1); }
.story-dropdown button.danger { color: #ff6b6b; }

.story-viewer-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.story-viewer-stage img, .story-viewer-stage video {
  max-width: 100%; max-height: 100%; object-fit: contain;
}

/* Instagram-style tap zones: quick tap skips, press & hold pauses */
.story-tap-zone {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  transition: background 0.15s ease;
}
.story-tap-left { left: 0; }
.story-tap-right { right: 0; }
.story-tap-zone.holding { background: rgba(0,0,0,0.18); }

.story-viewer-caption-wrap { position: relative; }
.story-viewer-caption {
  color: #fff;
  text-align: center;
  font-size: 13.5px;
  padding: 10px 24px;
}
.story-caption-edit { padding: 8px 14px 0; }
.story-caption-edit textarea {
  width: 100%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  resize: none;
  min-height: 56px;
}
.story-caption-edit textarea::placeholder { color: rgba(255,255,255,0.5); }
.story-caption-edit-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 8px 0;
}
.story-caption-edit-actions .btn { padding: 6px 16px; font-size: 12.5px; }

/* Report bar: sits low, above the like/reply footer, others' stories only */
.story-report-bar {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: calc(100% - 28px);
  margin: 4px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  color: rgba(255,255,255,0.8);
  font-size: 12.5px;
  padding: 9px 14px;
}
.story-report-bar:hover { background: rgba(255,255,255,0.14); color: #fff; }
.story-report-bar[hidden] { display: none !important; }

.story-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: none;
  display: none;
  align-items: center; justify-content: center;
  z-index: 5;
}
.story-nav-prev { left: 14px; }
.story-nav-next { right: 14px; }

.story-viewer-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px calc(16px + env(safe-area-inset-bottom));
  position: relative;
}
/* Like button + count grouped and pinned to the right of the footer */
.story-like-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; }
.story-like-btn {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.story-like-btn.liked {
  color: #ff4d6d;
  background: rgba(255,77,109,0.15);
}
.story-like-btn.pop { transform: scale(1.25); }
.story-like-btn[hidden] { display: none !important; }
.story-reply-form[hidden] { display: none !important; }
.story-like-count {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-family: var(--font-mono);
  min-width: 18px;
  flex-shrink: 0;
  cursor: pointer;
}
.story-reply-form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
}
.story-reply-form input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13.5px;
}
.story-reply-form input::placeholder { color: rgba(255,255,255,0.55); }
.story-reply-send {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--amber);
  color: #1a1206;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.story-reply-send:disabled { opacity: 0.5; }
.story-reply-sent {
  position: absolute;
  right: 20px;
  bottom: calc(100% + 6px);
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.story-reply-sent.show { opacity: 1; }

@media (min-width: 640px) {
  .story-viewer { align-items: center; }
  .story-viewer-stage { max-width: 420px; margin: 0 auto; width: 100%; border-radius: var(--radius-lg); }
  .story-nav { display: flex; }
}

/* ---------------------------------------------------------
   Comments & replies
   --------------------------------------------------------- */
.comments-section { margin-top: 4px; }
.comment-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.comment-composer input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 16px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.comment-composer input:focus { border-color: var(--amber); }

.comments-list { display: flex; flex-direction: column; gap: 14px; }
.comment-item { display: flex; gap: 10px; align-items: flex-start; }
.comment-body { flex: 1; min-width: 0; }
.comment-bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: inline-block;
  max-width: 100%;
}
.comment-bubble .user-name { font-size: 12.5px; display: block; margin-bottom: 2px; }
.comment-bubble p { margin: 0; font-size: 13.5px; word-wrap: break-word; }

.comment-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-faint);
}
.comment-meta button {
  background: none; border: none; color: inherit;
  font-size: 11.5px; font-weight: 600; padding: 0;
}
.comment-meta button:hover { color: var(--amber); }

.replies { margin-top: 10px; padding-left: 8px; border-left: 2px solid var(--border-soft); display: flex; flex-direction: column; gap: 10px; }
.reply-item .comment-bubble { padding: 6px 10px; }

.reply-form { display: flex; gap: 8px; margin-top: 8px; }
.reply-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* ---------------------------------------------------------
   Profile — FB-style cover + X-style header/stats
   --------------------------------------------------------- */
.profile-cover { padding: 0 0 20px; overflow: hidden; margin-bottom: 4px; }
.cover-photo {
  height: 180px;
  background: linear-gradient(120deg, var(--violet-soft), var(--amber-soft)), var(--bg-elevated);
  background-size: cover;
  background-position: center;
  position: relative;
}
.cover-edit-btn, .cover-remove-btn {
  position: absolute;
  top: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border: none;
}
.cover-edit-btn { right: 12px; }
.cover-remove-btn { right: 56px; }

.profile-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 0 20px;
  margin-top: -44px;
}
.profile-avatar-wrap { position: relative; }
.profile-avatar-wrap img {
  width: 92px; height: 92px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-elevated);
  background: var(--bg-elevated);
}
.avatar-edit-btn {
  position: absolute;
  bottom: 2px; right: 2px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--amber);
  color: #1a1206;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  cursor: pointer;
  border: 3px solid var(--bg-elevated);
}
.profile-actions { display: flex; gap: 8px; padding-bottom: 6px; max-width: 100%; }
.profile-actions .btn {
  padding: 8px 14px;
  font-size: 13px;
  gap: 6px;
  white-space: nowrap;
}

.profile-info { padding: 14px 20px 0; }
.profile-name { font-family: var(--font-display); font-size: 21px; margin: 0; font-weight: 600; }
.profile-name .user-name { font-size: inherit; font-weight: inherit; font-family: inherit; }
.profile-name .admin-tag { font-size: 11px; padding: 2px 8px; margin-left: 2px; }
.profile-username { color: var(--text-faint); font-size: 13.5px; margin: 2px 0 10px; }
.profile-bio { font-size: 14px; margin: 0 0 10px; white-space: pre-wrap; }
.profile-meta-row {
  display: flex; flex-wrap: wrap; gap: 14px;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 12px;
}
.profile-meta-row a { color: var(--amber); }
.profile-stats { display: flex; gap: 20px; font-size: 13.5px; color: var(--text-dim); }
.profile-stats strong { color: var(--text); font-family: var(--font-mono); font-weight: 600; }
.stat-link { background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.stat-link:hover strong { color: var(--amber); }

.follow-list { max-height: 380px; overflow-y: auto; margin: 0 -8px; }
.follow-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
}
.follow-list-row:hover { background: var(--glass-strong); }
.follow-list-row .follow-list-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.follow-list-row .follow-list-meta a { font-weight: 600; font-size: 13.5px; }
.follow-list-row .btn { padding: 6px 14px; font-size: 12.5px; flex-shrink: 0; }

.profile-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-soft);
  padding: 0 4px;
}
.profile-tabs a {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-faint);
  border-bottom: 2px solid transparent;
}
.profile-tabs a.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ---------------------------------------------------------
   Modal (edit profile, etc.)
   --------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal-card { width: 100%; max-width: 420px; padding: 20px 22px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.modal-head h3 { font-family: var(--font-display); font-weight: 500; margin: 0; }

/* ---------------------------------------------------------
   Messenger — two-pane desktop, stacked mobile
   --------------------------------------------------------- */
.messenger {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: calc(100vh - 140px);
  min-height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  gap: 0;
}
.conv-pane, .chat-pane { border-radius: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-pane { border-right: 1px solid var(--border-soft); }

.conv-pane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
}
.conv-pane-head h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0; }

.conv-search {
  margin: 0 14px 10px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text-faint);
  position: relative;
}
.conv-search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }

/* Generic search bar — communities browse page, community Settings
   members tab, anywhere else a simple search box is needed. */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text-faint);
}
.search-bar input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 13.5px; }
.search-bar:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.user-search-results {
  margin: -4px 14px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  position: relative;
  z-index: 5;
}
.user-search-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.user-search-item:hover { background: var(--glass-strong); }
.user-search-item div { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }

.conversation-list { flex: 1; overflow-y: auto; padding: 4px 8px 10px; }
.conv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.conv-item:hover, .conv-item.active { background: var(--glass-strong); }
.conv-avatar-wrap { position: relative; flex-shrink: 0; }
.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--success); border: 2px solid var(--bg-elevated);
}
.conv-item-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.conv-last-msg { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.conv-time { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.conv-unread { position: static; }

.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-faint); text-align: center; padding: 20px;
}
.chat-empty i { font-size: 30px; margin-bottom: 12px; }
.chat-empty h3 { font-family: var(--font-display); color: var(--text); font-weight: 500; margin: 0 0 4px; }

#chat-active { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
#chat-active[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.chat-back-btn { display: none; }
.chat-head-meta { display: flex; flex-direction: column; line-height: 1.2; }
.chat-settings-btn { margin-left: auto; }

.chat-settings-popover {
  position: absolute;
  top: 54px;
  right: 12px;
  width: 220px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 14px;
  z-index: 20;
  animation: homeBoxIn 0.15s ease both;
}
.chat-settings-title { font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin: 0 0 10px; }
.theme-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.theme-swatch {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.theme-swatch:hover { transform: scale(1.12); }
.theme-swatch.active { border-color: var(--text); }
.theme-custom-row { display: flex; align-items: center; gap: 8px; }
.theme-custom-row input[type="color"] {
  width: 32px; height: 32px; padding: 0; border: none; border-radius: 8px;
  background: none; cursor: pointer;
}
.theme-custom-row label { font-size: 12px; color: var(--text-faint); }

.chat-settings-title-spaced { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }

/* Chat background (wallpaper) picker — visual swatches only, Telegram
   style, no color-name text labels shown in the UI itself. */
.wallpaper-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.wallpaper-swatch {
  width: 40px; height: 40px; border-radius: 10px;
  border: 2px solid transparent; cursor: pointer;
  background: var(--bg-elevated);
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  transition: transform 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}
.wallpaper-swatch:hover { transform: scale(1.08); }
.wallpaper-swatch.active { border-color: var(--text); }
.wallpaper-upload-tile { background: var(--glass-strong); color: var(--amber); }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background-size: cover; background-position: center; background-repeat: no-repeat; transition: background-image 0.2s ease; }
.chat-messages.has-wallpaper .msg-bubble:not(.sticker-msg) { box-shadow: 0 2px 10px rgba(0,0,0,0.25); }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-bubble {
  position: relative;
  max-width: 70%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 16px 16px 16px 4px;
  padding: 9px 13px;
}
.chat-pane {
  /* Per-chat theme color — overridden inline per conversation by
     chat-settings.js; defaults to the amber brand color. */
  --dm-theme: var(--amber);
  --dm-theme-2: #d98a2e;
}
.msg-row.mine .msg-bubble {
  background: linear-gradient(120deg, var(--dm-theme), var(--dm-theme-2));
  color: #1a1206;
  border-radius: 16px 16px 4px 16px;
  border: none;
}
.msg-bubble p { margin: 0; font-size: 13.5px; word-wrap: break-word; white-space: pre-wrap; user-select: none; -webkit-user-select: none; }
.msg-media { max-width: 220px; border-radius: 10px; margin-bottom: 4px; }
.msg-story-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  opacity: 0.85;
  padding-bottom: 7px;
  margin-bottom: 7px;
  border-bottom: 1px solid rgba(127,127,127,0.25);
}
.msg-story-thumb { width: 32px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.msg-time { display: block; font-size: 10px; opacity: 0.6; margin-top: 3px; font-family: var(--font-mono); }
.msg-menu-btn {
  position: absolute; top: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-faint); font-size: 11px;
  display: none; align-items: center; justify-content: center;
  padding: 0;
}
.msg-row.mine .msg-menu-btn { left: -8px; }
.msg-row.theirs .msg-menu-btn { right: -8px; }
.msg-bubble:hover .msg-menu-btn, .msg-bubble.menu-open .msg-menu-btn { display: flex; }

/* Popup rendered into <body> so it can be positioned next to whichever
   bubble was tapped and clamped to stay fully on-screen. */
.msg-menu-popup {
  position: fixed; z-index: 95;
  min-width: 168px;
  padding: 6px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  animation: homeBoxIn 0.12s ease both;
}
.msg-menu-popup button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text-dim);
  padding: 9px 10px; font-size: 13px; border-radius: 8px;
}
.msg-menu-popup button i { width: 14px; text-align: center; font-size: 12px; }
.msg-menu-popup button:hover { background: var(--glass-strong); color: var(--text); }
.msg-menu-popup button.msg-menu-danger { color: var(--danger); }
.msg-menu-popup button.msg-menu-danger:hover { background: rgba(242,89,60,0.12); }

/* Quoted "replying to" tag shown above a message that replied to
   another one, in the same visual family as the story reply tag. */
.msg-reply-tag {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; opacity: 0.85;
  padding: 6px 8px;
  margin-bottom: 7px;
  border-left: 2px solid currentColor;
  border-radius: 4px;
  background: rgba(127,127,127,0.12);
}
.msg-reply-tag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-reply-thumb { width: 26px; height: 26px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }

/* Inline edit mode inside a bubble */
.msg-edit-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.msg-edit-textarea {
  background: rgba(0,0,0,0.18); color: inherit;
  font-size: 13.5px; padding: 7px 9px; min-height: 44px;
}
.msg-edit-actions { display: flex; justify-content: flex-end; gap: 8px; }
.msg-edit-actions button {
  border: none; border-radius: 8px; padding: 5px 10px; font-size: 12px;
}
.msg-edit-save { background: rgba(0,0,0,0.25); color: inherit; font-weight: 600; }
.msg-edit-cancel { background: none; color: inherit; opacity: 0.75; }

/* Sticker messages — no bubble chrome, just the image floating in the row */
.msg-bubble.sticker-msg {
  background: none; border: none; padding: 0; max-width: 46%;
}
.msg-sticker-img { width: 100%; max-width: 140px; display: block; }
.msg-bubble.sticker-msg .msg-time { position: absolute; bottom: -16px; right: 0; opacity: 0.55; }
.msg-row.mine .msg-bubble.sticker-msg .msg-time { text-align: right; }
.msg-row.theirs .msg-bubble.sticker-msg .msg-time { left: 0; right: auto; }

.chat-composer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}
.chat-composer input[type="text"] {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
}
.chat-composer input[type="text"]:focus { border-color: var(--amber); }
.chat-composer #chat-send-btn { color: var(--amber); }
.chat-attach-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px 10px;
  font-size: 12px; color: var(--text-dim);
}
.chat-attach-preview[hidden] { display: none; }
.chat-attach-preview button { background: none; border: none; color: var(--text-faint); }

/* Reply preview shown above the composer while replying to a message */
.reply-preview {
  display: flex; align-items: center; gap: 10px;
  margin: 0 14px 8px;
  padding: 7px 10px;
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  background: var(--glass);
}
.reply-preview[hidden] { display: none; }
.reply-preview-body { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.reply-preview-label { font-size: 11px; font-weight: 600; color: var(--amber); }
.reply-preview-text { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-preview button { background: none; border: none; color: var(--text-faint); flex-shrink: 0; }

/* Sticker button + personal sticker tray */
#sticker-tray-btn { color: var(--text-faint); }
.sticker-tray {
  position: absolute;
  left: 12px; right: 12px;
  bottom: 66px;
  max-height: 240px;
  padding: 10px;
  z-index: 20;
  display: flex; flex-direction: column;
  animation: homeBoxIn 0.15s ease both;
}
.sticker-tray-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  margin-bottom: 8px;
}
.sticker-add-tile {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--glass-strong); color: var(--amber);
  cursor: pointer; font-size: 12px;
}
.sticker-tray-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  overflow-y: auto;
}
.sticker-tray-empty { grid-column: 1 / -1; font-size: 12px; color: var(--text-faint); text-align: center; padding: 10px 4px; }
.sticker-tray-item {
  position: relative; border-radius: 10px; overflow: hidden;
  background: var(--glass); aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 4px;
}
.sticker-tray-item img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sticker-tray-remove {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,0.6); border: none; color: var(--text-faint);
  font-size: 8px; display: flex; align-items: center; justify-content: center;
}
.sticker-tray-remove:hover { color: var(--danger); }

/* Sticker cropper modal */
.sticker-cropper-card { max-width: 380px; }
.sticker-shape-toggle { display: flex; gap: 8px; margin-bottom: 12px; }
.shape-btn {
  flex: 1; padding: 7px 0; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 999px;
  background: none; color: var(--text-faint);
}
.shape-btn.active { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.sticker-crop-stage {
  position: relative;
  width: 100%; height: 300px;
  display: flex; align-items: center; justify-content: center;
  background: #050508; border-radius: var(--radius-sm);
  overflow: hidden;
  touch-action: none;
}
.sticker-crop-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; user-select: none; pointer-events: none; }
.sticker-crop-box {
  position: absolute;
  border: 2px dashed var(--amber);
  background: rgba(242, 165, 60, 0.12);
  box-shadow: 0 0 0 2000px rgba(0,0,0,0.55);
  cursor: move;
  touch-action: none;
}
.crop-handle {
  position: absolute; right: -8px; bottom: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--amber); border: 2px solid #050508;
  cursor: nwse-resize;
  touch-action: none;
}
.sticker-crop-hint { font-size: 11.5px; color: var(--text-faint); margin: 10px 0 0; text-align: center; }
.sticker-crop-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

@media (max-width: 780px) {
  .messenger { grid-template-columns: 1fr; height: calc(100vh - 130px); border-radius: 0; }
  .conv-pane { border-right: none; }
  .chat-pane { display: none; }
  .messenger.chat-open .conv-pane { display: none; }
  .messenger.chat-open .chat-pane {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 60;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    border-radius: 0;
  }
  .chat-back-btn { display: flex; }
  .chat-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .chat-composer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sticker-tray { bottom: calc(66px + env(safe-area-inset-bottom)); }
}

/* Full-screen chat on mobile: bottom nav gets out of the way and the
   composer sits flush with the real bottom of the screen. */
body.chat-view-active .bottom-nav { display: none !important; }
@media (max-width: 780px) {
  body.chat-view-active { padding-bottom: 0; }
}

/* ---------------------------------------------------------
   Communities — browse grid + wall
   --------------------------------------------------------- */
.section-head-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-head-row .btn { font-size: 13px; padding: 9px 16px; }

.community-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.community-card { overflow: hidden; display: block; }
.community-card-cover {
  height: 100px;
  background: linear-gradient(120deg, var(--violet-soft), var(--amber-soft)), var(--bg-elevated);
  background-size: cover; background-position: center;
}
.community-card-body { padding: 14px 16px; }
.community-card-body h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 4px; font-weight: 600; }
.community-card-body p { font-size: 12.5px; color: var(--text-dim); margin: 0 0 10px; }
.community-card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--text-faint); }
.joined-pill {
  background: var(--amber-soft); color: var(--amber);
  padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 11px;
}

/* ---------------------------------------------------------
   Notifications
   --------------------------------------------------------- */
.notif-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  margin-bottom: 8px;
  position: relative;
}
.notif-item.unread { border-color: var(--amber-soft); background: rgba(242,165,60,0.05); }
.notif-type-icon {
  position: absolute;
  left: 38px; bottom: 12px;
  width: 20px; height: 20px;
  background: var(--amber);
  color: #1a1206;
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-elevated);
}
.notif-text { font-size: 13.5px; color: var(--text-dim); line-height: 1.4; }

.post-owner-menu { position: relative; margin-left: auto; flex-shrink: 0; }
.post-owner-dropdown {
  position: absolute; top: 100%; right: 0; z-index: 10;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-width: 110px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.post-owner-dropdown button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-dim);
  padding: 9px 14px; font-size: 13px;
}
.post-owner-dropdown button:hover { background: var(--glass-strong); color: var(--text); }
.post-owner-dropdown .delete-post-btn:hover { color: var(--danger); }

.edit-post-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 12px;
  resize: vertical;
  min-height: 60px;
}

.repost-attribution {
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 600;
  margin: 0 0 8px;
}

/* ---------------------------------------------------------
   Admin panel — premium light/blue "terminal" theme
   --------------------------------------------------------- */
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(120% 60% at 15% -10%, var(--amber-soft) 0%, transparent 45%),
    var(--bg);
}
.admin-sidebar {
  padding: 22px 16px;
  border-radius: 0;
  border-right: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.admin-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}
.admin-sidebar .brand::before {
  content: "";
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--amber), var(--violet));
  box-shadow: 0 4px 14px -3px var(--amber-soft);
  flex-shrink: 0;
}
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 600;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.admin-nav a i { width: 16px; text-align: center; color: var(--text-faint); transition: color 0.15s ease; }
.admin-nav a:hover { background: var(--glass-strong); color: var(--text); }
.admin-nav a.active {
  background: linear-gradient(120deg, var(--amber-soft), transparent);
  color: var(--amber);
}
.admin-nav a.active i { color: var(--amber); }
.admin-nav a.active::before {
  content: "";
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 60%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--amber), var(--violet));
}

.admin-content { padding: 30px 34px 70px; max-width: 1160px; }
.admin-page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-page-title::before {
  content: "";
  width: 5px; height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--amber), var(--violet));
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.admin-stat-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.admin-stat-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber), var(--violet));
  opacity: 0.85;
}
.admin-stat-value { font-family: var(--font-mono); font-size: 27px; font-weight: 700; color: var(--amber); }
.admin-stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }

.admin-search-form { display: flex; gap: 10px; margin-bottom: 18px; max-width: 420px; }
.admin-search-form input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  outline: none;
}
.admin-search-form input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.admin-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tabs a {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--glass);
  border: 1px solid var(--border);
}
.admin-tabs a.active { background: var(--amber-soft); color: var(--amber); border-color: transparent; }

.admin-table-wrap { overflow-x: auto; padding: 6px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.admin-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--glass-strong); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-actions .btn { padding: 6px 12px; font-size: 12px; }
.admin-actions .btn.is-active { background: var(--amber-soft); border-color: transparent; color: var(--amber); }

.admin-quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.admin-quick-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.admin-quick-links a i { color: var(--amber); font-size: 15px; }
.admin-quick-links a:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(0,0,0,0.15); }

/* ---------------------------------------------------------
   Admin — Users, mobile-first card grid (replaces the plain
   table on the Users page: avatar/name/email up top, tags row,
   then a "Tags" toggle that expands into on/off switches so
   Founder / Admin / Blue tic can each be flipped independently). */
.admin-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.admin-user-card { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.admin-user-card-top { display: flex; align-items: center; gap: 12px; }
.admin-user-card-id { display: flex; flex-direction: column; min-width: 0; }
.admin-user-card-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.admin-user-card-fields { display: flex; flex-direction: column; gap: 6px; }
.admin-field {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm, 8px);
  padding: 7px 10px;
}
.admin-field i { color: var(--text-faint); width: 14px; text-align: center; }
.admin-field-row { display: flex; gap: 8px; }
.admin-field-row .admin-field { flex: 1; }
.admin-user-card-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.admin-user-card-actions { display: flex; flex-direction: column; gap: 8px; }
.admin-danger-btn { color: var(--danger); }

/* "Tags" / "Edit" expandable panels — <details>/<summary> so no extra
   JS is needed to open/close them, styled to look like a button. */
.admin-tags-toggle summary {
  list-style: none;
  cursor: pointer;
  width: 100%;
  text-align: center;
}
.admin-tags-toggle summary::-webkit-details-marker { display: none; }
.admin-tags-toggle[open] summary { margin-bottom: 8px; }
.admin-tags-panel { display: flex; flex-direction: column; gap: 8px; }
.admin-tag-switch-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm, 8px);
  padding: 8px 10px;
}
.admin-tag-switch-form span { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }

/* The on/off toggle switch itself */
.tag-switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 999px;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}
.tag-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.tag-switch.is-on { background: linear-gradient(120deg, var(--amber), var(--violet)); }
.tag-switch.is-on .tag-switch-knob { left: 18px; }

.admin-edit-panel { display: flex; flex-direction: column; gap: 8px; }
.admin-edit-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-edit-panel input, .admin-edit-panel textarea {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm, 8px);
  padding: 8px 10px;
}
.admin-edit-panel input:focus, .admin-edit-panel textarea:focus { border-color: var(--amber); outline: none; }

@media (max-width: 640px) {
  .admin-user-grid { grid-template-columns: 1fr; }
}

.admin-toolbar-row { display: flex; justify-content: flex-end; margin-bottom: 16px; }

/* Simple centered modal used by Admin → Communities (Add / Edit / Members) */
.admin-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 200;
}
.admin-modal {
  width: 100%;
  max-width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: var(--radius-md);
}
.admin-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.admin-modal-head h3 { margin: 0; font-size: 16px; }
.admin-modal form { display: flex; flex-direction: column; gap: 10px; }
.admin-modal label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.admin-modal input, .admin-modal textarea {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.admin-members-list { display: flex; flex-direction: column; gap: 8px; }
.admin-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--glass);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.admin-member-id { display: flex; flex-direction: column; line-height: 1.25; flex: 1 1 auto; min-width: 0; }
.admin-member-row .btn { padding: 6px 10px; font-size: 11.5px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-right: 4px; }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-danger { background: rgba(242,89,60,0.15); color: #ff9d84; }
.pill-success { background: rgba(92,201,138,0.15); color: var(--success); }

@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    padding: 12px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .admin-sidebar .brand { margin-bottom: 10px !important; font-size: 18px; }
  .admin-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border);
    font-size: 12.5px;
  }
  .admin-nav a[style] { margin-top: 0 !important; }
  .admin-content { padding: 18px 14px 50px; }
  .admin-page-title { font-size: 20px; margin-bottom: 14px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-stat-card { padding: 14px 16px; }
  .admin-stat-value { font-size: 21px; }
  .admin-quick-links { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-search-form { max-width: 100%; }
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .admin-tabs a { flex-shrink: 0; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 9px 10px; }
}

/* Narrower phones (~360px and under): stat cards and quick links stay
   at a firm 2-per-row instead of squeezing 3 in, so labels/icons keep
   room to breathe. */
@media (max-width: 380px) {
  .admin-stat-grid { gap: 8px; }
  .admin-stat-card { padding: 12px; }
  .admin-stat-value { font-size: 19px; }
  .admin-stat-label { font-size: 11px; }
  .admin-quick-links { gap: 8px; }
  .admin-quick-links a { padding: 12px; font-size: 12.5px; }
}

/* Below ~600px, admin tables collapse into stacked cards instead of
   scrolling sideways — each row becomes a card, each cell gets a
   small label pulled from data-label="…" on the <td>. */
@media (max-width: 600px) {
  .admin-table-wrap { padding: 0; }
  .admin-table thead { display: none; }
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
  .admin-table tr {
    background: var(--glass);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    padding: 4px 2px;
  }
  .admin-table td {
    border-bottom: none;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: right;
  }
  /* Content-preview cells (comment/post text, report reason) had a
     fixed px max-width for the desktop table layout — on the stacked
     mobile card layout that forces a narrow column and wraps oddly,
     so let them use the full row width instead. */
  .admin-table td[style*="max-width"] { max-width: 100% !important; }
  .admin-table td::before {
    content: attr(data-label);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-faint);
    text-align: left;
    flex-shrink: 0;
  }
  .admin-table td.admin-actions-cell { flex-direction: column; align-items: stretch; text-align: left; }
  .admin-table td.admin-actions-cell::before { margin-bottom: 6px; }
  .admin-table .admin-actions { justify-content: flex-start; }
  .admin-table .admin-actions form { flex: 1 1 auto; }
  .admin-table .admin-actions .btn { width: 100%; }
}

/* ---------------------------------------------------------
   Empty states
   --------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty-state i { font-size: 28px; margin-bottom: 12px; color: var(--text-dim); }
.empty-state h3 { font-family: var(--font-display); color: var(--text); margin: 0 0 6px; font-weight: 500; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------------------------------------------------------
   Community board — global admin/founder announcements
   --------------------------------------------------------- */
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 4px 16px;
}
.board-head h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  margin: 0;
  display: flex; align-items: center; gap: 10px;
  color: var(--amber);
}
.live-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
}
.live-pill i { font-size: 6px; color: var(--success, #3ddc84); }

.board-composer { max-width: 100%; }
.board-composer textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  resize: vertical;
  outline: none;
}
.board-composer textarea::placeholder { color: var(--text-faint); }

.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.board-font-select {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.board-style-btn {
  background: var(--glass-strong);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  width: 34px; height: 34px;
  font-size: 12px;
  cursor: pointer;
}
.board-style-btn.active { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }

.record-btn { border: none; cursor: pointer; font-family: inherit; }
.record-btn.recording { color: #ff5c4d; background: rgba(255, 92, 77, 0.14); }
.record-status {
  color: #ff5c4d;
  font-size: 12px;
  font-family: var(--font-mono);
  margin: 8px 0 0 2px;
}
.audio-preview-item {
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-strong);
  color: var(--amber);
  font-size: 22px;
}
#board-audio-preview, #post-media-input + audio { width: 100%; margin-top: 10px; }
audio.board-voice-note { width: 100%; margin: 4px 0 10px; height: 38px; }

.role-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
  margin-left: 2px;
}
.role-founder { background: rgba(242, 165, 60, 0.18); color: var(--amber); }
.role-admin { background: var(--violet-soft); color: var(--violet); }

.board-post { position: relative; }
.board-delete-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 6px;
  border: none;
  background: rgba(255, 92, 77, 0.14);
  color: #ff5c4d;
  font-size: 12.5px;
  cursor: pointer;
  z-index: 2;
}
.board-post .post-head { padding-right: 34px; }
.board-post .post-head-meta { flex-direction: row; align-items: center; gap: 4px; }

.reaction-bar {
  display: flex;
  gap: 4px;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border-soft);
}
.reaction-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
}
.reaction-btn:hover { background: var(--glass-strong); }
.reaction-btn.active { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.reaction-emoji { font-size: 14px; }
