/* Dark only, Anthropic-style warm greys with the clay accent. */
:root {
  color-scheme: dark;
  --page: #141413;
  --surface: #1a1a19;
  --surface-raised: #262624;
  --text-primary: #faf9f5;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #3d3d3a;
  --border: rgba(250, 249, 245, 0.10);
  --accent: #d97757;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --volume-listed: #5a5955;
  --critical: #d03b3b;
  --good-text: #0ca30c;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header, main { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main { padding-bottom: 40px; }
header { padding-top: 20px; }
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { text-decoration: none; }
.brand:hover h1 { color: var(--accent); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 22px; margin: 12px 0 4px; }
h3 { font-size: 15px; margin: 24px 0 8px; }
.card h3 { margin-top: 0; }
.server { color: var(--text-muted); font-weight: 400; margin-left: 6px; }

nav { display: flex; gap: 4px; }
.tab {
  padding: 6px 14px; border-radius: 6px; text-decoration: none;
  color: var(--text-secondary); border: 1px solid transparent;
}
.tab.active { color: var(--text-primary); background: var(--surface); border-color: var(--accent); }
h1 { color: var(--text-primary); }
h1::before { content: "✺ "; color: var(--accent); }
button[type="submit"] { background: var(--accent); border-color: var(--accent); color: #141413; font-weight: 600; }
button[type="submit"]:hover { background: #e08a6d; }
a { color: var(--accent); }

.status { color: var(--text-muted); margin: 8px 0 16px; font-size: 13px; }
.status.warn { color: var(--text-primary); border-left: 3px solid var(--critical); padding-left: 8px; }
.status.warn::before { content: "⚠ "; }
.error { border-left: 3px solid var(--critical); padding: 8px 12px; background: var(--surface); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-bottom: 12px; }
.variants { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.variants .chips { margin-bottom: 0; }
.chips button:disabled { opacity: 0.4; cursor: default; }
.chips button[aria-disabled="true"] { opacity: 0.55; border-style: dashed; color: var(--text-muted); cursor: pointer; }
.variant-note { margin: 6px 0 0; }
.variant-note:empty { display: none; }
.chip-count { color: var(--text-muted); margin-left: 4px; }
.variants a { color: var(--accent); font-size: 12px; text-decoration: none; }
.variants a:hover, .variants a:focus-visible { text-decoration: underline; }
.chip-group { display: contents; }
.chip-heading { color: var(--text-muted); font-size: 12px; margin: 0 2px 0 8px; }
.chips button { font-size: 12px; padding: 3px 9px; border-radius: 999px; color: var(--text-secondary); }
.chips button[aria-pressed="true"] { color: var(--text-primary); border-color: var(--accent); background: rgba(217, 119, 87, 0.18); }
.filters label { color: var(--text-secondary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
input, select, button {
  font: inherit; color: var(--text-primary); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px;
}
#q { flex: 0 1 220px; width: 220px; min-width: 0; }
input[type="number"] { width: 110px; }
button { cursor: pointer; }
button:hover { background: var(--surface-raised); }

.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--grid); }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.sort-button {
  font: inherit; font-weight: inherit; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer; white-space: nowrap;
}
.sort-button:hover { color: var(--text-primary); background: none; }
.sort-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
th[aria-sort] { color: var(--text-primary); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable:focus td { background: var(--surface-raised); }
td.item span { vertical-align: middle; }
td.item img { vertical-align: middle; margin-right: 8px; }
.tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.tag.good { color: var(--good-text); border-color: var(--good-text); }
.note { color: var(--text-muted); font-size: 12px; margin: 2px 0 0; }
.ladder td .note { white-space: nowrap; }

.empty { color: var(--text-muted); padding: 16px 4px; }
.back { color: var(--text-secondary); text-decoration: none; }
.summary { color: var(--text-secondary); margin: 0 0 8px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap;
  border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface);
}
.badge.up, .badge.down { color: var(--text-primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 16px; }
.card table { border: 0; }
.ranges { display: flex; gap: 4px; margin-bottom: 8px; }
.ranges button.active { background: var(--surface-raised); border-color: var(--axis); font-weight: 600; }
.chart-box { position: relative; height: 420px; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--text-secondary); padding: 4px 0; }

/* Market attributes stay in fixed, readable columns. */
.quality[data-quality="Super"] { color: #efc76a; border-color: #79612e; }
.quality[data-quality="Elite"] { color: #ccabff; border-color: #655080; }
.quality[data-quality="Unique"] { color: #8ac4ff; border-color: #3d6188; }
.quality[data-quality="Refined"] { color: #80d7bd; border-color: #3c7363; }
.quality[data-quality="Normal"] { color: #c3c2b7; }
.composition { min-width: 36px; text-align: center; font-weight: 600; }
.composition.enhanced { color: #efc76a; background: #302819; border-color: #79612e; }
.socket-count { white-space: nowrap; color: var(--text-muted); }
.socket-count.socketed { color: #80d7bd; font-weight: 600; }
.filter-menu { position: relative; margin: 0; flex: 0 0 112px; min-width: 0; }
#category-filter { flex-basis: 132px; }
#type-filter { flex-basis: 148px; }
.filter-menu summary { border: 1px solid var(--border); border-radius: 6px; position: relative; padding: 7px 28px 7px 10px; background: var(--surface); list-style: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-menu summary::-webkit-details-marker { display: none; }
.filter-menu summary::after { content: '⌄'; position: absolute; right: 10px; color: var(--text-muted); }
.filter-menu.selected summary { border-color: var(--accent); color: var(--text-primary); }
.filter-menu summary:hover { background: var(--surface-raised); }
.filter-menu summary:focus-visible, .filter-options button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; width: 240px; padding: 8px; background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; box-shadow: 0 12px 30px #0008; }
.filter-panel input { width: 100%; margin-bottom: 6px; }
.filter-options { max-height: none; overflow: visible; }
.filter-options button { display: block; width: 100%; text-align: left; border: 0; }
.filter-options button[aria-pressed="true"] { color: var(--accent); background: var(--surface-raised); }
.filter-clear { width: 100%; margin-top: 6px; color: var(--text-secondary); }
.filter-options button[aria-pressed="true"]::before { content: '✓ '; }
.filter-options button[data-value=""]::before { content: none; }
.stock-toggle { flex: 0 0 auto; padding: 7px 10px; border-radius: 6px; color: var(--text-secondary); }
.stock-toggle[aria-pressed="true"] { color: var(--text-primary); border-color: var(--accent); background: rgba(217, 119, 87, 0.18); }
td.item { white-space: nowrap; }
.group-mode #results-table th:last-child, .group-mode #results-table td:last-child { display: none; }
.group-detail #history-body td:nth-child(3), .group-detail #history-body td:nth-child(6), .group-detail #history-body td:nth-child(7),
.group-detail #history-panel th:nth-child(3), .group-detail #history-panel th:nth-child(6), .group-detail #history-panel th:nth-child(7) { display: none; }
#group-members { margin: 12px 0; }
#group-member-list { display: flex; gap: 8px 16px; flex-wrap: wrap; padding: 8px 0; }
[hidden] { display: none !important; }

/* Reserve the Reset slot so selecting a filter cannot wrap the row. */
#reset-filters[hidden] { display: block !important; visibility: hidden; }

.toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 6px 12px; border-radius: 6px; font-size: 13px;
  background: var(--surface-raised); color: var(--text-muted); border: 1px solid var(--border);
  pointer-events: none; z-index: 10;
}
.locate-button { white-space: nowrap; color: var(--accent); }
.locate-button:disabled { cursor: default; color: var(--text-muted); }
.market-map { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-raised); }
.market-map img { display: block; width: 100%; height: 100%; }
.map-marker { position: absolute; width: 20px; height: 20px; transform: translate(-50%, -50%); border: 3px solid white; border-radius: 50%; background: #ef5350; box-shadow: 0 0 0 7px #ef535050, 0 0 18px #ef5350; }

#booth-tooltip { position: fixed; z-index: 100; width: min(280px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; padding: 12px; background: var(--surface); border: 1px solid var(--axis); border-radius: 10px; box-shadow: 0 8px 24px #0008; }
#booth-tooltip .market-map { margin-top: 8px; }
#booth-details { margin: 8px 0 0; font-size: 12px; line-height: 1.6; }


.product-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.product-panels .card { min-width: 0; }
.history-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.history-pagination span { font-size: 12px; color: var(--text-secondary); }
.history-pagination button:disabled { opacity: .4; cursor: default; }
@media (max-width: 1000px) { .product-panels { grid-template-columns: minmax(0, 1fr); } }

.product-panels th, .product-panels td { padding: 8px; font-size: 12px; }
#history-body td:first-child { white-space: pre; }

/* Type page grid: row tint in the quality colour, faded empty cells, picked cell outlined. */
.price-grid .group-head th { text-align: center; border-bottom: 1px solid var(--border); }
.price-grid .sep { border-left: 1px solid var(--border); }
.price-grid .quality-filter { font-size: 14px; padding: 3px 10px; }
.price-grid td.empty-cell { color: var(--grid); }
.price-grid td small { color: var(--text-muted); margin-left: 6px; font-size: 11px; font-weight: 400; }
.price-grid td.hit { font-weight: 600; cursor: pointer; }
.price-grid td.hit:hover, .price-grid td.hit:focus-visible { outline: 1px solid var(--axis); }
.price-grid td.picked { outline: 2px solid var(--accent); }
.price-grid tr[data-q="Super"] td.hit { color: #efc76a; background: rgba(239, 199, 106, 0.10); }
.price-grid tr[data-q="Elite"] td.hit { color: #ccabff; background: rgba(204, 171, 255, 0.10); }
.price-grid tr[data-q="Unique"] td.hit { color: #8ac4ff; background: rgba(138, 196, 255, 0.10); }
.price-grid tr[data-q="Refined"] td.hit { color: #80d7bd; background: rgba(128, 215, 189, 0.10); }
.price-grid tr[data-q="Normal"] td.hit { color: #c3c2b7; background: rgba(195, 194, 183, 0.08); }
.type-chart-box { height: 300px; }

/* Home: one clickable icon per item type, grouped by category. */
.type-strip { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.type-group-name { color: var(--text-secondary); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.type-tiles { display: flex; flex-wrap: wrap; gap: 4px; }
.type-tile { display: flex; flex-direction: column; align-items: center; width: 70px; padding: 6px 2px; border-radius: 8px;
  border: 1px solid transparent; color: var(--text-primary); text-decoration: none; font-size: 12px; text-align: center; line-height: 1.2; }
.type-tile img { width: 36px; height: 36px; object-fit: contain; margin-bottom: 4px; }
.type-tile:hover, .type-tile:focus-visible { background: var(--surface-raised); border-color: var(--axis); color: var(--text-primary); }
/* Product page: the type breadcrumb sits next to "Back to search". */
#product-type-link { margin-left: 16px; }

/* Type page: sales and recent asks behind a picked price that are no longer on the market. */
#type-gone { margin-top: 12px; }
.gone-title { margin: 0 0 6px; font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.gone-row td { color: var(--text-muted); }

/* Type grid: a quality badge is a button that lists every listing of that quality. */
.quality-filter { cursor: pointer; font: inherit; font-size: 12px; }
.quality-filter:hover, .quality-filter:focus-visible { outline: 1px solid var(--axis); }
.quality-filter[aria-pressed="true"] { outline: 2px solid var(--accent); }

/* Merchants: two leaderboards side by side on wide screens, stacked on narrow ones. */
.merchant-boards { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.merchant-boards .card { margin-bottom: 0; }

/* Type page: quality chips above Listed now dim while a grid price/quality pick overrides them. */
#type-show.overridden button { opacity: 0.45; }

/* A row that appeared on a live refresh glows briefly (patchRows); nothing else moves or blinks. */
@keyframes row-new { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
tr.row-new td { animation: row-new 2.5s ease-out; }
@media (prefers-reduced-motion: reduce) { tr.row-new td { animation: none; } }

/* Bundle page (Meteor + MeteorScroll): picture tiles, one coloured verdict, suggested-price chips.
   Parts of the generic type page that mean nothing for these items are hidden. */
#view-type.bundle-mode #type-grid-card, #view-type.bundle-mode #type-ladder-card,
#view-type.bundle-mode #type-badges { display: none; }
.bundle-hero { margin-bottom: 16px; }
.bundle-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.bundle-tile { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #e8a33d; border-radius: 8px; padding: 14px 16px; }
.bundle-tile.pack { border-left-color: var(--series-3); }
.bundle-name { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.bundle-name img { width: 40px; height: 40px; }
.bundle-price { font-size: 30px; font-weight: 700; margin: 8px 0 2px; color: #e8a33d; font-variant-numeric: tabular-nums; }
.bundle-tile.pack .bundle-price { color: var(--series-3); }
.bundle-per { font-size: 15px; color: var(--text-primary); }
.bundle-stats { margin-top: 6px; color: var(--text-muted); font-size: 12px; }
.bundle-verdict { margin: 12px 0 8px; padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.bundle-verdict.bundle { background: color-mix(in srgb, var(--series-3) 14%, transparent); border-color: var(--series-3); color: var(--text-primary); }
.bundle-verdict.singles { background: color-mix(in srgb, #e8a33d 14%, transparent); border-color: #e8a33d; color: var(--text-primary); }
.bundle-sell { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bundle-chip { padding: 4px 10px; border-radius: 999px; background: var(--surface-raised); color: var(--text-primary); font-size: 13px; }
.bundle-chip.muted { color: var(--text-muted); cursor: help; }
/* Bundle page: Quality (2nd) and Gems (7th) are always empty for Meteors / Dragon Balls. */
#view-type:not(.bundle-mode) #type-listings-table th:nth-child(4), #view-type:not(.bundle-mode) #type-listings-table td:nth-child(4) { display: none; }  /* per unit: bundle pages only */
#view-type.bundle-mode #type-listings-table th:nth-child(2), #view-type.bundle-mode #type-listings-table td:nth-child(2),
#view-type.bundle-mode #type-listings-table th:nth-child(7), #view-type.bundle-mode #type-listings-table td:nth-child(7) { display: none; }

/* Merchant page: name + My shop / alerts buttons, the booth map, undercut status. */
.merchant-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.merchant-head h2 { margin-right: 6px; }
#merchant-mine[aria-pressed="true"] { color: #efc76a; border-color: #79612e; }
.merchant-map-box { max-width: 320px; margin: 4px 0 16px; }
.merchant-map-box .market-map { position: relative; }
.merchant-map-box img { width: 100%; height: auto; border-radius: 8px; display: block; }
.tag.bad { color: var(--critical); border-color: var(--critical); }
button.tag.ref-toggle { background: none; font: inherit; font-size: 12px; cursor: pointer; }
.ref-note, .ref-detail { white-space: nowrap; }
.ref-detail { color: var(--text-secondary); }
@keyframes row-undercut { from { background: color-mix(in srgb, var(--critical) 30%, transparent); } to { background: transparent; } }
tr.row-undercut td { animation: row-undercut 3s ease-out; }
@media (prefers-reduced-motion: reduce) { tr.row-undercut td { animation: none; } }

/* Home: the Trend column stays hidden until some row has a 7-day trend. */
#results-table.no-trend .trend-col { display: none; }
/* Home rows whose cheapest ask is a deal (owner 2026-10-01). */
#results-body tr.deal-row td { background: rgba(110, 200, 140, 0.10); }
/* Site-wide tooltip (tooltip.js) replacing the browser's title tooltip. */
.tip { position: absolute; z-index: 1000; max-width: 420px; padding: 8px 10px; border-radius: 6px;
  background: var(--surface-raised); color: var(--text-primary); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45); font-size: 13px; line-height: 1.4; white-space: pre-line;
  pointer-events: none; }

/* Item watches and the shared notification inbox. */
.watch-bell { display: inline-flex; align-items: center; gap: 4px; padding: 5px; vertical-align: middle; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.watch-bell svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.watch-bell:hover, .watch-bell[aria-pressed="true"] { color: var(--accent); background: var(--surface-raised); }
#notification-count:not(:empty) { color: var(--accent); font-size: 12px; }
#notification-panel { position: fixed; z-index: 50; right: max(16px, calc((100vw - 1100px) / 2)); top: 64px; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 88px); overflow-y: auto; box-shadow: 0 12px 40px #0008; }
#notification-panel h3 { margin: 0; }
.notification-entry { display: grid; gap: 3px; padding: 12px 8px; border-bottom: 1px solid var(--border); color: var(--text-secondary); text-decoration: none; }
.notification-entry.unread { border-left: 3px solid var(--accent); }
.notification-entry small { color: var(--text-muted); }
.watch-entry { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; }
