/* ════════════════════════════════════════════════════════════════════════
   WildLegacy — FORUM design system (glassmorphism, dark, scene background).
   Stage 1: design tokens + glass material + forum home (category/section list).
   Shares this file with section/topic/profile pages — those inherit the dark
   token palette (kept readable) and get full per-page polish in later stages.
   Unified with the login screen (css/login.css): same Inter type, same glass
   tokens, same indigo→violet accent, same scene background.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Brand / accent (shared with login) ── */
  --accent:        #5B5BF0;
  --accent-2:      #8A7CFF;

  /* ── Glass material (shared with login) ── */
  --glass:         rgba(18, 22, 38, .55);   /* header / light glass            */
  --glass-panel:   rgba(15, 19, 34, .74);   /* DENSE panel — text reads on it  */
  --glass-row:     rgba(255, 255, 255, .04);/* quiet inner row on a panel      */
  --glass-border:  rgba(255, 255, 255, .12);
  --glass-blur:    24px;
  --glass-shadow:  0 24px 70px rgba(0, 0, 0, .42);
  --glass-inner:   inset 0 1px 0 rgba(255, 255, 255, .08);

  /* ── Type colors ── */
  --text:          #ffffff;
  --muted:         rgba(255, 255, 255, .72);
  --faint:         rgba(255, 255, 255, .52);

  /* ── Radii / motion ── */
  --radius-lg:     24px;
  --radius-md:     16px;
  --radius-sm:     11px;
  --ease:          cubic-bezier(.4, 0, .2, 1);
  --ease-pop:      cubic-bezier(.18, .9, .32, 1.2);

  /* ── Legacy token aliases (used by section/topic/profile components) — ──
     remapped to the dark palette so every shared component stays readable
     until its own redesign stage. Keep these names; just dark values now.   */
  --surface:        rgba(15, 19, 34, .74);
  --surface-2:      rgba(255, 255, 255, .05);
  --primary:        #a99dff;                 /* link/accent text on dark       */
  --primary-light:  rgba(138, 124, 255, .15);
  --primary-hover:  #b8adff;
  --primary-border: rgba(138, 124, 255, .42);
  --text-2:         rgba(255, 255, 255, .80);
  --text-muted:     rgba(255, 255, 255, .54);
  --border:         rgba(255, 255, 255, .11);
  --border-2:       rgba(255, 255, 255, .18);
  --shadow-sm:      0 2px 12px rgba(0, 0, 0, .28);
  --shadow:         0 10px 34px rgba(0, 0, 0, .34);
  --shadow-lg:      0 28px 80px rgba(0, 0, 0, .50);
  --radius:         16px;

  /* aura accent slot — set per category via :nth-child below */
  --cat-accent:     var(--accent-2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: #090b18;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ── Scene background (fixed) + vignette — same art as login ── */
.scene {
  position: fixed; inset: 0; z-index: -2;
  background: url('/assets/backgrounds/login-scene.jpg?v=2') center / cover no-repeat;
  background-color: #161b33;
}
.vignette {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, transparent 40%, rgba(7, 9, 18, .55) 100%),
    linear-gradient(to bottom, rgba(7, 9, 18, .62) 0%, rgba(7, 9, 18, .40) 30%, rgba(7, 9, 18, .72) 100%);
}

/* glass material helper (any element) */
.forum-glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(125%);
  backdrop-filter: blur(var(--glass-blur)) saturate(125%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}

/* ════════════════════ HEADER ════════════════════ */
.forum-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11, 14, 26, .58);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  backdrop-filter: blur(20px) saturate(125%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 6px 30px rgba(0, 0, 0, .28);
}
.header-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 22px;
}
.forum-logo { display: flex; align-items: center; gap: 11px; }
.header-icon {
  width: 26px; height: 26px;
  /* tint the pokedex glyph to the violet accent */
  filter: brightness(0) saturate(100%) invert(64%) sepia(38%) saturate(900%) hue-rotate(212deg) brightness(101%) contrast(101%);
  opacity: .95;
}
.header-title { display: flex; align-items: baseline; gap: 9px; line-height: 1; }
.brand-word {
  font-size: 20px; font-weight: 800; letter-spacing: -.4px;
  background: linear-gradient(135deg, #8ea0ff, #b9a6ff 60%, #d9b8ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--faint);
  padding-left: 9px; border-left: 1px solid var(--glass-border);
}

.user-block { display: flex; align-items: center; gap: 11px; }
.auth-loading { font-size: 13px; color: var(--faint); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid var(--primary-border);
  box-shadow: 0 0 0 3px rgba(138, 124, 255, .12);
}
.user-name { font-weight: 600; font-size: 14px; color: var(--text); }
.btn-login {
  font: inherit; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer;
  text-decoration: none; padding: 8px 18px; border-radius: 50px; border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(91, 91, 240, .35);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s var(--ease);
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(91, 91, 240, .5); filter: brightness(1.06); }

/* ════════════════════ LAYOUT ════════════════════ */
.forum-main { padding: 34px 18px 80px; }
.forum-container { max-width: 960px; margin: 0 auto; }

/* ── Hero ── */
.forum-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  margin-bottom: 26px;
}
.page-title {
  font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -1px;
  line-height: 1.05; color: var(--text);
}
.page-subtitle { margin-top: 9px; font-size: 15px; line-height: 1.5; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
  font-family: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn-primary {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(91, 91, 240, .34);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(91, 91, 240, .46); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  color: var(--muted); background: rgba(255, 255, 255, .06); border-color: var(--glass-border);
}
.btn-secondary:hover { background: rgba(255, 255, 255, .11); color: var(--text); border-color: var(--border-2); }

/* ════════════════════ CATEGORY BLOCKS (signature: aura rail + chip) ═══════ */
.categories-list { display: flex; flex-direction: column; gap: 18px; }

.category-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
/* aura rail — the signature accent glow down the left edge */
.category-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--cat-accent), transparent 85%);
  box-shadow: 0 0 18px 1px var(--cat-accent);
  opacity: .9;
}
/* per-category aura accent cycle */
.category-card:nth-child(5n + 1) { --cat-accent: #6f7bff; }
.category-card:nth-child(5n + 2) { --cat-accent: #9b87ff; }
.category-card:nth-child(5n + 3) { --cat-accent: #3fd0c9; }
.category-card:nth-child(5n + 4) { --cat-accent: #f5b25a; }
.category-card:nth-child(5n + 5) { --cat-accent: #ff7d9c; }

.category-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px 15px;
  border-bottom: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
}
.category-chip {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: color-mix(in srgb, var(--cat-accent) 22%, rgba(255, 255, 255, .05));
  border: 1px solid color-mix(in srgb, var(--cat-accent) 45%, transparent);
  box-shadow: 0 0 22px -4px var(--cat-accent), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.category-title-wrap { flex: 1; min-width: 0; }
.category-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; color: var(--text); }
.category-desc { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.45; }

/* admin actions — quiet ghost icon-buttons, revealed on hover (never "torch") */
.category-actions { display: flex; gap: 6px; flex-shrink: 0; opacity: 0; transition: opacity .2s var(--ease); }
.category-card:hover .category-actions { opacity: 1; }
@media (hover: none) { .category-actions { opacity: .7; } }
.cat-action-btn {
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 13px; line-height: 1;
  display: grid; place-items: center;
  color: var(--muted); background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border);
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.cat-action-btn:hover { background: rgba(255, 255, 255, .12); color: var(--text); border-color: var(--border-2); }
.cat-action-danger:hover { background: rgba(220, 38, 38, .22); color: #ffb4b4; border-color: rgba(220, 38, 38, .5); }

/* ── Section rows inside a category ── */
.topic-list { display: flex; flex-direction: column; padding: 6px; }
.topic-item {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 13px 14px; border-radius: 13px;
  text-decoration: none; color: inherit; cursor: pointer;
  transition: background .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease);
}
.topic-item:hover {
  background: var(--glass-row);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cat-accent) 40%, transparent),
              0 0 24px -6px var(--cat-accent);
  transform: translateY(-1px);
}
.topic-icon {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; font-size: 18px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border);
  transition: border-color .16s var(--ease);
}
.topic-item:hover .topic-icon { border-color: color-mix(in srgb, var(--cat-accent) 50%, transparent); }
.topic-info { flex: 1; min-width: 0; }
.topic-title { font-size: 15px; font-weight: 700; color: var(--text); }
.topic-meta { font-size: 12.5px; color: var(--faint); margin-top: 2px; line-height: 1.4; }
.topic-stats { text-align: right; margin-left: 14px; flex-shrink: 0; }
.topic-posts-count { font-size: 15px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.topic-posts-label { font-size: 10px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
/* nav chevron — index section rows only (affordance, no real metric to show) */
.categories-list .topic-item::after {
  content: '›'; flex-shrink: 0; margin-left: 4px;
  font-size: 20px; line-height: 1; color: var(--faint);
  transition: color .16s var(--ease), transform .16s var(--ease);
}
.categories-list .topic-item:hover::after { color: var(--text); transform: translateX(3px); }

/* ── Empty / loading ── */
.topic-list .forum-empty {
  margin: 6px; padding: 14px 16px; text-align: left;
  font-size: 13px; color: var(--faint);
  background: rgba(255, 255, 255, .03); border: 1px dashed var(--glass-border); border-radius: 12px;
}
.forum-empty { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.forum-empty .btn-login { display: inline-block; margin-top: 4px; }
.forum-loading { padding: 40px; text-align: center; color: var(--faint); font-size: 14px; font-weight: 600; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* staggered entrance for category blocks */
@media (prefers-reduced-motion: no-preference) {
  .category-card { animation: riseIn .5s var(--ease) both; }
  .category-card:nth-child(1) { animation-delay: .03s; }
  .category-card:nth-child(2) { animation-delay: .09s; }
  .category-card:nth-child(3) { animation-delay: .15s; }
  .category-card:nth-child(4) { animation-delay: .21s; }
  .category-card:nth-child(5) { animation-delay: .27s; }
  .category-card:nth-child(n + 6) { animation-delay: .33s; }
  @keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
}

/* ════════════════════ STATISTICS ════════════════════ */
.forum-stats {
  margin-top: 22px; padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.stats-title { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--faint); margin-bottom: 14px; text-transform: uppercase; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat-cell {
  display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center;
  padding: 14px 8px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .045); border: 1px solid var(--glass-border);
}
.stat-val { font-size: 23px; font-weight: 800; color: var(--text); line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11px; color: var(--faint); }
.stat-link { color: var(--primary); text-decoration: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-link:hover { text-decoration: underline; color: var(--primary-hover); }

.stats-toplist { margin-top: 16px; border-top: 1px solid var(--glass-border); padding-top: 15px; }
.stats-toplist-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.stats-toplist-list { list-style: none; counter-reset: tl; display: flex; flex-direction: column; gap: 4px; }
.stats-toplist-list li {
  counter-increment: tl; display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; padding: 7px 10px; border-radius: 9px; background: rgba(255, 255, 255, .03);
}
.stats-toplist-list li::before {
  content: counter(tl); margin-right: 10px; flex-shrink: 0;
  font-size: 11px; font-weight: 800; color: var(--faint); min-width: 16px;
}
.stats-toplist-list li a { flex: 1; }
.stats-toplist-count { font-weight: 800; color: #ff9db4; font-variant-numeric: tabular-nums; }

/* ════════════════════ MODALS / FORMS (admin) ════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; justify-content: center; align-items: center;
  background: rgba(5, 7, 14, .6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.modal-content {
  width: 90%; max-width: 480px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius-lg);
  background: rgba(17, 21, 37, .92);
  -webkit-backdrop-filter: blur(28px) saturate(130%); backdrop-filter: blur(28px) saturate(130%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
  animation: popIn .22s var(--ease-pop);
}
@keyframes popIn { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 17px; font-weight: 800; color: var(--text); }
.modal-close { background: none; border: none; font-size: 24px; color: var(--faint); cursor: pointer; line-height: 1; transition: color .15s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 7px; color: var(--muted); }
.form-control {
  width: 100%; padding: 11px 14px; font-family: inherit; font-size: 14px; outline: none;
  color: var(--text); background: rgba(9, 12, 24, .5);
  border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.form-control::placeholder { color: var(--faint); }
.form-control:focus { border-color: var(--accent-2); background: rgba(9, 12, 24, .68); box-shadow: 0 0 0 3px rgba(138, 124, 255, .18); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ════════════════════ SHARED COMPONENTS (section / topic / profile) ═══════
   Dark-token restyle so these pages stay readable now; full polish later.    */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post-card {
  display: flex; overflow: hidden; border-radius: var(--radius-md);
  background: var(--surface); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}
.post-sidebar {
  width: 140px; flex-shrink: 0; padding: 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: rgba(255, 255, 255, .035); border-right: 1px solid var(--glass-border);
}
.post-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary-border); margin-bottom: 12px; }
.post-author { font-size: 14px; font-weight: 700; color: var(--primary); word-break: break-word; }
.post-main { flex: 1; padding: 20px; display: flex; flex-direction: column; }
.post-meta { font-size: 12px; color: var(--faint); margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; }
.post-content { font-size: 15px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.post-author-wrap { display: contents; cursor: pointer; }
.post-author-wrap .post-author { transition: text-decoration .15s; }
.post-author-wrap:hover .post-author { text-decoration: underline; }

.reply-area { margin-top: 30px; padding: 20px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm); }
.reply-title { font-size: 16px; font-weight: 800; margin-bottom: 12px; color: var(--text); }

.breadcrumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--primary); text-decoration: none; font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs-sep { color: var(--faint); font-size: 10px; }

/* profile */
.profile-card { padding: 24px; margin-bottom: 22px; border-radius: var(--radius-lg); background: var(--glass-panel); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inner); }
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary-border); flex-shrink: 0; box-shadow: 0 0 0 4px rgba(138, 124, 255, .12); }
.profile-head-info { flex: 1; min-width: 0; }
.profile-name { font-size: 22px; font-weight: 800; color: var(--text); word-break: break-word; }
.profile-rank { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-light); padding: 4px 12px; border-radius: 50px; border: 1px solid var(--primary-border); }
.profile-edit-btn { flex-shrink: 0; align-self: flex-start; }
.profile-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; }
.profile-info-cell { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .045); border: 1px solid var(--glass-border); }
.pi-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--faint); text-transform: uppercase; }
.pi-value { font-size: 14px; font-weight: 600; color: var(--text); word-break: break-word; }
.profile-edit-form { margin-top: 18px; border-top: 1px solid var(--glass-border); padding-top: 18px; }
.profile-about { margin-top: 20px; border-top: 1px solid var(--glass-border); padding-top: 18px; }
.profile-about-title { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--faint); margin-bottom: 8px; text-transform: uppercase; }
.profile-about-body { font-size: 15px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word; }
.profile-posts-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 16px; }
.profile-post-item { display: block; padding: 14px 16px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--glass-border); text-decoration: none; color: inherit; transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease); }
.profile-post-item:hover { background: rgba(255, 255, 255, .06); border-color: var(--primary-border); transform: translateY(-1px); }
.profile-post-snippet { font-size: 14px; line-height: 1.55; color: var(--text); }
.profile-post-meta { font-size: 12px; color: var(--faint); margin-top: 8px; }
.profile-more-btn { display: block; width: 100%; margin-top: 4px; }

/* thanks (likes) — rose accent tuned for dark */
.post-footer { margin-top: auto; padding-top: 12px; }
.post-thank-btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; padding: 6px 14px; border-radius: 50px; background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border); transition: .15s var(--ease); }
.post-thank-btn .thank-ico { font-size: 14px; color: var(--faint); transition: .15s; }
.post-thank-btn .thank-count { font-weight: 800; font-variant-numeric: tabular-nums; }
.post-thank-btn:hover { background: rgba(255, 125, 156, .14); border-color: rgba(255, 125, 156, .42); color: #ff9db4; }
.post-thank-btn:hover .thank-ico { color: #ff5e84; }
.post-thank-btn.liked { background: rgba(255, 94, 132, .18); border-color: rgba(255, 94, 132, .5); color: #ff9db4; }
.post-thank-btn.liked .thank-ico { color: #ff5e84; }
.post-thank-btn:disabled { opacity: .55; cursor: default; }
.post-thanks-static { font-size: 13px; color: var(--faint); }
.post-thanks-static b { color: var(--muted); }
.profile-thanks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
.pt-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px; border-radius: var(--radius-sm); background: rgba(255, 94, 132, .12); border: 1px solid rgba(255, 94, 132, .26); }
.pt-val { font-size: 22px; font-weight: 800; color: #ff9db4; line-height: 1; font-variant-numeric: tabular-nums; }
.pt-lbl { font-size: 11px; color: var(--muted); }

/* ════════════════════ RESPONSIVE ════════════════════ */
@media (max-width: 720px) {
  .forum-hero { flex-direction: column; align-items: stretch; }
  .hero-actions { flex-wrap: wrap; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .scene { background-image: url('/assets/backgrounds/login-scene-mobile.jpg?v=2'); }
  .forum-main { padding: 24px 14px 64px; }
  .header-inner { padding: 11px 16px; }
  .brand-sub { display: none; }
  .category-header { padding: 14px 16px; gap: 12px; }
  .category-chip { width: 40px; height: 40px; font-size: 20px; }
  .topic-item { padding: 12px 12px; gap: 12px; }
}
@media (max-width: 640px) {
  .post-card { flex-direction: column; }
  .post-sidebar { width: 100%; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; text-align: left; border-right: none; border-bottom: 1px solid var(--glass-border); }
  .post-avatar { width: 40px; height: 40px; margin-bottom: 0; }
  .post-main { padding: 16px; }
  .profile-head { flex-wrap: wrap; }
  .profile-info-grid { grid-template-columns: 1fr; }
}

/* ════════════════════ STAGE 2 — SECTION PAGE (topic list) ════════════════════
   Reuses the Stage 1 design system (glass tokens, .topic-item base, aura glow).   */

/* breadcrumbs — current (non-link) crumb */
.breadcrumbs-current { color: var(--text); font-weight: 600; }

/* section hero — glass panel with aura rail + icon chip (mirrors a category head) */
.section-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.section-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--accent-2), transparent 85%);
  box-shadow: 0 0 18px 1px var(--accent-2); opacity: .9;
}
.section-hero-chip {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-size: 24px; line-height: 1;
  background: color-mix(in srgb, var(--accent-2) 22%, rgba(255, 255, 255, .05));
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  box-shadow: 0 0 22px -4px var(--accent-2), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.section-hero-text { flex: 1; min-width: 0; }
.section-hero .page-title { font-size: clamp(22px, 3vw, 28px); letter-spacing: -.4px; }
.section-desc { margin-top: 5px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.section-hero-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.btn-guest-cta { text-decoration: none; display: inline-flex; align-items: center; }

/* topics board — glass panel holding the rows */
.topics-board {
  display: flex; flex-direction: column; gap: 2px; padding: 8px; overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}

/* topic row — stretched-link pattern (whole row clickable, admin buttons above) */
.topics-board .topic-item { position: relative; gap: 13px; }
.topic-link { position: absolute; inset: 0; z-index: 1; border-radius: 13px; }
.topic-row-avatar {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, .05);
}
.topic-row .topic-info { flex: 1; min-width: 0; }
.topic-row .topic-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 15px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topic-row .topic-meta { font-size: 12.5px; color: var(--faint); margin-top: 2px; }
.topic-row .topic-meta b { color: var(--muted); font-weight: 700; }
.topic-badge { font-size: 12px; flex-shrink: 0; }

.topic-metrics { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.topic-metrics .topic-stats { margin-left: 0; text-align: center; min-width: 54px; }
.topic-activity { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--faint); min-width: 96px; }
.topic-activity-ico { font-size: 12px; opacity: .8; }

/* pinned / locked (forward-compatible — light up if those fields are added) */
.topic-item.pinned { background: color-mix(in srgb, var(--accent-2) 9%, transparent); }
.topic-item.pinned:hover { background: color-mix(in srgb, var(--accent-2) 15%, transparent); }
.topic-item.locked .topic-title { color: var(--muted); }

/* admin actions — hover-revealed ghost (matches Stage 1 .cat-action-btn) */
.topic-actions { position: relative; z-index: 2; display: flex; gap: 6px; flex-shrink: 0; opacity: 0; transition: opacity .18s var(--ease); }
.topic-item:hover .topic-actions { opacity: 1; }
@media (hover: none) { .topic-actions { opacity: .7; } }

/* empty */
.topics-empty { padding: 30px 22px; text-align: center; color: var(--muted); font-size: 14px; }
.topics-empty-cta { color: var(--accent-2); font-weight: 600; }

@media (max-width: 640px) {
  .section-hero { flex-wrap: wrap; }
  .section-hero-chip { width: 44px; height: 44px; font-size: 21px; }
  .section-hero-actions { width: 100%; }
  .section-hero-actions .btn, .section-hero-actions .btn-guest-cta { flex: 1; justify-content: center; text-align: center; }
  /* metrics wrap under the title, indented past the avatar */
  .topics-board .topic-item { flex-wrap: wrap; }
  .topic-metrics { flex-basis: 100%; margin-left: 53px; justify-content: flex-start; gap: 20px; padding-top: 2px; }
  .topic-activity { min-width: 0; }
}
@media (max-width: 560px) {
  .breadcrumbs { font-size: 12px; }
  .breadcrumbs-current { max-width: 45vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ════════════════════ STAGE 3 — TOPIC PAGE (posts) ════════════════════
   Reading-first: dense --glass-panel under text, 16px / 1.7, capped measure.   */

.forum-container--narrow { max-width: 840px; }

/* topic hero */
.topic-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px; margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.topic-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--accent-2), transparent 85%);
  box-shadow: 0 0 18px 1px var(--accent-2); opacity: .9;
}
.topic-hero-main { flex: 1; min-width: 0; }
.topic-hero .page-title { font-size: clamp(21px, 2.8vw, 27px); letter-spacing: -.4px; line-height: 1.2; }
.topic-hero-meta { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.topic-hero-meta b { color: var(--text); font-weight: 700; }
.topic-hero-meta .dot { color: var(--faint); margin: 0 2px; }
.topic-hero-actions { flex-shrink: 0; }

/* posts */
.post-list { display: flex; flex-direction: column; gap: 16px; }
.post-card { position: relative; background: var(--glass-panel); }
/* OP (first post) — subtle accent */
.post-card.op { border-color: color-mix(in srgb, var(--accent-2) 38%, var(--glass-border)); }
.post-card.op::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-2) 22%, transparent),
              inset 3px 0 0 0 var(--accent-2);
}

/* author sidebar */
.post-author { font-size: 14px; font-weight: 700; color: var(--accent-2); }
.post-author-wrap:hover .post-author { text-decoration: underline; }
.post-author-stats { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); width: 100%; display: flex; flex-direction: column; gap: 6px; }
.pas-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); justify-content: center; }
.pas-ico { opacity: .85; }

/* post body */
.post-main { gap: 0; }
.post-meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px; color: var(--faint);
  margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--glass-border);
}
.post-num { color: var(--faint); font-weight: 800; text-decoration: none; font-variant-numeric: tabular-nums; }
.post-num:hover { color: var(--accent-2); }
.post-date { color: var(--faint); }
.post-admin-actions { margin-left: auto; display: flex; gap: 6px; opacity: 0; transition: opacity .18s var(--ease); }
.post-card:hover .post-admin-actions { opacity: 1; }
@media (hover: none) { .post-admin-actions { opacity: .7; } }

/* THE reading surface — generous size, line-height, capped measure */
.post-content {
  font-size: 16px; line-height: 1.7; color: var(--text);
  max-width: 68ch; white-space: pre-wrap; word-break: break-word;
}
.post-content a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }

/* footer: actions left, thanks right */
.post-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.post-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.post-action-btn {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  padding: 6px 12px; border-radius: 50px;
  color: var(--muted); background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border);
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.post-action-btn:hover { background: rgba(255, 255, 255, .1); color: var(--text); border-color: var(--border-2); }
.post-thanks { margin-left: auto; }

/* reply box — 3 states */
.reply-area {
  margin-top: 26px; padding: 20px; border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inner);
}
.reply-area .form-control { min-height: 120px; resize: vertical; line-height: 1.6; }
.reply-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.reply-prompt {
  margin-top: 26px; padding: 20px 22px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  background: var(--glass-panel); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner); color: var(--muted); font-size: 14px;
}
.reply-locked {
  margin-top: 26px; padding: 18px 22px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255, 255, 255, .03); border: 1px dashed var(--glass-border);
  color: var(--muted); font-size: 14px;
}
.reply-locked-ico { font-size: 16px; }

/* mobile: author becomes a compact top bar; stats inline */
@media (max-width: 640px) {
  .post-sidebar { gap: 12px; }
  .post-author-wrap { display: flex !important; align-items: center; gap: 10px; }
  .post-author-stats { margin-top: 0; padding-top: 0; border-top: none; width: auto; flex-direction: row; gap: 14px; margin-left: auto; }
  .pas-row { justify-content: flex-start; }
  .post-content { font-size: 15.5px; max-width: none; }
  .topic-hero { flex-direction: row; }
}

/* ════════════════════ STAGE 4 — PROFILE PAGE ════════════════════
   Public profile (forum_profiles projection). Built on Stage 1–3 tokens.        */

.profile-hero {
  position: relative; overflow: hidden;
  padding: 24px; margin-bottom: 16px; border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), var(--glass-inner);
}
.profile-hero::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom, var(--accent-2), transparent 85%);
  box-shadow: 0 0 18px 1px var(--accent-2); opacity: .9;
}
.profile-hero-top { display: flex; align-items: center; gap: 20px; }
.profile-hero .profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  border: 3px solid var(--primary-border); box-shadow: 0 0 0 4px rgba(138, 124, 255, .12), 0 0 30px -6px var(--accent-2);
}
.profile-hero-id { flex: 1; min-width: 0; }
.profile-name { font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -.4px; color: var(--text); word-break: break-word; }
.profile-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.profile-rank { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent-2); background: var(--primary-light); padding: 4px 12px; border-radius: 50px; border: 1px solid var(--primary-border); }
.profile-loc { font-size: 13px; color: var(--muted); }
.profile-joined { margin-top: 8px; font-size: 13px; color: var(--faint); }
.profile-edit-btn { flex-shrink: 0; align-self: flex-start; }

.profile-stat-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; }
.pstat { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .045); border: 1px solid var(--glass-border); }
.pstat-val { font-size: 24px; font-weight: 800; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.pstat-lbl { font-size: 12px; color: var(--faint); }

/* sections (about / contacts) */
.profile-section {
  padding: 20px 22px; margin-bottom: 16px; border-radius: var(--radius-lg);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inner);
}
.profile-section--muted { color: var(--faint); font-size: 14px; text-align: center; }
.profile-section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.profile-about-body { font-size: 16px; line-height: 1.7; color: var(--text); white-space: pre-wrap; word-break: break-word; max-width: 68ch; }
.profile-contacts { font-size: 15px; line-height: 1.6; color: var(--text); word-break: break-word; }
.profile-contacts a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }

/* inline edit form */
.profile-edit-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--glass-border); }
.profile-edit-form textarea.form-control { min-height: 96px; resize: vertical; line-height: 1.6; }
.profile-edit-form input[type="file"] { padding: 9px 12px; font-size: 13px; cursor: pointer; }
.profile-edit-form input[type="file"]::file-selector-button {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; margin-right: 12px;
  padding: 6px 12px; border-radius: 8px; color: var(--text);
  background: rgba(255, 255, 255, .08); border: 1px solid var(--glass-border);
}
.ef-hint { margin-top: 6px; font-size: 12px; color: var(--faint); }

/* posts */
.profile-posts { margin-top: 4px; }
.profile-posts-title { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
.profile-post-item {
  display: block; padding: 16px 18px; margin-bottom: 12px; border-radius: var(--radius-md);
  background: var(--glass-panel);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.profile-post-item:hover {
  border-color: color-mix(in srgb, var(--accent-2) 40%, transparent);
  box-shadow: var(--shadow-sm), 0 0 24px -8px var(--accent-2);
  transform: translateY(-1px);
}
.profile-post-snippet { font-size: 14.5px; line-height: 1.55; color: var(--text); }
.profile-post-meta { font-size: 12px; color: var(--faint); margin-top: 8px; }
.profile-more-btn { display: block; width: 100%; margin-top: 4px; }

@media (max-width: 640px) {
  .profile-hero-top { flex-direction: column; text-align: center; gap: 14px; }
  .profile-hero-id { width: 100%; }
  .profile-badges, .profile-joined { justify-content: center; }
  .profile-badges { justify-content: center; }
  .profile-edit-btn { width: 100%; }
  .profile-about-body { max-width: none; }
}

/* ════════════════════ STAGE 5 — EDITOR, RENDERED MARKDOWN, DIALOGS ══════════ */

/* ── rendered markdown inside post bodies / preview ── */
.post-content .md-quote {
  margin: 12px 0; padding: 12px 16px;
  border-left: 3px solid var(--accent-2); border-radius: 0 10px 10px 0;
  background: rgba(138, 124, 255, .08);
  color: var(--muted); font-size: 15px; line-height: 1.6;
}
.post-content .md-quote .md-cite { display: block; font-style: normal; font-weight: 700; font-size: 12.5px; color: var(--accent-2); margin-bottom: 6px; }
.post-content .md-quote :where(p):last-child { margin-bottom: 0; }
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  padding: 1px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--glass-border);
}
.post-content .md-pre {
  margin: 12px 0; padding: 14px 16px; overflow-x: auto; max-width: 100%;
  border-radius: var(--radius-sm); background: rgba(9, 12, 24, .55); border: 1px solid var(--glass-border);
}
.post-content .md-pre code { padding: 0; border: 0; background: none; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.post-content .md-list { margin: 10px 0; padding-left: 22px; }
.post-content .md-list li { margin-bottom: 5px; }
.post-content p { margin: 0 0 10px; }
.post-content p:last-child { margin-bottom: 0; }
.post-content strong { color: var(--text); font-weight: 700; }

/* ── markdown editor (toolbar + preview) ── */
.md-editor { display: flex; flex-direction: column; }
.md-toolbar {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 7px 8px; border: 1px solid var(--glass-border); border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: rgba(255, 255, 255, .04);
}
.md-tool {
  min-width: 30px; height: 30px; padding: 0 9px; cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--glass-border); border-radius: 8px;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.md-tool:hover { background: rgba(255, 255, 255, .12); color: var(--text); border-color: var(--border-2); }
.md-tool--b { font-weight: 800; }
.md-tool--i { font-style: italic; font-weight: 600; }
.md-tool-spacer { flex: 1; }
.md-preview-toggle { color: var(--accent-2); font-weight: 600; }
/* the textarea sits flush under the toolbar */
.md-editor > .form-control { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.md-preview {
  min-height: 80px; padding: 14px 16px; max-width: none;
  border: 1px solid var(--glass-border); border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: rgba(9, 12, 24, .4);
}
.md-empty { color: var(--faint); font-style: italic; }

/* inline post-edit box */
.post-edit-box { margin-top: 4px; }
.post-edit-box .reply-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* ── danger button + confirm dialog ── */
.btn-danger {
  color: #fff; border: 1px solid transparent;
  background: linear-gradient(135deg, #e2495f, #b3253a);
  box-shadow: 0 8px 22px rgba(220, 38, 38, .3);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(220, 38, 38, .42); filter: brightness(1.05); }
.btn-danger:active { transform: translateY(0); }
.confirm-modal { max-width: 420px; }
.confirm-message { font-size: 15px; line-height: 1.55; color: var(--muted); }
.confirm-modal .modal-actions { margin-top: 22px; }

@media (max-width: 560px) {
  .md-toolbar { gap: 4px; padding: 6px; }
  .md-tool { min-width: 28px; height: 28px; padding: 0 7px; font-size: 12px; }
}
