/* LotusBuilder styles
   Layout: one-column app shell. Centered search on the home page; a sticky search bar,
   a card-image grid for results and a two-column card page everywhere else. */

/* ========== Theme tokens ========== */
:root {
  --bg: #f5f3f1;
  --surface: #ffffff;
  --ink: #1d1813;
  --muted: #6b6158;
  --line: #e3ddd6;
  /* Brand orange #F08000 for fills; a deeper shade for text links so they stay readable on white */
  --accent: #f08000;
  --accent-ink: #1d1206;
  --accent-soft: #fdebd5;
  --accent-text: #b05800;
  --ok: #2f7d4f;
  --ok-soft: #e2f2e8;
  --danger: #b3261e;
  --danger-fill: #c62828; /* red message background, white text */
  --no: #8a8178;
  --no-soft: #efebe6;
  --shadow: 0 1px 2px rgba(29,24,19,.08), 0 6px 18px rgba(29,24,19,.06);
  --font-display: "Marcellus", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Mana symbol colours, from the Mana icon set; printed colours stay the same in both themes */
  --w: #f0f2c0;
  --u: #b5cde3;
  --b: #aca29a;
  --r: #db8664;
  --g: #93b483;
  --c: #beb9b2;
  --gold: #d6b25e; /* multicolor */
  --sym-ink: #111111;
  --sym-shadow: rgba(0,0,0,.85);
}

/* Dark theme: same values for the system setting and for an explicit choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110e;
    --surface: #1f1a15;
    --ink: #f2ede7;
    --muted: #ab9f93;
    --line: #352d25;
    --accent: #f08000;
    --accent-ink: #1d1206;
    --accent-soft: #3b2410;
    --accent-text: #f7a04a;
    --ok: #7ccc9a;
    --ok-soft: #1d3327;
    --danger: #ff8a7a;
    --no: #988e84;
    --no-soft: #29231d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110e;
  --surface: #1f1a15;
  --ink: #f2ede7;
  --muted: #ab9f93;
  --line: #352d25;
  --accent: #f08000;
  --accent-ink: #1d1206;
  --accent-soft: #3b2410;
  --accent-text: #f7a04a;
  --ok: #7ccc9a;
  --ok-soft: #1d3327;
  --danger: #ff8a7a;
  --no: #988e84;
  --no-soft: #29231d;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.35);
  color-scheme: dark;
}

/* ========== Base ========== */
:root { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
/* Paints the band behind the iPhone status bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.inner { max-width: 1180px; margin: 0 auto; }
.h-page { font-family: var(--font-display); font-weight: 400; font-size: 28px; margin: 20px 0 4px; }
.section-h { font-family: var(--font-display); font-size: 19px; margin: 8px 0 0; font-weight: 400; }
.muted { color: var(--muted); margin: 0; }
.empty { padding-block: 48px; text-align: center; color: var(--muted); }

/* Buttons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 18px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: currentColor; background: var(--surface); }
.btn.small { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.linkbtn { background: none; border: 0; padding: 6px 2px; color: var(--accent-text); cursor: pointer; font-weight: 600; }

.toast {
  position: fixed;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: fit-content;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  text-align: center;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  z-index: 40;
  max-width: calc(100% - 32px);
}
.toast.error { background: var(--danger-fill); color: #fff; }

/* ========== Home ========== */
#home { position: relative; min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding-block: 40px 64px; }
#home .inner { width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-size: clamp(34px, 8vw, 52px); letter-spacing: .01em; line-height: 1; color: var(--ink); }
.logo svg { width: 1.05em; height: 1.05em; flex: none; }
.tagline { color: var(--muted); margin: -8px 0 0; font-size: 15px; }
.home-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 15px; }
/* The four links fit on one line on a phone */
@media (max-width: 460px) { .home-links { gap: 8px 10px; font-size: 13px; } }
@media (max-width: 380px) { .home-links { gap: 8px 8px; font-size: 12.5px; } }
.syntax { color: var(--muted); font-size: 13.5px; max-width: 520px; }
.syntax code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--no-soft); padding: 1px 5px; border-radius: 4px; color: var(--ink); }
.status { color: var(--muted); font-size: 13px; min-height: 1.2em; }
/* Credit at the very bottom of the home page */
.powered { position: absolute; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); margin: 0; text-align: center; color: var(--muted); font-size: 12.5px; }
.powered a { color: var(--accent-text); font-weight: 600; text-decoration: none; }

/* Deck button and create menu on the home page */
.homeplus { position: absolute; top: 12px; right: max(16px, env(safe-area-inset-right, 0px)); z-index: 30; }
.plusbtn { width: 42px; height: 42px; border-radius: 21px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.plusbtn svg { width: 20px; height: 20px; }
.plusmenu {
  position: absolute;
  right: 0;
  top: 50px;
  width: 260px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.plusmenu button { display: flex; gap: 12px; align-items: center; text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.plusmenu button:hover:not(:disabled) { background: var(--accent-soft); }
.plusmenu button:disabled { opacity: .5; cursor: default; }
.plusmenu svg { width: 22px; height: 22px; flex: none; color: var(--accent-text); }
.plusmenu span { display: flex; flex-direction: column; }
.plusmenu small { color: var(--muted); font-size: 13px; }

/* ========== Search bar and suggestions ========== */
.searchbox { position: relative; width: 100%; }
.searchbox input {
  width: 100%;
  height: 56px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0 100px 0 22px;
  font-size: 17px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.searchbox input:focus { border-color: var(--accent); }
/* Hide the browser's own clear button; we draw ours */
.searchbox input::-webkit-search-cancel-button,
.searchbox input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.searchbox .go { position: absolute; right: 6px; top: 6px; width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.searchbox .go svg { width: 20px; height: 20px; }
.searchbox .clear { position: absolute; right: 56px; top: 12px; width: 32px; height: 32px; border-radius: 16px; border: 0; background: var(--no-soft); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.searchbox .clear:hover { color: var(--ink); }
.searchbox .clear svg { width: 16px; height: 16px; }
.searchbox input:placeholder-shown ~ .clear { display: none; }

.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 20;
  text-align: left;
  list-style: none;
  margin: 0;
  padding: 6px 0;
}
.suggest li { padding: 10px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.suggest.wide li { padding: 9px 12px 9px 16px; gap: 10px; }
.suggest li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-soft); }
.suggest li.none { color: var(--muted); cursor: default; }
.suggest li.none:hover { background: none; }
.suggest .mana { flex: none; }

/* ========== Top bar ========== */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 15; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .inner { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.topbar .logo { font-size: 22px; gap: 8px; cursor: pointer; background: none; border: 0; padding: 0; }
.topbar .logo span { display: none; }
.topbar .searchbox { flex: 1; min-width: 0; }
.topbar .searchbox input { height: 42px; border-radius: 21px; font-size: 16px; box-shadow: none; background: var(--bg); padding-right: 78px; }
.topbar .searchbox .go { width: 34px; height: 34px; top: 4px; right: 4px; }
.topbar .searchbox .go svg { width: 16px; height: 16px; }
.topbar .searchbox .clear { right: 42px; top: 7px; width: 28px; height: 28px; }
.topbar .searchbox .clear svg { width: 14px; height: 14px; }
.topback { flex: none; width: 36px; height: 42px; margin: 0 -6px 0 -4px; border: 0; background: none; color: var(--accent); display: grid; place-items: center; cursor: pointer; padding: 0; border-radius: 10px; }
.topback svg { width: 26px; height: 26px; }
.topback:hover { background: var(--accent-soft); }
@media (min-width: 640px) { .topbar .logo span { display: inline; } }

/* Deck picker: the round button right of the search bar and its menu */
.deckpick { position: relative; flex: none; }
/* Deck and list pages: Main / Side / Maybe button in place of the deck button (none on a list page) */
.boardpick { position: relative; flex: none; display: none; }
body.in-editor .deckpick { display: none; }
body.in-editor:not(.editor-list) .boardpick { display: block; }
.boardbtn { height: 42px; border-radius: 21px; border: 2px solid var(--accent); background: var(--surface); color: var(--accent-text); display: flex; align-items: center; gap: 2px; padding: 0 8px 0 13px; font-weight: 700; font-size: 14px; cursor: pointer; }
.boardbtn svg { width: 16px; height: 16px; transition: transform .2s; }
.boardbtn[aria-expanded="true"] svg { transform: rotate(180deg); }
.boardmenu { width: 200px; }
.boardmenu button { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; border: 0; background: none; border-radius: 10px; padding: 10px; font-size: 15px; color: inherit; cursor: pointer; text-align: left; }
.boardmenu button small { color: var(--muted); }
.boardmenu button:hover { background: var(--accent-soft); }
.boardmenu button[aria-checked="true"] { font-weight: 700; color: var(--accent-text); background: var(--accent-soft); }
/* "+" on a name suggestion while on a deck or list page */
.suggest .sug-add { flex: none; width: 30px; height: 30px; margin: -4px -8px -4px 0; border-radius: 15px; border: 0; background: var(--accent); color: #fff; font-size: 20px; font-weight: 700; line-height: 1; display: grid; place-items: center; cursor: pointer; padding: 0 0 2px; }
.suggest .sug-add:active { transform: scale(.92); }
.deckbtn { position: relative; width: 42px; height: 42px; border-radius: 21px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.deckbtn svg { width: 20px; height: 20px; }
.deckbtn.on { border: 2px solid var(--accent); }
/* Picture of the picked deck, filling the round button */
.deckpic { position: absolute; inset: 1px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.deckpic img { width: 100%; height: 100%; object-fit: cover; }
.deckmenu {
  position: absolute;
  right: 0;
  top: 50px;
  width: 300px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 25;
}
.deckmenu .menu-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-right: 10px; }
.deckmenu .menu-top .linkbtn { font-size: 14px; }
.deckmenu .menu-h { margin: 6px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.deckmenu .menu-empty { margin: 8px 10px; color: var(--muted); }
/* "Lists" separator between decks and lists in the deck button's menu */
.deckmenu .menu-sep { display: flex; align-items: center; gap: 8px; margin: 8px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.deckmenu .menu-sep::before, .deckmenu .menu-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.deckmenu .menu-sep::before { flex: 0 0 10px; }
.deckmenu .menu-sep-row { display: flex; align-items: center; gap: 8px; padding-right: 10px; }
.deckmenu .menu-sep-row .menu-sep { flex: 1; }
.deckmenu .menu-sep-row .linkbtn { font-size: 14px; }
.deckoptrow { display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 10px; border-radius: 10px; cursor: pointer; }
.deckoptrow:hover { background: var(--accent-soft); }
.deckoptrow.picked { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.deckoptrow img, .deckoptrow .deck-ph { width: 52px; height: 38px; object-fit: cover; border-radius: 6px; flex: none; background: var(--no-soft); }
.deckopt-text { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; }
.deckopt-text small { color: var(--muted); font-size: 13px; }
/* The deck name opens the deck page, so it is underlined like a link */
.deckname { max-width: 100%; border: 0; background: none; padding: 0; font-weight: 700; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.deckname:hover { color: var(--accent-text); text-decoration-color: currentColor; }
.deckname-row { display: flex; align-items: baseline; gap: 8px; max-width: 100%; }
.deckname-row .deckname { min-width: 0; }
.deck-age { flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.deckx { flex: none; width: 32px; height: 32px; margin-right: 6px; border-radius: 16px; border: 0; background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.deckx:hover { color: var(--danger); }
.deckx svg { width: 14px; height: 14px; }
.deckmenu .menu-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; border-top: 1px solid var(--line); margin-top: 6px; padding: 6px 8px 2px; }

/* ========== Search results ========== */
.resbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-block: 16px 12px; color: var(--muted); font-size: 14px; }
.resbar strong { color: var(--ink); }
.resbar select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 14px; }
.resctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
/* "Sort by" and Ascending / Descending stay together on one line */
.sortgrp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.filter-note { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.filter-note .mana { flex: none; font-size: 16px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; padding-bottom: 32px; }
@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px 18px; } }
.more { display: flex; justify-content: center; padding-bottom: 48px; }

/* Card images, and the text frame shown when an image can't load */
.tile { display: block; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; border-radius: 4.75% / 3.5%; transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.cardimg { display: block; width: 100%; max-width: 100%; aspect-ratio: 488 / 680; border-radius: 4.75% / 3.5%; background: var(--no-soft); object-fit: cover; }
.fallback {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 488 / 680;
  border-radius: 4.75% / 3.5%;
  border: 6px solid var(--ink);
  background: var(--surface);
  padding: 9% 8%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: clamp(11px, 2.6vw, 14px);
  overflow: hidden;
  color: var(--ink);
}
.fallback .fn { font-family: var(--font-display); font-size: 1.15em; line-height: 1.15; display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.fallback .ft { color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; margin-top: auto; }
.fallback .fs { font-size: .85em; color: var(--muted); }

/* "+" on a result card, shown while a deck is picked: just below the title bar so the mana cost stays visible.
   White on a dark disc so it reads on any card art. */
.tilewrap { position: relative; }
.tilewrap .tile { width: 100%; }
.addbtn { display: none; position: absolute; top: 12%; right: 10%; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.62); color: #fff; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.addbtn svg { width: 15px; height: 15px; }
.addbtn:hover { background: rgba(0,0,0,.8); }
.addbtn:active { transform: scale(.92); }
.deck-active .addbtn { display: grid; }
/* "+4" just under the "+", for formats that allow four copies */
.add4btn { display: none; position: absolute; top: calc(12% + 36px); right: 10%; width: 30px; height: 22px; border-radius: 11px; border: 2px solid #fff; background: rgba(0,0,0,.62); color: #fff; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.45); font-size: 11px; font-weight: 700; line-height: 1; }
.add4btn:hover { background: rgba(0,0,0,.8); }
.add4btn:active { transform: scale(.92); }
.deck-four .add4btn { display: grid; }
/* Turn-over button on double-faced cards, same look as the "+", always shown */
.flipbtn { position: absolute; top: calc(50% - 15px); right: 10%; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.62); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.flipbtn svg { width: 16px; height: 16px; }
.flipbtn:hover { background: rgba(0,0,0,.8); }
.flipbtn:active { transform: scale(.92); }
.tilewrap .tile { transition: transform .15s ease-in; }
.tilewrap .tile.flipping { transform: perspective(800px) rotateY(90deg); }

/* ========== Card page ========== */
.cardpage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 20px 48px; }
@media (min-width: 820px) { .cardpage { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 40px; align-items: start; } }
.cp-img { max-width: 360px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.cp-img .cardimg { box-shadow: var(--shadow); }
#mainImg { width: 100%; }
.cp-info { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.face { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.face > div { padding: 12px 16px; border-top: 1px solid var(--line); }
.face > div:first-child { border-top: 0; }
.face h1, .face h2 { font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1.2; margin: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; text-wrap: balance; }
.face h2 { font-size: 20px; }
.face .type { font-weight: 600; }
.face .text p { margin: 0 0 8px; }
.face .text p:last-child { margin: 0; }
.face .flavor { font-style: italic; color: var(--muted); }
.face .pt { font-weight: 700; font-variant-numeric: tabular-nums; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.meta b { color: var(--ink); font-weight: 600; }
.legal { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.legal div { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.pill { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; border-radius: 4px; padding: 2px 6px; min-width: 76px; text-align: center; }
.pill.yes { background: var(--ok-soft); color: var(--ok); }
.pill.no { background: var(--no-soft); color: var(--no); }
.addrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Artworks */
.arts { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.arts button { border: 2px solid transparent; padding: 0; background: none; cursor: pointer; border-radius: 6px; display: flex; flex-direction: column; gap: 3px; text-align: left; font-size: 12px; color: var(--muted); }
.arts button[aria-pressed="true"] .cardimg { outline: 3px solid var(--accent); outline-offset: 1px; }
.arts button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arts .art-tr, .ps-tr { color: var(--accent-text); font-weight: 700; } /* Retro frame, Borderless… */
.ps-tr { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Rulings */
#rulSec { display: flex; flex-direction: column; gap: 10px; }
.rulings { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.rulings li { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.rulings li:first-child { border-top: 0; }
.rulings p { margin: 0; max-width: 68ch; }
.rulings small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rulings .ms { width: .95em; height: .95em; }

/* ========== Forms: advanced search and deck creator ========== */
.adv-intro { color: var(--muted); margin: 0 0 12px; max-width: 62ch; }
.adv { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 48px; }
.adv .row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px 24px; padding: 14px 16px; border-top: 1px solid var(--line); }
.adv .row:first-child { border-top: 0; }
@media (min-width: 720px) { .adv .row { grid-template-columns: 170px minmax(0, 1fr); padding: 16px 20px; } }
.adv .row > label, .adv .lbl { font-weight: 700; padding-top: 9px; }
.adv .field { min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.adv input[type=text], .adv input[type=number], .adv select { height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 12px; font-size: 16px; max-width: 100%; }
.adv input[type=text] { width: 100%; }
.adv input:focus, .adv select:focus { border-color: var(--accent); outline: none; }
.adv small { color: var(--muted); font-size: 13.5px; }
.adv code, .adv-preview code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--no-soft); padding: 1px 5px; border-radius: 4px; }
.adv .inline { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.adv .inline input { flex: 1; min-width: 140px; }
.statrow { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.statrow + .statrow { margin-top: 8px; }
.statrow input { width: 110px; }
.picker { display: flex; flex-wrap: wrap; gap: 4px; }
/* Text field with a symbol menu behind the arrow at its end */
.symfield { position: relative; width: 100%; }
.adv .symfield input[type=text] { padding-right: 46px; }
.symtoggle { position: absolute; top: 3px; right: 3px; width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--accent); display: grid; place-items: center; cursor: pointer; padding: 0; }
.symtoggle svg { width: 22px; height: 22px; transition: transform .2s; }
.symtoggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.symtoggle:hover, .symtoggle[aria-expanded="true"] { background: var(--accent-soft); }
.symdrop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; max-width: 100%; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16); }
.symdrop { left: 0; max-height: 60vh; overflow-y: auto; }
.symdrop .picker { gap: 6px; }
.symgroup { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 8px 2px 6px; }
.symgroup:first-child { margin-top: 0; }
.typefilter { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 0 10px; font-size: 16px; margin-bottom: 2px; }
.typefilter:focus { border-color: var(--accent); outline: none; }
.typechips { display: flex; flex-wrap: wrap; gap: 6px; }
.typechip { border: 1px solid var(--line); background: var(--bg); border-radius: 16px; padding: 5px 11px; font-size: 14px; cursor: pointer; color: inherit; }
.typechip:hover { border-color: var(--accent); }
.typechip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.typegroup[hidden], .typechip[hidden] { display: none; }
.typenone { color: var(--muted); font-size: 14px; margin: 10px 2px 2px; }
.symdrop .picker button { width: 38px; height: 38px; }
.picker button { width: 34px; height: 34px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; display: grid; place-items: center; cursor: pointer; font-size: 20px; padding: 0; }
.picker button:hover { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); border-radius: 20px; padding: 5px 12px 5px 6px; cursor: pointer; font-size: 20px; }
.chip span { font-size: 14px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { flex-direction: row !important; flex-wrap: wrap; gap: 10px 20px !important; padding-top: 8px; }
.adv-preview { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; padding: 14px 16px; border-top: 1px solid var(--line); background: var(--bg); }
.adv-preview span { font-weight: 700; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.adv-preview code { word-break: break-word; font-size: 14px; }
.adv-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.adv-foot .adv-actions { background: var(--surface); }
/* The search preview and buttons stay pinned to the bottom of the window while the form scrolls */
.adv-foot { position: sticky; bottom: 0; z-index: 5; border-radius: 0 0 12px 12px; overflow: hidden; box-shadow: 0 -6px 16px rgba(0, 0, 0, .08); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); }
.adv-foot .adv-preview { padding: 10px 16px; }
.adv-foot .adv-actions { padding: 10px 16px 12px; flex-wrap: nowrap; }
.adv-foot .adv-actions .btn { white-space: nowrap; padding-left: 12px; padding-right: 12px; }
.adv-foot .adv-actions .primary { flex: 1; min-width: 0; }

/* ========== Deck creator ========== */
.form-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 20px 0 12px; }
.form-head .h-page { margin: 0; }
.form-head-actions { display: flex; gap: 6px; }
.deckform textarea.bulk { font-family: ui-monospace, Menlo, monospace; font-size: 16px; min-height: 140px; }
.deckform small.bad { color: var(--danger); }
.deckform textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px 12px; font-size: 16px; resize: vertical; min-height: 96px; }
.deckform textarea:focus { border-color: var(--accent); outline: none; }
.searchbox.mini { width: 100%; }
.searchbox.mini input { height: 42px; border-radius: 8px; box-shadow: none; background: var(--bg); padding: 0 12px; font-size: 16px; }
.searchbox.mini input:disabled { opacity: .7; }
.cmdr-chips { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.cmdr-chips:empty { display: none; }
.cmdr-chip { display: flex; align-items: center; gap: 12px; border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 6px 8px 6px 6px; width: 100%; }
.cmdr-chip img { width: 72px; height: 53px; object-fit: cover; border-radius: 6px; flex: none; background: var(--no-soft); }
.cmdr-chip > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmdr-chip small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.cmdr-chip b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { flex: none; width: 32px; height: 32px; border-radius: 16px; border: 0; background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.chip-x svg { width: 14px; height: 14px; }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }

/* ========== Deck page ========== */
.deckhead { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 20px 8px; }
@media (min-width: 760px) { .deckhead { grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; } }
.deck-art { display: grid; grid-template-columns: 1fr; border-radius: 12px; overflow: hidden; aspect-ratio: 626 / 457; max-width: 100%; background: var(--no-soft); }
.deck-art.two { grid-template-columns: 1fr 1fr; }
.deck-art img { width: 100%; height: 100%; object-fit: cover; }
.deck-title { min-width: 0; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.deck-title h1 { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 0; text-wrap: balance; }
.fmt-pill { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; }
.deck-cmdr { margin: 0; }
.deck-desc { margin: 0; color: var(--muted); max-width: 62ch; overflow-wrap: anywhere; }
.deck-desc[hidden] { display: none; }
/* "Description ▾" above a deck's or list's description, which starts hidden */
.desc-toggle { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 0; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.desc-toggle svg { width: 16px; height: 16px; color: var(--accent); transition: transform .2s; }
.desc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
/* Name and Edit/Delete share a line when the name fits (see placeTitleButtons); otherwise .stacked puts the buttons below */
.deck-titlerow { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
/* The ⋮ button stays at the right of the name; a long name wraps beside it */
.deck-titlerow h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.deck-colors { display: inline-flex; gap: 3px; vertical-align: .08em; margin-left: 6px; font-size: .62em; white-space: nowrap; }
.deck-colors .ms { width: 1.05em; height: 1.05em; }
.deck-actions { position: relative; display: flex; flex: none; gap: 6px; padding-top: 4px; }
/* "⋮" button beside the deck name, and its menu */
.kebab { width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.kebab svg { width: 18px; height: 18px; }
.kebab[aria-expanded="true"] { border-color: var(--accent); color: var(--accent-text); }
.kebab-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.kebab-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; border-radius: 8px; padding: 10px; font-size: 15px; color: inherit; cursor: pointer; text-align: left; }
.kebab-menu button svg { width: 18px; height: 18px; flex: none; }
.kebab-menu button:hover { background: var(--accent-soft); }
.kebab-menu button.danger { color: var(--danger); }
/* Export: the deck as text, to copy */
.export-box { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.export-head { display: flex; flex-direction: column; }
.export-head small { color: var(--muted); }
.export-box textarea { white-space: pre; overflow-wrap: normal; overflow-x: auto; width: 100%; min-height: 200px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 10px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; resize: vertical; color: inherit; }
.export-actions { display: flex; gap: 8px; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.confirm span { flex-basis: 100%; }
.legal-box, .deck-empty { display: flex; flex-direction: column; gap: 10px; padding-block: 12px; }
.board + .board { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 20px; }
.board .section-h { display: flex; align-items: center; gap: 8px; }
/* Arrow that folds a board away; points down when open, right when folded */
.collapse { width: 30px; height: 30px; border: 0; border-radius: 15px; background: none; color: var(--accent-text); display: grid; place-items: center; cursor: pointer; padding: 0; }
.collapse:hover { background: var(--accent-soft); }
.collapse svg { width: 20px; height: 20px; transition: transform .2s; }
.board.collapsed .collapse svg { transform: rotate(-90deg); }
.board.collapsed .board-body { display: none; }
.board-body { display: flex; flex-direction: column; gap: 10px; }
@media (prefers-reduced-motion: reduce) { .collapse svg { transition: none; } }
.checks-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.checks-list li { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; border-top: 1px solid var(--line); }
.checks-list li:first-child { border-top: 0; }
.checks-list .mark { font-weight: 700; width: 1em; text-align: center; flex: none; }
.checks-list .ok .mark { color: var(--ok); }
.checks-list .bad .mark { color: var(--danger); }
.checks-list .pending { color: var(--muted); }
.count-pill { font-family: var(--font-body); font-size: 14px; font-weight: 700; background: var(--no-soft); border-radius: 10px; padding: 2px 8px; vertical-align: middle; font-variant-numeric: tabular-nums; }
.cmdr-group h3 { margin-top: 4px; }
.cmdr-group { margin-bottom: 6px; }
.cmdr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 420px; }

/* "Cards" heading with the list / pictures toggle on its right */
.cards-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.viewtoggle { position: relative; display: flex; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--no-soft); }
/* The orange oval that slides under the chosen option */
.viewtoggle::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--accent); box-shadow: var(--shadow); transition: transform .22s cubic-bezier(.3,.7,.3,1); }
.viewtoggle[data-view="cards"]::before { transform: translateX(100%); }
.viewtoggle button { position: relative; width: 42px; height: 30px; border: 0; border-radius: 999px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; transition: color .22s; }
.viewtoggle button[aria-pressed="true"] { color: var(--accent-ink); }
.viewtoggle svg { width: 19px; height: 19px; }
@media (prefers-reduced-motion: reduce) { .viewtoggle::before, .viewtoggle button { transition: none; } }

/* Picture view: same grid as search results, with a copy count on cards you have more than one of */
.deck-pics .dc-group h3 { margin-top: 14px; }
.deck-pics .grid { padding-bottom: 8px; }
.qty-badge { position: absolute; top: 12%; left: 8%; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 11px; border: 2px solid #fff; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; font-variant-numeric: tabular-nums; pointer-events: none; }
button.qty-badge { pointer-events: auto; cursor: pointer; font-family: inherit; }
button.qty-badge[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
/* − count + that opens under a tapped count */
.qty-step { position: absolute; top: calc(12% + 28px); left: 8%; display: flex; align-items: center; border: 2px solid #fff; border-radius: 16px; background: rgba(0,0,0,.8); color: #fff; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.45); }
.qty-step button { width: 32px; height: 30px; border: 0; background: none; color: #fff; font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }
.qty-step button:active { background: rgba(255,255,255,.2); }
.qty-step span { min-width: 22px; text-align: center; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Card list grouped by type */
.deck-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px 32px; align-items: start; }
.dc-group h3 { margin: 10px 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dc-group h3 span { font-variant-numeric: tabular-nums; }
/* "+ Basic" beside the mainboard's Lands heading, and the five basic lands it opens */
.dc-group h3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.basic-tool { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; letter-spacing: normal; text-transform: none; }
.basic-toggle { height: 26px; min-width: 26px; border-radius: 13px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-text); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 0 9px; cursor: pointer; display: inline-grid; place-items: center; }
.basic-tool.open .basic-toggle { padding: 0; width: 26px; }
.basic-toggle svg { width: 13px; height: 13px; }
.basic-pick { display: inline-flex; gap: 4px; }
.basic-pick[hidden] { display: none; }
.basic-pick button { width: 26px; height: 26px; border-radius: 13px; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; padding: 0; cursor: pointer; font-size: 17px; }
.basic-pick button:hover { border-color: var(--accent); }
.basic-pick button:active { transform: scale(.9); }
.dc-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.dc-row .q { width: 1.6em; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.dc-row .nm { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 4px 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-row .nm:hover { color: var(--accent-text); }
.dc-row .nm[aria-expanded="true"] { color: var(--accent-text); font-weight: 700; }
/* List view: preview under a card name */
.dc-preview { padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.dc-preview .tilewrap { width: 200px; max-width: 60%; }
/* "…" to change a card's printing: always on the list preview, on a tapped card in picture view */
.dotsbtn { position: absolute; top: 12%; right: 10%; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.62); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.dotsbtn svg { width: 16px; height: 16px; }
/* Picture view: white "−" on each card removes one copy (like the "+" on search results); the "…" sits below it */
.minusbtn { position: absolute; top: 12%; right: 10%; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.62); color: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.45); }
.minusbtn svg { width: 15px; height: 15px; }
.minusbtn:hover { background: rgba(0,0,0,.8); }
.minusbtn:active { transform: scale(.92); }
.deck-pics .tilewrap .dotsbtn { top: calc(12% + 38px); }
.deck-pics .dotsbtn, .cmdr-grid .dotsbtn { display: none; }
.tilewrap.armed .dotsbtn { display: grid; }
.tilewrap.armed .tile { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4.75% / 3.5%; }
/* Choose a printing: a sheet from the bottom of the screen */
.printsheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.ps-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.ps-panel { position: relative; width: 100%; max-width: 640px; max-height: 80vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow); padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.ps-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ps-head small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.ps-head b { font-size: 17px; }
.ps-x { flex: none; width: 34px; height: 34px; border-radius: 17px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.ps-x svg { width: 15px; height: 15px; }
.ps-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ps-grid .muted { grid-column: 1 / -1; margin: 0; }
.ps-item { border: 2px solid transparent; background: none; border-radius: 10px; padding: 3px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; color: inherit; font-size: 12px; font-weight: 600; }
.ps-pic { display: block; }
.ps-item img { width: 100%; border-radius: 4.75% / 3.5%; display: block; }
.ps-item[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
body.sheet-open { overflow: hidden; }
/* Foil: a moving rainbow sheen over the card picture */
.tile.foil, .ps-item.foil .ps-pic { position: relative; display: block; overflow: hidden; }
.tile.foil::after, .ps-item.foil .ps-pic::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 4.75% / 3.5%;
  background: linear-gradient(115deg, transparent 15%, rgba(255, 70, 170, .32) 28%, rgba(255, 220, 60, .32) 38%,
    rgba(60, 255, 190, .32) 48%, rgba(70, 140, 255, .32) 58%, rgba(190, 90, 255, .32) 68%, transparent 82%);
  background-size: 300% 300%; mix-blend-mode: color-dodge; animation: foil-sheen 7s linear infinite;
}
@keyframes foil-sheen { from { background-position: 100% 100%; } to { background-position: 0% 0%; } }
@media (prefers-reduced-motion: reduce) { .tile.foil::after, .ps-item.foil .ps-pic::after { animation: none; background-position: 50% 50%; } }
.foil-badge { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 6px; color: #fff;
  background: linear-gradient(100deg, #ff4fa3, #ffb347, #3fd8b0, #5a8cff, #b066ff); }
/* Prices: list rows, the deck's value, under each printing in the sheet */
.dc-price { flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.deck-value { margin: 0; color: var(--muted); font-size: 14px; }
.deck-value:empty { display: none; }
.deck-value b { color: var(--ink); }
.ps-special { align-self: center; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #fff; border-radius: 6px; padding: 1px 6px;
  background: linear-gradient(100deg, #ff4fa3, #ffb347, #3fd8b0, #5a8cff, #b066ff); }
.ps-prices { font-size: 11.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.ps-prices i { font-style: normal; font-weight: 700; color: var(--ink); }
.ps-head, .ps-foil { flex: none; } /* only the list of printings shrinks and scrolls */
/* Foil copies in the printing sheet: "FOIL  2 of 4 copies  − 2 +" */
.ps-foil { display: flex; align-items: center; gap: 10px; padding: 0 0 12px; font-size: 15px; }
.ps-foil-label { flex: 1; color: var(--muted); font-size: 14px; }
.ps-foil-step { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.ps-foil-step button { width: 36px; height: 34px; border: 0; background: var(--bg); color: var(--ink); font-size: 18px; cursor: pointer; }
.ps-foil-step button:disabled { opacity: .35; cursor: default; }
.ps-foil-step b { min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.dc-row .mana { flex: none; flex-wrap: nowrap; }
.dc-step { display: flex; flex: none; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dc-step button { width: 30px; height: 30px; border: 0; background: var(--surface); cursor: pointer; font-size: 17px; line-height: 1; padding: 0; }
.dc-step button + button { border-left: 1px solid var(--line); }

/* Mana curve */
.curve-box { display: flex; flex-direction: column; gap: 12px; padding-block: 12px; }
.curve-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.curve-stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.curve-stats b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.curve-stats span { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.curve { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; align-items: end; height: 170px; padding: 10px 12px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.curve-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.curve-n { font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; min-height: 15px; }
.curve-bar { width: 100%; max-width: 34px; min-height: 0; background: var(--accent); border-radius: 4px 4px 0 0; }
.curve-mv { width: 100%; text-align: center; border-top: 1px solid var(--line); padding: 4px 0 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.curve-axis { margin: 0; color: var(--muted); font-size: 12.5px; }

/* Colors: a 100% bar of nonland cards by color, then a table of cards and mana symbols */
.colors-box { display: flex; flex-direction: column; gap: 12px; padding-block: 12px 48px; }
.cb-bar { display: flex; gap: 2px; height: 18px; border-radius: 9px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); padding: 2px; }
.cb-seg { flex-basis: 0; min-width: 4px; border-radius: 6px; }
.cb-W { background: var(--w); } .cb-U { background: var(--u); } .cb-B { background: var(--b); }
.cb-R { background: var(--r); } .cb-G { background: var(--g); } .cb-C { background: var(--c); }
.cb-M { background: var(--gold); }
.gold-dot { display: inline-block; width: 1.05em; height: 1.05em; border-radius: 50%; background: var(--gold); box-shadow: -1px 1px 0 var(--sym-shadow); vertical-align: -.14em; }
.cb-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.cb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cb-table th, .cb-table td { padding: 8px 8px; text-align: left; border-top: 1px solid var(--line); white-space: nowrap; }
.cb-table thead th { border-top: 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.cb-table td:not(:first-child), .cb-table thead th:not(:first-child) { text-align: right; }
.cb-table tbody th { font-weight: 600; }
.cb-table tfoot th, .cb-table tfoot td { font-weight: 600; }
.cb-table small { color: var(--muted); font-size: 12.5px; }
.cb-name { display: inline-flex; align-items: center; gap: 6px; }
.cb-table th:first-child, .cb-table td:first-child { padding-left: 12px; }
.cb-table th:last-child, .cb-table td:last-child { padding-right: 12px; }
.sub-h { margin: 6px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Symbols vs producers: two thin bars per color */
.cmp { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--muted); }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-key { display: inline-block; width: 14px; height: 8px; border-radius: 4px; }
.cmp-key.need, .cmp-bar.need { background: var(--accent); }
.cmp-key.make, .cmp-bar.make { background: var(--ink); }
.cmp-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 10px; }
.cmp-color .ms, .cmp-color .gold-dot { width: 20px; height: 20px; }
.cmp-bars { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cmp-track { display: flex; align-items: center; gap: 6px; height: 12px; }
.cmp-bar { height: 8px; border-radius: 0 4px 4px 0; min-width: 2px; }
.cmp-track b { font-size: 12px; font-variant-numeric: tabular-nums; }


/* My decks */
.decks-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }
.deck-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 48px; }
.deck-row { display: flex; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px; cursor: pointer; width: 100%; }
.deck-row:hover { border-color: var(--accent); }
.deck-row img, .deck-ph { width: 84px; height: 61px; object-fit: cover; border-radius: 8px; flex: none; background: var(--no-soft); }
.dr-text { display: flex; flex-direction: column; min-width: 0; }
.dr-text b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-text small { color: var(--muted); font-size: 14px; }

/* ========== Mana symbols ========== */
.mana { display: inline-flex; gap: 2px; vertical-align: middle; flex-wrap: wrap; }
.ms { display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; flex: none; line-height: 0; }
.ms > svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(-1px 1px 0 var(--sym-shadow)); }
.ms.bare > svg { filter: none; }
.ms text { font-family: var(--font-body); }
.mana .ms { width: 1.05em; height: 1.05em; }
.text .ms { width: .95em; height: .95em; margin: 0 .04em; }

/* ========== Motion ========== */
@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .addbtn:active, .add4btn:active, .flipbtn:active { transform: none; }
  .tilewrap .tile { transition: none; }
}
