* {
  box-sizing: border-box;
}

:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --ink: #1c2427;
  --muted: #657174;
  --line: #d9e0e2;
  --line-strong: #b9c6c9;
  --accent: #247460;
  --accent-dark: #173f36;
  --accent-warm: #a9631d;
  --code-bg: #edf4f1;
  --table-head: #eef3f3;
  --shadow: 0 12px 30px rgba(25, 35, 38, 0.08);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans SC",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.68;
}

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

a:hover {
  text-decoration: underline;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 288px;
  overflow-y: auto;
  background: #16221f;
  color: #f5faf7;
  padding: 24px 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand span {
  color: #aac2bc;
  font-size: 13px;
  margin-top: 4px;
}

.sidebar nav {
  display: grid;
  gap: 4px;
}

.sidebar a {
  display: block;
  color: #dcebe7;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.layout {
  min-height: 100vh;
  margin-left: 288px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 42px clamp(24px, 6vw, 72px) 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.kicker,
.section-eyebrow {
  margin: 0 0 8px;
  color: var(--accent-warm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 42px;
  line-height: 1.1;
}

.summary {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.meta a,
.meta span,
.language-switcher button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  background: #fafcfc;
  color: var(--ink);
  font-size: 13px;
}

.language-switcher button {
  cursor: pointer;
  font: inherit;
}

.language-switcher button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.meta a {
  color: var(--accent);
}

.language-switcher {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.language-panel,
.language-marker {
  display: none;
}

body[data-lang="zh"] .language-panel[data-lang="zh"],
body[data-lang="en"] .language-panel[data-lang="en"],
body[data-lang="ja"] .language-panel[data-lang="ja"],
body[data-lang="es"] .language-panel[data-lang="es"] {
  display: block;
}

.wiki-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 46px clamp(22px, 4vw, 52px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.wiki-page:nth-of-type(even) {
  background: #fbfcfc;
}

.wiki-page h1 {
  margin: 0 0 24px;
  font-size: 32px;
  line-height: 1.22;
}

.wiki-page h2 {
  margin: 34px 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 28px;
  line-height: 1.25;
}

.wiki-page h3 {
  margin: 30px 0 12px;
  color: var(--accent-dark);
  font-size: 23px;
  line-height: 1.3;
}

.wiki-page h4 {
  margin: 24px 0 10px;
  font-size: 19px;
  line-height: 1.35;
}

.wiki-page p,
.wiki-page ul,
.wiki-page ol,
.wiki-page blockquote {
  max-width: 880px;
}

.wiki-page p {
  margin: 0 0 16px;
}

.wiki-page ul,
.wiki-page ol {
  padding-left: 24px;
  margin: 0 0 18px;
}

.wiki-page li + li {
  margin-top: 7px;
}

blockquote {
  margin: 18px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  background: #f1f6f4;
  color: #43504d;
}

code {
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--code-bg);
  color: #12453b;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--table-head);
  color: #243134;
  font-weight: 700;
}

td:first-child,
th:first-child {
  width: 72px;
}

td img[width="32"],
th img[width="32"] {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.raw-table table {
  min-width: 0;
}

.raw-table .entity-image-cell {
  width: 260px;
  text-align: center;
  vertical-align: top;
}

.raw-table .entity-description-cell {
  vertical-align: top;
}

.raw-table img {
  max-width: min(220px, 45vw);
  height: auto;
}

.wiki-figure {
  margin: 18px 0 26px;
}

.wiki-figure img,
.wiki-page > img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}

.wiki-float-right {
  float: right;
  margin: 0 0 18px 24px;
}

.wiki-float-left {
  float: left;
  margin: 4px 12px 8px 0;
}

section::after {
  display: block;
  clear: both;
  content: "";
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(24px, 6vw, 72px);
  color: var(--muted);
  background: #edf2f1;
  border-top: 1px solid var(--line);
}

footer p {
  margin: 0;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
  }

  .sidebar nav {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .layout {
    margin-left: 0;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .meta {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .sidebar {
    padding: 18px 16px;
  }

  .hero,
  .wiki-page {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .wiki-page h1 {
    font-size: 27px;
  }

  .wiki-page h2 {
    font-size: 24px;
  }

  .wiki-page h3 {
    font-size: 20px;
  }

  .wiki-float-right,
  .wiki-float-left {
    float: none;
    margin: 0 0 16px;
  }

  table {
    min-width: 620px;
  }

  footer {
    display: block;
  }

  footer a {
    display: inline-block;
    margin-top: 10px;
  }
}
