:root {
  color-scheme: dark;
  --background: #0d1016;
  --surface: #151a23;
  --surface-raised: #1b2230;
  --border: #30394a;
  --text: #d9dee8;
  --muted: #98a3b7;
  --accent: #71a1fe;
  --accent-soft: rgba(113, 161, 254, 0.14);
  --code: #0a0d12;
  --success: #68d391;
  --maximum-width: 68rem;
  --wiki-width: 84rem;
  --header-height: 5rem;
  --syntax-background: #1e1f22;
  --syntax-text: #bcbec4;
  --syntax-keyword: #cf8e6d;
  --syntax-string: #6aab73;
  --syntax-escape: #cf8e6d;
  --syntax-number: #2aacb8;
  --syntax-comment: #7a7e85;
  --syntax-type: #bcbec4;
  --syntax-type-parameter: #16baac;
  --syntax-annotation: #b3ae60;
  --syntax-function: #56a8f5;
  --syntax-property: #c77dbb;
  --syntax-error: #f57e84;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -20%, rgba(113, 161, 254, 0.18), transparent 34rem),
    var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #9abbff;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 16, 22, 0.96);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(calc(100% - 2rem), var(--wiki-width));
  margin: 0 auto;
  padding: 1.15rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 1px solid rgba(113, 161, 254, 0.5);
  border-radius: 0.55rem;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.82rem;
}

.brand-icon {
  width: 1.6rem;
  height: 1.6rem;
  image-rendering: pixelated;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

.site-nav a,
.nav-trigger,
.repository-link {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.site-nav a,
.nav-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.nav-trigger:hover,
.nav-trigger[aria-expanded="true"],
.nav-trigger[data-current="true"] {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-chevron {
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.15rem) rotate(45deg);
}

.nav-trigger[aria-expanded="true"] .nav-chevron {
  transform: translateY(0.1rem) rotate(225deg);
}

.repository-link { white-space: nowrap; }

[hidden] { display: none !important; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 1rem;
  z-index: 200;
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  color: var(--text);
  background: var(--surface-raised);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

body.menu-open { overflow: hidden; }

.nav-backdrop {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.55);
}

.wiki-menu {
  position: fixed;
  inset: var(--header-height) 0 auto;
  z-index: 90;
  width: 100%;
  max-width: none;
  max-height: calc(100dvh - var(--header-height));
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.3);
}

.wiki-menu[open] { animation: menu-enter 160ms ease-out; }

@keyframes menu-enter {
  from { opacity: 0; transform: translateY(-0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}

.menu-shell {
  width: min(calc(100% - 2rem), var(--wiki-width));
  margin: 0 auto;
  padding: 1.8rem 0 1.1rem;
}

.menu-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.menu-heading h2 {
  margin: 0.3rem 0 0.55rem;
  padding: 0;
  border: 0;
  font-size: 1.9rem;
}

.menu-heading p { margin: 0; color: var(--muted); }

.menu-close {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  background: var(--surface-raised);
  font-size: 1.6rem;
  cursor: pointer;
}

.menu-browser {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 2rem;
}

.menu-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-self: start;
}

.menu-tabs button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.65rem 0.8rem;
  border: 0;
  border-radius: 0.4rem;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.menu-tabs button[aria-selected="true"],
.menu-tabs button:hover { color: var(--text); background: var(--accent-soft); }

.menu-overview {
  display: inline-block;
  margin: 0 0 1.2rem;
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.menu-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.4rem;
}

.menu-group h3 { margin: 0 0 0.8rem; font-size: 0.85rem; color: var(--muted); }
.menu-links, .menu-subtopics { max-width: none; margin: 0; padding: 0; list-style: none; }
.menu-links > li { margin-bottom: 0.3rem; }
.menu-links > li > a { display: block; padding: 0.6rem; border-radius: 0.4rem; color: var(--text); text-decoration: none; }
.menu-links > li > a:hover { background: var(--surface-raised); }
.menu-link-title { display: block; font-size: 0.95rem; font-weight: 650; }
.menu-link-description { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.menu-subtopics { display: flex; flex-wrap: wrap; gap: 0.25rem 0.7rem; padding: 0 0.6rem 0.45rem; }
.menu-subtopics a { font-size: 0.8rem; text-decoration: none; }
.menu-footer { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.menu-footer a { color: var(--muted); font-size: 0.85rem; text-decoration: none; }

.site-nav a:hover {
  color: var(--text);
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1.5rem 0 2rem;
}

.section-nav a {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.7rem;
  background: var(--surface);
  text-decoration: none;
}

.section-nav a[aria-current="page"] {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.page-shell {
  width: min(calc(100% - 2rem), var(--maximum-width));
  min-height: calc(100vh - 11rem);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) 0;
}

.page-shell.has-sidebar {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
  width: min(calc(100% - 2rem), var(--wiki-width));
  padding-top: 2rem;
}

.content { min-width: 0; overflow-wrap: anywhere; }
.content:not(.home-content) h1 { max-width: 26ch; font-size: clamp(2rem, 4.2vw, 3.3rem); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.4rem; color: var(--muted); font-size: 0.8rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs > * + *::before { content: "/"; display: inline-block; margin-right: 0.4rem; color: var(--muted); }
.wiki-sidebar { position: sticky; top: calc(var(--header-height) + 1.5rem); align-self: start; max-height: calc(100dvh - var(--header-height) - 3rem); overflow-y: auto; padding: 0.5rem 0.8rem 0.5rem 0; font-size: 0.85rem; }
.sidebar-toggle { display: none; }
.sidebar-home { display: block; margin-bottom: 1rem; font-weight: 750; text-decoration: none; }
.sidebar-section { margin-bottom: 0.6rem; }
.sidebar-section > summary { padding: 0.5rem 0; color: var(--text); font-weight: 700; cursor: pointer; }
.sidebar-section h3 { margin: 1rem 0 0.35rem; color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.sidebar-link { display: block; margin: 0.15rem 0; padding: 0.4rem 0.65rem; border-radius: 0.35rem; color: var(--muted); text-decoration: none; }
.sidebar-link:hover, .sidebar-link[aria-current="page"] { color: var(--text); background: var(--accent-soft); }
.sidebar-children { margin-left: 0.6rem; border-left: 1px solid var(--border); padding-left: 0.3rem; font-size: 0.8rem; }
.guide-links { padding-left: 1.2rem; }
.guide-links > li { margin-bottom: 1rem; }
.guide-links > li > a { font-weight: 700; }
.guide-links > li > span { display: block; color: var(--muted); }
.guide-links ul { margin: 0.35rem 0; font-size: 0.9rem; }

.content > :first-child {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: #f2f5fa;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin-bottom: 1.2rem;
  font-size: clamp(2.25rem, 7vw, 4.8rem);
  letter-spacing: -0.045em;
}

h2 {
  margin-top: 3rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
  font-size: clamp(1.45rem, 4vw, 2rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-top: 2rem;
  font-size: 1.2rem;
}

p,
ul,
ol,
blockquote {
  max-width: 74ch;
}

strong {
  color: #f5f7fb;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 0.45rem 0.45rem 0;
  color: var(--muted);
  background: var(--accent-soft);
}

code {
  border: 1px solid rgba(152, 163, 183, 0.18);
  border-radius: 0.3rem;
  padding: 0.12em 0.35em;
  color: #dce7ff;
  background: var(--code);
  font-family: ui-monospace, "Cascadia Code", "JetBrains Mono", monospace;
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 1rem 1.1rem;
  background: var(--syntax-background);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.16);
}

pre code {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--syntax-text);
}

/* Rouge token classes, using the palette generated from the in-game IdeColors.kt. */
.highlight .k,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .ow {
  color: var(--syntax-keyword);
}

.highlight .kt,
.highlight .nc,
.highlight .nt { color: var(--syntax-type); }
.highlight .nf,
.highlight .nb { color: var(--syntax-function); }
.highlight .nd { color: var(--syntax-annotation); }
.highlight .na,
.highlight .py { color: var(--syntax-property); }
.highlight .nn { color: var(--syntax-text); }

.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .sh,
.highlight .sr,
.highlight .sx { color: var(--syntax-string); }
.highlight .se,
.highlight .si { color: var(--syntax-escape); }

.highlight .m,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il { color: var(--syntax-number); }

.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cp,
.highlight .cs { color: var(--syntax-comment); }
.highlight .gd { color: var(--syntax-error); }
.highlight .gi { color: var(--syntax-string); }
.highlight .err { color: var(--syntax-error); background: rgba(255, 100, 100, 0.1); }

table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.8rem;
  text-align: left;
}

th {
  color: #f2f5fa;
  background: var(--surface-raised);
}

.hero-copy {
  max-width: 54rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
}

.showcase {
  margin: 1.5rem 0 2rem;
}

.showcase img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

.showcase figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 2rem 0 3rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.8rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  padding: 0.55rem 1rem;
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
  text-decoration: none;
}

.button.primary {
  border-color: var(--accent);
  color: #07101f;
  background: var(--accent);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.1rem;
  background: linear-gradient(145deg, var(--surface-raised), var(--surface));
}

.feature-card h3 {
  margin: 0 0 0.45rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

.audience-cards > a { display: flex; flex-direction: column; color: var(--text); text-decoration: none; transition: border-color 120ms ease; }
.audience-cards > a:hover { border-color: var(--accent); }
.audience-cards h2 { margin: 0 0 0.7rem; padding: 0; border: 0; font-size: 1.45rem; }
.audience-cards p { flex: 1; }
.card-action { display: block; margin-top: 1.5rem; color: var(--accent); font-size: 0.85rem; font-weight: 650; }

.version-chip {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  border: 1px solid rgba(104, 211, 145, 0.35);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  color: var(--success);
  background: rgba(104, 211, 145, 0.08);
  font-size: 0.85rem;
  font-weight: 700;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(calc(100% - 2rem), var(--wiki-width));
  margin: 0 auto;
  padding: 1.4rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; }

@media (max-width: 55rem) {
  .menu-browser { grid-template-columns: 1fr; gap: 1.2rem; }
  .menu-tabs { flex-direction: row; flex-wrap: wrap; }
  .menu-tabs button { font-size: 0.85rem; }
  .menu-tabs button span { display: none; }
  .menu-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-shell.has-sidebar { grid-template-columns: 1fr; gap: 1.5rem; }
  .wiki-sidebar { position: static; max-height: 18rem; padding: 0.5rem 0.8rem; border: 1px solid var(--border); border-radius: 0.5rem; background: var(--surface); }
  .sidebar-toggle { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; font-weight: 650; cursor: pointer; }
  .sidebar-navigation { padding: 0.9rem 0; }
}

@media (max-width: 44rem) {
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-inner { flex-wrap: wrap; gap: 0.5rem 1rem; padding: 0.75rem 0; }
  .site-nav a, .nav-trigger { padding: 0.45rem 0.25rem; font-size: 0.8rem; gap: 0.4rem; }
  .repository-link { margin-left: auto; font-size: 0.8rem; }
  .menu-shell { padding-top: 1.2rem; }
  .menu-columns { grid-template-columns: 1fr; gap: 1rem; }
  .menu-heading { margin-bottom: 1rem; }
  .menu-heading h2 { font-size: 1.5rem; }
  .menu-heading p { font-size: 0.85rem; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wiki-menu[open] { animation: none; }
  .audience-cards > a { transition: none; }
}
