:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #efede8; --text: #1d1c1a; --muted: #6b6760;
  --line: #dedad2; --accent: #2f5d50; --accent-text: #ffffff; --accent-soft: #e2ece8;
  --warn: #9a5b00; --warn-soft: #fbf0dc; --danger: #a33a2c; --ok: #2f6b3a; --ok-soft: #e3f0e4;
  --radius: 10px; --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 16px rgb(0 0 0 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151514; --surface: #1f1f1d; --surface-2: #2a2a27; --text: #ecebe7; --muted: #a29e96;
    --line: #36352f; --accent: #7fb8a5; --accent-text: #10201b; --accent-soft: #23332e;
    --warn: #e0a54a; --warn-soft: #33291a; --danger: #e4826f; --ok: #8cc99a; --ok-soft: #1f3123;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151514; --surface: #1f1f1d; --surface-2: #2a2a27; --text: #ecebe7; --muted: #a29e96;
  --line: #36352f; --accent: #7fb8a5; --accent-text: #10201b; --accent-soft: #23332e;
  --warn: #e0a54a; --warn-soft: #33291a; --danger: #e4826f; --ok: #8cc99a; --ok-soft: #1f3123;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.cart-btn, .btn { border: 0; border-radius: 999px; padding: 8px 16px; background: var(--accent);
  color: var(--accent-text); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.pill { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent-text) 25%, transparent); text-align: center; }

.hero { padding-top: 20px; }
.lede { font-size: 17px; margin: 0 0 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 20px; padding: 0; margin: 0; list-style: none; color: var(--muted); font-size: 14px; }
.facts b { color: var(--text); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters input, .filters select, .form input, .form select, .form textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-height: 38px; }
.price-range { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.price-range input { width: 72px; }
.colors { display: flex; gap: 4px; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13px; }
.colors button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.count { color: var(--muted); margin: 16px 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; }
.card .art { all: unset; cursor: zoom-in; display: block; aspect-ratio: 488 / 680; background: var(--surface-2); }
.card .art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Foil look. Scryfall's image rules forbid covering the artist/copyright line,
   colour-shifting the image or stamping it, so the effect is a frame *around* the
   picture with the finish named on a strip below it; the card image is untouched. */
.card .art, .art-frame { position: relative; overflow: hidden; }
.card .art img { object-fit: contain; }
.art-frame { border-radius: 4.75% / 3.5%; }
.foil { padding: 4px 4px 22px; border-radius: 10px; background-size: 300% 300%; animation: foil-shift 6s ease-in-out infinite alternate; }
.card .art.foil { aspect-ratio: 488 / 706; }
.foil img { border-radius: 4.5% / 3.3%; }
.foil-std { background-image: linear-gradient(115deg, #f7b5e6, #b5e3f7, #c3f7b5, #f7e9b5, #e0b5f7, #f7b5e6); }
.foil-surge { background-image: repeating-linear-gradient(115deg, #ff4f8b 0 8%, #ffc94f 8% 16%, #4fffa8 16% 24%, #4fa8ff 24% 32%, #b44fff 32% 40%); }
.foil-etched { background-image: linear-gradient(115deg, #8d8d96, #f2f2f5, #a9a9b3, #ffffff, #8d8d96); }
.foil-special { background-image:
  radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 2px),
  linear-gradient(115deg, #3b1d8f, #0b7fb3, #b3127a, #3b1d8f); background-size: 23px 29px, 31px 37px, 300% 300%; }
.foil-textured { background-image: repeating-linear-gradient(45deg, rgb(255 255 255 / .35) 0 2px, transparent 2px 6px),
  linear-gradient(115deg, #ffd27a, #a0e6ff, #ffa0dc, #ffd27a); }
@keyframes foil-shift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .foil { animation: none; background-position: 50% 50%; } }
.foil-badge { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); z-index: 1; white-space: nowrap;
  padding: 0 8px; border-radius: 999px; font-size: 11px; line-height: 16px; font-weight: 700; color: #2b2340; background: rgb(255 255 255 / .85); }
.foil-special .foil-badge { color: #fff; background: rgb(0 0 0 / .45); }
.art-frame.foil { padding-bottom: 26px; }
.art-frame .foil-badge { font-size: 13px; line-height: 20px; }
.card .info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card h3 { font-size: 14px; margin: 0; line-height: 1.3; }
.card .meta { font-size: 12px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.foil { background: linear-gradient(90deg, #f6d9ff, #d6f0ff, #dfffe0); color: #3b3550; }
.buy { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 6px; }
.price { font-weight: 700; font-size: 16px; }
.left { font-size: 12px; color: var(--muted); }
.add { border: 0; border-radius: 8px; padding: 6px 12px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; cursor: pointer; }
.add.in { background: var(--accent); color: var(--accent-text); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; background: var(--surface-2); width: 30px; height: 30px; cursor: pointer; font-weight: 700; }
.stepper span { min-width: 28px; text-align: center; font-weight: 600; }
.more { text-align: center; margin: 24px 0; }
.more button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 22px; cursor: pointer; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 40px; border-top: 1px solid var(--line); margin-top: 24px; }

dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.x { position: absolute; top: 8px; right: 10px; border: 0; background: var(--surface-2); width: 34px; height: 34px;
  border-radius: 50%; font-size: 20px; cursor: pointer; z-index: 2; }
.sheet { width: min(860px, calc(100vw - 24px)); border-radius: 14px; }
.detail-body { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 24px; padding: 24px; }
.detail-body .imgs img { width: 100%; display: block; }
.detail-body h2 { margin: 0 0 4px; font-size: 22px; padding-right: 36px; }
.detail-body dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 14px 0; font-size: 14px; }
.detail-body dt { color: var(--muted); }
.detail-body dd { margin: 0; }
.oracle { white-space: pre-line; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.flip { margin-top: 8px; }
@media (max-width: 680px) { .detail-body { grid-template-columns: 1fr; padding: 16px; } .detail-body .imgs { max-width: 300px; margin: 0 auto; } }

.drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(480px, 100vw); }
#cart-body { padding: 20px 20px 32px; }
#cart-body h2 { margin: 0 0 12px; font-size: 20px; }
.lines { list-style: none; padding: 0; margin: 0 0 12px; }
.lines li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lines img { width: 44px; border-radius: 3px; display: block; }
.lines .nm { font-size: 13px; line-height: 1.3; }
.lines .sub { font-size: 12px; color: var(--muted); }
.lines .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px; margin: 12px 0; }
.sum .total { font-weight: 700; font-size: 18px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 10px 0; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--warn); }
.ship { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.ship label { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.ship label.off { opacity: .5; cursor: not-allowed; }
.ship label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.ship small { grid-column: 2 / 4; color: var(--muted); font-size: 12px; }
.form { display: grid; gap: 10px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form .hp { position: absolute; left: -9999px; }
.paybox { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.paybox .big { font-size: 22px; font-weight: 700; }
.paybox code { font-size: 17px; font-weight: 700; background: var(--surface); padding: 2px 8px; border-radius: 6px; }
.empty { color: var(--muted); padding: 30px 0; text-align: center; }

/* admin + order pages */
.page { padding: 24px 16px 60px; max-width: 1100px; margin: 0 auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 20px; }
.tile { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 20px; }
.tile span { color: var(--muted); font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); }
table.list td.n { text-align: right; font-variant-numeric: tabular-nums; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.paid { background: var(--accent-soft); color: var(--accent); }
.status.shipped, .status.picked_up { background: var(--ok-soft); color: var(--ok); }
.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.tabs button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.scroll-x { overflow-x: auto; }
@media print { .top, .filters, .tabs, .no-print, .x { display: none !important; } body { background: #fff; } }

/* ---- shared header / footer (nav.js) ------------------------------------------ */
.top-row { gap: 12px; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo { color: var(--accent); margin-right: 6px; }
.sep { color: var(--muted); }
.crumb { color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.crumb:hover, .brand:hover { color: var(--accent); }
.links { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.links a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.links a:hover { color: var(--text); background: var(--surface-2); }
.links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.links a.small { font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
@media (max-width: 860px) {
  .menu-btn { display: inline-block; }
  .links { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 12px; box-shadow: var(--shadow); }
  .top.menu-open .links { display: flex; }
  .links a { padding: 10px 12px; font-size: 15px; }
  .top { position: sticky; }
  .top-row { position: relative; }
  .cart-btn #cart-total-top { display: none; }
}
.site-foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 20px 0 90px; font-size: 13px; color: var(--muted); }
.foot-row { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.foot-row b { color: var(--text); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.site-foot nav a { color: var(--muted); }
.page h1 { margin-top: 0; }

/* ---- shop extras --------------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { background: var(--surface); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px; color: var(--muted); }
.steps li b { display: block; color: var(--text); font-size: 14px; }
.steps li b::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 12px; margin-right: 6px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr 1fr; } }
.filters .extra { display: contents; }
.filter-toggle { display: none; }
@media (max-width: 760px) {
  .filter-toggle { display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
  .filters .extra { display: none; }
  .filters.open .extra { display: contents; }
}
.clear-filters { border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); border-radius: 999px; padding: 10px 12px 10px 18px; display: flex; gap: 12px; align-items: center;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 20; font-size: 14px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast button { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; }
.cart-bar { display: none; }
@media (max-width: 760px) {
  .cart-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 6; display: flex; justify-content: space-between; align-items: center;
    background: var(--accent); color: var(--accent-text); border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
  .cart-bar[hidden] { display: none; }
  .toast { bottom: 80px; }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 40px 12px 0; }
.drawer-head h2 { margin: 0; }
.linkish { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
.checkout-step { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }

/* ---- order timeline ----------------------------------------------------------- */
.timeline { display: flex; gap: 0; margin: 18px 0; padding: 0; list-style: none; }
.timeline li { flex: 1; text-align: center; font-size: 13px; color: var(--muted); position: relative; padding-top: 26px; }
.timeline li::before { content: ""; position: absolute; top: 6px; left: 50%; width: 14px; height: 14px; border-radius: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 2px solid var(--line); z-index: 1; }
.timeline li::after { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--text); font-weight: 600; }
.timeline li.done::before { background: var(--accent); border-color: var(--accent); }
.timeline li.done::after { background: var(--accent); }

/* ---- admin extras ------------------------------------------------------------- */
.checklist { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin: 0 0 18px; }
.checklist h2 { margin: 0 0 4px; font-size: 18px; }
.checklist ol { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px;
  border: 2px solid var(--line); flex: none; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.checklist li.done span.t { color: var(--muted); text-decoration: line-through; }
.sharebox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sharebox code { background: var(--surface-2); padding: 6px 10px; border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.tabs .count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: var(--surface);
  font-size: 11px; margin-left: 4px; text-align: center; }
.admin-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.admin-bar h1 { margin: 0; font-size: 22px; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.help-grid section { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.help-grid h2 { margin-top: 0; font-size: 18px; }
.help-grid h3 { font-size: 15px; margin: 14px 0 4px; }
.help-grid p, .help-grid li { font-size: 14px; }
.toc { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 18px; }
@media (max-width: 520px) {
  .crumbs:has(.crumb) .brand-text { display: none; }
  .crumb { max-width: 46vw; }
}
