:root {
  --bg: #0d0f14;
  --panel: #161a22;
  --panel-2: #1d222c;
  --line: #2a303c;
  --text: #e7e9ee;
  --muted: #9aa3b2;
  --sun-1: #ffb347;
  --sun-2: #ff6a3d;
  --accent: #ff9a3d;
  --ok: #4cc38a;
  --warn: #f2c94c;
  --bad: #ff6b6b;
  --vigilance: #3c8ad8;
  --command: #3fa45b;
  --aggression: #d64545;
  --cunning: #e2b93b;
  --heroism: #e9e4d4;
  --villainy: #3a3a40;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--sun-1); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- layout ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px;
  background: #0a0c10; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 3px; font-weight: 800; letter-spacing: .02em; color: var(--text); }
.brand:hover { text-decoration: none; }
/* Logo: the sun mark plus a wide, heavy "TWIN SUNS" (Unbounded) and a thin, spaced-out "HUB". */
.logo-mark { height: 24px; width: auto; flex: none; display: block; }
.brand-text { display: inline-flex; align-items: baseline; gap: .55em; color: #f2eee3; white-space: nowrap; }
.brand-name { font-family: "Unbounded", var(--font); font-weight: 700; font-size: 1.02rem; text-transform: uppercase; letter-spacing: .01em; }
.brand-hub { font-weight: 400; font-size: .78rem; text-transform: uppercase; letter-spacing: .32em; color: #cfcabd; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a, .account a, .account button { color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover, .account a:hover, .nav a.active, .account a.active { color: var(--text); text-decoration: none; }
/* The section you're in: an orange underline (an orange label in the phone menu). */
.nav a.active, .account a.active:not(.btn) { text-decoration: underline 2px var(--accent); text-underline-offset: 8px; }
.account { display: flex; gap: 14px; align-items: center; }
.account form { margin: 0; }
.account button { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
/* Testers' feedback form: an orange outline so it stands out in the header without competing with Sign up. */
.account a.feedback-btn { color: var(--accent); border-color: var(--accent); background: rgba(255, 154, 61, .08); }
.account a.feedback-btn:hover { color: var(--text); background: rgba(255, 154, 61, .16); }
/* Signed-in headers get tight on mid-size screens: "Feedback" alone there. The phone menu has room again. */
.feedback-btn .fb-short { display: none; }
@media (max-width: 1100px) and (min-width: 701px) { .feedback-btn .fb-long { display: none; } .feedback-btn .fb-short { display: inline; } }
/* Account menu: your username opens My account, My decks, Collection and Log out (the site's .menu dropdown). */
.account-menu summary {
  display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; white-space: nowrap; cursor: pointer;
}
.account-menu summary:hover, .account-menu[open] summary, .account-menu summary.active { color: var(--text); }
.account-menu summary.active { text-decoration: underline 2px var(--accent); text-underline-offset: 8px; }
.account-menu .caret { width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; transition: transform .15s; }
.account-menu[open] .caret { transform: rotate(180deg) translateY(4px); }
.account-menu .menu-items { min-width: 190px; top: calc(100% + 14px); }
.account .account-menu .menu-items a, .account .account-menu .menu-items button { color: var(--text); font-weight: 500; }
.account .account-menu .menu-items a.active { color: var(--accent); text-decoration: none; }
.container { max-width: 1680px; margin: 0 auto; padding: 28px 40px 60px; }
/* Pages that are mostly card images or tiles (deck, pick list, card, card search, leaders, leader, deck lists, profiles)
   get a wider cap, and their cards and tiles grow on big screens (--card-scale below). Reading pages keep the 1680px
   cap. */
.container.wide { max-width: 2240px; }
/* Past the old cap, fixed-column grids fit tiles of about the size they had at 1680px, grown by --card-scale, so
   tiles get bigger rather than only more numerous. A row of four or more shares the full width, so it doesn't stop
   short of the edge; a shorter one keeps its tile size. */
@media (min-width: 1760px) {
  .container.wide .top-grid { --tile-min: calc(250px * var(--card-scale)); }
  .container.wide .top-grid.top-leaders, .container.wide .leader-grid { --tile-min: calc(300px * var(--card-scale)); }
  .container.wide .top-grid.top-pairs, .container.wide .deck-grid { --tile-min: calc(500px * var(--card-scale)); }
  .container.wide .folder-grid { --tile-min: calc(280px * var(--card-scale)); }
  .container.wide :is(.top-grid, .leader-grid, .deck-grid, .folder-grid) { grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); }
  .container.wide .top-grid:has(> :nth-child(4)) { grid-template-columns: repeat(auto-fit, minmax(var(--tile-min), 1fr)); }
}
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; padding: 18px 24px; text-align: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #3d4554; text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.primary { background: linear-gradient(135deg, var(--sun-1), var(--sun-2)) border-box; border-color: transparent; color: #1a0f05; }
/* Primary buttons have no border to light up, so hover brightens just their edge: a pale-gold line inside it and a faint
   ring outside (no movement). Pressing dims the button a touch. */
.btn.primary { transition: filter .12s, box-shadow .12s; }
.btn.primary:is(:hover, :focus-visible):not(:disabled) { box-shadow: inset 0 0 0 1.5px #ffe2b0, 0 0 0 1px rgba(255, 179, 71, .55); }
.btn.primary:active:not(:disabled) { filter: brightness(.95); box-shadow: 0 0 0 2px rgba(255, 154, 61, .3); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: .85rem; }
.btn-icon { width: 13px; height: 13px; flex: none; fill: currentColor; }
input[type=text], input[type=search], input[type=password], input[type=email], select, textarea {
  background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 8px 10px; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 154, 61, .45); border-color: transparent; }
/* Keyboard focus: one orange ring everywhere. Chips hide their checkbox/radio, so the label shows the ring. */
:focus-visible, .chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible):not(input, select, textarea) { outline: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
label { font-size: .85rem; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { background: var(--panel-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; }

/* ---------- aspects ---------- */
/* Official aspect icons (from starwarsunlimited.com), used wherever a card or deck shows its aspects. */
.pips { display: inline-flex; gap: 2px; vertical-align: middle; }
.pip {
  width: 18px; height: 18px; display: inline-block; flex: none; vertical-align: middle;
  background: center / contain no-repeat;
}
.pip.Vigilance { background-image: url("../img/aspects/vigilance.eb65eb06183a.png"); }
.pip.Command { background-image: url("../img/aspects/command.a79e8f8521b4.png"); }
.pip.Aggression { background-image: url("../img/aspects/aggression.1413d6de45a4.png"); }
.pip.Cunning { background-image: url("../img/aspects/cunning.f18ef1547769.png"); }
.pip.Heroism { background-image: url("../img/aspects/heroism.723304836654.png"); }
.pip.Villainy { background-image: url("../img/aspects/villainy.a32cb1442a4d.png"); }
.chip .pip { width: 20px; height: 20px; }

/* ---------- home page hero (templates/home.html) ---------- */
/* Edge to edge under the top bar: headline, a scope toggle and the big search, with a few leaders from the newest set
   fanned at each side, fading toward the middle so they never compete with the search. */
.hero {
  position: relative; text-align: center; padding: 64px 24px 56px; margin: -28px -40px 0;
  background: radial-gradient(ellipse 60% 70% at 50% 0%, rgba(255, 150, 60, .16), transparent 70%), #0b0d12;
  border-bottom: 1px solid var(--line);
}
.hero-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: 2.6rem; letter-spacing: -.02em; margin-bottom: 10px; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lede { color: var(--muted); font-size: 1.08rem; max-width: 560px; margin: 0 auto 26px; }
.hero-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 10px; margin-bottom: 18px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px;
  border: 1px solid rgba(255, 154, 61, .4); background: rgba(255, 154, 61, .08); color: var(--text); font-size: .88rem;
}
/* Pills, chips and feature squares lift a little on hover, like every other clickable thing on the page. */
.hero-tag, .leader-chip, .home-feature { transition: transform .12s, border-color .12s, box-shadow .12s, background .12s; }
.hero-tag:is(:hover, :focus-visible), .leader-chip:is(:hover, :focus-visible) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); }
.hero-tag:hover { text-decoration: none; border-color: var(--accent); }
.hero-tag b {
  background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); color: #1a0f05; border-radius: 99px; padding: 1px 9px;
  font-size: .8rem; letter-spacing: .05em; text-transform: uppercase;
}
.hero-tag > span:last-child { color: var(--accent); }
/* Spoilers: the next set, in a cooler colour so it doesn't read as the same thing as the featured set. */
.hero-tag.spoiled { border-color: rgba(120, 170, 255, .4); background: rgba(120, 170, 255, .08); }
.hero-tag.spoiled:hover { border-color: #78aaff; }
.hero-tag.spoiled b { background: #78aaff; color: #07122a; }
.hero-tag.spoiled > span:last-child { color: #9cc0ff; }
.tag-faces { display: inline-flex; }
.tag-faces img { width: 26px; height: 26px; object-fit: cover; object-position: 20% 30%; border-radius: 50%; border: 2px solid #0b0d12; display: block; }
.tag-faces img + img { margin-left: -9px; }
/* The fans are clipped by their own layer, not the hero, so the search results can drop below the hero. */
.hero-fans { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero-fan { --fan-in: 56px; position: absolute; top: 50%; width: 360px; height: 330px; transform: translateY(-50%); z-index: 1; pointer-events: none; }
/* Each fan fades toward the middle of the page as a whole (fading each card would let the back one show through
   the front one). */
.hero-fan.left { left: max(-40px, calc(50% - 860px)); -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent); mask-image: linear-gradient(90deg, #000 55%, transparent); }
.hero-fan.right { right: max(-40px, calc(50% - 860px)); -webkit-mask-image: linear-gradient(270deg, #000 55%, transparent); mask-image: linear-gradient(270deg, #000 55%, transparent); }
.hero-fan img {
  position: absolute; width: 300px; aspect-ratio: 7 / 5; object-fit: cover; border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .08);
  transition: scale .2s, rotate .2s, translate .2s, opacity .2s, box-shadow .2s;
}
.hero-fan.left img:nth-child(1) { left: 0; top: 10px; rotate: -8deg; }
.hero-fan.left img:nth-child(2) { left: 50px; top: 120px; rotate: -2deg; }
.hero-fan.right img:nth-child(1) { right: 0; top: 10px; rotate: 8deg; }
.hero-fan.right img:nth-child(2) { right: 50px; top: 120px; rotate: 2deg; }
/* While a chip is pointed at, its card's fan drops its fade and the other card in it steps back (the rule after
   this one brings the chosen card forward again; same specificity, so the order matters). */
.hero:has(.leader-chip:is([data-fan="1"], [data-fan="2"]):is(:hover, :focus-visible)) .hero-fan.left,
.hero:has(.leader-chip:is([data-fan="3"], [data-fan="4"]):is(:hover, :focus-visible)) .hero-fan.right { -webkit-mask-image: none; mask-image: none; }
.hero:has(.leader-chip:is([data-fan="1"], [data-fan="2"]):is(:hover, :focus-visible)) .hero-fan.left img,
.hero:has(.leader-chip:is([data-fan="3"], [data-fan="4"]):is(:hover, :focus-visible)) .hero-fan.right img { opacity: .25; }
/* Pointing at a leader's chip under the search brings that leader's card out of the fan: whole, upright, unfaded
   and slid in from the edge so none of it is cut off. */
.hero:has(.leader-chip[data-fan="1"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="1"],
.hero:has(.leader-chip[data-fan="2"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="2"],
.hero:has(.leader-chip[data-fan="3"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="3"],
.hero:has(.leader-chip[data-fan="4"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="4"] {
  z-index: 3; scale: 1.08; rotate: 0deg; opacity: 1; box-shadow: 0 0 0 2px var(--accent), 0 20px 50px rgba(0, 0, 0, .7);
}
.hero:has(.leader-chip[data-fan="1"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="1"],
.hero:has(.leader-chip[data-fan="2"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="2"] { translate: var(--fan-in) 0; }
.hero:has(.leader-chip[data-fan="3"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="3"],
.hero:has(.leader-chip[data-fan="4"]:is(:hover, :focus-visible)) .hero-fan img[data-fan="4"] { translate: calc(-1 * var(--fan-in)) 0; }
@media (max-width: 1500px) { .hero-fan { --fan-in: 86px; } .hero-fan img { opacity: .5; width: 250px; } .hero-fan.left { left: -70px; } .hero-fan.right { right: -70px; } }
@media (max-width: 1100px) { .hero-fan { display: none; } }

/* What to search: Everything / Leaders / Cards / Decks / Players. */
.scope { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; }
.scope button { border: 0; background: none; color: var(--muted); font: 600 .88rem var(--font); padding: 6px 14px; border-radius: 99px; cursor: pointer; }
.scope button:hover { color: var(--text); }
.scope button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
/* Segmented toggles (static/js/segmented.js): once the script is running, one sliding thumb marks the chosen option
   instead of each option's own background. Without the script the options above still show it. */
[data-segmented] { position: relative; }
.seg-thumb { position: absolute; z-index: 0; border-radius: 99px; background: var(--seg-bg, var(--panel-2)); box-shadow: inset 0 0 0 1px var(--accent); pointer-events: none; }
[data-segmented].seg-animate .seg-thumb { transition: left .28s cubic-bezier(.3, .8, .3, 1), width .28s cubic-bezier(.3, .8, .3, 1), top .28s; }
[data-segmented] :is(button, label) { position: relative; z-index: 1; transition: color .2s; }
.seg-ready :is(button[aria-pressed="true"], label:has(input:checked)) { background: none; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { [data-segmented].seg-animate .seg-thumb { transition: none; } }
.home-search { position: relative; display: flex; align-items: center; max-width: 720px; margin: 0 auto; }
.home-search .icon { position: absolute; left: 20px; color: var(--muted); pointer-events: none; }
.home-search input[type=search] {
  height: 64px; padding: 0 56px 0 54px; font-size: 1.2rem; border-radius: 16px;
  background: var(--panel); border: 1px solid #353c4a; box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.home-search input[type=search]:focus { outline: 2px solid rgba(255, 154, 61, .55); border-color: transparent; }
.home-search kbd { position: absolute; right: 16px; font: 600 .8rem var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; }
.home-search .search-results { left: 0; right: 0; width: 100%; text-align: left; }
.hero-try { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 14px; color: var(--muted); font-size: .88rem; }
/* Four leader names rarely fit the hero's text width, so this row gets a little more room on wide screens. */
@media (min-width: 1101px) { .hero-try { margin-inline: -100px; } }
.leader-chip { color: var(--text); padding: 3px 12px 3px 3px; }
.leader-chip img { width: 34px; aspect-ratio: 7 / 5; object-fit: cover; border-radius: 99px 4px 4px 99px; display: block; }
.leader-chip:hover, .leader-chip:focus-visible { border-color: var(--accent); background: var(--panel-2); }
/* The hero's search replaces the top bar's on the home page. */
.home-page .topbar .site-search { display: none; }

.home-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1320px; margin: 36px auto 44px; }
.home-feature { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--text); }
.home-feature:is(:hover, :focus-visible) { transform: translateY(-4px); border-color: rgba(255, 255, 255, .4); box-shadow: 0 12px 28px rgba(0, 0, 0, .5); text-decoration: none; }
.home-feature b { font-size: 1.02rem; }
.home-feature > span:not(.feature-icon) { color: var(--muted); font-size: .9rem; }
.feature-icon { grid-row: span 2; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 154, 61, .12); color: var(--sun-1); }
.feature-icon svg { width: 22px; height: 22px; }
@media (max-width: 1100px) { .home-features { grid-template-columns: repeat(2, 1fr); } }

/* Leader and card of the day: two equal panels, art beside its name and who it plays with. Landscape art (the
   leader side) is --daily-h tall; portrait art (the unit side, the card) gets the toggle's old space too, so it's
   readable without making the row taller. */
.home-daily {
  --daily-h: clamp(200px, 12vw, 230px); --daily-tall: calc(var(--daily-h) + 36px); --daily-thumb: clamp(110px, 6.5vw, 125px);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 40px;
}
/* Tall enough for the unit side and its toggle, so flipping the leader never changes the row's height. */
.daily { display: flex; gap: 20px; padding: 18px; min-height: calc(var(--daily-tall) + 14px + 38px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.daily-art { position: relative; flex: none; align-self: start; }
.daily-art a { display: block; }
.daily-art img { display: block; height: var(--daily-h); width: auto; max-width: 100%; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transition: translate .15s, box-shadow .15s; }
/* The big leader / card picture opens its page: the same neutral lift and edge as the small leaders beside it. */
.daily-art a:is(:hover, :focus-visible) img { translate: 0 -3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .85), 0 16px 34px rgba(0, 0, 0, .55); }
.card-daily .daily-art img, .leader-daily .side-unit { height: var(--daily-tall); }
.leader-daily .side-unit, .leader-daily .daily-art:has(input[value="unit"]:checked) .side-leader { display: none; }
.leader-daily .daily-art:has(input[value="unit"]:checked) .side-unit { display: block; }
/* Desktop: the art keeps the leader side's width whichever side shows, the unit side centred in it, so flipping never
   moves the text beside it. */
@media (min-width: 701px) {
  .leader-daily .daily-art { width: calc(var(--daily-h) * 7 / 5); }
  .leader-daily .daily-art a { display: flex; justify-content: center; }
}
/* Leader / Unit: a small version of the search scope toggle, straddling the art's bottom edge (the cards' text
   boxes sit at the bottom, so it mustn't cover more than the border). */
.daily-art:has(.side-toggle) { margin-bottom: 14px; }
.side-toggle {
  --seg-bg: var(--panel); position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 50%); display: inline-flex; gap: 2px; padding: 3px;
  background: rgba(13, 15, 20, .88); border: 1px solid var(--line); border-radius: 99px; box-shadow: 0 4px 14px rgba(0, 0, 0, .5);
}
.side-toggle label { position: relative; padding: 2px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.side-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.side-toggle label:has(input:checked) { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.side-toggle label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.daily-info { flex: 1; min-width: 0; }
.daily-label { color: var(--accent); font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 4px; }
.daily h2 { margin: 0 0 4px; font-size: 1.45rem; }
.daily h2 a { color: var(--text); }
.daily-meta { display: flex; align-items: center; gap: 4px; margin: 0 0 2px; color: var(--muted); font-size: .88rem; }
.daily-meta .pip { width: 18px; height: 18px; }
.daily-meta span:not(.pip) { margin-left: 4px; }
.daily-set { margin: 0 0 8px; color: var(--muted); font-size: .8rem; }
.daily-set a { color: var(--muted); text-decoration: underline dotted; text-underline-offset: 3px; }
.daily-set a:hover { color: var(--text); }
.daily-traits { margin: 0 0 2px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.daily .ability { padding: 6px 10px; margin-bottom: 6px; }
.daily .ability p { margin-top: 2px; font-size: .88rem; line-height: 1.45; }
.leader-daily .side-text-unit, .leader-daily:has(input[value="unit"]:checked) .side-text-leader { display: none; }
.leader-daily:has(input[value="unit"]:checked) .side-text-unit { display: block; }
/* Far right: up to four leaders that go with it, a 2x2 grid in order of share, about as tall as the art. */
.daily-side { flex: none; width: calc(2 * var(--daily-thumb) + 10px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 8px 10px; }
.daily-side .daily-sub { grid-column: 1 / -1; margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.daily-side .daily-sub span { font-size: .8rem; }
.daily-side a { display: grid; gap: 4px; padding: 3px; margin: -3px; border-radius: 8px; color: var(--text); font-size: .8rem; min-width: 0; }
/* Hover: the picture lifts with a soft white outline and the name brightens. Neutral on purpose: orange is kept for
   what's selected, featured or new. */
.daily-side a:is(:hover, :focus-visible) { background: var(--panel-2); text-decoration: none; }
.daily-side a:is(:hover, :focus-visible) img { translate: 0 -2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .85), 0 8px 20px rgba(0, 0, 0, .5); }
.daily-side b { color: #cfd5df; }
.daily-side a:is(:hover, :focus-visible) b { color: #fff; }
.daily-side img { width: 100%; aspect-ratio: 7 / 5; object-fit: cover; border-radius: 6px; display: block; transition: translate .15s, box-shadow .15s; }
.daily-side a > span { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.daily-side b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.daily-side .muted { flex: none; }
.daily-sub { margin: 14px 0 6px; font-size: .8rem; color: var(--muted); }
/* Stacked (one panel per row), there's width to spare: the four leaders go in one row instead of 2x2. */
@media (max-width: 1700px) {
  .home-daily { grid-template-columns: 1fr; --daily-h: 215px; --daily-thumb: clamp(120px, 10vw, 156px); }
  .daily-side { width: calc(4 * var(--daily-thumb) + 30px); grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) { .daily-side { width: calc(2 * var(--daily-thumb) + 10px); grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .daily { flex-wrap: wrap; } .daily-side { width: 100%; } }
@media (max-width: 700px) { .daily { flex-direction: column; } .home-daily { --daily-h: 200px; } .daily { min-height: 0; } .daily-art { align-self: center; } .leader-daily .side-leader { width: 100%; height: auto; } }
/* Phones: flipped to Unit, the (portrait) card grows to most of the panel's width so its text is readable. */
@media (max-width: 700px) {
  .leader-daily .daily-art:has(input[value="unit"]:checked) { align-self: stretch; }
  .leader-daily .daily-art:has(input[value="unit"]:checked) .side-unit { width: 82%; height: auto; margin-inline: auto; }
}
/* First printed in the latest release or the upcoming (spoiled) set: an orange pill on trending pairs and cards. */
.new-tag { display: inline-block; vertical-align: 2px; padding: 0 7px; border-radius: 99px; font-size: .8rem; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: #1a0f05; background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); }
/* Trending cards: always one full row of eight (two rows of four on narrower screens), never a lone card on a row. */
.card-grid.browse.home-cards { grid-template-columns: repeat(8, minmax(0, 1fr)); margin-bottom: 36px; }
@media (max-width: 1100px) { .card-grid.browse.home-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-line :is(.new-tag, .unreleased-tag) { align-self: flex-start; }

/* ---------- deck tiles ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.deck-tile {
  display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text); transition: transform .12s, border-color .12s, box-shadow .12s;
}
/* Picking a deck (deck tiles, pair tiles, folders, list rows): a clear lift, a light border and a shadow. Neutral, like
   every hover; orange is for what's selected, featured or new. */
.deck-tile:is(:hover, :focus-visible) {
  transform: translateY(-4px); border-color: rgba(255, 255, 255, .4); box-shadow: 0 12px 28px rgba(0, 0, 0, .5); text-decoration: none;
}
/* Deck art (partials/deck_art.html): leaders side by side, then a slim base bar (aspect icon, HP, name) with an
   edge in the base's aspect colour. */
/* The leaders sit on the tile's own colour with a little room around and between them, so each card's rounded corners
   and faint outline show (rather than butting into the tile edge on black). Below the aspect stripe when there is one. */
.deck-art { display: grid; background: var(--panel); }
.deck-art .art-leaders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; }
.deck-art .art-leaders > * { aspect-ratio: 7 / 5; }
.deck-art .art-leaders img { width: 100%; height: auto; object-fit: cover; display: block; }
.deck-art .art-leaders > div { border: 1px dashed var(--line); border-radius: 5%; }
.deck-art .base-bar {
  display: flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; overflow: hidden; white-space: nowrap;
  background: #14171d; font-size: .8rem; color: #e7e9ee;
}
.deck-art .base-bar span { overflow: hidden; text-overflow: ellipsis; }
.deck-art .base-bar .pip { width: 15px; height: 15px; }
.deck-art .base-hp { color: var(--text); font-weight: 800; }
.deck-art .base-bar.empty { color: var(--muted); }
.deck-art .base-bar.Vigilance { background: color-mix(in srgb, var(--vigilance) 32%, #14171d); }
.deck-art .base-bar.Command { background: color-mix(in srgb, var(--command) 32%, #14171d); }
.deck-art .base-bar.Aggression { background: color-mix(in srgb, var(--aggression) 32%, #14171d); }
.deck-art .base-bar.Cunning { background: color-mix(in srgb, var(--cunning) 32%, #14171d); }
.deck-tile .body { padding: 12px 14px; }
.deck-tile .name { font-weight: 700; margin-bottom: 2px; }
.tile-head { display: flex; align-items: flex-start; gap: 10px; }
.tile-head .name { flex: 1; min-width: 0; }
.tile-head .pips { flex: none; margin-top: 2px; }
.tile-foot { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 10px; margin-top: 8px; }
.tile-labels { display: grid; gap: 4px; justify-items: end; margin-left: auto; }
.tile-labels .deck-tags-line { justify-content: flex-end; margin: 0; }
.tile-foot .tile-meta { flex: 1 1 130px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.badge {
  display: inline-block; font-size: .8rem; font-weight: 700; padding: 1px 7px; border-radius: 99px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.legal { color: var(--ok); border-color: rgba(76, 195, 138, .4); }
.badge.illegal { color: var(--warn); border-color: rgba(242, 201, 76, .4); }
/* Spoiled cards that aren't out yet: red, on deck badges, card tags and outlines. */
.badge.upcoming { color: var(--bad); border-color: rgba(255, 107, 107, .45); }
.unreleased-tag { flex: none; color: var(--bad); border: 1px solid rgba(255, 107, 107, .45); border-radius: 99px;
  padding: 0 7px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
img.unreleased, .view-tile.unreleased, .result.unreleased { outline: 3px solid var(--bad); outline-offset: -3px; }
.view-tile .tile-new { position: absolute; bottom: 6px; right: 6px; font-size: .8rem; font-weight: 800; padding: 2px 7px;
  border-radius: 99px; background: rgba(0, 0, 0, .85); color: var(--bad); }

.pair-tile { display: flex; gap: 0; align-items: stretch; }
.pair-tile .art { height: 80px; }

/* ---------- grid / list toggle ---------- */
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.view-toggle a { padding: 6px 12px; color: var(--muted); font-weight: 600; font-size: .85rem; }
.view-toggle a:hover { text-decoration: none; color: var(--text); }
.view-toggle a.on { background: var(--panel-2); color: var(--text); }

.deck-table { width: 100%; border-collapse: collapse; }
.deck-table th, .deck-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.deck-table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.deck-table tbody tr { transition: background .12s, box-shadow .12s; }
.deck-table tbody tr:hover { background: var(--panel-2); box-shadow: inset 3px 0 0 rgba(255, 255, 255, .45); }
.deck-table .art-cell { width: 1%; padding: 10px 18px 10px 0; }
.deck-table .deck-art { width: 520px; border-radius: 8px; overflow: hidden; }
.deck-table .deck-name { font-weight: 700; color: var(--text); }
.deck-table .tile-summary { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- leaders ---------- */
/* 5 leaders per row on desktop so the card text stays legible. */
.leader-grid { display: grid; gap: 16px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1300px) { .leader-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .leader-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .leader-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.leader-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); }
.leader-card { transition: transform .12s, border-color .12s, box-shadow .12s; }
.leader-card:is(:hover, :focus-visible) { transform: translateY(-4px); border-color: rgba(255, 255, 255, .4); box-shadow: 0 12px 28px rgba(0, 0, 0, .5); text-decoration: none; }
/* The leader sits inside the tile with 8px of room, like the art on deck and pair tiles. */
.leader-card img { width: calc(100% - 16px); margin: 8px 8px 0; aspect-ratio: 7 / 5; object-fit: cover; display: block; }
.leader-card .body { padding: 8px 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: .85rem; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px; position: relative;
}
.chip.on { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
.chip:hover { text-decoration: none; color: var(--text); }

/* ---------- deck page ---------- */
.deck-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; margin-bottom: 24px; }
.deck-head .commanders { display: flex; gap: 10px; }
.deck-head .commanders img { width: 210px; border-radius: 10px; display: block; }
.deck-body { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
.deck-cols { columns: 3 260px; column-gap: 28px; }
.deck-group { break-inside: avoid; margin-bottom: 20px; }
/* Section headers: a filled bar across all of a section's columns, so where a group starts and ends reads at a glance.
   The builder's .deck-section h3 matches. */
.deck-group h3 { padding: 6px 12px; margin: 0 0 6px; border-radius: 8px; background: var(--panel-2); font-size: 1.02rem; font-weight: 700; color: var(--text); }
.deck-group h3 > .muted { color: var(--sun-1); }
.deck-group h3 .not-in-stats { color: var(--muted); font-size: .82rem; font-weight: 600; }
/* Clicking a section's header collapses it (static/js/deck-sections.js). The builder's headers share these rules. */
:is(.deck-group, .deck-section) > h3 { cursor: pointer; user-select: none; }
:is(.deck-group, .deck-section) > h3:hover { background: #262c38; }
/* A stat or token filter is on and a collapsed section hides some of its cards: an orange outline on that section's
   bar says so (deck page and builder). */
.token-filtered :is(.deck-group, .deck-section).collapsed:has(.token-match) > h3 { box-shadow: inset 0 0 0 2px var(--accent); }
.collapse-btn { display: inline-grid; place-items: center; width: 22px; height: 22px; margin: -2px 4px -2px -6px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; vertical-align: -5px; }
.collapse-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: rotate .15s; }
.collapse-btn:hover { color: var(--text); }
.collapsed > h3 { margin-bottom: 0; }
.collapsed .collapse-btn svg { rotate: -90deg; }
.collapsed > .group-body, .collapsed > .section-body { display: none !important; }
.deck-view.list .deck-group.collapsed { width: var(--list-col, 320px); max-width: 100%; }
.card-line {
  display: flex; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 6px; cursor: default; font-size: .92rem;
}
.card-line:hover { background: var(--panel-2); }
.card-line .qty-n { color: var(--muted); font-size: .8rem; }  /* "×3", only for cards that allow more than one copy */
.card-line .cost {
  width: 20px; height: 20px; border-radius: 50%; background: #2c3340; display: grid; place-items: center;
  font-size: .8rem; font-weight: 700; flex: none;
}
.card-line .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-line .sub { color: var(--muted); }
.penalty { color: var(--warn); font-size: .8rem; font-weight: 700; }
.curve { display: flex; gap: 6px; align-items: flex-end; height: 120px; }
.curve .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
/* The bar's height is a share of the track, which leaves out the labels: as a share of the whole column, tall bars
   plus their labels overflowed and got squashed to the same height (15 and 23 looked alike). The count sits on top
   of the bar, in the track's top padding. */
.curve .bar .track { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; padding-top: 16px; }
.curve .bar span { position: relative; width: 100%; background: linear-gradient(var(--sun-1), var(--sun-2)); border-radius: 4px 4px 0 0; min-height: 2px; }
.curve .bar small { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.curve .bar b { position: absolute; bottom: 100%; left: 0; right: 0; text-align: center; font-size: .8rem; line-height: 16px; color: var(--muted); }
.issues { list-style: none; padding: 0; margin: 0; }
.issues li { padding: 4px 0 4px 20px; position: relative; font-size: .9rem; }
.issues li::before { position: absolute; left: 0; }
.issues .err::before { content: "✕"; color: var(--bad); }
.issues .warn::before { content: "!"; color: var(--warn); font-weight: 800; left: 4px; }
.issues .ok::before { content: "✓"; color: var(--ok); }
/* Builder: what's left to add, as neutral steps that tick off (not errors: an unfinished deck isn't a wrong one). */
.issues li.steps { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-left: 0; color: var(--muted); }
.issues li.steps::before { content: none; }
.issues .step { display: inline-flex; align-items: center; gap: 6px; }
.issues .step::before { content: ""; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 50%; flex: none; }
.issues .step b { color: var(--text); font-weight: 600; }
.issues .step.done { color: var(--ok); }
.issues .step.done::before { content: "✓"; border: 0; width: auto; height: auto; font-weight: 800; }
.badge.unfinished { color: var(--muted); border-style: dashed; }

/* ---------- hover preview ---------- */
#preview {
  position: fixed; z-index: 100; pointer-events: none; display: none; width: 260px; border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .7);
}
#preview img { display: block; width: 100%; }
#preview.wide { width: min(380px, 40vw); }

/* ---------- discovery tables ---------- */
.rate-table { width: 100%; border-collapse: collapse; }
.rate-table td, .rate-table th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
.rate-table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.meter { height: 6px; background: var(--panel-2); border-radius: 3px; width: 120px; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--sun-1), var(--sun-2)); }
.syn-pos { color: var(--ok); }
.syn-neg { color: var(--muted); }

.auth-box { max-width: 380px; margin: 40px auto; }
.auth-box p { margin: 0 0 12px; }
.auth-box .helptext, .auth-box ul { font-size: .8rem; color: var(--muted); }
.errorlist { color: var(--bad); }

@media (max-width: 800px) {
  .topbar { gap: 14px; padding: 0 16px; }
  .brand-text { display: none; }
  .nav { gap: 14px; }
  .nav a, .account a, .account button { white-space: nowrap; font-size: .9rem; }
  .account .btn:not(.feedback-btn) { display: none; }
  .container { padding: 20px 16px 40px; }
  .grid { grid-template-columns: 1fr; }
  .deck-table .hide-sm { display: none; }
  .hero { margin: -20px -16px 0; padding: 40px 16px; }
  .hero h1 { font-size: 1.9rem; }
  .home-search input[type=search] { height: 54px; font-size: 1.05rem; }
  .home-search kbd { display: none; }
  .scope { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; }
  .scope button { padding: 6px 10px; font-size: .82rem; }
  .home-features { grid-template-columns: 1fr; margin: 24px 0 32px; }
  .deck-head, .deck-body { grid-template-columns: 1fr; }
  .deck-head .commanders img { width: calc(50% - 5px); }
}

.set-heading { margin: 28px 0 12px; font-size: 1.1rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; }

/* ---------- leader page (EDHREC-style) ---------- */
/* The art and the info sit together in the middle of the page, with the info at a readable width. */
/* Leader page filters swap results in place (static/js/leader-filters.js): the parts dim briefly while they load. */
[data-leader-part] { transition: opacity .15s; }
[data-leader-part].is-loading { opacity: .55; }
.leader-hero { display: grid; grid-template-columns: auto minmax(0, 900px); justify-content: center; gap: 32px; margin-bottom: 36px; align-items: start; }
.leader-info h1 { font-size: 2.2rem; margin-bottom: 4px; }
.card-text { white-space: pre-line; max-width: 720px; }
.section { margin-bottom: 40px; }
.section-head { margin-bottom: 4px; }
.section-head h2 { margin: 0; }

/* Leader art in grids: the leader side only (both sides are on the leader's own page). */
.leader-thumb { width: 100%; aspect-ratio: 7 / 5; object-fit: cover; border-radius: 10px; display: block; background: #000; }
/* Leader page: leader side and deployed unit side at the same height. */
/* Same card turned sideways: the unit side is as wide as the leader side is tall, so both print at the
   same size. Top-aligned so they read as a pair. */
.leader-sides { display: flex; gap: 14px; align-items: flex-start; }
.leader-sides figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
.leader-sides img { width: calc(392px * var(--card-scale)); aspect-ratio: 7 / 5; object-fit: cover; border-radius: 12px; display: block; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.leader-sides figure + figure img { width: calc(280px * var(--card-scale)); aspect-ratio: 5 / 7; }
.leader-sides figcaption { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
@media (max-width: 1250px) { .leader-sides img { width: 308px; } .leader-sides figure + figure img { width: 220px; } }
/* Phones: the two sides stacked, full width, like the deck page's leaders. */
@media (max-width: 700px) { .leader-sides { flex-direction: column; align-items: stretch; } .leader-sides figure { width: 100%; } .leader-sides img, .leader-sides figure + figure img { width: 100%; } }

.partner-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(calc(220px * var(--card-scale)), 1fr)); margin-top: 12px; }
/* Five or more partners share the full row, like the card grids below; a short list keeps its tile size. */
.partner-grid:has(> :nth-child(5)) { grid-template-columns: repeat(auto-fit, minmax(calc(220px * var(--card-scale)), 1fr)); }
.partner { color: var(--text); border-radius: 12px; padding: 8px; border: 1px solid transparent; transition: transform .12s, border-color .12s, background .12s, box-shadow .12s; }
/* Hover: the tile lifts onto a panel with a light border, like the printings and deck tiles; the leader picture stays
   put inside it. The picked partner keeps its orange border (it's the active filter) and only lifts. */
.partner:is(:hover, :focus-visible) { text-decoration: none; background: var(--panel); transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.partner:not(.on):is(:hover, :focus-visible) { border-color: rgba(255, 255, 255, .35); }
.partner.on { border-color: var(--accent); background: var(--panel); }
.partner-name { font-weight: 700; margin-top: 8px; }
/* Leader page: share of decks per base aspect, with a bar in the aspect's colour. */
.base-filter { gap: 6px; margin: 4px 0 8px; }
.base-filter [data-card-size-picker] { margin-left: auto; }  /* stays right when the note wraps it */
.base-aspect-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(calc(280px * var(--card-scale)), 1fr));  /* the boxes share the row */ margin-top: 12px; }
.base-aspect { display: grid; gap: 6px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; position: relative; }
/* A base aspect box is the cards filter: its name link covers the box; the top base link sits above it. */
/* Hover: the same tile lift as the partner tiles above; the picked aspect keeps its orange border and only lifts. */
.base-aspect.pickable { transition: transform .12s, border-color .12s, box-shadow .12s; }
.base-aspect.pickable:is(:hover, :focus-within) { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }
.base-aspect.pickable:not(.on):is(:hover, :focus-within) { border-color: rgba(255, 255, 255, .35); }
.base-aspect.on.pickable:is(:hover, :focus-within) { box-shadow: 0 0 0 1px var(--accent), 0 10px 24px rgba(0, 0, 0, .45); }
.base-aspect.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.base-aspect-link { color: inherit; }
.base-aspect-link:hover { text-decoration: none; }
.base-aspect-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.base-aspect .small a { position: relative; z-index: 1; }
.base-aspect .share-bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.base-aspect .share-bar span { display: block; height: 100%; background: var(--muted); }
.base-aspect.Vigilance .share-bar span { background: var(--vigilance); }
.base-aspect.Command .share-bar span { background: var(--command); }
.base-aspect.Aggression .share-bar span { background: var(--aggression); }
.base-aspect.Cunning .share-bar span { background: var(--cunning); }

.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(calc(170px * var(--card-scale)), 1fr)); }
.stat-card img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 9px; display: block; }
.stat-name { font-weight: 600; font-size: .88rem; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-line { display: flex; justify-content: space-between; gap: 6px; font-size: .8rem; color: var(--muted); }

@media (max-width: 800px) {
  .leader-hero { grid-template-columns: 1fr; }
  .partner-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stat-line { flex-direction: column; }
}

/* Per-deck card settings shown on deck pages */
.card-line .cost.custom { background: var(--accent); color: #1a0f05; }
.foil-mark { color: #9fd8ff; }

/* Deck visibility, one-line description, primer */
.badge.vis-unlisted { color: #9fd8ff; border-color: rgba(159, 216, 255, .4); }
.badge.vis-private { color: var(--muted); }
.badge.retired { color: var(--muted); border-style: dashed; }
.badge.primer { color: var(--sun-1); border-color: color-mix(in srgb, var(--sun-1) 40%, transparent); }
.badge.no-primer { color: var(--muted); border-style: dashed; }
a.badge:hover { text-decoration: none; border-color: currentColor; }
.deck-summary-line { font-size: 1.05rem; color: #cfd5df; margin: -4px 0 8px; }
.tile-summary { font-size: .85rem; color: #cfd5df; margin: 2px 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Tabs (builder's Deck / Suggestions / Primer, deck page's Deck / Primer). */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  background: none; border: 0; color: var(--muted); padding: 8px 10px; font: inherit; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); text-decoration: none; }
.deck-tabs { margin-top: 18px; }
.primer { max-width: 860px; }
.primer-body, .primer-preview { line-height: 1.65; }
.primer-body h1, .primer-body h2, .primer-body h3, .primer-preview h1, .primer-preview h2, .primer-preview h3 { margin: 1.2em 0 .4em; }
.primer-body blockquote, .primer-preview blockquote { margin: 0; padding: 4px 14px; border-left: 3px solid var(--accent); color: #cfd5df; }
.primer-body code, .primer-preview code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.primer-body table, .primer-preview table { border-collapse: collapse; }
.primer-body th, .primer-body td, .primer-preview th, .primer-preview td { border: 1px solid var(--line); padding: 4px 8px; }

/* Deck lists: 3 decks per row with big leader art; shared filter bar */
/* One deck-tile size site-wide (deck lists, home, leader and card pages): 3 per row on desktop so
   each leader in the pair is big enough to read. */
.deck-grid { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.deck-grid .deck-tile .body { padding: 14px 16px; }
.deck-grid .deck-tile .name { font-size: 1.05rem; }
/* My decks: an empty tile that starts a new deck in the folder being viewed. Grid rows stretch it to its neighbours. */
.add-deck-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 240px;
  padding: 16px; text-align: center; background: transparent; border: 2px dashed var(--line); color: var(--muted);
}
.add-deck-tile:hover { border-color: var(--accent, #48505f); color: var(--text); }
.add-deck-tile .add-plus { font-size: 2.6rem; line-height: 1; font-weight: 300; }
.add-deck-tile .add-label { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.add-deck-tile .muted { overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.selecting .add-deck-tile { display: none; }
.deck-filters { display: grid; gap: 10px; margin-bottom: 22px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.deck-filters .filter-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.chip.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip.toggle:has(input:checked) { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
/* List: leaders big enough to recognise, then a smaller base. */
@media (max-width: 1100px) { .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .deck-table .deck-art { width: 340px; } }
@media (max-width: 700px) { .deck-grid { grid-template-columns: 1fr; } .deck-table .deck-art { width: 150px; } }

/* ---------- deck page (view) ---------- */
html:has(.deck-hero) { scrollbar-gutter: stable; }  /* the deck page's tabs don't shift it sideways either */
.deck-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 32px; margin-bottom: 28px; }
.hero-info { min-width: 0; }
.hero-info .hero-actions { padding-block: 26px; }  /* room around the buttons; the stats sit a little lower */
.hero-art { display: grid; gap: 12px; justify-items: start; align-content: start; }
.hero-leaders { display: flex; gap: 12px; }
/* Leader and base art grow with big screens (--card-scale), like the card grids. */
.deck-hero { --hero-leader-w: calc(300px * var(--card-scale)); }
.hero-leaders img { width: var(--hero-leader-w); aspect-ratio: 7 / 5; object-fit: cover; border-radius: 12px; display: block; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transition: translate .15s, box-shadow .15s; }
/* Each leader opens its page: the same neutral lift and edge as leader pictures elsewhere. */
.hero-leaders a:is(:hover, :focus-visible) img { translate: 0 -3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .85), 0 16px 34px rgba(0, 0, 0, .55); }
.hero-empty { width: var(--hero-leader-w); aspect-ratio: 7 / 5; border: 2px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.hero-base { display: grid; gap: 6px; justify-items: center; justify-self: center; }
.hero-base img { width: calc(225px * var(--card-scale)); aspect-ratio: 7 / 5; object-fit: cover; border-radius: 10px; display: block; }
.hero-info h1 { margin-bottom: 4px; }
.hero-sub { display: flex; align-items: flex-start; gap: 24px; }
.hero-sub-main { flex: 1; min-width: 0; }
.hero-sub-main p { margin: 0; }
.hero-by { padding-left: 14px; }
.hero-sub-main .deck-summary-line { margin-top: 6px; }
.hero-sub .deck-tags-line { flex: none; flex-wrap: nowrap; margin: 0; }
@media (max-width: 700px) { .hero-sub { flex-direction: column; gap: 8px; } .hero-sub .deck-tags-line { flex-wrap: wrap; } }
.hero-stats { display: grid; gap: 12px; }
.glance { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.glance-num b { font-size: 1.7rem; font-weight: 800; }
.glance-num b.ok { color: var(--ok); }
.glance-num span { color: var(--muted); margin-left: 4px; font-size: .9rem; }
.glance-legal { display: grid; gap: 6px; padding-top: 8px; }
.glance-badges { gap: 6px; }
.glance-legal .issues li { font-size: .82rem; padding-top: 1px; padding-bottom: 1px; }
.glance-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
/* Deck Makeup: types, aspects, tokens and the owner's highlights, a labeled line each. Every value filters the list. */
.makeup { display: grid; gap: 10px; align-content: start; }
.makeup .stat-title { margin-bottom: 0; }
.makeup-line { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; }
.makeup-line.highlights { padding-top: 10px; border-top: 1px solid var(--line); }
.makeup-vals { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.makeup-vals.tight { gap: 6px; }
.stat-val { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-weight: 700; }
.stat-val:first-child { margin-left: -8px; }
.stat-val:hover:not(:disabled) { background: var(--panel-2); }
.stat-val:disabled { color: var(--muted); }
.stat-val .pip { width: 22px; height: 22px; }
.stat-val .type-icon { margin: 0; }
.stat-chip { padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; }
.stat-chip b { color: var(--text); font-weight: 800; }
.stat-chip:hover { border-color: var(--muted); }
.stat-chip.add-stat { background: none; border-style: dashed; }
.stat-chip.add-stat:hover { border-color: var(--accent); color: var(--text); }
.glance-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.glance-box .row { margin-bottom: 4px; }
/* Tokens Needed: a chip per token; clicking one filters the decklist to its cards. Unit tokens, token upgrades and
   other tokens tinted apart. */
/* Stats you can click to highlight their cards, like the Tokens Needed chips. */
.stat-click { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.stat-click:disabled { cursor: default; }
.curve .bar.stat-click:hover:not(:disabled) small { color: var(--text); }
[data-cards], [data-focus] { transition: box-shadow .16s, background-color .16s, border-color .16s; }
.deck-view .view-tile { transition: transform .12s, box-shadow .12s, opacity .15s, filter .15s, outline-color .15s; }
[data-cards][aria-pressed="true"], [data-focus][aria-pressed="true"] { border-radius: 6px; box-shadow: 0 0 0 1.5px var(--sun-1); }
.token-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.token-chip { font-size: .82rem; padding: 3px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--muted); cursor: pointer; color: inherit; font: inherit; font-size: .82rem; }
.token-chip:hover { border-color: var(--muted); }
.token-chip[aria-pressed="true"] { background: var(--panel); border-color: var(--sun-1); box-shadow: 0 0 0 1px var(--sun-1); }
.token-filter-note[hidden] { display: none; }
.token-filter-note { animation: ease-pop .16s ease-out; }
/* Things that appear ease in, and highlights fade, on the deck page and in the builder. */
@keyframes ease-pop { from { opacity: 0; transform: translateY(-4px); } }
.menu[open] > .menu-items, .move-menu, .name-suggest:not([hidden]), .highlight-chooser { animation: ease-pop .14s ease-out; }
.select-bar:not([hidden]) { animation: ease-rise .18s ease-out; }
@keyframes ease-rise { from { opacity: 0; transform: translate(-50%, 10px); } to { transform: translateX(-50%); } }
.card-line, .view-tile, .deck-item { transition: opacity .15s, filter .15s, background-color .15s, box-shadow .15s, outline-color .15s; }
.stat-chip, .token-chip, .chip, .stat-val, .deck-group > h3, .deck-section > h3 { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
[data-section] { transition: outline-color .12s, background-color .12s; }
@media (prefers-reduced-motion: reduce) {
  .token-filter-note, .menu[open] > .menu-items, .move-menu, .name-suggest:not([hidden]), .highlight-chooser, .select-bar:not([hidden]) { animation: none; }
  .card-line, .view-tile, .deck-item, .stat-chip, .token-chip, .chip, .stat-val, .deck-group > h3, .deck-section > h3, [data-section] { transition: none; }
}
/* A token chosen: its cards keep full colour with a highlight; the rest grey out but stay clickable. */
.token-filtered [data-uid]:not(.token-match) { opacity: .35; filter: grayscale(1); }
.token-filtered [data-uid]:not(.token-match):hover { opacity: .7; }
.token-filtered .card-line.token-match { background: color-mix(in srgb, var(--sun-1) 14%, transparent); box-shadow: inset 3px 0 0 var(--sun-1); border-radius: 4px; }
.token-filtered .view-tile.token-match { outline: 3px solid var(--sun-1); outline-offset: 1px; border-radius: 8px; }
.token-filter-note .link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.token-filter-note .link-btn:hover { text-decoration: underline; }
.token-filter-note { scroll-margin-top: 68px; margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.token-chip.unit { border-left-color: var(--sun-1); }
.token-chip.upgrade { border-left-color: var(--vigilance); }
.stat-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.curve.mini { height: 90px; gap: 4px; }
.icon-counts { display: flex; flex-wrap: wrap; gap: 12px; font-weight: 700; }
.icon-counts > :is(span, button) { display: inline-flex; align-items: center; gap: 4px; }
.icon-counts .pip { width: 22px; height: 22px; }

/* Bigger text wherever a decklist is shown. The builder's block matches. */
.deck-view .card-line { font-size: .98rem; padding-block: 3px; }
.deck-view .card-line .cost { width: 23px; height: 23px; font-size: .8rem; }
.deck-view-bar, .deck-view-bar select { font-size: .95rem; }
.deck-view-bar .view-toggle a { font-size: .92rem; }
.deck-tabs .tab { font-size: 1.04rem; }
.deck-group h3 { font-size: 1.08rem; }
.deck-view-bar { margin-bottom: 14px; gap: 14px; flex-wrap: wrap; }
.deck-view-bar label { flex-wrap: nowrap; }
.deck-view-bar select { width: auto; }
.deck-view .secondary { opacity: .45; }
.deck-group h3 .pips { vertical-align: -3px; }
/* List: laid out like Stacks. Sections sit side by side and wrap to the next row; a long section takes several columns
   under its one heading, so a group reads as one block. */
.deck-view.list { display: flex; flex-wrap: wrap; gap: 20px 24px; align-items: flex-start; margin-inline: auto; }
.deck-view.list .deck-group { margin: 0; max-width: 100%; }
.deck-view.list .group-body { display: flex; flex-wrap: wrap; gap: 0 24px; align-items: flex-start; }
.deck-view.list .list-col { flex: none; width: var(--list-col, 320px); max-width: 100%; }  /* card-size.js sets the width */
.list-break { flex-basis: 100%; height: 0; margin-top: -20px; }  /* ends the top row in the Type grouping */
.list-flow .list-break { display: none; }
.deck-view.list .list-col .nm { white-space: normal; overflow: visible; }  /* the whole name, on two lines if it needs them */
@media (max-width: 700px) { .deck-view.list .deck-group, .deck-view.list .list-col { width: 100%; } }
/* Stacks: each section is one or more columns of overlapping cards showing only their top strip (cost, name).
   margin-top percentages are of the column's width; a card is 140% of its width tall, so -116% leaves a strip of
   24% of the width (about 17% of the card). static/js/stacks.js gives the card under a resting pointer .peek,
   which drops the overlap on the next card so the whole card shows, and slides the cards that move. */
.deck-view.stacks { display: flex; flex-wrap: wrap; gap: 18px 22px; align-items: flex-start; }
.deck-view.stacks .deck-group { margin: 0; }
.deck-view.stacks .group-body { display: flex; gap: 10px; align-items: flex-start; }
.deck-view.stacks .stack { width: var(--card-w); display: flex; flex-direction: column; padding-bottom: 4px; }
.deck-view.stacks .view-tile { flex: none; box-shadow: 0 -2px 6px rgba(0, 0, 0, .55); }
.deck-view.stacks .view-tile + .view-tile { margin-top: -116%; }
.deck-view.stacks .view-tile.peek + .view-tile { margin-top: 0; }  /* .peek and the slide: static/js/stacks.js */
.deck-view.stacks a.view-tile:hover { transform: none; box-shadow: 0 -2px 6px rgba(0, 0, 0, .55); }  /* stacks slide instead; the line still shows */
.deck-view.stacks .view-tile .tile-qty { top: 4px; left: auto; right: 6px; }
/* Phones: one wider stack per row (as in the builder), so each card's name strip is big enough to read. */
@media (max-width: 700px) {
  .deck-view.stacks .deck-group { width: 100%; }
  .deck-view.stacks .group-body { flex-direction: column; align-items: center; gap: 14px; }
  .deck-view.stacks .stack { width: min(240px, 68vw); }
}
/* On deck pages the whole row opens the card page: the name link is stretched over the row. */
.deck-view .card-line { position: relative; cursor: pointer; }
.deck-view .card-line .nm a::after { content: ""; position: absolute; inset: 0; }
.deck-view .card-line:hover .nm a { color: var(--sun-1); }
.deck-view .card-line .penalty, .deck-view .card-line .cost.custom { position: relative; z-index: 1; }  /* keep their tooltips */
.deck-view .deck-group { margin-bottom: 20px; }
.deck-view.images .group-body { display: grid; gap: 10px; grid-template-columns: var(--grid-template, repeat(auto-fill, minmax(min(var(--card-w), 100%), 1fr))); }
/* Rounded like the card itself (5%) with no backing of its own, so no black shows at the corners (the image brings a
   loading placeholder). Hover: a small lift and an orange line drawn just inside the card's edge, like the builder's
   card images (::before; ::after is the foil shine). isolation keeps that line inside its own card, so in Stacks the cards
   on top still cover it and it fills in as they slide away. */
.view-tile { position: relative; isolation: isolate; display: block; border-radius: 5%; overflow: hidden; aspect-ratio: 5 / 7;
  color: inherit; transition: transform .12s, box-shadow .12s; }
a.view-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .5); text-decoration: none; }
.view-tile::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .12s;
}
a.view-tile:hover::before { box-shadow: inset 0 0 0 2px var(--accent); }
.view-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.view-tile .tile-qty, .view-tile .tile-pen {
  position: absolute; font-size: .8rem; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: rgba(0, 0, 0, .8);
}
.view-tile .tile-qty { top: 6px; left: 6px; }
.view-tile .tile-pen { bottom: 6px; left: 6px; color: var(--warn); }
/* Foil (deck page, builder tiles, the builder's card panel): two soft diagonal rainbows over the printed card. On Standard
   printings it fades out over the black border, so that stays black; two fades, across and down, and the foil shows
   fully only where both are solid. Leaders and bases are landscape, so theirs swap (.wide). Hyperspace, Prestige, most
   promos and the like have no black border, so the foil covers the whole card (.foil-full). */
:is(.view-tile, .deck-tile-img, .info-img, #preview).foil::after {
  --foil-x: transparent 2.5%, #000 8%, #000 92%, transparent 97.5%;
  --foil-y: transparent 1.8%, #000 5.8%, #000 94.2%, transparent 98.2%;
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: hard-light; opacity: .23;
  background: linear-gradient(135deg, #ff5f6d, #ffb347 8%, #fff176 16%, #6fe39a 25%, #5cc8ff 33%, #8f7bff 41%, #ff6fd8 46%, #ff5f6d 50%, #ffb347 58%, #fff176 66%, #6fe39a 75%, #5cc8ff 83%, #8f7bff 91%, #ff6fd8);
  -webkit-mask: linear-gradient(90deg, var(--foil-x)), linear-gradient(180deg, var(--foil-y));
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.info-img.wide.foil::after {
  --foil-x: transparent 1.8%, #000 5.8%, #000 94.2%, transparent 98.2%;
  --foil-y: transparent 2.5%, #000 8%, #000 92%, transparent 97.5%;
}
:is(.view-tile, .deck-tile-img, .info-img, #preview).foil.foil-full::after { -webkit-mask: none; mask: none; }
@media (max-width: 1250px) {
  .deck-hero { grid-template-columns: 1fr; }
  .glance-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .hero-leaders img, .hero-empty { width: calc(50vw - 24px); }
  .hero-base img { width: 60vw; }
  .glance-grid { grid-template-columns: 1fr; }
  .deck-view.images .group-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Leader rankings */
.leader-art { position: relative; }
.rank {
  position: absolute; top: 8px; left: 8px; padding: 2px 9px; border-radius: 99px; font-weight: 800; font-size: .85rem;
  /* Grey, not near-black, so it stands out from the page as well as from the art (Cards tiles sit on the page itself). */
  background: #2d3441; color: #d5d9e1; border: 1px solid #424a59; box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
/* On the leaders page the rank sits centred under the art. */
.rank-line { display: flex; justify-content: center; margin-top: -12px; position: relative; }
.rank-line .rank { position: static; padding: 3px 14px; font-size: .9rem; }
/* Top three: gold, silver and bronze medals. */
.rank.medal-1, .rank.medal-2, .rank.medal-3 { border: 0; color: #1a1206; box-shadow: 0 2px 10px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .5); }
.rank.medal-1 { background: linear-gradient(135deg, #fff1a8, #f5c542 45%, #c8901a); }
.rank.medal-2 { background: linear-gradient(135deg, #ffffff, #cfd6df 45%, #8e98a6); }
.rank.medal-3 { background: linear-gradient(135deg, #ffd2a8, #d4874a 45%, #8f4f22); }

/* ---------- card pages (shared look with the builder's card info panel) ---------- */
/* The card and its info sit together in the middle of the page, like the leader page. */
.card-hero { display: grid; grid-template-columns: minmax(0, clamp(300px, 22vw, 440px)) minmax(0, 760px); justify-content: center;
  gap: 32px; margin-bottom: 30px; align-items: start; }
.card-hero-art img { width: 100%; border-radius: 14px; display: block; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.info-sub { color: var(--muted); margin-top: 2px; }
.info-tags, .info-traits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.info-tags .pip { width: 22px; height: 22px; }
.tag { font-size: .8rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); }
.trait { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.trait + .trait::before { content: "·"; margin-right: 6px; }
.stats-row { display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
/* Card and leader pages: the sets a card was printed in, newest first. */
.card-sets { margin: 4px 0 14px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.card-sets .filter-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.card-sets ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.card-sets li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.card-sets .set-code { flex: none; min-width: 52px; font-size: .8rem; font-weight: 800; color: var(--accent); }
.card-sets .set-name { font-weight: 600; }
.stat { display: grid; justify-items: center; min-width: 64px; padding: 6px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.stat b { font-size: 1.25rem; line-height: 1.1; }
.stat span { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ability { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; border-left: 3px solid var(--line); }
.ability-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.ability p { margin: 4px 0 0; white-space: pre-line; font-size: .93rem; }
.printings { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(calc(140px * var(--card-scale)), 1fr)); }
.printing { display: grid; gap: 2px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; text-align: left; }
.printing img { width: 100%; border-radius: 6px; display: block; margin-bottom: 4px; }
.printing-name { font-weight: 700; font-size: .85rem; }
.printing-meta { font-size: .8rem; color: var(--muted); }
.rulings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 860px; }
.rulings li { background: var(--panel-2); border-radius: 10px; padding: 10px 14px; }
.rulings p { margin: 2px 0 0; font-size: .92rem; }
.ruling-date { font-size: .8rem; color: var(--muted); font-weight: 600; }
.source-note { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
a.stat-card { color: var(--text); }
/* Card thumbnails (Cards page, leader and card pages, trending cards): the same lift as deck tiles, with an orange
   outline. The one hover that's orange on purpose: picking a card out of a grid of them reads better with it. */
a.stat-card:is(:hover, :focus-visible) { text-decoration: none; }
a.stat-card img { transition: translate .12s, box-shadow .12s; }
a.stat-card:is(:hover, :focus-visible) img { translate: 0 -4px; box-shadow: 0 0 0 2px var(--accent), 0 12px 28px rgba(0, 0, 0, .5); }
.card-grid.browse img.wide { aspect-ratio: 7 / 5; }
/* The Cards page, the leader page's card sections and a card's Often Played With follow the Card size picker (M/L),
   like the deck and builder grids; phones keep three per row. */
.card-grid.browse, .card-grid.sized { grid-template-columns: var(--grid-template, repeat(auto-fill, minmax(min(var(--card-w), 100%), 1fr))); }
@media (max-width: 800px) { .card-grid.browse, .card-grid.sized { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-line .nm a { color: inherit; }
.card-line .nm a:hover { color: var(--sun-1); text-decoration: none; }
@media (max-width: 800px) { .card-hero { grid-template-columns: 1fr; } .card-hero-art { max-width: 280px; } }

/* Dropdown menu built on <details> (deck page Export) */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-items {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 250px; padding: 6px; display: grid; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.menu-items a { display: grid; padding: 7px 10px; border-radius: 7px; color: var(--text); }
.menu-items a:hover { background: var(--panel); text-decoration: none; }
.menu-items a span, .menu-items button span { font-size: .8rem; color: var(--muted); }
.menu-items button {
  display: grid; gap: 1px; padding: 7px 10px; border-radius: 7px; color: var(--text); background: none; border: 0;
  font: inherit; text-align: left; cursor: pointer; width: 100%;
}
.menu-items button:hover { background: var(--panel); }
.menu-items button.danger b { color: var(--bad); }
.menu-items button[hidden] { display: none; }
.menu-items hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.menu-items.align-right { left: auto; right: 0; }
.menu-items { max-width: calc(100vw - 16px); }  /* and base.html shifts one back on screen if it runs off an edge */

/* Breadcrumbs: top-left trail back to the list a page belongs to */
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); margin: -8px 0 16px; min-width: 0; }
.breadcrumbs a { color: var(--muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--sun-1); text-decoration: none; }
.breadcrumbs [aria-current] { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Phones: just the way up, "‹ Decks" (the level above this page), since the page title right below already says
   where you are. A touch-sized target. */
@media (max-width: 700px) {
  .breadcrumbs > :not(a:last-of-type) { display: none; }
  .breadcrumbs a:last-of-type { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; color: var(--text); }
  .breadcrumbs a:last-of-type::before { content: "‹"; font-size: 1.4em; line-height: 1; color: var(--sun-1); margin-top: -2px; }
  .breadcrumbs { margin: -16px 0 8px; }
}

/* Large image viewer (card page printings and art) */
.zoomable { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; width: 100%; }
button.printing { cursor: zoom-in; }
/* Printings (card and leader pages) open a larger view, so they hover like other "look closer" items: the tile's
   tile lifts with a lighter border and a shadow; the picture stays put inside it. Neutral, as it isn't an action. */
.printing { transition: border-color .12s, translate .15s, box-shadow .15s; }
button.printing:is(:hover, :focus-visible), .printing:has(.zoomable:is(:hover, :focus-visible)) {
  border-color: rgba(255, 255, 255, .35); translate: 0 -3px; box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}
/* Leader printings: landscape leader side, so fewer per row; the deployed side opens from a link under it. */
.leader-printings { grid-template-columns: repeat(auto-fill, minmax(calc(200px * var(--card-scale)), 1fr)); }
.leader-printings .printing { align-content: start; }
@media (max-width: 520px) { .leader-printings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.leader-printings .link-btn { justify-self: start; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: .8rem; cursor: zoom-in; }
.leader-printings .link-btn:hover { text-decoration: underline; }
.lightbox {
  width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent;
  display: none; align-items: center; justify-content: center; gap: 16px;
}
.lightbox[open] { display: flex; }
.lightbox::backdrop { background: rgba(0, 0, 0, .85); }
.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; pointer-events: none; }
.lightbox img { max-height: 82vh; max-width: min(90vw, 640px); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .7); }
.lightbox figcaption { color: var(--text); font-weight: 600; text-align: center; }
.lightbox button {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font-size: 1.8rem; line-height: 1; cursor: pointer;
}
.lightbox button:hover { border-color: var(--accent); }
.lightbox .lb-close { position: fixed; top: 20px; right: 20px; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { visibility: hidden; }

/* Card page: top 6 leaders / pairings in one row on desktop */
.top-grid { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 12px; }
.pair-art { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border-radius: 10px; overflow: hidden; background: #000; }
.pair-art img { width: 100%; aspect-ratio: 7 / 5; object-fit: cover; display: block; }
@media (max-width: 1300px) { .top-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Card page: leaders 5 per row like the Leaders page; pairs 3 per row so each leader is about single-tile size. */
.top-grid.top-leaders { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.top-grid.top-pairs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.pair-name span { display: block; }
@media (max-width: 1100px) { .top-grid.top-leaders { grid-template-columns: repeat(3, minmax(0, 1fr)); } .top-grid.top-pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .top-grid.top-leaders { grid-template-columns: repeat(2, minmax(0, 1fr)); } .top-grid.top-pairs { grid-template-columns: 1fr; } }

/* Epic Action / deploy ability: tagged so it stands apart from the card's other text */
.ability.epic { border-left-color: var(--accent); background: rgba(255, 154, 61, .07); }
.epic-tag {
  display: inline-block; font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 99px; background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); color: #1a0f05;
}

/* ---------- error pages ---------- */
.error-page { max-width: 560px; margin: 60px auto; text-align: center; }
.error-page h1 { margin: 6px 0 8px; }
.error-code {
  font-size: 4.5rem; font-weight: 800; line-height: 1; letter-spacing: -.02em;
  background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.error-links { justify-content: center; margin-top: 20px; }

/* ---------- phone menu ---------- */
.topbar-links { display: contents; }
.menu-toggle { display: none; }
@media (max-width: 700px) {
  .brand-text { display: inline-flex; }
  .menu-toggle {
    display: grid; place-items: center; margin-left: auto; width: 40px; height: 40px; padding: 0;
    background: none; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
  }
  /* Three-line icon that turns into an × when open. */
  .menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
    display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; position: relative; transition: transform .15s, background .15s;
  }
  .menu-toggle span::before, .menu-toggle span::after { content: ""; position: absolute; left: 0; }
  .menu-toggle span::before { top: -6px; }
  .menu-toggle span::after { top: 6px; }
  .topbar.open .menu-toggle span { background: transparent; }
  .topbar.open .menu-toggle span::before { transform: translateY(6px) rotate(45deg); }
  .topbar.open .menu-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

  .topbar-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column;
    background: #0a0c10; border-bottom: 1px solid var(--line); padding: 6px 16px 14px; box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
  }
  .topbar.open .topbar-links { display: flex; }
  .topbar-links .nav, .topbar-links .account { flex-direction: column; align-items: stretch; gap: 0; }
  .topbar-links .account { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
  .topbar-links .nav a, .topbar-links .account a, .topbar-links .account button {
    display: block; padding: 12px 4px; font-size: 1rem; text-align: left; width: 100%;
  }
  .topbar-links .nav a.active, .topbar-links .account a.active { color: var(--accent); text-decoration: none; }
  .topbar-links .account .btn { display: flex; justify-content: center; margin-top: 8px; }
  /* In the phone menu the account menu opens in place, under your username, and starts open. */
  .topbar-links .account-menu summary { padding: 12px 4px; font-size: 1rem; text-decoration: none; justify-content: space-between; }
  .topbar-links .account-menu .menu-items { position: static; min-width: 0; padding: 0 0 0 12px; background: none; border: 0; box-shadow: none; animation: none; }
  .topbar-links .account-menu .menu-items a, .topbar-links .account-menu .menu-items button { padding: 10px 4px; }
  .topbar-links .account-menu .menu-items hr { margin: 4px 0; }
}

/* ---------- site dialogs (static/js/dialog.js) ---------- */
.site-dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px 22px;
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.site-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.site-dialog form { display: grid; gap: 12px; margin: 0; }
.site-dialog h2 { margin: 0; font-size: 1.15rem; }
.site-dialog .sd-message { margin: 0; color: #cfd5df; line-height: 1.5; }
.site-dialog .sd-field { display: grid; gap: 6px; }
.site-dialog .sd-field[hidden], .site-dialog .sd-message[hidden] { display: none; }
.site-dialog .sd-choices { display: grid; gap: 6px; }
.site-dialog .sd-choices[hidden] { display: none; }
.site-dialog .sd-choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer;
}
.site-dialog .sd-choice:has(input:checked) { border-color: var(--accent); background: var(--panel-2); }
.site-dialog .sd-choice input { margin-top: 3px; accent-color: var(--accent); }
.site-dialog .sd-choice span { display: grid; gap: 1px; }
.site-dialog .sd-choice small { color: var(--muted); font-size: .8rem; }
.site-dialog .sd-error { margin: -4px 0 0; color: var(--bad); font-size: .85rem; min-height: 0; }
.site-dialog .sd-error:empty { display: none; }
.site-dialog .sd-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.btn.danger-solid { background: var(--bad); border-color: var(--bad); color: #1a0606; }

/* ---------- filter panels: always open on desktop, collapsed behind "Filters (n)" on phones ---------- */
.filter-panel > summary { display: none; list-style: none; }
/* Live filters (filters.js): the old results dim while the new ones load. */
[data-live-results] { transition: opacity .15s; }
[data-live-results].is-loading { opacity: .45; }
.filter-panel > summary::-webkit-details-marker { display: none; }
@media (max-width: 700px) {
  .filter-panel > summary { display: inline-flex; margin-bottom: 12px; }
  .filter-panel[open] > summary { margin-bottom: 10px; }
  .filter-panel > summary.has-active { border-color: var(--accent); color: var(--text); }
  /* Open, the button reads "Hide filters" with its caret flipped and looks pressed, so tapping it again clearly closes. */
  .filter-panel[open] > summary { background: var(--panel); border-color: #3d4554; }
  .filter-panel > form { overflow: hidden; }  /* for the open/close slide (filters.js) */
}
.filter-panel > summary .caret { width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; transition: transform .15s; }
.filter-panel[open] > summary .caret { transform: rotate(180deg) translateY(4px); }

/* ---------- phones: touch-sized controls ---------- */
/* Chips, small buttons and toggles at least 44px tall (Apple's guideline), with a little more room between chips. */
@media (max-width: 700px) {
  .chip { min-height: 44px; padding-block: 8px; padding-inline: 14px; }
  .tag-menu .chip { display: inline-flex; align-items: center; }
  .chips { gap: 8px; }
  .btn.sm { min-height: 44px; padding-inline: 16px; }
  .view-toggle a { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding-inline: 18px; }
}

/* Phones: moving between pages (or applying a filter) cross-fades instead of flashing; the top bar and an open filter
   panel stay put while the rest changes. Browsers without view transitions just load the page as before. */
@media (max-width: 700px) and (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .topbar { view-transition-name: topbar; }
  .filter-panel[open] { view-transition-name: filter-panel; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

/* ---------- toasts (static/js/toast.js) ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px 11px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-size: .9rem; line-height: 1.4; animation: toast-in .18s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--bad); }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast button:hover { color: var(--text); }
.toast .toast-action { font-size: .85rem; font-weight: 600; color: var(--accent); padding: 2px 6px; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 700px) { .toasts { right: 16px; left: 16px; bottom: 16px; width: auto; } }

/* Deck lists: count and "Load more" under the tiles/rows */
.load-more { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 24px; }

/* ---------- image placeholders ----------
   Card art comes from swu-db and can take a moment: show a soft card-coloured panel in its place (the images are
   opaque, so they cover it once loaded). Every one of these reserves its size, so nothing jumps when art arrives. */
.deck-art img, .stat-card img, .leader-card img, .leader-sides img, .hero-leaders img, .hero-base img,
.card-hero-art img, .printing img, .pair-art img, .leader-art img, .result img, .deck-tile-img img, .sug-tile img,
.slot img, .info-img img {
  background: linear-gradient(135deg, #1d222b, #14171d 60%, #1a1e26);
}
.card-hero-art img { aspect-ratio: 5 / 7; object-fit: cover; }
/* Card page printings only (the builder's info panel has its own sizes). */
section.section .printing img { aspect-ratio: 5 / 7; object-fit: cover; }
.card-hero-art img.wide, section.section .printing img.wide { aspect-ratio: 7 / 5; }

/* Show/Hide toggle inside password fields (static/js/password.js) */
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 64px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 3px 8px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer;
}
.password-toggle:hover { color: var(--text); }

/* ---------- deck history ---------- */
.history { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 12px; max-width: 900px; }
.history-entry { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.history-head { display: flex; align-items: center; gap: 10px; }
.history-head form { margin: 0; }
.history-when { font-weight: 700; }
.history-note { margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: rgba(255, 154, 61, .06); border-radius: 4px; }
.history-changes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 18px; margin-top: 10px; }
.change { font-size: .9rem; padding: 2px 0; }
.change a { color: var(--text); }
.change b { display: inline-block; min-width: 26px; }
.change.in b { color: var(--ok); }
.change.out b { color: var(--bad); }
.change.move b { color: var(--sun-1); }
.history-filter { margin: 14px 0 0; gap: 8px; align-items: center; }
.history-section { margin-top: 12px; }
.history-section h3 { margin: 0 0 4px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.history-section .history-changes { margin-top: 0; }
/* Blocks: In (green), Out (red), Moved to not counted (amber), with a coloured edge so they read apart. */
.history-section { border-left: 3px solid var(--line); padding-left: 10px; }
.history-section[data-kind="in"] { border-color: var(--ok); }
.history-section[data-kind="in"] h3 { color: var(--ok); }
.history-section[data-kind="out"] { border-color: var(--bad); }
.history-section[data-kind="out"] h3 { color: var(--bad); }
.history-section[data-kind="aside"] { border-color: var(--sun-1); }
.history-section[data-kind="aside"] h3 { color: var(--sun-1); }
.change { display: block; color: var(--text); }
.change:hover { text-decoration: none; }
.change:hover .change-name { color: var(--sun-1); }
.change.aside b { color: var(--sun-1); }
.change-where { color: var(--muted); font-size: .8rem; }
.change-art { display: none; }
/* Images view: card tiles with the change on a badge and where it went underneath. */
.history.images .history-changes { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.history.images .change { position: relative; padding: 0; font-size: .8rem; }
.history.images .change-art { display: block; width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 7px; background: #000; }
.history.images .change-art.wide { aspect-ratio: 7 / 5; }
.history.images .change b { position: absolute; top: 5px; left: 5px; min-width: 0; padding: 1px 7px; border-radius: 99px;
  background: rgba(0, 0, 0, .85); font-size: .8rem; }
.history.images .change-name { display: none; }
.history.images .change-where { display: block; margin-top: 3px; line-height: 1.25; }
.history.images .change.out .change-art { opacity: .55; filter: grayscale(.6); }
.detail-change { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; font-size: .9rem; padding: 3px 0; }
.detail-label { min-width: 90px; font-weight: 700; }
.detail-change .was { color: var(--muted); text-decoration: line-through; }
.detail-change details { flex: 1; min-width: 240px; }
.detail-change summary { cursor: pointer; color: var(--sun-1); }
.text-diff { margin-top: 6px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  font-size: .84rem; white-space: pre-wrap; max-height: 320px; overflow: auto; }
.text-diff .in b { color: var(--ok); }
.text-diff .out { color: var(--muted); }
.text-diff .out b { color: var(--bad); }
.change-chip { font-size: .8rem; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); }
.change-chip.in { color: var(--ok); }
.change-chip.out { color: var(--bad); }

/* ---------- top-bar search (static/js/site-search.js) ---------- */
.site-search { position: relative; width: min(340px, 28vw); margin-right: 8px; }
.site-search input { padding: 6px 30px 6px 10px; font-size: .88rem; background: var(--panel); }
/* The "/" shortcut as a key badge (like the home search), not text in the placeholder; it steps aside once you type. */
.site-search kbd { position: absolute; right: 8px; top: 50%; translate: 0 -50%; font: 600 .8rem var(--font); color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; pointer-events: none; }
.site-search input:is(:focus, :not(:placeholder-shown)) ~ kbd, .touch-ui .site-search kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); right: 0; width: max(100%, 420px); max-height: 70vh; overflow-y: auto; z-index: 60;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6);
}
.search-results[hidden] { display: none; }
.search-hit { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; color: var(--text); }
.search-hit:hover, .search-hit.on { background: var(--panel); text-decoration: none; }
.search-hit.on { outline: 1px solid var(--accent); }
.hit-art { width: 40px; aspect-ratio: 5 / 7; border-radius: 4px; overflow: hidden; background: #14171d; justify-self: center; }
.hit-art.wide { width: 56px; aspect-ratio: 7 / 5; }
.hit-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* People have no picture: a round initial instead. */
.hit-art:has(.hit-initial) { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; }
.hit-initial { font-weight: 700; color: var(--muted); }
.hit-text { display: grid; min-width: 0; }
.hit-text b, .hit-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-text span { font-size: .8rem; color: var(--muted); }
.hit-kind { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.search-empty { padding: 10px; color: var(--muted); font-size: .88rem; }
@media (max-width: 1000px) { .site-search { width: 200px; } }
/* Phones: the search box is the first thing in the menu panel. */
@media (max-width: 700px) {
  .topbar-links .site-search { order: -1; width: auto; margin: 8px 0 6px; }
  .search-results { width: 100%; left: 0; }
}

/* Type-to-search leader picker (static/js/leader-picker.js); its list reuses the top-bar search styles. */
.leader-picker { position: relative; flex: 1 1 220px; }
.leader-picker .search-results { left: 0; right: auto; width: max(100%, 360px); max-height: 420px; }
.leader-picker .search-hit { grid-template-columns: 56px minmax(0, 1fr); }
.leader-picker .search-hit.clear { display: block; color: var(--muted); }

/* ---------- card-type icons on decklist sections (deck page and builder) ---------- */
/* How many of each card type a Cost group holds (builder and deck page). */
.type-counts { display: inline-flex; gap: 10px; margin-left: 12px; font-size: .8rem; font-weight: 600; color: var(--muted);
  text-transform: none; letter-spacing: 0; vertical-align: 1px; }
.type-counts > span { display: inline-flex; align-items: center; }
.type-counts .type-icon { width: 12px; height: 12px; margin-right: 3px; vertical-align: 0; }
.type-icon { display: inline-block; width: 15px; height: 15px; margin-right: 6px; vertical-align: -2px; flex: none;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; background: var(--muted); }
.type-icon.t-ground { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M2%2021%209%208l4%206%203-4%206%2011z%27/%3E%3C/svg%3E"); background: #c49a6c; }
.type-icon.t-space { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M12%202l5%2013-5-2-5%202zM10%2016h4l-2%206z%27/%3E%3C/svg%3E"); background: #5aa9e6; }
.type-icon.t-event { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M13%202%204%2014h7l-1%208%2010-13h-7z%27/%3E%3C/svg%3E"); background: #e2b93b; }
.type-icon.t-upgrade { --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M12%203l8%208h-5v10H9V11H4z%27/%3E%3C/svg%3E"); background: #9b8cff; }

/* Aspect accent: a thin stripe in the deck's aspect colours across the top of its art, so lists scan by colour.
   Segments sit 2px apart on a dark ground, so white (Heroism) and black (Villainy) stay distinct.
   Villainy is black with a light inner outline so it still shows on dark art and the dark page. */
.deck-art { position: relative; }

/* Deck tags (Aggro, Budget, ...): small neutral chips on tiles, list rows and the deck page. */
.deck-tags-line { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.deck-tag { font-size: .8rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; color: var(--muted);
  background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.hero-info .deck-tags-line { margin: 8px 0; }
.hero-info .deck-tag { font-size: .8rem; padding: 2px 10px; }

/* ---------- accounts: settings, profile, sign-in buttons ---------- */
/* One column of grouped rows. A row's button sits top right; opening it drops the form in below the row's text. */
.settings-page { max-width: 760px; margin: 0 auto; }
.settings-group { margin-top: 26px; padding: 20px; }
.settings-group h2 { margin: 0 0 14px; font-size: 1.05rem; }
.danger-zone { border-color: rgba(255, 107, 107, .35); }
.danger-zone h2 { color: var(--bad); }
.set-row { position: relative; padding: 16px 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.set-row + .set-row { margin-top: 10px; }
.danger-zone .set-row { border-color: rgba(255, 107, 107, .25); }
.set-info h3, .set-info h3 + p { padding-right: 104px; }  /* clear of the button; lines below it can run full width */
.set-info h3 { margin: 0 0 6px; font-size: .95rem; }
.set-info p { margin: 0 0 10px; line-height: 1.5; overflow-wrap: anywhere; }
.set-info p:last-child { margin-bottom: 0; }
.set-info form { margin: 0 0 12px; }
.set-row > details > summary, .set-row > .set-action { position: absolute; top: 14px; right: 14px; }
@media (max-width: 700px) { .settings-group { padding: 16px 14px; } .set-row { padding: 14px; } }
.set-row > details > summary { list-style: none; }
.set-row > details > summary::-webkit-details-marker { display: none; }
.set-row > details .if-open, .set-row > details[open] .if-closed { display: none; }
.set-row > details[open] .if-open { display: inline; }
.set-row > details > form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.set-row > details > form > * { max-width: 420px; }
.set-row > details > form p { margin: 0 0 14px; line-height: 1.5; }
.set-row > details > form input:not([type="checkbox"]) { width: 100%; }
.set-row .helptext, .set-row form ul { font-size: .8rem; color: var(--muted); }
.social-mark { font-weight: 700; }
.social-mark.discord { color: #8b95ff; }
.social-mark.google { color: #8ab4f8; }
.social-buttons { display: grid; gap: 8px; margin-bottom: 4px; }
.social-btn { justify-content: center; font-weight: 600; }
.social-btn.discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.social-btn.google { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.or-line { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.profile-head { gap: 14px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; font-weight: 800;
  color: #1a0f05; background: linear-gradient(135deg, var(--sun-1), var(--sun-2)); flex: none; }

/* ---------- My decks folders (static/js/folders.js) ---------- */
.folder-icon {
  display: inline-block; width: 16px; height: 16px; vertical-align: -2px; margin-right: 6px; background: var(--sun-1);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
  --icon: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M2%206a2%202%200%200%201%202-2h5l2%202h9a2%202%200%200%201%202%202v10a2%202%200%200%201-2%202H4a2%202%200%200%201-2-2z%27/%3E%3C/svg%3E");
}
.folder-icon.lg { width: 26px; height: 26px; vertical-align: -4px; margin-right: 10px; }
.folder-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 22px; }
.folder-tile {
  display: flex; align-items: center; gap: 4px; padding: 10px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); transition: transform .12s, border-color .12s, background .12s, box-shadow .12s;
}
.folder-tile:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, .4); box-shadow: 0 12px 28px rgba(0, 0, 0, .5); }
.folder-tile:has(.folder-more[open]) { transform: none; z-index: 5; }
.folder-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; }
.folder-link:hover { text-decoration: none; }
.folder-more-btn {
  list-style: none; padding: 2px 8px; border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1;
  border: 1px solid transparent;
}
.folder-more-btn::-webkit-details-marker { display: none; }
.folder-more-btn:hover, .folder-more[open] .folder-more-btn { color: var(--text); border-color: var(--line); }
.folder-tile.off-profile .folder-thumb { opacity: .55; }
.folder-up { border-style: dashed; background: none; }
.folder-up .up-arrow { font-size: 1.6rem; line-height: 1; color: var(--sun-1); }
.off-profile-badge { justify-self: start; border-style: dashed; }
.menu-items button:disabled { cursor: default; opacity: .6; }
.menu-items button:disabled:hover { background: none; }
.profile-folder { display: flex; align-items: center; margin: 0 0 14px; }
.folder-thumb {
  flex: none; display: grid; grid-auto-flow: column; gap: 2px; place-items: center; width: 92px; height: 52px;
  border-radius: 7px; overflow: hidden; background: var(--panel-2);
}
.folder-thumb img { width: 45px; height: 52px; object-fit: cover; display: block; }
.folder-thumb img:only-child { width: 92px; }
.folder-thumb .folder-icon { margin: 0; }
.folder-text { display: grid; gap: 2px; min-width: 0; }
.folder-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-scope { margin: -10px 0 16px; }
.deck-folder { margin: 2px 0; }
.deck-folder .folder-icon { width: 13px; height: 13px; margin-right: 4px; }
/* Drag and drop: drop targets light up while something is being dragged. */
.drag-active .folder-tile, .drag-active .breadcrumbs [data-drop-folder] { outline: 1px dashed #48505f; outline-offset: 2px; }
.drop-over, .drag-active .drop-over { background: var(--panel-2); border-color: var(--accent); outline: 2px solid var(--accent) !important; }
.dragging { opacity: .45; }
/* Select mode: clicks pick decks; the bar at the bottom moves them. */
.btn.on { border-color: var(--accent); }
.selecting [data-deck] { position: relative; cursor: pointer; user-select: none; }
.selecting .deck-tile[data-deck]::after {
  content: ""; position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #fff; background: rgba(0, 0, 0, .55); box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
.selecting .deck-tile[data-deck] { transform: none; }
.selecting [data-deck].selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.selecting .deck-tile.selected::after {
  background: var(--accent) url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20viewBox%3D%270%200%2024%2024%27%3E%3Cpath%20d%3D%27M5%2012l5%205L19%207%27%20fill%3D%27none%27%20stroke%3D%27%231a0f05%27%20stroke-width%3D%273%27/%3E%3C/svg%3E") center / 16px no-repeat;
  border-color: var(--accent);
}
.selecting .deck-table tr.selected { background: var(--panel-2); }
.select-bar {
  position: sticky; bottom: 16px; z-index: 30; display: flex; align-items: center; gap: 10px; margin-top: 20px;
  padding: 10px 14px; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.select-bar[hidden] { display: none; }
/* The folder menu sits mid-row on phones: open it leftward so it stays on screen. */
@media (max-width: 700px) { .folder-menu .menu-items { left: auto; right: 0; } }
.folder-picker .folder-options { display: grid; gap: 2px; max-height: min(60vh, 420px); overflow-y: auto; margin: 0 -8px; }
.folder-option {
  display: flex; align-items: center; padding: 8px 12px; border: 0; border-radius: 7px; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.folder-option:hover:not(:disabled), .folder-option:focus-visible { background: var(--panel-2); }
.folder-option:disabled { color: var(--muted); cursor: default; }

/* Card image size picker (static/js/card-size.js): one tile width per size for every card grid. */
/* A card grid's column count (card-size.js fitCardGrids), set on the grid itself; nested grids don't inherit it. */
@property --grid-template { syntax: "*"; inherits: false; }
:root { --card-base: 160px; --card-scale: 1; --card-w: calc(var(--card-base) * var(--card-scale)); }
/* On <html> (site-wide) or on one grid with its own size (data-card-size-scope, e.g. the builder's card search). */
[data-card-size] { --card-w: calc(var(--card-base) * var(--card-scale)); }
[data-card-size="M"] { --card-base: 160px; }
[data-card-size="L"] { --card-base: 195px; }
/* Big screens show bigger cards, not only more of them. */
@media (min-width: 1900px) { :root { --card-scale: 1.15; } }
@media (min-width: 2400px) { :root { --card-scale: 1.3; } }
.card-size[hidden] { display: none; }
.card-size { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.card-size .view-toggle a { min-width: 30px; display: inline-flex; align-items: center; justify-content: center; }
.card-size .view-toggle svg { display: block; }
/* Phones: the site-wide picker hides; the Cards and Leaders pages show a phone picker of their own (its own setting, on
   <html data-phone-size>), choosing 3 or 2 cards a row on Cards and 2 or 1 leaders a row on Leaders. */
@media (max-width: 700px) {
  .card-size { display: none; }
  .card-size.phone-size:not([hidden]) { display: inline-flex; }
  html[data-phone-size="L"] .card-grid.browse:not(.home-cards) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-phone-size="L"] .leader-grid { grid-template-columns: 1fr; }
  html[data-phone-size="L"] .deck-tile .art-leaders { grid-template-columns: 1fr; }  /* Decks: leaders stacked */
}
@media (min-width: 701px) { .card-size.phone-size { display: none; } }
.page-head { align-items: baseline; margin-bottom: .5em; }
.page-head h1 { margin: 0; }

/* Pick list (decks/pick.html): tick cards off while pulling them from a collection. */
.pick-head { gap: 14px; margin-bottom: 6px; }
.pick-progress { color: var(--muted); }
.pick-progress b { color: var(--text); font-size: 1.2rem; }
.pick-bar { margin: 12px 0 18px; }
.pick-group { margin-bottom: 18px; break-inside: avoid; }
.pick-group h3 { font-size: .95rem; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 0 0 6px; }
.pick-group.done h3 { color: var(--ok); }
.pick-list.list { columns: 2 380px; column-gap: 32px; }
.pick-line { display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; cursor: pointer; break-inside: avoid; }
.pick-line:hover { background: var(--panel-2); }
.pick-line input { width: 18px; height: 18px; flex: none; accent-color: var(--ok); cursor: pointer; }
.pick-qty { color: var(--muted); min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.pick-name { flex: 1; min-width: 0; }
.pick-printing { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.pick-line.picked .pick-name, .pick-line.picked .pick-qty { text-decoration: line-through; color: var(--muted); }
.pick-list.hide-picked .pick-line.picked { display: none; }  /* beats the Images view's display: grid */
/* Images: small tiles (the Card size picker sets the width); the checkbox sits on the card. */
.pick-list.images .pick-body { display: grid; gap: 10px; grid-template-columns: var(--grid-template, repeat(auto-fill, minmax(min(var(--card-w), 100%), 1fr))); }
.pick-list.images .pick-line { position: relative; display: grid; gap: 2px; padding: 6px; align-content: start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.pick-list.images .pick-line img { width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 6px; display: block; }
.pick-list.images .pick-line img.wide { aspect-ratio: 7 / 5; }
.pick-list.images .pick-line input { position: absolute; top: 12px; left: 12px; width: 22px; height: 22px; }
.pick-list.images .pick-qty { text-align: left; font-size: .8rem; }
.pick-list.images .pick-name { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-list.images .pick-line.picked img { opacity: .35; }
.pick-list.images .pick-line.picked { border-color: var(--ok); }
@media print {
  .topbar, .pick-bar, .pick-head .btn, .breadcrumbs, footer { display: none !important; }
}

/* ---------- card image corners ----------
   Most swu-db card scans have square white corners baked in (the printed card's are round, about 2.8% of its long
   side). A fixed radius like 10px hides them on small images but not on big ones, so every card image is rounded in
   proportion instead: 5% of each side, always a little rounder than the card itself. Comes last so it wins over the
   per-component radii; round face crops (the hero's spoiler faces, its leader chips) keep theirs. */
img[src*="/images/cards/"]:not(.tag-faces img, .leader-chip img) { border-radius: 5%; }
/* A hairline just inside each card's edge (deck and pair tile art included), so its black border doesn't vanish into
   the dark page. Zero specificity (:where), so any component's own outline (unreleased red, hover orange) still wins. */
:where(img[src*="/images/cards/"]:not(.tag-faces img, .leader-chip img)) { outline: 1px solid rgba(255, 255, 255, .16); outline-offset: -1px; }
/* The Cost Curve fills its box, however tall Deck Makeup makes the row. */
.glance-grid .glance-box:has(> .curve) { display: flex; flex-direction: column; }
.glance-grid .curve.mini { flex: 1; height: auto; min-height: 130px; align-items: stretch; }
.glance-grid .curve.mini .bar { height: auto; }

/* Collection (collection/page.html) */
.owned-add { display: grid; gap: 8px; margin-bottom: 18px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.owned-add .filter-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.owned-add input[type=search] { max-width: 420px; }
.owned-found { display: grid; gap: 4px; }
.owned-result { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 6px 8px; color: var(--text);
  background: none; border: 0; border-radius: 8px; text-align: left; font: inherit; cursor: pointer; }
.owned-result:hover, .owned-result:focus-visible { background: var(--panel-2); }
.owned-result img { width: 34px; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 4px; display: block; }
.owned-result > span:nth-child(2) { display: grid; min-width: 0; }
.owned-picked { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.owned-printings { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.owned-printing { display: grid; gap: 4px; align-content: start; }
.owned-printing-name { font-weight: 600; font-size: .88rem; margin-top: 4px; }
.owned-finish { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
:is(.owned-tile, .owned-printing, .owned-table) .view-tile.wide { aspect-ratio: 7 / 5; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.qty-stepper button { width: 30px; height: 30px; padding: 0; color: var(--text); background: none; border: 0; font: inherit; font-weight: 700; cursor: pointer; }
.qty-stepper button:hover { background: var(--panel-2); }
.qty-stepper input { width: 44px; height: 30px; padding: 0; color: var(--text); background: none; border: 0; border-inline: 1px solid var(--line); border-radius: 0; font: inherit; font-weight: 700; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.qty-stepper input::-webkit-inner-spin-button, .qty-stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.owned-section { margin-bottom: 22px; }
.owned-heading { font-size: 1rem; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.owned-heading .small { font-weight: 500; margin-left: 6px; }
.owned-table .deck-name, .owned-sub { display: block; }
.owned-phone-meta { display: none; }
.owned-table .owned-qty-col { width: 1%; white-space: nowrap; text-align: right; }
.owned-tile { display: grid; gap: 4px; align-content: start; min-width: 0; }
.owned-tile .qty-stepper { justify-self: start; margin-top: 2px; }
.owned-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owned-empty { padding: 24px 0; }
@media (max-width: 800px) {
  .owned-table :is(th, td):not(.art-cell):not(.owned-card):not(.owned-qty-col):not(.diff-col):not(.change-col) { display: none; }
  .owned-phone-meta { display: block; }
}

/* Import and export dialogs (builder, collection) */
.io-dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.io-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.info-close {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.info-close:hover { border-color: var(--accent); }
.io { display: grid; gap: 10px; }
.io textarea { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.io-dialog { width: min(820px, calc(100vw - 32px)); }
.io-head { display: flex; justify-content: space-between; align-items: center; }
.io-head h2 { margin: 0; }
.io-examples { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.io-example { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.io-example-title { font-weight: 700; margin-bottom: 6px; }
.io-example pre { margin: 0 0 8px; font-size: .8rem; color: #cfd5df; white-space: pre-wrap; }
.io-example p { margin: 0; font-size: .8rem; color: var(--muted); }
.io-example code { font-size: .8rem; color: var(--text); }
@media (max-width: 700px) { .io-examples { grid-template-columns: 1fr; } }

/* Collection import */
.owned-add .row input[type=search] { flex: 1 1 260px; max-width: 420px; }
.owned-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.owned-review { margin: 8px 0; padding-left: 18px; }
.owned-problems-title { font-size: .9rem; margin: 14px 0 6px; color: var(--warn); }
.owned-problems { display: grid; gap: 6px; max-height: 240px; overflow: auto; padding: 8px 10px; background: var(--panel-2); border-radius: 8px; }
.owned-problems > div { display: grid; gap: 1px; min-width: 0; }
.owned-problems code { overflow-wrap: anywhere; }
.io-dialog [hidden] { display: none; }

/* Collection: counts that aren't saved yet */
.qty-stepper.unsaved { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.qty-stepper.unsaved input { color: var(--accent); }
.owned-finish:has(.qty-stepper.unsaved) > span { color: var(--accent); }
.owned-table tbody tr.unsaved, .owned-table tbody tr.unsaved:hover { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: inset 4px 0 0 var(--accent); }
.owned-table tbody tr.unsaved .deck-name { color: var(--accent); }
.owned-tile.unsaved .view-tile { outline: 2px solid var(--accent); outline-offset: 2px; }
.owned-tile.unsaved .stat-name { color: var(--accent); }
.owned-savebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; background: var(--panel-2); border: 1px solid var(--accent); border-radius: 12px; box-shadow: 0 10px 28px rgba(0, 0, 0, .55); font-weight: 600; white-space: nowrap; }
.owned-savebar[hidden] { display: none; }
body.owned-has-drafts .container { padding-bottom: 84px; }

/* Collection list: each row's card, like the art column on the Decks list */
.owned-table .art-cell { padding: 10px 14px 10px 10px; }
.owned-art { width: 120px; }
@media (max-width: 800px) {
  .owned-art { width: 64px; }
  .owned-table .art-cell { padding: 8px 8px 8px 4px; }
  .owned-table .owned-card { padding-inline: 4px; }
}

/* Collection, Show: All cards: what you don't own is dimmed until it has a count */
.not-owned:not(.unsaved) :is(.view-tile, .deck-name, .owned-sub, .stat-name, .owned-meta, .owned-phone-meta) { opacity: .5; }

/* Page numbers, between Previous and Next */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; }
.pager-num { min-width: 36px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .85rem; text-align: center; }
a.pager-num:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.pager-num.on { color: var(--text); background: var(--panel-2); border-color: var(--accent); }
.pager-gap { color: var(--muted); padding: 0 2px; }

/* Collection, Condensed view: one tile per card, opening its printings */
.owned-card-tile { padding: 0; color: var(--text); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.owned-card-tile .view-tile { transition: transform .12s, box-shadow .12s; }
.owned-card-tile:is(:hover, :focus-visible) .view-tile { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0, 0, 0, .5), 0 0 0 2px var(--accent); }
.owned-tile-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.owned-total { display: inline-block; min-width: 30px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.unsaved .owned-total { color: var(--accent); border-color: var(--accent); }
.owned-card-row { cursor: pointer; }
.owned-card-row button.deck-name { padding: 0; background: none; border: 0; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.owned-card-row button.deck-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.owned-card-tile .view-tile.wide { aspect-ratio: 7 / 5; }

/* Collection: row count, Clear filters and the view toggles, between the filters and the cards */
.owned-results-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: -8px 0 14px; }

/* Review Import: each printing's count now and after */
.diff { font-weight: 700; white-space: nowrap; }
.diff.new, .diff.up { color: var(--ok); }
.diff.down { color: var(--warn); }
.diff.removed { color: var(--bad); }
.diff.same { color: var(--muted); font-weight: 500; }
.diff-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.diff-dot.new, .diff-dot.up { background: var(--ok); }
.diff-dot.down { background: var(--warn); }
.diff-dot.removed { background: var(--bad); }
.owned-kinds { margin: 4px 0 18px; }
.owned-problems-box { margin: 0 0 18px; }
.owned-problems-box > summary { cursor: pointer; font-weight: 700; color: var(--warn); margin-bottom: 8px; }
.diff.changed { color: var(--accent); }
.diff-dot.changed { background: var(--accent); }
/* Review Import: the change sits under the card, bottom right; the counts are labelled beside the name */
.diff-badge { display: block; width: max-content; margin: 6px 0 0 auto; padding: 2px 9px; border-radius: 99px; font-weight: 800; font-size: .85rem;
  border: 1px solid currentColor; color: var(--muted); }
.diff-badge.new, .diff-badge.up { color: var(--ok); }
.diff-badge.down { color: var(--warn); }
.diff-badge.removed { color: var(--bad); }
.diff-badge.changed { color: var(--accent); }
.owned-tile .diff-badge { margin-top: -2px; }
.owned-table .art-cell .diff-badge { margin-top: 6px; }
.diff-counts { display: flex; align-items: baseline; gap: 6px; font-size: .85rem; color: var(--muted); }
.diff-counts b { color: var(--text); font-size: 1rem; }
.owned-table .diff-col { width: 1%; white-space: nowrap; text-align: center; font-size: 1rem; }
.owned-table th.diff-col { font-size: .8rem; }

/* Review Import: lines that won't be imported, each with Fix when it can be */
.owned-problem { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.owned-problem > div { display: grid; gap: 1px; min-width: 0; }
.owned-problem .btn { flex: none; }
#fix-dialog .owned-printing .row { gap: 6px; margin-top: 4px; }

/* Review Import: every line that won't be imported, then Fix Imports, one line at a time */
.owned-problems-box .owned-problems { max-height: none; overflow: visible; }
.owned-problem[hidden] { display: none; }
.owned-problems-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.owned-problems [data-problems-more] { justify-self: start; }
.fix-dialog { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.fix-typed { display: grid; gap: 2px; padding: 10px 12px; background: var(--panel-2); border-radius: 10px; }
.fix-typed code { font-size: .95rem; }
.fix-printings { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 8px; }
.fix-printing { position: relative; display: grid; gap: 3px; align-content: start; padding: 6px; color: var(--text); text-align: left;
  background: none; border: 2px solid transparent; border-radius: 12px; font: inherit; cursor: pointer; }
.fix-printing:is(:hover, :focus-visible) { border-color: rgba(255, 255, 255, .35); }
.fix-printing.suggested { border-color: var(--accent); }
.fix-printing .view-tile.wide { aspect-ratio: 7 / 5; }
.fix-suggested { position: absolute; top: 12px; left: 12px; z-index: 3; padding: 2px 8px; border-radius: 99px; background: var(--accent); color: #1a0f05; font-size: .8rem; font-weight: 800; }
/* The heading line: count on the left, Fix imports on the right, above the grey box */
.owned-problems-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.owned-problems-title h3 { margin: 0 auto 0 0; font-size: .95rem; color: var(--warn); }
.owned-problems > .owned-problem { display: flex; }

/* Fix All Imports: one row per failed line, the suggested printing picked, others to pick instead */
.fix-table-wrap { overflow-x: auto; }
.fix-table { width: 100%; border-collapse: collapse; }
.fix-table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; text-align: left; padding: 6px 8px; }
.fix-table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.fix-typed-cell { width: 26%; }
.fix-typed-cell code { display: block; overflow-wrap: anywhere; }
.fix-suggested-cell { width: 120px; }
.fix-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.fix-pick { flex: none; width: 104px; display: grid; gap: 2px; padding: 4px; color: var(--text); text-align: left; background: none;
  border: 2px solid transparent; border-radius: 10px; font: inherit; font-size: .8rem; cursor: pointer; }
.fix-pick:is(:hover, :focus-visible) { border-color: rgba(255, 255, 255, .35); }
.fix-pick.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.fix-pick .view-tile.wide { aspect-ratio: 7 / 5; }
.fix-pick-label { font-weight: 700; }
.fix-pick-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fix-table tr:not(.picked) .fix-typed-cell code { color: var(--muted); }
/* Fix All Imports, roomier: a wide window, bigger pictures that wrap onto more rows */
#fix-all-dialog { width: min(1600px, calc(100vw - 32px)); }
.fix-table { table-layout: fixed; }
.fix-table th:nth-child(1), .fix-typed-cell { width: 300px; }
.fix-table th:nth-child(2), .fix-suggested-cell { width: 176px; }
.fix-typed-cell { display: table-cell; }
.fix-typed-cell > * { display: block; }
.fix-typed-cell code { font-size: .95rem; margin-bottom: 4px; }
.fix-typed-cell .fix-finish { display: inline-flex; margin-top: 10px; }
.fix-strip { flex-wrap: wrap; overflow: visible; gap: 10px; }
.fix-pick { width: 156px; font-size: .85rem; }
@media (max-width: 900px) {
  .fix-table, .fix-table tbody, .fix-table tr, .fix-table td { display: block; width: auto; }
  .fix-table thead { display: none; }
}
.owned-revise-note { padding: 10px 12px; border: 1px solid var(--accent); border-radius: 10px; color: var(--text); }
/* In List, the change has its own column, last (Grid keeps it under the picture) */
.owned-table .change-col { width: 90px; text-align: center; }
.owned-table .change-col .diff-badge { margin: 0 auto; }
/* Section headings on the Collection and review pages, as the deckbuilder's: a filled band, a little bigger, the count
   in sun colour. On review pages the band's left edge takes the change's colour too. */
.owned-heading { display: flex; align-items: center; gap: 8px; padding: 8px 14px; margin: 0 0 10px; border: 0; border-radius: 8px;
  background: var(--panel-2); font-size: 1.12rem; font-weight: 700; color: var(--text); }
.owned-heading .small { margin-left: 0; font-size: .95rem; font-weight: 700; color: var(--sun-1); }
.owned-heading .diff-dot { margin-right: 0; }
.owned-heading:has(.diff-dot.new, .diff-dot.up) { box-shadow: inset 4px 0 0 var(--ok); }
.owned-heading:has(.diff-dot.down) { box-shadow: inset 4px 0 0 var(--warn); }
.owned-heading:has(.diff-dot.removed) { box-shadow: inset 4px 0 0 var(--bad); }
.owned-heading:has(.diff-dot.changed) { box-shadow: inset 4px 0 0 var(--accent); }
.owned-section { margin-bottom: 26px; }
/* Collection and review sections collapse from their heading, like the deck page's (static/js/deck-sections.js) */
.owned-section[data-section] > .owned-heading { cursor: pointer; user-select: none; }
.owned-heading .collapse-btn { margin: 0 -2px 0 -6px; }
.owned-section.collapsed > .owned-heading { margin-bottom: 0; }
.collapsed > .owned-body { display: none !important; }
/* Section headings: exactly the deckbuilder's size and spacing (builder.css .deck-section h3) */
.owned-heading { padding: 6px 12px; margin: 0 0 6px; font-size: 1.02rem; }
.owned-heading .small { font-size: 1.02rem; }
.owned-results-bar .card-size { margin-right: 4px; }

/* Phone-only and desktop-only pieces (the builder's More menu takes Playtest and Copy deck on phones). */
@media (min-width: 701px) { .phone-only { display: none !important; } }
@media (max-width: 700px) { .phone-hide { display: none !important; } }

/* ---------- deck page on phones: laid out like the builder's ----------
   Name and details, the leaders and base stacked big, then Edit deck (or Copy deck) / Export / More, the numbers, the
   stats. The view controls sit in a tidy grid. */
@media (max-width: 700px) {
  .deck-hero { display: flex; flex-direction: column; gap: 14px; }
  .hero-info { display: contents; }
  .hero-info > h1, .hero-info > .hero-sub { order: 1; }
  .hero-info h1 { margin-bottom: -6px; }
  .hero-by { padding-left: 0; }
  .hero-art { order: 2; justify-items: stretch; gap: 10px; }
  .hero-leaders { flex-direction: column; gap: 10px; }
  .hero-leaders img, .hero-empty { width: 100%; }
  /* Leader / Unit toggle: under the leaders; on Unit each leader shows its portrait unit side, a bit narrower than
     the screen so the pair doesn't run several screens tall, but large enough to read. */
  .hero-side-toggle { position: static; transform: none; justify-self: center; order: -1; }  /* above the leaders, reachable either way */
  .side-toggle label { padding: 8px 18px; }  /* touch-sized */
  .hero-art.show-unit .hero-leaders { align-items: center; }
  .hero-art.show-unit .hero-leaders a { width: 82%; }
  .hero-art.show-unit .hero-leaders img { aspect-ratio: 5 / 7; }
  .hero-base { justify-self: stretch; }
  .hero-base img { width: 100%; }
  .hero-info .hero-actions { order: 3; padding-block: 0; flex-wrap: nowrap; gap: 6px; }
  .hero-actions > .btn, .hero-actions > .menu, .hero-actions > form { flex: 1 1 0; min-width: 0; }
  .hero-actions > .btn, .hero-actions > .menu > summary, .hero-actions > form > .btn { width: 100%; justify-content: center; }
  .hero-info > .hero-stats { order: 4; }
  .deck-tabs .tab { font-size: .95rem; }
  .deck-view-bar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .deck-view-bar .view-toggle { grid-column: 1 / -1; display: flex; }
  .deck-view-bar .view-toggle a { flex: 1; text-align: center; padding-block: 8px; }
  .deck-view-bar label { display: grid; gap: 4px; font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .deck-view-bar select { width: 100%; padding: 8px; font-size: .95rem; letter-spacing: 0; text-transform: none; color: var(--text); }
}
/* Touch: no hover lift or line left behind on the deck page's cards after a tap. */
.touch-ui .deck-view:not(.stacks) a.view-tile:hover, .touch-ui .hero-leaders a:hover img { transform: none; translate: none; box-shadow: none; }
.touch-ui a.view-tile:hover::before { box-shadow: inset 0 0 0 2px transparent; }
.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; }



/* Home page on phones: Trending pairs and Recent decks show 3 each (one per row, so 6 ran several screens);
   "Browse all" leads to the rest. */
@media (max-width: 700px) {
  .home-trim > :nth-child(n+4) { display: none; }
  /* Trending cards: one row of 4 (the grid is 4 across here; 6 would leave a half row). */
  .home-cards > :nth-child(n+5) { display: none; }
}

/* Home section headers: the title, then a line with what the list is on the left and its link on the right, right
   above the tiles (the link in the same place for every section). */
.home-title { margin-bottom: 2px; }
.home-sub { margin-bottom: 12px; flex-wrap: nowrap; }
.home-sub > a { white-space: nowrap; }

/* Text pages such as Privacy: a readable line length and spacing between sections. */
.legal-page { max-width: 70ch; margin: 0 auto; padding-bottom: 24px; line-height: 1.6; }
.legal-page h2 { margin-top: 28px; }
.legal-page ul { padding-left: 20px; }
.legal-page li + li { margin-top: 6px; }

/* Contact page: a roomy message box, and the bot trap kept off screen (it's there for bots, not people). */
.contact-box { max-width: 560px; }
.contact-box textarea, .contact-box select { width: 100%; }
.contact-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
