:root {
  --bg: #0a0f1a;
  --panel: #111a28;
  --panel-2: #172234;
  --steel: #2a3648;
  --steel-light: #5b6574;
  --text: #d9e2ec;
  --muted: #8fa3bb;
  --chevron: #e8892b;
  --chevron-dark: #a85a12;
  --horizon: #6fb6ff;
  --horizon-deep: #1565a8;
  --tip: #4fbf8b;
  --warning: #e8892b;
  --slot: #262f3d;
  --slot-edge-light: #3b4658;
  --slot-edge-dark: #0e141e;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 16px; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 85% -10%, rgba(21, 101, 168, 0.18), transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  font: 17px/1.65 Barlow, system-ui, sans-serif;
}

a { color: var(--horizon); text-decoration: none; }
a:hover { text-decoration: underline; }

.masthead {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  border-bottom: 2px solid var(--chevron);
  background: linear-gradient(180deg, #0d1522, var(--bg));
}

.brand { display: block; flex: 0 0 auto; }
.logo { display: block; width: 300px; height: auto; }

.masthead-text { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.wiki-name {
  font-family: Orbitron, sans-serif;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 13px;
}

.search {
  width: 240px;
  padding: 8px 12px;
  border: 1px solid var(--steel);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search:focus { outline: 2px solid var(--horizon-deep); border-color: var(--horizon-deep); }

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  max-width: 1280px;
  margin: 0 auto;
}

.sidebar {
  padding: 24px 20px;
  border-right: 1px solid var(--steel);
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}
.sidebar h3 {
  margin: 20px 0 8px;
  font: 700 11px Orbitron, sans-serif;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--chevron);
}
.sidebar h3:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block;
  padding: 4px 10px;
  border-left: 2px solid transparent;
  color: var(--text);
  font-size: 15px;
}
.sidebar li a:hover { background: var(--panel); text-decoration: none; border-left-color: var(--steel-light); }
.sidebar li a.current { border-left-color: var(--chevron); background: var(--panel); color: #fff; }

.content { padding: 24px 40px 48px; min-width: 0; }

.breadcrumb { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb span { margin: 0 4px; }

h1, h2, h3, h4 { font-family: Michroma, sans-serif; font-weight: 400; color: #eef3f9; line-height: 1.3; }
.page-title {
  margin: 0 0 18px;
  font-size: 30px;
  letter-spacing: 0.06em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--steel);
}
article h2 {
  font-size: 20px;
  margin: 40px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--steel);
  clear: both;
}
article h3 { font-size: 16px; margin: 28px 0 8px; color: #dfe8f2; }
article h4 { font-size: 14px; margin: 20px 0 6px; }
h2 .anchor, h3 .anchor, h4 .anchor { color: inherit; }
h2 .anchor:hover::after, h3 .anchor:hover::after { content: ' #'; color: var(--chevron); }

.summary { font-size: 19px; color: #c8d4e2; }

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.88em;
  background: var(--panel-2);
  border: 1px solid var(--steel);
  border-radius: 3px;
  padding: 1px 5px;
  color: #ffd6ad;
}
pre.code {
  background: #070b13;
  border: 1px solid var(--steel);
  border-left: 3px solid var(--horizon-deep);
  border-radius: 4px;
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
}
pre.code.layout { width: fit-content; max-width: 100%; }
pre.code code { background: none; border: 0; padding: 0; color: #cfe3ff; }

.toc {
  display: inline-block;
  min-width: 260px;
  max-width: 420px;
  margin: 4px 0 8px;
  padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--steel);
  border-top: 3px solid var(--horizon-deep);
  border-radius: 4px;
  font-size: 15px;
}
.toc-title {
  font: 700 11px Orbitron, sans-serif;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.toc ol { margin: 0; padding-left: 20px; }

.infobox {
  float: right;
  clear: right;
  width: 300px;
  margin: 0 0 20px 28px;
  background: var(--panel);
  border: 1px solid var(--steel);
  border-radius: 4px;
  overflow: hidden;
  font-size: 15px;
}
.infobox-title {
  padding: 10px 14px;
  background: linear-gradient(90deg, var(--chevron-dark), var(--chevron));
  color: #10151d;
  font: 400 14px Michroma, sans-serif;
  letter-spacing: 0.06em;
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td { padding: 7px 14px; border-top: 1px solid var(--steel); vertical-align: top; text-align: left; }
.infobox th { width: 40%; color: var(--muted); font-weight: 500; }

.table-wrap { overflow-x: auto; margin: 16px 0; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 15px; }
.table-wrap th {
  background: var(--panel-2);
  text-align: left;
  font-weight: 600;
  color: #eef3f9;
  border-bottom: 2px solid var(--chevron);
}
.table-wrap th, .table-wrap td { padding: 8px 12px; border: 1px solid var(--steel); vertical-align: top; }
.table-wrap tbody tr:nth-child(even) { background: rgba(23, 34, 52, 0.55); }

.callout {
  margin: 18px 0;
  padding: 12px 16px;
  border: 1px solid var(--steel);
  border-left: 4px solid var(--horizon);
  border-radius: 4px;
  background: var(--panel);
}
.callout.tip { border-left-color: var(--tip); }
.callout.warning { border-left-color: var(--warning); }
.quote { margin: 18px 0; padding: 4px 16px; border-left: 3px solid var(--steel-light); color: var(--muted); }

.recipe {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: start;
  gap: 18px;
  margin: 14px 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--steel);
  border-radius: 4px;
}
.recipe-table { display: flex; align-items: center; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; }
.slot {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slot);
  border: 2px solid;
  border-color: var(--slot-edge-dark) var(--slot-edge-light) var(--slot-edge-light) var(--slot-edge-dark);
  font: 700 16px Orbitron, sans-serif;
  color: var(--chevron);
}
.slot.empty { color: transparent; }
.arrow { font-size: 26px; color: var(--steel-light); }
.result {
  width: 200px;
  padding: 10px 12px;
  border: 2px solid var(--chevron);
  border-radius: 4px;
  background: var(--panel-2);
  font-weight: 600;
  text-align: center;
}
.recipe-kind { order: 1; grid-column: 1 / -1; contain: inline-size; font-size: 13px; color: var(--muted); }
.legend { width: 280px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.legend li { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.slot-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--slot);
  border: 1px solid var(--slot-edge-light);
  font: 700 12px Orbitron, sans-serif;
  color: var(--chevron);
}

.glyphs {
  display: inline-flex;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 2px;
  vertical-align: middle;
  padding: 2px 4px;
  background: #070b13;
  border-radius: 3px;
}
.glyph { width: 22px; height: 22px; }

img { max-width: 100%; }
article::after { content: ''; display: block; clear: both; }

.foot {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--steel);
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--steel); padding: 16px; }
  .sidebar ul { display: flex; flex-wrap: wrap; gap: 4px 8px; }
  .content { padding: 20px 16px 40px; }
  .masthead { flex-wrap: wrap; padding: 12px 16px; }
  .logo { width: 220px; }
  .masthead-text { width: 100%; }
  .search { width: 100%; }
  .toc, .infobox { float: none; width: auto; margin: 0 0 20px; }
}

.icon { width: 32px; height: 32px; image-rendering: pixelated; }
.icon-small { width: 24px; height: 24px; image-rendering: pixelated; vertical-align: middle; }
.icon-large { width: 64px; height: 64px; image-rendering: pixelated; }
.slot .icon { width: 32px; height: 32px; }
.item { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; font-weight: 500; }
.item .icon { width: 24px; height: 24px; }
.infobox-icon {
  display: flex;
  justify-content: center;
  padding: 14px 0 10px;
  background: radial-gradient(circle, rgba(21, 101, 168, 0.35), transparent 70%);
}
.infobox-icon .icon-large { width: 96px; height: 96px; }
.result { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.result-slot {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slot);
  border: 2px solid;
  border-color: var(--slot-edge-dark) var(--slot-edge-light) var(--slot-edge-light) var(--slot-edge-dark);
}
.count {
  position: absolute;
  right: 4px;
  bottom: 0;
  font: 700 18px Barlow, sans-serif;
  color: #fff;
  text-shadow: 2px 2px 0 #3f3f3f;
}
.result-name { font-weight: 600; text-align: center; }

.search-box { position: relative; }
.search-results {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  width: 320px;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--steel);
  border-top: 2px solid var(--horizon-deep);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px; color: var(--text); }
.search-results a:hover { background: var(--panel-2); text-decoration: none; }
.search-results span { color: var(--muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; margin: 14px 0; }
.card {
  min-width: 0;
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--steel);
  border-radius: 4px;
}
.card:hover { border-color: var(--steel-light); }
.card-icon {
  flex: 0 0 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slot);
  border: 2px solid;
  border-color: var(--slot-edge-dark) var(--slot-edge-light) var(--slot-edge-light) var(--slot-edge-dark);
}
.card-icon .icon-large { width: 40px; height: 40px; }
.card-text { min-width: 0; overflow-wrap: anywhere; }
.card-title { font-weight: 600; color: #eef3f9; }
.card-summary { font-size: 14px; color: var(--muted); line-height: 1.5; margin-top: 2px; }

.recipes { display: flex; flex-wrap: wrap; gap: 0 16px; }
.slot a { display: flex; }
.result-name a { color: inherit; }
.result-name a:hover { color: var(--horizon); }
.legend a { color: var(--text); }
.legend a:hover { color: var(--horizon); }
a.item { color: var(--horizon); }
.used-in { columns: 2 220px; padding-left: 20px; }
.used-in li { break-inside: avoid; margin: 2px 0; }

/* Code colors, after the IntelliJ dark theme */
.tok-keyword { color: #cf8e6d; }
.tok-type { color: #e2c08d; }
.tok-string { color: #6aab73; }
.tok-number { color: #2aacb8; }
.tok-comment { color: #7a7e85; font-style: italic; }
.tok-annotation { color: #b3ae60; }
.tok-key { color: #c77dbb; }

.infobox-image {
  display: flex;
  justify-content: center;
  padding: 14px 0 6px;
  background: radial-gradient(circle, rgba(21, 101, 168, 0.35), transparent 70%);
}
.infobox-image img { max-height: 260px; image-rendering: pixelated; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 16px 0; }
.gallery figure { margin: 0; background: var(--panel); border: 1px solid var(--steel); border-radius: 4px; overflow: hidden; }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption { padding: 6px 10px; font-size: 14px; color: var(--muted); }
.card-icon .card-image { max-width: 48px; max-height: 48px; image-rendering: pixelated; }

@media (max-width: 760px) {
  .recipe { grid-template-columns: auto; }
}
