:root {
  --bg: #f8f9fa;
  --sidebar-bg: #ffffff;
  --content-bg: #ffffff;
  --ink: #202122;
  --muted: #54595d;
  --link: #0645ad;
  --link-hover: #0b0080;
  --border: #a2a9b1;
  --border-light: #eaecf0;
  --accent: #8b1a1a;
  --accent-light: #fee7e7;
  --green: #14866d;
  --green-light: #e6f5f0;
  --gold: #ac6600;
  --gold-light: #fef6e7;
  --header-bg: #1a1a2e;
  --header-text: #ffffff;
  --toc-bg: #f8f9fa;
  --quote-border: #c8ccd1;
  --infobox-bg: #f8f9fa;
  --infobox-header: #8b1a1a;
  --category-bg: #eaecf0;
  --search-bg: #ffffff;
}

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

body {
  font-family: 'Linux Libertine', 'Georgia', 'Times', serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.4px;
  line-height: 1.6;
}

/* ===== LAYOUT ===== */
.wiki-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.wiki-header {
  grid-column: 1 / -1;
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  border-bottom: 3px solid var(--accent);
}

.wiki-header .logo {
  font-size: 1.3em;
  font-weight: bold;
  text-decoration: none;
  color: var(--header-text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.wiki-header .logo span {
  font-size: 0.65em;
  opacity: 0.7;
  font-weight: normal;
}

.wiki-header .search-box {
  display: flex;
  gap: 6px;
}

.wiki-header .search-box input {
  padding: 5px 10px;
  border: 1px solid #555;
  border-radius: 2px;
  font-size: 13px;
  width: 200px;
  background: var(--search-bg);
}

.wiki-header .search-box button {
  padding: 5px 12px;
  background: #3366cc;
  color: white;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
}

/* ===== SIDEBAR ===== */
.wiki-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-light);
  padding: 16px 12px 40px;
  font-size: 13px;
  overflow-y: auto;
  max-height: calc(100vh - 52px);
  position: sticky;
  top: 52px;
  align-self: start;
  mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 36px), transparent 100%);
}

.sidebar-section {
  margin-bottom: 18px;
}

.sidebar-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
  font-family: system-ui, -apple-system, sans-serif;
}

.sidebar-section ul {
  list-style: none;
}

.sidebar-section li {
  margin-bottom: 2px;
}

.sidebar-section a {
  color: var(--link);
  text-decoration: none;
  display: block;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 12.5px;
  line-height: 1.4;
}

.sidebar-section a:hover {
  background: var(--border-light);
  color: var(--link-hover);
}

.sidebar-section a.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: bold;
}

/* ===== CONTENT ===== */
.wiki-content {
  background: var(--content-bg);
  padding: 24px 28px 60px;
  max-width: 960px;
  min-height: calc(100vh - 52px);
}

/* ===== TYPOGRAPHY ===== */
.wiki-content h1 {
  font-size: 1.95em;
  font-weight: normal;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.wiki-content h2 {
  font-size: 1.5em;
  font-weight: normal;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 4px;
  margin: 28px 0 12px;
  line-height: 1.3;
}

.wiki-content h3 {
  font-size: 1.17em;
  font-weight: bold;
  margin: 20px 0 8px;
}

.wiki-content p {
  margin-bottom: 10px;
}

.wiki-content a {
  color: var(--link);
  text-decoration: none;
}

.wiki-content a:hover {
  text-decoration: underline;
}

.wiki-content a.redlink {
  color: #ba0000;
}

.wiki-content ul, .wiki-content ol {
  margin: 8px 0 12px 24px;
}

.wiki-content li {
  margin-bottom: 4px;
}

/* ===== INTRO BOX (like Wikipedia's lead) ===== */
.wiki-intro {
  font-size: 15px;
  margin-bottom: 20px;
}

.wiki-intro p:first-child {
  font-size: 15.5px;
}

/* ===== TABLE OF CONTENTS ===== */
.toc {
  background: var(--toc-bg);
  border: 1px solid var(--border);
  padding: 12px 16px;
  display: inline-block;
  margin: 0 0 20px;
  min-width: 220px;
  max-width: 400px;
  font-size: 13px;
}

.toc-title {
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  font-size: 13px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin-bottom: 3px;
}

.toc a {
  color: var(--link);
  text-decoration: none;
}

.toc a:hover {
  text-decoration: underline;
}

/* ===== INFOBOX ===== */
.infobox {
  float: right;
  margin: 0 0 16px 20px;
  border: 1px solid var(--border);
  background: var(--infobox-bg);
  width: 280px;
  font-size: 12.8px;
}

.infobox-header {
  background: var(--infobox-header);
  color: white;
  padding: 8px 12px;
  text-align: center;
  font-weight: bold;
  font-size: 14px;
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
}

.infobox td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.infobox td:first-child {
  font-weight: bold;
  width: 40%;
  color: var(--muted);
}

/* ===== ACCUSATION BOX ===== */
.accusation {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  margin: 14px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
}

.accusation .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: bold;
  margin-bottom: 6px;
  font-family: system-ui, sans-serif;
}

.accusation blockquote {
  font-style: italic;
  margin: 0 0 6px;
  color: #4a1010;
}

.accusation .source {
  font-size: 11.5px;
  color: var(--muted);
  font-style: normal;
}

/* ===== RESPONSE BOX ===== */
.response {
  background: var(--green-light);
  border-left: 4px solid var(--green);
  padding: 14px 18px;
  margin: 14px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
}

.response .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--green);
  font-weight: bold;
  margin-bottom: 6px;
  font-family: system-ui, sans-serif;
}

/* ===== QUOTE ===== */
.wiki-quote {
  border-left: 3px solid var(--quote-border);
  padding: 8px 16px;
  margin: 12px 0;
  background: #f9f9f9;
}

.wiki-quote blockquote {
  font-style: italic;
  margin: 0 0 4px;
}

.wiki-quote .attribution {
  font-size: 12.5px;
  color: var(--muted);
}

/* ===== DATA TABLE ===== */
.wiki-table {
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13.5px;
  width: 100%;
}

.wiki-table th {
  background: var(--border-light);
  padding: 6px 10px;
  text-align: left;
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.wiki-table td {
  padding: 5px 10px;
  border: 1px solid var(--border);
}

.wiki-table tr:nth-child(even) {
  background: #f8f9fa;
}

/* ===== NOTICE BOX ===== */
.notice {
  background: var(--gold-light);
  border: 1px solid #dda;
  padding: 12px 16px;
  margin: 14px 0;
  font-size: 13px;
  border-radius: 4px;
}

.notice strong {
  color: var(--gold);
}

/* ===== HIGHLIGHT STAT ===== */
.stat-highlight {
  text-align: center;
  padding: 20px;
  margin: 16px 0;
  background: var(--infobox-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.stat-highlight .number {
  font-size: 3.2em;
  font-weight: bold;
  color: var(--accent);
  line-height: 1;
}

.stat-highlight .desc {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

/* ===== CATEGORIES ===== */
.categories {
  margin-top: 40px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--muted);
}

.categories a {
  color: var(--link);
  text-decoration: none;
}

.cat-tag {
  display: inline-block;
  background: var(--category-bg);
  padding: 2px 8px;
  border-radius: 2px;
  margin: 2px 3px;
  font-size: 11.5px;
}

/* ===== SEE ALSO ===== */
.see-also {
  background: var(--toc-bg);
  border: 1px solid var(--border-light);
  padding: 12px 16px;
  margin: 20px 0;
  border-radius: 4px;
}

.see-also h3 {
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.see-also ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

/* ===== REFERENCES ===== */
.references {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.references h2 {
  font-size: 1.2em;
}

.references ol {
  padding-left: 24px;
}

.references li {
  margin-bottom: 4px;
}

.ref-tag {
  font-size: 10.5px;
  vertical-align: super;
  color: var(--link);
  cursor: pointer;
}

/* ===== FOOTER ===== */
.wiki-footer {
  background: var(--border-light);
  padding: 16px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 10;
}

.wiki-footer a {
  color: var(--link);
  text-decoration: none;
}

/* ===== MINI TIMELINE ===== */
.mini-timeline {
  margin: 20px 0;
  padding: 0;
  list-style: none;
  position: relative;
}

.mini-timeline::before {
  content: '';
  position: absolute;
  left: 110px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border);
}

.mini-timeline .tl-era {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--accent);
  margin: 28px 0 12px;
  padding-left: 130px;
  position: relative;
}

.mini-timeline .tl-era:first-child {
  margin-top: 0;
}

.mini-timeline .tl-era::before {
  content: '';
  position: absolute;
  left: 105px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--content-bg);
}

.mini-timeline .tl-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  position: relative;
}

.mini-timeline .tl-item::before {
  content: '';
  position: absolute;
  left: 107px;
  top: 7px;
  width: 9px;
  height: 9px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid var(--content-bg);
  z-index: 1;
}

.mini-timeline .tl-item.tl-negative::before {
  background: var(--accent);
}

.mini-timeline .tl-item.tl-neutral::before {
  background: var(--gold);
}

.mini-timeline .tl-date {
  width: 100px;
  text-align: right;
  font-size: 12px;
  font-weight: bold;
  color: var(--muted);
  padding-right: 10px;
  padding-top: 2px;
  flex-shrink: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

.mini-timeline .tl-text {
  padding-left: 22px;
  font-size: 13.5px;
  line-height: 1.5;
  flex: 1;
}

.mini-timeline .tl-text b {
  color: var(--ink);
}

.mini-timeline .tl-text a {
  color: var(--link);
  text-decoration: none;
}

.mini-timeline .tl-text a:hover {
  text-decoration: underline;
}

/* ===== CONTRADICTION BOX ===== */
.contradiction {
  background: #fff8e7;
  border-left: 4px solid var(--gold);
  padding: 14px 18px;
  margin: 14px 0;
  border-radius: 0 4px 4px 0;
  font-size: 13.5px;
}

.contradiction .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: bold;
  margin-bottom: 6px;
  font-family: system-ui, sans-serif;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switch {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-right: 16px;
}

.lang-switch a {
  font-size: 20px;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s;
  line-height: 1;
}

.lang-switch a:hover {
  opacity: 0.8;
}

.lang-switch a.active {
  opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .wiki-layout {
    grid-template-columns: 1fr;
  }
  .wiki-sidebar {
    display: none;
  }
  .wiki-content {
    padding: 16px;
  }
  .infobox {
    float: none;
    width: 100%;
    margin: 0 0 16px;
  }
  .wiki-header .search-box { display: none; }
}
