:root {
  --ink: #071426;
  --panel: #0e2038;
  --slot: #0a182b;
  --slot-hi: #27405f;
  --slot-lo: #030a14;
  --line: #213a58;
  --text: #e8f2fb;
  --soft: #a3b8cc;
  --cyan: #19c8ff;
  --blue: #0a6cff;
  --core: #5ad8ff;
  --economy: #ffc857;
  --display: #bda6ff;
  --gameplay: #7ee081;
  --tone: var(--core);
  --display-font: "Chakra Petch", "Trebuchet MS", sans-serif;
  --body-font: "Atkinson Hyperlegible", "Segoe UI", sans-serif;
  --code-font: "JetBrains Mono", Consolas, monospace;
}

.g-core { --tone: var(--core); }
.g-economy { --tone: var(--economy); }
.g-display { --tone: var(--display); }
.g-gameplay { --tone: var(--gameplay); }

* { box-sizing: border-box; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 17px/1.6 var(--body-font);
}
a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: #7fe0ff; }
:focus-visible { outline: 3px solid var(--economy); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--display-font); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2.25rem, 5vw, 3.75rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
code { font: .86em var(--code-font); color: #c9ecff; overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--economy); color: #000; padding: 8px 12px; z-index: 30; }
.skip:focus { left: 8px; }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 40px);
  background: var(--ink);
  border-bottom: 2px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font: 700 1.2rem var(--display-font);
  text-decoration: none;
  white-space: nowrap;
}
.brand img { display: block; mix-blend-mode: screen; }
.top nav { display: flex; gap: 20px; }
.top nav a { color: var(--soft); text-decoration: none; font-weight: 700; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }
.top nav a[aria-current] { box-shadow: 0 2px 0 var(--cyan); }
.search { position: relative; margin-left: auto; width: min(340px, 34vw); }
.search input {
  width: 100%;
  padding: 8px 12px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  background: var(--slot);
  border: 0;
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
}
.search input::placeholder { color: var(--soft); }
.results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(480px, calc(100vw - 32px));
  max-height: 70vh;
  overflow: auto;
  background: var(--panel);
  border: 2px solid var(--blue);
  box-shadow: 0 12px 30px #0009;
}
.results a { display: block; padding: 9px 12px; color: var(--text); text-decoration: none; border-bottom: 1px solid var(--line); }
.results a:hover, .results a.on { background: #17365a; }
.results b { font: 600 14px var(--code-font); overflow-wrap: anywhere; }
.results small { display: block; color: var(--soft); }
.results .kind { float: right; margin-left: 10px; color: var(--soft); font-size: 13px; }
.results p { margin: 0; padding: 12px; color: var(--soft); }

/* Home */
.home { padding: 0 clamp(16px, 3vw, 40px); }
.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) 0 56px;
}
.hero-copy { max-width: 1040px; margin-bottom: 28px; }
.lede { color: var(--soft); font-size: 1.2rem; margin: 16px 0 0; max-width: 62ch; }
.note { color: var(--soft); font-size: .95rem; margin: 14px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn {
  display: inline-block;
  padding: 11px 20px;
  color: #04121f;
  font: 700 1.05rem var(--display-font);
  text-decoration: none;
  background: linear-gradient(135deg, var(--cyan), #2b8dff);
  box-shadow: inset -3px -3px 0 #0a4fb8, inset 3px 3px 0 #8be6ff;
}
.btn:hover { color: #04121f; filter: brightness(1.1); }
.btn-quiet {
  color: var(--text);
  background: var(--panel);
  box-shadow: inset -3px -3px 0 var(--slot-lo), inset 3px 3px 0 var(--slot-hi);
}
.btn-quiet:hover { color: var(--text); }

/* The inventory: the one big idea of the site */
.inventory {
  padding: 16px clamp(10px, 2vw, 22px) 18px;
  background: var(--panel);
  box-shadow: inset 4px 4px 0 var(--slot-hi), inset -4px -4px 0 var(--slot-lo), 0 0 0 2px #000;
}
.inventory-title { font: 700 1.05rem var(--display-font); color: var(--soft); margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; }
.slot { position: relative; display: block; color: var(--tone); text-decoration: none; }
.slot-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  aspect-ratio: 1;
  height: 100%;
  width: 100%;
  padding: 6px 2px;
  color: var(--tone);
  background: var(--slot);
  box-shadow: inset 3px 3px 0 var(--slot-lo), inset -3px -3px 0 var(--slot-hi);
}
.pixel { width: 44%; height: auto; display: block; fill: currentColor; }
.slot-name { color: var(--text); font: 700 clamp(.66rem, 1.05vw, .9rem) var(--display-font); line-height: 1; }
a.slot:hover .slot-face, a.slot:focus-visible .slot-face { background: #1b3a5f; }
a.slot:hover .pixel, a.slot:focus-visible .pixel { transform: scale(1.1); }
a.slot:hover, a.slot:focus-visible { z-index: 5; }
.tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 6;
  width: 270px;
  padding: 9px 12px;
  color: var(--soft);
  font-size: .92rem;
  line-height: 1.35;
  background: #0b0520;
  border: 2px solid #3b1fb0;
  outline: 2px solid #0b0520;
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tip-left { left: 0; transform: none; }
.tip-right { left: auto; right: 0; transform: none; }
.tip b { display: block; color: var(--tone); font: 700 1.05rem var(--display-font); }
.tip-group { display: block; color: #8d84b8; font-size: .82rem; margin-bottom: 4px; }
.tip > span:last-child { display: block; color: var(--text); }
a.slot:hover .tip, a.slot:focus-visible .tip { opacity: 1; visibility: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--soft); font-size: .92rem; }
.legend i { display: inline-block; width: 11px; height: 11px; margin-right: 7px; background: var(--tone); }
@media (prefers-reduced-motion: no-preference) {
  .grid a.slot .pixel { animation: drop .32s steps(4) backwards; }
  .grid a.slot:nth-child(9n+2) .pixel { animation-delay: .05s; }
  .grid a.slot:nth-child(9n+3) .pixel { animation-delay: .1s; }
  .grid a.slot:nth-child(9n+4) .pixel { animation-delay: .15s; }
  .grid a.slot:nth-child(9n+5) .pixel { animation-delay: .2s; }
  .grid a.slot:nth-child(9n+6) .pixel { animation-delay: .25s; }
  .grid a.slot:nth-child(9n+7) .pixel { animation-delay: .3s; }
  .grid a.slot:nth-child(9n+8) .pixel { animation-delay: .35s; }
  .grid a.slot:nth-child(9n) .pixel { animation-delay: .4s; }
  @keyframes drop { from { opacity: 0; transform: translateY(-12px) scale(.7); } }
}

.band { max-width: 1240px; margin: 0 auto; padding: 48px 0; border-top: 2px solid var(--line); }
.steps { list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; padding: 0; margin: 24px 0; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: block;
  width: 44px;
  margin-bottom: 12px;
  color: var(--cyan);
  font: 700 1.5rem/44px var(--display-font);
  text-align: center;
  background: var(--slot);
  box-shadow: inset 3px 3px 0 var(--slot-lo), inset -3px -3px 0 var(--slot-hi);
}
.steps strong { display: block; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 72px); }
.facts { margin: 20px 0 0; }
.facts dt { font-weight: 700; margin-top: 16px; }
.facts dd { margin: 2px 0 0; color: var(--soft); }
.pairs { list-style: none; padding: 0; margin: 20px 0; }
.pairs li { display: grid; grid-template-columns: 52px 18px 52px 1fr; gap: 6px; align-items: center; margin-bottom: 14px; }
.pairs p { margin: 0 0 0 10px; color: var(--soft); }
.pairs strong { color: var(--text); }
.plus { text-align: center; color: var(--soft); font-weight: 700; }
.mini {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: var(--tone);
  background: var(--slot);
  box-shadow: inset 3px 3px 0 var(--slot-lo), inset -3px -3px 0 var(--slot-hi);
}
.mini .pixel { width: 27px; }

/* Plugin list */
.wide { max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px) 48px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px) 48px; }
.page-head { padding: 40px 0 8px; }
.group { margin-top: 32px; }
.group h2 { color: var(--tone); }
.rows { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 6px 28px; }
.row { display: flex; gap: 14px; align-items: center; padding: 6px; color: var(--text); text-decoration: none; }
.row:hover { background: var(--panel); color: var(--text); }
.row .slot-face { flex: 0 0 60px; width: 60px; height: 60px; padding: 0; }
.row .pixel { width: 32px; }
.row strong { display: block; font: 700 1.1rem var(--display-font); }
.row span span { display: block; color: var(--soft); font-size: .95rem; line-height: 1.35; }

/* Docs */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); padding-top: 28px; }
.side { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; scrollbar-width: thin; scrollbar-color: var(--slot-hi) transparent; }
.side > summary { display: none; }
.side h2 { font-size: 1rem; color: var(--soft); margin: 16px 0 4px; }
.side h2:first-child { margin-top: 0; }
.side a { display: flex; align-items: center; gap: 9px; padding: 3px 8px; color: var(--soft); text-decoration: none; }
.side a .pixel { width: 16px; color: var(--tone); }
.side a:hover { color: var(--text); background: var(--panel); }
.side a[aria-current] { color: var(--text); background: var(--panel); box-shadow: inset 3px 0 0 var(--tone); font-weight: 700; }
.guide-nav a { padding: 6px 10px; --tone: var(--cyan); }
.doc { min-width: 0; max-width: 900px; }
.doc > p, .doc > ul, .doc > ol, .doc h2, .doc h3 { max-width: 72ch; }
.doc-head { display: flex; gap: 20px; align-items: flex-start; }
.doc-head .big { flex: 0 0 96px; width: 96px; height: 96px; padding: 0; }
.doc-head .big .pixel { width: 54px; }
.doc-head h1 { color: var(--text); font-size: clamp(2rem, 4vw, 3rem); }
.doc-head .lede { margin-top: 6px; }
.meta { color: var(--soft); font-size: .92rem; margin: 6px 0 0; }
.jump { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 24px 0 8px; padding: 10px 0; border-block: 2px solid var(--line); }
.jump a { font-size: .95rem; }
.doc h2 { margin: 40px 0 12px; }
.doc h3 { margin: 24px 0 8px; }
.doc li { margin: 4px 0; }
.table-wrap { overflow-x: auto; margin: 14px 0; border: 2px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th { text-align: left; background: var(--panel); font-family: var(--display-font); white-space: nowrap; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td:first-child code { white-space: normal; }
.code { position: relative; margin: 14px 0; }
pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: #040d1a;
  border: 2px solid var(--line);
  font-size: .85rem;
  line-height: 1.55;
}
pre code { color: #dbeaf6; overflow-wrap: normal; font-size: inherit; }
pre .c { color: #7f99b3; }
pre .k { color: var(--cyan); }
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  color: var(--text);
  font: 700 .85rem var(--display-font);
  background: var(--panel);
  border: 0;
  box-shadow: inset 2px 2px 0 var(--slot-hi), inset -2px -2px 0 var(--slot-lo);
  cursor: pointer;
}
details.config > summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--cyan); }
.license { white-space: pre-wrap; max-width: 72ch; color: var(--soft); }

/* Footer */
.foot { padding: 24px clamp(16px, 3vw, 40px) 32px; border-top: 2px solid var(--line); color: var(--soft); font-size: .95rem; }
.foot p { margin: 4px 0; max-width: 80ch; }
.foot .legal { font-size: .85rem; }

@media (max-width: 900px) {
  .docs { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .side { position: static; max-height: none; border: 2px solid var(--line); padding: 4px 12px; }
  .side > summary { display: list-item; cursor: pointer; font-weight: 700; padding: 6px 0; }
  .side nav { padding-bottom: 8px; }
  .steps { grid-template-columns: 1fr; gap: 18px; }
  .split { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .slot-empty:nth-last-child(-n+3) { display: none; }
  .slot-name { font-size: clamp(.58rem, 1.9vw, .8rem); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  html { scroll-padding-top: 12px; }
  .top { position: static; flex-wrap: wrap; gap: 8px 16px; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .top nav { margin-left: auto; gap: 14px; }
  .brand { font-size: 1.05rem; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .slot-empty { display: none; }
  .slot-name { font-size: .72rem; }
  .pairs li { grid-template-columns: 52px 18px 52px; }
  .pairs p { grid-column: 1 / -1; margin: 4px 0 0; }
  .doc-head { flex-direction: column; gap: 12px; }
}
@media (hover: none) { .tip { display: none; } }
