/* The card market: a trading floor in the shop's own ink and paper. */
.card-market, .market-sheet {
    --ink: var(--text-dark);
    --muted: var(--text-muted);
    --up: #11703f;
    --up-bg: #c9f7d8;
    --up-bright: #7bd88f;
    --down: #b3163b;
    --down-bg: #ffd9e1;
    --down-bright: #ff7a93;
    --sheet-paper: #fff9e9;
    /* The buy buttons and the order book's depth: sky by day, the theme's blue by night (#1279). */
    --buy: #9bf6ff;
    --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Mono', Menlo, Consolas, monospace;
}
/* By night the gains and losses are washed in the theme's tints (docs/design-system.md, Themes); the
   tape, the chart's tip and a pressed range stay a dark board in either light. */
html[data-theme="dark"] :is(.card-market, .market-sheet) {
    --up: var(--success);
    --up-bg: var(--tint-green);
    --down: var(--danger);
    --down-bg: var(--tint-pink);
    /* The sheet a card or a booster is laid on: cream paper by day, the theme's yellow tint by night (#1214). */
    --sheet-paper: var(--tint-yellow);
    --buy: var(--pastel-blue);
}
.card-market .visually-hidden, .market-sheet .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.market-tab-count { display: inline-block; min-width: 1.6em; margin-left: 8px; padding: 1px 6px; border: 2px solid var(--ink, #25252d); border-radius: 99px; background: #25252d; color: #fff; font-size: .7rem; font-variant-numeric: tabular-nums; }
.market-tabs button[aria-selected="true"] .market-tab-count { background: var(--white); color: var(--text-dark); }

/* Change chips: up in green, down in red, whatever the surface. */
.market-change { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border: 2px solid var(--ink-border); border-radius: 99px; background: var(--muted-gray); color: var(--muted); font: 850 .72rem/1.3 var(--mono); white-space: nowrap; }
.market-change.is-up { background: var(--up-bg); color: var(--up); }
.market-change.is-down { background: var(--down-bg); color: var(--down); }

/* The tape: the latest sales run past like a stock ticker. */
.market-tape { position: relative; display: flex; align-items: stretch; margin: 0 0 28px; overflow: hidden; border: 3px solid var(--ink-border); border-radius: 12px; background: #2d2d2d; box-shadow: 5px 5px 0 #ff5d8f; color: #fff9e9; }
.market-tape-label { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; padding: 0 16px; background: #ffe76b; color: #2d2d2d; font-size: .7rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
.market-tape-label::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: #ff3d6e; box-shadow: 0 0 0 3px #ff3d6e40; animation: market-live 1.4s ease-in-out infinite; }
@keyframes market-live { 50% { opacity: .3; } }
.market-tape-viewport { flex: 1; min-width: 0; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
.market-tape-viewport:focus-visible { outline: 3px solid #ffe76b; outline-offset: -3px; }
.market-tape-track { display: flex; width: max-content; animation: market-tape var(--tape-duration, 40s) linear infinite; }
.market-tape:hover .market-tape-track, .market-tape-viewport:focus-within .market-tape-track { animation-play-state: paused; }
@keyframes market-tape { to { transform: translateX(-50%); } }
.market-tape-run { display: flex; }
.market-tape-item { display: inline-flex; align-items: center; gap: 9px; padding: 11px 20px; border-right: 1px solid #ffffff26; color: inherit; font-size: .8rem; text-decoration: none; white-space: nowrap; }
.market-tape-item:hover, .market-tape-item:focus-visible { background: #ffffff14; outline: none; }
.market-tape-item i { width: 8px; height: 8px; border-radius: 2px; background: var(--rarity-color, #75818f); box-shadow: 0 0 0 2px #ffffff30; transform: rotate(45deg); }
.market-tape-item b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-weight: 800; }
.market-tape-item > span { font: 800 .82rem var(--mono); color: #ffe76b; }
.market-tape-item .market-change { border: 0; background: none; padding: 0; }
.market-tape-item .market-change.is-up { color: var(--up-bright); }
.market-tape-item .market-change.is-down { color: var(--down-bright); }
.market-tape-item .market-change.is-flat { color: #c9c3d3; }
.motion-reduced .market-tape-track { animation: none; }
.motion-reduced .market-tape-viewport { overflow-x: auto; mask-image: none; }
.motion-reduced .market-tape-run[aria-hidden="true"] { display: none; }
.motion-reduced .market-tape-label::before { animation: none; }

/* The pulse: how busy the floor is, and which way it leans. */
.market-floor-head { margin-top: 0; }
.market-pulse { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.market-stat { position: relative; display: grid; align-content: start; gap: 2px; min-width: 0; padding: 16px 18px; border: 3px solid var(--ink-border); border-radius: 14px; background: var(--white); box-shadow: 5px 5px 0 var(--ink-shadow); }
.market-stat > span { color: var(--muted); font-size: .68rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.market-stat > strong { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 950; line-height: 1.05; font-variant-numeric: tabular-nums; }
.market-stat > small { color: var(--muted); font-size: .74rem; font-weight: 750; }
.market-stat:nth-child(1) { background: var(--tint-yellow); }
.market-stat:nth-child(2) { background: var(--tint-blue); }
.market-stat:nth-child(3) { background: var(--tint-pink); }
.market-mood > strong { font-size: clamp(1.25rem, 2.2vw, 1.7rem); }
.market-mood.is-bull { background: var(--up-bg); }
.market-mood.is-bear { background: var(--down-bg); }
.market-mood.is-crab { background: var(--tint-peach); }
.market-mood.is-calm { background: var(--bg-subtle); }

/* Movers and your own offers: small horizontal shelves under the pulse. */
.market-movers, .market-wanted, .market-mine { margin-top: 26px; }
.market-movers h3, .market-wanted h3, .market-mine h3 { margin: 0 0 12px; font-size: .78rem; font-weight: 1000; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.market-movers-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.market-mover { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "art name" "art change" "spark spark" "price price"; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px 14px; border: 3px solid var(--ink-border); border-radius: 14px; background: var(--white); box-shadow: 4px 4px 0 var(--ink-shadow); color: var(--ink); text-decoration: none; transition: transform .14s ease, box-shadow .14s ease; }
.market-mover:hover, .market-mover:focus-visible { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink-shadow); outline: none; }
.market-mover:focus-visible { box-shadow: 6px 6px 0 #ff5d8f; }
.market-mover img { grid-area: art; width: 64px; height: 64px; object-fit: cover; border: 2px solid var(--ink-border); border-radius: 9px; box-shadow: 2px 2px 0 var(--rarity-color, #75818f); }
.market-mover-name { grid-area: name; align-self: end; display: -webkit-box; overflow: hidden; font-size: .84rem; font-weight: 850; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.market-mover > strong { grid-area: change; align-self: start; font: 950 1.35rem var(--mono); }
.market-mover.is-up > strong { color: var(--up); }
.market-mover.is-down > strong { color: var(--down); }
.market-mover .market-spark { grid-area: spark; width: 100%; height: 30px; margin-top: 8px; }
.market-mover small { grid-area: price; color: var(--muted); font-size: .7rem; font-weight: 750; }
.market-wanted-list { display: flex; gap: 14px; overflow-x: auto; padding: 2px 6px 10px 2px; scroll-snap-type: x proximity; }
.market-wanted-item { flex: 0 0 auto; display: grid; grid-template-columns: 44px auto; column-gap: 10px; align-items: center; min-width: 210px; padding: 10px 14px 10px 10px; border: 2px solid var(--ink-border); border-radius: 12px; background: var(--white); box-shadow: 3px 3px 0 var(--ink-shadow); color: var(--ink); text-decoration: none; scroll-snap-align: start; }
.market-wanted-item img, .market-wanted-item i { grid-row: 1 / 4; width: 44px; height: 44px; object-fit: cover; border: 2px solid var(--ink-border); border-radius: 7px; box-shadow: 2px 2px 0 var(--rarity-color, #75818f); }
.market-wanted-item i { display: grid; place-items: center; background: var(--bg-subtle); font-style: normal; font-weight: 1000; }
.market-wanted-item span { max-width: 180px; overflow: hidden; font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.market-wanted-item strong { font: 850 .82rem var(--mono); }
.market-wanted-item small { width: fit-content; padding: 1px 7px; border-radius: 99px; background: var(--bg-subtle); font-size: .68rem; font-weight: 850; }
.market-wanted-item.is-sell { background: var(--up-bg); }
.market-wanted-item.is-sell small { background: var(--up); color: #fff; }
.market-wanted-item.is-mine small { background: var(--tint-yellow); color: #7a5a00; }
.market-wanted-item:hover, .market-wanted-item:focus-visible { box-shadow: 5px 5px 0 var(--ink-shadow); transform: translate(-2px, -2px); outline: none; }
.market-mine-list { display: flex; gap: 14px; overflow-x: auto; padding: 2px 6px 10px 2px; scroll-snap-type: x proximity; }
.market-mine-item { flex: 0 0 auto; display: grid; grid-template-columns: 44px auto; column-gap: 10px; align-items: center; min-width: 210px; padding: 10px 14px 10px 10px; border: 2px solid var(--ink-border); border-radius: 12px; background: var(--white); box-shadow: 3px 3px 0 var(--ink-shadow); color: var(--ink); text-decoration: none; scroll-snap-align: start; }
.market-mine-item img { grid-row: 1 / 4; width: 44px; height: 44px; object-fit: cover; border: 2px solid var(--ink-border); border-radius: 7px; }
.market-mine-item span { max-width: 180px; overflow: hidden; font-size: .78rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.market-mine-item strong { font: 850 .82rem var(--mono); }
.market-mine-item small { width: fit-content; padding: 1px 7px; border-radius: 99px; font-size: .68rem; font-weight: 850; }
.market-mine-item.is-lowest small, .market-mine-item.is-alone small { background: var(--up-bg); color: var(--up); }
.market-mine-item.is-tied small { background: var(--tint-yellow); color: #7a5a00; }
.market-mine-item.is-undercut small { background: var(--down-bg); color: var(--down); }
.market-mine-item:hover, .market-mine-item:focus-visible { box-shadow: 5px 5px 0 var(--ink-shadow); transform: translate(-2px, -2px); outline: none; }
/* Taking offers off sale: the heading carries the controls, each offer a box to tick. */
.market-mine-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.market-mine .market-mine-head h3 { margin: 0 auto 0 0; }
.market-mine-head button { min-height: 32px; padding: 4px 12px; border: 2px solid var(--ink-border); border-radius: 9px; background: var(--white); box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .74rem; font-weight: 900; cursor: pointer; }
.market-mine-head button[hidden] { display: none; }
.market-mine-head button.is-danger { background: var(--down-bg); color: var(--down); }
.market-mine-head button:disabled { box-shadow: none; opacity: .6; cursor: default; }
.market-mine-head button:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 2px; }
.market-mine-list.is-picking .market-mine-item { grid-template-columns: auto 44px auto; cursor: pointer; }
.market-mine-list.is-picking .market-mine-item img { grid-row: 1 / 4; grid-column: 2; }
.market-mine-list.is-picking .market-mine-item input { grid-row: 1 / 4; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.market-mine-list.is-picking .market-mine-item:has(input:checked) { background: var(--tint-yellow); }
.market-mine-list.is-picking .market-mine-item:focus-within { outline: 3px solid #ff5d8f; outline-offset: 2px; }

/* Filters: one open panel where there is room, a folded one on a phone. */
.market-browser { align-items: end; }
/* Clear filters sits beside the search box, the filters on the row below. */
.market-browser > [data-browse-reset] { order: 1; }
.market-browser .card-browser-filters { order: 2; flex: 1 1 100%; }
.market-browser .card-browser-filters > summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: 9px 14px; border: 2px solid var(--ink-border); border-radius: 8px; background: var(--white); box-shadow: 3px 3px 0 var(--ink-shadow); font-size: .8rem; font-weight: 850; list-style: none; cursor: pointer; }
.market-browser .card-browser-filters > summary::-webkit-details-marker { display: none; }
.market-browser .card-browser-filters[open]:not([data-browse-pinned]) > summary { margin-bottom: 12px; }
.market-browser .card-browser-filters[data-browse-pinned] > summary { display: none; }
.market-browser .card-browser-filter-panel { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.market-browser .card-browser-filter-panel > label { flex: 1 1 150px; }
.market-browser .card-browser-filter-panel > [data-browse-sort] { flex: 0 1 280px; }
.market-browser .card-browser-price { display: flex; flex: 1 1 220px; gap: 8px; }
.market-browser .card-browser-price label { flex: 1 1 0; min-width: 0; }
.market-browser .card-browser-price input { font-variant-numeric: tabular-nums; }
.market-browser .card-browser-filter-panel > .card-browser-toggle { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 2px solid var(--ink-border); border-radius: 7px; background: var(--white); cursor: pointer; }
.market-browser .card-browser-toggle input { width: 18px; min-height: 0; height: 18px; margin: 0; padding: 0; accent-color: #ff5d8f; }
.market-browser .card-browser-toggle:has(input:checked) { background: var(--tint-yellow); box-shadow: 3px 3px 0 var(--ink-shadow); }
.market-browser > button[data-browse-reset] { align-self: end; }
.market-card-count { margin: 4px 0 18px; color: var(--muted); font-size: .8rem; font-weight: 850; letter-spacing: .04em; }

/* The floor: one tile per card, its cheapest offer and where its price is going. */
.card-market .card-market-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr)); gap: 34px 26px; align-items: stretch; }
.market-tile { position: relative; display: grid; grid-template-rows: auto 1fr; min-width: 0; animation: market-tile-in .45s cubic-bezier(.2, .8, .2, 1) backwards; animation-delay: calc(var(--tile-index, 0) * 28ms); }
@keyframes market-tile-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.market-tile-card { display: block; position: relative; z-index: 1; margin: 0 8px 18px; color: inherit; text-decoration: none; transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.market-tile-card .trading-card { width: 100%; }
.market-tile-card:hover, .market-tile-card:focus-visible { transform: translateY(-6px) rotate(-1.2deg); outline: none; }
.market-tile-card:focus-visible .trading-card { outline: 3px solid #ff5d8f; outline-offset: 4px; }
/* A column whose button sits at the bottom, level with its neighbours'. */
.market-plate { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 14px 14px; border: 3px solid var(--ink-border); border-radius: 14px; background: var(--white); box-shadow: 5px 5px 0 var(--ink-shadow); }
.market-plate::before { content: ''; position: absolute; inset: 0 0 auto; height: 8px; border-radius: 11px 11px 0 0; background: var(--rarity-color, #75818f); }
.market-plate-quote { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.market-plate-price { display: flex; align-items: baseline; gap: 5px; margin: 0; }
.market-plate-price strong { font-size: 1.7rem; font-weight: 950; line-height: 1; font-variant-numeric: tabular-nums; }
.market-plate-price small { color: var(--muted); font-size: .68rem; font-weight: 800; }
.market-plate-meta { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 750; }
.market-plate button, .market-quick-manage { width: 100%; margin-top: auto; padding: 10px 12px; border: 3px solid var(--ink-border); border-radius: 9px; background: var(--buy); box-shadow: 3px 3px 0 var(--ink-shadow); color: var(--ink); font-size: .78rem; font-weight: 900; text-align: center; text-decoration: none; cursor: pointer; transition: transform .1s ease, box-shadow .1s ease; }
.market-plate button:hover:not(:disabled), .market-quick-manage:hover { box-shadow: 1px 1px 0 var(--ink-shadow); transform: translate(2px, 2px); }
.market-plate button:disabled { background: var(--bg-subtle); box-shadow: none; opacity: .75; cursor: default; }
.market-plate button:focus-visible, .market-quick-manage:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 3px; }
.market-quick-manage { background: var(--tint-yellow); }
.market-tile.is-deal .market-plate { background: linear-gradient(180deg, var(--tint-green), var(--white) 55%); }

.market-spark { display: block; width: 100%; height: 34px; overflow: visible; animation: market-spark-in 1s cubic-bezier(.3, .7, .2, 1) backwards; animation-delay: calc(var(--tile-index, 0) * 28ms + .15s); }
@keyframes market-spark-in { from { clip-path: inset(-20% 100% -20% 0); } to { clip-path: inset(-20% -10% -20% 0); } }
.market-spark.is-empty { border-bottom: 2px dashed #d7d1dd; height: 18px; margin-bottom: 16px; animation: none; }
.market-spark-line { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
@keyframes market-draw { from { stroke-dashoffset: 1; } }
.market-spark-area { fill: #25252d14; stroke: none; }
.market-spark circle { fill: var(--white); stroke: var(--ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.market-spark.is-up .market-spark-area { fill: #7bd88f55; }
.market-spark.is-up circle { fill: var(--up-bright); }
.market-spark.is-down .market-spark-area { fill: #ff7a9340; }
.market-spark.is-down circle { fill: var(--down-bright); }

/* Stickers and flags: a row of their own at the top of the price plate. */
.market-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: -4px; }
.market-sticker { display: inline-flex; align-items: center; padding: 2px 9px; border: 2px solid var(--ink-border); border-radius: 7px; box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .74rem; font-weight: 1000; letter-spacing: .03em; }
.market-sticker.is-deal { background: var(--up-bright); animation: market-sticker-glow 2.4s ease-in-out infinite; }
.market-sticker.is-hot { background: #ff9f5a; }
.market-sticker.is-new { background: var(--pastel-yellow); }
@keyframes market-sticker-glow { 50% { box-shadow: 2px 2px 0 var(--ink-shadow), 0 0 0 4px #7bd88f66; } }
.market-flag { display: inline-flex; align-items: center; padding: 2px 8px; border: 2px solid var(--ink-border); border-radius: 99px; background: var(--white); box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .68rem; font-weight: 900; }
.market-flag.is-wished { background: var(--pastel-yellow); }
.market-flag.is-missing { background: #ff5d8f; color: #fff; }
.market-flag.is-owned { background: var(--tint-blue); }

/* The sheet: one card's corner of the market. */
.market-sheet { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 32px 20px; border: 0; background: transparent; color: var(--ink); overflow: auto; overscroll-behavior: contain; }
.market-sheet::backdrop { background: rgb(37 37 45 / .62); backdrop-filter: blur(3px); }
html:has(.market-sheet[open]) { overflow: hidden; }
.market-sheet-frame { position: relative; display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 34px; width: min(1120px, 100%); margin: 0 auto; padding: 34px; border: 3px solid var(--ink-border); border-radius: 22px; background: var(--sheet-paper); box-shadow: 10px 10px 0 var(--ink-shadow); animation: market-sheet-in .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes market-sheet-in { from { opacity: 0; transform: translateY(26px) scale(.98); } }
.market-sheet-close { position: absolute; inset: 14px 14px auto auto; z-index: 3; width: 44px; height: 44px; border: 3px solid var(--ink-border); border-radius: 50%; background: var(--white); box-shadow: 3px 3px 0 var(--ink-shadow); color: var(--ink); font-size: 1.5rem; font-weight: 900; line-height: 1; cursor: pointer; }
.market-sheet-close:hover { transform: rotate(90deg); transition: transform .2s ease; }
.market-sheet-close:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 3px; }
.market-sheet-showcase { align-self: start; position: sticky; top: 0; display: grid; justify-items: center; padding: 22px 18px 30px; border: 3px solid var(--ink-border); border-radius: 18px; background: radial-gradient(circle at 50% 30%, var(--white) 0, #fff0 60%), repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rarity-color, #75818f) 16%, var(--sheet-paper)) 0 10deg, var(--sheet-paper) 10deg 20deg); overflow: hidden; }
.market-sheet-card { width: 100%; }
.market-sheet-card .card-tilt-stage { width: 100%; }
.market-sheet-card .trading-card { width: 100%; }
.market-sheet-card .card-inspector-details { display: none; }
.market-sheet-card.is-unknown { display: grid; place-items: center; aspect-ratio: 4 / 7; border: 3px dashed #8c8794; border-radius: 12px; color: var(--text-muted); font-size: 4rem; font-weight: 1000; }
.market-sheet-body { display: grid; align-content: start; gap: 22px; min-width: 0; }
.market-sheet-head { padding-right: 50px; }
.market-sheet-kicker { margin: 0 0 6px; color: var(--muted); font-size: .74rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.market-sheet-head h2 { margin: 0 0 12px; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1; overflow-wrap: anywhere; }
.market-sheet-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.market-sheet-rarity { padding: 4px 10px; border: 2px solid var(--ink-border); border-radius: 7px; background: var(--rarity-color, #75818f); color: #fff; font-size: .7rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.market-sheet-wish { min-height: 32px; padding: 4px 12px; border: 2px solid var(--ink-border); border-radius: 99px; background: var(--white); box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .74rem; font-weight: 900; cursor: pointer; }
.market-sheet-wish[aria-pressed="true"] { background: var(--pastel-yellow); }
.market-sheet-wish:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 3px; }
.market-sheet-quote { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 3px solid var(--ink-border); border-radius: 14px; background: var(--white); box-shadow: 5px 5px 0 var(--ink-shadow); }
.market-sheet-quote > div { display: grid; align-content: start; gap: 3px; min-width: 0; padding: 14px 16px; border-left: 2px solid #ece6f1; }
.market-sheet-quote > div:first-child { border-left: 0; background: var(--tint-yellow); }
.market-sheet-quote span { color: var(--muted); font-size: .66rem; font-weight: 950; letter-spacing: .1em; text-transform: uppercase; }
.market-sheet-quote strong { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 950; line-height: 1.05; font-variant-numeric: tabular-nums; }
.market-sheet-quote small { color: var(--muted); font-size: .7rem; font-weight: 750; }
.market-sheet-quote .market-change { width: fit-content; }
.market-sheet-deal { margin: -8px 0 0; padding: 10px 14px; border: 2px solid var(--ink-border); border-radius: 10px; background: var(--up-bg); color: var(--up); font-size: .82rem; font-weight: 850; }
.market-sheet h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: .8rem; font-weight: 1000; letter-spacing: .16em; text-transform: uppercase; }
.market-sheet h3 span { padding: 1px 8px; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-size: .7rem; letter-spacing: 0; }

/* The price chart. */
.market-chart { padding: 18px 18px 14px; border: 3px solid var(--ink-border); border-radius: 14px; background: var(--white); box-shadow: 5px 5px 0 var(--ink-shadow); }
.market-chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.market-chart-head h3 { margin: 0; }
.market-chart-ranges { display: flex; overflow: hidden; border: 2px solid var(--ink-border); border-radius: 9px; }
.market-chart-ranges button { min-width: 44px; min-height: 32px; padding: 4px 10px; border: 0; border-left: 2px solid var(--ink-border); background: var(--white); color: var(--ink); font: 850 .72rem var(--mono); cursor: pointer; }
.market-chart-ranges button:first-child { border-left: 0; }
.market-chart-ranges button[aria-pressed="true"] { background: #2d2d2d; color: #ffe76b; }
.market-chart-ranges button:focus-visible { outline: 3px solid #ff5d8f; outline-offset: -3px; }
.market-chart-plot { position: relative; border-radius: 8px; }
.market-chart-plot:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 4px; }
.market-chart-svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.market-chart-tick line { stroke: #ece6f1; stroke-width: 1; }
.market-chart-tick text, .market-chart-date { fill: var(--muted); font: 700 11px var(--mono); }
.market-chart-area { fill: url(#marketChartFill); }
.market-chart-fill-top { stop-color: #7bd88f; stop-opacity: .45; }
.market-chart-fill-bottom { stop-color: #7bd88f; stop-opacity: 0; }
.market-chart-svg.is-down .market-chart-fill-top, .market-chart-svg.is-down .market-chart-fill-bottom { stop-color: #ff7a93; }
.market-chart-line { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; animation: market-draw 1.2s cubic-bezier(.3, .7, .2, 1) backwards; }
.market-chart-hold { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 3 5; opacity: .45; }
.market-chart-floor line { stroke: #ff5d8f; stroke-width: 2; stroke-dasharray: 7 5; }
.market-chart-floor text { fill: #c2185b; font: 850 11px var(--mono); paint-order: stroke; stroke: #fff; stroke-width: 4px; }
.market-chart-cursor { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 4; opacity: 0; }
.market-chart-cursor.is-shown { opacity: .7; }
.market-chart-point { fill: var(--white); stroke: var(--ink); stroke-width: 2.4; transform-box: fill-box; transform-origin: center; transition: transform .12s ease; animation: market-point-in .4s cubic-bezier(.2, .8, .2, 1.4) backwards; animation-delay: calc(.35s + var(--point-index, 0) * 18ms); }
@keyframes market-point-in { from { transform: scale(0); } }
.market-chart-point.is-active { transform: scale(1.6); }
.market-chart-point.finish-foil { fill: url(#marketFoilPoint); }
.market-chart-point.finish-prismatic { fill: url(#marketPrismaticPoint); }
.market-chart-point.finish-negative { fill: var(--ink); stroke: #fff9e9; }
.market-chart-point.finish-misprint { fill: #c79bff; }
.market-chart-point.finish-signed { fill: #ffd166; }
.market-chart-tip { position: absolute; left: var(--tip-x); top: var(--tip-y); z-index: 2; display: grid; gap: 2px; min-width: 150px; padding: 8px 11px; border: 2px solid var(--ink-border); border-radius: 9px; background: #2d2d2d; color: #fff9e9; box-shadow: 3px 3px 0 #ff5d8f; font-size: .72rem; font-weight: 750; transform: translate(14px, -50%); pointer-events: none; }
.market-chart-tip.is-left { transform: translate(calc(-100% - 14px), -50%); }
.market-chart-tip strong { color: #ffe76b; font: 900 .9rem var(--mono); }
.market-chart-tip time { color: #c9c3d3; font-size: .68rem; }
.market-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .7rem; font-weight: 800; }
.market-chart-legend li { display: flex; align-items: center; gap: 6px; }
.market-chart-legend i { width: 11px; height: 11px; border: 2px solid var(--ink-border); border-radius: 50%; background: var(--white); }
.market-chart-legend i.finish-foil { background: linear-gradient(135deg, var(--pastel-blue), var(--tint-pink), var(--pastel-yellow)); }
.market-chart-legend i.finish-prismatic { background: linear-gradient(90deg, #ff5d8f, var(--pastel-yellow), #7bd88f, #8d55ef); }
.market-chart-legend i.finish-negative { background: var(--ink); }
.market-chart-legend i.finish-misprint { background: #c79bff; }
.market-chart-legend i.finish-signed { background: var(--pastel-yellow); }
.market-chart-empty { margin: 8px 0; padding: 26px 16px; border: 2px dashed #cfc7d8; border-radius: 10px; color: var(--muted); font-weight: 800; text-align: center; }

/* The order book: every offer, cheapest first, with its depth drawn behind it. */
.market-book ol, .market-sales ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.market-book-row { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr) auto; grid-template-areas: "price copy action" "price seller action"; align-items: center; column-gap: 14px; padding: 10px 12px; overflow: hidden; border: 2px solid var(--ink-border); border-radius: 10px; background: var(--white); }
.market-book-row::before { content: ''; position: absolute; inset: 0 auto 0 0; z-index: -1; width: var(--depth); background: color-mix(in srgb, var(--buy) 22%, transparent); }
.market-book-row.is-floor { box-shadow: 3px 3px 0 var(--ink-shadow); }
.market-book-row.is-floor::before { background: #7bd88f40; }
.market-book-row.is-mine { border-style: dashed; background: var(--tint-yellow); }
.market-book-price { grid-area: price; font-size: .74rem; font-weight: 750; color: var(--muted); }
.market-book-price strong { display: block; color: var(--ink); font: 950 1.3rem var(--mono); }
.market-book-copy { grid-area: copy; min-width: 0; font-size: .8rem; font-weight: 850; }
.market-book-copy .card-preview-button { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.market-book-seller { grid-area: seller; min-width: 0; overflow: hidden; color: var(--muted); font-size: .74rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.market-book-seller a { color: inherit; font-weight: 850; }
.market-book-row button, .market-book-manage { grid-area: action; padding: 9px 12px; border: 2px solid var(--ink-border); border-radius: 8px; background: var(--buy); box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .74rem; font-weight: 900; text-decoration: none; white-space: nowrap; cursor: pointer; }
.market-book-row button:disabled { background: var(--bg-subtle); box-shadow: none; opacity: .75; cursor: default; }
.market-book-manage { background: var(--tint-yellow); }
.market-book-row button:focus-visible, .market-book-manage:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 2px; }
/* Bids, under the offers: what collectors would pay for any copy, highest first. */
.market-bid-row { grid-template-columns: minmax(96px, auto) minmax(0, 1fr); grid-template-areas: "price seller" "price asks"; }
.market-bid-row::before { background: #ffd6f538; }
.market-bid-row.is-top { box-shadow: 3px 3px 0 var(--ink-shadow); }
.market-bid-row.is-top::before { background: #ffd6f5a0; }
.market-bid-form { display: grid; gap: 6px; margin-top: 12px; }
.market-bid-form label { font-size: .74rem; font-weight: 900; }
.market-bid-controls { display: flex; flex-wrap: wrap; gap: 8px; }
.market-bid-controls input { flex: 1 1 120px; min-width: 0; min-height: 40px; padding: 6px 10px; border: 2px solid var(--ink-border); border-radius: 8px; background: var(--white); color: var(--ink); font: 850 1rem var(--mono); }
.market-bid-controls button, .market-bid-sign-in { padding: 9px 14px; border: 2px solid var(--ink-border); border-radius: 8px; background: #ffd6f5; box-shadow: 2px 2px 0 var(--ink-shadow); color: var(--ink); font-size: .74rem; font-weight: 900; text-decoration: none; white-space: nowrap; cursor: pointer; }
.market-bid-controls .market-bid-withdraw { background: var(--white); }
.market-bid-asks { grid-area: asks; font-size: .7rem; font-weight: 800; opacity: .75; }
.market-bid-conditions { border: 2px solid var(--ink-border); border-radius: 8px; background: var(--white); }
.market-bid-conditions summary { padding: 7px 10px; font-size: .74rem; font-weight: 900; cursor: pointer; }
.market-bid-condition-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; padding: 0 10px 10px; }
.market-bid-condition-grid label { display: grid; gap: 3px; font-size: .7rem; font-weight: 850; }
.market-bid-condition-grid select, .market-bid-condition-grid input { min-width: 0; min-height: 34px; padding: 4px 8px; border: 2px solid var(--ink-border); border-radius: 6px; background: var(--white); color: var(--ink); font: 800 .8rem var(--mono); }
.market-bid-conditions summary:focus-visible, .market-bid-condition-grid select:focus-visible, .market-bid-condition-grid input:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 2px; }
.market-bid-controls button:disabled { box-shadow: none; opacity: .7; cursor: default; }
.market-bid-controls input:focus-visible, .market-bid-controls button:focus-visible, .market-bid-sign-in:focus-visible { outline: 3px solid #ff5d8f; outline-offset: 2px; }
.market-bid-sign-in { display: inline-block; width: fit-content; margin-top: 12px; }
.market-bid-hint { margin: 0; color: var(--muted); font-size: .72rem; font-weight: 700; }
.market-sales li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 8px 12px; border-bottom: 2px solid #ece6f1; font-size: .78rem; font-weight: 750; }
.market-sales li strong { font: 950 1rem var(--mono); }
.market-sales li time { color: var(--muted); font-size: .72rem; white-space: nowrap; }
.market-sheet .card-holders { margin: 0; }
.market-sheet .market-empty { padding: 18px; font-size: .86rem; }

.motion-reduced .market-tile, .motion-reduced .market-spark, .motion-reduced .market-chart-line,
.motion-reduced .market-chart-point, .motion-reduced .market-sheet-frame, .motion-reduced .market-sticker { animation: none; }
.motion-reduced .market-tile-card, .motion-reduced .market-mover, .motion-reduced .market-chart-point { transition: none; }

@media (max-width: 960px) {
    .market-pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .market-sheet-frame { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 26px 20px; }
    .market-sheet-showcase { position: relative; justify-self: center; width: min(100%, 360px); }
}
@media (max-width: 860px) {
    .market-browser .card-browser-filter-panel > label { flex: 1 1 calc(50% - 12px); }
    .market-browser .card-browser-price { flex: 1 1 100%; }
}
@media (max-width: 600px) {
    .market-tape-item { padding: 10px 14px; }
    .market-stat { padding: 12px 13px; }
    .card-market .card-market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
    .market-tile-card { margin: 0 4px 14px; }
    .market-plate { padding: 18px 10px 10px; gap: 6px; }
    .market-plate-quote { flex-wrap: wrap; }
    .market-plate-price strong { font-size: 1.3rem; }
    .market-plate button, .market-quick-manage { padding: 8px 6px; font-size: .68rem; }
    .market-sticker { font-size: .68rem; padding: 1px 7px; }
    .market-sheet { padding: 0; }
    .market-sheet-frame { min-height: 100%; padding: 58px 16px 28px; border: 0; border-radius: 0; box-shadow: none; }
    .market-sheet-showcase { width: 100%; padding: 16px 12px 22px; }
    .market-sheet-card { width: min(58vw, 220px); }
    .market-sheet-quote { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .market-sheet-quote > div:nth-child(3) { border-left: 0; }
    .market-sheet-quote > div:nth-child(n + 3) { border-top: 2px solid #ece6f1; }
    .market-chart { padding: 14px 10px 10px; }
    .market-book-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "price action" "copy copy" "seller seller"; row-gap: 4px; }
    .market-bid-row { grid-template-columns: minmax(0, 1fr); grid-template-areas: "price" "seller"; }
    .market-sales li { grid-template-columns: 52px minmax(0, 1fr) auto; }
    .market-sales li .market-change { display: none; }
}
