:root {
  color-scheme: dark;
  --ink: #ded8cc;
  --muted: #aaa196;
  --page: #171510;
  --surface: #201d18;
  --surface-raised: #2b261f;
  --gold: #a8793b;
  --gold-bright: #d1a25a;
  --line: rgb(169, 126, 59);
  --code: #12110e;
  --cream: #e7e0d4;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at 75% 4%, rgba(140, 99, 43, .12), transparent 32%),
    linear-gradient(115deg, #14120f, #1c1914 52%, #15130f);
  color: var(--ink);
  font-family: "Noto Sans", sans-serif;
  line-height: 1.65;
}
button, input { font: inherit; }
:where(.doc-section, .changelog-content) a:any-link:not(.button) {
  color: var(--gold-bright);
  text-decoration: underline;
  text-decoration-color: rgba(209, 162, 90, .48);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
:where(.doc-section, .changelog-content) a:any-link:not(.button):is(:hover, :focus-visible, :active) {
  color: var(--cream);
  text-decoration-color: currentColor;
}
:where(.doc-section, .changelog-content) a:any-link:not(.button):focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}
code, pre { font-family: "Source Code Pro", monospace; }
code.inline-code,
.doc-section p > code,
.doc-section h3 > code,
.doc-section dt > code,
.doc-section dd > code,
.doc-section li > code,
.doc-section td > code,
.doc-section th > code {
  padding: .08em .38em;
  border: 1px solid rgba(169, 126, 59, .42);
  border-radius: 3px;
  background: rgba(22, 19, 15, .9);
  color: #d3a560;
  font-family: "Source Code Pro", monospace;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.doc-section .method-label code.inline-code,
.doc-section .signature code.inline-code {
  display: inline-block;
  user-select: all;
  cursor: text;
}
.doc-section p.method-label { margin: 0 0 18px; font-size: 13px; line-height: 1.55; }
.language-lua .token.comment { color: #81796e; font-style: italic; }
.language-lua .token.keyword { color: #e78a69; }
.language-lua .token.literal { color: #d49ee8; }
.language-lua .token.number { color: #d8b977; }
.language-lua .token.string { color: #9fcf8f; }
.language-lua .token.function { color: #84bce4; }
.language-json .token.key { color: #84bce4; }
.language-json .token.string { color: #9fcf8f; }
.language-json .token.number { color: #d8b977; }
.language-json .token.literal { color: #d49ee8; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 260px;
  padding: 36px 30px;
  background: linear-gradient(180deg, #12100d, #1b1712);
  color: var(--cream);
  border-right: 1px solid #715126;
  display: flex;
  flex-direction: column;
  z-index: 3;
}
.brand {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font-family: Cinzel, serif;
  font-size: 20px;
  line-height: 1.1;
}
.brand small {
  display: block;
  color: #958b7e;
  font: 10px "Source Code Pro", monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: 6px;
}
.sidebar-support { margin-top: 34px; }
.header-toggle { display: none; }
nav { min-height: 0; margin-top: 34px; display: grid; gap: 3px; overflow-y: auto; }
nav a {
  color: #b8afa3;
  text-decoration: none;
  padding: 7px 0;
  border-bottom: 1px solid rgba(180, 146, 93, .1);
  font-size: 13px;
  transition: .2s;
}
nav a:hover, nav a.active { color: var(--gold-bright); padding-left: 8px; }
.sidebar nav .editor-nav-link { padding: 7px 10px; border-left: 2px solid #a8793b; background: linear-gradient(90deg, rgba(169, 126, 59, .24), rgba(169, 126, 59, .05) 75%, transparent); color: #ead6b5; }
.sidebar nav .editor-nav-link:hover, .sidebar nav .editor-nav-link[aria-current="page"] { padding-left: 18px; border-left-color: var(--gold-bright); color: var(--gold-bright); background: linear-gradient(90deg, rgba(169, 126, 59, .34), rgba(169, 126, 59, .07) 75%, transparent); }
.docs-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  margin-top: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(169, 126, 59, .55);
  border-radius: 2px;
  background: linear-gradient(#302b24, #211e19);
  color: var(--cream);
  font: 12px "Noto Sans", sans-serif;
  text-align: left;
  cursor: pointer;
}
.docs-search-trigger + nav { margin-top: 14px; }
.docs-search-trigger svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.docs-search-trigger kbd { margin-left: auto; color: var(--muted); font: 10px "Source Code Pro", monospace; white-space: nowrap; }
.docs-search-trigger:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
.docs-search-trigger:focus-visible, .docs-search-close:focus-visible, .docs-search-results a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.docs-search-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(80dvh, 680px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1a1713;
  color: var(--cream);
  box-shadow: 0 24px 80px #000c;
  overflow: hidden;
}
.docs-search-dialog[open] { display: flex; flex-direction: column; }
.docs-search-dialog::backdrop { background: #070605c9; }
.docs-search-field { display: flex; align-items: center; gap: 10px; flex: none; padding: 0 16px; border-bottom: 1px solid #564126; }
.docs-search-field:focus-within { border-bottom-color: var(--gold-bright); }
.docs-search-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.docs-search-field input {
  flex: 1;
  min-width: 0;
  padding: 17px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--cream);
  font: 16px "Noto Sans", sans-serif;
}
.docs-search-field input::placeholder { color: var(--muted); }
.docs-search-close { flex: none; min-width: 44px; min-height: 44px; padding: 8px; border: 1px solid #5e492e; border-radius: 3px; background: #28231c; color: var(--muted); font: 11px "Source Code Pro", monospace; cursor: pointer; }
.docs-search-close:hover { color: var(--cream); border-color: var(--gold-bright); }
.docs-search-results { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.docs-search-results a { display: block; padding: 11px 18px; border-bottom: 1px solid rgba(180, 146, 93, .1); color: var(--cream); text-decoration: none; font-size: 14px; }
.docs-search-results a[aria-selected="true"], .docs-search-results a:hover { background: #382c1e; color: var(--gold-bright); }
.docs-search-empty { margin: 0; padding: 24px 18px; color: var(--muted); font-size: 14px; }
.docs-search-hint { flex: none; margin: 0; padding: 10px 18px; border-top: 1px solid #564126; color: var(--muted); font: 11px "Source Code Pro", monospace; }
main { min-width: 0; margin-left: 260px; }
.landing main { margin-left: 0; }
.landing .hero {
  min-height: 100vh;
  min-height: 100svh;
  padding-left: clamp(32px, 12vw, 190px);
  padding-right: clamp(32px, 12vw, 190px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-bottom: 0;
}
.landing .hero h1 { max-width: none; }
.landing .lede {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}
.landing .hero-actions {
  justify-content: center;
  align-items: center;
  max-width: 100%;
}
.landing .hero-actions .button { max-width: 100%; }
.landing .hero a:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}
.hero-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  max-width: 100%;
  overflow: visible;
  margin-top: 24px;
}
.hero-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  padding: 0;
  border-bottom: 0;
  color: var(--gold-bright);
  text-decoration: none;
}
.hero-socials a:hover { color: var(--cream); padding-left: 0; }
.hero-socials svg { display: block; flex: none; fill: currentColor; }
.hero {
  min-height: 72vh;
  padding: clamp(80px, 12vh, 150px) clamp(40px, 9vw, 150px) clamp(72px, 9vh, 110px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--line);
  background: #171510 url("../assets/header-poster.webp") center / cover no-repeat;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(135deg, rgba(203, 156, 82, .035) 0 1px, transparent 1px 8px),
    linear-gradient(90deg, rgba(18, 16, 13, .92) 0%, rgba(24, 20, 16, .72) 58%, rgba(17, 15, 12, .8) 100%),
    linear-gradient(0deg, rgba(15, 13, 10, .82), transparent 40%);
}
.hero > :not(.hero-video) {
  position: relative;
  z-index: 1;
}
.hero-video {
  position: absolute;
  inset: -12px;
  z-index: -2;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  object-fit: cover;
  filter: blur(5px) saturate(.58) sepia(.08) brightness(.58);
}
.hero-compact {
  min-height: auto;
  padding-top: clamp(72px, 9vh, 110px);
  padding-bottom: clamp(58px, 7vh, 84px);
}
.eyebrow {
  font: 600 11px "Source Code Pro", monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--gold);
}
.hero h1 { font: 700 clamp(48px, 7vw, 104px)/.98 Cinzel, serif; letter-spacing: -.045em; margin: 25px 0; max-width: 1050px; overflow-wrap: anywhere; }
.lede { font-size: clamp(17px, 2vw, 20px); max-width: 650px; color: var(--muted); }
.hero-actions { display: flex; align-items: center; gap: 30px; margin-top: 38px; }
.button {
  background: linear-gradient(#3a342b, #25211b);
  color: #eadfce;
  padding: 12px 19px;
  text-decoration: none;
  font: 600 12px "Source Code Pro", monospace;
  text-transform: uppercase;
  letter-spacing: .08em;
  border: 1px solid #9f7339;
  box-shadow:
    inset 0 0 0 1px rgba(231, 192, 121, .12),
    0 1px 0 rgba(0, 0, 0, .55);
}
.button:hover {
  background: linear-gradient(#494035, #302a22);
  border-color: var(--gold-bright);
}
.hero-text-link {
  color: var(--gold-bright);
  font: 600 12px "Source Code Pro", monospace;
  letter-spacing: .08em;
  text-underline-offset: 4px;
  text-transform: uppercase;
}
.hero-text-link:hover {
  color: var(--cream);
}
.doc-section {
  display: grid;
  grid-template-columns: minmax(0, 900px);
  padding: clamp(72px, 8vw, 110px) clamp(32px, 8vw, 130px);
  border-bottom: 1px solid var(--line);
}
.doc-section > * { min-width: 0; }
.doc-section h2 { font: 700 clamp(34px, 4vw, 58px) Cinzel, serif; margin: 0 0 22px; overflow-wrap: anywhere; }
h2[id] { scroll-margin-top: 40px; }
.doc-section h3 { font: 600 17px Cinzel, serif; color: var(--gold-bright); margin-top: 0; overflow-wrap: anywhere; }
.doc-section > div > h3 { margin-top: 40px; }
.doc-section p { font-size: 17px; max-width: 760px; color: #cec7bb; }
.doc-section .signature { color: var(--gold-bright); font: 600 13px/1.8 "Source Code Pro", monospace; overflow-wrap: anywhere; }
.doc-section table {
  width: 100%;
  max-width: 760px;
  margin: 28px 0;
  border: 1px solid rgba(169, 126, 59, .5);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 3px;
  background: rgba(24, 21, 17, .78);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .018),
    0 12px 28px rgba(0, 0, 0, .2);
  color: #cfc7bb;
  font-size: 14px;
  line-height: 1.55;
  overflow: hidden;
}
.doc-section th,
.doc-section td {
  padding: 13px 16px;
  border-right: 1px solid rgba(169, 126, 59, .2);
  border-bottom: 1px solid rgba(169, 126, 59, .2);
  text-align: left;
  vertical-align: top;
}
.doc-section th:last-child,
.doc-section td:last-child { border-right: 0; }
.doc-section tbody tr:last-child td { border-bottom: 0; }
.doc-section th {
  background: linear-gradient(180deg, rgba(54, 47, 38, .96), rgba(39, 34, 28, .96));
  color: var(--gold-bright);
  font: 600 11px/1.5 "Source Code Pro", monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.doc-section tbody tr:nth-child(even) { background: rgba(255, 255, 255, .018); }
.doc-section tbody tr:hover { background: rgba(169, 126, 59, .08); }
.code-block {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 28px 0;
}
pre {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--code);
  color: #ddd6ca;
  padding: 52px 25px 25px;
  margin: 0;
  border: 1px solid rgba(169, 126, 59, .38);
  border-left: 3px solid var(--gold);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .018),
    0 14px 32px rgba(0, 0, 0, .28);
  font-size: 13px;
  line-height: 1.7;
}
.code-copy {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  min-width: 64px;
  padding: 6px 10px;
  border: 1px solid rgba(169, 126, 59, .55);
  border-radius: 3px;
  background: linear-gradient(#302b24, #211e19);
  color: #cec6ba;
  font: 600 11px "Noto Sans", sans-serif;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.code-copy:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: linear-gradient(#3b342a, #29241d);
}
.code-copy:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.sprite-name-picker {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(49, 43, 35, .78), rgba(35, 31, 26, .78));
}
.sprite-name-picker > label {
  display: block;
  margin-bottom: 10px;
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
}
.sprite-name-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
#sprite-name-filter {
  width: min(100%, 320px);
  padding: 9px 11px;
  border: 1px solid rgba(169, 126, 59, .55);
  border-radius: 2px;
  outline: none;
  background: #171510;
  color: var(--ink);
  font: 13px "Noto Sans", sans-serif;
}
#sprite-name-filter::placeholder { color: #7f776c; }
#sprite-name-filter:focus {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px rgba(209, 162, 90, .15);
}
.sprite-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
.sprite-name-grid button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(169, 126, 59, .38);
  border-radius: 2px;
  background: linear-gradient(#302b24, #211e19);
  color: #cfc7bb;
  cursor: copy;
  transition: border-color .15s, color .15s, background .15s;
}
.sprite-name-grid button[hidden] { display: none; }
.sprite-name-grid button:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: linear-gradient(#3b342a, #29241d);
}
.sprite-name-grid button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 1px;
}
.sprite-name-grid button img {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.sprite-name-grid button code {
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  text-overflow: ellipsis;
}
.sprite-name-empty {
  padding: 16px 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.overhead-bar-preview {
  max-width: 760px;
  margin: 28px 0;
  padding: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(49, 43, 35, .78), rgba(35, 31, 26, .78));
}
.overhead-bar-preview label {
  display: block;
  margin-bottom: 10px;
  color: var(--gold-bright);
  font-size: 14px;
  font-weight: 700;
}
.overhead-bar-preview select {
  width: min(100%, 400px);
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid rgba(169, 126, 59, .55);
  border-radius: 2px;
  background: #171510;
  color: var(--ink);
  font: 13px "Noto Sans", sans-serif;
}
.overhead-bar-preview select:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.overhead-bar-preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: #171510;
}
.overhead-bar-preview-art {
  position: relative;
  flex: none;
  width: var(--bar-width);
  height: var(--bar-height);
  transform: scale(3);
  image-rendering: pixelated;
}
.overhead-bar-preview-art img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: var(--bar-width);
  height: var(--bar-height);
  image-rendering: pixelated;
}
.overhead-bar-preview-fill-clip {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--bar-fill-width);
  height: var(--bar-height);
  overflow: hidden;
}
.overhead-bar-preview-art[hidden], .overhead-bar-preview-error[hidden] { display: none; }
.doc-section .overhead-bar-preview-error {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.overhead-bar-preview-copy { margin-top: 20px; }
.overhead-bar-preview-copy-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.overhead-bar-preview-copy-controls select { width: min(100%, 180px); }
.overhead-bar-preview-copy-button {
  position: static;
  min-height: 44px;
  padding: 9px 14px;
}
.overhead-bar-preview-code {
  max-height: 320px;
  margin: 16px 0 0;
  padding: 16px 18px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.overhead-bar-preview-code[hidden] { display: none; }
.copy-toast {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  min-width: 160px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid #6f9f66;
  background: linear-gradient(#302b24, #211e19);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .42);
  color: #ddd6ca;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .14s ease, transform .14s ease;
}
.copy-toast[data-state="error"] { border-left-color: #a9675b; }
.copy-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.note {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(49, 43, 35, .78), rgba(35, 31, 26, .78));
  color: #d2cabd;
}
.note > p { margin: 0; color: inherit; font-size: inherit; }
.api-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(14px, 2vw, 20px);
}
.api-grid article {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(45, 40, 33, .88), rgba(31, 28, 23, .88));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .018);
}
dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 0; }
dt { min-width: 0; font: 600 12px/1.55 "Source Code Pro", monospace; color: var(--gold-bright); overflow-wrap: anywhere; word-break: break-word; }
dd { min-width: 0; margin: 0 0 12px; font-size: 14px; color: #bfb7ab; overflow-wrap: anywhere; }
.api-grid dt code.inline-code {
  border-color: rgba(209, 162, 90, .58);
  background: rgba(22, 19, 15, .94);
  color: var(--gold-bright);
  font-weight: 700;
}
.api-grid dd code.inline-code {
  padding: 0 .08em;
  border: 0;
  background: transparent;
  color: #ddd0bc;
  font-size: .92em;
  font-weight: 600;
}
.changelog-content {
  max-width: 900px;
  padding: clamp(52px, 6vw, 76px) clamp(32px, 8vw, 130px);
}
.changelog-content h2 {
  margin: 0;
  padding-top: clamp(48px, 6vw, 72px);
  border-top: 1px solid var(--line);
  font-size: clamp(30px, 3vw, 44px);
  font-family: Cinzel, serif;
  line-height: 1.3;
}
.changelog-content h2:first-child { padding-top: 0; border-top: 0; }
.changelog-content h2:not(:first-child) { margin-top: clamp(48px, 6vw, 72px); }
.changelog-content h3 {
  margin: 28px 0 10px;
  color: var(--gold-bright);
  font: 600 17px Cinzel, serif;
}
.changelog-content p,
.changelog-content li { color: #c5bdb1; }
.changelog-content ul {
  margin: 0;
  padding-left: 22px;
}
.changelog-content li { margin-bottom: 10px; padding-left: 4px; }
.changelog-content li::marker { color: var(--gold); }
.changelog-content code {
  padding: .08em .38em;
  border: 1px solid rgba(169, 126, 59, .42);
  border-radius: 3px;
  background: rgba(22, 19, 15, .9);
  color: #d3a560;
  font-size: 13px;
  font-weight: 600;
}
footer { padding: 45px clamp(24px, 9vw, 150px); color: #7d7468; font: 11px "Source Code Pro", monospace; text-transform: uppercase; }
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .65s ease, transform .65s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-video { display: none; }
  .copy-toast, .header-toggle-icon, .reveal { transition: none; }
}

@media (max-width: 850px) {
  .sidebar {
    position: sticky;
    inset: 0 0 auto;
    width: auto;
    height: auto;
    max-height: 100vh;
    max-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr auto auto;
    column-gap: 10px;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid #715126;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  }
  .sidebar-has-search { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .docs-search-trigger { grid-column: 2; grid-row: 1; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; margin-top: 0; padding: 0; }
  .docs-search-trigger span, .docs-search-trigger kbd { display: none; }
  .sidebar-has-search .sidebar-support { grid-column: 3; }
  .sidebar-support { grid-column: 2; grid-row: 1; margin-top: 0; }
  .sidebar-support .btn-container { min-width: 0; }
  .sidebar-support .kofi-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 0;
    width: 44px;
    height: 44px;
    padding: 0 !important;
  }
  .sidebar-support .kofi-button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
  .sidebar-support .kofitext { font-size: 0 !important; letter-spacing: 0 !important; line-height: 1 !important; }
  .sidebar-support .kofiimg { margin: 0 !important; }
  .header-toggle {
    grid-column: 3;
    grid-row: 1;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border: 1px solid rgba(169, 126, 59, .55);
    border-radius: 2px;
    background: linear-gradient(#302b24, #211e19);
    color: #cec6ba;
    font: 600 11px "Source Code Pro", monospace;
    text-transform: uppercase;
    letter-spacing: .08em;
    cursor: pointer;
  }
  .sidebar-has-search .header-toggle { grid-column: 4; }
  .header-toggle:hover { border-color: var(--gold-bright); color: var(--gold-bright); }
  .header-toggle:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
  .header-toggle-icon {
    width: 8px;
    height: 8px;
    border-right: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform .2s ease;
  }
  .header-toggle[aria-expanded="true"] .header-toggle-icon {
    transform: translateY(2px) rotate(225deg);
  }
  .sidebar nav {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    margin-top: 14px;
    overscroll-behavior: contain;
  }
  .sidebar.nav-open nav { display: grid; }
  .sidebar nav a { min-height: 44px; padding: 10px 8px; }
  .sidebar nav a.editor-nav-link, .sidebar nav a[href="#visual-editor"] { display: none; }
  main { margin-left: 0; }
  h2[id] { scroll-margin-top: 100px; }
  .hero { min-height: clamp(480px, 70vh, 680px); padding: clamp(72px, 12vw, 110px) clamp(24px, 8vw, 68px) clamp(72px, 10vw, 96px); }
  .doc-section { grid-template-columns: 1fr; padding: clamp(64px, 10vw, 88px) clamp(24px, 7vw, 56px); }
}

@media (max-width: 520px) {
  .sidebar { padding: 12px 16px; }
  .brand { font-size: 18px; }
  .brand small { font-size: 9px; }
  .sidebar nav { grid-template-columns: 1fr 1fr; }
  .hero {
    min-height: clamp(430px, 72vh, 580px);
    padding: clamp(58px, 16vw, 78px) 20px clamp(62px, 16vw, 82px);
  }
  .hero h1 { font-size: clamp(40px, 14vw, 56px); }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 16px; }
  .button { width: 100%; max-width: 260px; text-align: center; }
  .doc-section { padding: 58px 18px; }
  .doc-section h2 { font-size: clamp(30px, 10vw, 42px); }
  .doc-section p { font-size: 16px; }
  .doc-section table { table-layout: fixed; font-size: 13px; }
  .doc-section th, .doc-section td { padding: 11px 10px; overflow-wrap: anywhere; }
  .api-grid article, .sprite-name-picker { padding: 16px; }
  .overhead-bar-preview { padding: 16px; }
  .overhead-bar-preview-art { transform: scale(2); }
  .note { padding: 15px 16px; }
  pre { padding: 50px 16px 18px; font-size: 12px; }
  .sprite-name-tools { align-items: stretch; flex-direction: column; }
  #sprite-name-filter { width: 100%; min-height: 44px; }
  .sprite-name-grid { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
  .sprite-name-grid button { min-height: 44px; }
  footer { padding: 36px 18px; }
}

@media (max-width: 360px) {
  .sidebar nav { grid-template-columns: 1fr; }
  .header-toggle span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .header-toggle { width: 44px; justify-content: center; padding: 0; }
  .doc-section { padding-inline: 14px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hero { min-height: 420px; padding-block: 56px; }
}
