/* ---------- Theme tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --bg-elevated: #131419;
  --bg-soft: #16181f;
  --bg-hover: #1d2029;
  --border: #24262f;
  --border-soft: #1c1e26;
  --text: #e7e9ee;
  --text-soft: #aab0bd;
  --text-dim: #767d8c;
  --text-strong: #ffffff;
  --accent: #3b82f6;
  --accent-strong: #2f6fe0;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --discord: #5865f2;
  --danger: #ef4444;
  --topbar-bg: rgba(12, 13, 16, 0.85);
  --code-bg: #0a0b0e;
  --code-text: #d7dbe3;
  --code-inline: #e3b3ff;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --radius-sm: 7px;
  --topbar-h: 56px;
  --sidebar-w: 270px;
  --content-max: 820px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}

/* ---------- Light theme ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-soft: #f3f4f6;
  --bg-hover: #e9ebef;
  --border: #e1e3e9;
  --border-soft: #edeef2;
  --text: #1c1e24;
  --text-soft: #515764;
  --text-dim: #8a909c;
  --text-strong: #0b0c10;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.10);
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --code-bg: #0f1115;
  --code-text: #d7dbe3;
  --code-inline: #a21caf;
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: var(--accent-soft); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand strong { color: var(--accent); font-weight: 700; }
.brand-logo { height: 24px; width: auto; display: block; }
/* The brand symbol is white; flip it to dark on light theme so it stays visible. */
html[data-theme="light"] .brand-logo,
html[data-theme="light"] .auth-logo { filter: invert(1); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.menu-toggle { display: none; }

.editor-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent);
  font-size: 13px; font-weight: 600; border: 1px solid transparent;
  transition: border-color 0.12s;
}
.editor-link:hover { border-color: var(--accent); text-decoration: none; }
@media (max-width: 560px) { .editor-link span { display: none; } }

.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: inline-flex; }

/* search */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin: 0 auto;
}
.topbar-search .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#searchInput:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#searchInput::placeholder { color: var(--text-dim); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 60vh;
  overflow-y: auto;
}
.search-results a {
  display: block;
  padding: 10px 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover,
.search-results a.active { background: var(--bg-hover); text-decoration: none; }
.search-results .r-title { font-weight: 600; font-size: 14px; }
.search-results .r-excerpt {
  color: var(--text-dim);
  font-size: 12.5px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-results .r-empty { padding: 14px; color: var(--text-dim); font-size: 13px; }

/* topbar right */
.topbar-right { display: flex; align-items: center; gap: 6px; }

.lang-switch, .user-menu { position: relative; }
.lang-current { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }

.user-btn {
  display: inline-flex;
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  border-radius: 50%;
}
.user-btn img { border-radius: 50%; border: 1px solid var(--border); display: block; }

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 50;
}
.dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
}
.dropdown a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.dropdown a.active { color: var(--accent); background: var(--accent-soft); }
.dropdown .lang-code {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  min-width: 30px;
  text-align: center;
}
.user-dropdown .user-name {
  padding: 8px 10px 6px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 4px;
}

/* ---------- Layout ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  max-width: 1320px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 22px 14px 60px;
  border-right: 1px solid var(--border-soft);
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list li { margin: 1px 0; }
.nav-list a {
  display: block;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 450;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav-list a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-list a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
}
.nav-group { margin-top: 18px; }
.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  padding: 6px 12px;
  margin-bottom: 3px;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}
.nav-group-title:hover { color: var(--text-soft); background: var(--bg-soft); }
.nav-chevron { flex-shrink: 0; transition: transform 0.18s ease; }
.nav-group.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-group-items { display: grid; grid-template-rows: 1fr; }
.nav-anim .nav-group-items { transition: grid-template-rows 0.2s ease; }
.nav-group.collapsed .nav-group-items { grid-template-rows: 0fr; }
.nav-group-items > .nav-list { overflow: hidden; min-height: 0; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 25;
}

/* ---------- On-page table of contents ---------- */
.toc {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 34px 20px 60px;
}
.toc-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-left: 11px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-soft);
  border-left: 2px solid var(--border);
  transition: color 0.12s, border-color 0.12s;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-l3 a { padding-left: 26px; font-size: 13px; }

html { scroll-behavior: smooth; }

/* ---------- Content ---------- */
.content {
  flex: 1;
  min-width: 0;
  padding: 38px 48px 100px;
}
.article {
  max-width: var(--content-max);
  margin: 0 auto;
}

.notice {
  max-width: var(--content-max);
  margin: 0 auto 26px;
  padding: 11px 15px;
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius);
  color: var(--accent-strong);
  font-size: 13.5px;
}

/* article typography */
.article h1, .article h2, .article h3, .article h4 {
  line-height: 1.25;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.article h1 {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.article h2 {
  font-size: 23px;
  font-weight: 650;
  margin: 42px 0 14px;
  padding-top: 6px;
}
.article h3 { font-size: 18px; font-weight: 600; margin: 30px 0 10px; }
.article h4 { font-size: 15.5px; font-weight: 600; margin: 22px 0 8px; color: var(--text-soft); }

.article p { margin: 0 0 16px; }
.article strong { color: var(--text-strong); font-weight: 650; }

.article a { font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(59,130,246,0.35); }
.article a:hover { border-bottom-color: var(--accent); }

.article ul, .article ol { margin: 0 0 18px; padding-left: 26px; }
.article li { margin: 6px 0; }
.article li::marker { color: var(--text-dim); }

.article blockquote {
  margin: 18px 0;
  padding: 4px 18px;
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 8px 0;
  display: block;
}

.article hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }

/* inline + block code */
.article :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1.5px 6px;
  color: var(--code-inline);
}
.article pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
}
.article pre code { font-family: var(--mono); background: none; border: none; padding: 0; color: var(--code-text); }

/* tables */
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 14px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.article th, .article td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.article th { background: var(--bg-soft); font-weight: 600; color: var(--text); }
.article tr:last-child td { border-bottom: none; }
.article tbody tr:hover { background: var(--bg-soft); }

/* ---------- Interactive hotspot figures ---------- */
.hotspot-figure { margin: 26px 0; }
.hotspot-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.hotspot-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0;
  border: none;
  border-radius: 0;
}
.hotspot-overlay { position: absolute; inset: 0; }
.hotspot-area {
  position: absolute;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 2px solid rgba(59, 130, 246, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.hotspot-area.shape-ellipse { border-radius: 50%; }
.hotspot-marker {
  position: absolute;
  top: -11px;
  left: -11px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.hotspot-area:hover,
.hotspot-area:focus-visible,
.hotspot-area.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}

.hotspot-legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.hotspot-item {
  display: flex;
  gap: 11px;
  padding: 9px 11px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.hotspot-item:hover,
.hotspot-item.active { background: var(--bg-soft); border-color: var(--accent); }
.hotspot-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border-radius: 50%;
  margin-top: 1px;
}
.hotspot-text strong { display: block; color: var(--text-strong); font-weight: 600; font-size: 14.5px; }
.hotspot-text p { margin: 3px 0 0; color: var(--text-soft); font-size: 13.5px; line-height: 1.55; }

.hotspot-tip {
  position: absolute;
  z-index: 6;
  max-width: 300px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  font-size: 13px;
  line-height: 1.55;
}
.hotspot-tip strong { display: block; color: var(--text-strong); margin-bottom: 2px; }
.hotspot-tip p { margin: 0; color: var(--text-soft); }
.hotspots-error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.article-footer {
  max-width: var(--content-max);
  margin: 48px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 13px;
}

.not-found { max-width: var(--content-max); margin: 40px auto; text-align: center; }

/* ---------- Admin dashboard ---------- */
.admin { max-width: 1240px; margin: 0 auto; padding: 30px 24px 90px; }
.admin-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.admin-head h1 { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.admin-stats { display: flex; align-items: center; gap: 16px; color: var(--text-soft); font-size: 14px; }
.admin-stats strong { color: var(--text); }
.admin-updated { color: var(--text-dim); font-size: 12px; }
.dot-online, .dot-off {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dot-online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18); }
.dot-off { background: var(--text-dim); }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; white-space: nowrap; }
.admin-table th {
  text-align: left; background: var(--bg-soft); color: var(--text-soft); font-weight: 600;
  padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg-soft); }
.admin-empty { text-align: center; color: var(--text-dim); padding: 24px; }
.u-cell { display: flex; align-items: center; gap: 10px; }
.u-av { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); flex-shrink: 0; }
.u-name { font-weight: 600; color: var(--text); }
.u-sub { color: var(--text-dim); font-size: 11.5px; }
.admin-table .mono { font-family: var(--mono); font-size: 12px; }
.admin-table .ua { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.badge {
  background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-admin { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-editor { background: var(--accent-soft); color: var(--accent); }
.role-regular { color: var(--text-dim); font-size: 12px; }
.btn-mini {
  font-family: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
  background: var(--bg-hover); color: var(--text); border: 1px solid var(--border);
  transition: border-color 0.12s, color 0.12s;
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }
.btn-mini:disabled { opacity: 0.6; cursor: default; }
.link-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 600; text-decoration: underline;
}
.guild-detail td { background: var(--bg); }
.guild-list { display: flex; flex-wrap: wrap; gap: 6px; white-space: normal; padding: 6px 0; max-width: 980px; }
.guild-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  border-radius: 20px; padding: 3px 11px; font-size: 12px; color: var(--text-soft);
}
.guild-chip img { width: 18px; height: 18px; border-radius: 50%; }
.guild-owner { color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.guild-chip.guild-left { opacity: 0.5; border-style: dashed; }
.guild-chip.guild-left img { filter: grayscale(1); }
.guild-left-tag { color: var(--text-dim); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.muted { color: var(--text-dim); font-size: 12px; }

/* ---------- In-site editor ---------- */
.edit-new { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.edit-new input, .edit-new select {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 8px 11px; font-size: 14px; font-family: inherit;
}
.edit-new input { min-width: 240px; }
.edit-langs { display: flex; gap: 5px; }
.lang-pill {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px;
  border: 1px solid var(--border); color: var(--text-soft);
}
.lang-pill:hover { text-decoration: none; }
.lang-pill.has { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.lang-pill.missing { color: var(--text-dim); border-style: dashed; }
.lang-pill.missing:hover { color: var(--text); border-color: var(--text-dim); }

.editor-body { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.editor-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-elevated);
}
.editor-bar .grow { flex: 1; }
.editor-title { color: var(--text-soft); font-size: 14px; }
.editor-fields { display: flex; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor-fields label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
}
.editor-fields input {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); padding: 7px 10px; font-size: 14px; font-family: inherit; text-transform: none; letter-spacing: 0;
}
.editor-fields input[type=number] { width: 90px; }
.editor-panes { flex: 1; display: flex; min-height: 0; }
.editor-left, .editor-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.editor-left { border-right: 1px solid var(--border); }
.editor-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-soft); }
.editor-hint { color: var(--text-dim); font-size: 12px; }
#body {
  flex: 1; width: 100%; border: none; resize: none; outline: none;
  background: var(--bg); color: var(--text); padding: 16px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65;
}
.editor-right { overflow-y: auto; }
.editor-preview-label { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.editor-right .article { padding: 20px 26px; max-width: none; }
.editor-toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 60;
  background: var(--bg-elevated); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 14px;
}
.editor-toast.err { border-color: var(--danger); color: #fca5a5; }
.edit-this { max-width: var(--content-max); margin: 0 auto 18px; }
.edit-this a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: var(--radius-sm);
}
.edit-this a:hover { text-decoration: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14.5px;
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-discord { background: var(--discord); }
.btn-discord:hover { background: #4752c4; }

/* ---------- Centered auth pages ---------- */
body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(59, 130, 246, 0.12), transparent 70%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  text-align: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 34px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { height: 60px; width: auto; margin: 0 auto 16px; }
.auth-card h1 { font-size: 26px; font-weight: 700; margin: 0 0 20px; letter-spacing: -0.02em; }
.auth-card h1 span { color: var(--accent); }
.auth-sub { color: var(--text-soft); margin: 0 0 24px; font-size: 14.5px; }
.auth-card .btn { width: 100%; }
.auth-note { color: var(--text-dim); font-size: 12.5px; margin: 16px 0 0; }
.auth-warn { color: #f5b74e; }

/* ---------- Responsive ---------- */
@media (max-width: 1160px) {
  .toc { display: none; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .brand span { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    height: auto;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
    width: 280px;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .sidebar-backdrop { display: block; }
  .content { padding: 26px 20px 80px; }
  .topbar-search { max-width: none; }
}

@media (max-width: 520px) {
  .lang-current { display: none; }
}
