/* Sprite gallery (docs/sprites/index.html, generated by scripts/build-sprites.mjs).
   Builds on ../style.css: same tokens, pixel frames and hard shadows. */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden], .empty { display: none !important; }
.spr { --check-a: #ffffff; --check-b: #e3eadb; }
@media (prefers-color-scheme: dark) { .spr { --check-a: #1a2e20; --check-b: #24402c; } }

/* ---------- Header ---------- */
.spr-top {
  background:
    linear-gradient(var(--grid) 2px, transparent 2px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 2px, transparent 2px) 0 0 / 32px 32px,
    var(--bg-hero);
}
.spr-top::after { content: ""; display: block; height: 24px; background: var(--snake-h) 0 0 / 32px 24px; image-rendering: pixelated; }
.toplinks { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.spr-hero { display: grid; gap: 22px 48px; grid-template-columns: minmax(0, 1fr); padding-top: 18px; padding-bottom: 30px; align-items: start; }
@media (min-width: 960px) { .spr-hero { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); } }
.spr-hero h1 { font-size: clamp(32px, 4.6vw, 50px); margin-bottom: 14px; }
.spr-hero .lead { max-width: 60ch; margin-bottom: 10px; font-size: clamp(16px, 1.8vw, 18px); }
.usage .codeblock { margin: 0 8px 14px 0; font-size: 13.5px; padding: 14px 16px; box-shadow: 6px 6px 0 var(--drop); }
.codeblock .n { color: #f6a96b; }
.howto { margin: 0; padding-left: 20px; font-size: 15px; color: var(--muted); }
.howto li { margin-bottom: 6px; }

/* ---------- Search bar and game type chips (sticky) ---------- */
.searchbar { position: sticky; top: 0; z-index: 12; background: var(--bg); border-bottom: var(--b) solid var(--frame); }
.sb-inner { display: flex; align-items: center; gap: 12px; padding-top: 8px; padding-bottom: 4px; }
#q {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; font: 16px var(--mono); color: var(--fg); background: var(--surface);
  border: var(--b) solid var(--frame); border-radius: 0; box-shadow: 4px 4px 0 var(--drop); -webkit-appearance: none; appearance: none;
}
#q:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.qn { flex: none; font: 700 13px var(--mono); color: var(--muted); }
.chips { position: static; border: 0; background: none; }
.chips-inner { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-top: 6px; padding-bottom: 8px; }
.chips-inner::-webkit-scrollbar { display: none; }
.chips a { flex: none; min-height: 36px; padding: 0 10px; font-size: 13.5px; color: var(--fg); background: var(--surface); border: 2px solid var(--line); }
@media (min-width: 900px) { .chips-inner { flex-wrap: wrap; } }
.chips a:hover { background: var(--accent-soft); }
.chips a[aria-current="true"] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--s-ink); }
body.searching .chips a[aria-current="true"] { background: var(--surface); color: var(--fg); border-color: var(--line); }

/* ---------- Sections ---------- */
main#content { scroll-margin-top: 120px; }
.tip { margin: 22px 0 0; font-size: 14.5px; color: var(--muted); }
.none { margin: 28px 0 0; padding: 14px 16px; border: var(--b) dashed var(--line); color: var(--muted); }
.gt { padding-top: 48px; scroll-margin-top: 120px; }
.gt h2 { margin-bottom: 8px; }
.hint { color: var(--muted); max-width: 75ch; margin-bottom: 8px; }
.packs { display: block; font-size: 14px; }
.packs code { font-size: 12.5px; }
.sub { margin: 24px 0 12px; font: 700 12.5px var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.sub::after { content: ""; flex: 1; border-top: var(--b) dotted var(--line); }
.pk { margin: 18px 0 10px; font: 700 15px var(--mono); }
.pk code { font-size: 12.5px; font-weight: 400; margin-left: 4px; }
.see { margin: 14px 0 0; font-size: 15px; color: var(--muted); }
.gen { margin-top: 64px; padding: 14px 16px; font-size: 14.5px; color: var(--muted); border: var(--b) dashed var(--line); }
body.searching .tip, body.searching .hint, body.searching .see, body.searching .gen { display: none; }
body.searching .gt { padding-top: 20px; }
body.searching .gt .kicker, body.searching .sub { display: none; }
body.searching .gt h2 { font-size: 22px; margin-bottom: 0; }
body.searching .pk { margin-top: 10px; }

/* ---------- Tiles ---------- */
.tiles { list-style: none; margin: 0 6px 6px 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.t { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 2px solid var(--line); }
.t:hover, .t:focus-within { border-color: var(--frame); box-shadow: 4px 4px 0 var(--drop); }
.pv {
  display: grid; place-items: center; height: 104px; padding: 8px; border: 0; cursor: zoom-in; width: 100%;
  background: repeating-conic-gradient(var(--check-b) 0 25%, var(--check-a) 0 50%) 0 0 / 16px 16px;
}
.pv img { max-width: 100%; height: auto; }
.pv:focus-visible { outline-offset: -3px; }
.nm {
  display: block; width: 100%; margin: 0; padding: 6px 8px 0; border: 0; background: none; text-align: left; cursor: copy;
  font: 700 12.5px/1.35 var(--mono); color: var(--fg); overflow-wrap: anywhere;
}
.nm:hover { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.sz { display: block; padding: 2px 8px 7px; font: 11.5px var(--mono); color: var(--muted); }
.an .pv { position: relative; }
.an .pv::after { content: "▶"; position: absolute; top: 4px; right: 4px; padding: 1px 4px; font-size: 9px; line-height: 1.4; color: var(--on-accent); background: var(--s-light); }

/* ---------- Sounds ---------- */
.sounds { list-style: none; margin: 0 6px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.snd { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 12px; padding: 8px 12px 8px 8px; background: var(--surface); border: 2px solid var(--line); }
.snd .nm { padding: 0; font-size: 13.5px; }
.snd .sd { grid-column: 2; font-size: 14px; color: var(--muted); }
.snd .sz { display: inline; padding: 0 0 0 4px; }
.play { grid-row: 1 / span 2; width: 44px; height: 44px; border: var(--b) solid var(--frame); background: var(--accent-soft); cursor: pointer; position: relative; }
.play::before { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 14px; background: var(--fg); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.play.on { background: var(--accent-fill); }
.play.on::before { width: 12px; height: 12px; clip-path: none; }

/* ---------- Detail view ---------- */
#detail {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 16px 18px 18px; overflow-y: auto;
  color: var(--fg); background: var(--surface); border: var(--b) solid var(--frame); box-shadow: 8px 8px 0 var(--drop);
}
#detail::backdrop { background: rgb(5 12 7 / .55); }
.d-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
#d-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; background: none; padding: 0; }
.x { flex: none; width: 44px; height: 44px; font-size: 18px; color: var(--fg); background: var(--surface-2); border: 2px solid var(--line); cursor: pointer; }
.stage { display: grid; place-items: center; min-height: 240px; padding: 12px; border: 2px solid var(--line); }
.stage[data-bg="check"] { background: repeating-conic-gradient(var(--check-b) 0 25%, var(--check-a) 0 50%) 0 0 / 20px 20px; }
.stage[data-bg="light"] { background: #f4f6ef; }
.stage[data-bg="dark"] { background: #1a1f24; }
.stage img { max-width: 100%; height: auto; }
.bgs { display: flex; gap: 6px; margin: 8px 0 10px; }
.bgs button, .tag-b { min-height: 34px; padding: 0 10px; font: 700 12.5px var(--mono); color: var(--fg); background: var(--surface); border: 2px solid var(--line); cursor: pointer; }
.bgs button[aria-pressed="true"] { background: var(--accent-fill); color: var(--on-accent); border-color: var(--s-ink); }
.d-text { margin: 0 0 2px; }
.d-meta { margin: 0 0 10px; font: 12.5px var(--mono); color: var(--muted); }
.d-frames { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fr { display: grid; justify-items: center; gap: 2px; min-width: 52px; padding: 4px; border: 2px solid var(--line); cursor: copy; background: repeating-conic-gradient(var(--check-b) 0 25%, var(--check-a) 0 50%) 0 0 / 10px 10px; }
.fr img { height: auto; }
.fr code { font-size: 11px; padding: 0 3px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag-b { min-height: 30px; font-weight: 400; color: var(--muted); }
#detail .codeblock { margin: 0 8px 14px 0; font-size: 13px; padding: 12px 14px; box-shadow: 5px 5px 0 var(--drop); white-space: pre; }
.d-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.d-btns .btn { cursor: pointer; border: 0; font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: 20px; z-index: 40; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 10px 16px; font: 700 14px var(--mono); overflow-wrap: anywhere; color: var(--on-accent); background: var(--s-light); border: var(--b) solid var(--s-ink); box-shadow: 4px 4px 0 var(--s-ink); }

@media (max-width: 560px) {
  .toplinks .gh-small { padding: 0 10px; font-size: 14px; }
  .tiles { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .pv { height: 96px; }
  .nm { font-size: 12px; }
  .usage .codeblock { font-size: 12.5px; }
  .stage { min-height: 180px; }
  #detail { padding: 12px 14px 14px; }
}
