/* GuyTheGathering — a bright, welcoming home: white rooms, near-black accents, soft shadows.
   Colors live here; the "Guy's place" section at the end of this file restyles the surfaces. */
:root {
  --felt: #f4eee4;        /* the room: soft stone, easy on the eyes */
  --felt-deep: #ece4d6;
  --felt-edge: #e2d8c7;
  --wood: #141414;        /* near-black, for the few solid dark accents */
  --wood-deep: #0b0b0b;
  --cream: #ffffff;       /* text on the dark accents */
  --paper: #fdf9f2;       /* cards: a warm off-white */
  --paper-2: #f5eee3;
  --line: #e7ded0;
  --ink: #141414;
  --ink-soft: #62625f;
  --gold: #141414;        /* the accent: near-black */
  --gold-deep: #45453f;
  --ember: #000000;
  --bad: #b3261e;
  --ok: #2b6e46;
  --focus: #141414;
  --accent-grad: linear-gradient(180deg, #2b2b2b 0%, #111111 100%);
  --page-bg:
    radial-gradient(1200px 480px at 50% -10%, rgba(255, 255, 255, 0.45), transparent 70%),
    linear-gradient(180deg, #f6f0e6 0%, #f0e8da 100%);

  --w: #efe6b8;
  --u: #2f74b5;
  --b: #3b3340;
  --r: #c5432f;
  --g: #2f7f51;
  --c: #b9c0bd;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --s-1: 0.8rem;
  --s0: 1rem;
  --s1: 1.2rem;
  --s2: 1.44rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 15px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg), var(--felt);
  background-attachment: fixed;
  color: var(--paper);
  font: 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 8px; top: -48px; z-index: 50;
  background: var(--gold); color: var(--ink); padding: 8px 12px; border-radius: 4px;
}
.skip:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bar :focus-visible, .zone :focus-visible, .stats :focus-visible { outline-color: var(--gold); }

/* ---------- header ---------- */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 20px;
  background: linear-gradient(90deg, rgba(6, 2, 2, 0.96) 0%, rgba(30, 7, 8, 0.94) 60%, rgba(70, 14, 12, 0.92) 100%);
  border-bottom: 1px solid rgba(255, 122, 31, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.bar::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent-grad);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 var(--s2)/1.1 var(--serif); letter-spacing: -0.01em; }
.brand-link { display: inherit; align-items: inherit; gap: inherit; color: inherit; text-decoration: none; }
.brand-accent {
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-mark {
  width: 22px; height: 30px; border-radius: 4px; flex: none;
  border: 2.5px solid var(--gold); box-shadow: 0 0 12px rgba(255, 122, 31, 0.55), inset 0 0 8px rgba(227, 54, 31, 0.6);
  background: radial-gradient(circle at 50% 60%, #ff9a3c 0 4px, transparent 5px), #1a0606;
}
.deckname { flex: 1 1 240px; display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.deckname input {
  flex: 1 1 auto; min-width: 0; padding: 4px 6px;
  background: transparent; border: 0; border-bottom: 1px dashed rgba(242, 245, 243, 0.4);
  font: 600 var(--s1)/1.3 var(--serif); color: var(--paper);
}
.deckname input:hover, .deckname input:focus { border-bottom-style: solid; }
.save-status { font-size: var(--s-1); opacity: 0.85; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.account { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0.45em 0.9em; min-height: 34px;
  border: 1px solid var(--ink-soft); border-radius: 4px;
  background: var(--paper); color: var(--ink);
  cursor: pointer; transition: background-color 0.12s;
}
.btn:hover { background: var(--paper-2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.bar .btn, .zone .btn {
  background: transparent; color: var(--paper); border-color: rgba(242, 245, 243, 0.5);
}
.bar .btn:hover, .zone .btn:hover { background: rgba(242, 245, 243, 0.12); }
.btn.primary, .bar .btn.primary {
  background: var(--accent-grad); color: #1a0705; border-color: #f0611f; font-weight: 700;
  box-shadow: 0 2px 10px rgba(227, 54, 31, 0.35);
}
.btn.primary:hover, .bar .btn.primary:hover { background: var(--accent-grad); filter: brightness(1.08); box-shadow: 0 3px 14px rgba(255, 122, 31, 0.5); }
.bar .btn, .zone .btn { border-radius: 6px; }
.bar .btn:hover, .zone .btn:hover { border-color: var(--gold); }
.btn.small { min-height: 28px; padding: 0.25em 0.7em; font-size: 0.9rem; }
.btn.link {
  border-color: transparent; background: transparent; color: var(--focus);
  text-decoration: underline; padding-left: 0; margin-right: auto;
}
.btn.link:hover { background: transparent; text-decoration-thickness: 2px; }

/* ---------- layout ---------- */
.table {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  grid-template-rows: auto 1fr;
  grid-template-areas: "zone stats finder" "zone list finder";
  gap: 20px;
  padding: 20px;
  max-width: 1560px; margin: 0 auto;
  align-items: start;
}
.zone { grid-area: zone; min-width: 0; }
.stats { grid-area: stats; min-width: 0; }
.list { grid-area: list; min-width: 0; }
.finder { grid-area: finder; min-width: 0; }

.panel {
  background: var(--paper); color: var(--ink);
  border-radius: 10px; padding: 20px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 122, 31, 0.12);
}
.finder { border-top: 4px solid var(--gold); }
.finder h2 { display: flex; align-items: center; gap: 8px; }
.panel h2 { font: 600 var(--s2)/1.2 var(--serif); letter-spacing: -0.01em; }
.finder { position: sticky; top: 12px; }

.help { font-size: 0.9rem; color: var(--ink-soft); }
.panel .help { margin: 6px 0 12px; }
.note {
  margin: 0 0 10px; padding: 8px 10px; font-size: 0.85rem;
  border-left: 4px solid var(--gold-deep); background: #fbf3dc; color: #4a3908;
}
.error { color: var(--bad); font-size: 0.9rem; min-height: 1.4em; }

/* ---------- command zone ---------- */
.zone h2, .stats h2 { font: 600 var(--s2)/1.2 var(--serif); margin-bottom: 12px; }
.zone h3, .stats h3 { font: 600 var(--s1)/1.2 var(--serif); margin: 28px 0 10px; }
.stats h2 + h3 { margin-top: 12px; }

.frame {
  aspect-ratio: 63 / 88;
  border: 3px solid var(--gold);
  border-radius: 14px;
  overflow: hidden;
}
.frame.empty {
  border-style: dashed;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 10px;
  padding: 22px;
  background: radial-gradient(circle at 50% 75%, rgba(255, 122, 31, 0.16), transparent 65%), rgba(20, 6, 7, 0.75);
}
.frame { box-shadow: 0 0 22px rgba(255, 122, 31, 0.25); }
.frame.empty .empty-title { font: 600 var(--s1)/1.25 var(--serif); }
.frame.empty p { font-size: 0.92rem; }
.frame.empty .wheel { width: 168px; height: 168px; margin-top: 14px; align-self: center; }
.frame.filled { background: var(--paper); }
.frame img.face { display: block; width: 100%; height: 100%; object-fit: cover; }

.identity { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.identity .cmd-name { font: 600 var(--s0)/1.3 var(--serif); }
.identity .id-text { font-size: 0.88rem; opacity: 0.9; margin-bottom: 8px; }

.wheel { width: 88px; height: 88px; flex: none; }
.wheel .link { stroke: rgba(242, 245, 243, 0.25); fill: none; stroke-width: 1; }
.wheel text { font: 700 13px var(--serif); text-anchor: middle; dominant-baseline: central; }
.wheel .w-off circle { fill: transparent; stroke: rgba(242, 245, 243, 0.55); stroke-width: 1.5; stroke-dasharray: 3 3; }
.wheel .w-off text { fill: rgba(242, 245, 243, 0.75); }
.wheel .w-on circle { stroke: var(--paper); stroke-width: 1.5; }
.wheel .w-on text { fill: var(--paper); }
.wheel .w-W circle { fill: var(--w); } .wheel .w-W text { fill: var(--ink); }
.wheel .w-U circle { fill: var(--u); }
.wheel .w-B circle { fill: var(--b); }
.wheel .w-R circle { fill: var(--r); }
.wheel .w-G circle { fill: var(--g); }
.wheel .colorless { fill: var(--c); stroke: var(--paper); stroke-width: 1.5; }

/* text rendering of a card (used when no image is available) */
.textcard {
  height: 100%; padding: 14px; background: var(--paper); color: var(--ink);
  display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.textcard header { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.textcard h3 { font: 700 1.05rem/1.2 var(--serif); margin: 0; }
.textcard .tl { font: italic 0.88rem/1.3 var(--serif); color: var(--ink-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; }
.textcard .ot { font: 0.9rem/1.45 var(--serif); }

/* mana symbols */
.cost { display: inline-flex; flex-wrap: nowrap; white-space: nowrap; gap: 2px; vertical-align: middle; }
.pip {
  display: inline-grid; place-items: center; min-width: 1.3em; height: 1.3em; padding: 0 0.2em;
  border-radius: 999px; font: 700 0.72rem/1 var(--sans); color: #fff;
}
.pip-W { background: var(--w); color: var(--ink); }
.pip-U { background: var(--u); }
.pip-B { background: var(--b); }
.pip-R { background: var(--r); }
.pip-G { background: var(--g); }
.pip-n { background: var(--c); color: var(--ink); }

/* deck check */
.checks { display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 1.4em 1fr; gap: 6px; font-size: 0.93rem; }
.checks .mark { font-weight: 700; text-align: center; }
.checks .ok .mark { color: #a9e3bc; }
.checks .bad .mark { color: #ffb4a3; }
.checks .todo .mark { color: rgba(242, 245, 243, 0.7); }
.checks .detail { display: block; font-size: 0.85rem; opacity: 0.85; }

/* stats */
.curve { display: flex; align-items: stretch; gap: 6px; }
.curve .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.curve .track { height: 76px; width: 100%; display: flex; align-items: flex-end; }
.curve .bar-fill { display: block; width: 100%; min-height: 2px; background: linear-gradient(0deg, #e3361f, #ff9a3c); border-radius: 3px 3px 0 0; }
.curve .n { font-size: 0.8rem; min-height: 1.2em; }
.curve .lbl { font-size: 0.8rem; opacity: 0.85; border-top: 1px solid rgba(242, 245, 243, 0.4); width: 100%; text-align: center; padding-top: 2px; }
.avg { font-size: 0.88rem; margin-top: 8px; opacity: 0.9; }

.pipcounts { display: flex; gap: 12px; flex-wrap: wrap; }
.pipcounts li { display: flex; align-items: center; gap: 6px; }
.pipcounts li.dim { opacity: 0.4; }

.typecounts { display: grid; gap: 4px; font-size: 0.93rem; }
.typecounts li { display: flex; justify-content: space-between; border-bottom: 1px solid rgba(242, 245, 243, 0.14); padding-bottom: 3px; }

.price-total { font: 700 var(--s2)/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.zone .help, .stats .help { color: rgba(242, 245, 243, 0.8); margin-top: 4px; }

/* ---------- decklist ---------- */
.list h2 { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.list h2 .count { font: 400 var(--s0)/1 var(--sans); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.group { margin-top: 20px; }
.group h3 { font: 600 var(--s1)/1.2 var(--serif); padding-bottom: 4px; border-bottom: 2px solid var(--ink); display: flex; gap: 10px; align-items: baseline; }
.group h3 .count { font: 400 0.9rem var(--sans); color: var(--ink-soft); }
.row {
  display: grid; grid-template-columns: 5.2rem minmax(0, 1fr) auto 4.6rem auto;
  gap: 8px; align-items: center; padding: 5px 2px; border-bottom: 1px solid var(--line);
}
.row:hover { background: var(--paper-2); }
.row .qty { display: flex; align-items: center; gap: 4px; justify-content: flex-start; font-variant-numeric: tabular-nums; }
.row .qty .n { min-width: 1.6em; text-align: center; }
.row .nm { font: 1rem/1.3 var(--serif); }
.row .warn { display: block; font: 0.8rem var(--sans); color: var(--bad); }
.row.flag .nm { color: var(--bad); }
.row .price { text-align: right; font-size: 0.88rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.step, .x {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 4px;
  background: #fff; color: var(--ink); cursor: pointer; line-height: 1; font-size: 1rem;
}
.step:hover, .x:hover { background: var(--paper-2); border-color: var(--ink-soft); }
.step:disabled { opacity: 0.4; cursor: not-allowed; }
.empty-list { margin-top: 16px; padding: 24px; border: 1px dashed var(--ink-soft); border-radius: 6px; color: var(--ink-soft); }

/* ---------- finder ---------- */
.search {
  width: 100%; padding: 0.65em 0.8em; border: 1px solid var(--ink-soft); border-radius: 8px;
  background: #fff; color: var(--ink);
}
.search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 122, 31, 0.25); outline: none; }

/* card-type filters under the search box */
.type-filters { display: grid; gap: 10px; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 30px; padding: 0.2em 0.85em; border-radius: 99px; cursor: pointer;
  font-size: 0.86rem; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.chip:hover { border-color: var(--gold); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--accent-grad); border-color: #f0611f; color: #1a0705; box-shadow: 0 1px 6px rgba(227, 54, 31, 0.3); }
.subpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.88rem; }
.subpick label { font-weight: 600; color: var(--ink-soft); }
.subpick select {
  flex: 1 1 150px; max-width: 220px; padding: 0.3em 0.5em; border-radius: 6px;
  border: 1px solid var(--ink-soft); background: #fff; color: var(--ink); font-size: 0.88rem;
}
.subpick .btn.link { margin-right: 0; padding: 0; min-height: 0; }
.cat-blurb {
  font-size: 0.84rem; color: var(--ink-soft); padding: 8px 10px; border-radius: 6px;
  background: var(--paper-2); border-left: 3px solid var(--gold);
}
.cat-blurb strong { color: var(--ink); }
.cat-blurb .btn.link { display: inline; margin: 0; padding: 0; min-height: 0; font-size: inherit; font-weight: 600; }

/* "By type" deck view */
.type-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip-n { font-weight: 400; opacity: 0.75; margin-left: 2px; font-variant-numeric: tabular-nums; }
.type-tabs + .cat-blurb { margin-top: 12px; }
.ltype { font: italic 0.74rem/1.25 var(--serif); color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.role-chips li {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 10px; border-radius: 99px;
  background: var(--paper-2); border: 1px solid var(--line); font-size: 0.84rem;
}
.role-chips .rn { font-weight: 700; font-variant-numeric: tabular-nums; }
.row .tline { display: block; font: italic 0.8rem/1.3 var(--serif); color: var(--ink-soft); }
.finder #search-status { margin: 8px 0; min-height: 1.3em; }
.results { max-height: calc(100vh - 260px); overflow: auto; border-top: 1px solid var(--line); }
.result {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 2px; border-bottom: 1px solid var(--line);
}
.result .thumb { width: 44px; height: 61px; object-fit: cover; border-radius: 3px; background: var(--paper-2); }
.result .name { font: 1rem/1.3 var(--serif); }
.result .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 0.82rem; color: var(--ink-soft); }
.tag { font-size: 0.85rem; color: var(--ink-soft); padding: 0 4px; }

/* ---------- hover preview ---------- */
.peek {
  position: fixed; z-index: 30; width: 260px; aspect-ratio: 63 / 88;
  border: 3px solid var(--gold); border-radius: 14px; overflow: hidden;
  background: var(--paper); pointer-events: none; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.peek img.face { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 12px); z-index: 60;
  max-width: min(92vw, 560px); padding: 10px 16px; border-radius: 4px;
  background: var(--ink); color: var(--paper); border-left: 5px solid var(--gold);
  opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-left-color: #ff8a73; }

/* ---------- dialogs ---------- */
dialog {
  width: min(560px, 92vw); max-height: 92vh; padding: 0; border: 0; border-radius: 6px;
  background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: rgba(12, 3, 3, 0.7); }
dialog { box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); border-top: 4px solid var(--gold); border-radius: 10px; }
.dlg { padding: 24px; display: grid; gap: 14px; }
.dlg h2 { font: 600 var(--s2)/1.2 var(--serif); }
.dlg .help { margin: 0; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center; }
.field { display: grid; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: 0.92rem; padding: 0; }
.field input[type="text"], .field input[type="password"], .field input[type="email"],.field textarea {
  width: 100%; padding: 0.55em 0.7em; border: 1px solid var(--ink-soft); border-radius: 4px;
  background: #fff; color: var(--ink);
}
.field textarea { font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.field .hint { font-size: 0.82rem; color: var(--ink-soft); }
.choice label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
code { font: 0.88em ui-monospace, Menlo, Consolas, monospace; background: var(--paper-2); padding: 1px 4px; border-radius: 3px; }

.deck-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.deck-item .dn { font: 600 1.05rem/1.3 var(--serif); }
.deck-item .dm { font-size: 0.85rem; color: var(--ink-soft); grid-column: 1; }
.deck-item .da { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .table {
    grid-template-columns: 300px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "zone finder" "zone stats" "zone list";
  }
  .finder { position: static; }
  .results { max-height: 46vh; }
}
@media (max-width: 760px) {
  .table { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "zone" "finder" "stats" "list"; padding: 12px; gap: 14px; }
  .bar { padding: 10px 12px; gap: 8px 12px; }
  .brand { order: 1; }
  .account { order: 2; margin-left: auto; }
  .deckname { order: 3; flex-basis: 100%; }
  .actions { order: 4; }
  .actions .btn { min-height: 32px; padding: 0.3em 0.7em; font-size: 0.92rem; }
  .frame.filled { max-width: 220px; }
  .frame.empty { aspect-ratio: auto; padding: 16px; max-width: none; }
  .frame.empty .wheel { width: 112px; height: 112px; margin-top: 4px; }
  .row { grid-template-columns: 5rem minmax(0, 1fr) auto; }
  .row .cost, .row .price { display: none; }
  .panel { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* =========================================================
   Commander theming, synergy, roles and card view
   ========================================================= */

/* Tint the felt with the commander's colors. */
:root[data-themed] body {
  background:
    radial-gradient(1100px 620px at 0% -10%, color-mix(in srgb, var(--tint-1) 34%, transparent), transparent 70%),
    radial-gradient(1000px 620px at 100% -10%, color-mix(in srgb, var(--tint-2) 22%, transparent), transparent 70%),
    var(--page-bg), var(--felt);
  background-attachment: fixed;
}
.bar { position: relative; }
:root[data-themed] .bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--id-stripe);
}

/* spark icon marking on-theme cards */
.spark { width: 0.85em; height: 0.85em; fill: currentColor; flex: none; }

/* synergy list in the command zone */
.syn-intro .spark { color: var(--gold); vertical-align: -0.05em; }
.themes { display: grid; gap: 8px; }
.theme {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(255, 122, 31, 0.18);
  border-left: 3px solid var(--gold);
}
.th-name { font: 600 1rem/1.25 var(--serif); }
.th-n { font: 400 0.8rem var(--sans); opacity: 0.8; margin-left: 6px; white-space: nowrap; }
.th-blurb { font-size: 0.82rem; opacity: 0.82; margin-top: 2px; }

/* deck roles in the stats column */
.roles { display: grid; gap: 9px; }
.role-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; font-size: 0.92rem; }
.role-row .rn { font-variant-numeric: tabular-nums; font-weight: 600; }
.role-row .rt { font-weight: 400; opacity: 0.7; font-size: 0.82rem; }
.rbar { grid-column: 1 / -1; position: relative; height: 7px; border-radius: 99px; background: rgba(242, 245, 243, 0.12); overflow: hidden; }
.rbar .band { position: absolute; top: 0; bottom: 0; background: rgba(242, 245, 243, 0.22); }
.rbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: rgba(242, 245, 243, 0.55); transition: width 0.25s; }
.role-row.good .fill { background: #8fd6a8; }
.role-row.low .fill { background: var(--gold); }
.role-row.high .fill { background: #9fc3e6; }
.role-row.plain { border-bottom: 1px solid rgba(242, 245, 243, 0.14); padding-bottom: 3px; }

/* commander banner on top of the decklist */
.list { overflow: hidden; }
.banner {
  position: relative; margin: -20px -20px 18px; min-height: 150px;
  display: flex; align-items: flex-end; padding: 18px 20px;
  background: var(--grad); color: #fff;
}
.banner.has-art { background: var(--art) center 30% / cover no-repeat, var(--grad); min-height: 190px; }
.banner::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(8, 14, 12, 0.05) 0%, rgba(8, 14, 12, 0.35) 45%, rgba(8, 14, 12, 0.85) 100%);
}
.banner > * { position: relative; }
.banner-kicker { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.banner-name { font: 700 1.9rem/1.1 var(--serif); letter-spacing: -0.01em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5); }
.banner-themes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.banner-themes span {
  font-size: 0.8rem; padding: 2px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(4px);
}
.credit { position: absolute; right: 12px; bottom: 8px; font-size: 0.72rem; opacity: 0.8; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 0; }
.seg button { white-space: nowrap; }
.seg-label { font-size: 0.82rem; color: var(--ink-soft); margin-right: 8px; }
.seg button {
  min-height: 30px; padding: 0.2em 0.8em; font-size: 0.88rem; cursor: pointer;
  border: 1px solid var(--ink-soft); background: #fff; color: var(--ink);
}
.seg button + button { border-left: 0; }
.seg button:first-of-type { border-radius: 4px 0 0 4px; }
.seg button:last-of-type { border-radius: 0 4px 4px 0; }
.seg button:hover { background: var(--paper-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.role-help { margin: 10px 0 0; }

/* synergy badge in lists and results */
.syn {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; vertical-align: 0.1em;
  font: 600 0.72rem/1.4 var(--sans); padding: 1px 8px; border-radius: 99px;
  background: #fff0e4; color: #8a2f0a; border: 1px solid #f6b285; white-space: nowrap;
}
.result .syn { margin: 3px 0 2px; }
.row.with-role { grid-template-columns: 5.2rem minmax(0, 1fr) 9.5rem 5.5rem 4.6rem auto; }
.row.with-role .cost { justify-content: flex-end; }
.role-pick select {
  font-size: 0.8rem; padding: 2px 4px; max-width: 9.5rem;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink-soft);
}
.role-pick.set select { border-color: var(--ink-soft); color: var(--ink); font-weight: 600; }

/* card view: overlapping stacks like cards laid out on a table */
.vgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px 16px;
  margin-top: 18px; align-items: start;
}
.vgroup h3 { font: 600 1rem/1.2 var(--serif); padding-bottom: 4px; margin-bottom: 8px; border-bottom: 2px solid var(--ink); display: flex; gap: 8px; align-items: baseline; }
.vgroup h3 .count { font: 400 0.85rem var(--sans); color: var(--ink-soft); }
.stack { display: flex; flex-direction: column; }
.vcard {
  position: relative; aspect-ratio: 63 / 88; border-radius: 4.8% / 3.5%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.12);
  background: #111; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
/* each card covers the one above except its title bar */
.vcard + .vcard { margin-top: calc(-139.68% + 1.85rem); }
.vcard:hover, .vcard:focus-within { transform: translateY(-8px); z-index: 2; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
.vcard img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.vcard.on-theme { box-shadow: 0 0 0 2px var(--gold), 0 0 14px 2px rgba(211, 166, 58, 0.55); }
.vcard.flag { box-shadow: 0 0 0 2px var(--bad); }
.vqty, .vspark {
  position: absolute; top: 0.32rem; display: grid; place-items: center;
  height: 1.25rem; min-width: 1.25rem; padding: 0 5px; border-radius: 99px;
  font: 700 0.72rem/1 var(--sans);
}
.vqty { right: 1.9rem; background: var(--ink); color: var(--paper); }
.vspark { left: -0.45rem; top: -0.45rem; background: var(--gold); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.vx {
  position: absolute; right: 0.3rem; top: 0.28rem; width: 1.35rem; height: 1.35rem; padding: 0;
  border: 0; border-radius: 99px; background: rgba(15, 20, 18, 0.75); color: #fff; cursor: pointer;
  font-size: 0.95rem; line-height: 1; opacity: 0; transition: opacity 0.12s;
}
.vcard:hover .vx, .vx:focus-visible { opacity: 1; }
@media (hover: none) { .vx { opacity: 0.85; } }

/* text-only stand-in for cards without an image (sample data) */
.mini {
  display: flex; flex-direction: column; height: 100%; padding: 5px;
  border-radius: inherit; background: var(--frame); color: var(--ink);
}
.mini-top, .mini-type, .mini-text { background: #f7f4ea; border-radius: 3px; }
.mini-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 3px 5px; min-height: 1.45rem; }
.mini-top .pip { font-size: 0.6rem; }
.mini-name { font: 700 0.74rem/1.15 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 1.6rem; }
.vcard .mini-top .cost { display: none; }
.mini-type { margin-top: 48%; padding: 2px 5px; font: italic 0.66rem/1.25 var(--serif); }
.mini-text { flex: 1; margin-top: 4px; padding: 4px 5px; font: 0.64rem/1.3 var(--serif); overflow: hidden; }

/* lands view: each land with its synergy score */
.lsummary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 18px; }
.lstat { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 6px; background: var(--paper-2); border-left: 3px solid var(--ink-soft); }
.lstat-n { font: 700 1.6rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.lstat-l { font-size: 0.82rem; color: var(--ink-soft); }
.lh { font: 600 1rem/1.2 var(--serif); margin-top: 18px; padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.lsources { display: grid; gap: 7px; margin-top: 10px; }
.lsources li { display: grid; grid-template-columns: auto minmax(0, 1fr) 3rem; gap: 10px; align-items: center; }
.lsrc-bar { position: relative; height: 10px; border-radius: 99px; background: var(--paper-2); }
.lsrc-bar .src { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--ink-soft); }
.lsrc-bar .need { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--gold-deep); }
.lsrc-n { font-size: 0.85rem; font-variant-numeric: tabular-nums; text-align: right; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 16px; margin-top: 16px; }
.ltile { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lface {
  position: relative; aspect-ratio: 63 / 88; border-radius: 4.8% / 3.5%; background: #111;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.12);
}
.lface img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.lface:hover .vx, .lface .vx:focus-visible { opacity: 1; }
.ltile.hi .lface { box-shadow: 0 0 0 2px var(--ok), 0 3px 10px rgba(0, 0, 0, 0.18); }
.ltile.lo .lface { box-shadow: 0 0 0 2px var(--bad), 0 3px 10px rgba(0, 0, 0, 0.18); }
.lscore {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 99px; font: 700 0.95rem/1.2 var(--sans); font-variant-numeric: tabular-nums;
  color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.ltile.hi .lscore { background: var(--ok); }
.ltile.mid .lscore { background: var(--gold-deep); }
.ltile.lo .lscore { background: var(--bad); }
.lname { font: 600 0.9rem/1.25 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lmakes { display: flex; gap: 2px; }
.lmakes .pip { font-size: 0.7rem; }
.lmeters { display: grid; gap: 3px; }
.lmeter { display: grid; grid-template-columns: 4.4rem minmax(0, 1fr) 2.4rem; gap: 6px; align-items: center; font-size: 0.74rem; color: var(--ink-soft); }
.lm-bar { height: 5px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.lm-bar span { display: block; height: 100%; background: var(--ink-soft); border-radius: inherit; }
.lm-v { text-align: right; font-variant-numeric: tabular-nums; }
.lwhy { font-size: 0.74rem; color: var(--ink-soft); font-style: italic; }

/* By type's Text layout: every card on one line, flowing into as many columns as fit */
.tlist { list-style: none; margin: 16px 0 0; padding: 0; columns: 270px; column-gap: 28px; }
.ti {
  display: grid; grid-template-columns: 2.9rem minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center;
  padding: 3px 4px; border-bottom: 1px solid var(--line); border-radius: 6px; break-inside: avoid; transition: background-color 0.12s;
}
.ti:hover { background: var(--paper-2); }
.ti .spct { margin: 0; justify-self: start; font-size: 0.72rem; }
.ti-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 0.95rem/1.5 var(--serif); }
.ti-n { font-size: 0.85rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.ti .cost, .ti .lmakes { justify-content: flex-end; }
.ti .x, .ti .more { width: 1.6rem; height: 1.6rem; }
@media (prefers-reduced-motion: reduce) { .ti { transition: none; } }

/* a row's ⋯ and × buttons: they show when the row is hovered or focused (always on touch screens) */
.row-acts { display: inline-flex; gap: 4px; justify-content: flex-end; }
.more {
  display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--line); border-radius: 4px; background: #fff; color: var(--ink); cursor: pointer;
}
.more svg { width: 14px; height: 14px; fill: currentColor; }
.more:hover, .more[aria-expanded="true"] { background: var(--paper-2); border-color: var(--ink-soft); }
@media (hover: hover) {
  .row-acts > * { opacity: 0; transition: opacity 0.12s; }
  :is(.row, .ti):hover .row-acts > *, .row-acts > :focus-visible, .row-acts > [aria-expanded="true"] { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .row-acts > * { transition: none; } }

/* the menu a ⋯ opens */
.card-menu {
  position: fixed; z-index: 80; min-width: 220px; max-width: 300px; padding: 6px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.card-menu [role="menuitem"] {
  display: block; width: 100%; padding: 7px 12px; border: 0; border-radius: 8px; background: none;
  color: inherit; font: inherit; font-size: 0.92rem; text-align: left; text-decoration: none; cursor: pointer;
}
.card-menu [role="menuitem"]:hover, .card-menu [role="menuitem"]:focus-visible { background: var(--paper-2); outline: none; }
.card-menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--line); }
.cm-head { padding: 6px 12px 4px; font: 600 0.8rem/1.3 var(--sans); color: var(--ink-soft); }
.cm-note { padding: 6px 12px; font-size: 0.88rem; color: var(--ink-soft); }
.cm-decks { max-height: 260px; overflow-y: auto; }
.cm-decks [role="menuitem"] span { display: block; font-size: 0.78rem; color: var(--ink-soft); }

/* ...and its hover preview: the card, with its stats underneath */
.peek.with-stats { aspect-ratio: auto; }
.peek-face { aspect-ratio: 63 / 88; overflow: hidden; }
.peek-stats { display: grid; gap: 5px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.ps-head { display: flex; align-items: center; gap: 8px; font: 600 0.95rem/1.3 var(--serif); }
.ps-head .spct { margin: 0; flex: none; }
.ps-type { font: italic 0.78rem/1.3 var(--serif); color: var(--ink-soft); }
.peek-stats .btag { justify-self: start; margin: 0; }

/* browse lands + enlarged card dialogs */
dialog.wide { width: min(1100px, 94vw); }
/* Close controls that stay reachable however far a long dialog is scrolled. */
.dlg-x {
  position: sticky; top: 12px; z-index: 5; display: grid; place-items: center;
  width: 38px; height: 38px; margin: 12px 12px -50px auto; padding: 0;
  border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--ink);
  font-size: 1.5rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.dlg-x:hover { background: var(--paper-2); border-color: var(--gold); }
dialog.wide .dlg > h2:first-child, dialog.wide .cd-info h2 { padding-right: 48px; }
dialog.wide .dlg-actions {
  position: sticky; bottom: 0; z-index: 4; margin: 0 -24px -24px; padding: 12px 24px;
  background: var(--paper); border-top: 1px solid var(--line);
}
.card-detail .dlg-actions { position: static; margin: 0; padding: 0; border: 0; background: none; }
.lbrowse { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }
.lbrowse .help { margin: 0; }
.lopen { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; border-radius: inherit; cursor: zoom-in; }
.lopen .mini { height: 100%; }
.lb-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.9rem; }
.lb-filter label { font-weight: 600; }
.lb-filter input { flex: 1 1 220px; max-width: 360px; padding: 0.4em 0.6em; border: 1px solid var(--ink-soft); border-radius: 4px; background: #fff; color: var(--ink); }
.lb-grid { margin-top: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.lb-act { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.lb-price { font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.lb-act .tag, .cd-info .tag { font-size: 0.8rem; color: var(--ink-soft); }
.card-detail { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.cd-face .face { display: block; width: 100%; height: auto; border-radius: 4.8% / 3.5%; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3); }
.cd-info { display: grid; gap: 12px; }
.cd-type { font: italic 0.95rem/1.3 var(--serif); color: var(--ink-soft); }
.cd-text { font: 0.95rem/1.5 var(--serif); }
.cd-syn { padding: 12px 14px; border-radius: 6px; background: var(--paper-2); border-left: 4px solid var(--gold-deep); display: grid; gap: 8px; }
.cd-syn.hi { border-left-color: var(--ok); }
.cd-syn.lo { border-left-color: var(--bad); }
.cd-score { font-size: 0.9rem; color: var(--ink-soft); }
.cd-score span { font: 700 1.6rem/1 var(--serif); color: var(--ink); margin-right: 4px; }
.cd-syn .lmeter { font-size: 0.82rem; }

@media (max-width: 760px) {
  .card-detail { grid-template-columns: minmax(0, 1fr); }
  .cd-face { max-width: 260px; margin: 0 auto; }
  .lb-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .lgrid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 18px 12px; }
  .banner { margin: -14px -14px 14px; min-height: 120px; }
  .banner.has-art { min-height: 150px; }
  .banner-name { font-size: 1.5rem; }
  .row.with-role { grid-template-columns: 5rem minmax(0, 1fr) auto; }
  .row.with-role .role-pick { grid-column: 2; grid-row: 2; }
  .vgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 18px 12px; }
}

/* =========================================================
   Brackets, synergy context, card styles, suggestions
   ========================================================= */

/* bracket picker in the command zone */
.brackets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.br-btn {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; min-width: 0;
  border: 1px solid rgba(242, 245, 243, 0.3); border-radius: 8px; background: rgba(0, 0, 0, 0.25); color: var(--paper); cursor: pointer;
}
.br-btn:hover { border-color: var(--gold); }
.br-btn[aria-pressed="true"] { background: var(--accent-grad); border-color: #f0611f; color: #1a0705; }
.br-n { font: 700 1.15rem/1 var(--serif); padding: 3px 0; }
.br-name { font-size: 0.64rem; letter-spacing: 0.02em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-blurb { margin-top: 8px; }
.br-status { margin-top: 6px; font-size: 0.86rem; padding: 6px 10px; border-radius: 6px; }
.br-status.ok { background: rgba(43, 110, 70, 0.3); }
.br-status.bad { background: rgba(179, 38, 30, 0.35); }
.cmd-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* "why" context */
.theme .th-why { grid-column: 1 / -1; font-size: 0.82rem; }
.th-why summary { cursor: pointer; color: #ffb37a; font-weight: 600; width: fit-content; }
.th-why[open] summary { margin-bottom: 6px; }
.th-why p { margin-top: 4px; opacity: 0.92; }
.why-k { font-weight: 700; font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.8; margin-right: 4px; }
q { font-style: italic; quotes: "“" "”"; }

/* synergy % and bracket tags */
.spct {
  display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 99px; vertical-align: 0.08em;
  font: 700 0.74rem/1.5 var(--sans); font-variant-numeric: tabular-nums; color: #fff;
}
.spct.hi { background: var(--ok); }
.spct.mid { background: var(--gold-deep); }
.spct.lo { background: var(--bad); }
.btag {
  display: inline-block; margin: 2px 6px 0 0; padding: 0 7px; border-radius: 4px; white-space: nowrap;
  font: 700 0.68rem/1.6 var(--sans); letter-spacing: 0.03em; text-transform: uppercase;
}
.btag.gc { background: #2a1010; color: #ffb37a; }
.btag.bad { background: #fde3df; color: var(--bad); border: 1px solid #f2b3aa; }
.name-btn {
  padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 2px;
}
.name-btn:hover { text-decoration-color: var(--gold); }
.finder-sort { margin-top: 0; }
.lb-count { margin: 0 auto 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.lb-count strong { color: var(--ink); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.lb-hide { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; }

/* card window: context and card styles */
.cd-cmd { padding: 10px 12px; border-radius: 6px; background: var(--paper-2); border-left: 4px solid var(--gold); font-size: 0.92rem; }
.cd-warn { font-size: 0.86rem; color: var(--bad); font-weight: 600; }
.cd-why ul, .cd-roles ul, .cd-bracket ul { display: grid; gap: 6px; margin-top: 4px; }
.cd-why li, .cd-roles li, .cd-bracket li { font-size: 0.9rem; }
.cd-roles q, .cd-why q { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 0.86rem; }
.cd-weights { font-size: 0.8rem; color: var(--ink-soft); }
.cd-roles, .cd-bracket { display: grid; gap: 4px; }
.cd-bracket p.ok, .cd-bracket p.warn, .cd-bracket p.bad { font-size: 0.86rem; font-weight: 600; }
.cd-bracket p.ok { color: var(--ok); }
.cd-bracket p.warn { color: var(--gold-deep); }
.cd-bracket p.bad { color: var(--bad); }
.cd-face { display: grid; gap: 10px; justify-items: start; }
.cd-style { font-size: 0.88rem; color: var(--ink-soft); }
.cd-style span { display: block; font-size: 0.8rem; }
.cd-prints { grid-column: 1 / -1; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.cd-prints h3 { font: 600 var(--s1)/1.2 var(--serif); }
.prints { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.pr-opt {
  display: grid; gap: 4px; width: 100%; padding: 6px; text-align: left; cursor: pointer;
  border: 2px solid transparent; border-radius: 10px; background: none; color: var(--ink);
}
.pr-opt:hover { border-color: var(--line); background: var(--paper-2); }
.pr-opt[aria-pressed="true"] { border-color: var(--gold); background: #fff3e8; }
.pr-opt img { width: 100%; height: auto; border-radius: 4.8% / 3.5%; display: block; }
.pr-none { display: grid; place-items: center; aspect-ratio: 63 / 88; border-radius: 8px; background: var(--paper-2); font-size: 0.8rem; color: var(--ink-soft); }
.pr-label { font-weight: 700; font-size: 0.84rem; }
.pr-sub { font-size: 0.76rem; color: var(--ink-soft); }

/* suggestions: pinned button + slide-out drawer */
.sg-tab {
  position: fixed; right: 18px; bottom: 18px; z-index: 35; display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border: 1px solid #f0611f; border-radius: 99px; cursor: pointer;
  background: #1a0707; color: var(--paper); font-weight: 700; font-size: 0.9rem;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 14px rgba(255, 122, 31, 0.35);
}
.sg-tab:hover { background: #2a0b0b; }
.sg-spark { color: var(--gold); }
.sg-count { min-width: 1.4em; padding: 0 5px; border-radius: 99px; background: var(--accent-grad); color: #1a0705; font-size: 0.78rem; text-align: center; }
body.sg-open .sg-tab { display: none; }
.sg-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 36; width: min(400px, 94vw);
  display: flex; flex-direction: column; background: var(--paper); color: var(--ink);
  border-left: 4px solid var(--gold); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
}
.sg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sg-head h2 { font: 600 var(--s2)/1.2 var(--serif); }
.sg-who { display: flex; align-items: center; gap: 10px; }
.sg-avatar {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 99px;
  background: var(--solid, var(--ink)); color: var(--on-solid, var(--paper)); font: 700 1.15rem/1 var(--serif);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--trim-1, var(--line));
}
.sg-role { font-size: 0.78rem; color: var(--ink-soft); }
.sg-say { font-size: 0.92rem; }
.sg-fill { display: grid; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); }
.sg-fill-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sg-item .sg-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.sg-x {
  width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 99px;
  background: #fff; color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.sg-x:hover { border-color: var(--gold); }
.sg-body { flex: 1; overflow: auto; padding: 12px 16px 24px; display: grid; gap: 16px; align-content: start; }
.sg-sec { display: grid; gap: 8px; }
.sg-sec h3 { font: 600 var(--s1)/1.2 var(--serif); padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.sg-item { display: grid; gap: 4px; justify-items: start; padding: 8px 10px; border-radius: 6px; background: var(--paper-2); border-left: 3px solid var(--ink-soft); font-size: 0.9rem; }
.sg-item.ok { border-left-color: var(--ok); }
.sg-item.warn { border-left-color: var(--gold); }
.sg-item.bad { border-left-color: var(--bad); }
.sg-why { font-size: 0.8rem; color: var(--ink-soft); }
.sg-cards { display: grid; gap: 2px; font-size: 0.86rem; }
.sg-cards li { display: flex; gap: 10px; align-items: baseline; }
.sg-picks { display: grid; gap: 4px; }
.sg-pick { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sg-pick img, .sg-noimg { width: 40px; height: 56px; object-fit: cover; border-radius: 3px; background: var(--paper-2); display: block; }
.sg-pick-main p:first-child { font: 0.95rem/1.3 var(--serif); }
@media (max-width: 760px) { .sg-tab { right: 12px; bottom: 12px; } }

/* copies stepper: − [n] + for basic lands and other any-number cards */
.qty-ctl { display: inline-flex; align-items: center; gap: 4px; }
.qty-in {
  width: 3.2em; height: 28px; padding: 0 4px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); -moz-appearance: textfield;
}
.qty-in::-webkit-outer-spin-button, .qty-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-in:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 122, 31, 0.22); outline: none; }
.row .qty .qty-in { width: 2.6em; }
.ltile .qty-ctl { margin: 2px 0; }

/* =========================================================
   Premium finish: glass side panels, hairline gradient borders,
   refined type, depth and motion
   ========================================================= */
:root { --hair: linear-gradient(135deg, rgba(255, 170, 90, 0.75), rgba(227, 54, 31, 0.35) 45%, rgba(255, 154, 60, 0.12)); }
::selection { background: rgba(255, 122, 31, 0.35); }
body {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .8 0 0 0 0 .7 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(1200px 500px at 50% -220px, rgba(255, 122, 31, 0.18), transparent 70%),
    var(--page-bg), var(--felt);
  background-attachment: fixed;
}
* { scrollbar-width: thin; scrollbar-color: rgba(180, 67, 15, 0.55) transparent; }

/* header */
.bar { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding-top: 14px; padding-bottom: 14px; }
.brand { font-size: 1.6rem; letter-spacing: 0.01em; text-shadow: 0 2px 18px rgba(255, 122, 31, 0.25); }

/* light panels: warm ivory with a glowing hairline border */
.panel, dialog {
  border: 1px solid transparent;
  background: linear-gradient(180deg, #fffdfb 0%, #f8f1ec 100%) padding-box, var(--hair) border-box;
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.15);
}
.finder { border-top: 1px solid transparent; }
.finder::before, dialog::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: 0; height: 2px; border-radius: 2px; background: var(--accent-grad); opacity: 0.9;
}
dialog { border-top: 1px solid transparent; }
@media (max-width: 1180px) { .finder { position: relative; } }
dialog.wide .dlg-actions { background: #f8f1ec; }
.panel h2, .dlg h2 { font-weight: 600; letter-spacing: -0.015em; }
.list { position: relative; }
.banner { border-radius: 16px 16px 0 0; }
.banner::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent-grad); }

/* dark side columns become glass cards */
.zone, .stats {
  padding: 20px; border-radius: 16px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, rgba(36, 12, 12, 0.72), rgba(14, 5, 5, 0.72)) padding-box, var(--hair) border-box;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.zone h3, .stats h3 {
  font: 700 0.72rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: #ffb37a;
  display: flex; align-items: center; gap: 10px; margin-top: 26px;
}
.zone h3::after, .stats h3::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 179, 122, 0.45), transparent); }
.zone h2, .stats h2 { letter-spacing: -0.01em; }
.price-total, .lstat-n, .cd-score span {
  background: linear-gradient(135deg, #ffb066, #ff7a1f 45%, #e3361f); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.theme { border-radius: 10px; background: rgba(255, 255, 255, 0.04); border-left-width: 3px; }

/* buttons: depth, highlight, lift */
.btn { border-radius: 8px; transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s, border-color 0.15s; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn.primary, .bar .btn.primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 4px 16px rgba(227, 54, 31, 0.38); }
.btn:not(.primary):not(.link) { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.bar .btn:not(.primary), .zone .btn:not(.primary) { box-shadow: none; }

/* segmented controls: one rounded track, dark pressed state */
.seg button { min-height: 32px; border-color: var(--line); background: #fff; transition: background-color 0.15s, color 0.15s; }
.seg button:first-of-type { border-radius: 99px 0 0 99px; padding-left: 1em; }
.seg button:last-of-type { border-radius: 0 99px 99px 0; padding-right: 1em; }
.seg button[aria-pressed="true"] {
  background: linear-gradient(180deg, #2d1414, #140808); color: #ffd2b0; border-color: #140808;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.chip { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s; }
.chip:hover { transform: translateY(-1px); }

/* inputs */
.search, .lb-filter input, .subpick select, .field input[type="text"], .field input[type="password"], .field input[type="email"],.field textarea {
  border-color: var(--line); background: #fff; box-shadow: inset 0 1px 2px rgba(60, 20, 10, 0.06);
}
.search { border-radius: 10px; }

/* lists and tiles */
.result { border-radius: 8px; padding-left: 6px; padding-right: 6px; transition: background-color 0.12s; }
.result:hover { background: #fbf1ea; }
.result .thumb { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); border-radius: 4px; }
.row { border-radius: 6px; transition: background-color 0.12s; }
.row:hover { background: #fbf1ea; }
.group h3, .vgroup h3, .lh { border-bottom: 0; position: relative; padding-bottom: 6px; }
.group h3::after, .vgroup h3::after, .lh::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--ink), rgba(28, 16, 16, 0.15) 60%, transparent);
}
.lface, .vcard { transition: transform 0.2s ease, box-shadow 0.2s ease; }
/* hovering a card's picture (browse window, By type view) magnifies it enough to read, above its neighbors.
   Only the picture inside grows, and it lets the mouse through (pointer-events: none), so the hover area stays
   the card's own spot: moving onto a name or an Add button, this card's or a neighbor's, shrinks it back
   instead of the big card sitting in the way. A click on the magnified card lands on .lface, which opens it too.
   app.js sets --zoom-x / --zoom-y so tiles at the edges grow inward instead of getting clipped. */
.ltile .lface { cursor: zoom-in; }
.ltile .lface:hover { z-index: 6; }
.ltile .lopen { position: relative; transform-origin: var(--zoom-x, 50%) var(--zoom-y, 25%); transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.3, 1), box-shadow 0.24s ease; }
.ltile .lface:hover .lopen { transform: scale(1.5); transition-delay: 0.1s; pointer-events: none; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 122, 31, 0.5), 0 0 22px rgba(255, 122, 31, 0.25); }
.lscore { backdrop-filter: blur(4px); letter-spacing: 0.02em; }
.lstat {
  border-radius: 12px; border-left: 0; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fff, #f6ece6); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 4px 14px rgba(60, 20, 10, 0.08);
}
.lstat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent-grad); }
.cat-blurb, .cd-syn, .cd-cmd, .sg-item { border-radius: 10px; }
.empty-list { border-radius: 12px; border-color: var(--line); background: rgba(255, 255, 255, 0.5); }

/* dialogs and overlays */
dialog::backdrop { background: radial-gradient(circle at 50% 30%, rgba(40, 8, 8, 0.6), rgba(5, 1, 1, 0.82)); backdrop-filter: blur(3px); }
.dlg-x, .sg-x { transition: transform 0.15s, border-color 0.15s; }
.dlg-x:hover, .sg-x:hover { transform: rotate(90deg); }
.toast { border-radius: 10px; background: rgba(20, 8, 8, 0.92); backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.sg-drawer { background: linear-gradient(180deg, #fffdfb, #f8f1ec); }
.sg-tab { backdrop-filter: blur(8px); transition: transform 0.15s, box-shadow 0.15s; }
.sg-tab:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 122, 31, 0.5); }

/* "Fits your deck" explanation under the sort switches */
.sort-note { flex-basis: 100%; margin: 0 !important; font-size: 0.82rem; }
.finder .sort-note { margin-top: 6px !important; }
.finder-sort .seg-label { display: none; }
.finder-sort .seg button { padding-left: 0.7em; padding-right: 0.7em; }
.cd-deck { border-left-style: double; border-left-width: 6px; }

/* land categories in the browse window */
.land-cats, .toolbar > .cat-blurb, .toolbar > .lc-note { flex-basis: 100%; }
.land-cats { display: grid; gap: 8px; }
.lc-group { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 8px; align-items: start; }
.lc-label { padding-top: 6px; font: 700 0.7rem/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-deep); }
.lc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lc-chips .chip { min-height: 28px; font-size: 0.82rem; padding: 0.15em 0.75em; }
.toolbar > .cat-blurb { margin: 2px 0 0; }
.lc-note { margin: 0 !important; }
@media (max-width: 760px) { .lc-group { grid-template-columns: minmax(0, 1fr); gap: 4px; } .lc-label { padding-top: 0; } }
@media (max-width: 480px) {
  dialog.wide .dlg-actions { gap: 6px; padding: 8px 12px; }
  dialog.wide .dlg-actions .btn { min-height: 30px; padding: 0.25em 0.7em; font-size: 0.85rem; }
}

/* export */
dialog.mid { width: min(720px, 94vw); }
.field-label { font-weight: 600; font-size: 0.92rem; }
.ex-formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(140px, calc(50% - 4px)), 1fr)); gap: 8px; }
@media (max-width: 480px) { .ex-fmt { padding: 8px 10px; } .ex-ext { display: none; } }
.ex-fmt {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 10px 12px; cursor: pointer; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.ex-fmt:hover { border-color: var(--gold); transform: translateY(-1px); }
.ex-fmt[aria-pressed="true"] { background: linear-gradient(180deg, #2d1414, #140808); color: #ffd2b0; border-color: #140808; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.ex-name { font-weight: 700; font-size: 0.9rem; }
.ex-ext { font: 0.74rem ui-monospace, Menlo, Consolas, monospace; opacity: 0.7; }
.ex-opt { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }

/* import */
.im-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.im-tools { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.im-file { position: relative; overflow: hidden; }
.im-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.im-file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
#import-text.drop { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 122, 31, 0.3); background: #fff7f0; }
.im-preview:empty { display: none; }
.im-preview { display: grid; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--paper-2); border-left: 3px solid var(--gold); font-size: 0.9rem; }
.im-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.im-pill { padding: 1px 10px; border-radius: 99px; background: linear-gradient(180deg, #2d1414, #140808); color: #ffd2b0; font-size: 0.78rem; font-weight: 700; }
.im-ok { color: var(--ok); font-weight: 600; }
.im-bad { color: var(--bad); font-weight: 600; }
.im-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.im-row select { flex: 1 1 200px; max-width: 320px; padding: 0.3em 0.5em; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-weight: 400; }

.print-area { display: none; }
@media print {
  body { background: #fff !important; color: #000; }
  body > *:not(.print-area) { display: none !important; }
  dialog, dialog::backdrop { display: none !important; }
  .print-area { display: block; font: 10.5pt/1.35 var(--serif); color: #000; }
  .print-area h1 { font-size: 20pt; margin: 0 0 2pt; }
  .print-area .pr-meta { color: #444; margin-bottom: 12pt; font-family: var(--sans); font-size: 9pt; }
  .print-area .pr-cols { columns: 3; column-gap: 18pt; }
  .print-area section { break-inside: avoid; margin-bottom: 10pt; }
  .print-area h2 { font-size: 11pt; border-bottom: 1pt solid #000; margin: 0 0 3pt; padding-bottom: 1pt; }
  .print-area h2 small { font-weight: 400; color: #555; }
  .print-area li span { display: inline-block; min-width: 1.6em; font-weight: 700; }
  .print-area .pr-foot { margin-top: 14pt; font-size: 8pt; color: #777; font-family: var(--sans); }
}

@media (max-width: 760px) {
  .zone, .stats { padding: 14px; }
  .panel, dialog { border-radius: 14px; }
}

/* =========================================================
   Guy's place: a bright, welcoming home.
   White rooms and paper, near-black accents used sparingly,
   hairline borders, soft shadows and rounded, friendly shapes.
   ========================================================= */
body { color: var(--ink); background: var(--page-bg), var(--felt); background-attachment: fixed; }
:root[data-themed] body {
  background:
    radial-gradient(1100px 620px at 0% -10%, color-mix(in srgb, var(--tint-1) 9%, transparent), transparent 70%),
    radial-gradient(1000px 620px at 100% -10%, color-mix(in srgb, var(--tint-2) 7%, transparent), transparent 70%),
    var(--page-bg), var(--felt);
  background-attachment: fixed;
}
::selection { background: rgba(0, 0, 0, 0.12); }
/* Scrollbars: dark on the cream page, light on the dark surfaces (panels, dialogs, Guy's drawer, the account
   menu), each strong enough to spot at a glance. scrollbar-color isn't inherited past the `*` rule, so the dark
   surfaces set it on themselves and everything inside them. */
* { scrollbar-color: rgba(20, 20, 20, 0.45) transparent; }
:is(.panel, .zone, .stats, dialog, .sg-drawer, .acct-pop, .card-menu), :is(.panel, .zone, .stats, dialog, .sg-drawer, .acct-pop, .card-menu) * {
  scrollbar-color: rgba(241, 236, 227, 0.5) rgba(241, 236, 227, 0.06);
}
:focus-visible, .bar :focus-visible, .zone :focus-visible, .stats :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* header: a black band across the top, everything in it light */
.bar {
  color: #fbf5eb;
  background: #141414;
  border-bottom: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.bar::before { display: none; }
/* the logo: a small hand of cards, and a wordmark where "The" is just lighter, not styled */
.brand { text-shadow: none; letter-spacing: -0.005em; gap: 9px; }
.brand-accent { background: none; color: inherit; -webkit-text-fill-color: currentColor; font-weight: 400; font-style: normal; }
.brand-mark { width: 30px; height: 30px; border: 0; border-radius: 0; box-shadow: none; background: none; color: currentColor; }
.brand-spark { fill: #141414; }
.hero .brand-accent { font-weight: 400; }
header.bar .btn:not(.primary) { color: #fbf5eb; border-color: rgba(247, 245, 240, 0.32); background: transparent; }
header.bar .btn:not(.primary):hover { background: rgba(247, 245, 240, 0.1); border-color: rgba(247, 245, 240, 0.7); }
header.bar .btn.primary { background: #fbf5eb; color: #141414; border-color: #fbf5eb; box-shadow: none; }
header.bar .btn.primary:hover { background: #fff; border-color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.deckname input { color: #fbf5eb; border-bottom-color: rgba(247, 245, 240, 0.3); }
.save-status { color: rgba(247, 245, 240, 0.65); }
.bar :focus-visible { outline-color: #fbf5eb; }

/* buttons: rounded and calm; solid black for the main action */
.btn, .bar .btn, .zone .btn { border-radius: 99px; border-color: #dacebc; }
.btn:not(.primary):hover { border-color: #141414; }
.btn.primary, .bar .btn.primary, .zone .btn.primary {
  background: #141414; color: #fff; border-color: #141414;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.12);
}
.btn.primary:hover, .bar .btn.primary:hover { background: #2a2a2a; filter: none; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.14), 0 8px 18px rgba(0, 0, 0, 0.14); }
.chip[aria-pressed="true"], .br-btn[aria-pressed="true"], .brackets .br-btn[aria-pressed="true"],
.seg button[aria-pressed="true"], .ex-fmt[aria-pressed="true"], .im-pill {
  background: #141414; color: #fff; border-color: #141414; box-shadow: none;
}
.chip:hover { border-color: #141414; }

/* every surface is white paper with a hairline edge */
.panel, dialog, .zone, .stats {
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(0, 0, 0, 0.05);
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.finder::before, dialog::before { height: 2px; left: 28px; right: 28px; background: #141414; opacity: 1; }
dialog.wide .dlg-actions { background: var(--paper); }
dialog::backdrop { background: rgba(15, 15, 15, 0.28); backdrop-filter: blur(4px); }
.zone h3, .stats h3 { color: var(--ink-soft); letter-spacing: 0.14em; }
.zone h3::after, .stats h3::after { background: var(--line); }
.zone .help, .stats .help { color: var(--ink-soft); }
.zone .btn:not(.primary) { background: #fffbf4; color: var(--ink); border-color: #dacebc; }
.zone .btn:not(.primary):hover { background: var(--paper-2); border-color: #141414; }
.note { background: var(--paper-2); color: var(--ink); border-left-color: #141414; }
.cat-blurb { border-left-color: #141414; }

/* command zone */
.frame { border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12); }
.frame.empty { border: 1.5px dashed #c9bba6; background: #f7f0e5; box-shadow: none; }
.wheel .link { stroke: rgba(0, 0, 0, 0.14); }
.wheel .w-off circle { stroke: rgba(0, 0, 0, 0.32); }
.wheel .w-off text { fill: var(--ink-soft); }
.wheel .w-on circle, .wheel .colorless { stroke: #fff; }
.theme { background: #fffbf4; border: 1px solid var(--line); border-left: 2px solid #141414; }
.th-why summary { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #c9bba6; }
.brackets .br-btn { background: #fffbf4; border-color: var(--line); color: var(--ink); }
.brackets .br-btn:hover { border-color: #141414; }
.br-status.ok { background: rgba(43, 110, 70, 0.08); color: var(--ok); }
.br-status.bad { background: rgba(179, 38, 30, 0.07); color: var(--bad); }

/* stats */
.checks .ok .mark { color: var(--ok); }
.checks .bad .mark { color: var(--bad); }
.checks .todo .mark { color: #a3a39f; }
.curve .bar-fill { background: linear-gradient(0deg, #141414, #4a4a47); }
.curve .lbl { border-top-color: rgba(0, 0, 0, 0.14); }
.typecounts li, .role-row.plain { border-bottom-color: var(--line); }
.rbar { background: #eee4d4; }
.rbar .band { background: #dfd4c2; }
.rbar .fill { background: #8c8c88; }
.role-row.good .fill { background: #3d8a5b; }
.role-row.low .fill { background: #141414; }
.role-row.high .fill { background: #5b8fc4; }
.price-total, .lstat-n, .cd-score span { background: none; color: var(--ink); -webkit-text-fill-color: currentColor; }

/* lists, search and tiles */
.search:focus, .qty-in:focus { border-color: #141414; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07); }
.row:hover, .result:hover { background: #f5ede0; }
.group h3::after, .vgroup h3::after, .lh::after { height: 1px; background: var(--line); }
.syn { background: #f2e9db; color: var(--ink); border-color: #dfd4c2; }
.btag.gc { background: #141414; color: #fff; }
.vcard.on-theme { box-shadow: 0 0 0 2px #141414, 0 6px 16px rgba(0, 0, 0, 0.18); }
.vspark { color: #fff; }
.ltile .lface:hover .lopen { box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18), 0 0 0 1px #141414; }
.lstat { background: #f7f0e5; border: 1px solid var(--line); box-shadow: none; }
.lstat::before { width: 2px; background: #141414; }
.pr-opt[aria-pressed="true"] { border-color: #141414; background: #f5ede0; }
#import-text.drop { border-color: #141414; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08); background: #f7f0e5; }
.im-preview { border-left-color: #141414; }
.empty-list { background: #f7f0e5; border-color: #dacebc; }
.banner::after { height: 1px; background: rgba(255, 255, 255, 0.5); }

/* suggestions, toasts */
.sg-tab { background: #141414; border-color: #141414; color: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2); }
.sg-tab:hover { background: #2a2a2a; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24); }
.sg-spark { color: #fff; }
.sg-count { background: #fffbf4; color: #141414; }
.sg-drawer { background: #fffbf4; border-left: 1px solid var(--line); box-shadow: -16px 0 40px rgba(0, 0, 0, 0.08); }
.toast { background: rgba(20, 20, 20, 0.96); color: #fff; border-left-color: #fff; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2); }
.peek { border: 1px solid var(--line); box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22); }

/* inputs and small controls: a touch brighter than the cards, never pure white */
.search, .lb-filter input, .subpick select, .field input[type="text"], .field input[type="password"], .field input[type="email"],.field textarea, .im-row select, .role-pick select,
.chip, .seg button, .step, .x, .more, .qty-in, .dlg-x, .sg-x, .ex-fmt { background-color: #fffbf4; }
.seg button[aria-pressed="true"], .chip[aria-pressed="true"], .ex-fmt[aria-pressed="true"] { background-color: #141414; }

/* =========================================================
   Deck stats dashboard (above the decklist): a row of tiles
   with the headline numbers; the open tile's details sit below.
   ========================================================= */
.dash-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; margin-bottom: 12px; }
.dash-head h2 { margin: 0 !important; }
.dash-head .help { margin: 0 !important; font-size: 0.82rem; }
.stats { container-type: inline-size; }
.dash-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
@container (max-width: 600px) { .dash-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 400px) { .dash-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dash-tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.dash-tile {
  position: relative; display: grid; grid-template-rows: auto auto auto 1fr; align-content: start; gap: 2px;
  min-width: 0; padding: 11px 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 14px; background: #fffbf4; color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.dash-tile:hover { border-color: #141414; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06); }
.dash-tile.on { border-color: #141414; box-shadow: 0 0 0 1px #141414; }
.dash-tile::after { /* a small chevron: down when closed, up when open */
  content: ""; position: absolute; right: 11px; top: 13px; width: 5px; height: 5px;
  border-right: 1.5px solid #9a8f80; border-bottom: 1.5px solid #9a8f80; transform: rotate(45deg); transition: transform 0.2s;
}
.dash-tile.on::after { transform: translateY(3px) rotate(-135deg); border-color: #141414; }
.dt-label { font: 700 0.64rem/1.2 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-soft); padding-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-value { font: 700 1.3rem/1.2 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.dt-sub { font-size: 0.74rem; line-height: 1.3; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dt-bars, .dt-dots, .dt-pips, .dt-split { align-self: end; margin-top: 8px; }
.dt-bars { display: flex; align-items: flex-end; gap: 2px; height: 18px; }
.dt-bars span { flex: 1; min-height: 2px; border-radius: 1.5px; background: #141414; opacity: 0.82; }
.dt-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dt-dots span { width: 9px; height: 9px; border-radius: 50%; background: #3d8a5b; }
.dt-dots .low { background: transparent; box-shadow: inset 0 0 0 1.5px #8f8476; }
.dt-dots .high { background: #5b8fc4; }
.dt-pips { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.dt-pips > span { display: inline-flex; align-items: center; gap: 3px; }
.dt-pips .pip { font-size: 0.56rem; min-width: 1.35em; height: 1.35em; }
.dt-split { height: 6px; border-radius: 99px; background: #e7ded0; overflow: hidden; }
.dt-split span { display: block; height: 100%; border-radius: inherit; background: #141414; }

.dash-panel { margin-top: 12px; padding: 16px 18px; border-radius: 14px; background: #f7f0e5; border: 1px solid var(--line); animation: dash-in 0.18s ease-out; }
@keyframes dash-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dash-panel .curve { max-width: 560px; }
.dash-panel .curve .track { height: 96px; }
.dash-panel .roles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 28px; }
.dash-panel .typecounts { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 28px; }
.dash-panel .help { margin: 10px 0 0 !important; }
.dash-panel .price-total { font-size: 1.8rem; }
@media (max-width: 760px) { .dash-panel { padding: 14px; } }
@media (prefers-reduced-motion: reduce) { .dash-panel { animation: none; } }

/* =========================================================
   Commander trims: once a commander is chosen, its colors
   quietly run through the builder's outlines, accent lines and
   hues. Buttons and selected states stay black.
   --trim-1 / --trim-2: first and last identity colors; --trim-grad: all of them.
   ========================================================= */
:root[data-themed] {
  --trim-line: color-mix(in srgb, var(--trim-1) 30%, var(--line));
  --trim-soft: color-mix(in srgb, var(--trim-1) 5%, var(--paper));
}
:root[data-themed] .panel, :root[data-themed] .zone, :root[data-themed] .stats, :root[data-themed] dialog {
  border-color: var(--trim-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px color-mix(in srgb, var(--trim-1) 9%, transparent);
  transition: border-color 0.4s, box-shadow 0.4s;
}
/* accent lines: the header stripe, the top edge of the finder and dialogs, the banner's lower edge */
:root[data-themed] .bar::after { height: 2px; background: var(--trim-grad); }
:root[data-themed] .finder::before, :root[data-themed] dialog::before { height: 3px; background: var(--trim-grad); }
:root[data-themed] .banner::after { height: 2px; background: var(--trim-grad); opacity: 0.9; }
:root[data-themed] .lstat::before { background: var(--trim-grad); }
/* section labels and group headings get a hint of the color in their rules */
:root[data-themed] .zone h3 { color: color-mix(in srgb, var(--trim-1) 55%, var(--ink-soft)); }
:root[data-themed] .zone h3::after { background: linear-gradient(90deg, color-mix(in srgb, var(--trim-1) 45%, transparent), transparent); }
:root[data-themed] .group h3::after, :root[data-themed] .vgroup h3::after, :root[data-themed] .lh::after {
  background: linear-gradient(90deg, color-mix(in srgb, var(--trim-1) 55%, transparent), var(--line) 55%, transparent);
}
/* the commander card, synergy themes and on-theme cards */
:root[data-themed] .frame.filled { border-color: color-mix(in srgb, var(--trim-1) 45%, transparent); box-shadow: 0 8px 24px color-mix(in srgb, var(--trim-1) 22%, rgba(0, 0, 0, 0.1)); }
:root[data-themed] .theme { border-left-color: var(--trim-1); }
:root[data-themed] .cat-blurb, :root[data-themed] .im-preview { border-left-color: var(--trim-1); }
:root[data-themed] .syn { background: var(--trim-soft); border-color: color-mix(in srgb, var(--trim-1) 28%, transparent); }
:root[data-themed] .vcard.on-theme { box-shadow: 0 0 0 2px var(--trim-1), 0 6px 16px color-mix(in srgb, var(--trim-1) 25%, transparent); }
/* the stats dashboard */
:root[data-themed] .dash-tile:hover { border-color: color-mix(in srgb, var(--trim-1) 65%, #141414); }
:root[data-themed] .dash-tile.on { border-color: var(--trim-1); box-shadow: 0 0 0 1px var(--trim-1), 0 6px 16px color-mix(in srgb, var(--trim-1) 14%, transparent); }
:root[data-themed] .dash-tile.on::after { border-color: var(--trim-1); }
:root[data-themed] .dt-bars span, :root[data-themed] .dt-split span { background: color-mix(in srgb, var(--trim-1) 70%, #141414); }
:root[data-themed] .curve .bar-fill { background: linear-gradient(0deg, color-mix(in srgb, var(--trim-1) 75%, #141414), color-mix(in srgb, var(--trim-2) 60%, #fff)); }
:root[data-themed] .dash-panel { background: var(--trim-soft); border-color: var(--trim-line); }
/* focus and hover outlines on inputs and cards */
:root[data-themed] .search:focus, :root[data-themed] .qty-in:focus { border-color: var(--trim-1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--trim-1) 16%, transparent); }
:root[data-themed] .ltile .lface:hover .lopen { box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--trim-1); }
:root[data-themed] .chip:hover:not([aria-pressed="true"]) { border-color: var(--trim-1); }

/* =========================================================
   Account menu (header, both pages): the username button opens
   a small card with "Your stuff" (decks, collection, ...) and
   Sign out.
   ========================================================= */
.acct-menu { position: relative; }
.acct-menu > summary { list-style: none; cursor: pointer; user-select: none; gap: 8px; }
.acct-menu > summary::-webkit-details-marker { display: none; }
.acct-menu > summary::after { /* chevron */
  content: ""; width: 5px; height: 5px; margin: -3px 1px 0 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); opacity: 0.75; transition: transform 0.2s;
}
.acct-menu[open] > summary::after { transform: translateY(3px) rotate(-135deg); }
.acct-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; min-width: 210px; padding: 6px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
}
.acct-pop.flip { right: auto; left: 0; }
.acct-who { padding: 8px 12px 10px; margin: 0 0 4px; border-bottom: 1px solid var(--line); font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; }
.acct-who strong { color: var(--ink); }
.acct-item {
  display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none;
  color: var(--ink); font: inherit; font-size: 0.92rem; text-align: left; text-decoration: none; cursor: pointer;
}
.acct-item:hover, .acct-item:focus-visible { background: var(--paper-2); }
.acct-head { margin: 4px 0 2px; padding: 6px 12px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.acct-sep { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
#btn-logout { color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .acct-pop { animation: none; } }

/* =========================================================
   Commander backdrop: the chosen commander's art, blurred and
   washed into the cream, sitting behind the builder. It's
   strongest at the top and fades out down the page.
   ========================================================= */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--cmd-art, none) center 22% / cover no-repeat;
  filter: blur(6px) saturate(1.1);
  transform: scale(1.06); /* hides the blur's soft edge */
  opacity: 0; transition: opacity 0.9s ease;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.75) 35%, rgba(0, 0, 0, 0.25) 75%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.75) 35%, rgba(0, 0, 0, 0.25) 75%, transparent 100%);
}
:root[data-art] body::before { opacity: 0.62; }
/* a cream veil over the art keeps the page light and the panels the focus */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(244, 238, 228, 0.22) 0%, rgba(244, 238, 228, 0.45) 55%, rgba(244, 238, 228, 0.78) 100%);
  opacity: 0; transition: opacity 0.9s ease;
}
:root[data-art] body::after { opacity: 1; }
@media print { body::before, body::after { display: none; } }
@media (prefers-reduced-motion: reduce) { body::before, body::after { transition: none; } }

/* =========================================================
   Dark panels: the builder's surfaces (panels, dialogs, the
   suggestions drawer, the account menu) are a warm charcoal,
   close to black. The color tokens are redefined inside them,
   so their contents follow; the rules below fix the spots that
   used fixed light colors. Accents inside flip to cream.
   ========================================================= */
.panel, .zone, .stats, dialog, .sg-drawer, .acct-pop, .card-menu, .peek {
  --paper: #1f1e1c;        /* the surface */
  --paper-2: #2a2826;      /* insets: notes, hovered rows, stat details */
  --control: #262422;      /* inputs, chips, tiles */
  --line: #3a3835;
  --line-strong: #4d4a45;
  --ink: #f1ece3;
  --ink-soft: #a9a195;
  --solid: #f1ece3;        /* selected states and main buttons */
  --on-solid: #161514;
  --gold: #d8d1c4;
  --gold-deep: #8f877b;
  --focus: #f1ece3;
  --ok: #7cc496;
  --bad: #f0897a;
  color: var(--ink);
  border-color: var(--line);
}
:root[data-themed] :is(.panel, .zone, .stats, dialog, .sg-drawer, .acct-pop, .card-menu, .peek) {
  --trim-line: color-mix(in srgb, var(--trim-1) 40%, var(--line));
  --trim-soft: color-mix(in srgb, var(--trim-1) 9%, var(--paper));
}
.panel, .zone, .stats, dialog, .sg-drawer, .acct-pop, .card-menu, .peek { background: var(--paper); }
.panel, .zone, .stats, dialog { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 14px 34px rgba(30, 20, 10, 0.22); }

/* inputs, chips, tiles and small controls */
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.search, .lb-filter input, .subpick select, .field input, .field textarea, .im-row select, .role-pick select,
  .chip, .seg button, .step, .x, .more, .qty-in, .dlg-x, .sg-x, .ex-fmt, .dash-tile, .theme, .br-btn, .btn:not(.primary)) {
  background-color: var(--control); color: var(--ink); border-color: var(--line-strong);
}
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.search, .lb-filter input, .field input, .field textarea)::placeholder { color: #857d72; }
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.btn:not(.primary), .chip, .dash-tile, .br-btn, .ex-fmt):hover { border-color: var(--ink); background-color: #2f2d2a; }
/* selected states and main buttons: cream on charcoal */
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.chip[aria-pressed="true"], .seg button[aria-pressed="true"], .br-btn[aria-pressed="true"],
  .ex-fmt[aria-pressed="true"], .im-pill, .btn.primary, .btag.gc) {
  background: var(--solid); color: var(--on-solid); border-color: var(--solid); box-shadow: none;
}
:is(.panel, .zone, .stats, dialog, .sg-drawer) .btn.primary:hover { background: #ffffff; border-color: #ffffff; }
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.search, .qty-in):focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(241, 236, 227, 0.12); }

/* insets and hovered rows */
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.row:hover, .result:hover, .frame.empty, .empty-list, .lstat, .dash-panel, .syn, .pr-opt[aria-pressed="true"], #import-text.drop) {
  background: var(--paper-2);
}
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.frame.empty, .empty-list) { border-color: var(--line-strong); }
:is(.panel, .zone, .stats, dialog) .syn { color: var(--ink); border-color: var(--line-strong); }
:is(.panel, .zone, .stats, dialog) :is(.cat-blurb, .note, .im-preview) { border-left-color: var(--ink); }
:is(.panel, .zone, .stats, dialog) .theme { border-left-color: var(--ink); }
:is(.panel, .zone, .stats, dialog) .pr-opt[aria-pressed="true"] { border-color: var(--ink); }
:is(.panel, .zone, .stats, dialog) .lstat::before, .finder::before, dialog::before { background: var(--ink); }
:is(.panel, .zone, .stats, dialog) :is(.vcard.on-theme) { box-shadow: 0 0 0 2px var(--ink), 0 6px 16px rgba(0, 0, 0, 0.35); }
:is(.panel, .zone, .stats, dialog) .ltile .lface:hover .lopen { box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--ink); }

/* the color wheel and mana symbols */
:is(.zone, .panel, dialog) .wheel .link { stroke: rgba(241, 236, 227, 0.22); }
:is(.zone, .panel, dialog) .wheel .w-off circle { stroke: rgba(241, 236, 227, 0.4); }
:is(.zone, .panel, dialog) .wheel .w-W text { fill: #161514; }
:is(.zone, .panel, dialog) .wheel .w-on circle, :is(.zone, .panel, dialog) .wheel .colorless { stroke: var(--paper); }
:is(.panel, .zone, .stats, dialog, .sg-drawer) :is(.pip-W, .pip-n) { color: #161514; }
:is(.panel, .zone, .stats, dialog, .sg-drawer) .pip-B { box-shadow: 0 0 0 1px rgba(241, 236, 227, 0.35); }
:is(.panel, .zone, .stats, dialog) .mini { color: #161514; }

/* stats: bars and tracks read light on charcoal */
:is(.stats, .panel) .curve .bar-fill { background: linear-gradient(0deg, #d9d2c5, #8f887c); }
:is(.stats, .panel) .curve .lbl { border-top-color: rgba(241, 236, 227, 0.18); }
.stats .dt-bars span, .stats .dt-split span { background: var(--ink); }
.stats .dt-split { background: rgba(241, 236, 227, 0.12); }
.stats .dt-dots .low { box-shadow: inset 0 0 0 1.5px #8f877b; }
.stats .dash-tile.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.stats .dash-tile::after { border-color: #8f877b; }
.stats .rbar { background: rgba(241, 236, 227, 0.08); }
.stats .rbar .band { background: rgba(241, 236, 227, 0.12); }
.stats .rbar .fill { background: #8f877b; }
.stats .role-row.low .fill { background: var(--ink); }
.stats .role-row.good .fill { background: #5fae7d; }
:is(.panel, .zone, .stats, dialog) .lm-bar span { background: var(--ink-soft); }

/* commander trims on charcoal: lighter mixes so the hue still shows */
:root[data-themed] .stats .dt-bars span, :root[data-themed] .stats .dt-split span { background: color-mix(in srgb, var(--trim-1) 65%, #f1ece3); }
:root[data-themed] :is(.stats, .panel) .curve .bar-fill { background: linear-gradient(0deg, color-mix(in srgb, var(--trim-1) 80%, #f1ece3), color-mix(in srgb, var(--trim-2) 45%, #f1ece3)); }
:root[data-themed] .stats .dash-tile.on { border-color: color-mix(in srgb, var(--trim-1) 70%, #f1ece3); box-shadow: 0 0 0 1px color-mix(in srgb, var(--trim-1) 70%, #f1ece3); }
:root[data-themed] :is(.panel, .zone, .stats, dialog) .theme { border-left-color: color-mix(in srgb, var(--trim-1) 75%, #f1ece3); }
:root[data-themed] :is(.panel, .zone, .stats, dialog) :is(.cat-blurb, .im-preview) { border-left-color: color-mix(in srgb, var(--trim-1) 75%, #f1ece3); }
:root[data-themed] .zone h3 { color: color-mix(in srgb, var(--trim-1) 45%, var(--ink-soft)); }

/* the header (and the account menu that drops out of it) sits above the page's panels, below the suggestions drawer (z 36) */
.bar { position: relative; z-index: 20; }

/* account button: a round avatar (a person icon for guests, an initial when signed in) and the name */
.acct-btn { gap: 8px; padding-left: 5px !important; }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: #f1ece3; color: #161514; font: 700 0.82rem/1 var(--serif);
}
.avatar.guest { background: rgba(241, 236, 227, 0.14); color: #f1ece3; box-shadow: inset 0 0 0 1px rgba(241, 236, 227, 0.35); }
.avatar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
:root[data-themed] .bar .avatar:not(.guest) { background: color-mix(in srgb, var(--trim-1) 35%, #f1ece3); }
.acct-name { max-width: 12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-pop { min-width: 236px; }
.acct-who { white-space: normal; line-height: 1.4; max-width: 240px; }
.acct-item.strong { font-weight: 700; }
@media (max-width: 600px) { .acct-name { max-width: 7em; } }

/* =========================================================
   Deck masthead, toolbar, column decklist and summary bar
   (layout inspired by clean deck pages like Moxfield's).
   ========================================================= */
.bar { justify-content: space-between; }
.account { margin-left: auto; }

/* masthead: commander art on the right, fading into charcoal on the left */
.deckhead {
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: flex-end;
  min-height: 210px; color: #f1ece3; background: #161514;
}
.deckhead::before { /* the art */
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: min(64%, 1040px); z-index: -2;
  background: var(--cmd-art, none) center 26% / cover no-repeat;
  opacity: 0; transition: opacity 0.8s ease;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 30%, #000 60%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 30%, #000 60%);
}
:root[data-art] .deckhead::before { opacity: 0.85; }
.deckhead::after { /* keeps the text readable and blends the bottom edge */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(22, 21, 20, 0.92) 0%, rgba(22, 21, 20, 0.55) 45%, rgba(22, 21, 20, 0.1) 100%),
    linear-gradient(0deg, rgba(22, 21, 20, 0.6) 0%, transparent 45%);
}
.dh-inner { width: 100%; max-width: 1560px; margin: 0 auto; padding: 30px 24px 22px; }
.dh-name {
  display: block; width: min(100%, 920px); padding: 0 0 2px; margin: 0;
  font: 700 clamp(1.9rem, 3.8vw, 3.1rem)/1.12 var(--serif); letter-spacing: -0.02em; color: #fff;
  background: transparent; border: 0; border-bottom: 1px dashed transparent; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}
.dh-name:hover { border-bottom-color: rgba(241, 236, 227, 0.35); }
.dh-name:focus { outline: none; border-bottom: 1px solid rgba(241, 236, 227, 0.7); }
.dh-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.dh-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 99px;
  background: rgba(241, 236, 227, 0.1); border: 1px solid rgba(241, 236, 227, 0.2);
  font-size: 0.8rem; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dh-k { font: 700 0.64rem/1 var(--sans); letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.7; }
.dh-pips { gap: 3px; padding-left: 6px; padding-right: 6px; }
.dh-pips .pip { font-size: 0.62rem; }
.deckhead :is(.pip-W, .pip-n) { color: #161514; }
.dh-theme { background: rgba(241, 236, 227, 0.05); }
:root[data-themed] .dh-theme { border-color: color-mix(in srgb, var(--trim-1) 55%, rgba(241, 236, 227, 0.2)); }
.dh-cta {
  padding: 4px 13px; border: 0; border-radius: 99px; background: #f1ece3; color: #161514;
  font: 700 0.8rem var(--sans); cursor: pointer;
}
.dh-cta:hover { background: #fff; }
.dh-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 12px 0 0; font-size: 0.88rem; color: rgba(241, 236, 227, 0.78); font-variant-numeric: tabular-nums; }
.deckhead .save-status { color: rgba(241, 236, 227, 0.55); }
/* who can see the saved deck: a small Private / Public switch and a link to its page */
.dh-share { display: inline-flex; align-items: center; gap: 12px; }
.dh-share:empty { display: none; }
.dh-vis {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 10px 1px 8px; border-radius: 99px; cursor: pointer;
  background: rgba(241, 236, 227, 0.08); border: 1px solid rgba(241, 236, 227, 0.25); color: rgba(241, 236, 227, 0.85); font: 600 0.78rem/1.6 var(--sans);
}
.dh-vis svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dh-vis:hover { background: rgba(241, 236, 227, 0.16); border-color: rgba(241, 236, 227, 0.5); }
.dh-vis.on { background: #f1ece3; border-color: #f1ece3; color: #161514; }
.dh-view { color: rgba(241, 236, 227, 0.78); font-size: 0.82rem; }
.dh-view:hover { color: #fff; }
/* Your Decks: the same switch as a badge and an inline link */
.vis-badge { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 99px; border: 1px solid var(--line-strong, var(--line)); font: 600 0.66rem/1.6 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); vertical-align: 2px; }
.vis-badge.on { background: var(--solid, var(--ink)); border-color: var(--solid, var(--ink)); color: var(--on-solid, var(--paper)); }
.deck-item .dm a { color: inherit; }
/* View mode (a shared deck at /deck/:id): the builder, read-only. No Add cards panel, so the deck gets the room;
   no controls that change the deck; Copy to my decks takes Save's place. data-missing: the deck can't be shown. */
.view-only { display: none !important; }
:root[data-viewing] .view-only { display: inline-flex !important; }
:root[data-viewing] :is(#btn-new, #btn-import, #btn-save, .finder) { display: none; }
:root[data-viewing] .table { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "zone stats" "zone list"; }
@media (max-width: 760px) { :root[data-viewing] .table { grid-template-columns: minmax(0, 1fr); grid-template-areas: "zone" "stats" "list"; } }
:root[data-viewing] :is(.x, .vx, [data-act="guy-fill"], [data-act="guy-undo"], [data-act="sg-add"], [data-act="sg-find"], [data-act="sg-theme"], [data-act="theme-search"]) { display: none !important; }
:root[data-viewing] .dh-name { cursor: default; border-bottom-color: transparent !important; }
:root[data-viewing] .br-btn:disabled { opacity: 0.4; cursor: default; }
.role-fixed { font-size: 0.8rem; color: var(--ink-soft); white-space: nowrap; }
:root[data-missing] #deckhead > .dh-inner:not(#view-missing), :root[data-missing] :is(.deckbar, .table, #summary, #sg-toggle) { display: none !important; }
#view-missing .dh-meta { margin-top: 10px; }
#view-missing .dh-cta { text-decoration: none; }

/* Card finishes: the picker's finish buttons and filters, a foil tag on deck rows, and a soft sheen over a
   foil card's picture (Cards view, card details, command zone) that drifts when you point at it. */
.pr-filters { margin-bottom: 12px; }
.pr-item { display: flex; flex-direction: column; gap: 6px; }
.pr-img { position: relative; display: block; }
.pr-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 99px; font: 700 0.64rem/1.3 var(--sans);
  background: rgba(20, 20, 20, 0.82); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.pr-fins { display: flex; flex-wrap: wrap; gap: 4px; }
.pr-fin {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 3px 8px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font: 600 0.7rem/1.3 var(--sans);
}
.pr-fin span { font-weight: 500; font-variant-numeric: tabular-nums; opacity: 0.85; }
.pr-fin:hover { color: var(--ink); border-color: var(--ink-soft); }
.pr-fin[aria-pressed="true"] { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.pr-fin.is-foil:not([aria-pressed="true"]) { border-color: color-mix(in srgb, #9fd3ff 45%, var(--line)); }
.foil-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; vertical-align: 1px;
  font: 600 0.66rem/1.6 var(--sans); letter-spacing: 0.03em; color: #161514;
  background: linear-gradient(100deg, #ffd6ec, #d6f0ff 45%, #fff3c4);
}
.foil-wrap { position: relative; display: block; height: 100%; border-radius: 4.8% / 3.5%; }
.cd-face .foil-wrap { height: auto; width: 100%; }
.foil-wrap.foil::after, .vcard.foil::after, .pr-opt.foil .pr-img::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 130, 210, 0.22) 36%, rgba(130, 220, 255, 0.24) 48%, rgba(255, 236, 150, 0.2) 60%, transparent 76%) 0 0 / 250% 100%;
  transition: background-position 0.9s ease;
}
.foil-wrap.foil:hover::after, .vcard.foil:hover::after { background-position: 100% 0; }
/* The hover preview can't be pointed at, so its sheen sweeps back and forth by itself. */
.peek .foil-wrap { height: 100%; border-radius: 0; }
.peek .foil-wrap.foil::after { animation: foil-sweep 2.6s ease-in-out infinite alternate; }
@keyframes foil-sweep { from { background-position: 0 0; } to { background-position: 100% 0; } }
.ps-head .foil-tag { vertical-align: 2px; }
@media (prefers-reduced-motion: reduce) {
  .foil-wrap.foil::after, .vcard.foil::after { transition: none; }
  .peek .foil-wrap.foil::after { animation: none; background-position: 50% 0; }
}

/* Deck stats: Mana odds (a table of land drops by turn) and Interaction (answers by what they hit) */
.odds-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.odds-table th, .odds-table td { padding: 5px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.odds-table thead th { font: 700 0.66rem/1.2 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.odds-table tbody th { font-weight: 500; }
.odds-table td { width: 34%; white-space: nowrap; }
.odds-bar { display: inline-block; width: 56px; height: 6px; margin-right: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; vertical-align: middle; }
.odds-bar span { display: block; height: 100%; border-radius: inherit; background: var(--ink-soft); }
.odds-cmd { margin: 12px 0 4px; font-size: 0.9rem; }
.answers { display: grid; gap: 2px; }
.answers li { display: grid; grid-template-columns: 11rem 2rem minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.an-k { font-weight: 600; }
.an-n { font: 700 1rem var(--serif); font-variant-numeric: tabular-nums; text-align: right; }
.an-list { color: var(--ink-soft); font-size: 0.82rem; }
.answers li.none .an-n { color: #e0a03a; }
.answers li.none .an-list { color: #e0a03a; font-style: italic; }
@media (max-width: 600px) { .answers li { grid-template-columns: minmax(0, 1fr) 2rem; } .an-list { grid-column: 1 / -1; } }

/* Browse from the List and Cards views: a row of types under the view switch, and a link on each type heading */
.browse-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.browse-row .seg-label { margin-right: 4px; }
/* a quiet pill with a plus: grey at rest, so the heading leads, brighter on hover */
.h-browse {
  display: inline-flex; align-items: center; gap: 5px; align-self: center; margin-left: auto;
  padding: 3px 11px 3px 8px; border-radius: 99px; border: 1px solid var(--line-strong, var(--line)); background: transparent;
  color: var(--ink-soft); font: 600 0.76rem/1.3 var(--sans); letter-spacing: 0.01em; white-space: nowrap; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.h-browse svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.h-browse:hover, .h-browse:focus-visible { color: var(--ink); border-color: var(--ink-soft); background: var(--paper-2); }
/* Test a hand: the summary line, the command zone beside the hand, and the cards (picked ones dim for the bottom) */
.hand-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.9rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.hand-sum strong { color: var(--ink); font-size: 1.05rem; }
.hand-sum .ok strong { color: var(--ok); }
.hand-sum .warn strong { color: #e0a03a; }
.hand-pick { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--paper-2); font-weight: 600; }
.hand-row { display: flex; gap: 22px; align-items: flex-start; margin-top: 4px; }
.hand-cmd { flex: none; width: 120px; display: grid; gap: 6px; padding-right: 22px; border-right: 1px solid var(--line); }
.hand-cmd .why-k { margin: 0; }
.hand-cmd img { display: block; width: 100%; height: auto; border-radius: 4.8% / 3.5%; opacity: 0.85; }
.hand-cmd-name { font: 600 0.9rem/1.3 var(--serif); }
.hand-cards { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.hc { position: relative; }
.hc-face { display: block; width: 100%; aspect-ratio: 63 / 88; padding: 0; border: 0; border-radius: 4.8% / 3.5%; background: #111; cursor: pointer; overflow: hidden; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); transition: transform 0.15s, opacity 0.15s; }
.hc-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hc-face .mini { height: 100%; }
.hc-face:hover { transform: translateY(-4px); }
.hc.drew .hc-face { box-shadow: 0 0 0 2px var(--ok), 0 4px 14px rgba(0, 0, 0, 0.35); }
.hc.picked .hc-face { opacity: 0.4; transform: translateY(8px); }
.hc-tag { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 3px 10px; border-radius: 99px; background: var(--solid); color: var(--on-solid); font: 700 0.75rem/1.3 var(--sans); pointer-events: none; }
@media (max-width: 600px) {
  .hand-row { flex-direction: column; }
  .hand-cmd { width: 90px; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .hand-cards { width: 100%; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
}

/* header link to Browse decks, beside the account button */
.hdr-link { margin-left: auto; color: rgba(247, 245, 240, 0.8); font-size: 0.9rem; text-decoration: none; }
.hdr-link:hover { color: #fff; text-decoration: underline; }
.hdr-link + .account { margin-left: 0; }
@media (max-width: 760px) { .hdr-link { order: 2; } .hdr-link + .account { order: 3; } }
@media (max-width: 600px) { .hdr-link { display: none; } .hdr-link + .account { margin-left: auto; } }

/* Collection and Wishlist: tags on deck rows, the controls in a card's details, and the list dialog */
.own-tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px; vertical-align: 1px;
  font: 600 0.66rem/1.6 var(--sans); letter-spacing: 0.03em; text-transform: uppercase;
  background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok);
}
.own-tag.part { background: color-mix(in srgb, #c9902a 18%, transparent); color: #c9902a; }
.own-tag.want { background: color-mix(in srgb, var(--ink-soft) 16%, transparent); color: var(--ink-soft); }
.cd-mine { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--paper-2); }
.cd-own { display: flex; align-items: center; gap: 10px; }
.cd-own .why-k { margin: 0; }
.cd-mine .qty { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.cd-mine .qty .n { min-width: 1.6em; text-align: center; }
.cd-want.on { background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
.cl-add { display: flex; gap: 8px; margin-top: 14px; }
.cl-add .search { flex: 1; min-width: 0; }
.cl-add .qty-in { width: 4.5em; }
.cl-import { margin-top: 10px; font-size: 0.92rem; }
.cl-import summary { cursor: pointer; color: var(--ink-soft); }
.cl-import textarea { width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--control, #fff); color: var(--ink); font: 0.9rem/1.4 ui-monospace, Consolas, monospace; }
.cl-import-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; }
.cl-import-row .btn { margin-left: auto; }
.cl-filter { margin-top: 4px; }
#cl-error:empty { min-height: 0; }
.cl-rows { max-height: min(52vh, 520px); overflow: auto; margin-top: 10px; border-top: 1px solid var(--line); }
.cl-row { display: grid; grid-template-columns: 6rem minmax(0, 1fr) 4.6rem 2rem; gap: 8px; align-items: center; padding: 5px 2px; border-bottom: 1px solid var(--line); }
.cl-row .qty { display: flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.cl-row .qty .n { min-width: 1.6em; text-align: center; }
.cl-row .nm { font: 1rem/1.3 var(--serif); }
.cl-row .tline { display: block; font: italic 0.8rem/1.3 var(--serif); color: var(--ink-soft); }
.cl-row .price { text-align: right; font-size: 0.88rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cl-more { padding: 10px 2px; }
#cl-extra { margin-right: auto; }
.btn.link.inline { display: inline; min-height: 0; padding: 0; margin: 0; font-size: inherit; color: inherit; }
.dh-credit { position: absolute; right: 16px; bottom: 10px; margin: 0; font-size: 0.72rem; color: rgba(241, 236, 227, 0.55); }

/* toolbar under the masthead: quiet icon buttons, Save on the right */
.deckbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; max-width: 1560px; margin: 0 auto; padding: 12px 20px 0; }
.tb {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font: 600 0.92rem var(--sans); cursor: pointer;
  transition: background-color 0.15s;
}
.tb:hover { background: rgba(20, 20, 20, 0.07); }
.tb svg, .tb-save svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-gap { flex: 1; }
.tb-save { gap: 7px; }
.table { padding-top: 14px; }

/* decklist: type groups flow side by side in columns, with compact rows */
.groups { columns: 300px; column-gap: 30px; margin-top: 6px; }
.groups .group { break-inside: avoid; margin: 0; padding-top: 14px; container-type: inline-size; }
.groups .row { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px; padding: 4px 2px; }
.groups .row .qty { min-width: 1.4rem; }
.groups .row .nm { font-size: 0.95rem; }
.groups .row .tline, .groups .row .price { display: none; }
.groups .row .syn { margin-left: 6px; padding: 1px 5px; }
.groups .row .syn > span { display: none; } /* just the spark; the themes are in its tooltip */
.groups .row.with-role { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.groups .row.with-role .role-pick { grid-column: 2 / -1; grid-row: 2; }
@container (min-width: 380px) {
  .groups .row, .groups .row.with-role { grid-template-columns: auto minmax(0, 1fr) auto 4.2rem auto; }
  .groups .row .price { display: block; }
}

/* summary bar along the bottom */
.summarybar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 34;
  display: flex; align-items: center; gap: 10px 18px; min-height: 50px; padding: 8px 20px;
  background: rgba(22, 21, 20, 0.96); color: #f1ece3; border-top: 1px solid #2c2a27;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
:root[data-themed] .summarybar { box-shadow: inset 0 2px 0 color-mix(in srgb, var(--trim-1) 75%, transparent); }
body:has(.summarybar) { padding-bottom: 58px; }
body:has(.summarybar) .sg-tab { bottom: 66px; }
body:has(.summarybar) .toast { bottom: 74px; }
.sb-count strong { font: 700 1.1rem var(--serif); }
.sb-status {
  padding: 3px 11px; border-radius: 99px; border: 1px solid rgba(241, 236, 227, 0.22); background: transparent;
  color: inherit; font: 600 0.82rem var(--sans); cursor: pointer;
}
.sb-status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #a9a195; vertical-align: 0.05em; }
.sb-status.ok::before { background: #7cc496; }
.sb-status.bad { border-color: rgba(240, 137, 122, 0.55); color: #f6b0a5; }
.sb-status.bad::before { background: #f0897a; }
.sb-status:hover { background: rgba(241, 236, 227, 0.08); }
.sb-price { font: 700 1rem var(--serif); }
.sb-types { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 0 auto; padding: 0; list-style: none; font-size: 0.82rem; color: rgba(241, 236, 227, 0.72); }
.sb-n { color: #f1ece3; font-weight: 700; }
@media (max-width: 760px) {
  .deckhead { min-height: 170px; }
  .deckhead::before { width: 100%; opacity: 0; }
  :root[data-art] .deckhead::before { opacity: 0.45; }
  .dh-inner { padding: 22px 16px 18px; }
  .dh-credit { display: none; }
  .deckbar { padding: 10px 10px 0; }
  .tb { padding: 7px 9px; font-size: 0.86rem; }
  .sb-types { display: none; }
  .summarybar { padding: 8px 14px; gap: 10px; }
  body:has(.summarybar) .sg-tab { bottom: 62px; }
}
@media print { .deckhead, .deckbar, .summarybar { display: none !important; } }

/* browse tiles: price on the left, a clear Add button on the right */
.lb-act > :last-child { margin-left: auto; }
.btn-add { gap: 5px; padding: 0.3em 0.95em 0.3em 0.75em !important; font-weight: 700; letter-spacing: 0.01em; }
.btn-add svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.lb-price { font-size: 0.82rem; }

/* the magnified card: a deeper shadow so it floats clearly over its neighbors */
:is(.panel, .zone, .stats, dialog) .ltile .lface:hover .lopen { box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(241, 236, 227, 0.5); }
:root[data-themed] :is(.panel, dialog) .ltile .lface:hover .lopen { box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px color-mix(in srgb, var(--trim-1) 60%, #f1ece3); }
.ltile .lface:hover .lscore { opacity: 0; transition: opacity 0.15s 0.1s; } /* the score badge would sit over the rules text */
@media (hover: none) { .ltile .lface:hover .lopen { transform: none; } } /* touch screens: tap opens the card instead */

/* =========================================================
   Motion: one easing curve for everything that moves, so the
   drawer, dialogs, toast and card peek glide in and out
   instead of popping. Reduced-motion users get none of it
   (see the prefers-reduced-motion rule near the top).
   ========================================================= */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);    /* fast start, long soft landing */
  --ease-in: cubic-bezier(0.55, 0, 0.75, 0.25);  /* for things leaving */
}
.btn, .chip, .seg button, .ex-fmt, .dlg-x, .sg-x, .sg-tab, .result, .row, .lface, .vcard { transition-timing-function: var(--ease-out); }
.btn { transition-duration: 0.2s; }

/* Guy's drawer: slides in with a soft landing, and slides back out (app.js adds .closing, then hides it) */
.sg-drawer { animation: sg-in 0.38s var(--ease-out); will-change: transform; }
.sg-drawer.closing { animation: sg-out 0.24s var(--ease-in) forwards; }
@keyframes sg-in { from { transform: translateX(100%); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes sg-out { to { transform: translateX(100%); opacity: 0.6; } }
.sg-body > * { animation: sg-rise 0.4s var(--ease-out) both; }
.sg-body > :nth-child(2) { animation-delay: 0.04s; }
.sg-body > :nth-child(3) { animation-delay: 0.08s; }
.sg-body > :nth-child(n + 4) { animation-delay: 0.12s; }
.sg-body.settled > * { animation: none; } /* re-renders while open shouldn't replay the entrance */
@keyframes sg-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sg-tab { animation: sg-tab-in 0.3s var(--ease-out); }
@keyframes sg-tab-in { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: none; } }

/* dialogs: fade and lift in, ease back out. @starting-style handles the way in; allow-discrete keeps
   them painted (and on the top layer) while the way out plays. Older browsers just open and close. */
dialog {
  opacity: 0; transform: translateY(10px) scale(0.98);
  transition: opacity 0.18s var(--ease-in), transform 0.18s var(--ease-in), overlay 0.18s allow-discrete, display 0.18s allow-discrete;
}
dialog[open] { opacity: 1; transform: none; transition-duration: 0.32s; transition-timing-function: var(--ease-out); }
@starting-style { dialog[open] { opacity: 0; transform: translateY(14px) scale(0.97); } }
dialog::backdrop { opacity: 0; transition: opacity 0.2s, overlay 0.2s allow-discrete, display 0.2s allow-discrete; }
dialog[open]::backdrop { opacity: 1; transition-duration: 0.3s; }
@starting-style { dialog[open]::backdrop { opacity: 0; } }

/* toast: rises and settles, fades a little quicker on the way out */
.toast { transform: translate(-50%, 14px) scale(0.98); transition: opacity 0.2s var(--ease-in), transform 0.2s var(--ease-in); }
.toast.show { transform: translate(-50%, 0); transition-duration: 0.36s; transition-timing-function: var(--ease-out); }

/* card peek and account menu: a quick fade-and-grow instead of appearing at full size */
.peek { transition: opacity 0.16s var(--ease-out), transform 0.22s var(--ease-out); transform-origin: left center; }
@starting-style { .peek { opacity: 0; transform: scale(0.96); } }
.acct-pop { animation: acct-in 0.24s var(--ease-out); transform-origin: top right; }
@keyframes acct-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.dash-panel { animation: dash-in 0.3s var(--ease-out); }
/* the credits footer on the builder and the playtester (the other pages use .home-foot from home.css) */
.site-foot { padding: 18px 20px 22px; text-align: center; font-size: 0.78rem; color: var(--ink-soft); }
.site-foot p + p { margin-top: 4px; }
.site-foot a { color: inherit; text-decoration: underline; }

/* popularity badge (stats from public decks on the site): an outlined pill beside the synergy spark */
.pop {
  display: inline-flex; align-items: center; margin-left: 6px; vertical-align: 0.1em; padding: 0 7px; border-radius: 99px;
  font: 600 0.7rem/1.5 var(--sans); font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line-strong, var(--line)); cursor: help;
}
.result .pop { margin: 3px 0 2px 6px; }
.pop-help { margin: 10px 0 0; }
.pop-help .pop { margin: 0 2px 0 0; cursor: default; }

/* The email reminder (notice.js): a slim bar across the top of the page. Fixed colors, so it reads the same on the
   dark pages and on the commander-tinted builder. */
.email-note {
  position: relative; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 6px 10px; padding: 8px 44px 8px 16px; background: #2b2620; color: #f1ece3; font-size: 0.9rem; line-height: 1.35;
  border-bottom: 1px solid rgba(241, 236, 227, 0.18); text-align: center;
}
.email-note p { margin: 0; }
.email-note strong { font-weight: 600; overflow-wrap: anywhere; }
.email-note .en-btn {
  font: inherit; font-size: 0.85rem; color: #f1ece3; background: transparent; border: 1px solid rgba(241, 236, 227, 0.45);
  border-radius: 999px; padding: 3px 12px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.email-note .en-btn:hover { background: rgba(241, 236, 227, 0.12); }
.email-note .en-btn:disabled { opacity: 0.5; cursor: default; }
.email-note .en-x {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: #f1ece3; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.email-note .en-x:hover { background: rgba(241, 236, 227, 0.12); }