/* Pepcels - forum theme
   ------------------------------------------------------------------ */

/* Dark is the default theme; <html data-theme="light"> flips every token below. */
:root,
:root[data-theme="dark"] {
  --bg: #0b0b0d;
  --bg-deep: #08080a;
  --panel: #1a1a1e;
  --panel-alt: #17171b;
  --panel-head: #232329;
  --row: #1e1e23;
  --row-alt: #1b1b20;
  --row-hover: #26262d;
  --line: #2c2c34;
  --line-soft: #24242b;

  --text: #d7d7de;
  --text-strong: #f2f2f5;
  --muted: #8a8a95;
  --link: #9db6e8;
  --link-hover: #c3d3f5;
  --username: #c8b7e8;
  --username-staff: #e6a23c;

  --input-bg: #131317;
  --control: #22222a;
  --control-alt: #1f242e;
  --control-alt-hover: #262c38;
  --code-bg: #101014;
  --spoiler-bg: #303039;
  --icon-muted: #6f7a8d;
  --avatar-light: 42%;
  --danger: #e07070;
  --tint: rgba(255, 255, 255, 0.03);
  --hover-tint: rgba(255, 255, 255, 0.05);

  --accent: #2f68c4;
  --accent-hover: #3a79dc;
  --accent-soft: rgba(47, 104, 196, 0.16);

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.45);

  --shell: 1180px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  /* Geometric, near-circular bowls — the wordmark look. Century Gothic ships with
     Windows/Office, Futura and Avenir Next cover macOS, URW Gothic covers Linux. */
  --font-brand: "Century Gothic", "URW Gothic", "Questrial", "Poppins", Futura, "Avenir Next",
    "Trebuchet MS", "Segoe UI", sans-serif;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #eceef2;
  --bg-deep: #ffffff;
  --panel: #ffffff;
  --panel-alt: #f5f6f9;
  --panel-head: #e8eaf0;
  --row: #ffffff;
  --row-alt: #f7f8fa;
  --row-hover: #f0f2f7;
  --line: #d5d9e2;
  --line-soft: #e3e6ed;

  --text: #33383f;
  --text-strong: #14171d;
  --muted: #6b7280;
  --link: #2559ab;
  --link-hover: #17408a;
  --username: #6b4bb0;
  --username-staff: #9a6412;

  --input-bg: #ffffff;
  --control: #eef0f5;
  --control-alt: #e8ecf5;
  --control-alt-hover: #dde3f0;
  --code-bg: #f3f4f7;
  --spoiler-bg: #d9dce3;
  --icon-muted: #7c8697;
  --avatar-light: 46%;
  --danger: #c0392b;
  --tint: rgba(20, 23, 29, 0.04);
  --hover-tint: rgba(20, 23, 29, 0.05);

  --accent: #2f68c4;
  --accent-hover: #2559ab;
  --accent-soft: rgba(47, 104, 196, 0.12);

  --shadow: 0 1px 2px rgba(20, 23, 29, 0.08);

  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3 { margin: 0; color: var(--text-strong); font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.dot { color: var(--muted); margin: 0 5px; }
.lede { color: var(--text); font-size: 15px; margin-bottom: 16px; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------ header/nav */

.site-header {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line-soft);
}
.site-header-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 18px 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: block; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-name {
  display: block;
  font-family: var(--font-brand);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text-strong);
  line-height: 1;
  font-feature-settings: "kern" 1;
}
.brand-accent { color: var(--accent-hover); }
.brand-tagline {
  display: block;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 4px;
}

.header-links { display: flex; align-items: center; gap: 10px; }
.header-links a {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--control);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  padding: 0;
  line-height: 0;
}
.header-links a svg { width: 17px; height: 17px; display: block; }
.header-links a:hover { background: var(--accent); color: #fff; text-decoration: none; border-color: transparent; }

/* Visually hidden, still read by screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------ theme toggle */

.theme-toggle {
  width: 36px;
  height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--control);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 0;
}
.theme-toggle:hover { background: var(--accent); color: #fff; border-color: transparent; }
.theme-toggle svg { width: 17px; height: 17px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.navbar { background: var(--panel-head); border-bottom: 1px solid var(--line); }
.nav-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
/* Dropdowns (account menu, bell menu) anchor here, not to their own small trigger — on a
   wrapping mobile nav the trigger can sit far from the true right edge, which would push a
   wide `right: 0` dropdown off the left side of the screen. Anchoring to this wider container
   instead keeps them within the visible header. */
.nav-right { position: relative; }
.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.nav-item:hover { background: var(--tint); color: var(--text-strong); text-decoration: none; }
.nav-item.is-active { color: var(--text-strong); border-bottom-color: var(--accent-hover); background: var(--hover-tint); }
.nav-item--cta { color: var(--link-hover); }
.nav-icon { width: 16px; height: 16px; opacity: 0.75; }
.nav-badge {
  background: #3f9142;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 5px;
}

/* DECISIONS D37: the notification bell — icon-only nav-right link with the same badge chip
   the Messages nav item uses. First click (app.js) opens a preview dropdown instead of
   navigating; a second click (menu already open, so JS lets the default through) follows the
   link to /notifications. No JS: it's a plain link straight to the full page. */
/* Deliberately no position: relative here — the dropdown anchors to .nav-right instead (see
   above), so it doesn't overflow off-screen when this trigger isn't near the true right edge
   on mobile. */
.nav-bell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  color: var(--text);
  border-radius: var(--radius);
}
.nav-bell:hover { background: var(--tint); color: var(--text-strong); text-decoration: none; }
.nav-bell svg { width: 18px; height: 18px; }
.nav-bell-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 320px;
  max-width: 90vw;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  padding: 10px 0;
  z-index: 40;
}
.nav-bell-menu-head { font-weight: 600; color: var(--text-strong); padding: 4px 14px 8px; }
.nav-bell-menu .notification-list { max-height: 340px; overflow-y: auto; }
.nav-bell-menu .notification-row > a,
.nav-bell-menu .notification-row .notification-static { padding: 10px 14px; }
.notification-empty { padding: 10px 14px; }
.nav-bell-viewall {
  display: block;
  text-align: center;
  padding: 9px 0 2px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  color: var(--link);
  font-size: 13px;
}
.nav-bell-viewall:hover { color: var(--link-hover); text-decoration: none; }

.nav-search { display: flex; align-items: center; margin-left: 8px; }
.nav-search input {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text);
  padding: 6px 10px;
  width: 150px;
  font-size: 13px;
}
.nav-search input:focus { outline: none; border-color: var(--accent); }
.nav-search button {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  padding: 6px 9px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.nav-search button svg { width: 15px; height: 15px; }
.nav-search button:hover { color: var(--text-strong); }

/* account dropdown — deliberately no position: relative on .account itself; the dropdown
   anchors to .nav-right instead (see above), so it doesn't overflow off-screen when this
   trigger isn't near the true right edge on mobile. */
.account-summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  color: var(--text);
  border-radius: var(--radius);
}
.account-summary::-webkit-details-marker { display: none; }
.account-summary:hover { background: var(--hover-tint); }
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  padding: 14px;
  z-index: 40;
}
.account-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.account-head strong { display: block; color: var(--text-strong); }
.account-stats { display: flex; gap: 18px; margin: 0 0 12px; }
.account-stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.account-stats dd { margin: 0; color: var(--text-strong); font-weight: 600; }
.account-menu a, .account-menu .linklike {
  display: block;
  padding: 7px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--link);
  background: none;
  border-left: 0; border-right: 0; border-bottom: 0;
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.account-menu a:hover, .account-menu .linklike:hover { color: var(--link-hover); text-decoration: none; }

/* ------------------------------------------------------------------ shell */

.shell { max-width: var(--shell); margin: 0 auto; padding: 16px; }
.shell--wide { max-width: 1400px; }

.breadcrumb { margin-bottom: 12px; }
.breadcrumb ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 10px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: 13px;
}
.breadcrumb li + li::before { content: "\203A"; color: var(--muted); margin-right: 6px; }
.breadcrumb span { color: var(--muted); }

.action-bar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  /* DECISIONS D39: a button's own label should never wrap to a second line — on a narrow
     screen with several buttons in a row (e.g. .action-bar), a squeezed flex:1 width used to
     wrap "Post thread" onto two lines, ballooning that one button's height past its siblings'. */
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); color: #fff; }
.btn--ghost { background: var(--control-alt); color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--control-alt-hover); color: var(--text-strong); }
.btn--disabled { background: var(--control); color: var(--muted); cursor: not-allowed; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
.layout--full { grid-template-columns: minmax(0, 1fr); }
.main-column { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.side-column { display: flex; flex-direction: column; gap: 14px; }

/* ------------------------------------------------------------ categories */

.category {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.category + .category { margin-top: 14px; }
.category-head {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  background: var(--panel-head);
  color: var(--text-strong);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.category-head::-webkit-details-marker { display: none; }
.chevron { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s ease; }
.category[open] .chevron { transform: rotate(180deg); }

.forum-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 130px 300px;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.forum-row:last-child { border-bottom: 0; }
.forum-row:hover { background: var(--row-hover); }
.forum-icon-cell { display: grid; place-items: center; color: var(--icon-muted); }
.forum-icon { width: 30px; height: 30px; }
.forum-main { min-width: 0; }
.forum-title { font-size: 15px; }
.forum-title a { color: var(--text-strong); font-weight: 600; }
.forum-desc { color: var(--muted); font-size: 13px; margin: 3px 0 0; }
.subforums {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  counter-reset: sub;
}
.subforums a { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--link); }
.subforums .forum-icon { width: 14px; height: 14px; opacity: 0.65; }

.forum-stats { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.forum-stats > div { display: flex; justify-content: space-between; gap: 8px; }
.stat-label { color: var(--muted); }
.stat-value { color: var(--text-strong); font-weight: 600; }

.forum-last { min-width: 0; }
.last-post { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.last-post--empty { color: var(--muted); font-size: 12.5px; }
.last-post-body { min-width: 0; }
.last-post-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.last-post-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* --------------------------------------------------------------- panels */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel.narrow { max-width: 460px; margin: 0 auto; width: 100%; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  background: var(--panel-head);
  border-bottom: 1px solid var(--line);
}
.panel-meta { color: var(--muted); font-size: 12.5px; }
.panel-body { padding: 16px; }
.panel-body--flush { padding: 0; }
.panel-link { display: inline-block; margin-top: 10px; font-size: 12.5px; }
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 6px 11px; border-radius: var(--radius); font-size: 13px; color: var(--text); }
.tab:hover { background: var(--row-hover); text-decoration: none; }
.tab.is-active { background: var(--accent); color: #fff; }
.inline-search { display: flex; gap: 6px; }
.inline-search input {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
}

/* --------------------------------------------------------------- threads */

.forum-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 4px 2px 6px;
}
.forum-header-icon { color: var(--icon-muted); }
.forum-header-icon .forum-icon { width: 34px; height: 34px; }

.thread-group-label {
  padding: 8px 16px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.thread-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 140px 150px 42px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: var(--row-hover); }
.thread-row.is-sticky { background: rgba(47, 104, 196, 0.06); }
.thread-line { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 14.5px; }
.thread-title { color: var(--text-strong); font-weight: 600; }
.thread-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.thread-stats { font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.thread-stats > div { display: flex; justify-content: space-between; gap: 6px; }
.thread-last { font-size: 12.5px; text-align: right; }
.thread-last-time { color: var(--text); }
.thread-last-user { color: var(--muted); }
.thread-last-avatar { display: grid; place-items: center; }
.flag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 5px;
}

/* prefixes */
.prefix {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  color: #fff;
  line-height: 1.5;
}
.prefix:hover { text-decoration: none; filter: brightness(1.12); color: #fff; }
.prefix--green { background: #2f8f4e; }
.prefix--emerald { background: #17795e; }
.prefix--teal { background: #1c7c86; }
.prefix--blue { background: #2f68c4; }
.prefix--indigo { background: #4b53c8; }
.prefix--purple { background: #7145c9; }
.prefix--pink { background: #b8397f; }
.prefix--red { background: #c0392b; }
.prefix--crimson { background: #97231d; }
.prefix--orange { background: #b96a20; }
.prefix--slate { background: #4a5162; }

/* ----------------------------------------------------------------- posts */

.thread-header { padding: 4px 2px 2px; }
.thread-header h1 { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 21px; }
.thread-header-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.mod-bar { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
/* DECISIONS D41: one shared small-action-button look — mod-bar (Pin/Lock/Feature/Delete
   thread), any bare .inline-form button (session Revoke, avatar Remove, Deactivate account,
   admin-table actions), and the post footer's React/Quote both share this now, instead of the
   post footer using a full pill shape while everything else used a smaller corner radius —
   visibly mismatched when they sit in the same row (React · Quote · Delete). .btn/.btn--primary
   (Post reply, Post thread, Save profile, etc.) are deliberately unchanged — a distinct,
   more prominent style for the actual primary action on a page, not an inconsistency to fix. */
.mod-bar button, .inline-form button, .react-btn, .quote-btn, .edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--control);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.mod-bar button:hover, .inline-form button:hover { background: var(--row-hover); }
.inline-form { display: inline; }
.danger-link { color: var(--danger) !important; }

.data-table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table th { color: var(--muted); font-weight: 600; }

.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.status-dot.status-good { background: #2f8f4e; }
.status-dot.status-warn { background: #b96a20; }
.status-dot.status-bad { background: var(--danger); }

.audit-detail {
  display: block;
  max-width: 320px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.post-list { display: flex; flex-direction: column; gap: 12px; }
.post {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.post-user {
  padding: 16px;
  background: var(--panel-alt);
  border-right: 1px solid var(--line-soft);
  text-align: center;
}
.post-user .avatar { margin: 0 auto 10px; }
.post-user-name { font-weight: 600; }
.post-user-title { color: var(--muted); font-size: 12px; margin-top: 2px; }
.post-user-stats { margin: 12px 0 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.post-user-stats > div { display: flex; justify-content: space-between; }
.post-user-stats dt { color: var(--muted); }
.post-user-stats dd { margin: 0; color: var(--text); }

.post-body { display: flex; flex-direction: column; min-width: 0; }
.post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
}
.post-head-left { display: inline-flex; align-items: center; gap: 6px; }
.post-edited { color: var(--muted); font-style: italic; }
.post-number { color: var(--muted); }
.post-content { padding: 16px; font-size: 14.5px; line-height: 1.62; word-wrap: break-word; flex: 1; }
.mention { color: var(--accent); font-weight: 600; }
.mention:hover { color: var(--link-hover); }
.post-content blockquote {
  margin: 10px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: var(--tint);
  color: var(--text);
}
.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
}
.post-content code { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.spoiler { background: var(--spoiler-bg); color: transparent; border-radius: 3px; padding: 0 4px; cursor: pointer; }
.spoiler.is-open, .spoiler:hover { color: var(--text); }
.post-signature {
  margin: 0 16px;
  padding: 10px 0 0;
  border-top: 1px dashed var(--line-soft);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
.post-signature p { margin: 0; }

.post-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-alt);
}
.react-btn svg { width: 14px; height: 14px; }
.react-btn:hover:not([disabled]), .quote-btn:hover { background: var(--row-hover); }
.react-btn.is-active { background: var(--accent-soft); border-color: var(--accent); color: var(--link-hover); }
.react-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.edit-btn:hover { background: var(--row-hover); }

/* DECISIONS D42: inline post editing swaps .post-content for this form in place — no page
   navigation, matches the quote button's "stay on the page" feel. */
.post-edit-form { padding: 16px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.post-edit-form textarea {
  width: 100%; min-height: 120px; resize: vertical; font: inherit;
  padding: 10px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-alt); color: var(--text);
}

/* DECISIONS D42: a <details> popover, same zero-JS pattern as the navbar account menu
   (.account-menu above) — no click-handler needed to open/close it. */
.report-widget { position: relative; display: inline-block; }
.report-widget > summary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--control); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
  list-style: none;
}
.report-widget > summary::-webkit-details-marker { display: none; }
.report-widget > summary:hover { background: var(--row-hover); }
.report-form {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  width: 260px; display: flex; flex-direction: column; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); padding: 12px;
}
.report-form textarea {
  width: 100%; resize: vertical; font: inherit; padding: 6px 8px;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-alt); color: var(--text);
}

.thread-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: flex-start; }

.reply-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.reply-form h2 { margin-bottom: 10px; }

/* ----------------------------------------------------------------- forms */

.stacked-form { display: flex; flex-direction: column; gap: 14px; }
.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .grow { flex: 1 1 260px; }
.attachment-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.attachment-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.attachment-status { font-size: 12.5px; color: var(--muted); }

.avatar-field { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar-field-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avatar-upload-btn { cursor: pointer; }
.avatar-status { font-size: 12.5px; }
.post-attachment { margin: 10px 0; }
.post-attachment img { max-width: 100%; max-height: 480px; border-radius: 8px; display: block; }
input[type="text"], input[type="password"], input[type="search"], select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  width: 100%;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.form-hint { color: var(--muted); font-size: 12.5px; }

.notice {
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-alt);
  margin-bottom: 12px;
  font-size: 13.5px;
}
.notice--success { border-color: #2f8f4e; background: rgba(47, 143, 78, 0.12); }
.notice--error { border-color: #c0392b; background: rgba(192, 57, 43, 0.12); }
.notice--warn { border-color: #b96a20; background: rgba(185, 106, 32, 0.12); }
.notice--info { border-color: var(--accent); background: var(--accent-soft); }

/* -------------------------------------------------------------- sidebar */

.mini-threads { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.mini-thread { display: flex; gap: 10px; }
.mini-thread-body { min-width: 0; }
.mini-thread-title { font-size: 13px; line-height: 1.35; }
.mini-thread-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.mini-forum { font-size: 11.5px; }

.stat-list { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.stat-list > div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.stat-list dt { color: var(--muted); }
.stat-list dd { margin: 0; color: var(--text-strong); font-weight: 600; }

.online-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.online-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* -------------------------------------------------------------- members */

.member-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.member-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.member-card-body { min-width: 0; }
.member-name { font-weight: 600; }
.member-title, .member-joined { color: var(--muted); font-size: 12px; }
.member-stats { display: flex; gap: 14px; margin: 6px 0; }
.member-stats dt { color: var(--muted); font-size: 11px; }
.member-stats dd { margin: 0; font-size: 13px; color: var(--text-strong); font-weight: 600; }

.profile-head { display: flex; gap: 18px; align-items: center; padding: 18px; }
.profile-title { color: var(--muted); margin: 4px 0; }
.role-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-stats {
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel-alt);
}
.profile-stats dt { color: var(--muted); font-size: 12px; }
.profile-stats dd { margin: 0; font-size: 17px; font-weight: 600; color: var(--text-strong); }
.profile-bio { padding: 14px 18px; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.55; }
.profile-bio p:first-child { margin-top: 0; }
.profile-bio p:last-child { margin-bottom: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

/* DECISIONS D37: notifications list — after .plain-list so gap: 0 actually wins the cascade. */
.notification-list { gap: 0; }
.notification-row { border-bottom: 1px solid var(--line-soft); }
.notification-row:last-child { border-bottom: 0; }
.notification-row > a,
.notification-row .notification-static { display: flex; gap: 12px; padding: 12px 6px; align-items: flex-start; }
.notification-row > a { color: var(--text); }
.notification-row > a:hover { background: var(--tint); text-decoration: none; }
.notification-row.is-unread { background: var(--hover-tint); }
.notification-glyph { flex: none; font-size: 17px; line-height: 1.3; }
.notification-body time { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.username { color: var(--username); font-weight: 500; }
.username.is-staff { color: var(--username-staff); }
/* Subscriber tier styling (Silver/Gold perks) — coloured username, Gold gets a badge too
   ("enhanced visibility in channels"). Staff colour still wins if both apply. */
.username.is-silver:not(.is-staff) { color: #b8c0cc; font-weight: 600; }
.username.is-gold:not(.is-staff) { color: #e0a940; font-weight: 600; }
.tier-badge { display: inline-block; margin-left: 2px; font-size: 0.85em; }
.tier-badge--gold { color: #e0a940; }

/* DECISIONS D31: one-off "Creator" styling — always wins over staff/tier colour (placed last
   in source order, same specificity, so the cascade resolves in its favour) since it's a
   distinct top-level identity marker, not a privilege tier. */
.username.is-creator {
  background: linear-gradient(90deg, #ff7ad9, #8f7bff, #4fd6e6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.tier-badge--creator { filter: none; }

.profile.profile--creator .profile-head {
  background: linear-gradient(120deg, rgba(255, 122, 217, 0.16), rgba(143, 123, 255, 0.16), rgba(79, 214, 230, 0.16));
  border-bottom: 1px solid var(--line);
}
.profile--creator h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile--creator .tier-badge--creator {
  font-size: 0.5em;
  font-weight: 600;
  background: linear-gradient(90deg, #ff7ad9, #8f7bff, #4fd6e6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  vertical-align: middle;
}

/* DECISIONS D35: "Contributor" — a distinct, cosmetic-only status, scoped to the profile page
   only (no username styling on posts/chat/member-list, unlike Creator). Blue/teal so it reads
   as visually distinct from Creator's pink/purple/cyan gradient. */
.tier-badge--contributor { filter: none; }
.profile.profile--contributor .profile-head {
  background: linear-gradient(120deg, rgba(79, 156, 230, 0.16), rgba(79, 214, 200, 0.16));
  border-bottom: 1px solid var(--line);
}
.profile--contributor h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile--contributor .tier-badge--contributor {
  font-size: 0.5em;
  font-weight: 600;
  background: linear-gradient(90deg, #4f9ce6, #4fd6c8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  vertical-align: middle;
}

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: var(--radius);
  flex: none;
  font-weight: 700;
  color: #fff;
  background: hsl(var(--avatar-hue, 250) 34% var(--avatar-light));
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  object-fit: cover;
}

/* ----------------------------------------------------------------- chat */

.chat-panel { display: flex; flex-direction: column; }
.chat-log {
  height: 460px;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-log:empty::before {
  content: attr(data-empty);
  color: var(--muted);
  margin: auto;
}
.chat-msg, .dm-msg { display: flex; gap: 10px; }
.chat-msg-head, .dm-msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; }
.chat-msg-head time, .dm-msg-head time { color: var(--muted); font-size: 11.5px; }
.chat-msg-text, .dm-msg-text { font-size: 14px; word-wrap: break-word; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel-alt); }
.chat-panel .notice, .dm-panel .notice { margin: 12px 16px; }

/* DECISIONS D29: private messaging — .dm-panel reuses .chat-panel's layout rules above via
   the combined selectors; only the inbox list and the profile "Message" button need new CSS. */
.dm-panel { display: flex; flex-direction: column; }
.conversation-list { display: flex; flex-direction: column; gap: 2px; }
.conversation-row a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.conversation-row a:hover { background: var(--row-hover); }
.conversation-row.is-unread a { background: var(--panel-alt); font-weight: 600; }
.conversation-row-body { flex: 1; min-width: 0; }
.conversation-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
/* DECISIONS D39: the name is a <span> here, not a link (see userLink's asSpan) — this row is
   already one big clickable link to the conversation, and a nested <a> is invalid HTML that
   silently broke the whole row's layout. min-width: 0 + ellipsis so a long name shrinks
   instead of pushing the timestamp off the edge on a narrow screen. */
.conversation-row-head .username { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row-head time { flex: none; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.conversation-row-preview {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-message-form { margin-top: 8px; }

/* --------------------------------------------------------------- upgrade */

.tier-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.tier {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tier--featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.tier-price { font-size: 22px; font-weight: 700; color: var(--text-strong); }
.tier-note { color: var(--muted); font-size: 12.5px; }
.tier-perks { list-style: none; margin: 8px 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.tier-perks li::before { content: "\2713"; color: #4caf72; margin-right: 8px; }
.tier .btn { justify-content: center; margin-top: auto; }

/* ----------------------------------------------------------------- rules */

.rules-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 14px; }
.rules-list h3 { font-size: 14.5px; }
.rules-list p { color: var(--muted); margin: 3px 0 0; }

.legal-doc h3 { font-size: 15.5px; margin: 26px 0 8px; }
.legal-doc h3:first-of-type { margin-top: 10px; }
.legal-doc p { margin: 0 0 10px; line-height: 1.55; }
.form-legal { font-size: 12.5px; margin-top: 10px; }
.faq { border-bottom: 1px solid var(--line-soft); padding: 10px 0; }
.faq:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--text-strong); }
.faq p { color: var(--muted); margin-top: 8px; }

.result { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.result:first-child { padding-top: 0; }
.result:last-child { border-bottom: 0; padding-bottom: 0; }
.result-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------ empty/pages */

.empty { padding: 44px 20px; text-align: center; }
.empty-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-head);
  color: var(--muted);
}
.empty-icon { width: 26px; height: 26px; }
.empty-title { color: var(--text-strong); font-weight: 600; margin: 0; }
.empty-hint { color: var(--muted); margin-top: 6px; }

.pagination { display: flex; gap: 5px; flex-wrap: wrap; }
.page-link {
  padding: 6px 11px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}
.page-link:hover { background: var(--row-hover); text-decoration: none; }
.page-link.is-current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --------------------------------------------------------- confirm dialog */

.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 200;
}
.confirm-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  padding: 22px;
  max-width: 420px;
  width: 100%;
}
.confirm-box p { color: var(--text-strong); font-size: 15px; margin-bottom: 18px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn--danger { background: #c0392b; color: #fff; }
.btn--danger:hover { background: #d0473a; color: #fff; }

/* ------------------------------------------------------- curated forums */

.curated-tag {
  margin-left: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--accent);
  border-radius: 3px;
  padding: 2px 7px;
  vertical-align: middle;
}
.curated-notice {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.curated-notice h2 { margin-bottom: 6px; }
.curated-notice p { color: var(--muted); margin-bottom: 12px; max-width: 62ch; }
.curated-notice strong { color: var(--text); }
.curated-icon { color: var(--accent-hover); }
.curated-icon .forum-icon { width: 34px; height: 34px; }

/* ----------------------------------------------------------- submissions */

.mode-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.mode-option {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-alt);
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
}
.mode-option.is-active { border-color: var(--accent); background: var(--accent-soft); }
.mode-option input { width: auto; margin-top: 2px; }
.mode-option strong { color: var(--text-strong); }
.mode-panel { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.mode-panel[hidden] { display: none; }

.submission-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.submission {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px;
  background: var(--panel-alt);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.submission + .submission { margin-top: 0; }
.submission--review + .submission--review { margin-top: 10px; }
.submission-main { min-width: 0; flex: 1; }
.submission-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.submission-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.submission-note {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--line);
  color: var(--text);
  font-size: 13px;
}
.submission-preview { margin-top: 10px; }
.submission-preview summary { cursor: pointer; color: var(--link); font-size: 13px; }
.submission-preview .post-content { padding: 12px 0 0; }
.submission-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.submission-actions input { width: 170px; padding: 7px 10px; font-size: 13px; }

.status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status--pending { background: rgba(185, 106, 32, 0.18); color: #d08a3a; border: 1px solid #b96a20; }
.status--approved { background: rgba(47, 143, 78, 0.18); color: #46a566; border: 1px solid #2f8f4e; }
.status--rejected { background: rgba(192, 57, 43, 0.16); color: #d2604f; border: 1px solid #c0392b; }

@media (max-width: 700px) {
  .submission { flex-direction: column; }
  .submission-actions input { width: 100%; }
}

/* ---------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--line-soft); background: var(--bg-deep); margin-top: 28px; }
.footer-inner {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 22px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer-brand { font-weight: 700; color: var(--text-strong); }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.footer-note { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side-column { order: 2; }
}

@media (max-width: 860px) {
  .forum-row { grid-template-columns: 44px minmax(0, 1fr); }
  .forum-stats {
    grid-column: 2;
    flex-direction: row;
    gap: 16px;
  }
  .forum-stats > div { gap: 5px; }
  .forum-last { grid-column: 2; }
  .thread-row { grid-template-columns: 42px minmax(0, 1fr); }
  .thread-stats { grid-column: 2; flex-direction: row; gap: 16px; }
  .thread-last { grid-column: 2; text-align: left; }
  .thread-last-avatar { display: none; }
  .post { grid-template-columns: minmax(0, 1fr); }
  .post-user {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 12px 16px;
  }
  .post-user .avatar { margin: 0; width: 44px !important; height: 44px !important; font-size: 20px !important; }
  .post-user-stats { flex-direction: row; gap: 14px; margin: 0 0 0 auto; }
  .post-user-stats > div { gap: 6px; }
}

@media (max-width: 620px) {
  .nav-item span { display: none; }
  .nav-item--cta span, .account-summary span { display: inline; }
  .nav-search input { width: 110px; }
  .site-header-inner { padding-bottom: 12px; }
  .brand-name { font-size: 25px; }
  /* DECISIONS D39: buttons grow to fill the row but never shrink below a width that fits
     their label on one line — if they don't all fit, the row wraps to a second line instead
     of the button squeezing its own text onto two lines (the previous flex: 1 did the latter). */
  .action-bar { justify-content: stretch; }
  .action-bar .btn { flex: 1 1 auto; min-width: 130px; }
}
