/* Public site: the Inventory look. Products sit in square slots like items in a
   Roblox inventory. Builds on base.css (fonts, reset, .wrap, .sr-only, .lockup);
   tokens and rules are in DESIGN.md. */

/* ---------- Tokens ---------- */

:root {
  --page: #ffffff;
  --frost: #eef2f7;
  --line: #d6dee8;
  --field-line: #8592a8;
  --ink: #0f1b2d;
  --ink-2: #536179;
  --select: #1f7ae0;
  --slot-shade: rgba(15, 27, 45, 0.06);
  --online: #23915f;
  --button-hover: #26354b;
  --buy-line: #0f1b2d;

  /* The inspect panel is navy on the light theme. */
  --inspect-bg: #0f1b2d;
  --inspect-border: #0f1b2d;
  --inspect-ink: #eef2f7;
  --inspect-ink-2: #9fb0c8;
  --inspect-line: #5a6e8c;
  --inspect-select: #4da3ff;
  --inspect-well: #1a2a42;

  /* Code panels look the same in both themes. */
  --code-bg: #0a1422;
  --code-ink: #eef2f7;
  --code-dim: #8c9bb3;
  --code-ok: #7fd1b9;
  --code-err: #f2a0a8;

  /* base.css names, so md.css and shared rules follow this palette. */
  --surface-100: var(--page);
  --surface-200: var(--frost);
  --rule: var(--line);
  --ink-muted: var(--ink-2);
  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-slot: 14px;
  --radius-panel: 20px;
  --radius-button: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0f1b2d;
    --frost: #1a2a42;
    --line: #2a3d5a;
    --field-line: #5a6e8c;
    --ink: #eef2f7;
    --ink-2: #9fb0c8;
    --select: #4da3ff;
    --slot-shade: rgba(0, 0, 0, 0.18);
    --online: #3dbe84;
    --button-hover: #c9d3e0;
    --buy-line: #5a6e8c;
    --inspect-bg: #1a2a42;
    --inspect-border: #2a3d5a;
    --inspect-well: #0f1b2d;
    --surface-100: #0f1b2d;
    --surface-200: #1a2a42;
    --rule: #2a3d5a;
    --ink-muted: #9fb0c8;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #0f1b2d;
  --frost: #1a2a42;
  --line: #2a3d5a;
  --field-line: #5a6e8c;
  --ink: #eef2f7;
  --ink-2: #9fb0c8;
  --select: #4da3ff;
  --slot-shade: rgba(0, 0, 0, 0.18);
  --online: #3dbe84;
  --button-hover: #c9d3e0;
  --buy-line: #5a6e8c;
  --inspect-bg: #1a2a42;
  --inspect-border: #2a3d5a;
  --inspect-well: #0f1b2d;
  --surface-100: #0f1b2d;
  --surface-200: #1a2a42;
  --rule: #2a3d5a;
  --ink-muted: #9fb0c8;
  color-scheme: dark;
}

/* ---------- Base ---------- */

html { background: var(--page); scrollbar-color: var(--field-line) var(--page); }
body {
  display: flex; flex-direction: column; min-height: 100vh;
  background: var(--page); color: var(--ink);
  font-family: var(--font-sans); font-size: 17px; line-height: 1.5;
  caret-color: var(--ink);
}
main { flex: 1; }
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 800; color: var(--ink); }
::selection { background: var(--ink); color: var(--page); }
a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
p { text-wrap: pretty; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--select); outline-offset: 3px; }
section[id], [role="tabpanel"] { scroll-margin-top: 24px; }

/* Wide, heavy Archivo for headings. */
.headline { font-weight: 800; font-stretch: 112%; letter-spacing: -0.015em; line-height: 1.04; text-wrap: balance; }
.display { font-weight: 800; font-stretch: 125%; letter-spacing: -0.015em; line-height: 1.02; text-wrap: balance; overflow-wrap: break-word; hyphens: auto; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  padding: 12px 16px; border-radius: var(--radius-button);
  background: var(--ink); color: var(--page); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

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

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 76px; }
.site-header .lockup .mark, .site-footer .lockup .mark { width: 30px; height: 30px; }
.lockup { border-radius: 4px; }
.lockup .wordmark { font-size: 19px; }
.header-menu { display: flex; flex: 1; align-items: center; gap: 28px; min-width: 0; }
.header-search { flex: 0 1 340px; margin-left: 24px; }
.site-nav { display: flex; gap: 28px; margin-left: auto; }
.site-nav a { padding: 8px 0; color: var(--ink); font-size: 16px; font-weight: 500; text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline 2px; text-underline-offset: 8px; }
.header-tools { display: flex; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-button); background: var(--page); color: var(--ink);
}
.icon-btn:hover { border-color: var(--field-line); }
.icon-btn.menu-toggle, html:not(.js) .icon-btn.theme-toggle { display: none; }

@media (max-width: 759px) {
  .header-inner { flex-wrap: wrap; gap: 8px; min-height: 64px; }
  .site-header .lockup { margin-right: auto; }
  .site-header .lockup .mark { width: 26px; height: 26px; }
  .lockup .wordmark { font-size: 17px; }
  .header-menu { order: 3; flex: 1 1 100%; flex-direction: column; align-items: stretch; gap: 8px; padding: 4px 0 8px; }
  .header-search { flex: none; margin: 0; }
  .site-nav { flex-direction: column; gap: 0; margin: 0; }
  .site-nav a { padding: 12px 0; border-top: 1px solid var(--line); }
  .js .icon-btn.menu-toggle { display: inline-grid; }
  .js .header-menu:not(.open) { display: none; }
}

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); }
.footer-grid { display: flex; flex-wrap: wrap; gap: 40px 72px; padding-top: 48px; padding-bottom: 32px; }
.footer-brand { flex: 1 1 320px; }
.site-footer .lockup .mark { width: 26px; height: 26px; }
.site-footer .lockup .wordmark { font-size: 17px; }
.footer-brand p { max-width: 24em; margin-top: 14px; color: var(--ink-2); font-size: 15px; line-height: 22px; }
.footer-col h2 { margin-bottom: 8px; color: var(--ink-2); font-size: 14px; font-weight: 600; line-height: 20px; }
.footer-col li { font-size: 15px; line-height: 30px; }
.footer-col a { color: var(--ink); text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-base { padding: 20px 0 32px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; line-height: 20px; }
@media (max-width: 559px) {
  .footer-grid { gap: 28px 48px; padding-top: 32px; }
  .footer-brand { flex-basis: 100%; }
}

/* ---------- Buttons, fields, tags, chips ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border: 1px solid transparent; border-radius: var(--radius-button);
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.1; text-align: center; text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--ink); color: var(--page); }
.button-primary:hover { background: var(--button-hover); }
.button-secondary { border-color: var(--field-line); background: var(--page); color: var(--ink); }
.button-secondary:hover { border-color: var(--ink); }

.field {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  border: 1px solid var(--field-line); border-radius: var(--radius-button); background: var(--page); color: var(--ink-2);
  cursor: text;
}
.field:hover { border-color: var(--ink); }
.field:focus-within { outline: 2px solid var(--select); outline-offset: 3px; }
.field input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none;
  color: var(--ink); font: inherit; font-size: 16px; outline: none;
}
.field input::placeholder { color: var(--ink-2); opacity: 1; }
.search-icon { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.tag {
  display: inline-block; padding: 5px 7px; border-radius: 6px;
  background: var(--page); color: var(--ink);
  font-size: 12px; font-weight: 600; font-stretch: 100%; line-height: 1; letter-spacing: 0; white-space: nowrap;
}

.count {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--frost); color: var(--ink);
  font-size: 13px; font-weight: 600; font-stretch: 100%; line-height: 1; letter-spacing: 0;
  font-variant-numeric: tabular-nums; vertical-align: middle;
}

.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--page); color: var(--ink);
  font-size: 15px; font-weight: 500; line-height: 1.2; text-decoration: none;
}
.chip-count { color: var(--ink-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip:hover { outline: 2px solid var(--select); outline-offset: 3px; }
.chip-x { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

/* ---------- Slots ---------- */

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 32px 24px; }
.slot-item[hidden] { display: none; }
.item { position: relative; display: block; color: var(--ink); text-decoration: none; }
.item:focus-visible { outline: none; }

.slot {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-slot); background: var(--frost);
  container-type: inline-size;
}
/* The inset shade sits over covers too, so every slot reads as a pressed cell. */
.slot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 -4px 0 var(--slot-shade); pointer-events: none;
}
.item:hover .slot, .item:focus-visible .slot, .is-current .slot { outline: 2px solid var(--select); outline-offset: 3px; }
.slot-grid:has(.item:hover, .item:focus-visible) .is-current > .item:not(:hover, :focus-visible) .slot { outline-color: transparent; }
.item:hover .item-name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

.item > .tag { position: absolute; top: 9px; left: 9px; z-index: 1; max-width: calc(100% - 18px); overflow: hidden; text-overflow: ellipsis; }
.slot-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slot-mark { width: 54%; height: auto; color: var(--ink); }
.slot-icon { width: 54%; height: auto; aspect-ratio: 1; border-radius: 12px; object-fit: cover; }
.slot-type { width: 40%; height: auto; color: var(--ink); }
.slot-letter { color: var(--ink); font-size: 40cqi; font-weight: 800; font-stretch: 125%; line-height: 1; }

.item-name { display: block; margin-top: 12px; font-size: 15px; font-weight: 600; line-height: 20px; overflow-wrap: anywhere; }
.item-sub, .item-price, .item-note { display: block; color: var(--ink-2); font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.item-price { font-variant-numeric: tabular-nums; }
.item-note { font-size: 13px; line-height: 18px; }

/* ---------- Code panel ---------- */

.code-panel { min-width: 0; border-radius: 12px; background: var(--code-bg); color: var(--code-ink); }
.code-panel pre {
  margin: 0; padding: 20px 22px; overflow-x: auto; border-radius: inherit;
  font-family: var(--font-mono); font-size: 13px; line-height: 22px; white-space: pre;
  scrollbar-color: #2a3d5a transparent;
}
.code-panel pre:focus-visible { outline-color: var(--inspect-select); }
.c-dim { color: var(--code-dim); }
.c-ok { color: var(--code-ok); }
.c-err { color: var(--code-err); }

/* ---------- Highlights and buy buttons ---------- */

.ticks li { position: relative; padding-left: 26px; font-size: 15px; line-height: 22px; }
.ticks li + li { margin-top: 8px; }
.tick { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.buy-list { display: flex; flex-direction: column; gap: 10px; }
.buy {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 60px; padding: 0 20px; border: 2px solid var(--buy-line); border-radius: 12px;
  color: var(--ink); font-size: 17px; font-weight: 600; text-decoration: none;
}
.buy:first-child { border-color: var(--ink); background: var(--ink); color: var(--page); }
.buy:hover { outline: 2px solid var(--select); outline-offset: 3px; }
.buy-price { font-size: 22px; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Home ---------- */

.home { padding: 40px 0 80px; }
.home-title { max-width: 15em; font-size: clamp(31px, 1.4vw + 26px, 46px); }
.home-lead { max-width: 36em; margin-top: 16px; color: var(--ink-2); font-size: 18px; line-height: 28px; }
/* Slots, then the inspect panel, then the chip rows; on wide screens the panel
   moves beside the slots and the chip rows sit under them. */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; margin-top: 36px; }
.home-grid > * { min-width: 0; }
@media (min-width: 1120px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) minmax(420px, 480px); grid-template-rows: auto 1fr; gap: 48px 56px; align-items: start; }
  .home-grid > .slot-grid { grid-column: 1; grid-row: 1; }
  .home-grid > .inspect { grid-column: 2; grid-row: 1 / span 2; }
  .home-grid > .browse { grid-column: 1; grid-row: 2; }
}

.slot-all .slot { border: 2px solid var(--ink); background: var(--page); }
.slot-all .slot::after { display: none; }
.slot-all-text { display: grid; gap: 6px; padding: 12px; text-align: center; }
.slot-all-count { font-size: 21px; font-stretch: 125%; }
.slot-all-hint { color: var(--ink-2); font-size: 14px; line-height: 18px; }

.browse { display: grid; gap: 14px; padding-top: 24px; border-top: 1px solid var(--line); }
.browse-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); align-items: start; gap: 8px; }
.browse-label { padding-top: 7px; color: var(--ink-2); font-size: 15px; line-height: 22px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* The inspect panel: the selected product's details, like an item's in a game. */
.inspect {
  min-width: 0; padding: 24px;
  border: 1px solid var(--inspect-border); border-radius: var(--radius-panel);
  background: var(--inspect-bg); color: var(--inspect-ink);
}
.inspect :focus-visible { outline-color: var(--inspect-select); }
.inspect-cover { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 12px; object-fit: contain; background: var(--inspect-well); }
.inspect-art { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 12px; background: var(--inspect-well); color: var(--inspect-ink); container-type: inline-size; }
.inspect-art-mark { width: 26%; height: auto; }
.inspect-art-icon { width: 26%; height: auto; aspect-ratio: 1; border-radius: 16px; object-fit: cover; }
.inspect-art-type { width: 22%; height: auto; }
.inspect-art-letter { font-size: 22cqi; font-weight: 800; font-stretch: 125%; line-height: 1; }
.inspect .code-panel pre { padding: 16px 18px; font-size: 12.5px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.inspect-body { padding: 20px 8px 4px; }
.inspect-name { color: var(--inspect-ink); font-size: clamp(30px, 1vw + 22px, 36px); }
.inspect-name a { color: inherit; text-decoration: none; }
.inspect-name a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.inspect-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; color: var(--inspect-ink-2); font-size: 15px; line-height: 22px; }
.inspect-kind .tag { background: var(--inspect-well); color: var(--inspect-ink); }
.inspect-summary { margin-top: 10px; font-size: 16px; line-height: 24px; }
.inspect .ticks { margin-top: 14px; }
.inspect .ticks li { font-size: 14px; line-height: 20px; }
.inspect .ticks li + li { margin-top: 6px; }
.inspect .tick { top: 2px; }
.inspect .tick { color: var(--inspect-ink-2); }
.inspect-note { margin-top: 22px; color: var(--inspect-ink-2); font-size: 15px; }
.inspect-note a, .inspect-more a { color: var(--inspect-ink); }
.inspect-more { margin-top: 18px; font-size: 15px; }

.buy-panel { flex-direction: row; flex-wrap: wrap; margin-top: 20px; }
.buy-panel .buy {
  flex: 1 1 140px; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 64px; padding: 10px 16px; border-width: 1px; border-color: var(--inspect-line); color: var(--inspect-ink);
}
.buy-panel .buy:first-child { border-color: var(--inspect-ink); background: var(--inspect-ink); color: #0f1b2d; }
.buy-panel .buy:hover { outline-color: var(--inspect-select); }
.buy-panel .buy-store { font-size: 14px; font-weight: 500; line-height: 18px; }
.buy-panel .buy-price { font-size: 20px; font-weight: 700; line-height: 24px; }

@media (min-width: 720px) and (max-width: 1119px) {
  .inspect { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: stretch; }
  .inspect > .code-panel { display: flex; align-items: center; }
  .inspect > .code-panel pre { flex: 1; }
  .inspect > .inspect-cover, .inspect > .inspect-art { height: 100%; aspect-ratio: auto; }
  .inspect-body { padding: 0; }
  .home .slot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1120px) {
  .home-grid.is-few { grid-template-columns: minmax(0, 330px) minmax(0, 1fr); }
  .is-few .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .is-few .inspect { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: stretch; padding: 28px; }
  .is-few .inspect .code-panel pre { padding: 16px 14px; }
  .is-few .inspect > .code-panel { display: flex; align-items: center; }
  .is-few .inspect > .code-panel pre { flex: 1; }
  .is-few .inspect > .inspect-cover, .is-few .inspect > .inspect-art { height: 100%; aspect-ratio: auto; }
  .is-few .inspect-body { padding: 0; }
}

/* ---------- Reviews ---------- */

.reviews-section { padding-bottom: 80px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 28px; }
.section-title { font-size: clamp(26px, 0.8vw + 22px, 34px); }
.score { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--ink-2); font-size: 15px; }
.score-num { color: var(--ink); font-size: 28px; font-weight: 800; font-stretch: 112%; line-height: 1; }
.rating { display: inline-flex; gap: 3px; }
.rating i { width: 12px; height: 12px; border: 1px solid var(--field-line); border-radius: 3px; }
.rating i.on { border-color: var(--ink); background: var(--ink); }
.review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; }
.review { display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: var(--radius-panel); background: var(--frost); }
.review blockquote { font-size: 17px; line-height: 26px; }
.review-by { display: grid; gap: 2px; margin-top: auto; font-size: 15px; line-height: 22px; }
.review-by b { font-weight: 600; overflow-wrap: anywhere; }
.review-by span { color: var(--ink-2); font-size: 14px; }

/* ---------- Discord ---------- */

.discord { padding-bottom: 88px; }
/* A plain section, not a card: the code panel beside it is the only container. */
.discord-panel { display: flex; flex-wrap: wrap; gap: 32px 56px; padding-top: 56px; border-top: 1px solid var(--line); }
.discord-copy { flex: 1 1 420px; min-width: 0; }
.discord-title { font-size: clamp(26px, 0.8vw + 22px, 34px); }
.discord-text { max-width: 30em; margin-top: 14px; color: var(--ink-2); }
.discord-status { display: flex; align-items: center; gap: 10px; margin-top: 18px; color: var(--ink-2); font-size: 15px; font-variant-numeric: tabular-nums; }
.online-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--online); }
.discord-copy .button { margin-top: 24px; }
.discord-panel .code-demo { flex: 1 1 460px; align-self: center; }

/* No products yet: the headline beside the Discord card. */
.home-empty { padding: 72px 0 96px; }
.home-empty .home-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 48px 64px; }
.home-empty .home-intro { flex: 1 1 520px; min-width: 0; }
.home-empty .home-title { max-width: 11em; font-size: clamp(34px, 1.8vw + 26px, 52px); }
.home-empty .home-lead { max-width: 28em; margin-top: 20px; font-size: 19px; line-height: 30px; }
.home-actions { margin-top: 32px; }
.home-empty .discord-status { margin-top: 20px; }
.home-empty .code-demo { flex: 1 1 480px; }

@media (max-width: 559px) {
  .home { padding: 28px 0 48px; }
  .home-lead { margin-top: 12px; font-size: 16px; line-height: 24px; }
  .home-grid { gap: 40px; margin-top: 28px; }
  .home .slot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 12px; }
  .home .item-name { margin-top: 10px; font-size: 14px; line-height: 18px; }
  .home .item-price { font-size: 13px; line-height: 18px; }
  .slot { border-radius: 12px; }
  .item > .tag { top: 7px; left: 7px; max-width: calc(100% - 14px); padding: 4px 6px; border-radius: 5px; font-size: 11px; }
  .slot-all-text { padding: 8px; gap: 4px; }
  .slot-all-count { font-size: 19px; }
  .slot-all-hint { font-size: 12px; line-height: 15px; }
  .browse-row { grid-template-columns: minmax(0, 1fr); }
  .browse-label { padding-top: 0; }
  .inspect { padding: 16px; border-radius: 18px; }
  .inspect-body { padding: 20px 4px 4px; }
  .discord { padding-bottom: 56px; }
  .discord-panel { padding-top: 40px; }
  .home-empty { padding: 36px 0 56px; }
  .home-empty .home-lead { font-size: 17px; line-height: 26px; }
}

/* ---------- Products page ---------- */

.catalog { padding: 44px 0 96px; }
.catalog-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 40px; }
.catalog-title { font-size: clamp(34px, 1.2vw + 28px, 46px); }
.catalog-search { flex: 1 1 420px; max-width: 560px; height: 52px; padding: 0 16px; border-radius: 12px; }
.catalog-search .search-icon { width: 20px; height: 20px; }
.catalog-empty-lead { max-width: 30em; margin-top: 16px; color: var(--ink-2); font-size: 18px; line-height: 28px; }

/* Filters: one row each for store, type and price, in a frost panel. */
.filters-panel { margin-top: 28px; }
.filters { display: grid; gap: 14px; padding: 20px 24px; border-radius: var(--radius-panel); background: var(--frost); }
.filters-empty { padding: 0; background: none; }
.filter-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: start; gap: 8px 16px; }
.filter-label { padding-top: 7px; color: var(--ink-2); font-size: 15px; line-height: 22px; }
.filter-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-price .filter-options { flex-wrap: nowrap; align-items: flex-start; gap: 12px 32px; }
.ranges { display: flex; flex: 1; flex-wrap: wrap; gap: 12px 32px; min-width: 0; padding-top: 6px; }
.chip-check.is-empty { color: var(--ink-2); border-style: dashed; }
.filters-apply { display: flex; justify-content: flex-end; }
.js .filters-apply { display: none; }

.chip-check {
  position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--page); color: var(--ink);
  font-size: 15px; font-weight: 500; line-height: 1.2; cursor: pointer; user-select: none;
}
.chip-check input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.chip-check:hover, .chip-check:has(:focus-visible) { outline: 2px solid var(--select); outline-offset: 3px; }
.chip-check:has(:checked) { border-color: var(--ink); background: var(--ink); color: var(--page); }
.chip-check:has(:checked) .chip-count { color: inherit; opacity: 0.75; }

/* Two range inputs share one track; catalog-page.js sets --lo and --hi (0 to 1). */
.range { display: flex; flex: 0 1 380px; align-items: center; gap: 14px; min-width: 260px; }
.range-name { font-size: 15px; white-space: nowrap; }
.range-values { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.range-track { --lo: 0; --hi: 1; --thumb: 20px; position: relative; flex: 1; min-width: 120px; height: calc(var(--thumb) + 4px); }
.range-track::before, .range-track::after { content: ""; position: absolute; top: calc(50% - 1.5px); height: 3px; border-radius: 2px; }
.range-track::before { left: calc(var(--thumb) / 2); right: calc(var(--thumb) / 2); background: var(--field-line); }
.range-track::after { left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--lo)); width: calc((100% - var(--thumb)) * (var(--hi) - var(--lo))); background: var(--ink); }
.range-track input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0;
  background: none; appearance: none; pointer-events: none;
}
.range-track.lo-on-top input:first-child { z-index: 2; }
.range-track input::-webkit-slider-runnable-track { height: 100%; background: none; }
.range-track input::-moz-range-track { background: none; }
.range-track input::-webkit-slider-thumb {
  width: var(--thumb); height: var(--thumb); margin-top: 2px; border: 2px solid var(--ink); border-radius: 50%;
  background: var(--page); appearance: none; pointer-events: auto; cursor: grab;
}
.range-track input::-moz-range-thumb {
  width: calc(var(--thumb) - 4px); height: calc(var(--thumb) - 4px); border: 2px solid var(--ink); border-radius: 50%;
  background: var(--page); pointer-events: auto; cursor: grab;
}
.range-track input:focus-visible { outline: none; }
@media (pointer: coarse) { .range-track { --thumb: 28px; } }
.range-track input:hover::-webkit-slider-thumb, .range-track input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--select); outline-offset: 3px; }
.range-track input:hover::-moz-range-thumb, .range-track input:focus-visible::-moz-range-thumb { outline: 2px solid var(--select); outline-offset: 3px; }

.results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }
.results-count { color: var(--ink-2); font-size: 15px; }
.results-count:focus { outline: none; }
.results-clear { color: var(--ink); font-size: 15px; }
.results-clear[hidden] { display: none; }
.filters-open { display: none; min-height: 46px; }
.filters-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--ink); color: var(--page); font-size: 12px; font-weight: 700; line-height: 1;
}
.badge:empty { display: none; }
.sort { position: relative; display: inline-flex; align-items: center; gap: 10px; margin-left: auto; color: var(--ink-2); font-size: 15px; }
.sort::after {
  content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.sort select {
  height: 40px; padding: 0 38px 0 12px; border: 1px solid var(--field-line); border-radius: var(--radius-button);
  background: var(--page); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; appearance: none; cursor: pointer;
}
.sort select:hover { border-color: var(--ink); }
.sort select option { background: var(--page); color: var(--ink); }
.active-chips { display: none; }

@media (max-width: 999px) {
  .js .filters-panel { display: none; }
  .js .filters-open { display: inline-flex; }
  .js .active-chips:not(:empty) { display: flex; margin-top: 12px; }
}

/* Store shelves. Shelves with one or two products sit side by side. */
.shelves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px 48px; margin-top: 32px; }
.shelf { grid-column: 1 / -1; min-width: 0; }
.shelf[data-size="1"], .shelf[data-size="2"] { grid-column: auto; }
.shelf[hidden] { display: none; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 22px; }
.shelf-title { font-size: clamp(24px, 0.8vw + 20px, 30px); }
.shelf-title .count { margin-left: 6px; vertical-align: 0.2em; }
.shelf-note { color: var(--ink-2); font-size: 15px; }
.shelf-visit { display: inline-block; margin-left: auto; padding: 4px 0; color: var(--ink); font-size: 15px; font-weight: 600; }
.shelf .slot-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.shelf .item-name { font-size: 16px; line-height: 21px; }
.shelf .item-price { margin-top: 6px; color: var(--ink); font-size: 16px; font-weight: 700; line-height: 22px; }
.shelf .item-price.is-muted { color: var(--ink-2); font-size: 15px; font-weight: 500; }

.no-results { margin-top: 32px; padding: 48px 24px; border-radius: var(--radius-panel); background: var(--frost); text-align: center; }
.no-results[hidden] { display: none; }
.no-results-title { font-size: 24px; font-weight: 800; font-stretch: 112%; }
.no-results p + p { margin-top: 8px; color: var(--ink-2); }
.no-results .button { margin-top: 24px; }

/* Filters on narrow screens: catalog-page.js moves the form in here. */
.filter-sheet {
  width: min(100%, 440px); max-width: none; height: 100dvh; max-height: none; margin: 0 0 0 auto; padding: 0;
  border: 0; border-left: 1px solid var(--line); background: var(--page); color: var(--ink);
}
.filter-sheet[open] { display: flex; flex-direction: column; animation: sheet-in 0.25s cubic-bezier(0.2, 0.7, 0.2, 1); }
.filter-sheet::backdrop { background: rgba(10, 20, 34, 0.55); }
@keyframes sheet-in { from { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .filter-sheet[open] { animation: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--gutter); border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 24px; }
.sheet-body { flex: 1; padding: 20px var(--gutter) 24px; overflow-y: auto; }
.sheet-body .filters { gap: 24px; padding: 0; background: none; }
.sheet-foot { padding: 12px var(--gutter); border-top: 1px solid var(--line); }
.sheet-foot .button { width: 100%; }

/* Stacked filter rows: in the sheet, and on phones without scripts. */
.sheet-body .filter-row { grid-template-columns: minmax(0, 1fr); }
.sheet-body .filter-label { padding-top: 0; color: var(--ink); font-weight: 600; }
.sheet-body .range { display: grid; flex-basis: 100%; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; min-width: 0; }
.sheet-body .range-track { grid-column: 1 / -1; grid-row: 2; }
.sheet-body .range-values { grid-column: 2; grid-row: 1; }

@media (min-width: 720px) and (max-width: 999px) {
  .shelf .slot-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 719px) {
  .shelves { gap: 44px 14px; }
  .shelf[data-size="2"] { grid-column: 1 / -1; }
  .shelf .slot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
  .shelf[data-size="1"] .slot-grid { grid-template-columns: minmax(0, 1fr); }
  .shelf[data-size="1"] .shelf-title { font-size: 19px; }
  .shelf-visit { flex-basis: 100%; margin-left: 0; }
}

@media (max-width: 559px) {
  .catalog { padding: 24px 0 64px; }
  .catalog-head { gap: 16px; }
  .catalog-search { flex-basis: 100%; height: 50px; }
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .filter-label { padding-top: 0; }
  .range { display: grid; flex-basis: 100%; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; min-width: 0; }
  .range-track { grid-column: 1 / -1; grid-row: 2; }
  .range-values { grid-column: 2; grid-row: 1; }
  .results-bar { margin-top: 12px; }
  .js .filters-open { flex: 1 1 0; order: -2; min-width: 0; }
  .sort { flex: 1 1 0; order: -1; min-width: 0; margin-left: 0; }
  .sort select { flex: 1; width: 100%; min-width: 0; height: 46px; }
  .results-count { flex-basis: 100%; }
  .shelf .item-name { font-size: 15px; line-height: 20px; }
  .shelf .item-sub { font-size: 13px; line-height: 18px; }
  .shelf .item-price { font-size: 15px; }
  .shelf .item-note { font-size: 12px; line-height: 17px; }
}

/* ---------- Product page ---------- */

.draft-notice { padding: 12px 0; background: var(--inspect-bg); color: var(--inspect-ink); font-size: 15px; line-height: 22px; }

.p-hero { padding: 24px 0 56px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; color: var(--ink-2); font-size: 15px; line-height: 22px; }
.crumbs a { display: inline-block; padding: 2px 0; color: var(--ink-2); }
.crumbs [aria-current] { color: var(--ink); overflow-wrap: anywhere; }
.p-hero-grid { display: grid; gap: 40px; margin-top: 24px; }
.p-media, .p-info, .p-main, .p-details { min-width: 0; }
.p-details { display: grid; gap: 28px; align-content: start; margin-top: 28px; }

.p-cover {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--frost); cursor: zoom-in;
}
.p-cover img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: contain; }
.p-cover.is-fixed { aspect-ratio: var(--cover-ratio); max-height: 560px; }
.p-cover.is-fixed img { height: 100%; max-height: none; }
.p-cover:hover { outline: 2px solid var(--select); outline-offset: 3px; }
.p-media .code-panel pre { padding: 24px 26px; font-size: 14px; line-height: 23px; }

.thumb-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden;
  border: 1px solid var(--line); border-radius: 12px; background: var(--frost); color: var(--ink);
  font-size: 16px; font-weight: 700; text-decoration: none;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 -4px 0 var(--slot-shade); pointer-events: none; }
.thumb:hover, .thumb.is-current { outline: 2px solid var(--select); outline-offset: 3px; }
.thumb-more { border: 2px solid var(--ink); background: var(--page); }
.thumb-more::after { display: none; }

.p-lockup { display: flex; align-items: center; gap: 18px; }
.p-lockup-text { min-width: 0; }
.p-icon {
  display: grid; flex: none; place-items: center; width: 72px; height: 72px; overflow: hidden;
  border: 1px solid var(--inspect-border); border-radius: 16px; background: var(--inspect-bg); color: var(--inspect-ink);
}
.p-icon-mark { width: 46px; height: 46px; }
.p-icon-icon { width: 100%; height: 100%; object-fit: cover; }
.p-icon-type { width: 36px; height: 36px; }
.p-icon-letter { font-size: 36px; font-weight: 800; font-stretch: 125%; line-height: 1; }
.p-title { font-size: clamp(34px, 2.4vw + 22px, 52px); }
.p-kind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; color: var(--ink-2); font-size: 16px; line-height: 22px; }
.p-kind .tag, .p-facts .tag { background: var(--frost); }
.p-summary { max-width: 34em; margin-top: 22px; font-size: 19px; line-height: 29px; }
.buy-page { margin-top: 28px; }
.p-terms { margin-top: 12px; color: var(--ink-2); font-size: 14px; line-height: 20px; }
.p-terms a { color: var(--ink-2); }
.p-unavailable { margin-top: 28px; color: var(--ink-2); }
.p-unavailable a { color: var(--ink); }
.p-details .ticks li { font-size: 16px; line-height: 24px; }
.p-details .ticks li + li { margin-top: 10px; }
.p-details .tick { top: 4px; }

.p-facts { display: grid; grid-template-columns: 120px minmax(0, 1fr); font-size: 15px; line-height: 22px; }
.p-facts dt, .p-facts dd { padding: 10px 0; border-top: 1px solid var(--line); }
.p-facts dt { color: var(--ink-2); }
.p-facts dd { overflow-wrap: anywhere; }

@media (min-width: 960px) {
  .p-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 56px; align-items: start; }
  .no-media .p-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .no-media .p-info { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 470px); gap: 56px; align-items: start; }
  .no-media .p-details { margin-top: 0; }
}

/* Tabs stay in reach while reading a long description. */
.p-tabs-bar { position: sticky; top: 0; z-index: 5; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--page); }
.tabs { display: flex; gap: 32px; overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; flex: none; align-items: center; gap: 8px; height: 52px; margin-bottom: -1px; padding: 0 4px;
  border-bottom: 3px solid transparent; color: var(--ink-2); font-size: 16px; font-weight: 600; text-decoration: none;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { border-bottom-color: var(--ink); color: var(--ink); }
.tab:focus-visible { outline-offset: -2px; }

.p-body { display: grid; gap: 48px 72px; padding-top: 48px; padding-bottom: 96px; }
.p-panels { min-width: 0; }
.p-panel:focus-visible { outline-offset: 12px; }
.panel-title { margin-bottom: 20px; font-size: 26px; font-stretch: 112%; letter-spacing: -0.01em; }
.js .has-tabs .p-panel:not(.is-active) { display: none; }
.js .has-tabs .panel-title {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.p-panel + .p-panel { margin-top: 64px; }
.js .has-tabs .p-panel + .p-panel { margin-top: 0; }

.p-ask { align-self: start; padding: 24px 26px; border-radius: var(--radius-panel); background: var(--frost); }
.p-ask-title { font-size: 17px; font-weight: 700; line-height: 1.35; }
.p-ask p { margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 23px; }
.p-ask .button { min-height: 44px; margin-top: 18px; padding: 0 18px; font-size: 15px; }
@media (min-width: 1000px) {
  .p-body { grid-template-columns: minmax(0, 1fr) 340px; }
  .p-ask { position: sticky; top: 76px; }
}

.empty-note { max-width: 40em; color: var(--ink-2); }
.empty-note a { color: var(--ink); }

.dep-groups { display: grid; gap: 48px; max-width: 820px; }
.dep-title { font-size: 21px; font-stretch: 112%; }
.dep-lead { margin-top: 6px; color: var(--ink-2); }
.deps { margin-top: 18px; border-top: 1px solid var(--line); }
.dep { display: grid; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.dep-name { color: var(--ink); font-size: 17px; font-weight: 600; line-height: 24px; overflow-wrap: anywhere; }
.dep-note { color: var(--ink-2); }
.p-reviews-head { margin-bottom: 24px; }

.lightbox {
  width: min(1200px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--page); color: var(--ink);
}
.lightbox::backdrop { background: rgba(10, 20, 34, 0.86); }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.lb-count { color: var(--ink-2); font-size: 14px; font-variant-numeric: tabular-nums; }
.lb-buttons { display: flex; gap: 8px; }
.lb-figure { display: grid; gap: 12px; padding: 16px; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 190px); margin: 0 auto; border-radius: 12px; object-fit: contain; }
.lb-figure figcaption { color: var(--ink-2); font-size: 15px; text-align: center; }
.lb-figure figcaption:empty { display: none; }

@media (max-width: 559px) {
  .p-hero { padding: 16px 0 36px; }
  .p-hero-grid { gap: 28px; margin-top: 14px; }
  .crumbs { font-size: 14px; }
  .p-cover { border-radius: 14px; }
  .thumb-row { gap: 8px; margin-top: 10px; }
  .thumb { border-radius: 10px; font-size: 14px; }
  .thumb:hover, .thumb.is-current { outline-offset: 2px; }
  .p-lockup { align-items: flex-start; gap: 14px; }
  .p-icon { margin-top: 2px; }
  .p-icon { width: 56px; height: 56px; border-radius: 13px; }
  .p-icon-mark { width: 34px; height: 34px; }
  .p-icon-type { width: 28px; height: 28px; }
  .p-icon-letter { font-size: 28px; }
  .p-kind { font-size: 14px; }
  .p-summary { margin-top: 16px; font-size: 17px; line-height: 26px; }
  .buy-page { margin-top: 22px; }
  .buy { min-height: 56px; padding: 0 18px; font-size: 16px; }
  .buy-price { font-size: 20px; }
  .p-details { gap: 24px; margin-top: 24px; }
  .p-details .ticks li { font-size: 15px; line-height: 22px; }
  .p-facts { grid-template-columns: 96px minmax(0, 1fr); }
  .tabs { gap: 24px; }
  .tab { height: 48px; font-size: 15px; }
  .p-body { gap: 40px; padding-top: 28px; padding-bottom: 56px; }
  .md { font-size: 16px; line-height: 26px; }
}

/* ---------- Legal pages ---------- */

.legal { padding: 44px 0 96px; }
.legal-head { padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.legal-title { max-width: 20em; font-size: clamp(32px, 1.4vw + 26px, 46px); }
.legal-effective { margin-top: 12px; color: var(--ink-2); font-size: 15px; }
.legal-grid { display: grid; gap: 40px; margin-top: 40px; }
.legal-toc { padding: 22px 24px; border-radius: var(--radius-panel); background: var(--frost); }
.legal-toc-title { color: var(--ink-2); font-size: 14px; font-weight: 600; line-height: 20px; }
.legal-related-title { margin-top: 24px; }
.legal-toc-list, .legal-related { margin-top: 8px; }
.legal-toc-list li + li, .legal-related li + li { border-top: 1px solid var(--line); }
.legal-toc-list a, .legal-related a { display: block; padding: 8px 0; color: var(--ink); font-size: 15px; line-height: 21px; text-decoration: none; }
.legal-toc-list a:hover, .legal-related a:hover { text-decoration: underline; }
.legal-body h2 { scroll-margin-top: 24px; }
@media (min-width: 1000px) {
  .legal-grid { grid-template-columns: 280px minmax(0, 1fr); gap: 80px; margin-top: 48px; }
  .legal-toc { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; }
}
@media (max-width: 559px) {
  .legal { padding: 28px 0 64px; }
  .legal-grid { gap: 32px; margin-top: 28px; }
}

/* ---------- 404 ---------- */

.header-tools { margin-left: auto; }
.not-found { display: grid; align-content: center; padding: 72px 0 96px; }
.not-found-title { max-width: 14em; font-size: clamp(32px, 1.8vw + 24px, 52px); }
.not-found-lead { max-width: 32em; margin-top: 16px; color: var(--ink-2); font-size: 18px; line-height: 28px; }
.not-found-search { display: flex; flex-wrap: wrap; gap: 12px; max-width: 520px; margin-top: 32px; }
.not-found-search .field { flex: 1 1 260px; height: 48px; }
.not-found-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; font-weight: 600; }
.not-found-links a { color: var(--ink); }

/* ---------- Critique fixes: needs line, empty results, phones ---------- */

.p-needs { margin-top: 24px; padding: 12px 16px; border-radius: 12px; background: var(--frost); font-size: 15px; line-height: 22px; }
.p-needs a { color: var(--ink); font-weight: 600; }
.p-needs + .buy-list { margin-top: 12px; }
.no-results-ask { margin-top: 20px; font-size: 15px; }
.no-results-ask a { color: var(--ink); }
@media (min-width: 960px) {
  .p-media { position: sticky; top: 24px; }
}
@media (max-width: 559px) {
  .filter-price .filter-options { flex-wrap: wrap; }
  .ranges { flex-basis: 100%; padding-top: 0; }
  .code-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media (max-width: 359px) {
  .js .filters-open, .sort { flex-basis: 100%; }
}

/* ---------- Code demo (home) ----------
   An editor panel that types example Luau. Every file's code is in the page;
   code-demo.js clips characters per line (clip-path in ch units) and moves the
   caret. Without scripts, or with reduced motion, the code simply shows. */

.code-demo { min-width: 0; margin: 0; }
.code-demo-bar {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px 0 12px;
  border: 1px solid var(--inspect-border); border-bottom-color: var(--inspect-well);
  border-radius: var(--radius-panel) var(--radius-panel) 0 0; background: var(--code-bg);
}
.code-tabs { display: flex; flex: 1; min-width: 0; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.code-tab {
  flex: none; height: 38px; margin-bottom: -1px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent;
  background: none; color: var(--code-dim); font-size: 13px; font-weight: 600; cursor: pointer;
}
.code-tab:hover { color: var(--code-ink); }
.code-tab[aria-selected="true"] { border-bottom-color: var(--code-ink); color: var(--code-ink); }
.code-tab-ext { font-weight: 400; }
.code-demo :focus-visible { outline-color: var(--inspect-select); }
.code-tab:focus-visible { outline-offset: -2px; }
.code-demo-pause {
  display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; margin-bottom: 6px;
  border: 1px solid var(--inspect-line); border-radius: 8px; background: none; color: var(--code-ink); cursor: pointer;
}
.code-demo-pause:hover { border-color: var(--code-ink); }
.code-demo-pause svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.code-demo-pause .i-play { fill: currentColor; stroke: none; }
.code-demo-pause .i-play, .code-demo-pause[aria-pressed="true"] .i-pause { display: none; }
.code-demo-pause[aria-pressed="true"] .i-play { display: block; }
.is-still .code-demo-pause, html:not(.js) .code-demo-pause, html:not(.js) .code-tab:not(:first-child) { display: none; }

/* All files share one cell, so the panel keeps the tallest file's height. */
.code-files { display: grid; border: 1px solid var(--inspect-border); border-top: 0; border-radius: 0 0 var(--radius-panel) var(--radius-panel); background: var(--code-bg); }
.code-file { grid-area: 1 / 1; min-width: 0; visibility: hidden; }
.code-file.is-active { visibility: visible; }
.code-lines {
  --lh: 20px; --pad-top: 18px; --pad-x: 20px; --gutter: calc(2ch + 14px);
  position: relative; margin: 0; padding: var(--pad-top) var(--pad-x) 10px; overflow: hidden;
  color: var(--code-ink); font-family: var(--font-mono); font-size: 13px; line-height: var(--lh); white-space: pre;
}
.cl { display: block; }
.ln { display: inline-block; width: 2ch; margin-right: 14px; color: var(--code-dim); text-align: right; user-select: none; }
.cl-text { display: inline-block; min-height: var(--lh); vertical-align: top; }
.t-k { font-weight: 700; }
.t-s { color: var(--code-ok); }
.t-c { color: var(--code-dim); }
.t-n { color: var(--code-err); }
.is-typing .cl:not(.is-done):not(.is-current) .cl-text { clip-path: inset(0 100% 0 0); }
.is-typing .cl:not(.is-done):not(.is-current) .ln { visibility: hidden; }
.is-typing .cl.is-current .cl-text { clip-path: inset(0 calc(100% - var(--shown, 0) * 1ch) 0 0); }
.code-caret {
  position: absolute; left: calc(var(--pad-x) + var(--gutter) + var(--cx, 0) * 1ch); top: calc(var(--pad-top) + var(--cy, 0) * var(--lh) + 3px);
  display: none; width: 2px; height: calc(var(--lh) - 6px); background: var(--code-ink);
}
.is-typing .code-file.is-active:not(.is-out) .code-caret { display: block; animation: caret-blink 1.06s steps(1) infinite; }
.is-paused .code-caret { animation: none; }
@keyframes caret-blink { 50% { opacity: 0; } }

.code-out {
  display: flex; gap: 12px; align-items: baseline; margin: 0; padding: 10px var(--pad-x, 20px) 16px;
  border-top: 1px solid var(--inspect-well); font-family: var(--font-mono); font-size: 12.5px; line-height: 20px;
}
.code-out-label { flex: none; color: var(--code-dim); font-family: var(--font-sans); font-size: 12px; font-weight: 600; }
.t-print { color: var(--code-ok); }
.t-warn { color: var(--code-err); }
.code-out > :last-child { transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.is-typing .code-file:not(.is-out) .code-out > :last-child { opacity: 0; }
.code-demo-note { margin-top: 10px; color: var(--ink-2); font-size: 13px; line-height: 18px; }

@media (max-width: 559px) {
  .code-lines { --lh: 18px; --pad-top: 14px; --pad-x: 12px; --gutter: 0px; font-size: 11px; }
  .ln { display: none; }
  .code-out { padding: 8px 12px 12px; font-size: 11px; }
  .code-tab-ext { display: none; }
}
