/* SKWIZ — card price screen
   Palette: graded-slab acrylic grey, deep navy ink, eucalyptus for verified.
   Foil gradient is used in one place only: the card frame. */

:root {
  /* One dark theme on every page: near-black canvas, soft panels, the brand
     purple for interaction, green for verified Australian prices. */
  --bg: #0E1015;
  --surface: #15171E;
  --surface-2: #1C1F28;
  --ink: #ECECEF;
  --ink-2: #A9ABB6;
  --ink-3: #7F828E;
  --line: #23262F;
  --line-strong: #323643;

  --accent: #A97BFF;
  --accent-wash: rgba(169, 123, 255, 0.14);

  /* Market-price chart: brand purple */
  --chart: #A97BFF;
  --chart-fill: rgba(169, 123, 255, 0.40);
  /* Another market's prices (e.g. US in AUD), always shown as a reference */
  --reference: #60A5FA;

  /* Headline prices: crisp white (the purple is our signature); green and
     red only carry meaning (rises and falls) */
  --price: #F5F3FF;
  --up: #34D399;
  --down: #F87171;

  --fresh: #34D399;
  --fresh-wash: rgba(52, 211, 153, 0.14);
  --ageing: #F2B24C;
  --ageing-wash: rgba(242, 178, 76, 0.15);
  --stale: #8A8E9A;
  --stale-wash: rgba(138, 142, 154, 0.16);

  --foil: conic-gradient(from 210deg at 50% 50%,
      #6fa9e0, #9d86e8 18%, #d98fbf 34%, #d9c37a 50%,
      #7fcfab 66%, #74bde0 82%, #6fa9e0);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 22px 44px -20px rgba(0, 0, 0, 0.85);
  --pop-shadow: 0 12px 32px -10px rgba(0, 0, 0, 0.75);

  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* Prices and other figures: an even monospace, so digits line up */
  --font-num: "DM Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 12px;
  --page-max: 1120px;
  --gutter: 16px;

  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Top bar + search ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  font-weight: 700;
  font-stretch: 108%;
  font-size: 15px;
  letter-spacing: -0.005em;
}

.brand-mark {
  width: 22px;
  height: 30px;
  border-radius: 4px;
  background: var(--foil);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--surface) 70%, transparent);
}

.brand-name { display: none; }

.search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--pop-shadow);
  max-height: min(70vh, 560px);
  max-height: min(70dvh, 560px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.search-option {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.search-option[aria-selected="true"],
.search-option:hover { background: var(--surface-2); }

/* Card-shaped thumbnail; the foil edge marks a card with no image */
.search-thumb {
  position: relative;
  display: block;
  width: 36px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(20, 33, 49, 0.2);
}
.search-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.search-thumb-proxy {
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 0 3px 3px;
  border: 2px solid transparent;
  border-radius: 3px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--foil) border-box;
  color: var(--ink-2);
  font-size: 8.5px;
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

.search-option-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.search-option-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-weight: 650;
  line-height: 1.25;
}
.search-option-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: 0.03em;
}

.search-option-meta {
  display: flex;
  flex-wrap: wrap;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
}
.search-option-meta > span {
  white-space: nowrap;
}
.search-option-meta > span:not(:last-child)::after {
  content: "•";
  margin: 0 6px;
  color: var(--ink-3);
}

.search-option-price {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.search-option-price.is-unpriced {
  font-family: var(--font);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 550;
}
/* No AU sales yet: the US (Scrydex) estimate, in the reference blue. */
.search-option-price.is-estimate,
.result-price.is-estimate {
  color: var(--reference, #60A5FA);
  font-size: 14px;
}

.search-empty {
  padding: 12px;
  color: var(--ink-2);
  font-size: 14px;
}
.search-empty strong { display: block; color: var(--ink); font-weight: 650; margin-bottom: 2px; }

/* Recent searches and recently viewed cards (empty search box) */
.search-section {
  padding: 10px 10px 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recent-option {
  display: grid;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
}
.recent-option[aria-selected="true"],
.recent-option:hover { background: var(--surface-2); }

.recent-search {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
}
.recent-search-icon { display: grid; color: var(--ink-3); }
.recent-search-icon svg { width: 18px; height: 18px; }
.recent-search-text { overflow-wrap: anywhere; font-weight: 600; }
.recent-search-lang { color: var(--ink-3); font-size: 12.5px; }

.recent-card {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 10px;
}

/* Last row of the suggestions: open the full results page. It stays
   pinned to the bottom of the list, so it shows without scrolling. */
.search-see-all {
  position: sticky;
  bottom: -6px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 6px -6px -6px;
  padding: 11px 16px 12px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 11px 11px;
  background: var(--surface);
  cursor: pointer;
}
.search-see-all[aria-selected="true"],
.search-see-all:hover { background: var(--surface-2); }
/* Arrow-key scrolling keeps the highlighted card clear of the pinned row */
.search-results:has(.search-see-all) { scroll-padding-bottom: 76px; }
.search-see-all-label {
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.search-see-all-note {
  color: var(--ink-3);
  font-size: 12.5px;
}

/* ---------- Page layout ---------- */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 20px var(--gutter) 64px;
  padding-bottom: max(64px, env(safe-area-inset-bottom));
}

/* Phones: like Collectr, the card is large at the top and everything else
   follows in one column; the sales chart comes before the price details. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "crumbs"
    "art"
    "identity"
    "price"
    "printing"
    "holding"
    "chart"
    "conf"
    "comps"
    "graded";
  column-gap: 16px;
  row-gap: 22px;
  align-items: start;
}

/* Cards with a single finish have no picker: drop its row so the empty
   track doesn't leave an extra gap. (From 960px the band is a flexbox.) */
@media (max-width: 599px) {
  .layout:has(> .card-head > .printing[hidden]) {
    grid-template-areas:
      "crumbs"
      "art"
      "identity"
      "price"
      "holding"
      "chart"
      "conf"
      "comps"
      "graded";
  }
}

/* The title band dissolves into the grid until 960px, where it becomes
   one band with the price on the right. */
.card-head { display: contents; }

.crumbs   { grid-area: crumbs; margin-bottom: -10px; }
.art      { grid-area: art; position: relative; justify-self: center; width: min(66vw, 290px); }
.identity { grid-area: identity; }
.price    { grid-area: price; }
.printing { grid-area: printing; margin-top: -6px; }
.holding  { grid-area: holding; }
.confidence-panel { grid-area: conf; }
.chart-panel { grid-area: chart; }
.comps-panel { grid-area: comps; }

/* ---------- Breadcrumb ---------- */

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
}
.crumbs li { min-width: 0; }
.crumbs li + li::before {
  content: "›";
  margin: 0 8px;
  color: var(--ink-3);
}
.crumbs [aria-current="page"] {
  color: var(--ink-2);
  font-weight: 600;
}

/* On phones the card name sits right below, so the last crumb is noise */
@media (max-width: 599px) {
  .crumbs li[aria-current="page"] { display: none; }
}

/* Set names search for the set, like Collectr's set links */
.crumb-link,
.set-link {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}
.crumb-link { color: var(--ink-2); }
.crumb-link:hover,
.set-link:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* ---------- Card art ---------- */

.card-frame {
  --card-radius: 9px;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  aspect-ratio: 63 / 88;
  padding: 3px;
  border-radius: var(--card-radius);
  background: var(--foil);
  box-shadow: var(--card-shadow);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.35s cubic-bezier(.2, .7, .2, 1);
  will-change: transform;
}

.card-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 30%),
      rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 48%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.card-frame.is-tilting { transition: transform 0.08s linear; }
.card-frame.is-tilting::after { opacity: 1; }

.card-face {
  container-type: inline-size;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: calc(var(--card-radius) - 3px);
  background: var(--surface);
}

.card-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Typographic stand-in when no card image exists */
.proxy {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10% 9% 9%;
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line) 45%, transparent) 7px 8px),
    var(--surface);
  color: var(--ink);
}

.proxy-set {
  display: none;
  font-size: 11px;
  font-size: 5.4cqw;
  color: var(--ink-2);
  line-height: 1.3;
}

.proxy-name {
  margin-top: auto;
  font-size: 13px;
  font-size: 11.5cqw;
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.proxy-number {
  margin-top: 4%;
  font-size: 11px;
  font-size: 7.5cqw;
  font-weight: 700;
  font-stretch: 118%;
  color: var(--ink-2);
}

.proxy-note {
  display: flex;
  align-items: center;
  gap: 4%;
  margin-top: auto;
  padding-top: 7%;
  border-top: 1px solid var(--line-strong);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.25;
}
.proxy-note svg { flex-shrink: 0; width: 16px; height: 16px; }
.proxy-note-text { display: none; }

@container (min-width: 170px) {
  .proxy-set { display: block; }
  .proxy-name { font-size: 10.5cqw; }
  .proxy-note { font-size: 13px; font-size: 5cqw; }
  .proxy-note svg { width: 1.3em; height: 1.3em; }
  .proxy-note-text { display: inline; }
}

/* Tap or click the card to see it large */
.card-frame.is-enlargeable { cursor: zoom-in; }
.card-frame:focus { outline: none; }
.card-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.art-expand {
  position: absolute;
  right: -6px;
  bottom: -6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--pop-shadow);
  cursor: zoom-in;
}
.art-expand svg { width: 20px; height: 20px; }
.art-expand:hover { border-color: var(--accent); color: var(--accent); }

/* Virtual finish: a rainbow sheen that follows the light (--gx/--gy), and
   for textured rarities an etched grain the sheen catches on. */
.foil-sheen,
.foil-texture {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.foil-sheen {
  background:
    linear-gradient(115deg,
      transparent 18%,
      rgba(255, 92, 170, 0.55) 30%,
      rgba(255, 220, 90, 0.5) 38%,
      rgba(90, 255, 190, 0.5) 46%,
      rgba(80, 180, 255, 0.55) 54%,
      rgba(190, 110, 255, 0.5) 62%,
      transparent 74%);
  background-size: 280% 280%;
  background-position: var(--gx, 30%) var(--gy, 30%);
  mix-blend-mode: color-dodge;
  opacity: 0.14;
  transition: opacity 0.3s;
}
.card-frame.is-tilting .foil-sheen { opacity: 0.45; }

/* Grain for textured cards: the sheen shows through speckles and fine
   etched lines rather than as one smooth band */
.foil-sheen.is-textured {
  -webkit-mask-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 2.2 -0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(60deg, #000 0 1px, transparent 1px 3px);
  mask-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 2.2 -0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(60deg, #000 0 1px, transparent 1px 3px);
  opacity: 0.3;
}
.card-frame.is-tilting .foil-sheen.is-textured { opacity: 0.85; }

.foil-texture {
  background:
    repeating-radial-gradient(circle at var(--gx, 40%) var(--gy, 30%),
      rgba(255, 255, 255, 0.16) 0 1px,
      transparent 1px 5px);
  mix-blend-mode: overlay;
  opacity: 0.35;
  transition: opacity 0.3s;
}
.card-frame.is-tilting .foil-texture { opacity: 0.6; }

/* ---------- Large card viewer ---------- */

html.has-viewer { overflow: hidden; }

.viewer {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.viewer::backdrop {
  background: rgba(6, 10, 16, 0.86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.viewer[open] { display: grid; place-items: center; }

.viewer-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: max(56px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.viewer-frame {
  --card-radius: 14px;
  width: min(88vw, calc((100vh - 190px) * 63 / 88), 520px);
  width: min(88vw, calc((100dvh - 190px) * 63 / 88), 520px);
  padding: 4px;
  touch-action: none;
  cursor: grab;
}
.viewer-frame .card-face { border-radius: calc(var(--card-radius) - 4px); }

.viewer-close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(20, 28, 40, 0.7);
  color: #fff;
  cursor: pointer;
}
.viewer-close svg { width: 22px; height: 22px; }
.viewer-close:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.viewer-text { max-width: 520px; text-align: center; }
.viewer-title { font-weight: 650; font-size: 15px; }
.viewer-hint { margin-top: 4px; color: rgba(255, 255, 255, 0.72); font-size: 13px; }
.viewer-hint:empty { display: none; }

/* ---------- Identity ---------- */

.identity { min-width: 0; padding-top: 2px; }

.card-name {
  font-size: 23px;
  font-weight: 750;
  font-stretch: 110%;
  line-height: 1.08;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}
.card-name:focus { outline: none; }

.card-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.title-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 6px;
  border: 1.5px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 750;
  font-stretch: 112%;
  letter-spacing: 0.03em;
}
.card-name.is-flash { animation: flash 0.9s ease-out; }

@keyframes flash {
  0%   { background: var(--accent-wash); box-shadow: 0 0 0 6px var(--accent-wash); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}

.card-set {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.35;
}

.card-printed {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.35;
}
.card-printed-label {
  display: block;
  color: var(--ink-2);
  font-weight: 600;
}
.card-printed-name {
  white-space: nowrap;
}

/* Rarity • number • language, as one line like Collectr's */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}

.tag { white-space: nowrap; }
.tag:not(:last-child)::after {
  content: "•";
  margin: 0 8px;
  color: var(--ink-3);
  font-weight: 400;
}

.tag-number {
  color: var(--ink);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: 0.01em;
}

/* ---------- Price ---------- */

.price-label {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
}

.price-value {
  margin-top: 6px;
  color: var(--price);
  font-family: var(--font-num);
  font-size: clamp(34px, 9.5vw, 46px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

.price-currency {
  margin-right: 0.08em;
  font-size: 0.5em;
  font-weight: 600;
  vertical-align: 0.7em;
}

/* "AUD" after the headline, drawn by CSS so the price text stays the price */
.price .price-value::after {
  content: "AUD";
  margin-left: 0.4em;
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 0.32em;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* "▲ A$12.40 (3.1%) past month" */
.price-change {
  margin-top: 6px;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
}
.price-change.is-up { color: var(--up); }
.price-change.is-down { color: var(--down); }
.price-change.is-flat { color: var(--ink-3); }

/* Card page backdrop: the card's own art, blurred and darkened, behind the header */
.card-backdrop {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 0;
  height: 520px;
  background-position: center 25%;
  background-size: cover;
  filter: blur(38px) saturate(1.4) brightness(0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.card-backdrop.is-visible { opacity: 1; }
#main { position: relative; overflow-x: clip; }
#main > .layout, #main > .results, #main > .review, #main > .load-error { position: relative; z-index: 1; }
.card-backdrop:has(~ .layout[hidden]) { display: none; }

/* Under the chart: evidence and spread */
.chart-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px 16px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.chart-stats[hidden] { display: none; }
.chart-stats dt { color: var(--ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.chart-stats dd { margin: 3px 0 0; font-family: var(--font-num); font-size: 15px; font-weight: 600; }

/* Another market's reference line (e.g. US prices in AUD): dashed blue */
.chart .reference-line {
  fill: none;
  stroke: var(--reference);
  stroke-width: 2;
  stroke-dasharray: 5 5;
  opacity: 0.9;
}
.legend-swatch.is-au { width: 18px; border-top: 2.5px solid var(--chart); }
.legend-swatch.is-reference { width: 18px; border-top: 2px dashed var(--reference); }

.graded-panel { grid-area: graded; }

.price-none {
  margin-top: 6px;
  font-size: clamp(23px, 6.4vw, 30px);
  font-weight: 720;
  font-stretch: 112%;
  line-height: 1.1;
}

.price-basis {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.price-evidence {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 13.5px;
}

.price-note {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 14.5px;
  max-width: 52ch;
}

/* Printing picker: one button per catalogue-verified finish */

.printing-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.printing-legend {
  float: left; /* lets the legend behave like a normal block */
  width: 100%;
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.printing-options {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.printing-option {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 12px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.printing-option:hover { border-color: var(--ink-3); }
.printing-option.is-selected {
  border-color: var(--accent);
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.printing-option:has(.printing-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The real radio stays in the page for keyboards and screen readers */
.printing-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.printing-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.printing-price {
  color: var(--ink-2);
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.printing-price.is-muted {
  color: var(--ink-3);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
}

.printing-notice {
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.text-button {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* About this price */

.confidence-empty {
  color: var(--ink-2);
  font-size: 14px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 8px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}
.status svg { width: 16px; height: 16px; flex-shrink: 0; }
.status-fresh  { background: var(--fresh-wash); }
.status-fresh svg { color: var(--fresh); }
.status-ageing { background: var(--ageing-wash); }
.status-ageing svg { color: var(--ageing); }
.status-stale  { background: var(--stale-wash); }
.status-stale svg { color: var(--stale); }

.fact-list { margin: 12px 0 0; }

.fact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
}
.fact-row + .fact-row { border-top: 1px solid var(--line); }

.fact-row dt {
  color: var(--ink-2);
  font-size: 13.5px;
}
.fact-row dd {
  margin: 0;
  text-align: right;
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.fact-row dd .fact-sub {
  font-family: var(--font);
}
.fact-sub {
  display: block;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 450;
}

.confidence .explainer {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.explainer {
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-2);
}
.explainer summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  list-style: none;
  border-radius: 6px;
}
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary svg {
  width: 14px; height: 14px;
  color: var(--ink-3);
  transition: transform 0.2s;
}
.explainer[open] summary svg { transform: rotate(90deg); }
.explainer p { margin-top: 8px; max-width: 60ch; }

/* ---------- Panels ---------- */

.panel {
  min-width: 0;
  padding: 18px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.panel-head { margin-bottom: 12px; }

.panel-title {
  font-size: 17px;
  font-weight: 700;
  font-stretch: 106%;
  line-height: 1.25;
}

.panel-sub {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.panel-sub:empty { display: none; }

.panel-foot {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
}
.panel-foot:empty { display: none; }

/* ---------- Sealed products strip on search results (sealed-results.js) ---------- */

.sealed-strip { margin: 4px 0 20px; }
.sealed-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.sealed-strip-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(140px, 160px);
  gap: 12px;
  margin: 0;
  padding: 0 0 8px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.sealed-strip-list li { scroll-snap-align: start; }
/* Product photos sit on white, so the art fills the tile's top edge to edge
   (no inner box) and the tile reads as one card. */
.sealed-tile {
  display: grid;
  grid-template-rows: auto auto 1fr;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
}
.sealed-tile:hover { border-color: var(--chart); }
.sealed-tile-art {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: #fff;
}
/* Pinned inside the square: a tall pack or wide box can't stretch the tile. */
.sealed-tile-art { position: relative; overflow: hidden; }
.sealed-tile-art img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; }
.sealed-tile-name { padding: 8px 10px 0; font-size: 13.5px; font-weight: 700; line-height: 1.25; }
.sealed-tile-meta { padding: 2px 10px 10px; color: var(--ink-3); font-size: 12.5px; }
.sealed-tile-price { margin-top: -6px; padding: 0 10px 10px; color: var(--fresh); font-family: var(--font-num); font-size: 16px; font-weight: 600; }

/* ---------- In your portfolio (holding.js) ---------- */

.holding {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-align: left;
}
.holding-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.holding-title { font-size: 15px; font-weight: 700; }
.holding-link {
  color: var(--chart);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.holding-link:hover { text-decoration: underline; }
.holding-add {
  min-height: 44px;
  border: 1.5px dashed var(--chart);
  border-radius: 10px;
  background: none;
  color: var(--chart);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.holding-add:hover:not(:disabled) { background: var(--chart-fill); color: var(--ink); }
.holding-add:disabled { opacity: 0.5; cursor: default; }
.holding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}
.holding-printing { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-button {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--chart);
  border-radius: 50%;
  background: none;
  color: var(--chart);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.stepper-button:hover:not(:disabled) { background: var(--chart-fill); color: var(--ink); }
.stepper-button:disabled { opacity: 0.5; cursor: default; }
.stepper-count {
  min-width: 2.2ch;
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--chart);
}
.holding-value {
  min-width: 84px;
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.holding-value.is-muted { color: var(--ink-3); font-size: 14px; }
.holding-cost {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-2);
  font-size: 14px;
}
.holding-cost-input {
  width: 120px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  text-align: right;
}
.holding-cost-input:focus { outline: 2px solid var(--chart); outline-offset: 1px; }
.holding-others { color: var(--ink-2); font-size: 13.5px; }
.holding-error { color: #D14343; font-size: 13.5px; }

/* ---------- Chart ---------- */

.chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
}
.chart-heading { flex: 1 1 220px; min-width: 0; }

/* 1M / 3M / 1Y / All: display window only, never the headline price */
.chart-range {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.range-button {
  appearance: none;
  min-width: 48px;
  min-height: 40px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.range-button:hover { color: var(--ink); }
.range-button.is-selected {
  background: var(--chart);
  color: #fff;
}

.chart {
  position: relative;
  height: 250px;
  margin: 0 -4px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: pan-y;
  cursor: crosshair;
  border-radius: 6px;
}
.chart svg:focus { outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

/* The market price over time: a smooth purple line with a fading fill */
.chart .sales-line {
  fill: none;
  stroke: var(--chart);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .sales-area { fill: url(#chart-area-fill); }
.chart .area-stop-top { stop-color: var(--chart-fill); }
.chart .area-stop-bottom { stop-color: var(--chart); stop-opacity: 0; }
.chart .end-dot {
  fill: var(--chart);
  stroke: var(--surface);
  stroke-width: 2;
}
.chart .active-guide {
  stroke: var(--ink-3);
  stroke-width: 1;
}
.chart .active-dot {
  fill: var(--chart);
  stroke: var(--surface);
  stroke-width: 2.5;
}

/* High and low: dashed guides with their values, like a range readout */
.chart .range-guide {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 5 4;
  opacity: 0.7;
}
.chart .guide-label {
  fill: var(--ink-2);
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.chart .baseline { stroke: var(--ink-3); stroke-width: 1.5; }
.chart .tick-label {
  fill: var(--ink-2);
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.chart .point-label {
  fill: var(--ink);
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}
/* Before a market price exists: one dot per sale */
.chart .dot-mark {
  fill: var(--chart);
  stroke: var(--surface);
  stroke-width: 2;
  transition: r 0.15s;
}
.chart .dot.is-active .dot-mark { r: 7; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.chart-legend:empty { display: none; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { flex-shrink: 0; display: inline-block; }
.legend-swatch.is-headline {
  width: 10px;
  height: 10px;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
}
.legend-swatch.is-market {
  width: 18px;
  border-top: 1.5px dashed var(--ink-2);
}

.chart-tip {
  position: absolute;
  z-index: 2;
  min-width: 120px;
  padding: 7px 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: var(--pop-shadow);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  white-space: nowrap;
}
.chart-tip-value {
  display: block;
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chart-tip.is-below { transform: translate(-50%, 14px); }
.chart-tip-meta {
  display: block;
  color: var(--ink-2);
  font-size: 12.5px;
}
.chart-tip-note {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.chart-empty {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  height: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--ink-3);
  font-size: 13.5px;
  text-align: center;
  padding: 16px;
}

/* ---------- Comps ---------- */

.comps {
  margin: 0 -8px;
  padding: 0;
  list-style: none;
}

.comp + .comp { border-top: 1px solid var(--line); }

.comp-link {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 8px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.12s;
}
.comp-link:hover,
.comp.is-active .comp-link { background: var(--surface-2); }

.comp-thumb {
  position: relative;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-3);
}
.comp-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.comp-thumb svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
}

.comp-body { min-width: 0; }

.comp-when { font-size: 14.5px; line-height: 1.3; }
.comp-date { font-weight: 650; }
.comp-date,
.comp-ago { white-space: nowrap; }
.comp-ago { margin-left: 6px; color: var(--ink-3); font-size: 13px; }

.comp-title {
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.comp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
}

.format-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.comp-link:hover .format-tag,
.comp.is-active .format-tag { background: var(--surface); }

.postage { color: var(--ink-3); font-size: 12.5px; }

.comp-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.comp-price {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.comp-out {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}
.comp-out svg { width: 12px; height: 12px; }
.comp-link:hover .comp-out { color: var(--accent); }

.comps-empty {
  padding: 8px;
  color: var(--ink-2);
}

/* ---------- Search results ---------- */

.results.is-switching {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.results-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 18px;
}

.results-heading {
  flex: 1 1 260px;
  min-width: 0;
}

.results-title {
  font-size: 22px;
  font-weight: 750;
  font-stretch: 108%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.results-title:focus { outline: none; }
.results-title:focus-visible { outline: 2px solid var(--accent); }

.results-summary {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 14px;
}
.results-summary:empty { display: none; }

/* All / English / Japanese: physical card language, not the UI language */
.results-filter {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segments {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
}

.results-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.segment {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 62px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.segment:hover { color: var(--ink); }
.segment-count {
  color: var(--ink-3);
  font-family: var(--font-num);
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.segment.is-selected .segment-count { color: var(--ink-2); }

.results-sort {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}
.results-sort-select {
  min-height: 44px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%238C99A8' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center / 16px,
    var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.segment.is-selected {
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--ink);
}
.segment:has(.segment-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.segment-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result { min-width: 0; }

/* Each tile is a small slab: the card above, its label below */
.result-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.result-link:hover {
  border-color: var(--line-strong);
  box-shadow: var(--pop-shadow);
  transform: translateY(-2px);
}
.result-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.result-art {
  container-type: inline-size;
  position: relative;
  display: block;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(20, 33, 49, 0.2);
}
.result-art img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-art.skeleton { box-shadow: none; }

/* Typographic stand-in under every image; the foil edge marks a card
   whose image is missing, like the search thumbnails */
.result-proxy {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 9% 9% 10%;
  border: 3px solid transparent;
  border-radius: 6px;
  background:
    repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line) 45%, transparent) 7px 8px) padding-box,
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--foil) border-box;
  color: var(--ink);
}
.result-proxy-note {
  visibility: hidden;
  color: var(--ink-3);
  font-size: 12px;
  font-size: 7.5cqw;
}
.result-art.is-missing .result-proxy-note { visibility: visible; }
.result-proxy-name {
  margin-top: auto;
  font-size: 15px;
  font-size: 10.5cqw;
  font-weight: 750;
  font-stretch: 112%;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.result-proxy-number {
  margin-top: 4%;
  color: var(--ink-2);
  font-size: 12px;
  font-size: 7.5cqw;
  font-weight: 700;
  font-stretch: 112%;
}

.result-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 2px 0;
}

/* Full card names, never cut short: "Magikarp & Wailord GX" */
.result-title {
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.result-printed,
.result-set {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.result-year { color: var(--ink-3); }

/* A Japanese card without a backend English alias says so */
.result-flag,
.card-flag {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 7px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}
.card-flag { display: inline-block; margin-top: 8px; font-size: 13px; }

.result-lang {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.6;
}
.result-lang.is-ja { border-color: var(--accent); color: var(--ink); }

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.35;
}
.result-number {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.result-rarity {
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.35;
}

.result-price {
  margin-top: auto;
  padding-top: 6px;
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result.is-skeleton .result-body .skeleton-line { width: 85%; }
.result.is-skeleton .result-body .skeleton-short { width: 50%; }

.results-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 22px;
  text-align: center;
}
.results-foot:empty { display: none; }

.results-message {
  width: 100%;
  max-width: 460px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
}
.results-message-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  font-stretch: 106%;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.results-message p {
  margin-top: 6px;
  color: var(--ink-2);
}

.button.button-quiet {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.button.button-quiet:hover {
  border-color: var(--accent);
  opacity: 1;
}
.button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.results-more {
  min-width: 220px;
  margin-top: 0;
}

.results-more-error {
  color: var(--ink-2);
}

@media (min-width: 600px) {
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
  .results-title { font-size: 28px; }
}

@media (min-width: 960px) {
  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
    gap: 16px;
  }
  .results-head { margin-bottom: 24px; }
  .results-title { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  a.result-link:hover { transform: none; }
}

/* ---------- Loading + error ---------- */

.skeleton {
  border-radius: 6px;
  background: var(--line);
  animation: pulse 1.4s ease-in-out infinite;
}
.card-face.skeleton { border-radius: calc(var(--card-radius) - 3px); }
.card-frame.is-loading { background: var(--line); box-shadow: none; }
.skeleton-line { height: 14px; margin-top: 10px; width: 80%; }
.skeleton-title { height: 24px; margin-top: 0; width: 90%; }
.skeleton-short { width: 45%; }
.skeleton-price { height: 56px; margin-top: 8px; width: 70%; max-width: 360px; }
.skeleton-chart { height: 100%; }
.skeleton-row { height: 56px; margin: 12px 8px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Switching cards keeps the current card on screen, dimmed, until the next one arrives */
.layout.is-switching {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

.load-error {
  max-width: 460px;
  margin: 48px auto 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.load-error-title { font-size: 20px; font-weight: 700; font-stretch: 108%; }
.load-error-body { margin-top: 6px; color: var(--ink-2); }

.button {
  margin-top: 16px;
  height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.button:hover { opacity: 0.9; }

.noscript { max-width: 480px; margin: 40px auto; padding: 0 16px; }

/* ---------- Phone search dropdown ----------
   Full content width under the header, price on its own line, so card
   names and set details aren't squeezed beside the logo and price. */

@media (max-width: 599px) {
  /* Reach back under the 22px brand mark and its 12px gap */
  .search-results {
    left: -34px;
    right: 0;
  }

  .search-option {
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 10px;
    row-gap: 3px;
    align-items: start;
  }
  .search-thumb {
    grid-row: span 2;
    width: 32px;
  }
  .search-option-price {
    grid-column: 2;
    font-size: 14px;
  }
  .search-option-title {
    white-space: normal;
  }
}

/* ---------- Narrow phones ---------- */

@media (max-width: 419px) {
  .comp-link { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; }
  .comp-thumb { width: 44px; height: 44px; }
}

@media (max-width: 359px) {
  .comp-link { grid-template-columns: minmax(0, 1fr) auto; }
  .comp-thumb { display: none; }
}

/* ---------- Larger screens ---------- */

@media (min-width: 420px) {
  .card-name { font-size: 26px; }
}

/* Tablets: the card beside its name, price and printing */
@media (min-width: 600px) and (max-width: 959px) {
  .layout {
    grid-template-columns: 232px minmax(0, 1fr);
    grid-template-areas:
      "crumbs crumbs"
      "art    identity"
      "art    price"
      "art    printing"
      "art    holding"
      "chart  chart"
      "conf   conf"
      "comps  comps"
      "graded graded";
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: 28px;
  }
  .layout:has(> .card-head > .printing[hidden]) {
    grid-template-areas:
      "crumbs crumbs"
      "art    identity"
      "art    price"
      "art    printing"
      "art    holding"
      "chart  chart"
      "conf   conf"
      "comps  comps"
      "graded graded";
  }
  .art { width: 100%; justify-self: stretch; }
}

@media (min-width: 600px) {
  .brand-name { display: inline; }
  .card-frame { --card-radius: 11px; }
  .card-name { font-size: 32px; }
  .panel { padding: 22px 22px 18px; }
  .chart { height: 270px; }
  .price-value { font-size: 52px; }
  .printing-option { flex: 0 1 auto; min-width: 128px; }
}

@media (min-width: 960px) {
  :root { --gutter: 28px; }
  body { font-size: 16px; }

  .topbar-inner { gap: 32px; padding-top: 14px; padding-bottom: 14px; }
  .search { max-width: 520px; margin-left: auto; }

  .page { padding-top: 40px; }

  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
    grid-template-areas:
      "crumbs crumbs"
      "head   head"
      "art    chart"
      "art    conf"
      "art    comps"
      "art    graded";
    grid-template-rows: auto auto auto auto 1fr auto;
    column-gap: 40px;
    row-gap: 24px;
  }

  .crumbs { margin-bottom: -8px; }

  /* Title band: name, set and details left; price right */
  .card-head {
    grid-area: head;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 48px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
  }
  .card-head .identity { flex: 1 1 340px; min-width: 0; }
  .card-head .price { flex: 0 1 auto; text-align: right; }
  .card-head .price-note,
  .card-head .printing-notice { margin-left: auto; max-width: 36ch; }

  /* The picker gets its own row under the price, so the name and the
     price stay level */
  .card-head .printing {
    display: flex;
    flex: 1 0 100%;
    flex-direction: column;
    align-items: flex-end;
    margin-top: -2px;
    text-align: right;
  }
  .card-head .printing-picker {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .card-head .printing-legend { width: auto; margin: 0; }
  .card-head .printing-options { justify-content: flex-end; }
  .card-head .printing-option { min-width: 136px; }
  .card-head .holding { flex: 0 1 380px; margin-left: auto; }

  .art {
    position: sticky;
    top: 108px;
    width: 100%;
    justify-self: stretch;
  }

  .card-frame { --card-radius: 16px; padding: 4px; }
  .card-face { border-radius: calc(var(--card-radius) - 4px); }

  .card-name { font-size: 40px; }
  .card-set { font-size: 17px; margin-top: 6px; }
  .title-badge { height: 26px; padding: 0 7px; font-size: 13px; }

  .price-value { font-size: 56px; }

  .chart { height: 300px; }
}

/* Three columns like Collectr: card art, sales, About this price */
@media (min-width: 1180px) {
  :root { --page-max: 1320px; }

  .layout {
    grid-template-columns: 300px minmax(0, 1fr) 300px;
    grid-template-areas:
      "crumbs crumbs crumbs"
      "head   head   head"
      "art    chart  conf"
      "art    comps  conf"
      "art    graded conf";
    grid-template-rows: auto auto auto 1fr auto;
    column-gap: 28px;
  }

  .confidence-panel {
    position: sticky;
    top: 108px;
  }
}

/* ---------- Motion + contrast preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card-frame { transform: none !important; }
}

@media (forced-colors: active) {
  .card-frame { border: 2px solid CanvasText; }
  .status { border: 1px solid CanvasText; }
  .chart .dot-mark { fill: Highlight; }
  .segment.is-selected,
  .printing-option.is-selected { outline: 2px solid Highlight; }
}

/* ---------- Needs review (?review) ----------
   The operator's pricing review desk. Same slab palette: eucalyptus marks
   sales in the trusted price, amber marks anything held or still pending,
   and submitted links are dashed so they never read as sales. */

:root {
  --danger: #B4232A;
  --danger-wash: rgba(180, 35, 42, 0.10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --danger: #F0817F;
    --danger-wash: rgba(240, 129, 127, 0.14);
  }
}

.topbar-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.topbar-link svg { width: 20px; height: 20px; }
.topbar-link:hover { color: var(--ink); border-color: var(--line-strong); }
.topbar-link[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent);
}
.topbar-link-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* A text-only link (no icon) always shows its label. */
.topbar-link:not(:has(svg)) .topbar-link-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }

@media (min-width: 600px) {
  .topbar-link-label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }
}

.review { min-width: 0; }

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 16px;
}

.review-heading { flex: 1 1 260px; min-width: 0; }

.review-title {
  font-size: 22px;
  font-weight: 750;
  font-stretch: 108%;
  line-height: 1.15;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.review-title:focus,
.review-message-title:focus { outline: none; }
.review-title:focus-visible,
.review-message-title:focus-visible { outline: 2px solid var(--accent); }

.review-summary {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 14px;
}
.review-summary:empty { display: none; }

/* Sign-in and export */

.review-tools {
  display: grid;
  gap: 10px;
  flex: 1 1 300px;
  max-width: 460px;
  min-width: 0;
}

.review-session-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.4;
}
.review-session-text.is-on { color: var(--fresh); font-weight: 600; }
.review-session-text.is-off {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--ageing-wash);
  color: var(--ink);
}
.review-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--fresh);
}

.review-signin {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.review-signin-label {
  display: block;
  font-size: 14px;
  font-weight: 650;
}
.review-signin-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.review-token-input,
.sale-reason,
.sale-note-input,
.links-url,
.links-note {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  /* 16px stops iOS zooming into the field */
  font: inherit;
  font-size: 16px;
}
.review-token-input:focus,
.sale-reason:focus,
.sale-note-input:focus,
.links-url:focus,
.links-note:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.sale-note-input,
.links-note {
  resize: vertical;
  line-height: 1.4;
}
.review-signin .button,
.review-signin-button {
  flex-shrink: 0;
  height: 44px;
  margin-top: 0;
}
.review-signin-note {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 12.5px;
}

.review-error {
  margin-top: 8px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.review-error:empty { display: none; }

.review-export-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.review-export {
  min-height: 44px;
  margin-top: 0;
}
.review-export-status {
  flex: 1 1 200px;
  min-width: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.review-export-status:empty { display: none; }
.review-export-status.is-error { color: var(--danger); font-weight: 600; }

/* Queue filter */

.review-filter {
  display: flex;
  gap: 8px;
  margin: 0 calc(-1 * var(--gutter)) 14px;
  padding: 2px var(--gutter) 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.review-filter::-webkit-scrollbar { display: none; }

.review-filter-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.review-filter-button:hover { color: var(--ink); border-color: var(--line-strong); }
.review-filter-button.is-selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.review-filter-count {
  font-family: var(--font-num);
  font-weight: 600;
  opacity: 0.8;
}

/* Queue list */

.review-queue,
.sales,
.proposals {
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-queue {
  display: grid;
  gap: 10px;
}

.review-item.is-skeleton {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.review-item-link {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.review-item-link:hover { border-color: var(--line-strong); }
.review-item-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.review-rank {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.review-thumb,
.review-card-thumb {
  position: relative;
  display: block;
  width: 52px;
  aspect-ratio: 63 / 88;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-2);
  box-shadow: 0 1px 2px rgba(20, 33, 49, 0.2);
}
.review-card-thumb { width: 84px; border-radius: 6px; }
.review-thumb img,
.review-card-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.review-thumb-proxy {
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 0 4px 4px;
  border: 2px solid transparent;
  border-radius: inherit;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--foil) border-box;
  color: var(--ink-3);
  font-family: var(--font-num);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.review-item-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.review-item-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.review-item-title {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.review-item-meta {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.35;
}
.review-item-reason {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.review-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.review-chip {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.4;
}

.review-item-price {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}
.review-price-value {
  font-family: var(--font-num);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}
.review-price-none {
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 650;
}
.review-price-basis {
  color: var(--ink-3);
  font-size: 12px;
  white-space: nowrap;
}

/* Phones: the price moves under the reason so names keep their width. */
@media (max-width: 479px) {
  .review-item-link { grid-template-columns: 52px minmax(0, 1fr); }
  .review-item-price {
    grid-column: 2;
    justify-items: start;
    grid-auto-flow: column;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
}

.review-message {
  padding: 22px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}
.review-message-title { font-size: 18px; font-weight: 700; }
.review-message p { margin-top: 6px; color: var(--ink-2); }

.review-refreshing {
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.review-foot {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 16px;
}
.review-more {
  min-width: 200px;
  min-height: 44px;
}

.review-foot-note {
  margin-top: 14px;
  color: var(--ink-3);
  font-size: 12.5px;
  line-height: 1.45;
}

/* Card detail */

.review-crumbs { margin-bottom: 12px; }
.review-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}
.review-back:hover { text-decoration: underline; text-underline-offset: 3px; }

.review-card-head {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  grid-template-areas:
    "thumb identity"
    "price price";
  gap: 14px 14px;
  margin-bottom: 16px;
}
.review-card-thumb { grid-area: thumb; }
.review-card-identity { grid-area: identity; min-width: 0; }
.review-card-title { display: block; }
.review-card-title .lang-badge { vertical-align: 0.2em; }
.review-card-printed {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.review-card-meta,
.review-card-printing,
.review-card-target {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.4;
}
.review-card-label { color: var(--ink-3); }
.review-card-printing .review-status { margin-left: 6px; }
.review-card-open {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.review-card-price {
  grid-area: price;
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.review-card-price-label { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.review-card-price-value {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.05;
}
.review-card-price-none { font-size: 20px; font-weight: 750; }
.review-card-price-basis { color: var(--ink-3); font-size: 12.5px; }

@media (min-width: 720px) {
  .review-card-head {
    grid-template-columns: 96px minmax(0, 1fr) minmax(200px, auto);
    grid-template-areas: "thumb identity price";
    align-items: start;
  }
  .review-card-thumb { width: 96px; }
  .review-card-price { justify-items: end; text-align: right; }
}

.review-panel { margin-top: 16px; }

/* Result of a save: before and after, exactly as the server returned it */

.review-banner {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--fresh);
  border-left-width: 4px;
  border-radius: 14px;
  background: var(--surface);
}
.review-banner:focus { outline: none; }
/* Clear the sticky header when a result is scrolled into view. */
.review-banner,
.review-title,
.sale { scroll-margin-top: 84px; }
.review-banner:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.review-banner.is-rejected { border-color: var(--danger); }
.review-banner.is-pending { border-color: var(--ageing); }
.review-banner.is-links { border-color: var(--ageing); border-style: dashed; }
.review-banner-title { font-size: 17px; font-weight: 700; }
.review-banner-sale,
.review-banner-reason {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.review-banner-note {
  margin-top: 4px;
  padding-left: 10px;
  border-left: 2px solid var(--line-strong);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.review-banner-note:empty { display: none; }
.review-banner-outcome { margin-top: 10px; font-weight: 650; }
.review-banner-id { margin-top: 6px; color: var(--ink-3); font-size: 12px; }
.review-banner-links { margin-top: 8px; padding-left: 18px; font-size: 14px; }

.review-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}
.review-compare-side {
  display: grid;
  gap: 2px;
  min-width: 120px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}
.review-compare-side.is-after { background: var(--fresh-wash); }
.review-compare.is-unchanged .review-compare-side.is-after { background: var(--surface-2); }
.review-compare-label { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.review-compare-price {
  font-family: var(--font-num);
  font-size: 22px;
  font-weight: 700;
}
.review-compare-none { font-size: 16px; font-weight: 700; }
.review-compare-basis { color: var(--ink-3); font-size: 12px; }
.review-compare-arrow { color: var(--ink-3); font-size: 20px; }

/* Sales */


.sale {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.sale:first-child { border-top: 0; padding-top: 4px; }
.sale[aria-busy="true"] { opacity: 0.75; }

.sale-body { min-width: 0; }
.sale-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sale-date { font-weight: 650; }
.sale-price {
  font-family: var(--font-num);
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}
.sale-title {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.sale-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.sale-tag {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
}

.review-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.45;
}
.review-status.is-trusted { background: var(--fresh-wash); color: var(--fresh); }
.review-status.is-open { background: var(--stale-wash); color: var(--ink-2); }
.review-status.is-held { background: var(--ageing-wash); color: var(--ageing); }
.review-status.is-approved { background: var(--accent-wash); color: var(--accent); }
.review-status.is-rejected { background: var(--danger-wash); color: var(--danger); }
.review-status.is-impact { background: var(--accent); color: var(--bg); }
.review-status.is-pending-link {
  border: 1px dashed var(--ageing);
  color: var(--ageing);
}

.sale-decision,
.sale-machine {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sale-machine-label { color: var(--ink); font-weight: 600; }
.sale-machine.is-auto_trust .sale-machine-label { color: var(--fresh); }
.sale-machine.is-auto_exclude .sale-machine-label { color: var(--danger); }
.sale-photo {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}
.sale-photo.is-match .sale-machine-label { color: var(--fresh); }
.sale-photo.is-same_artwork_different_colours .sale-machine-label { color: var(--danger); }
.sale-holds {
  margin: 8px 0 0;
  padding: 6px 10px;
  list-style: none;
  border-left: 3px solid var(--ageing);
  border-radius: 0 8px 8px 0;
  background: var(--ageing-wash);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sale-holds li + li { margin-top: 4px; }
.sale-holds .sale-why-label { font-weight: 600; }
.sale-holds li.sale-why-label + li { margin-top: 2px; }
.sale-flag {
  border-left-color: var(--accent);
  background: var(--accent-wash);
}
.sale-why {
  border-left-color: var(--danger);
  background: var(--danger-wash);
}
.sale-reasons {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sale-decision-source,
.sale-reasons-label { color: var(--ink); font-weight: 600; }
.sale-code {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}
.sale-when { color: var(--ink-3); }
.sale-code-details { margin-top: 2px; }
.sale-code-details summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--ink-3);
  font-size: 12.5px;
  cursor: pointer;
}
.sale-more { display: block; margin: 8px auto 0; }

.sale-note {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  font-size: 13.5px;
}
.sale-note-reason { color: var(--ink-2); font-weight: 600; }
.sale-note-text {
  margin-top: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sale-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.sale-link.is-missing { color: var(--ink-3); font-weight: 400; }

.sale-decide { margin-top: 6px; }
.sale-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.sale-action {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
}
.sale-action:disabled { cursor: progress; opacity: 0.6; }
.sale-action.is-approved { color: var(--fresh); border-color: color-mix(in srgb, var(--fresh) 55%, var(--line)); }
.sale-action.is-rejected { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.sale-action.is-pending { color: var(--ageing); border-color: color-mix(in srgb, var(--ageing) 50%, var(--line)); }
.sale-action[aria-pressed="true"].is-approved { background: var(--fresh); border-color: var(--fresh); color: var(--bg); }
.sale-action[aria-pressed="true"].is-rejected { background: var(--danger); border-color: var(--danger); color: var(--bg); }
.sale-action[aria-pressed="true"].is-pending { background: var(--ageing); border-color: var(--ageing); color: var(--bg); }

@media (min-width: 720px) {
  .sale-actions { max-width: 420px; }
}

.sale-form {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.sale-form-title { font-weight: 700; }
.sale-field-label {
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}
.sale-form-buttons {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 4px;
}
.sale-save,
.links-submit {
  min-height: 44px;
  margin-top: 0;
}
.sale-cancel { min-height: 44px; }

/* Missing sales: submitted links stay visibly pending */

.proposals {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.proposal {
  padding: 12px;
  border: 1px dashed var(--ageing);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ageing-wash) 45%, var(--surface));
}
.proposal-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.proposal-link {
  color: var(--accent);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.proposal-flag {
  margin-top: 6px;
  color: var(--ageing);
  font-size: 13px;
  font-weight: 650;
}
.proposal-notes {
  margin-top: 6px;
  padding-left: 18px;
  font-size: 13.5px;
}
.proposal-note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.proposal-note-when { color: var(--ink-3); }
.proposal-steps {
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 13px;
}
.proposal-steps summary {
  min-height: 32px;
  cursor: pointer;
  font-weight: 600;
}
.proposal-steps ul { padding-left: 18px; }

.links-form { display: grid; gap: 10px; }
.links-rows { display: grid; gap: 10px; }
.links-row {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.links-legend {
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}
.links-add,
.links-remove {
  justify-self: start;
  min-height: 40px;
}
.links-buttons { display: flex; }

/* Other collected sales */

.other-panel > .other-summary {
  display: grid;
  gap: 2px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}
.other-panel > .other-summary::-webkit-details-marker { display: none; }
.other-panel > .other-summary .panel-title::after {
  content: " ▸";
  color: var(--ink-3);
}
.other-panel[open] > .other-summary .panel-title::after { content: " ▾"; }
.other-panel[open] > .other-summary { margin-bottom: 8px; }

@media (forced-colors: active) {
  .review-status,
  .sale-action,
  .review-filter-button,
  .proposal { border: 1px solid CanvasText; }
}

/* Live refresh status on the card page */
.live-refresh-note { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; background: var(--surface-2, rgba(127,127,127,0.12)); color: inherit; }

/* ---------- Site menu: header links on wider screens, a tab bar on phones ---------- */
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.search ~ .site-nav { margin-left: 0; }
.site-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.site-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.site-link:hover { color: var(--ink); background: var(--surface-2); }
.site-link[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--chart) 20%, transparent); }
/* Without a search box in the header there's room for the name. */
.topbar-inner:not(:has(.search)) .brand-name { display: inline; }
.tabbar { display: none; }
@media (max-width: 759px) {
  .site-nav { display: none; }
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }
  .tab-link {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 6px 0 4px;
    border-radius: 12px;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .tab-link svg { width: 23px; height: 23px; }
  .tab-link:active { background: var(--surface-2); }
  .tab-link[aria-current="page"] { color: var(--chart); }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
}

/* ---------- US market & graded reference (Scrydex) ---------- */
.us-market { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.us-market-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.us-market-label { flex-basis: 100%; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.us-market-price { font-family: var(--font-num); font-size: 28px; font-weight: 500; color: var(--reference, #60A5FA); }
.us-market-usd { color: var(--ink-3); font-family: var(--font-num); font-size: 14px; }
.us-market-trends { display: flex; gap: 16px; margin: 0; }
.us-market-trends div { display: grid; gap: 2px; }
.us-market-trends dt { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.us-market-trends dd { margin: 0; font-family: var(--font-num); font-size: 14px; }
.us-market-trends .is-up dd { color: var(--up); }
.us-market-trends .is-down dd { color: var(--down); }
.us-market-conditions { margin: 0; color: var(--ink-2); font-size: 13px; }
.graded-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 14px 0 4px; }
.graded-company h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.graded-company ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.graded-company li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.graded-grade { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.graded-price { font-family: var(--font-num); font-size: 14px; }
.graded-none { color: var(--ink-2); margin: 12px 0 0; }
.graded-note { margin: 12px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.45; }

/* ---------- Portfolio switcher ---------- */
.pfs { position: relative; display: inline-block; }
.pfs-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.pfs-button:hover { border-color: var(--chart); }
.pfs-label { color: var(--ink-2); font-size: 13px; }
.pfs-name { font-weight: 800; }
.pfs-caret { color: var(--ink-3); }
.pfs-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: grid;
  min-width: 260px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.pfs-menu[hidden] { display: none; }
.pfs-menu hr { width: 100%; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.pfs-option, .pfs-action {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pfs-option:hover, .pfs-action:hover { background: var(--surface-2); }
.pfs-option.is-active { background: color-mix(in srgb, var(--chart) 18%, transparent); }
.pfs-option-name { font-weight: 700; }
.pfs-option-count { color: var(--ink-3); font-size: 13px; }
.pfs-action { color: var(--chart); font-weight: 650; }
.pfs-action.is-danger { color: var(--down); }
.pf-switcher { margin-bottom: -6px; }
.scan-switcher { margin-bottom: 4px; }
.us-fallback { margin: 6px 0 0; color: var(--ink-2); }
.us-fallback strong { color: var(--reference, #60A5FA); font-family: var(--font-num); font-size: 20px; font-weight: 500; }
.us-fallback-note { color: var(--ink-3); font-size: 12.5px; }

/* ---------- Condition / graded switch (card page) ---------- */
.condition-switch { display: grid; gap: 8px; margin-top: 14px; }
.cond-title { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.cond-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cond-chip {
  min-width: 44px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.cond-chip.is-on { border-color: var(--chart); background: color-mix(in srgb, var(--chart) 20%, transparent); color: var(--ink); }
.cond-chip:disabled { opacity: 0.45; cursor: default; }
.cond-grade { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; }
.cond-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 2px 0 0; }
.cond-price strong { font-family: var(--font-num); font-size: 24px; font-weight: 500; color: var(--reference, #60A5FA); }
.cond-label { color: var(--ink); font-weight: 700; }
.cond-price small { flex-basis: 100%; color: var(--ink-3); font-size: 12px; }
@media (min-width: 960px) { .card-head .condition-switch { justify-items: end; } .card-head .cond-row { justify-content: flex-end; } .card-head .cond-price { justify-content: flex-end; } }

/* Owner's "Invalid" control on each sold listing */
.comp { position: relative; }
.comp-invalid {
  margin: 4px 0 0 auto;
  display: block;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.comp-invalid:hover, .comp-invalid:focus { color: var(--down); border-color: var(--down); }

/* How far to trust the headline (priceConfidence in app.js). */
.price-trust { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.price-trust-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--stale); flex-shrink: 0; }
.price-trust.is-high .price-trust-dot { background: var(--fresh); }
.price-trust.is-medium .price-trust-dot { background: var(--ageing); }
.price-trust.is-low .price-trust-dot { background: var(--down); }
.price-trust.is-review { color: var(--ageing); font-weight: 600; }
.price-trust.is-review .price-trust-dot { background: var(--ageing); }

/* Site footer (added to every page by theme.js). */
.site-footer {
  max-width: var(--page-max); margin: 24px auto 0; padding: 22px var(--gutter) 28px;
  border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13.5px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 12px 0 0; line-height: 1.5; }

/* "How is this worked out?" beside a price. */
.price-how { font-size: 13px; color: var(--accent); text-decoration: none; white-space: nowrap; }
.price-how:hover { text-decoration: underline; }
.price-how-line { margin: 8px 0 0; }
.set-stats-how { margin: 8px 0 0; }
