/* Colors, type and shape come from heraldry (site/heraldry/, linked in index.html). */
:root { --content-width: 1400px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page-bg); color: var(--text);
  font: 15px/1.5 var(--font-body); min-height: 100vh; display: flex; flex-direction: column;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--link); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 60; padding: 8px 12px; background: var(--bg-raised); color: var(--text); }
.skip-link:focus { top: 8px; }
main { flex: 1; outline: none; }
/* The router focuses main after each view change; :focus-visible would otherwise outline the whole page. */
main:focus-visible { outline: none; }
.wrap { width: min(var(--content-width), 100% - 32px); margin-inline: auto; overflow-wrap: anywhere; }
.none { color: var(--text-faint); }
kbd { font: 12px/1 ui-monospace, monospace; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg);
  backdrop-filter: var(--topbar-filter); -webkit-backdrop-filter: var(--topbar-filter);
  border-bottom: 1px solid var(--topbar-line);
}
.topbar-inner { width: min(var(--content-width), 100% - 32px); margin-inline: auto; min-height: 56px; display: flex; align-items: center; gap: 12px; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--topbar-ink); margin-right: auto;
  font: var(--display-weight) 22px/1 var(--font-display); letter-spacing: var(--display-tracking); text-transform: var(--display-case); white-space: nowrap;
}
.brand em { font-style: normal; color: var(--topbar-accent); }
.brand-mark { width: 28px; height: 28px; }
.tabs { display: flex; flex: none; gap: 4px; background: var(--tabs-bg); padding: 4px; border-radius: var(--radius-pill); border: 1px solid var(--tabs-line); }
.tabs a { text-decoration: none; padding: 5px 14px; border-radius: var(--radius-pill); color: var(--topbar-dim); font-weight: 500; font-size: 14px; white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--tab-active-bg); color: var(--tab-active-ink); box-shadow: var(--shadow); }
.nav-count:not(:empty) { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.theme-toggle { flex: none; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--tabs-line); background: var(--tabs-bg); color: var(--topbar-dim); font-size: 13px; cursor: pointer; }
.theme-toggle:hover { color: var(--topbar-ink); }

.notice { background: color-mix(in srgb, var(--accent) 14%, var(--bg-raised)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; }
.site-notice { width: min(var(--content-width), 100% - 32px); margin: 12px auto 0; }
.site-notice[hidden] { display: none; }

/* ---------- page head & filters ---------- */
.page-head { padding: 24px 0 8px; }
.page-head h1 { margin: 0; color: var(--heading-ink); font: var(--display-weight) clamp(28px, 4vw, 40px)/1.05 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); }
.page-head p { margin: 6px 0 0; color: var(--text-dim); max-width: 75ch; }

.filters { margin: 12px 0 4px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > span, .range-label, .ranges legend { font-size: 12px; font-weight: 600; color: var(--text-dim); letter-spacing: .02em; }
.field input, .field select, .range-field input {
  height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--bg-raised); padding: 0 10px; min-width: 0; width: 100%;
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.field input:focus, .field select:focus, .range-field input:focus { border-color: var(--accent); }
.search-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.help { margin: 6px 0 0; font-size: 12px; color: var(--text-faint); }
.more { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); }
.more > summary { cursor: pointer; padding: 10px 14px; font-weight: 600; font-size: 14px; }
.more[open] > summary { border-bottom: 1px solid var(--line); }
.active-count { color: var(--accent); font-weight: 600; }
.facet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 12px 14px; }
.ranges { border: 0; margin: 0; padding: 0 14px 14px; min-width: 0; }
.ranges legend { padding: 0; margin-bottom: 6px; }
.range-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
.range-field { display: grid; grid-template-columns: minmax(64px, 1fr) 56px auto 56px; align-items: center; gap: 4px; }
.range-field input { height: 32px; padding: 0 6px; text-align: center; }

.chips-row { min-height: 0; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 0; }
.chip {
  height: 30px; padding: 0 10px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: var(--bg-raised);
  color: var(--text); cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.chip span { color: var(--text-faint); font-size: 15px; }
.chip:hover { border-color: var(--accent); }
.chip.clear-all { background: transparent; color: var(--text-dim); }
.result-count { color: var(--text-faint); font-size: 13px; margin: 10px 0 8px; }

/* ---------- the big table ---------- */
/* position: relative keeps screen-reader-only text in cells inside the scroller, so it can't widen the page. */
.table-wrap {
  position: relative; overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised);
  max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px);
}
.table-wrap.plain, .table-wrap.compare-wrap { max-height: none; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
.units th, .units td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; vertical-align: middle; }
.units thead th { position: sticky; top: 0; z-index: 2; background: var(--thead-bg); padding: 0; font-weight: 600; }
.units thead th button {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; padding: 9px 10px; cursor: pointer;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--thead-ink);
}
.units thead th.num button { justify-content: flex-end; }
.units thead th button:hover { color: var(--thead-ink); text-decoration: underline; }
.units thead th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.units thead th[aria-sort="ascending"] button, .units thead th[aria-sort="descending"] button { color: var(--thead-accent); }
.units abbr { text-decoration: none; }
.arrow { font-size: 9px; }
.units .num { text-align: right; font-variant-numeric: tabular-nums; }
.units tbody tr:nth-child(even) > * { background: var(--row-alt); }
.units tbody tr:hover > * { background: var(--row-hover); }
.units tbody tr.selected > * { background: var(--row-selected); }
.units tbody > tr > * { background: var(--bg-raised); }
/* Checkbox and name stay put while the table scrolls sideways. */
.units .col-sel { position: sticky; left: 0; z-index: 1; width: 38px; min-width: 38px; padding: 0 0 0 12px; }
.units .col-name { position: sticky; left: 38px; z-index: 1; font-weight: 500; white-space: normal; min-width: 180px; max-width: 260px; box-shadow: 1px 0 0 var(--line); }
.units thead .col-sel, .units thead .col-name { z-index: 3; }
.units .col-name a { color: var(--text); text-decoration: none; font-weight: 600; }
.units .col-name a:hover { color: var(--link); text-decoration: underline; }
.units .col-species, .units .col-class, .units .col-set { white-space: normal; min-width: 120px; max-width: 220px; }
.units input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; margin: 0; vertical-align: middle; }
.units td.empty { padding: 40px; text-align: center; color: var(--text-dim); white-space: normal; }
.qual { color: var(--text-faint); font-weight: 400; font-size: .85em; }
.gen { display: inline-flex; align-items: center; gap: 6px; }
.gen-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gen); flex: none; }
.badge { font: 700 10px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 4px 6px; border-radius: var(--radius-xs); vertical-align: 1px; }
.badge.draft, .badge.preorder { background: var(--preorder); color: var(--preorder-ink); }
.badge.unverified, .badge.announced, .badge.unknown { background: transparent; color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--line-strong); }
.badge.cancelled { background: var(--bg-sunken); color: var(--text-faint); text-decoration: line-through; box-shadow: inset 0 0 0 1px var(--line); }
/* Expected (not yet released) years in the list. */
.units td.expected { color: var(--text-dim); font-style: italic; }
.units .exp { font-size: 10px; font-style: normal; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); }
.cols { margin-top: 8px; }
.col-grid { border: 0; margin: 0; padding: 12px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; align-items: center; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.aliases { margin: 4px 0 0; font-size: 13px; color: var(--text-faint); }
.data-note { margin-top: 14px; }
.provenance { margin: 12px 0 0; font-size: 13px; color: var(--text-faint); }
.history { margin: 10px 0 0; font-size: 14px; color: var(--text-dim); }
.history ul { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 2px; }
.ability details { margin-top: 6px; font-size: 13px; }
.ability details summary { cursor: pointer; color: var(--text-dim); }
.ability details p { margin-top: 6px; }

/* ---------- compare bar ---------- */
.cmpbar { position: sticky; bottom: 0; z-index: 15; padding: 10px 16px; background: color-mix(in srgb, var(--bg-raised) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line-strong); }
.cmpbar[hidden], .cmpbar:empty { display: none; }
.cmpbar-inner { width: min(var(--content-width), 100%); margin-inline: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.cmp-count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 80px; color: var(--text-dim); }
.cmp-count b { color: var(--text); }
.cmp-actions { display: flex; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; text-decoration: none; border: 1px solid var(--accent); cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }

/* ---------- unit page ---------- */
.crumbs { padding: 18px 0 0; font-size: 14px; color: var(--text-faint); }
.crumbs a { color: var(--text-dim); }
/* Heading first in the markup (and on phones); on wide screens the card sits left of heading and details. */
.detail {
  display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); grid-template-rows: auto 1fr;
  grid-template-areas: "card head" "card main"; gap: 0 32px; padding: 16px 0 8px; align-items: start;
}
.detail > * { min-width: 0; }
.detail-head { grid-area: head; }
.card-frame { grid-area: card; }
.detail-main { grid-area: main; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "head" "card" "main"; gap: 20px; } }
.card-frame { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: sticky; top: 72px; }
@media (max-width: 860px) { .card-frame { position: static; max-width: 460px; } }
.card-frame figure { margin: 0; }
.card-frame img { width: 100%; cursor: zoom-in; border-radius: var(--radius-sm); background: var(--bg-sunken); }
.card-frame figcaption { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 6px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.gallery img { aspect-ratio: 1; object-fit: contain; }
.eyebrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tag { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); border: 1px solid var(--line-strong); padding: 3px 8px; border-radius: var(--radius-xs); text-decoration: none; }
a.tag[style] { border-color: var(--gen); color: var(--text); }
a.tag:hover { border-color: var(--accent); }
.detail h1 { margin: 0; color: var(--heading-ink); font: var(--display-weight) clamp(30px, 5vw, 46px)/1.02 var(--font-display); text-transform: var(--display-case); }
.detail h1 .qual { font-size: .55em; }
.subtitle { color: var(--text-dim); margin: 8px 0 0; }
.points-line { margin: 8px 0 0; color: var(--text-dim); }
.points-line b { color: var(--text); font-size: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.statline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0 10px; }
.stat { border-radius: var(--radius-sm); padding: 10px 4px 8px; text-align: center; color: var(--stat-ink); }
.stat b { display: block; font: var(--display-weight) 30px/1 var(--font-display); }
.stat span { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.stat.life { background: var(--life); } .stat.move { background: var(--move); } .stat.range { background: var(--range); }
.stat.attack { background: var(--attack); } .stat.defense { background: var(--defense); }
@media (max-width: 420px) { .stat b { font-size: 24px; } .stat span { font-size: 9px; letter-spacing: .04em; } }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 14px 0 0; }
.facts div { background: var(--bg-raised); padding: 9px 12px; }
.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 500; }
.section-title { color: var(--heading-ink); font: var(--display-weight) 22px/1.1 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); margin: 28px 0 10px; }
.section-title .count { color: var(--text-faint); font-size: 18px; }
.abilities { display: grid; gap: 10px; }
.ability { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ability h3 { margin: 0 0 4px; font: var(--display-weight) 17px/1.2 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); color: var(--ability-ink); }
.ability p { margin: 0; color: var(--text-dim); white-space: pre-line; }
.ability .src { margin-top: 6px; font-size: 12px; color: var(--text-faint); }
.related { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rel { color: var(--text-faint); font-size: 13px; }
.kv th, .kv td, .products th, .products td, .compare th, .compare td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.kv thead th, .products thead th { white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--thead-ink); background: var(--thead-bg); }
.kv tbody tr:last-child > *, .products tbody tr:last-child > *, .compare tbody tr:last-child > * { border-bottom: 0; }
.kv .num, .products .num { text-align: right; font-variant-numeric: tabular-nums; }
.compare .num { font-variant-numeric: tabular-nums; }
.products tbody th { font-weight: 500; min-width: 220px; }
.products .prod { display: flex; gap: 10px; align-items: flex-start; }
.products .thumb { width: 40px; height: 40px; object-fit: contain; border-radius: var(--radius-xs); background: var(--bg-sunken); flex: none; }
/* Cells keep words whole: the page .wrap's overflow-wrap: anywhere is inherited and would let a wrapping cell shrink mid-word. */
.products td { white-space: nowrap; overflow-wrap: normal; }
.products .line { display: block; }
.products th .credit, .products th .promo { display: block; font-size: 12px; font-weight: 400; }
.products th .credit { color: var(--text-faint); }
.products th .promo { color: var(--text-dim); margin-top: 2px; }
.products td.wrap-cell { white-space: normal; min-width: 120px; }
.products td.inbox { white-space: normal; min-width: 160px; }
.products.contents td { white-space: normal; }
.products td.note { min-width: 200px; color: var(--text-dim); font-size: 13px; }
.store { font-size: 12px; }
[data-zoom] { cursor: zoom-in; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 10px; }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: var(--radius-sm); background: var(--bg-raised); border: 1px solid var(--line); }
.photo-grid figcaption { text-align: center; font-size: 12px; color: var(--text-faint); margin-top: 4px; }
svg.ext { width: 12px; height: 12px; margin-left: 3px; vertical-align: -1px; stroke: currentColor; fill: none; stroke-width: 2; }
.wide-section { padding-bottom: 48px; }

/* ---------- compare page ---------- */
.compare { width: auto; min-width: 100%; }
.kv tbody th { min-width: 140px; }
.compare thead th { background: var(--thead-bg); color: var(--thead-ink); position: sticky; top: 0; font-weight: 600; min-width: 140px; max-width: 260px; white-space: normal; }
.compare thead th a { color: inherit; }
.compare tbody th { color: var(--text-dim); font-weight: 600; font-size: 13px; white-space: nowrap; position: sticky; left: 0; background: var(--bg-raised); z-index: 1; box-shadow: 1px 0 0 var(--line); }
.compare td { max-width: 260px; }
.compare td.best { background: var(--best); font-weight: 700; }
.compare .remove { margin-left: 6px; border: 1px solid var(--line-strong); background: transparent; border-radius: var(--radius-xs); width: 26px; height: 26px; cursor: pointer; color: var(--text-dim); }
.compare .remove:hover { color: var(--text); border-color: var(--accent); }
.compare .abil details { margin-bottom: 4px; }
.compare .abil summary { cursor: pointer; font: var(--display-weight) 15px/1.3 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); }
.compare .abil p { margin: 4px 0 8px; color: var(--text-dim); font-size: 13px; white-space: pre-line; }

/* ---------- about, empty, footer ---------- */
.prose-page { max-width: 820px; padding-bottom: 48px; }
.prose-page p, .prose-page li { color: var(--text-dim); }
.fine { font-size: 12px; color: var(--text-faint); }
.empty { padding: 60px 0; text-align: center; color: var(--text-dim); }
.footer { border-top: 1px solid var(--line); padding: 22px 16px 28px; text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 24px; }
.footer p { margin: 4px auto; max-width: 900px; }
.footer a { color: var(--text-dim); }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .85); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.modal-open { overflow: hidden; }
.lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: min(1100px, 100%); max-height: 100%; min-height: 0; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 96px); max-height: calc(100dvh - 96px); object-fit: contain; }
.lightbox figcaption { color: #e9ecf1; font-size: 13px; text-align: center; }
.lightbox-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; color: #fff; font-size: 36px; cursor: pointer; line-height: 1; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .search-row { grid-template-columns: 1fr; }
  .topbar-inner { gap: 8px; }
  .theme-toggle { font-size: 0; width: 32px; padding: 0; }
  .theme-toggle::before { content: "◐"; font-size: 16px; }
  .facet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px; }
  .ranges { padding: 0 10px 10px; }
  .range-grid { grid-template-columns: 1fr; }
  .units .col-name { min-width: 140px; max-width: 170px; }
  .table-wrap { max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); }
  .cmp-names { display: none; }
}
@media (max-width: 520px) {
  .brand-word { display: none; }
  .tabs a { padding: 5px 10px; font-size: 13px; }
  .help { display: none; }
}
@media (max-width: 430px) {
  .topbar-inner { gap: 6px; }
  .brand { font-size: 18px; gap: 6px; }
  .brand-mark { width: 18px; height: 18px; }
  .tabs { padding: 3px; gap: 2px; }
  .tabs a { padding: 5px 8px; font-size: 13px; }
}
@media (max-width: 359px) {
  .brand > span { display: none; }
}

/* ================================================================ store pages
   The store, packs and bonuses views, store cards, and the buy blocks on stat and pack pages (site/store.js).
   Carried over from Summonings. */

.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 20px 0 6px; }
.highlight {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  padding: 12px 14px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.highlight:hover { border-color: var(--line-strong); }
.highlight .h-icon { flex: none; width: 42px; height: 48px; overflow: hidden; border-radius: var(--radius-sm); background: var(--bg-sunken); position: relative; }
.highlight .h-label { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.highlight .h-title { font-weight: 600; line-height: 1.3; }
.highlight .h-sub { font-size: 13px; color: var(--text-dim); }

.toolbar {
  position: sticky; top: 56px; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px 0; margin-bottom: 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.toolbar-search {
  flex: 1 1 220px; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px; height: 38px;
}
.toolbar-search:focus-within { border-color: var(--accent); }
.toolbar-search svg { width: 16px; height: 16px; stroke: var(--text-faint); fill: none; stroke-width: 2; flex: none; }
.toolbar-search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; height: 100%; }
.toolbar .chips { margin: 0; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-size: 11px; color: inherit; opacity: .7; }
.select {
  height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-raised); padding: 0 30px 0 12px;
  appearance: none; -webkit-appearance: none; cursor: pointer; font-size: 14px; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
/* ---------- grid & figure cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 16px; padding-bottom: 48px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }

.fcard {
  position: relative; display: flex; flex-direction: column; text-decoration: none;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.fcard:hover, .fcard:focus-visible { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); outline: none; }
.fcard:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 3px; }
.image-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; color: var(--text-dim); font-size: 13px; text-align: center; }

/* Figure portrait: crops the miniature photo out of the army card's art panel. */
.portrait {
  position: relative; aspect-ratio: 4 / 5; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 20%, color-mix(in srgb, var(--gen, #555) 45%, var(--bg-sunken)), var(--bg-sunken));
}
.portrait img {
  position: absolute; max-width: none;
  width: 320%; left: -153%; top: 0; margin-top: -20%;
}
.portrait.box img { width: 100%; height: 100%; left: 0; margin: 0; object-fit: contain; padding: 10%; }
.portrait .gen-stripe { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--gen, var(--line-strong)); }

.badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 1; pointer-events: none; }
.badges .badge { font-size: 11px; padding: 5px 8px; background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .3); }
.badge.new { background: var(--new); color: var(--new-ink); }
.badge.preorder { background: var(--preorder); color: var(--preorder-ink); }
.badge.bonus { background: var(--bonus); color: var(--bonus-ink); }
.badge.soldout { background: var(--soldout); color: var(--soldout-ink); }
.badge.qty { background: var(--accent); color: var(--accent-ink); }
.fcard-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.fcard-name { font: var(--display-weight) 20px/1.1 var(--font-display); text-transform: var(--display-case); letter-spacing: var(--display-tracking); }
.fcard-meta { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.fcard-box { font-size: 13px; color: var(--text-dim); margin-top: 6px; line-height: 1.35; }
.fcard-price { margin-top: auto; padding-top: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price { font-weight: 600; font-size: 16px; }
.price-alt { font-size: 12px; color: var(--text-faint); }

.fcard-meta .gen-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; vertical-align: 1px; background: var(--gen, var(--text-faint)); }

/* ---------- release cards ---------- */
.rcard .portrait { aspect-ratio: 4 / 3; }
.rcard .fcard-name { font-size: 22px; }
.rcard .roster { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.buy { display: grid; gap: 10px; margin-top: 18px; }
.buy-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.buy-row .edition { font-weight: 600; }
.buy-row .sku { font-size: 12px; color: var(--text-faint); }
.buy-row .right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.buy-row .price { font-size: 20px; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.stock { font-size: 12px; font-weight: 600; }
.stock.ok { color: var(--new); } .stock.pre { color: var(--preorder); } .stock.out { color: var(--soldout); }
.stock.unknown { color: var(--text-faint); }

.bonus-panel {
  margin-top: 18px; border-radius: var(--radius); padding: 14px; display: flex; gap: 14px; align-items: center;
  border: 1px solid color-mix(in srgb, var(--bonus) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--bonus) 16%, var(--bg-raised)), var(--bg-raised));
}
.bonus-panel .portrait { flex: none; width: 84px; border-radius: var(--radius-sm); }
.bonus-panel h3 { margin: 0; font: var(--display-weight) 20px/1.1 var(--font-display); text-transform: var(--display-case); }
.bonus-panel .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--bonus); }
.bonus-panel p { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.bonus-panel .deadline { font-weight: 600; color: var(--text); }
.bonus-panel a { color: inherit; }

.badge.past { background: var(--bg-sunken); color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--line-strong); }
.bonus-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 12px; }
.bonus-row {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px;
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.bonus-row.live {
  border-color: color-mix(in srgb, var(--bonus) 55%, var(--line));
  background: linear-gradient(135deg, color-mix(in srgb, var(--bonus) 12%, var(--bg-raised)), var(--bg-raised));
}
.bonus-row .eyebrow { margin-bottom: 6px; }
.bonus-row .badge { position: static; box-shadow: none; }
.bonus-thumb { flex: none; width: 84px; border-radius: var(--radius-sm); overflow: hidden; display: block; }
.bonus-row h3 { margin: 0; font: var(--display-weight) 20px/1.1 var(--font-display); text-transform: var(--display-case); }
.bonus-row h3 a { text-decoration: none; }
.bonus-row p { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); overflow-wrap: anywhere; }
.bonus-row .qualifiers a, .bonus-row .avail a { color: var(--text); }
.bonus-row .avail { color: var(--text); font-weight: 500; }
.release-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 14px; color: var(--text-dim); font-size: 14px; }
.release-facts b { color: var(--text); font-weight: 600; }
.prose p { color: var(--text-dim); margin: 0 0 10px; }
.bullets { margin: 0; padding-left: 18px; color: var(--text-dim); }
.bullets li { margin: 3px 0; }
.bullets a { color: var(--text); }
.box-notes { margin-top: 8px; font-size: 12px; color: var(--text-faint); }
.minor { margin: 14px 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 640px) { .cols { grid-template-columns: 1fr; } }
.where-to-buy .buy-lead { margin: 0; }
.bonus-history { margin-top: 14px; font-size: 14px; }
.bonus-history summary { cursor: pointer; color: var(--text-dim); }
.bonus-history .bonus-list { margin-top: 10px; }
.prose { margin-top: 18px; max-width: 75ch; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }

@media (max-width: 640px) {
  /* Bonus banners become a swipeable row so they don't fill the first screen. */
  .highlights {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px;
    margin-inline: -16px; padding: 0 16px 4px; scrollbar-width: none;
  }
  .highlights::-webkit-scrollbar { display: none; }
  .highlight { flex: 0 0 82%; scroll-snap-align: start; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid.wide { grid-template-columns: 1fr; }
  .fcard-name { font-size: 17px; }
  .fcard-body { padding: 10px 10px 12px; }
  .badges { top: 6px; left: 6px; gap: 4px; }
  .badges .badge { font-size: 9px; padding: 4px 6px; }
  .toolbar { position: static; }
}
@media (prefers-reduced-motion: reduce) { .fcard { transition: none; } .fcard:hover { transform: none; } }

/* Below the rail's breakpoint the header is two rows: the brand, then the six views in a row that scrolls
   sideways if it has to. */
@media (max-width: 899px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 2px; padding: 6px 0 8px; }
  .brand { margin-right: 0; }
  .tabs { order: 2; flex: 1 0 100%; overflow-x: auto; scrollbar-width: none; justify-content: space-between; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; }
  .toolbar { position: static; }
  .card-frame { top: 110px; }
}
@media (max-width: 430px) {
  .brand-word { display: inline; }
  .tabs a { padding: 5px 9px; font-size: 13px; }
}
