:root {
  --bg: #17111f;
  --raise: #221a2c;
  --line: #352944;
  --ink: #f0e9f7;
  --muted: #a99bbb;
  --amethyst: #b57cff;
  --amethyst-ink: #d4b3ff;
  --ice-ink: #a8d6f0;
  --lantern: #ffc46b;
  --lantern-deep: #c98a2a;
  --lantern-light: #ffe2ad;
  --on-lantern: #2a1704;
  --shadow: #0c0812;
  --pixel: "Pixelify Sans", ui-monospace, monospace;
  --text: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--amethyst-ink); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible { outline: 2px solid var(--lantern); outline-offset: 2px; }

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.9em;
  background: #ffffff12;
  padding: 1px 5px;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page { max-width: 54rem; margin: 0 auto; padding: 0 16px; }

/* ---- Header ---- */

.hero { padding-top: 72px; padding-bottom: 44px; }
#wordmark { display: block; max-width: 100%; image-rendering: pixelated; }
.tagline { font-size: 1.3125rem; line-height: 1.4; margin: 28px 0 0; max-width: 44ch; }
.assurance { color: var(--muted); margin: 6px 0 0; max-width: 52ch; }

.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.links a {
  font: 500 1rem var(--pixel);
  color: var(--ink);
  text-decoration: none;
  padding: 7px 14px 9px;
  border: 2px solid var(--line);
  border-radius: 3px;
}
.links a:hover { border-color: var(--amethyst); }

/* ---- Toolbar ---- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 6px;
}

.tabs { display: flex; gap: 2px; margin-left: -12px; }
.tabs button {
  position: relative;
  font: 600 1.0625rem var(--pixel);
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 3px;
  padding: 8px 12px 11px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { color: var(--ink); }
.tabs button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 3px;
  background: var(--amethyst);
}
.tabs .count { font-weight: 500; color: var(--muted); margin-left: 6px; }

.tools { display: flex; gap: 8px; }
.tools input,
.tools select {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 12px;
}
.tools input { width: 14rem; }
.tools input::placeholder { color: var(--muted); }

/* ---- Items ---- */

.items { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--line); }
.item { border-bottom: 1px solid var(--line); }
.item.open { background: var(--raise); }

.row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 12px;
  cursor: pointer;
}

.icon {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  image-rendering: pixelated;
  background: var(--shadow);
  box-shadow: 0 0 0 2px var(--shadow);
}

.name { margin: 0; font: 600 1.3125rem/1.25 var(--pixel); }
.toggle {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.toggle:focus-visible { outline-offset: 3px; border-radius: 2px; }
.row:hover .toggle { color: var(--amethyst-ink); }

.summary {
  margin: 4px 0 0;
  max-width: 60ch;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The full notes show below once open */
.item.open .summary { display: none; }

.facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 10px 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 0.8125rem;
  line-height: 1.5;
  padding: 1px 8px;
  border-radius: 3px;
  background: #ffffff0f;
  color: var(--ink);
}
.chip-pack { background: #b57cff26; color: var(--amethyst-ink); }
.chip-mod { background: #6aa6d026; color: var(--ice-ink); }
.chip-beta { background: #f08a6a26; color: #ffb9a3; }

.download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 1.0625rem var(--pixel);
  color: var(--on-lantern);
  background: var(--lantern);
  text-decoration: none;
  white-space: nowrap;
  padding: 10px 16px 13px;
  border-radius: 3px;
  box-shadow: inset 0 -4px 0 var(--lantern-deep), inset 0 2px 0 var(--lantern-light);
}
.download:hover { color: var(--on-lantern); background: #ffd083; }
.download:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 var(--lantern-deep), inset 0 2px 0 var(--lantern-light);
}
.download svg { width: 14px; height: 14px; flex: none; shape-rendering: crispEdges; }
.download .size { font: 400 0.8125rem var(--text); opacity: 0.75; }

/* Details open below the row */
.details-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.22s ease; }
.item.open .details-wrap { grid-template-rows: 1fr; }
.details { min-height: 0; overflow: hidden; }
.details-inner { padding: 0 12px 24px 94px; }

.shots {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.shots a { flex: none; scroll-snap-align: start; }
.shots img { display: block; height: 170px; width: auto; border-radius: 4px; background: var(--shadow); }

.desc { max-width: 62ch; }
.desc p, .desc ul, .desc ol { margin: 0 0 12px; }
.desc ul, .desc ol { padding-left: 1.3em; }
.desc h4 { font: 600 1.0625rem var(--pixel); margin: 18px 0 6px; }
.desc hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.details h4.part { font: 600 1rem var(--pixel); color: var(--muted); margin: 20px 0 6px; }
.files, .older { list-style: none; margin: 0; padding: 0; max-width: 40rem; }
.files li, .older li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 14px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.files a { overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 0.875rem; }

.link-btn {
  font: inherit;
  font-size: 0.875rem;
  color: var(--amethyst-ink);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--ink); }

.detail-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 18px; font-size: 0.9375rem; }
.detail-actions .link-btn { font-size: inherit; }

.status { padding: 40px 12px; color: var(--muted); }
.status:empty { display: none; }
.status.error { color: var(--ink); }

/* ---- Install ---- */

.install { margin-top: 80px; padding-top: 32px; border-top: 2px solid var(--line); }
.install h2 { font: 600 1.6875rem/1.2 var(--pixel); margin: 0 0 22px; }
.install-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.install h3 { font: 600 1.1875rem var(--pixel); margin: 0 0 10px; }
.install ol { margin: 0; padding-left: 1.5em; }
.install li { margin-bottom: 8px; padding-left: 4px; }
.install li::marker { color: var(--amethyst); font: 600 1rem var(--pixel); }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 20px;
  margin-top: 72px;
  margin-bottom: 40px;
  font-size: 0.875rem;
  color: var(--muted);
}

.credit { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Phones ---- */

@media (max-width: 640px) {
  .hero { padding-top: 40px; padding-bottom: 32px; }
  .tagline { font-size: 1.1875rem; margin-top: 22px; }
  .toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .tabs { min-width: 0; margin-left: -8px; overflow-x: auto; }
  .tabs button { padding-left: 8px; padding-right: 8px; }
  .tabs button[aria-pressed="true"]::after { left: 8px; right: 8px; }
  .tools input { flex: 1; min-width: 0; width: auto; }
  .row { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: start; padding: 16px 10px; }
  .icon { width: 48px; height: 48px; }
  .download { grid-column: 1 / -1; justify-content: center; }
  .details-inner { padding: 0 10px 22px; }
  .shots img { height: 130px; }
  .install-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
