/* ═══════════════════════════════════════════════════════════════════════════
   funscript.wiki — Stylesheet
   Design: Editorial/encyclopedic with techy accents
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Custom Properties ─────────────────────────────────────────────────── */
:root {
  --sidebar-bg:    #0f1117;
  --sidebar-text:  #c8cdd8;
  --sidebar-hover: #1e2230;
  --sidebar-active:#2a3050;
  --accent:        #4f9cf9;
  --accent-dim:    #2563b0;
  --accent-glow:   rgba(79,156,249,.15);

  --bg:            #f8f8f6;
  --surface:       #ffffff;
  --border:        #d4d4cc;
  --border-light:  #e8e8e4;
  --text:          #1a1a18;
  --text-muted:    #666660;
  --text-light:    #999994;

  --heading-font:  'Libre Baskerville', Georgia, serif;
  --body-font:     'Source Sans 3', 'Helvetica Neue', Arial, sans-serif;
  --mono-font:     'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-width: 220px;
  --content-max:   860px;
  --topbar-h:      52px;

  --radius:        4px;
  --radius-lg:     8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--accent-dim); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent); }
a.external::after {
  content: ' ↗';
  font-size: .75em;
  opacity: .6;
}

img { max-width: 100%; height: auto; }

/* ── Top Navigation Bar ────────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #0a0d14;
  border-bottom: 1px solid #1e2535;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 200;
  gap: 1rem;
}

#site-wordmark {
  font-family: var(--heading-font);
  font-size: 1.35rem;
  letter-spacing: -.5px;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark-fs   { color: #e8eaf6; font-weight: 700; }
.wordmark-dot  { color: var(--accent); font-weight: 700; }
.wordmark-wiki { color: #7b8ab8; font-weight: 400; font-style: italic; }

/* Search bar */
#search-form {
  display: flex;
  align-items: center;
  background: #1a1f2e;
  border: 1px solid #2a3044;
  border-radius: 20px;
  overflow: hidden;
  flex: 1;
  max-width: 500px;
  transition: border-color .2s, box-shadow .2s;
}
#search-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #d0d4e0;
  padding: .45rem 1rem;
  font-family: var(--body-font);
  font-size: .9rem;
}
#search-input::placeholder { color: #555d74; }
#search-btn {
  background: none;
  border: none;
  color: #7b8ab8;
  padding: .45rem .9rem;
  cursor: pointer;
  transition: color .2s;
}
#search-btn:hover { color: var(--accent); }

/* User menu */
#user-menu {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .85rem;
  white-space: nowrap;
}
#user-menu a { color: #8a9ab8; }
#user-menu a:hover { color: #d0d4e0; text-decoration: none; }
#user-menu .user-display { color: var(--accent); font-weight: 600; }
#user-menu .btn-register {
  background: var(--accent);
  color: #fff !important;
  padding: .28rem .8rem;
  border-radius: 14px;
  font-weight: 600;
}
#user-menu .btn-register:hover { background: var(--accent-dim); }
#user-menu .admin-link { color: #f09030 !important; }

/* ── Layout Grid ───────────────────────────────────────────────────────── */
#layout {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid #1c2030;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a3050 transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: #2a3050; border-radius: 2px; }

#sidebar-nav {
  padding: 1.2rem 0 2rem;
}

.nav-section {
  padding: .5rem 0;
}
.nav-section + .nav-section {
  border-top: 1px solid #1c2030;
}

.nav-section-title {
  font-family: var(--mono-font);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #4a5168;
  padding: .6rem 1.2rem .3rem;
}

.nav-section ul { list-style: none; }
.nav-section ul li a {
  display: block;
  padding: .3rem 1.2rem;
  font-size: .875rem;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background .15s, color .15s;
  border-radius: 0;
}
.nav-section ul li a:hover {
  background: var(--sidebar-hover);
  color: #e8eaf6;
  text-decoration: none;
}
.nav-section ul li a.active {
  background: var(--sidebar-active);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: calc(1.2rem - 3px);
}

.sidebar-stats { padding-bottom: 1rem; }
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  padding: .4rem 1rem;
}
.stat-item {
  background: #161b27;
  border: 1px solid #1e2535;
  border-radius: var(--radius);
  padding: .5rem;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: var(--mono-font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
}
.stat-label {
  display: block;
  font-size: .7rem;
  color: #5a6278;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Content Wrap ──────────────────────────────────────────────────────── */
#content-wrap {
  flex: 1;
  min-width: 0;
  background: var(--bg);
}

/* ── Article Page ──────────────────────────────────────────────────────── */
.page-container {
  max-width: calc(var(--content-max) + 2rem);
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* Article tabs (View / Edit / History / Talk) */
.article-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding-top: 1.2rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.article-tabs a, .article-tabs span {
  display: inline-block;
  padding: .4rem .9rem;
  font-size: .85rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .15s;
}
.article-tabs a:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  text-decoration: none;
}
.article-tabs .active {
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
  color: var(--text);
  font-weight: 600;
  margin-bottom: -2px;
}
.article-tabs .tab-edit { margin-left: auto; }
.article-tabs .tab-edit a {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent-dim);
}
.article-tabs .tab-edit a:hover {
  background: var(--accent);
  border-color: var(--accent);
}

/* Article header */
.article-header {
  margin-bottom: 1.2rem;
}
.article-title {
  font-family: var(--heading-font);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
  margin-bottom: .5rem;
}
.article-meta {
  font-size: .8rem;
  color: var(--text-light);
}
.article-meta a { color: var(--text-muted); }

/* Article body */
#article-body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
}

#article-body h2 {
  font-family: var(--heading-font);
  font-size: 1.5rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  margin: 1.8rem 0 .7rem;
  padding-bottom: .3rem;
  color: var(--text);
}
#article-body h3 {
  font-family: var(--heading-font);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.4rem 0 .5rem;
  color: var(--text);
}
#article-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 .4rem;
  color: var(--text-muted);
}
.heading-link {
  font-size: .7em;
  color: var(--text-light) !important;
  opacity: 0;
  margin-left: .4rem;
  vertical-align: middle;
  text-decoration: none !important;
}
h2:hover .heading-link,
h3:hover .heading-link,
h4:hover .heading-link { opacity: 1; }

#article-body p { margin-bottom: .9rem; }

#article-body ul, #article-body ol {
  margin: .5rem 0 .9rem 1.5rem;
}
#article-body li { margin-bottom: .25rem; }

#article-body strong { font-weight: 700; }
#article-body em { font-style: italic; }

#article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

#article-body pre {
  background: #1a1f2e;
  color: #c8cdd8;
  font-family: var(--mono-font);
  font-size: .85rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid #2a3044;
}

#article-body code {
  font-family: var(--mono-font);
  font-size: .85em;
  background: #f0f0ec;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: .15em .4em;
}

/* ── Table of Contents ─────────────────────────────────────────────────── */
#toc {
  float: right;
  clear: right;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  margin: 0 0 1.2rem 1.5rem;
  font-size: .88rem;
  min-width: 180px;
  max-width: 260px;
}
#toc-title {
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .4rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-family: var(--mono-font);
  font-size: .72rem;
}
#toc ol {
  margin: 0;
  padding-left: 1.2rem;
  list-style: decimal;
}
#toc ol ol {
  margin-top: .15rem;
  list-style: lower-alpha;
}
#toc li { margin-bottom: .2rem; }
#toc a { color: var(--accent-dim); }

/* ── Infobox ────────────────────────────────────────────────────────────── */
.infobox {
  float: right;
  clear: right;
  margin: 0 0 1.2rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  min-width: 220px;
  max-width: 300px;
  border-collapse: collapse;
  overflow: hidden;
}
.infobox .infobox-title {
  background: var(--sidebar-bg);
  color: #e8eaf6;
  font-family: var(--heading-font);
  font-size: .95rem;
  font-weight: 700;
  text-align: center;
  padding: .6rem .8rem;
  border-bottom: 2px solid var(--accent);
}
.infobox .infobox-image {
  text-align: center;
  padding: .5rem;
  border-bottom: 1px solid var(--border-light);
}
.infobox .infobox-image img {
  max-height: 180px;
  object-fit: contain;
}
.infobox th {
  background: #f4f4f0;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: .35rem .7rem;
  border: 1px solid var(--border-light);
  white-space: nowrap;
  font-size: .82rem;
}
.infobox td {
  padding: .35rem .7rem;
  border: 1px solid var(--border-light);
  vertical-align: top;
}

/* ── Wikitable ──────────────────────────────────────────────────────────── */
.wikitable {
  border-collapse: collapse;
  margin: 1rem 0;
  width: 100%;
  font-size: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.wikitable th {
  background: #f0f0ec;
  font-weight: 700;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.wikitable td {
  padding: .45rem .75rem;
  border: 1px solid var(--border-light);
  vertical-align: top;
}
.wikitable tr:nth-child(even) td { background: #fafaf8; }
.wikitable caption {
  caption-side: top;
  font-weight: 700;
  font-size: .9rem;
  padding: .4rem;
  color: var(--text-muted);
}

/* ── Notices ────────────────────────────────────────────────────────────── */
.notice {
  border-left: 4px solid var(--accent);
  background: var(--accent-glow);
  padding: .6rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: .8rem 0;
  font-size: .9rem;
}
.stub-notice { border-color: #e8a020; background: rgba(232,160,32,.08); }
.outdated-notice { border-color: #e04040; background: rgba(224,64,64,.06); }

.main-article {
  font-style: italic;
  color: var(--text-muted);
  margin: .5rem 0;
  padding: .3rem .8rem;
  border-left: 3px solid var(--border);
}
.see-also {
  background: #f4f4f0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .9rem;
  font-size: .9rem;
  margin: .6rem 0;
}

/* Article categories footer */
.article-categories {
  margin-top: 2rem;
  padding-top: .8rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-muted);
}
.article-categories a { margin: 0 .3rem; }

/* ── Edit Page ──────────────────────────────────────────────────────────── */
.edit-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
.edit-title {
  font-family: var(--heading-font);
  font-size: 1.6rem;
  margin-bottom: .3rem;
}
.edit-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}
.edit-help {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: .8rem 1.2rem;
  margin-bottom: 1rem;
  font-size: .84rem;
  color: var(--text-muted);
}
.edit-help strong { color: var(--text); }
.edit-help code { font-family: var(--mono-font); background: #f0f0ec; padding: .1em .3em; border-radius: 3px; }

.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .3rem;
}
.form-input, .form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .8rem;
  font-family: var(--body-font);
  font-size: .95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-textarea {
  font-family: var(--mono-font);
  font-size: .875rem;
  min-height: 500px;
  resize: vertical;
  line-height: 1.5;
}
.form-note { font-size: .8rem; color: var(--text-light); margin-top: .3rem; }

.edit-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .4rem;
}
.toolbar-btn {
  background: #f4f4f0;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .25rem .55rem;
  font-size: .8rem;
  cursor: pointer;
  font-family: var(--mono-font);
  transition: background .15s;
}
.toolbar-btn:hover { background: #e8e8e4; }

.btn {
  display: inline-block;
  padding: .55rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  border: none;
  transition: background .2s, transform .1s;
  text-decoration: none;
  font-family: var(--body-font);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-dim); color: #fff; }
.btn-primary:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-secondary { background: #e8e8e4; color: var(--text); }
.btn-secondary:hover { background: var(--border); text-decoration: none; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; text-decoration: none; }

.edit-actions { display: flex; gap: .8rem; margin-top: 1rem; align-items: center; }

/* ── Search Results ─────────────────────────────────────────────────────── */
.search-header { margin: 1.5rem 0 1rem; }
.search-title { font-family: var(--heading-font); font-size: 1.5rem; }
.search-count { color: var(--text-muted); font-size: .9rem; }

.search-results { list-style: none; }
.search-result-item {
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 0;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-title {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--heading-font);
}
.search-result-excerpt {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .25rem;
  line-height: 1.5;
}
.search-result-excerpt mark {
  background: rgba(79,156,249,.2);
  color: inherit;
  padding: .05em .2em;
  border-radius: 2px;
}

/* No article found */
.not-found-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
}
.not-found-box h2 { font-family: var(--heading-font); margin-bottom: .5rem; }
.not-found-box p { color: var(--text-muted); margin-bottom: 1rem; }

/* ── Category Page ──────────────────────────────────────────────────────── */
.category-header {
  padding: 1.5rem 0 1rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.category-name {
  font-family: var(--heading-font);
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.category-badge {
  font-size: .8rem;
  background: var(--accent-dim);
  color: #fff;
  padding: .2rem .6rem;
  border-radius: 10px;
  font-family: var(--mono-font);
  font-weight: 400;
}
.category-desc { color: var(--text-muted); font-size: .95rem; margin-top: .4rem; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  transition: box-shadow .2s, border-color .2s;
}
.article-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.article-card-title {
  font-family: var(--heading-font);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .3rem;
}
.article-card-desc {
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Main Page (Portal) ─────────────────────────────────────────────────── */
.portal-hero {
  background: linear-gradient(135deg, #0a0d14 0%, #0f1a2e 60%, #0d1520 100%);
  color: #e8eaf6;
  padding: 3rem 2rem;
  border-bottom: 1px solid #1e2535;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.portal-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 50%, rgba(79,156,249,.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(79,156,249,.05) 0%, transparent 70%);
}
.portal-hero-inner { position: relative; max-width: 700px; margin: 0 auto; }
.portal-title {
  font-family: var(--heading-font);
  font-size: 2.4rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: #ffffff;
}
.portal-title span { color: var(--accent); }
.portal-tagline {
  font-size: 1.05rem;
  color: #8a9ab8;
  margin-bottom: 1.5rem;
}
.portal-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.portal-stat-item { text-align: center; }
.portal-stat-num {
  font-family: var(--mono-font);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
}
.portal-stat-label {
  font-size: .78rem;
  color: #4a5568;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.portal-body { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.portal-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.portal-section-head {
  background: var(--sidebar-bg);
  color: #e8eaf6;
  padding: .65rem 1rem;
  font-family: var(--heading-font);
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.portal-section-head a { color: #9ab8e8; }
.portal-section-body { padding: .8rem 1rem; }
.portal-section-body ul { list-style: none; }
.portal-section-body ul li {
  padding: .3rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .9rem;
}
.portal-section-body ul li:last-child { border-bottom: none; }
.portal-section-body ul li a { font-weight: 600; }

.portal-featured {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 2rem;
}
.portal-featured-head {
  background: linear-gradient(90deg, #0f1117, #1a2040);
  color: #e8eaf6;
  padding: .7rem 1.2rem;
  font-family: var(--heading-font);
  font-size: 1rem;
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
}
.portal-featured-body {
  padding: 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 640px) { .portal-featured-body { grid-template-columns: 1fr; } }
.featured-desc { font-size: .92rem; line-height: 1.65; color: var(--text-muted); }
.featured-title { font-family: var(--heading-font); font-size: 1.2rem; margin-bottom: .4rem; }

/* ── History / Revisions ───────────────────────────────────────────────── */
.revision-list { list-style: none; }
.revision-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .875rem;
}
.revision-date { color: var(--text-muted); font-family: var(--mono-font); font-size: .8rem; }
.revision-user { font-weight: 600; }
.revision-summary { color: var(--text-muted); font-style: italic; }

/* ── Login / Register ──────────────────────────────────────────────────── */
.auth-container {
  max-width: 420px;
  margin: 3rem auto;
  padding: 0 1.5rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
}
.auth-title {
  font-family: var(--heading-font);
  font-size: 1.5rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

/* ── Flash messages ─────────────────────────────────────────────────────── */
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 600;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Recent Changes ─────────────────────────────────────────────────────── */
.rc-list { list-style: none; }
.rc-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .4rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .88rem;
}
.rc-date { color: var(--text-light); font-family: var(--mono-font); font-size: .78rem; min-width: 130px; }
.rc-title { font-weight: 700; }
.rc-user { color: var(--text-muted); }
.rc-new { background: #16a34a; color: #fff; font-size: .68rem; padding: .1em .4em; border-radius: 3px; font-weight: 700; vertical-align: middle; }

/* ── Special pages ─────────────────────────────────────────────────────── */
.special-title {
  font-family: var(--heading-font);
  font-size: 1.6rem;
  padding: 1.5rem 0 .8rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}
.alpha-group { margin-bottom: 1.5rem; }
.alpha-letter {
  font-family: var(--heading-font);
  font-size: 1.3rem;
  color: var(--accent-dim);
  margin-bottom: .4rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border-light);
}
.alpha-articles { list-style: none; columns: 3; }
.alpha-articles li { break-inside: avoid; padding: .15rem 0; font-size: .88rem; }

/* ── Footer ─────────────────────────────────────────────────────────────── */
#site-footer {
  background: var(--sidebar-bg);
  border-top: 1px solid #1c2030;
  color: #5a6278;
  font-size: .82rem;
  padding: 2rem 0;
}
.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}
.footer-col strong { color: #8a9ab8; display: block; margin-bottom: .5rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { padding: .15rem 0; }
.footer-col a { color: #5a6278; }
.footer-col a:hover { color: #8a9ab8; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar { display: none; }
  .alpha-articles { columns: 2; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  #topbar { padding: 0 .8rem; }
  .wordmark-wiki { display: none; }
  #user-menu { gap: .5rem; }
  #toc, .infobox { float: none; max-width: 100%; margin: 0 0 1rem 0; }
  .portal-featured-body { grid-template-columns: 1fr; }
  .portal-stats { gap: 1.2rem; }
  .alpha-articles { columns: 1; }
  .footer-inner { grid-template-columns: 1fr; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  #topbar, #sidebar, .article-tabs, #site-footer { display: none; }
  #content-wrap { margin: 0; }
  #article-body { font-size: 11pt; }
}
