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

:root {
  --bg: #f8f9fa;
  --bg2: #ffffff;
  --border: #a2a9b1;
  --border-light: #eaecf0;
  --text: #202122;
  --text-muted: #54595d;
  --link: #3366cc;
  --infobox-title-bg: #cee0f2;
  --infobox-title-text: #202122;
  --notice-bg: #eaf3fb;
  --notice-border: #a2c9e8;
  --sidebar-title-bg: #cee0f2;
  --sidebar-title-text: #202122;
  --toc-bg: #f8f9fa;
}

body {
  font-family: -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* ── DARK MODE ── */
body.theme-dark {
  --bg: #1a1a1b;
  --bg2: #27282b;
  --border: #555;
  --border-light: #3a3a3a;
  --text: #d0d0d0;
  --text-muted: #909090;
  --link: #6699ff;
  --infobox-title-bg: #333;
  --infobox-title-text: #d0d0d0;
  --notice-bg: #222;
  --notice-border: #555;
  --sidebar-title-bg: #333;
  --sidebar-title-text: #d0d0d0;
  --toc-bg: #222;
  background: var(--bg);
  color: var(--text);
}

/* ── HEADER ── */
#wiki-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
#wiki-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  gap: 20px;
}
#wiki-logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
#wiki-title-text { font-family: Georgia, serif; font-size: 20px; }
#wiki-subtitle { font-size: 11px; color: var(--text-muted); display: block; }
#wiki-search { display: flex; gap: 6px; }
#wiki-search input {
  padding: 5px 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  width: 220px;
  background: var(--bg2);
  color: var(--text);
  border-radius: 2px;
}
#wiki-search button {
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  border-radius: 2px;
  color: var(--text);
}
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 16px;
  border-radius: 3px;
  color: var(--text);
}

/* ── TABS ── */
#wiki-tabs {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
#wiki-tabs-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
}
#wiki-tabs a {
  display: inline-block;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--link);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
}
#wiki-tabs a:hover { background: var(--bg); border-color: var(--border); }
#wiki-tabs a.active {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}

/* ── LAYOUT ── */
#wiki-body {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 0;
  padding: 20px;
  align-items: start;
}

/* ── CONTENT ── */
#wiki-content {
  background: var(--bg2);
  border: 1px solid var(--border-light);
  padding: 24px 28px;
  min-height: 600px;
  color: var(--text);
}
#wiki-content h1 {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: normal;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 16px;
  color: var(--text);
}
#wiki-content h2 {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: normal;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 3px;
  margin: 24px 0 10px;
  color: var(--text);
}
#wiki-content h3 { font-size: 16px; font-weight: bold; margin: 18px 0 8px; }
#wiki-content p { margin-bottom: 12px; }
#wiki-content a { color: var(--link); text-decoration: none; }
#wiki-content a:hover { text-decoration: underline; }
#wiki-content ul, #wiki-content ol { padding-left: 28px; margin-bottom: 12px; }
#wiki-content li { margin-bottom: 4px; }

/* ── INFOBOX ── */
.infobox {
  float: right;
  clear: right;
  margin: 0 0 16px 24px;
  border: 1px solid var(--border);
  background: var(--toc-bg);
  font-size: 13px;
  width: 260px;
}
.infobox-title {
  background: var(--infobox-title-bg);
  color: var(--infobox-title-text);
  text-align: center;
  font-weight: bold;
  padding: 6px 10px;
  font-size: 13px;
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox td { padding: 4px 8px; vertical-align: top; border-top: 1px solid var(--border-light); color: var(--text); }
.infobox td:first-child { font-weight: bold; width: 45%; }

/* ── TOC ── */
.toc {
  background: var(--toc-bg);
  border: 1px solid var(--border);
  padding: 12px 16px;
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
  min-width: 200px;
}
.toc-title { font-weight: bold; text-align: center; margin-bottom: 8px; }
.toc ol { padding-left: 20px; }
.toc a { color: var(--link); text-decoration: none; }

/* ── NOTICE ── */
.wiki-notice {
  background: var(--notice-bg);
  border: 1px solid var(--notice-border);
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 16px;
  border-radius: 2px;
  color: var(--text);
}

/* ── CATEGORIES ── */
.wiki-categories {
  border-top: 1px solid var(--border);
  margin-top: 28px;
  padding-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.wiki-categories a { color: var(--link); }

/* ── SIDEBAR ── */
#wiki-sidebar { padding-left: 16px; }
.sidebar-box {
  background: var(--bg2);
  border: 1px solid var(--border-light);
  margin-bottom: 14px;
  font-size: 13px;
}
.sidebar-box-title {
  background: var(--sidebar-title-bg);
  color: var(--sidebar-title-text);
  padding: 6px 10px;
  font-weight: bold;
  font-size: 12px;
}
.sidebar-box ul { list-style: none; padding: 8px 10px; }
.sidebar-box li { padding: 2px 0; border-bottom: 1px solid var(--border-light); }
.sidebar-box li:last-child { border-bottom: none; }
.sidebar-box a { color: var(--link); text-decoration: none; }
.sidebar-box a:hover { text-decoration: underline; }

/* ── FOOTER ── */
#wiki-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 20px;
}
#wiki-footer a { color: var(--link); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #wiki-body { grid-template-columns: 1fr; }
  #wiki-sidebar { padding-left: 0; margin-top: 16px; }
  .infobox { float: none; width: 100%; margin: 0 0 16px 0; }
}
