/* GO Pocket design system.
   1 tokens · 2 base · 3 header & tab bar · 4 blocks, hero & tables · 5 card tiles · 6 pack shelf
   7 articles & decks · 8 card detail & filters · 9 footer · 10 phones · 11 motion
   Colour: the brand purple carries links, actions and soft panels; neutrals are tinted toward it
   (ink, lavender-white) so nothing reads as a second blue-grey palette. Gold is kept for ★ / ♛ rarity
   only. The one loud element is the booster-pack shelf; everything around it stays flat and quiet.
   Figures use Space Grotesk with tabular digits. */

/* ── 1 tokens ─────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: optional; /* preloaded; never swaps late, so text never jumps (CLS) */
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --brand: #7659d9;          /* brand purple: links, active states, focus (5.0:1 on white) */
  --brand-fill: #7659d9;     /* logo, accent fills */
  --brand-strong: #6042bf;   /* primary buttons, selected chips (white text 6.9:1) */
  --brand-strong-hover: #4e33a6;
  --brand-soft: #f3f0fc;     /* brand background: hero, pack shelf, badges */
  --on-brand-soft: #6042bf;  /* text on --brand-soft */
  --on-brand: #ffffff;
  --bg: #faf9fd;
  --surface: #ffffff;
  --surface-2: #f4f2fa;
  --text: #1c1830;
  --muted: #625c7a;
  --line: #e7e3f3;
  --line-strong: #cfc8e4;
  --gold: #946708;           /* ★ ✦ ♛ rarities (5.1:1 on white) */
  --up: #1d7a40; --down: #b3261e; /* tier movement */
  --shadow: 0 1px 2px rgba(42, 26, 94, .06), 0 8px 24px rgba(42, 26, 94, .07);
  --dots: rgba(118, 89, 217, .13);
  /* card elements (tile tints, type dots) */
  --el-grass: #5aa647; --el-fire: #e0603a; --el-water: #3b8fd9; --el-lightning: #e7b923; --el-psychic: #b0559f;
  --el-fighting: #b06b3a; --el-darkness: #3c4652; --el-metal: #8a96a3; --el-dragon: #b39233; --el-colorless: #b9bec4;
  --el-trainer: #8d86a6;
  --font-body: "Noto Sans TC", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Noto Sans TC", "PingFang TC", "Hiragino Sans", "Microsoft JhengHei", system-ui, sans-serif;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.25rem; --fs-xl: 1.7rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r1: 4px; --r2: 8px; --r3: 14px; --r4: 22px;
  --gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  --tab-bar: 60px;
  color-scheme: light;
  font-family: var(--font-body);
}
:root[data-theme="dark"] {
  --brand: #a996ee; --brand-fill: #9b84e8; --brand-strong: #6a4bcc; --brand-strong-hover: #7c5fe0;
  --brand-soft: #251f45; --on-brand-soft: #cfc4f7; --on-brand: #ffffff;
  --bg: #121020; --surface: #1a172d; --surface-2: #231f3a; --text: #edeaf8; --muted: #a59fbe;
  --line: #2e2948; --line-strong: #453e68; --gold: #e6bd55; --up: #6fd08c; --down: #f2928a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28); --dots: rgba(169, 150, 238, .14);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand: #a996ee; --brand-fill: #9b84e8; --brand-strong: #6a4bcc; --brand-strong-hover: #7c5fe0;
    --brand-soft: #251f45; --on-brand-soft: #cfc4f7; --on-brand: #ffffff;
    --bg: #121020; --surface: #1a172d; --surface-2: #231f3a; --text: #edeaf8; --muted: #a59fbe;
    --line: #2e2948; --line-strong: #453e68; --gold: #e6bd55; --up: #6fd08c; --down: #f2928a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28); --dots: rgba(169, 150, 238, .14);
    color-scheme: dark;
  }
}

/* ── 2 base ───────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r1); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.01em; margin-top: var(--s4); }
h2 { font-size: var(--fs-lg); font-weight: 800; }
h2 a { color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); }
.sub { margin-left: .4em; font-size: .7em; font-weight: 500; color: var(--muted); }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.code { display: inline-block; padding: 0 7px; border-radius: 6px; background: var(--brand-soft); color: var(--on-brand-soft);
  font-size: var(--fs-xs); font-weight: 700; line-height: 1.7; letter-spacing: .02em; vertical-align: middle; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; color: var(--on-brand-soft); }
.lead { max-width: 40em; margin: 0 0 var(--s4); color: var(--muted); }
.notice { max-width: 46em; margin: 0 0 var(--s4); padding: var(--s3) var(--s4); border-left: 3px solid var(--brand-fill);
  border-radius: 0 var(--r2) var(--r2) 0; background: var(--brand-soft); font-size: var(--fs-sm); }
.source-note { margin: var(--s3) 0 0; font-size: var(--fs-xs); color: var(--muted); }
.empty { padding: var(--s5); border: 1px dashed var(--line-strong); border-radius: var(--r3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 50; padding: var(--s2) var(--s3); background: var(--surface); }
.skip-link:focus { left: var(--s2); }
main { min-height: 60vh; padding-bottom: var(--s7); }

/* ── 3 header & tab bar ───────────────────────────────────────────────────── */
.site-head { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head__inner { display: flex; align-items: center; gap: var(--s5); height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.go-mark { width: 50px; height: 26px; color: var(--brand-fill); }
.brand__name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.site-nav { display: flex; gap: 2px; }
.site-nav a { padding: 6px 12px; border-radius: 999px; color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.site-nav a:hover { background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--on-brand-soft); font-weight: 700; }
.site-head__tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.icon-btn, .theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0;
  border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.icon-btn:hover, .theme-toggle:hover { background: var(--surface-2); }
.icon-btn svg, .theme-toggle svg, .tab-bar svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle__moon { fill: currentColor !important; stroke: none !important; }
:root:not([data-theme]) .theme-toggle, :root[data-theme="dark"] .theme-toggle__moon, :root[data-theme="light"] .theme-toggle__sun { display: none; }

.tab-bar { display: none; }

/* ── 4 blocks, hero & tables ──────────────────────────────────────────────── */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: var(--s4) 0 0; padding: 0; list-style: none; font-size: var(--fs-xs); color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.block { padding-top: var(--s6); }
.block__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s3); }
.block__head h2 { margin: 0; }
.more { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.more::after { content: " ›"; }

.search { display: flex; max-width: 640px; border: 1px solid var(--line-strong); border-radius: var(--r3); background: var(--surface); overflow: hidden; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.search input { flex: 1; min-width: 0; padding: 13px 16px; border: 0; background: none; color: var(--text); font: inherit; outline: none; }
.search button { padding: 0 var(--s5); border: 0; background: var(--brand-strong); color: var(--on-brand); font: inherit; font-weight: 700; cursor: pointer; }
.search button:hover { background: var(--brand-strong-hover); }

/* home hero: search on the left, the newest expansion's packs on the right */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s6); margin-top: var(--s5);
  padding: var(--s6) var(--s6) var(--s6) var(--s7); border-radius: var(--r4); background-color: var(--brand-soft);
  background-image: radial-gradient(circle at 1px 1px, var(--dots) 1.5px, transparent 0); background-size: 20px 20px; }
.hero h1 { margin: 0 0 var(--s2); font-size: clamp(1.7rem, 4.2vw, 2.5rem); }
.hero__lead { max-width: 34em; margin: 0 0 var(--s4); color: var(--muted); }
.hero .type-links ul { margin: var(--s4) 0 0; }
.hero__latest { display: grid; justify-items: center; gap: var(--s3); min-width: 280px; padding: var(--s2) var(--s4); color: var(--text); text-align: center; }
.hero__latest:hover { text-decoration: none; }
.hero__art { --pack-h: 208px; --logo-w: 164px; display: block; }
.hero__caption { display: grid; gap: 2px; }
.hero__caption strong { font-family: var(--font-display); font-size: var(--fs-lg); }
.hero__latest:hover strong { color: var(--brand); }
.hero__meta, .pack-card__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px var(--s2); font-size: var(--fs-xs); color: var(--muted); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s3) var(--s5); margin: 0 0 var(--s4); }
.facts div { min-width: 0; }
.facts dt { font-size: var(--fs-xs); color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts--inline { display: flex; flex-wrap: wrap; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r3); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); background: var(--surface); }
.data th, .data td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data tbody tr:last-child > * { border-bottom: 0; }
.data thead th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); background: var(--surface-2); }
.data tbody th { font-weight: 600; }
.data td.num { text-align: right; }
.data tbody tr:hover { background: var(--surface-2); }

.rarity-counts { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.rarity-counts li { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.jump { margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; }
.jump ul { display: flex; gap: var(--s2); margin: 0; padding: 2px 0; list-style: none; font-size: var(--fs-sm); white-space: nowrap; }
.jump a { display: block; padding: 5px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); }
.jump a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.older { margin-top: var(--s4); }
.older summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--brand); }
.not-found { padding: var(--s7) 0; }
.not-found .search { margin: var(--s4) 0; }

/* ── 5 card tiles ─────────────────────────────────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s4) var(--s3); margin: 0; padding: 0; list-style: none; }
.tile a { display: block; color: var(--text); }
.tile a:hover { text-decoration: none; }
.tile a:hover .tile__name { color: var(--brand); }
.tile a:hover .tile__art { transform: translateY(-2px); box-shadow: var(--shadow); }
/* Fixed ratio reserves the space before any image arrives (CLS ≤ 0.1). */
/* Thumbnails are 141×84 art crops; the element tint shows until (or instead of) the image. */
.tile__art { display: block; aspect-ratio: 141 / 84; overflow: hidden; border-radius: var(--r2); background: var(--el-trainer);
  transition: transform .15s ease, box-shadow .15s ease; }
.tile__art:empty { opacity: .85; }
.decklist__art { background: var(--el-trainer); }
.tile__art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tile__name { display: block; margin-top: 6px; font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile__meta { display: flex; justify-content: space-between; gap: 4px; font-size: var(--fs-xs); color: var(--muted); }
.tile__rarity { letter-spacing: -.05em; color: var(--muted); }
.tile__rarity--hi { color: var(--gold); }
[data-el="grass"] { background: var(--el-grass); } [data-el="fire"] { background: var(--el-fire); }
[data-el="water"] { background: var(--el-water); } [data-el="lightning"] { background: var(--el-lightning); }
[data-el="psychic"] { background: var(--el-psychic); } [data-el="fighting"] { background: var(--el-fighting); }
[data-el="darkness"] { background: var(--el-darkness); } [data-el="metal"] { background: var(--el-metal); }
[data-el="dragon"] { background: var(--el-dragon); } [data-el="colorless"] { background: var(--el-colorless); }
.el-dot { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; }

/* ── 6 pack shelf: expansions shown as their booster packs ────────────────── */
/* .fan: 1–3 wrappers side by side, with the zh logo printed over them as on the real wrapper. */
.fan { position: relative; display: inline-flex; align-items: flex-end; justify-content: center; transition: transform .2s ease; }
.fan__pack { display: block; width: auto; height: var(--pack-h, 132px); }
.fan--2 .fan__pack:nth-child(1) { transform: translateX(16%) rotate(-7deg); }
.fan--2 .fan__pack:nth-child(2) { transform: translateX(-16%) rotate(7deg); }
.fan--3 .fan__pack:nth-child(1) { transform: translate(34%, 3%) rotate(-11deg); }
.fan--3 .fan__pack:nth-child(2) { position: relative; z-index: 1; transform: translateY(-3%); }
.fan--3 .fan__pack:nth-child(3) { transform: translate(-34%, 3%) rotate(11deg); }
.fan__logo { position: absolute; left: 50%; bottom: 7%; z-index: 2; width: var(--logo-w, 104px); max-width: none; height: auto;
  transform: translateX(-50%); filter: drop-shadow(0 1px 3px rgba(20, 10, 50, .45)); pointer-events: none; }
.fan--0 .fan__logo { position: static; transform: none; width: min(100%, 168px); }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.pack-card a { display: flex; flex-direction: column; height: 100%; padding-bottom: var(--s3); border: 1px solid var(--line); border-radius: var(--r3);
  background: var(--surface); color: var(--text); text-align: center; overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.pack-card a:hover { border-color: var(--brand); box-shadow: var(--shadow); text-decoration: none; }
.pack-card a:hover .fan { transform: translateY(-4px) rotate(-2deg); }
.pack-card__art { display: grid; place-items: center; height: 168px; margin-bottom: var(--s3); background: var(--brand-soft);
  background-image: radial-gradient(circle at 1px 1px, var(--dots) 1.5px, transparent 0); background-size: 16px 16px; }
.pack-card__name { padding: 0 var(--s3); font-family: var(--font-display); font-weight: 700; line-height: 1.3; }
.pack-card__en { padding: 0 var(--s3); font-size: var(--fs-xs); color: var(--muted); }
.pack-card__meta { margin-top: auto; padding: var(--s2) var(--s3) 0; }

.set-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s5); margin-top: var(--s3); }
.set-head__art { --pack-h: 176px; --logo-w: 140px; display: grid; place-items: center; min-width: 200px; padding: var(--s4) var(--s5);
  border-radius: var(--r3); background: var(--brand-soft); background-image: radial-gradient(circle at 1px 1px, var(--dots) 1.5px, transparent 0); background-size: 16px 16px; }
.set-head h1 { margin-top: 0; }

/* ── 7 articles & decks ───────────────────────────────────────────────────── */
.article-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s5) var(--s4); margin: 0; padding: 0; list-style: none; }
.article-card a { display: grid; gap: 4px; color: var(--text); }
.article-card a:hover { text-decoration: none; }
.article-card a:hover .article-card__title { color: var(--brand); }
.article-card__cover { display: block; aspect-ratio: 2 / 1; margin-bottom: 4px; overflow: hidden; border-radius: var(--r3); background: var(--surface-2); }
.article-card__cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.article-card a:hover .article-card__cover img { transform: scale(1.03); }
.article-card__kind { font-size: var(--fs-xs); font-weight: 700; color: var(--on-brand-soft); }
.article-card__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-weight: 600; line-height: 1.4; }
.article-card time, .articles time { font-size: var(--fs-xs); color: var(--muted); }
.articles { margin: 0; padding: 0; list-style: none; }
.articles li { display: flex; justify-content: space-between; gap: var(--s4); padding: 10px 0; border-bottom: 1px solid var(--line); }
.articles a { color: var(--text); }
.articles a:hover { color: var(--brand); }
.articles time { flex: none; }

.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--s4); margin: 0; padding: 0; list-style: none; }
.deck { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); overflow: hidden; }
.deck__cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: 100%; gap: 2px; aspect-ratio: 2 / 1; background: var(--line); }
.deck__card { display: block; min-width: 0; height: 100%; }
.deck__card .tile__art { height: 100%; aspect-ratio: auto; border-radius: 0; }
.deck__card:hover .tile__art { transform: none; box-shadow: none; filter: brightness(1.08); }
.deck .deck__name { margin: var(--s3) var(--s3) 2px; font-size: var(--fs-md); font-weight: 700; line-height: 1.35; }
.deck__guide { margin: auto var(--s3) var(--s3); font-size: var(--fs-sm); font-weight: 600; }
.deck__guide::after { content: " ↗"; }

/* folded deck guides on /tier-list/: one row per expansion (pack art, name, code, date, count) that
   opens to show its decks */
.folds { display: grid; gap: var(--s3); }
.fold { border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease; }
.fold:hover, .fold[open] { border-color: var(--brand); }
.fold[open] { box-shadow: var(--shadow); }
.fold__head { display: grid; grid-template-columns: 136px minmax(0, 1fr) auto; align-items: center; gap: var(--s4);
  padding-right: var(--s4); cursor: pointer; list-style: none; }
.fold__head::-webkit-details-marker { display: none; }
.fold__head::after { content: ""; width: 9px; height: 9px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease; }
.fold[open] > .fold__head::after { transform: translateY(3px) rotate(-135deg); }
.fold__head:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--r3); }
.fold__art { --pack-h: 76px; --logo-w: 64px; display: grid; place-items: center; align-self: stretch; min-height: 96px; overflow: hidden;
  background: var(--brand-soft); background-image: radial-gradient(circle at 1px 1px, var(--dots) 1.5px, transparent 0); background-size: 16px 16px; }
.fold__head:hover .fan { transform: translateY(-3px) rotate(-2deg); }
.fold__title { display: flex; flex-direction: column; gap: 4px; padding: var(--s3) 0; }
.fold__name { font-family: var(--font-display); font-size: var(--fs-md); font-weight: 700; line-height: 1.3; }
.fold__meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: var(--fs-xs); color: var(--muted); }
.fold__body { padding: var(--s4); border-top: 1px solid var(--line); }
.fold__body .source-note .more { margin-left: var(--s3); white-space: nowrap; }

/* ranked decks (/tier-list/, home) and full deck lists (/decks/…) */
.tier-badge { display: inline-block; padding: 1px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2);
  color: var(--muted); font-family: var(--font-display); font-size: .78em; font-weight: 700; line-height: 1.5; white-space: nowrap; vertical-align: .12em; }
.tier-badge--1 { border-color: var(--brand-strong); background: var(--brand-strong); color: var(--on-brand); }
.tier-badge--2 { border-color: var(--on-brand-soft); background: var(--brand-soft); color: var(--on-brand-soft); }
.tier-badge--3 { border-color: transparent; background: var(--brand-soft); color: var(--on-brand-soft); }
/* where a deck comes from (tournament) or that its list is from an old format (archived) */
.deck-tag { display: inline-block; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r1); background: var(--brand-soft); color: var(--on-brand-soft);
  font-size: .78em; font-weight: 700; line-height: 1.6; white-space: nowrap; vertical-align: .12em; }
.deck-tag--old { border-color: var(--line-strong); background: transparent; color: var(--muted); }
.deck:has(.deck__link:hover) { border-color: var(--brand); box-shadow: var(--shadow); }
.deck__link { display: flex; flex-direction: column; height: 100%; color: var(--text); }
.deck__link:hover { text-decoration: none; }
.deck__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin: auto var(--s3) var(--s3); padding-top: 2px; font-size: var(--fs-xs); color: var(--muted); }
.energy { display: inline-flex; align-items: center; }
.energy .el-dot { margin-right: 4px; }
.trend { font-weight: 700; white-space: nowrap; }
.trend--up { color: var(--up); }
.trend--down { color: var(--down); }
.deck-head { margin: var(--s4) 0 0; }
.deck-head h1 { margin: 0; }
.deck-head__tier { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 var(--s2); font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.deck-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin: var(--s2) 0 0; font-size: var(--fs-sm); color: var(--muted); }
.decklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--s4) var(--s3); margin: 0; padding: 0; list-style: none; }
.decklist__card a { display: block; color: var(--text); }
.decklist__card a:hover { text-decoration: none; }
.decklist__art { position: relative; display: block; aspect-ratio: 367 / 512; border-radius: 4.5% / 3.2%; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease; }
.decklist__card a:hover .decklist__art { transform: translateY(-2px); box-shadow: var(--shadow); }
.decklist__art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.decklist__count { position: absolute; right: 6%; bottom: 5%; min-width: 2.2em; padding: 1px 8px; border-radius: 999px; background: rgba(20, 16, 40, .88);
  color: #fff; font-size: var(--fs-sm); font-weight: 700; text-align: center; }
.decklist__name { display: block; margin-top: 6px; font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.decklist__id { display: block; font-size: var(--fs-xs); color: var(--muted); }

/* ── 8 card detail & filters ──────────────────────────────────────────────── */
.card-detail { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); grid-template-rows: auto auto 1fr;
  column-gap: var(--s6); align-items: start; margin: var(--s3) 0 var(--s4); }
.card-detail__art { grid-row: 1 / -1; }
.card-detail__art .tile__art { aspect-ratio: 367 / 512; border-radius: var(--r3); }
.card-face { display: block; width: 100%; height: auto; aspect-ratio: 367 / 512; border-radius: 4.5% / 3.2%; box-shadow: var(--shadow); }
.card-detail h1 { margin-top: 0; }
.card-detail h1 .sub { display: block; font-size: var(--fs-sm); font-weight: 500; }
.card-detail .facts { padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.data--wrap th, .data--wrap td { white-space: normal; }
.data td.rates { line-height: 1.7; white-space: nowrap; }
.data--wrap .sub { display: block; }
.plain-list { margin: 0 0 var(--s3); padding-left: 1.2em; }
.plain-list--columns { columns: 16em auto; column-gap: var(--s6); }
.plain-list--columns li { break-inside: avoid; margin-bottom: 4px; }
.block h3 { font-size: var(--fs-sm); margin: var(--s3) 0 var(--s2); }
.block > h3 { color: var(--muted); }

.type-links ul { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0 0 var(--s4); padding: 0; list-style: none; font-size: var(--fs-sm); }
.type-links a { display: flex; align-items: center; padding: 4px 12px 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); }
.type-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.filters { margin-bottom: var(--s4); }
.filters__q { margin-bottom: var(--s3); }
.filters__more { margin-bottom: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface); }
.filters__more summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); }
.filters__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); margin: var(--s3) 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-xs); color: var(--muted); }
.field select, .field input { padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: var(--r2); background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); }
.field--inline { flex-direction: row; align-items: center; gap: var(--s2); }
.filter-group { margin: var(--s3) 0 0; padding: 0; border: 0; }
.filter-group legend { margin-bottom: 6px; font-size: var(--fs-xs); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 4px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: var(--fs-sm); cursor: pointer; user-select: none; }
.chip span:hover { border-color: var(--brand); }
.chip input:checked + span { border-color: var(--brand-strong); background: var(--brand-strong); color: var(--on-brand); }
.chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.filters__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); }
.filters__count { margin: 0 auto 0 0; font-size: var(--fs-sm); font-weight: 600; }
.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r2); overflow: hidden; }
.view-toggle button { padding: 6px 12px; border: 0; background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.view-toggle button[aria-pressed="true"] { background: var(--brand-strong); color: var(--on-brand); }
.link-btn { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.load-more { text-align: center; margin: var(--s5) 0; }
.load-more button { padding: 10px 32px; border: 1px solid var(--brand-strong); border-radius: 999px; background: var(--surface); color: var(--on-brand-soft); font: inherit; font-weight: 700; cursor: pointer; }
.load-more button:hover { background: var(--brand-soft); }
.load-more button[hidden] { display: none; }
.set-hits { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin: 0 0 var(--s4); padding: 0; list-style: none; }
/* list view: same tiles laid out as rows */
.tiles--list { grid-template-columns: 1fr; gap: 0; }
.tiles--list .tile a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.tiles--list .tile__art { aspect-ratio: 1; border-radius: 50%; }
.tiles--list .tile a:hover .tile__art { transform: none; box-shadow: none; }
.tiles--list .tile__name { margin: 0; }
.tiles--list .tile__meta { gap: var(--s4); }

/* ── 9 footer ─────────────────────────────────────────────────────────────── */
.site-foot { margin-top: var(--s6); padding: var(--s6) 0; border-top: 1px solid var(--line); background: var(--surface); font-size: var(--fs-sm); color: var(--muted); }
.site-foot__title { font-size: var(--fs-sm); color: var(--text); }
.network { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s2) var(--s5); margin: 0 0 var(--s4); padding: 0; list-style: none; }
.network li { display: flex; flex-direction: column; }
.network a { font-weight: 600; }
.network span { font-size: var(--fs-xs); }
.site-foot__note { margin: var(--s2) 0; }
.site-foot__legal { margin: var(--s4) 0 0; font-size: var(--fs-xs); }

/* ── 10 phones: bottom tab bar for one-handed use ─────────────────────────── */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: var(--s5); }
  .hero__latest { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; min-width: 0; padding: var(--s4) 0 0;
    border-top: 1px solid var(--line-strong); text-align: left; }
  .hero__art { --pack-h: 120px; --logo-w: 96px; padding: 0 var(--s3); }
  .hero__meta { justify-content: flex-start; }
}
@media (max-width: 767px) {
  .site-nav { display: none; }
  .tab-bar { position: fixed; inset: auto 0 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tab-bar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line); }
  .tab-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: 11px; }
  .tab-bar a:hover { text-decoration: none; }
  .tab-bar a[aria-current="page"] { color: var(--brand); font-weight: 700; box-shadow: inset 0 2px 0 var(--brand-fill); }
  body { padding-bottom: calc(var(--tab-bar) + env(safe-area-inset-bottom)); }
  .hero { margin-top: var(--s3); padding: var(--s4); border-radius: var(--r3); }
  .block { padding-top: var(--s5); }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--s3) var(--s2); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .pack-card__art { --pack-h: 112px; --logo-w: 90px; height: 144px; }
  .fold__head { grid-template-columns: 104px minmax(0, 1fr) auto; gap: var(--s3); }
  .fold__art { --pack-h: 60px; --logo-w: 52px; min-height: 80px; }
  .fold__body { padding: var(--s3); }
  .decks { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .deck .deck__name { font-size: var(--fs-sm); }
  .decklist { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3) var(--s2); }
  .decklist__name { font-size: var(--fs-xs); }
  .decklist__count { padding: 0 6px; font-size: var(--fs-xs); }
  .article-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s3); }
  .article-card__title { font-size: var(--fs-sm); -webkit-line-clamp: 3; line-clamp: 3; }
  .articles li { flex-direction: column; gap: 0; }
  .set-head { grid-template-columns: 1fr; gap: var(--s3); }
  .set-head__art { --pack-h: 136px; --logo-w: 110px; }
  .tiles.tiles--list { grid-template-columns: 1fr; gap: 0; }
  .filters__more:not([open]) { padding-bottom: var(--s3); }
  .card-detail { grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: none; column-gap: var(--s4); }
  .card-detail__art { grid-row: auto; }
  .card-detail .facts, .card-detail__note { grid-column: 1 / -1; margin-top: var(--s3); }
}

/* ── 11 motion ────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
