/* ═══════════════════════════════════
   WIKI — VIEW PAGE (WIKIPEDIA STYLE)
   ═══════════════════════════════════ */
.wiki-view {
  max-width: 960px;
  margin: 0 auto;
}

/* ── Header ── */
.wiki-view-header {
  border-bottom: 2px solid var(--line2);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.wiki-view-title {
  font-family: 'Oswald', monospace;
  font-size: 32px;
  letter-spacing: 1px;
  color: var(--green-pale);
  margin: 0 0 10px;
  text-transform: uppercase;
}
.wiki-view-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: var(--faint);
  font-family: 'JetBrains Mono', monospace;
  flex-wrap: wrap;
}
.wiki-view-meta b { color: var(--muted); }
.wiki-view-actions {
  margin-top: 12px;
}

/* ── Content — Wikipedia style ── */
:is(.wiki-view, .wiki-editor) .wiki-view-content {
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 28px 32px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--green-pale);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content h1,
:is(.wiki-view, .wiki-editor) .wiki-view-content h2,
:is(.wiki-view, .wiki-editor) .wiki-view-content h3,
:is(.wiki-view, .wiki-editor) .wiki-view-content h4 {
  font-family: 'Oswald', monospace;
  color: var(--green);
  letter-spacing: 1px;
  margin-top: 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line2);
  padding-bottom: 6px;
  text-transform: uppercase;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content h1 { font-size: 24px; border-bottom: 2px solid var(--green-dim); }
:is(.wiki-view, .wiki-editor) .wiki-view-content h2 { font-size: 20px; }
:is(.wiki-view, .wiki-editor) .wiki-view-content h3 { font-size: 17px; }
:is(.wiki-view, .wiki-editor) .wiki-view-content h4 { font-size: 15px; border-bottom: none; }

:is(.wiki-view, .wiki-editor) .wiki-view-content p { margin: 10px 0; }
:is(.wiki-view, .wiki-editor) .wiki-view-content a {
  color: var(--green);
  text-decoration: underline;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content a:hover { color: var(--green-pale); }
:is(.wiki-view, .wiki-editor) .wiki-view-content ul,
:is(.wiki-view, .wiki-editor) .wiki-view-content ol {
  margin: 10px 0;
  padding-left: 24px;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content li { margin: 4px 0; }
:is(.wiki-view, .wiki-editor) .wiki-view-content blockquote {
  border-left: 3px solid var(--green-dim);
  margin: 16px 0;
  padding: 12px 20px;
  background: var(--bg);
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--muted);
  font-style: italic;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r);
  margin: 12px 0;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .vid {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  margin: 16px 0;
  border-radius: var(--r);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .vid iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--amber);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content pre {
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 14px 18px;
  overflow-x: auto;
  margin: 16px 0;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content pre code {
  background: none;
  padding: 0;
  color: var(--green-pale);
}

/* Spoilers in content — like Wikipedia templates */
:is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-box {
  --spoiler-width: 70%;
  width: var(--spoiler-width);
  max-width: 900px;
  margin: 16px auto !important;
  border-color: var(--amber-dim);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-header {
  background: linear-gradient(180deg, rgba(255,179,0,.08) 0%, rgba(255,179,0,.04) 100%);
  border-bottom-color: var(--amber-dim);
  cursor: pointer;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-header:hover {
  background: linear-gradient(180deg, rgba(255,179,0,.12) 0%, rgba(255,179,0,.06) 100%);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-content { display: none; }
:is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-box.open .spoiler-content { display: block; }

/* ── Footer ── */
.wiki-view-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line2);
}

/* ── Table of contents (auto-generated) ── */
.wiki-toc {
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  padding: 16px 20px;
  margin-bottom: 24px;
}
.wiki-toc-title {
  font-family: 'Oswald', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 10px;
}
.wiki-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.wiki-toc-list li {
  padding: 3px 0;
}
.wiki-toc-list li a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color .15s;
}
.wiki-toc-list li a:hover { color: var(--green); }
.wiki-view .wiki-toc { display: block; width: auto; margin: 0 0 24px; }
.wiki-view .wiki-toc-list li a {
  display: block;
  padding: 3px 0;
  margin: 0;
  border: 0;
  background: none;
  text-transform: none;
  letter-spacing: normal;
}
.wiki-view .wiki-view-content .spoiler-box {
  border-width: 1px;
  border-style: solid;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg);
}
.wiki-view .wiki-view-content .spoiler-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  user-select: none;
  font-family: var(--terminal-font);
  font-size: 12px;
  letter-spacing: 1.5px;
  border-bottom-width: 1px;
  border-bottom-style: solid;
}
.wiki-view .wiki-view-content .spoiler-arrow { font-size: 9px; line-height: 1; }
.wiki-view .wiki-view-content .spoiler-title { flex: 1; text-transform: uppercase; }
.wiki-view .wiki-view-content .spoiler-content {
  padding: 14px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line2);
}
.wiki-editor .wiki-view-content .spoiler-content { display: block; }

/* The editor, preview and saved page share article typography. */
.wiki-view, .wiki-preview-content { min-width: 0; }
:is(.wiki-view, .wiki-editor) .wiki-view-content {
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.wiki-editor .ed-editor.wiki-view-content {
  min-height: 380px;
  max-height: none;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content :is(ul, ol) { padding-left: 28px; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ul { list-style-type: disc; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ol { list-style-type: decimal; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ul ul { list-style-type: circle; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ol[type="I"] { list-style-type: upper-roman; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ol[type="i"] { list-style-type: lower-roman; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ol[type="A"] { list-style-type: upper-alpha; }
:is(.wiki-view, .wiki-editor) .wiki-view-content ol[type="a"] { list-style-type: lower-alpha; }
:is(.wiki-view, .wiki-editor) .wiki-view-content li > :is(ul, ol) { margin: 4px 0; }
:is(.wiki-view, .wiki-editor) .wiki-view-content hr {
  display: block;
  height: 0;
  margin: 4px 0;
  border: 0;
  border-top: 3px double var(--green-dim);
}
:is(.wiki-view, .wiki-editor) .wiki-view-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content :is(td, th) {
  border: 1px solid var(--line2);
  padding: 8px 12px;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content .vid :is(iframe, video) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}
:is(.wiki-view, .wiki-editor) .wiki-view-content video { max-width: 100%; }
.wiki-toc-list .wiki-toc-subsection { padding-left: 16px; }
.wiki-view-title { overflow-wrap: anywhere; }
.ed-modal-box.preview-box.wiki-preview-box {
  width: 1040px;
  max-width: calc(100vw - 24px);
  max-height: 94dvh;
  box-sizing: border-box;
}
.wiki-preview-content { overflow-y: auto; overscroll-behavior: contain; }
.wiki-preview-box #preview-status:empty { display: none; }
.wiki-preview-box #preview-status { color: var(--muted); line-height: 1.6; }
.wiki-preview-box .wiki-view { width: 100%; }
.wiki-preview-box .prev-header { flex-shrink: 0; gap: 12px; }
.wiki-editor .tb { gap: 8px 4px; }
.wiki-editor .tb-color-preview {
  display: grid;
  place-items: center;
  color: #10160d;
  font: bold 16px Georgia, serif;
  border-bottom: 3px solid currentColor;
}
.wiki-editor .tb-highlight-wrap .tb-color-preview { border: 1px solid var(--muted); }
.wiki-editor .tb-color-wrap:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.wiki-editor .tb-btn:focus-visible, .wiki-editor .tb-sel:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.wiki-editor .tb-btn:disabled { opacity: .5; cursor: progress; }
@media (max-width: 600px) {
  :is(.wiki-view, .wiki-editor) .wiki-view-content { padding: 18px 16px; }
  .wiki-view-title { font-size: 25px; }
  .wiki-view-meta { gap: 8px 16px; font-size: 11px; }
  .ed-modal-box.preview-box.wiki-preview-box { padding: 12px; max-width: calc(100vw - 12px); }
  .wiki-editor .tb-group { flex-wrap: wrap; }
  .wiki-editor .tb-right { margin-left: 0; }
  .wiki-editor .ed-status { flex-wrap: wrap; gap: 6px; }
  :is(.wiki-view, .wiki-editor) .wiki-view-content .spoiler-box { max-width: 100%; }
}

/* Keep tools visible while the article grows. */
body .ed-card.wiki-editor { overflow: visible; }
body .wiki-editor .tb { position: sticky; top: 0; z-index: 30; background: var(--panel); max-height: 45dvh; overflow-y: auto; }
body .wiki-editor .ed-editor { overflow: visible; }
