:root { --comments-panel-width: 260px; --nav-sidebar-width: 240px; }

/* ── Dark mode ── */
html.dark-mode,
html.dark-mode body { background: #0d0d0d; color: #d0d0d0; }

html.dark-mode main { background-color: #0d0d0d; }

html.dark-mode .wiki-article-body p,
html.dark-mode .wiki-article-body li,
html.dark-mode .wiki-article-body dd { color: #c8c8c8; }

html.dark-mode .wiki-article-body h1,
html.dark-mode .wiki-article-body h2,
html.dark-mode .wiki-article-body h3,
html.dark-mode .wiki-article-body h4,
html.dark-mode .wiki-article-body h5,
html.dark-mode .wiki-article-body h6 { color: #ececec; }

html.dark-mode .wiki-article-body a { color: #60a5fa; }
html.dark-mode .wiki-article-body a:hover { color: #93c5fd; }

/* Force dark text on highlights in dark mode — inline color:inherit would otherwise pick up white */
html.dark-mode mark,
html.dark-mode #editorPreview mark,
html.dark-mode #notesPreview mark { color: #111 !important; }

html.dark-mode .wiki-article-body code {
  background: #1e1e2e;
  border-color: #333;
  color: #cdd6f4;
}

html.dark-mode .wiki-article-body pre { background: #1a1a2e; }

html.dark-mode .wiki-article-body blockquote {
  border-left-color: #334;
  color: #888;
}

html.dark-mode .wiki-article-body hr { border-color: #2a2a2a; }

html.dark-mode .wiki-article-body table th {
  background: #1a1a2e;
  color: #ccc;
}

html.dark-mode .wiki-article-body th,
html.dark-mode .wiki-article-body td { border-color: #2a2a2a; color: #c8c8c8; }

html.dark-mode .wiki-article-body { color: #c8c8c8; }

html.dark-mode .wiki-article-title { color: #f0f0f0; }
html.dark-mode .wiki-article-meta  { color: #4a4a4a; }
html.dark-mode .wiki-article-back  { color: #555; }
html.dark-mode .wiki-article-back:hover { color: #aaa; }

/* ── Table of Contents (floating) ── */
.wiki-toc {
  position: fixed;
  top: 80px;
  right: 20px;
  width: 220px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  z-index: 100;
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}

.wiki-toc--hidden .wiki-toc__body { display: none; }

.wiki-toc__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: grab;
  user-select: none;
}

.wiki-toc--hidden .wiki-toc__header { border-bottom: none; }

.wiki-toc__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
}

.wiki-toc__chevron {
  font-size: 11px;
  color: #bbb;
  line-height: 1;
}

.wiki-toc__body {
  overflow-y: auto;
  padding: 6px 0;
  flex: 1;
  min-height: 0;
}

.wiki-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-toc__link {
  display: block;
  height: auto;
  font-family: 'Raleway', sans-serif;
  padding: 3px 12px;
  color: #777;
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
  flex: 1;
  min-width: 0;
}

.wiki-toc__link:hover { color: #2563eb; }

.wiki-toc__link.active {
  color: #2563eb;
  border-left-color: #2563eb;
  background: #eff6ff;
}

.wiki-toc__link--h1 { font-weight: 600; }
.wiki-toc__link--h3 { font-size: 11px; color: #999; }
.wiki-toc__link--h4 { font-size: 11px; color: #bbb; }

/* ── TOC tree (fold / unfold) ── */
.wiki-toc__row {
  display: flex;
  align-items: center;
}

.wiki-toc__fold {
  background: none;
  border: none;
  padding: 0;
  width: 14px;
  min-width: 14px;
  height: auto;
  font-size: 8px;
  font-family: 'Raleway', sans-serif;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
}

.wiki-toc__fold:hover { color: #555; }

.wiki-toc__fold-space {
  display: inline-block;
  width: 14px;
  min-width: 14px;
  flex-shrink: 0;
}

.wiki-toc__children {
  list-style: none;
  padding: 0 0 0 14px;
  margin: 0;
}

.wiki-toc__children--folded { display: none; }

.wiki-toc__ctrl-btn {
  background: none;
  border: none;
  padding: 0 2px;
  width: auto;
  height: auto;
  font-size: 11px;
  font-family: 'Raleway', sans-serif;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

.wiki-toc__ctrl-btn:hover { color: #555; }
.wiki-toc__ctrl-btn--close:hover { color: #e53e3e; }

.wiki-toc--ghost {
  opacity: 0.18;
  transition: opacity 0.25s;
}

.wiki-toc--ghost:hover {
  opacity: 0.9;
}

@media (max-width: 1100px) { .wiki-toc { display: none !important; } }

html.dark-mode .wiki-toc {
  background: #13131f;
  border-color: #2a2a3e;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

html.dark-mode .wiki-toc__header { border-bottom-color: #2a2a3e; }
html.dark-mode .wiki-toc__label { color: #555; }
html.dark-mode .wiki-toc__chevron { color: #444; }
html.dark-mode .wiki-toc__link { color: #777; }
html.dark-mode .wiki-toc__link:hover { color: #60a5fa; }
html.dark-mode .wiki-toc__link.active {
  color: #60a5fa;
  border-left-color: #60a5fa;
  background: rgba(96,165,250,0.08);
}
html.dark-mode .wiki-toc__link--h3 { color: #555; }
html.dark-mode .wiki-toc__link--h4 { color: #444; }
html.dark-mode .wiki-toc__fold { color: #444; }
html.dark-mode .wiki-toc__fold:hover { color: #aaa; }
html.dark-mode .wiki-toc__ctrl-btn { color: #444; }
html.dark-mode .wiki-toc__ctrl-btn:hover { color: #aaa; }
html.dark-mode .wiki-toc__ctrl-btn--close:hover { color: #fc8181; }

/* ── Wiki list page ── */
.wiki-list-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

body {
  background-color: #fff;
}

main{
  background-color: white;
}

.wiki-list-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 32px;
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 16px;
}

.wiki-list-title {
  font-family: 'Oswald', sans-serif;
  font-size: 28px;
  font-weight: 500;
  color: #111;
  margin: 0;
}

.wiki-list-back {
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  color: #888;
  text-decoration: none;
}

.wiki-list-back:hover { color: #111; }

.wiki-article-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.wiki-article-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
  gap: 16px;
}

.wiki-article-item__title {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #111;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.wiki-article-item__title:hover { color: #2563eb; }

.wiki-article-item__date {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #bbb;
  flex-shrink: 0;
}

.wiki-empty {
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  color: #bbb;
  padding: 24px 0;
}

/* ── Article reader page ── */
.wiki-article-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  position: relative;
}

.wiki-article-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.wiki-article-back {
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  color: #888;
  text-decoration: none;
  display: inline-block;
}

.wiki-article-back:hover { color: #111; }

.wiki-article-nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wiki-article-edit {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #fff;
  background: #2563eb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background 0.15s;
}

.wiki-article-edit:hover { background: #1d4ed8; }

.wiki-present-dark-toggle {
  font-size: 13px;
  line-height: 1;
  background: none;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: #ccc;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.wiki-present-dark-toggle:hover {
  color: #555;
  border-color: #ccc;
}

.wiki-present-dark-toggle.active {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #f0e68c;
}

.wiki-article-dual {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #bbb;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.wiki-article-dual:hover {
  background: none;
  color: #555;
  border-color: #ccc;
}

.wiki-article-present {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #bbb;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s;
}

.wiki-article-present:hover {
  color: #555;
  border-color: #ccc;
}

.wiki-article-map {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #6b8fd4;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid #c5d3ef;
  border-radius: 4px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wiki-article-map:hover {
  color: #2563eb;
  border-color: #93aede;
  background: rgba(37,99,235,0.05);
}
html.dark-mode .wiki-article-map {
  color: #7aa0e0;
  border-color: #2a3a5a;
}
html.dark-mode .wiki-article-map:hover {
  color: #93c5fd;
  border-color: #3b5285;
  background: rgba(99,149,235,0.08);
}

/* ── Font picker ── */
.wiki-font-picker-btn {
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 600;
  color: #999;
  background: none;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wiki-font-picker-btn:hover { color: #555; border-color: #ccc; }
.wiki-font-picker-btn.active { color: #2563eb; border-color: #93aede; background: rgba(37,99,235,0.06); }

.wiki-font-panel {
  position: fixed;
  z-index: 300;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  padding: 10px;
  width: 260px;
}
.wiki-font-panel__title {
  font-family: 'Oswald', sans-serif;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 8px;
}
.wiki-font-options { display: flex; flex-direction: column; gap: 2px; }
.wiki-font-option {
  display: grid;
  grid-template-columns: 36px 80px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.1s;
}
.wiki-font-option:hover { background: #f5f5f5; }
.wiki-font-option--active { background: rgba(37,99,235,0.07); }
.wiki-font-option__preview {
  font-size: 20px;
  line-height: 1;
  color: #333;
  text-align: center;
}
.wiki-font-option__name {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #444;
  letter-spacing: 0.02em;
}
.wiki-font-option__sample {
  font-size: 10px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wiki-font-option--active .wiki-font-option__name { color: #2563eb; }

html.dark-mode .wiki-font-picker-btn { color: #666; border-color: #333; }
html.dark-mode .wiki-font-picker-btn:hover { color: #bbb; border-color: #555; }
html.dark-mode .wiki-font-picker-btn.active { color: #60a5fa; border-color: #3b5285; background: rgba(99,149,235,0.1); }
html.dark-mode .wiki-font-panel { background: #1e1e1e; border-color: #2a2a2a; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
html.dark-mode .wiki-font-panel__title { color: #555; }
html.dark-mode .wiki-font-option:hover { background: #2a2a2a; }
html.dark-mode .wiki-font-option--active { background: rgba(96,165,250,0.1); }
html.dark-mode .wiki-font-option__preview { color: #ccc; }
html.dark-mode .wiki-font-option__name { color: #bbb; }
html.dark-mode .wiki-font-option__sample { color: #555; }
html.dark-mode .wiki-font-option--active .wiki-font-option__name { color: #60a5fa; }

/* ── Comments toggle button ── */
.wiki-comments-toggle {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #a07020;
  background: rgba(255,210,0,0.08);
  border: 1px solid rgba(212,146,10,0.3);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wiki-comments-toggle:hover {
  color: #7a5000;
  border-color: #d4920a;
  background: rgba(255,210,0,0.16);
}
.wiki-comments-toggle.active {
  color: #7a5000;
  border-color: #d4920a;
  background: rgba(255,210,0,0.22);
}
html.dark-mode .wiki-comments-toggle { color: #e0a830; border-color: rgba(224,168,48,0.3); background: rgba(255,200,0,0.06); }
html.dark-mode .wiki-comments-toggle:hover { color: #fbbf24; border-color: #e0a830; background: rgba(255,200,0,0.14); }
html.dark-mode .wiki-comments-toggle.active { color: #fbbf24; border-color: #e0a830; background: rgba(255,200,0,0.18); }


.wiki-article-title {
  font-family: 'Oswald', sans-serif;
  font-size: clamp(24px, 5vw, 38px);
  font-weight: 500;
  color: #111;
  margin: 0 0 8px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.wiki-article-meta {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #bbb;
  margin-bottom: 36px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.wiki-youtube-embed {
  position: relative; width: 100%; padding-top: 56.25%; /* 16:9 */
  margin-bottom: 32px; border-radius: 6px; overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,0.12);
}
.wiki-youtube-embed iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* ── Article body (markdown rendered) ── */
.wiki-article-body {
  font-family: var(--wiki-body-font, 'Raleway', sans-serif);
  font-size: 15px;
  line-height: 1.8;
  color: #333;
}
.wiki-article-body p,
.wiki-article-body li,
.wiki-article-body dt,
.wiki-article-body dd,
.wiki-article-body blockquote {
  font-family: var(--wiki-body-font, 'Raleway', sans-serif);
}

.wiki-article-body h1,
.wiki-article-body h2,
.wiki-article-body h3,
.wiki-article-body h4 {
  font-family: var(--wiki-body-font, 'Oswald', sans-serif);
  font-weight: 500;
  color: #111;
  margin: 1.6em 0 0.5em;
  line-height: 1.2;
}

.wiki-article-body h1 { font-size: 26px; }
.wiki-article-body h2 { font-size: 21px; border-bottom: 1px solid #f0f0f0; padding-bottom: 6px; }
.wiki-article-body h3 { font-size: 17px; }
.wiki-article-body h4 { font-size: 14px; letter-spacing: 0.05em; text-transform: uppercase; }

.wiki-article-body p  { margin: 0 0 1.2em; color: #333; }
.wiki-article-body ul,
.wiki-article-body ol { padding-left: 1.6em; margin: 0 0 1.2em; }
.wiki-article-body li { margin-bottom: 0.3em; }

.wiki-article-body a {
  display: inline;
  color: #2563eb;
  text-decoration: none;
  height: auto;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  align-items: unset;
}
.wiki-article-body a:hover { text-decoration: underline; }

.wiki-article-body blockquote {
  border-left: 3px solid #ddd;
  margin: 0 0 1.2em;
  padding: 4px 16px;
  color: #777;
  font-style: italic;
}

.wiki-article-body code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  border-radius: 3px;
  padding: 1px 5px;
}

.wiki-article-body pre {
  background: #282c34;
  border-radius: 6px;
  padding: 0;
  overflow: hidden;
  margin: 0 0 1.2em;
}

.wiki-article-body pre code {
  background: none;
  border: none;
  color: #abb2bf;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  display: block;
  padding: 16px;
  overflow-x: auto;
}

/* When hljs is active the line-numbers table provides all internal spacing */
.wiki-article-body pre code.hljs {
  padding: 0;
}

/* ── Line numbers (CSS-counter approach, safe with wiki-comment spans) ── */
pre.hljs-lines {
  padding-left: 3.5em !important;
  position: relative;
}

pre.hljs-lines code.hljs {
  padding: 14px 16px !important;
}

.hljs-line-numbers-rows {
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5em;
  padding-top: 14px;
  box-sizing: border-box;
  border-right: 1px solid #3e4451;
  user-select: none;
  pointer-events: none;
  counter-reset: linenumber;
}

.hljs-line-numbers-rows > span {
  display: block;
  line-height: 1.6;
  counter-increment: linenumber;
}

.hljs-line-numbers-rows > span::before {
  content: counter(linenumber);
  color: #4b5263;
  display: block;
  text-align: right;
  padding-right: 0.8em;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

/* ── Line-numbers table ── */
.hljs-ln {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.6;
}

.hljs-ln tr,
.wiki-article-body .hljs-ln tr { border: none; background: transparent; }
.hljs-ln td,
.wiki-article-body .hljs-ln td { padding: 0; vertical-align: top; border: none; background: transparent; }

.hljs-ln-numbers {
  user-select: none;
  text-align: right;
  color: #4b5263;
  border-right: 1px solid #3e4451;
  padding: 0 12px !important;
  white-space: nowrap;
  width: 1%;
}

.hljs-ln-code { padding: 0 16px !important; }

/* First/last row top/bottom padding to mimic block padding */
.hljs-ln tr:first-child td,
.wiki-article-body .hljs-ln tr:first-child td { padding-top: 14px !important; }
.hljs-ln tr:last-child td,
.wiki-article-body .hljs-ln tr:last-child  td { padding-bottom: 14px !important; }

.wiki-article-body hr {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 2em 0;
}

.wiki-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2em;
  font-size: 13px;
}

.wiki-article-body th,
.wiki-article-body td {
  border: 1px solid #e8e8e8;
  padding: 8px 12px;
  text-align: left;
}

.wiki-article-body th { background: #f7f7f7; font-family: 'Oswald', sans-serif; font-weight: 500; }

/* ── Admin article list (no scroll cap) ── */
.admin-article-list {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

/* ── Pagination ── */
.wiki-pagination {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid #f0f0f0;
}

.wiki-pagination__perpage {
  display: flex;
  align-items: center;
}

.wiki-pagination__nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.page-btn {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 400;
  width: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  background: white;
  color: #555;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  line-height: 1;
}

.page-btn:hover:not(:disabled) {
  background: #f0f0f0;
  color: #111;
}

.page-btn.active {
  background: #111;
  color: white;
  border-color: #111;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Wiki admin editor ── */
main {
  display: block !important;
}

.wiki-admin-editor {
  display: flex;
  flex-direction: column;
  position: relative;
  flex: 1;
  min-height: 0;
}

/* ── Extras side panel ── */
.wiki-admin-extras-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 268px;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  box-shadow: -6px 0 24px rgba(0,0,0,0.07);
  overflow: hidden;
}
.wiki-admin-editor.extras-open .wiki-admin-extras-panel {
  transform: translateX(0);
}
.wiki-admin-extras-panel__header {
  display: flex;
  align-items: center;
  padding: 11px 14px 10px;
  border-bottom: 1px solid #eeeeee;
  flex-shrink: 0;
}
.wiki-admin-extras-panel__title {
  flex: 1;
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #888;
}
.wiki-admin-extras-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: #bbb;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}
.wiki-admin-extras-panel__close:hover { color: #555; background: #f0f0f0; }
.wiki-admin-extras-panel__body {
  flex: 1;
  overflow-y: auto;
}
.wiki-admin-extras-section {
  padding: 12px 14px;
  border-bottom: 1px solid #f2f2f2;
}
.wiki-admin-extras-section__label {
  font-size: 10px;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}
.wiki-admin-extras-section #editorYoutube {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  font-family: monospace;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  outline: none;
  color: #333;
  background: #fafafa;
}
.wiki-admin-extras-section #editorYoutube:focus { border-color: #2563eb; background: #fff; }
.wiki-admin-extras-views {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wiki-admin-extras-views .wiki-admin-tab {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 12px;
  color: #555;
  background: none;
  margin-bottom: 0;
}
.wiki-admin-extras-views .wiki-admin-tab:hover { background: #f5f5f5; color: #222; border-color: #e8e8e8; }
.wiki-admin-extras-views .wiki-admin-tab.active {
  background: #f0f0f0;
  color: #111;
  border-color: #ddd;
  border-bottom-color: #ddd;
}
.wiki-admin-extras-ext-link { opacity: 0.7; }
.wiki-admin-extras-section--files { padding-top: 10px; padding-bottom: 10px; }
.wiki-admin-extras-section--files .wiki-admin-editor__files-header { margin-bottom: 8px; }
.wiki-admin-extras-section--files .wiki-admin-editor__files-list { flex-wrap: wrap; }

/* ── Editor content area (flex row: panels + docked TOC) ── */
.wiki-admin-editor__content {
  display: flex;
  flex: 1;
  min-height: 0;
}
.wiki-admin-editor__panels {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ── Docked TOC (inside editor, not floating) ── */
.wiki-toc--docked {
  position: static !important;
  width: 210px;
  flex-shrink: 0;
  border-radius: 0 !important;
  border: none !important;
  border-left: 1px solid #e8e8e8 !important;
  box-shadow: none !important;
  max-height: none !important;
  height: auto;
  background: #fafafa !important;
  overflow: hidden;
  transition: width 0.2s ease;
}
.wiki-toc--docked .wiki-toc__header {
  cursor: default !important;
  user-select: auto !important;
}
/* Collapsed: shrink to a narrow strip showing only the chevron */
.wiki-toc--docked.wiki-toc--hidden {
  width: 28px;
}
.wiki-toc--docked.wiki-toc--hidden .wiki-toc__label,
.wiki-toc--docked.wiki-toc--hidden .wiki-toc__ctrl-btn--close {
  display: none;
}
.wiki-toc--docked.wiki-toc--hidden .wiki-toc__header {
  padding: 10px 0;
  justify-content: center;
  border-bottom: none;
}
html.dark-mode .wiki-toc--docked {
  background: #151519 !important;
  border-left-color: #2a2a2a !important;
}
html.dark-mode .wiki-toc--docked .wiki-toc__header { border-bottom-color: #2a2a2a; }

/* ── Extras toggle button active state ── */
.wiki-admin-editor.extras-open #extrasToggleBtn {
  background: #111;
  color: #fff;
  border-color: #111;
}
html.dark-mode .wiki-admin-editor.extras-open #extrasToggleBtn {
  background: #e0e0e0;
  color: #111;
  border-color: #e0e0e0;
}

/* ── Tab indicator bar (shown when on JSX/Notes view) ── */
.wiki-admin-tab-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px;
  background: #f8f8f8;
  border-bottom: 1px solid #eeeeee;
  flex-shrink: 0;
}
.wiki-admin-tab-indicator__name {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #999;
}
.wiki-admin-tab-indicator__back {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  background: none;
  border: none;
  cursor: pointer;
  color: #2563eb;
  padding: 0;
  text-decoration: none;
}
.wiki-admin-tab-indicator__back:hover { text-decoration: underline; }

.wiki-admin-editor__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px 14px;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
}

.wiki-admin-editor__title {
  flex: 1;
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  font-weight: 500;
  border: none;
  outline: none;
  color: #111;
  background: transparent;
  min-width: 0;
}

.wiki-admin-editor__title::placeholder { color: #ccc; }

.wiki-admin-editor__toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wiki-admin-editor__slug {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  color: #aaa;
}

.wiki-admin-editor__tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e8e8e8;
  flex-shrink: 0;
  padding: 0 28px;
}

.wiki-admin-tab {
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #999;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 14px 7px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.1s, border-color 0.1s;
}

.wiki-admin-tab:hover { color: #333; }

.wiki-admin-tab.active {
  color: #111;
  border-bottom-color: #111;
}

.wiki-admin-editor__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wiki-admin-editor__jsx {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wiki-admin-editor__jsx-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wiki-admin-editor__jsx-split iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-left: 1px solid #e8e8e8;
  display: block;
}

.wiki-admin-editor__jsx-hint {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #999;
  padding: 10px 24px 8px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.wiki-admin-editor__jsx-hint code {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  border-radius: 2px;
  padding: 1px 4px;
}

.wiki-admin-editor__notes {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.wiki-admin-editor__notes-hint {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #999;
  padding: 10px 24px 8px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.wiki-admin-editor__notes-text {
  flex: 1;
  width: 100%;
  min-height: 0;
  resize: none;
  border: none;
  outline: none;
  padding: 20px 24px;
  font-family: 'Raleway', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: #333;
  background: transparent;
  box-sizing: border-box;
}

.wiki-admin-editor__notes-text::placeholder { color: #ccc; }

.wiki-admin-editor__page {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}


.wiki-admin-editor__jsx-code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  border: none;
  border-right: 1px solid #e8e8e8;
  padding: 20px 24px;
  outline: none;
  overflow-y: auto;
  color: #333;
  background: #fafafa;
  width: 100%;
  height: 100%;
}

.wiki-admin-editor__md {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  border: none;
  border-right: 1px solid #e8e8e8;
  padding: 20px 24px;
  outline: none;
  overflow-y: hidden;
  color: #333;
  background: #fafafa;
  min-height: calc(100vh - 180px);
  box-sizing: border-box;
}

.wiki-admin-editor__preview-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.wiki-admin-editor__highlight-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-bottom: 1px solid #e8e8e8;
  background: #fafafa;
  flex-shrink: 0;
}

.hl-label {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #aaa;
  margin-right: 3px;
}

.hl-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Raleway', sans-serif;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: border-color 0.1s, box-shadow 0.1s, background 0.1s;
}

.hl-btn:hover {
  border-color: rgba(0, 0, 0, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

html.dark-mode .hl-btn {
  background: #2a2a2a;
  color: #d0d0d0;
  border-color: rgba(255,255,255,0.12);
}
html.dark-mode .hl-btn:hover {
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.hl-btn--clear {
  background: white;
  color: #bbb;
  font-size: 10px;
  font-weight: 400;
  margin-left: 3px;
}

.hl-btn--action {
  background: white;
  color: #555;
  font-size: 13px;
  font-weight: 400;
}

.hl-btn--action:disabled {
  color: #ccc;
  cursor: default;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.hl-btn--bold {
  background: white;
  font-weight: 900;
}

.hl-btn--italic {
  background: white;
  font-style: italic;
}

.hl-btn--underline {
  background: white;
  text-decoration: underline;
}

.hl-btn--strike {
  background: white;
  text-decoration: line-through;
}

.hl-btn--code {
  background: white;
  font-family: monospace;
  font-size: 13px;
  font-weight: 400;
  color: #c7254e;
}

.hl-sep {
  width: 1px;
  height: 16px;
  background: #e0e0e0;
  margin: 0 4px;
  flex-shrink: 0;
}

.wiki-admin-editor__preview {
  padding: 20px 28px;
  overflow-y: visible;
  font-size: 14px;
  flex: 1;
  min-height: calc(100vh - 180px);
  box-sizing: border-box;
}

.wiki-admin-editor__preview:focus {
  outline: none;
}

.wiki-admin-editor--article-width .wiki-admin-editor__preview {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* ── JSX diagram in article ── */
.wiki-diagram-wrapper {
  margin: 32px -24px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e8e8e8;
  background: #050810;
  min-height: 400px;
  isolation: isolate;
}

.wiki-diagram-wrapper #root {
  display: block;
  width: 100%;
  min-height: 400px;
}

/* Isolate diagram from global element resets */
.wiki-diagram-wrapper button,
.wiki-diagram-wrapper a,
.wiki-diagram-wrapper p,
.wiki-diagram-wrapper label,
.wiki-diagram-wrapper input,
.wiki-diagram-wrapper select {
  all: revert;
}

/* ── Week card article links ── */
.week-section--articles {
  border-top: 1px solid #f0f0f0;
  padding-top: 10px;
}

.week-section--articles .week-section__label { color: #2563eb; }

.week-articles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-article-link {
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  padding-left: 18px;
  position: relative;
}

.week-article-link::before {
  content: '📄';
  position: absolute;
  left: 0;
  font-size: 11px;
  top: 1px;
}

/* ── Sidebar view toggle (Flat / Tree) ── */
.wiki-view-toggle {
  display: flex;
  gap: 3px;
  padding: 6px 8px;
  border-bottom: 1px solid #e8e8e8;
}

.wiki-view-btn {
  flex: 1;
  padding: 3px 6px;
  font-size: 11px;
  font-family: 'Raleway', sans-serif;
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  color: #888;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.wiki-view-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.wiki-view-btn:hover:not(.active) {
  background: #f5f5f5;
  color: #333;
}

/* ── Article tree list ── */
.admin-article-tree {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  flex: 1;
}

.wiki-tree-node { margin: 0; padding: 0; }

.wiki-tree-row {
  display: flex;
  align-items: center;
  padding: 3px 4px 3px 0;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.1s;
  gap: 2px;
  min-width: 0;
}

.wiki-tree-row:hover { background: #f5f7ff; }
.wiki-tree-node.active > .wiki-tree-row { background: #eff6ff; }

.wiki-tree-toggle {
  width: 18px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 10px;
  color: #aaa;
  cursor: pointer;
  padding: 0;
  border-radius: 3px;
  flex-shrink: 0;
}

.wiki-tree-toggle:hover { background: #e8e8e8; color: #333; }
.wiki-tree-toggle--leaf { cursor: default; pointer-events: none; color: transparent; }

.wiki-tree-label {
  flex: 1;
  min-width: 0;
  padding: 0 2px;
  overflow: hidden;
}

.wiki-tree-title {
  display: block;
  font-size: 12px;
  font-family: 'Raleway', sans-serif;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-tree-slug {
  display: block;
  font-size: 10px;
  color: #bbb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-tree-actions {
  display: none;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.wiki-tree-row:hover .wiki-tree-actions,
.wiki-tree-node.active > .wiki-tree-row .wiki-tree-actions { display: flex; }

.wiki-tree-children {
  list-style: none;
  padding: 0 0 0 18px;
  margin: 0;
}

.wiki-tree-children--collapsed { display: none; }

/* dark mode */
html.dark-mode .wiki-view-toggle { border-bottom-color: #222; }
html.dark-mode .wiki-view-btn { border-color: #333; color: #777; }
html.dark-mode .wiki-view-btn:hover:not(.active) { background: #1a1a2e; color: #ccc; }
html.dark-mode .wiki-tree-row:hover { background: #1a1a2e; }
html.dark-mode .wiki-tree-node.active > .wiki-tree-row { background: rgba(37,99,235,0.15); }
html.dark-mode .wiki-tree-toggle { color: #555; }
html.dark-mode .wiki-tree-toggle:hover { background: #2a2a3e; color: #ccc; }
html.dark-mode .wiki-tree-title { color: #d0d0d0; }
html.dark-mode .wiki-tree-slug { color: #555; }

.week-article-link:hover { text-decoration: underline; }

/* ── Public wiki search bar ── */
.wiki-search-bar {
  padding: 10px 0 6px;
}

.wiki-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
  color: #333;
  background: #fafafa;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wiki-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: #fff;
}

/* ── Public wiki view toggle overrides ── */
.wiki-list-page .wiki-view-toggle {
  padding: 8px 0;
  border-bottom: none;
  border-top: 1px solid #f0f0f0;
  margin-bottom: 4px;
}

.wiki-list-page .wiki-view-btn {
  flex: 0;
  padding: 4px 12px;
}

/* ── Public wiki tree ── */
.wiki-public-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wiki-public-tree .wiki-tree-row {
  display: flex;
  text-decoration: none;
  padding: 6px 6px 6px 0;
}

.wiki-public-tree .wiki-tree-row:hover .wiki-tree-title {
  color: #2563eb;
}

.wiki-public-tree .wiki-tree-title {
  font-size: 14px;
}

.wiki-public-tree .wiki-tree-toggle {
  width: 22px;
  min-width: 22px;
  height: 22px;
  font-size: 11px;
}

.wiki-public-tree .wiki-tree-children {
  padding-left: 22px;
}

/* dark mode */
html.dark-mode .wiki-search-input {
  background: #1a1a2e;
  border-color: #333;
  color: #d0d0d0;
}

html.dark-mode .wiki-search-input:focus {
  border-color: #2563eb;
  background: #16213e;
}

html.dark-mode .wiki-list-page .wiki-view-toggle {
  border-top-color: #222;
}

/* ── Article page with sidebar layout ── */
.wiki-article-layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 99px);
  position: relative;
}

.wiki-nav-sidebar {
  width: var(--nav-sidebar-width);
  min-width: var(--nav-sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e8e8e8;
  background: #fafafa;
  transition: width 0.2s, min-width 0.2s, border-color 0.2s;
}

.wiki-nav-sidebar--resizing {
  transition: none !important;
}

.wiki-nav-sidebar-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
.wiki-nav-sidebar-resize-handle:hover,
.wiki-nav-sidebar-resize-handle.dragging {
  background: rgba(0, 120, 212, 0.25);
}

.wiki-article-layout.sidebar-collapsed .wiki-nav-sidebar {
  width: 0;
  min-width: 0;
  border-right-color: transparent;
}

.wiki-nav-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 10px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.wiki-nav-sidebar__home {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.wiki-nav-sidebar__home:hover { color: #2563eb; }

.wiki-nav-sidebar__toggle {
  background: none;
  border: none;
  font-size: 10px;
  color: #bbb;
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 3px;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}

.wiki-nav-sidebar__toggle:hover {
  background: #eee;
  color: #555;
}

.wiki-nav-sidebar__tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

/* Floating expand button shown when sidebar is collapsed */
.wiki-nav-expand-btn {
  display: none;
  position: fixed;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 5px;
  cursor: pointer;
  font-size: 10px;
  color: #999;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
  z-index: 50;
  transition: color 0.1s, border-color 0.1s;
}

.wiki-article-layout.sidebar-collapsed .wiki-nav-expand-btn {
  display: block;
}

.wiki-nav-expand-btn:hover {
  color: #2563eb;
  border-color: #2563eb;
}

.wiki-article-main {
  flex: 1;
  min-width: 0;
}

/* Override article page to fill the main column */
.wiki-article-main .wiki-article-page {
  max-width: 760px;
  margin: 0 auto;
}

/* ── Comments panel ── */
.wiki-comments-panel {
  position: relative;
  width: 0;
  min-width: 0;
  flex-shrink: 0;
  overflow: hidden;
  border-left: 1px solid transparent;
  transition: width 0.25s ease, min-width 0.25s ease, border-color 0.25s;
}

.wiki-comments-panel--resizing,
.wiki-comments-panel--resizing .wiki-comments-panel__inner {
  transition: none !important;
}

.wiki-article-layout.comments-open .wiki-comments-panel {
  width: var(--comments-panel-width);
  min-width: var(--comments-panel-width);
  border-left-color: #e8e8e8;
  overflow: visible;
}

.wiki-comments-panel__inner {
  width: var(--comments-panel-width);
  padding: 16px 0 0;
  box-sizing: border-box;
  background: #fff;
}

.wiki-comments-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
.wiki-comments-resize-handle:hover,
.wiki-comments-resize-handle.dragging {
  background: rgba(0, 120, 212, 0.25);
}

.wiki-comments-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 0 14px 10px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.wiki-comments-panel__title {
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  letter-spacing: 0.03em;
}

.wiki-comments-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}
.wiki-comments-panel__close:hover { color: #555; background: #f0f0f0; }

.wiki-comments-panel__empty {
  font-size: 12px;
  color: #aaa;
  padding: 12px 0;
  text-align: center;
}

.wiki-comments-entry {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, top 0.28s ease;
  box-sizing: border-box;
}
.wiki-comments-entry:hover {
  background: rgba(255,210,0,0.08);
  border-left-color: #d4920a;
}

.wiki-comments-entry__num {
  width: 20px;
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,210,0,0.35);
  border: 1px solid #d4920a;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7a5000;
  flex-shrink: 0;
  margin-top: 1px;
}

.wiki-comments-entry__excerpt {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #999;
  font-style: italic;
  margin-bottom: 4px;
  line-height: 1.5;
  transition: margin-bottom 0.25s ease;
}

.wiki-comments-entry--collapsed .wiki-comments-entry__excerpt {
  margin-bottom: 0;
}

.wiki-comments-entry__excerpt::after {
  content: ' ▾';
  font-style: normal;
  font-size: 9px;
  opacity: 0.4;
}

.wiki-comments-entry:not(.wiki-comments-entry--collapsed) .wiki-comments-entry__excerpt::after {
  content: ' ▴';
}

.wiki-comments-entry__text {
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  color: #333;
  line-height: 1.6;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.25s ease;
}

.wiki-comments-entry--collapsed .wiki-comments-entry__text {
  max-height: 0;
}
.wiki-comments-entry__text p  { margin: 0 0 6px; color: #333; }
.wiki-comments-entry__text p:last-child { margin-bottom: 0; }
.wiki-comments-entry__text code { background: rgba(0,0,0,0.07); border-radius: 3px; padding: 1px 4px; font-size: 0.9em; }
.wiki-comments-entry__text pre  { background: rgba(0,0,0,0.05); border-radius: 4px; padding: 5px 8px; margin: 4px 0; overflow-x: auto; }
.wiki-comments-entry__text pre code { background: none; padding: 0; }
.wiki-comments-entry__text ul, .wiki-comments-entry__text ol { margin: 3px 0; padding-left: 16px; }
.wiki-comments-entry__text li { margin: 2px 0; }

/* Number marker superscript on the highlighted span */
.wiki-comment-marker {
  font-size: 9px;
  font-weight: 700;
  color: #b87c0a;
  vertical-align: super;
  line-height: 1;
  margin-left: 1px;
  pointer-events: none;
}

/* Hover + flash from panel interaction */
.wiki-comment--hover { background: rgba(255,200,0,0.48) !important; }

@keyframes wiki-comment-flash {
  0%   { background: rgba(255,220,0,0.7); }
  100% { background: rgba(255,210,0,0.28); }
}
.wiki-comment--flash { animation: wiki-comment-flash 0.45s ease 3; }

/* Dark mode */
html.dark-mode .wiki-article-layout.comments-open .wiki-comments-panel { border-left-color: #2a2a3a; }
html.dark-mode .wiki-comments-panel__inner { background: #0d0d0d; }
html.dark-mode .wiki-comments-panel__header { border-bottom-color: #2a2a3a; }
html.dark-mode .wiki-comments-panel__title { color: #d0d0d0; }
html.dark-mode .wiki-comments-panel__close { color: #555; }
html.dark-mode .wiki-comments-panel__close:hover { color: #aaa; background: #1a1a2e; }
html.dark-mode .wiki-comments-entry:hover { background: rgba(255,200,0,0.06); }
html.dark-mode .wiki-comments-entry__num { background: rgba(255,200,0,0.15); color: #e0a830; }
html.dark-mode .wiki-comments-entry__excerpt { color: #555; }
html.dark-mode .wiki-comments-entry__text { color: #e0e0e0; }
html.dark-mode .wiki-comments-entry__text p { color: #e0e0e0; }
html.dark-mode .wiki-comments-entry__text code { background: rgba(255,255,255,0.1); }
html.dark-mode .wiki-comments-entry__text pre  { background: rgba(0,0,0,0.3); }
html.dark-mode .wiki-comment-marker { color: #c08820; }

/* Responsive: hide panel on narrow screens */
@media (max-width: 900px) {
  .wiki-article-layout.comments-open .wiki-comments-panel {
    display: none;
  }
}

/* Responsive: hide sidebar on narrow screens */
@media (max-width: 900px) {
  .wiki-article-layout {
    display: block;
  }
  .wiki-nav-sidebar {
    display: none !important;
  }
  .wiki-nav-expand-btn {
    display: none !important;
  }
}

/* Dark mode */
html.dark-mode .wiki-nav-sidebar {
  background: #0f0f1a;
  border-right-color: #222;
}

html.dark-mode .wiki-article-layout.sidebar-collapsed .wiki-nav-sidebar {
  border-right-color: transparent;
}

html.dark-mode .wiki-nav-sidebar__header {
  border-bottom-color: #222;
}

html.dark-mode .wiki-nav-sidebar__home { color: #d0d0d0; }
html.dark-mode .wiki-nav-sidebar__home:hover { color: #60a5fa; }

html.dark-mode .wiki-nav-sidebar__toggle { color: #444; }
html.dark-mode .wiki-nav-sidebar__toggle:hover { background: #1a1a2e; color: #aaa; }

html.dark-mode .wiki-nav-expand-btn {
  background: #13131f;
  border-color: #333;
  color: #555;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

html.dark-mode .wiki-nav-expand-btn:hover { color: #60a5fa; border-color: #60a5fa; }

/* ── Tree drag & drop ── */
.wiki-tree-row[draggable="true"] { cursor: grab; }
.wiki-tree-row[draggable="true"]:active { cursor: grabbing; }

.wiki-tree-node.dragging { opacity: 0.35; pointer-events: none; }

.wiki-tree-row--drop-before {
  box-shadow: inset 0 2px 0 0 #2563eb;
}
.wiki-tree-row--drop-after {
  box-shadow: inset 0 -2px 0 0 #2563eb;
}
.wiki-tree-row--drop-inside {
  background: rgba(37,99,235,0.1) !important;
  box-shadow: inset 0 0 0 1px #2563eb;
  border-radius: 4px;
}

html.dark-mode .wiki-tree-row--drop-before { box-shadow: inset 0 2px 0 0 #60a5fa; }
html.dark-mode .wiki-tree-row--drop-after  { box-shadow: inset 0 -2px 0 0 #60a5fa; }
html.dark-mode .wiki-tree-row--drop-inside {
  background: rgba(96,165,250,0.1) !important;
  box-shadow: inset 0 0 0 1px #60a5fa;
}

/* ── Sub-articles placeholder in admin preview ── */
.wiki-subtree-placeholder {
  position: relative;
  color: transparent !important;
  background: #f1f5f9;
  border: 1.5px dashed #cbd5e1;
  border-radius: 5px;
  padding: 8px 12px;
  margin: 6px 0;
  display: block;
  cursor: default;
  user-select: none;
  min-height: 32px;
}
.wiki-subtree-placeholder::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  font-family: 'Raleway', sans-serif;
  pointer-events: none;
}
html.dark-mode .wiki-subtree-placeholder { background: #1e293b; border-color: #475569; }
html.dark-mode .wiki-subtree-placeholder::after { color: #94a3b8; }

/* ── Sub-articles block – shared base ── */
.wiki-subtree {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  margin: 14px 0;
  background: #f8fafc;
  display: inline-block;
  min-width: 160px;
}
.wiki-subtree__title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 5px;
}
.wiki-subtree__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.wiki-subtree__item {
  padding-left: 13px;
  margin: 0;
  position: relative;
  line-height: 1.7;
}
.wiki-subtree__list--root > .wiki-subtree__item { padding-left: 0; }
.wiki-subtree__item::before {
  content: '';
  position: absolute;
  left: 3px; top: 9px;
  width: 5px; height: 1px;
  background: #cbd5e1;
}
.wiki-subtree__list--root > .wiki-subtree__item::before { display: none; }
.wiki-subtree__link {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  border-radius: 2px;
}
.wiki-subtree__link:hover { text-decoration: underline; }
.wiki-subtree__item > .wiki-subtree__list { margin-top: 0; }

/* ── Tree style (default) ── */
/* no extra rules needed — base is tree */

/* ── Cards style ── */
.wiki-subtree--cards { display: block; }
.wiki-subtree--cards .wiki-subtree__list--root {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
.wiki-subtree--cards .wiki-subtree__list--root > .wiki-subtree__item {
  padding: 7px 9px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  line-height: 1.4;
}
.wiki-subtree--cards .wiki-subtree__list--root > .wiki-subtree__item::before { display: none; }
.wiki-subtree--cards .wiki-subtree__list--root > .wiki-subtree__item > .wiki-subtree__link {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 3px;
}
.wiki-subtree--cards .wiki-subtree__list { border-top: 1px solid #f1f5f9; padding-top: 4px; margin-top: 4px; }
.wiki-subtree--cards .wiki-subtree__list .wiki-subtree__item { padding-left: 0; line-height: 1.6; }
.wiki-subtree--cards .wiki-subtree__list .wiki-subtree__item::before { display: none; }
.wiki-subtree--cards .wiki-subtree__list .wiki-subtree__link { font-size: 11px; color: #64748b; }
.wiki-subtree--cards .wiki-subtree__list .wiki-subtree__link:hover { color: #2563eb; }
.wiki-subtree--cards .wiki-subtree__list .wiki-subtree__list { border-top: none; padding-top: 0; padding-left: 8px; }

/* ── List style ── */
.wiki-subtree--list {
  background: none;
  border: none;
  padding: 2px 0;
}
.wiki-subtree--list .wiki-subtree__list--root > .wiki-subtree__item { padding-left: 13px; }
.wiki-subtree--list .wiki-subtree__item::before {
  content: '›';
  background: none;
  width: auto; height: auto;
  font-size: 11px;
  color: #94a3b8;
  top: 1px; left: 2px;
}
.wiki-subtree--list .wiki-subtree__list--root > .wiki-subtree__item::before { display: block; }
.wiki-subtree--list .wiki-subtree__list--root > .wiki-subtree__item > .wiki-subtree__link { font-weight: 500; }

/* ── Tags style ── */
.wiki-subtree--tags { border: none; background: none; padding: 2px 0; }
.wiki-subtree--tags .wiki-subtree__list--root {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.wiki-subtree--tags .wiki-subtree__list--root > .wiki-subtree__item { padding: 0; line-height: 1; }
.wiki-subtree--tags .wiki-subtree__list--root > .wiki-subtree__item::before { display: none; }
.wiki-subtree--tags .wiki-subtree__link {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #334155;
  transition: background 0.12s, border-color 0.12s;
}
.wiki-subtree--tags .wiki-subtree__link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
  text-decoration: none;
}

/* ── Dark mode ── */
html.dark-mode .wiki-subtree { background: #1e293b; border-color: #334155; }
html.dark-mode .wiki-subtree__link { color: #60a5fa; }
html.dark-mode .wiki-subtree__item::before { background: #475569; }

html.dark-mode .wiki-subtree--cards .wiki-subtree__list--root > .wiki-subtree__item { background: #0f172a; border-color: #334155; }
html.dark-mode .wiki-subtree--cards .wiki-subtree__list { border-top-color: #1e293b; }
html.dark-mode .wiki-subtree--cards .wiki-subtree__list .wiki-subtree__link { color: #64748b; }
html.dark-mode .wiki-subtree--cards .wiki-subtree__list .wiki-subtree__link:hover { color: #60a5fa; }

html.dark-mode .wiki-subtree--list { background: none; border: none; }
html.dark-mode .wiki-subtree--list .wiki-subtree__item::before { background: none; color: #475569; }

html.dark-mode .wiki-subtree--tags { background: none; border: none; }
html.dark-mode .wiki-subtree--tags .wiki-subtree__link { background: #1e293b; border-color: #334155; color: #94a3b8; }
html.dark-mode .wiki-subtree--tags .wiki-subtree__link:hover { background: #1e3a5f; border-color: #2563eb; color: #60a5fa; }

/* ── Toolbar insert button group ── */
.hl-subtree-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.hl-btn--subtree-btn {
  height: 22px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #2563eb;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Raleway', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
}
.hl-btn--subtree-btn:hover { background: #eff6ff; border-color: #93c5fd; }
.hl-subtree-depth {
  height: 22px;
  padding: 0 2px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #fff;
  color: #555;
  font-size: 10px;
  font-family: 'Raleway', sans-serif;
  cursor: pointer;
}
html.dark-mode .hl-btn--subtree-btn { background: #1e293b; color: #60a5fa; border-color: #1e3a5f; }
html.dark-mode .hl-btn--subtree-btn:hover { background: #172554; }
html.dark-mode .hl-subtree-depth { background: #1e293b; color: #94a3b8; border-color: #334155; }

/* ── Draft / private badges for admin ── */
.wiki-draft-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 3px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  vertical-align: middle;
  letter-spacing: 0.03em;
}
.wiki-article-draft-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
html.dark-mode .wiki-draft-badge,
html.dark-mode .wiki-article-draft-badge {
  background: #451a03;
  color: #fbbf24;
  border-color: #78350f;
}

/* ── Image click-to-resize hint in the admin preview pane ── */
.wiki-admin-editor__preview img {
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color .15s;
}
.wiki-admin-editor__preview img:hover {
  outline-color: #2563eb;
}
/* ── draw.io diagram zoom controls ── */
.drawio-viewer {
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden; /* clips content when zoomed in */
}
.drawio-viewer svg {
  display: block;
  width: 100%;
  height: 100%;
}
.drawio-fig__controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 1;
}
.drawio-viewer:hover .drawio-fig__controls {
  opacity: 1;
  pointer-events: auto;
}
.drawio-zoom-btn {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: rgba(255,255,255,0.92);
  color: #333;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
}
.drawio-zoom-btn:hover { background: #fff; border-color: #888; }
html.dark-mode .drawio-zoom-btn {
  background: rgba(20,20,30,0.88);
  border-color: #444;
  color: #ccc;
}
html.dark-mode .drawio-zoom-btn:hover { background: #1e1e2e; border-color: #666; }

/* ── Editor panel: single-mode with toggle ── */
.wiki-admin-editor__panel {
  display: flex;
  flex-direction: column;
}

.wiki-admin-editor__panes {
  display: flex;
  align-items: flex-start;
}

.wiki-admin-editor__panes > .wiki-admin-editor__md {
  flex: 1;
  border-right: none;
}

.wiki-admin-editor__panes > .wiki-admin-editor__preview {
  flex: 1;
}

.wiki-admin-editor__highlight-bar {
  flex-wrap: wrap;
  row-gap: 4px;
  height: auto;
}

/* ── Mode toggle buttons ── */
.hl-mode-btn {
  font-family: 'Oswald', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  height: 22px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f5f5f5;
  color: #777;
  cursor: pointer;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}
.hl-mode-btn:hover { background: #eaeaea; color: #333; }
.hl-mode-btn.active {
  background: #111;
  color: white;
  border-color: #111;
}
html.dark-mode .hl-mode-btn { background: #2a2a2a; border-color: #3a3a3a; color: #888; }
html.dark-mode .hl-mode-btn:hover { background: #333; color: #ccc; }
html.dark-mode .hl-mode-btn.active { background: #e0e0e0; color: #111; border-color: #e0e0e0; }

/* ── Heading buttons ── */
.hl-btn--heading {
  background: white;
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 10px;
  width: 24px;
}
html.dark-mode .hl-btn--heading { background: #222; }

/* ── Wiki internal links [[Title]] ── */
.wiki-ilink {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wiki-ilink:hover { color: #1d4ed8; }

.wiki-ilink--missing {
  color: #dc2626;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: help;
}

.wiki-ilink--ambiguous {
  color: #d97706;
  text-decoration: underline dashed;
  text-underline-offset: 2px;
  cursor: pointer;
}
.wiki-ilink--ambiguous:hover { color: #b45309; }

/* ── Disambiguation popup ── */
.wiki-ilink-popup {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  min-width: 200px;
  max-width: 340px;
  padding: 4px 0;
  font-family: 'Raleway', sans-serif;
}

.wiki-ilink-popup__item {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  text-decoration: none;
  color: inherit;
  gap: 2px;
  transition: background 0.1s;
}
.wiki-ilink-popup__item:hover { background: #f1f5f9; }

.wiki-ilink-popup__title {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.wiki-ilink-popup__path {
  font-size: 11px;
  color: #94a3b8;
}

html.dark-mode .wiki-ilink { color: #60a5fa; }
html.dark-mode .wiki-ilink:hover { color: #93c5fd; }
html.dark-mode .wiki-ilink--missing { color: #f87171; }
html.dark-mode .wiki-ilink--ambiguous { color: #fbbf24; }
html.dark-mode .wiki-ilink--ambiguous:hover { color: #f59e0b; }
html.dark-mode .wiki-ilink-popup {
  background: #1e1e2e;
  border-color: #2a2a3e;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
html.dark-mode .wiki-ilink-popup__item:hover { background: #2a2a3e; }
html.dark-mode .wiki-ilink-popup__title { color: #e2e8f0; }
html.dark-mode .wiki-ilink-popup__path { color: #475569; }

/* ── Admin files panel ── */
.wiki-admin-editor__files {
  flex-shrink: 0;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
  padding: 6px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiki-admin-editor__files-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-admin-editor__files-label {
  font-family: 'Raleway', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #aaa;
}

.wiki-admin-editor__files-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
}

.wiki-files-empty {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #ccc;
  align-self: center;
}

.wiki-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 5px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  max-width: 240px;
  transition: border-color 0.1s;
}
.wiki-file-chip:hover { border-color: #bbb; }

.wiki-file-chip__icon { font-size: 13px; flex-shrink: 0; }

.wiki-file-chip__name {
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.wiki-file-chip__name:hover { text-decoration: underline; }

.wiki-file-chip__size {
  color: #aaa;
  font-size: 10px;
  flex-shrink: 0;
}

.wiki-file-chip__insert {
  background: none;
  border: 1px solid #bfdbfe;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  color: #2563eb;
  cursor: pointer;
  line-height: 1.4;
  flex-shrink: 0;
  transition: background 0.1s;
}
.wiki-file-chip__insert:hover { background: #eff6ff; }

.wiki-file-chip__remove {
  background: none;
  border: none;
  padding: 0 1px;
  font-size: 10px;
  color: #ccc;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.1s;
}
.wiki-file-chip__remove:hover { color: #e53e3e; }

/* ── Inline file download card (rendered in article body) ── */
.wiki-file-card {
  display: block;
  margin: 0.8em 0;
}
.wiki-file-card__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: #f7f7f7;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  text-decoration: none !important;
  color: #333;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  max-width: 480px;
}
.wiki-file-card__link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb !important;
}
.wiki-file-card__icon { font-size: 18px; flex-shrink: 0; }
.wiki-file-card__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.wiki-file-card__size { color: #aaa; font-size: 11px; flex-shrink: 0; }
.wiki-file-card__dl   { font-size: 11px; color: #2563eb; flex-shrink: 0; }

html.dark-mode .wiki-file-card__link { background: #1a1a2e; border-color: #2a2a3e; color: #d0d0d0; }
html.dark-mode .wiki-file-card__link:hover { background: #1e3a5f; border-color: #2563eb; color: #60a5fa !important; }
html.dark-mode .wiki-file-card__size { color: #555; }
html.dark-mode .wiki-file-card__dl   { color: #60a5fa; }

/* ── Editor drag-over highlight ── */
.wiki-editor-drag-over {
  outline: 2px dashed #2563eb !important;
  outline-offset: -3px;
  background: rgba(37,99,235,0.04) !important;
}

html.dark-mode .wiki-admin-editor__files { background: #111118; border-top-color: #222; }
html.dark-mode .wiki-admin-editor__files-label { color: #555; }
html.dark-mode .wiki-file-chip { background: #1a1a2e; border-color: #2a2a3e; }
html.dark-mode .wiki-file-chip:hover { border-color: #3a3a5e; }
html.dark-mode .wiki-file-chip__name { color: #60a5fa; }
html.dark-mode .wiki-file-chip__size { color: #555; }
html.dark-mode .wiki-file-chip__insert { border-color: #1e3a5f; color: #60a5fa; }
html.dark-mode .wiki-file-chip__insert:hover { background: rgba(96,165,250,0.08); }
html.dark-mode .wiki-file-chip__remove { color: #444; }
html.dark-mode .wiki-file-chip__remove:hover { color: #fc8181; }
html.dark-mode .wiki-files-empty { color: #444; }

/* ── Article attachments section ── */
.wiki-article-attachments {
  margin-top: 2.5em;
  padding-top: 1.5em;
  border-top: 1px solid #e8e8e8;
}

.wiki-article-attachments__title {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 10px;
}

.wiki-article-attachments__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wiki-article-attachments__item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wiki-article-attachments__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  background: #f7f7f7;
  border: 1px solid #e8e8e8;
  border-radius: 5px;
  text-decoration: none;
  color: #333;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  transition: background 0.1s, border-color 0.1s;
  max-width: 400px;
}
.wiki-article-attachments__link:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.wiki-article-attachments__icon { font-size: 16px; flex-shrink: 0; }

.wiki-article-attachments__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wiki-article-attachments__size {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #aaa;
  flex-shrink: 0;
}

html.dark-mode .wiki-article-attachments { border-top-color: #222; }
html.dark-mode .wiki-article-attachments__title { color: #555; }
html.dark-mode .wiki-article-attachments__link { background: #1a1a2e; border-color: #2a2a3e; color: #d0d0d0; }
html.dark-mode .wiki-article-attachments__link:hover { background: #1e3a5f; border-color: #2563eb; color: #60a5fa; }
html.dark-mode .wiki-article-attachments__size { color: #555; }

/* ── Font selector ── */
.hl-font-select {
  height: 22px;
  padding: 0 4px;
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 4px;
  background: #fff;
  color: #333;
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  cursor: pointer;
  outline: none;
  max-width: 96px;
  transition: border-color 0.1s;
}
.hl-font-select:hover { border-color: rgba(0,0,0,0.4); }
html.dark-mode .hl-font-select {
  background: #2a2a2a;
  color: #d0d0d0;
  border-color: rgba(255,255,255,0.12);
}
html.dark-mode .hl-font-select:hover { border-color: rgba(255,255,255,0.3); }

/* ── Toolbar groups ── */
#editorToolbar {
  flex-wrap: wrap !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 0 !important;
  row-gap: 0 !important;
}

.hl-group {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  padding: 3px 8px 4px 6px;
  position: relative;
}

.hl-group__header {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 14px;
  margin-bottom: 2px;
}

.hl-group__handle {
  cursor: grab;
  color: transparent;
  font-size: 12px;
  line-height: 1;
  user-select: none;
  transition: color 0.1s;
}
.hl-group:hover .hl-group__handle { color: #ccc; }
.hl-group__handle:active { cursor: grabbing; }

.hl-group__name {
  font-size: 9px;
  color: transparent;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: 'Raleway', sans-serif;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.1s;
}
.hl-group:hover .hl-group__name { color: #bbb; }

.hl-group__float-btn,
.hl-group__dock-btn,
.hl-group__hide-btn {
  background: none;
  border: none;
  padding: 0 1px;
  width: auto;
  height: auto;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  color: transparent;
  transition: color 0.1s;
  flex-shrink: 0;
}
.hl-group:hover .hl-group__float-btn,
.hl-group:hover .hl-group__hide-btn { color: #bbb; }
.hl-group:hover .hl-group__float-btn:hover { color: #2563eb; }
.hl-group:hover .hl-group__hide-btn:hover { color: #e53e3e; }

.hl-group__dock-btn { display: none; }
.hl-group--float .hl-group__float-btn { display: none; }
.hl-group--float .hl-group__dock-btn { display: flex; color: #999; }
.hl-group--float .hl-group__dock-btn:hover { color: #333; }

.hl-group__btns {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.hl-group--float {
  position: fixed;
  z-index: 9000;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 6px 10px 8px;
}
.hl-group--float .hl-group__header {
  cursor: move;
  margin-bottom: 6px;
  height: auto;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}
.hl-group--float .hl-group__name { color: #888; font-size: 10px; }
.hl-group--float .hl-group__hide-btn { color: #bbb; }
.hl-group--float .hl-group__hide-btn:hover { color: #e53e3e; }

.hl-group--hidden { display: none !important; }

.hl-group--drag-over { background: rgba(37,99,235,0.06); }

.hl-toolbar-overflow-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}

.hl-toolbar-overflow {
  background: none;
  border: none;
  padding: 0 10px;
  font-size: 14px;
  color: #ccc;
  cursor: pointer;
  height: 100%;
  display: flex;
  align-items: center;
  transition: color 0.1s;
  letter-spacing: 3px;
}
.hl-toolbar-overflow:hover { color: #555; }

.hl-toolbar-menu {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 180px;
  padding: 4px 0;
  font-family: 'Raleway', sans-serif;
}

.hl-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  font-size: 12px;
  color: #555;
}

.hl-menu-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: #aaa;
  font-style: italic;
}

.hl-menu-show-btn {
  background: none;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  color: #2563eb;
  cursor: pointer;
  transition: background 0.1s;
  flex-shrink: 0;
}
.hl-menu-show-btn:hover { background: #eff6ff; }

html.dark-mode .hl-group { border-right-color: #2a2a2a; border-bottom-color: #2a2a2a; }
html.dark-mode .hl-group:hover .hl-group__handle { color: #444; }
html.dark-mode .hl-group:hover .hl-group__name { color: #444; }
html.dark-mode .hl-group:hover .hl-group__float-btn,
html.dark-mode .hl-group:hover .hl-group__hide-btn { color: #444; }
html.dark-mode .hl-group:hover .hl-group__float-btn:hover { color: #60a5fa; }
html.dark-mode .hl-group:hover .hl-group__hide-btn:hover { color: #fc8181; }
html.dark-mode .hl-group--float {
  background: #1a1a2e;
  border-color: #2a2a3e;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
html.dark-mode .hl-group--float .hl-group__header { border-bottom-color: #2a2a3e; }
html.dark-mode .hl-group--float .hl-group__name { color: #666; }
html.dark-mode .hl-group--float .hl-group__hide-btn { color: #555; }
html.dark-mode .hl-group--float .hl-group__hide-btn:hover { color: #fc8181; }
html.dark-mode .hl-group--float .hl-group__dock-btn { color: #555; }
html.dark-mode .hl-group--float .hl-group__dock-btn:hover { color: #ccc; }
html.dark-mode .hl-group--drag-over { background: rgba(96,165,250,0.08); }
html.dark-mode .hl-toolbar-overflow { color: #444; }
html.dark-mode .hl-toolbar-overflow:hover { color: #ccc; }
html.dark-mode .hl-toolbar-menu {
  background: #1a1a2e;
  border-color: #2a2a3e;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
html.dark-mode .hl-menu-item { color: #aaa; }
html.dark-mode .hl-menu-empty { color: #555; }
html.dark-mode .hl-menu-show-btn { border-color: #333; color: #60a5fa; }
html.dark-mode .hl-menu-show-btn:hover { background: rgba(96,165,250,0.08); }

/* ── Inline comments ─────────────────────────────────────────────────────── */
.wiki-comment {
  background: rgba(255, 210, 0, 0.28);
  border-bottom: 2px solid #d4920a;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s;
}

.wiki-comment:hover {
  background: rgba(255, 200, 0, 0.45);
}

/* Selection popup */
#commentSelPopup {
  display: none;
  position: fixed;
  z-index: 9100;
  flex-direction: column-reverse;
  background: #16162a;
  border: 1px solid rgba(255,200,0,0.22);
  border-radius: 8px;
  padding: 2px 3px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55), 0 0 0 1px rgba(0,0,0,0.3);
  pointer-events: all;
  user-select: none;
  min-width: 220px;
}

.sel-popup-btns {
  display: flex;
  align-items: center;
}

.sel-popup-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,200,0,0.18);
  margin: 0 1px;
  flex-shrink: 0;
}

.sel-popup-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: rgba(255,200,0,0.8);
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  line-height: 1;
  letter-spacing: 0.04em;
}

.sel-popup-btn:hover { background: rgba(255,200,0,0.1); color: #fbbf24; }

#selPopupResult {
  display: none;
  padding: 8px 10px 6px;
  max-width: 300px;
  max-height: 220px;
  overflow-y: auto;
  border-bottom: 1px solid rgba(255,200,0,0.12);
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  color: #d0d0d0;
  line-height: 1.5;
}
.sel-result-word { font-size: 13px; font-weight: 700; color: #fbbf24; margin-bottom: 2px; }
.sel-result-phonetic { font-size: 11px; color: #888; font-weight: 400; margin-left: 4px; }
.sel-result-pos { font-style: italic; color: #a78bfa; font-size: 10px; margin-top: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.sel-result-defs { margin: 3px 0 0 10px; padding: 0; list-style: disc; color: #ccc; }
.sel-result-defs li { margin-bottom: 2px; }
.sel-result-loading { color: #666; font-style: italic; }
.sel-result-err { color: #f87171; }
.sel-result-trans-dir { font-size: 10px; color: #a78bfa; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.sel-result-trans { color: #e0e0e0; }

/* ── Editor quick-tool floating button + popup ── */
#editorQuickToolWrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 8900;
  user-select: none;
}

#editorQuickToolBtn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #111;
  color: #fff;
  font-size: 18px;
  cursor: grab;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
#editorQuickToolBtn:hover { background: #333; transform: scale(1.08); }
#editorQuickToolBtn.open  { background: #2563eb; }
#editorQuickToolBtn.dragging { cursor: grabbing; transform: scale(1.08); }

#editorQuickTool {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: #13131f;
  border: 1px solid #252540;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 280px;
}

.eqt-row {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.eqt-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: #252540;
  margin: 0 3px;
  flex-shrink: 0;
}

.eqt-label {
  font-family: 'Raleway', sans-serif;
  font-size: 10px;
  color: #444;
  margin-right: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#editorQuickTool .hl-mode-btn {
  background: #1e1e30;
  color: #666;
  border-color: #252540;
}
#editorQuickTool .hl-mode-btn:hover { background: #252540; color: #aaa; }
#editorQuickTool .hl-mode-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

#editorQuickTool .hl-btn,
#editorQuickTool .hl-btn--subtree-btn {
  background: #1e1e30;
  color: #888;
  border-color: #252540;
}
#editorQuickTool .hl-btn:hover,
#editorQuickTool .hl-btn--subtree-btn:hover { background: #252540; color: #ccc; }

/* Admin comment tooltip (edit view) */
#commentTooltip {
  display: none;
  position: fixed;
  z-index: 9100;
  background: #13131f;
  border: 1px solid #252540;
  border-radius: 10px;
  padding: 12px 15px 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,0,0,0.3);
  max-width: 320px;
  min-width: 200px;
  pointer-events: all;
}

.comment-tooltip__text {
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  color: #c0c0dc;
  line-height: 1.6;
  margin-bottom: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  word-break: break-word;
}

.comment-tooltip__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 9px;
}

.comment-tooltip__btn {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid #252540;
  background: transparent;
  color: #50507a;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.12s;
}

.comment-tooltip__btn:hover { background: rgba(255,255,255,0.05); color: #9090c0; border-color: #353560; }

.comment-tooltip__btn--remove { color: #c05555; border-color: rgba(200,70,70,0.25); }
.comment-tooltip__btn--remove:hover { background: rgba(200,70,70,0.1); color: #f87171; border-color: rgba(248,113,113,0.4); }

/* Comment add/edit modal */
@keyframes comment-modal-in {
  from { opacity: 0; transform: translate(-50%, -47%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#commentModalBackdrop.open {
  background: rgba(0,0,12,0.65);
  backdrop-filter: blur(3px);
}

#commentModal {
  background: #13131f;
  border: 1px solid #252540;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,200,0,0.04);
  width: 380px;
  overflow: hidden;
}

#commentModal.open {
  animation: comment-modal-in 0.2s cubic-bezier(0.34, 1.08, 0.64, 1) both;
}

#commentModal .modal__header {
  background: #13131f;
  border-bottom: 1px solid rgba(255,200,0,0.1);
  padding: 15px 20px 13px;
}

#commentModal .modal__title {
  font-family: 'Raleway', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #7070a0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#commentModal .modal__close {
  color: #303050;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}

#commentModal .modal__close:hover {
  color: #7070a0;
  background: rgba(255,255,255,0.05);
}

#commentModal .form-row {
  padding: 16px 20px 0;
  margin-bottom: 0;
}

#commentModal .form-row label {
  font-size: 9px;
  color: rgba(255,200,0,0.45);
  letter-spacing: 0.16em;
}

#commentModal #commentText {
  background: #0b0b18;
  border-color: #1e1e38;
  color: #c8c8e0;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-family: 'Raleway', sans-serif;
  min-height: 100px;
  line-height: 1.65;
  caret-color: rgba(255,200,0,0.7);
}

#commentModal #commentText::placeholder { color: #252545; }

#commentModal #commentText:focus {
  border-color: rgba(255,200,0,0.3);
  box-shadow: 0 0 0 3px rgba(255,200,0,0.05);
  background: #0b0b18;
  outline: none;
}

.comment-md-hint {
  display: block;
  font-family: 'Raleway', sans-serif;
  font-size: 10px;
  color: #252545;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

#commentModal .modal__actions {
  background: #13131f;
  border-top: 1px solid rgba(255,255,255,0.04);
  padding: 12px 20px 16px;
  margin-top: 10px;
}

#commentModal .admin-btn {
  font-family: 'Raleway', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 6px;
  padding: 7px 16px;
  transition: all 0.12s;
}

#commentModal .admin-btn:not(.admin-btn--primary) {
  background: transparent;
  border-color: #1e1e38;
  color: #353560;
}

#commentModal .admin-btn:not(.admin-btn--primary):hover {
  background: rgba(255,255,255,0.04);
  color: #6060a0;
  border-color: #2e2e50;
}

#commentModal .admin-btn--primary {
  background: rgba(255,200,0,0.1);
  border-color: rgba(255,200,0,0.28);
  color: #c08820;
}

#commentModal .admin-btn--primary:hover {
  background: rgba(255,200,0,0.18);
  border-color: rgba(255,200,0,0.5);
  color: #f0b020;
}

/* Read-only comment tip (article page) */
.wiki-comment-tip {
  position: absolute;
  z-index: 9200;
  max-width: 300px;
  min-width: 140px;
  background: #22223a;
  color: #e0e0f0;
  border: 1px solid #3a3a58;
  border-radius: 8px;
  padding: 9px 14px;
  font-family: 'Raleway', sans-serif;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  pointer-events: none;
}
.wiki-comment-tip p  { margin: 0 0 7px; }
.wiki-comment-tip p:last-child { margin-bottom: 0; }
.wiki-comment-tip code { background: rgba(255,255,255,0.12); border-radius: 3px; padding: 1px 4px; font-size: 0.9em; }
.wiki-comment-tip pre  { background: rgba(0,0,0,0.25); border-radius: 4px; padding: 6px 10px; margin: 6px 0; overflow-x: auto; }
.wiki-comment-tip pre code { background: none; padding: 0; }
.wiki-comment-tip strong { color: #fff; }
.wiki-comment-tip ul, .wiki-comment-tip ol { margin: 4px 0; padding-left: 18px; }
.wiki-comment-tip li { margin: 2px 0; }

/* Upward-pointing arrow (outer — border colour) */
.wiki-comment-tip::before {
  content: '';
  position: absolute;
  top: -9px;
  left: var(--arrow-left, 18px);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 9px solid transparent;
  border-top: none;
  border-bottom-color: #3a3a58;
}

/* Upward-pointing arrow (inner — background colour) */
.wiki-comment-tip::after {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--arrow-left, 18px);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-top: none;
  border-bottom-color: #22223a;
}

/* Dark mode */
html.dark-mode .wiki-comment { background: rgba(255,200,0,0.18); border-bottom-color: #b87c0a; }
html.dark-mode .wiki-comment:hover { background: rgba(255,200,0,0.32); }
html.dark-mode .wiki-comment-tip { background: #1a1a2e; border-color: #2a2a48; }
html.dark-mode .wiki-comment-tip::before { border-bottom-color: #2a2a48; }
html.dark-mode .wiki-comment-tip::after  { border-bottom-color: #1a1a2e; }
