:root {
  color-scheme: dark;
  --bg: oklch(12% 0.008 25);
  --surface: oklch(16% 0.009 25);
  --surface-subtle: oklch(20% 0.01 25);
  --ink: oklch(94% 0.004 25);
  --muted: oklch(70% 0.01 25);
  --line: oklch(28% 0.012 25);
  --line-strong: oklch(40% 0.016 25);
  --accent: oklch(64% 0.225 28);
  --accent-strong: oklch(70% 0.205 28);
  --accent-soft: oklch(21% 0.055 28);
  --up: oklch(74% 0.145 160);
  --up-soft: oklch(22% 0.035 160);
  --blue: oklch(72% 0.15 255);
  --radius: 0.45rem;
  --content: 76rem;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --z-dialog: 30;
  --z-toast: 40;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  min-width: 20rem;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--ink); font-size: 1rem; line-height: 1.5; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 0.16em; }
a:hover { text-decoration-color: currentColor; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 65%, white); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }

.skip-link { position: fixed; top: 0.75rem; left: 0.75rem; z-index: 100; padding: 0.55rem 0.7rem; background: var(--ink); color: var(--bg); font-weight: 800; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.app-shell { width: min(100% - 2rem, var(--content)); margin: 0 auto; padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }

.topbar {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
  border-bottom: 1px solid var(--line);
}

.brand { display: block; width: 11.9rem; height: 3.55rem; overflow: hidden; background: #050505; line-height: 0; text-decoration: none; }
.brand-lockup-image { display: block; width: 12.5rem; height: 3.55rem; object-fit: cover; object-position: left center; }

.time-tabs { display: inline-flex; justify-self: center; padding: 0.18rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.time-tabs button { min-height: 2.1rem; padding: 0.42rem 0.8rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 0.8rem; font-weight: 750; }
.time-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.demo-state { display: inline-flex; align-items: center; gap: 0.4rem; justify-self: end; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.site-nav { display: inline-flex; justify-self: end; gap: 1rem; margin-right: 0.25rem; color: var(--muted); font-size: 0.8rem; font-weight: 750; }
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.demo-state i, .market-status i { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--up); }

.claim-stage { padding: 2rem 0 1.35rem; }
.claim-panel { width: min(100%, 68rem); margin: 0 auto; text-align: left; }
.market-status { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem 1rem; margin: 0 0 1.2rem; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.market-status span { display: inline-flex; align-items: center; gap: 0.35rem; }
.market-status span + span::before { margin-right: 0.55rem; color: var(--line-strong); content: "·"; }
.market-status b { color: var(--ink); font-variant-numeric: tabular-nums; }
.market-status a { color: var(--blue); font-weight: 750; text-decoration: none; }

.claim-panel h1 { margin: 0; color: var(--ink); font-size: 2.75rem; font-weight: 850; letter-spacing: -0.035em; line-height: 1; text-align: center; text-wrap: balance; }
.claim-panel h1 span { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.claim-copy { max-width: 48ch; margin: 1rem auto 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }

.market-entry { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 0.75rem; align-items: stretch; margin-top: 1.35rem; }

.bid-console { display: grid; grid-template-columns: minmax(12rem, 1.5fr) minmax(8rem, 0.7fr) minmax(9rem, 0.65fr) auto; align-items: end; gap: 0.65rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface); text-align: left; }
.amount-control { grid-column: 3; grid-row: 1; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 2.6rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.amount-control > button, .dialog-stepper > button { min-height: 3rem; border: 0; background: var(--surface-subtle); color: var(--ink); font-size: 1.1rem; font-weight: 800; }
.amount-control > button:hover, .dialog-stepper > button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.amount-control label { display: grid; align-content: center; min-width: 0; padding: 0 0.55rem; border-inline: 1px solid var(--line); }
.amount-control label > span:first-child { display: none; }
.money-field { display: flex; align-items: center; min-width: 0; color: var(--ink); font-weight: 850; }
.money-field b { flex: 0 0 auto; }
.money-field input { width: 100%; min-width: 0; min-height: 2.9rem; padding: 0 0.15rem; border: 0; background: transparent; color: var(--ink); font-weight: 850; font-variant-numeric: tabular-nums; outline: 0; }

.field { display: grid; gap: 0.3rem; min-width: 0; color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.field-wide { grid-column: 1; grid-row: 1; }
.field:not(.field-wide) { grid-column: 2; grid-row: 1; }
.field input, .field select { width: 100%; min-height: 3rem; padding: 0.65rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 0.88rem; font-weight: 650; }
.field input::placeholder { color: var(--muted); }
.field input:hover, .field select:hover { border-color: var(--line-strong); }

.primary-action { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; padding: 0.65rem 1rem; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--accent); color: white; font-size: 0.86rem; font-weight: 850; line-height: 1.1; white-space: nowrap; transition: background 160ms var(--ease), transform 160ms var(--ease); }
.bid-console > .primary-action { grid-column: 4; grid-row: 1; }
.primary-action:hover { background: var(--accent-strong); }
.primary-action:active { transform: translateY(1px); }
.demo-note { grid-column: 1 / -1; margin: -0.05rem 0 0; color: var(--muted); font-size: 0.74rem; }

.bid-terms { padding: 0.85rem 0.9rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--surface-subtle); }
.bid-terms h2 { margin: 0 0 0.6rem; font-size: 0.88rem; }
.bid-terms dl { display: grid; gap: 0.48rem; margin: 0; }
.bid-terms dl div { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.45rem; }
.bid-terms dt { color: var(--ink); font-size: 0.7rem; font-weight: 800; }
.bid-terms dd { margin: 0; color: var(--muted); font-size: 0.69rem; line-height: 1.35; }
.bid-terms a { display: inline-block; margin-top: 0.65rem; color: var(--blue); font-size: 0.7rem; font-weight: 750; }

.category-market { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 0; border-block: 1px solid var(--line); }
.category-market h2 { flex: 0 0 auto; margin: 0; color: var(--muted); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.04em; text-transform: uppercase; }
.category-rail { display: flex; flex: 1 1 auto; gap: 0.25rem; overflow-x: auto; padding-bottom: 0.1rem; scrollbar-width: thin; }
.category-chip { flex: 0 0 auto; min-height: 2rem; padding: 0.35rem 0.6rem; border: 0; border-radius: 0.25rem; background: transparent; color: var(--muted); font-size: 0.78rem; font-weight: 720; white-space: nowrap; }
.category-chip:hover { background: var(--surface-subtle); color: var(--ink); }
.category-chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.board-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.4rem 0 0.7rem; }
.board-toolbar h2 { margin: 0; color: var(--ink); font-size: 1.15rem; font-weight: 850; }
.board-toolbar p { margin: 0; color: var(--muted); font-size: 0.76rem; text-align: right; }
.board-context { display: grid; justify-items: end; gap: 0.2rem; }
.measurement-note { position: relative; color: var(--muted); font-size: 0.7rem; text-align: right; }
.measurement-note summary { color: var(--blue); font-weight: 750; cursor: pointer; }
.measurement-note p { position: absolute; right: 0; z-index: 2; width: 21rem; margin-top: 0.4rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); line-height: 1.45; text-align: left; }
.top-three { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
.featured-listing { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.85rem 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.65rem; background: var(--surface); }
.featured-1 { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; padding: 1.15rem; border-color: oklch(48% 0.11 28); background: var(--accent-soft); }
.featured-rank { grid-column: 1 / -1; color: var(--muted); font-size: 0.7rem; font-weight: 850; letter-spacing: 0.05em; }
.featured-1 .featured-rank { color: var(--accent-strong); }
.featured-listing .product-cell { align-self: center; }
.featured-1 .product-name { font-size: 1.2rem; }
.featured-evidence { display: flex; justify-content: flex-end; gap: 1.2rem; }
.featured-metric { display: grid; gap: 0.15rem; min-width: 5rem; }
.featured-metric span { color: var(--muted); font-size: 0.67rem; font-weight: 700; }
.featured-metric strong { color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.featured-actions { display: flex; align-items: end; justify-content: flex-end; gap: 0.4rem; grid-column: 1 / -1; }
.featured-1 .featured-actions { grid-column: auto; }
.featured-actions .bid-button { flex: 0 1 auto; }
.board-header, .rank-row { display: grid; grid-template-columns: 3.25rem minmax(15rem, 1fr) minmax(6.5rem, 7.5rem) minmax(5.5rem, 6.5rem) minmax(9.5rem, 10.5rem); align-items: center; gap: 0.8rem; }
.board-header { min-height: 2.2rem; padding: 0 0.65rem; border: 1px solid var(--line); border-bottom: 0; background: var(--surface-subtle); color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.035em; text-transform: uppercase; }
.board-header span:nth-child(3), .board-header span:nth-child(4) { text-align: right; }
.board-list { border: 1px solid var(--line); background: var(--surface); }
.rank-row { min-height: 5.15rem; padding: 0.75rem 0.65rem; border-bottom: 1px solid var(--line); transition: background 160ms var(--ease); }
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: oklch(19% 0.01 25); }
.rank-row[data-rank="1"] { background: var(--accent-soft); }
.rank-row.is-updated { animation: row-flash 850ms var(--ease); }
.rank-position { color: var(--ink); font-size: 1.05rem; font-weight: 850; font-variant-numeric: tabular-nums; text-align: center; }
.rank-row[data-rank="1"] .rank-position { color: var(--accent-strong); }

.product-cell { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.product-mark { position: relative; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: 0 0 2.6rem; overflow: hidden; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface-subtle); color: var(--ink); font-size: 0.78rem; font-weight: 850; }
.product-mark img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface-subtle); }
.product-mark.has-icon .product-initials { visibility: hidden; }
.product-copy { min-width: 0; }
.product-name { display: block; overflow: hidden; color: var(--ink); font-size: 0.9rem; font-weight: 800; line-height: 1.2; text-overflow: ellipsis; text-decoration: none; white-space: nowrap; }
.product-name:hover { color: var(--blue); }
.product-meta { display: flex; flex-wrap: wrap; gap: 0.28rem 0.48rem; margin-top: 0.2rem; color: var(--muted); font-size: 0.69rem; font-weight: 650; }
.listing-description { display: -webkit-box; overflow: hidden; margin: 0.2rem 0 0; color: var(--muted); font-size: 0.76rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 1; }
.sponsored-chip, .local-chip, .verified-chip, .estimated-chip { display: inline-flex; align-items: center; padding: 0.12rem 0.3rem; border: 1px solid var(--line); border-radius: 0.2rem; font-size: 0.62rem; font-weight: 800; line-height: 1; }
.sponsored-chip { border-color: oklch(48% 0.11 28); color: var(--accent-strong); }
.verified-chip { border-color: oklch(48% 0.08 160); color: var(--up); }
.estimated-chip { border-color: var(--line-strong); color: var(--muted); }
.local-chip { color: var(--blue); }

.money-cell, .click-cell { display: grid; gap: 0.1rem; justify-items: end; color: var(--muted); font-size: 0.66rem; font-weight: 700; }
.money-cell strong, .click-cell strong { color: var(--ink); font-size: 0.9rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.click-cell strong { color: var(--up); }
.row-actions { display: flex; justify-content: flex-end; gap: 0.35rem; }
.bid-button, .share-button { min-height: 2.25rem; padding: 0.45rem 0.6rem; border-radius: 0.3rem; font-size: 0.72rem; font-weight: 800; }
.bid-button { flex: 1 1 auto; border: 1px solid var(--accent); background: var(--accent); color: white; }
.bid-button:hover { background: var(--accent-strong); }
.share-button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.share-button:hover { border-color: var(--line-strong); color: var(--ink); }
.empty-state { min-height: 12rem; margin: 0; padding: 2rem; color: var(--muted); }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.25rem; padding: 1.25rem 0 0; color: var(--muted); font-size: 0.75rem; }
.footer-brand { color: var(--ink); font-weight: 900; letter-spacing: 0.04em; }
.footer-links { display: inline-flex; flex-wrap: wrap; gap: 0.8rem; }
.footer-links a { color: var(--muted); font-weight: 700; }

.dialog { width: min(calc(100% - 1.5rem), 33rem); max-height: calc(100dvh - 1.5rem); overflow: auto; margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 0.65rem; background: var(--surface); color: var(--ink); }
.dialog:not([open]) { display: none; }
.dialog[open] { z-index: var(--z-dialog); }
.dialog::backdrop { background: rgb(23 25 29 / 0.58); }
.dialog-panel { display: grid; gap: 0.9rem; margin: 0; padding: 1rem; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); }
.section-label { margin: 0; color: var(--muted); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.dialog-heading h2 { margin: 0.25rem 0 0; font-size: 1.25rem; line-height: 1.15; }
.icon-button { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; padding: 0; border: 1px solid var(--line); border-radius: 0.3rem; background: var(--surface); color: var(--ink); }
.bid-target, .payment-preview, .acknowledgement { padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-subtle); }
.bid-target { display: grid; gap: 0.25rem; }
.bid-target span, .payment-preview p, .field-hint { color: var(--muted); font-size: 0.76rem; }
.bid-target strong { font-size: 1rem; }
.order-summary { display: grid; border-block: 1px solid var(--line); }
.order-summary div { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.order-summary div:last-child { border-bottom: 0; }
.order-summary span { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.order-summary strong { font-size: 0.76rem; text-align: right; }
.dialog-stepper { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 2.6rem; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dialog-stepper .money-field { padding-left: 0.65rem; border-inline: 1px solid var(--line); }
.field-hint { min-height: 1.15rem; margin: -0.25rem 0 0; }
.acknowledgement { display: flex; align-items: flex-start; gap: 0.55rem; color: var(--muted); font-size: 0.76rem; line-height: 1.4; }
.acknowledgement input { flex: 0 0 auto; margin: 0.15rem 0 0; accent-color: var(--accent); }
.payment-preview { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.7rem; }
.payment-preview strong { display: block; margin-top: 0.2rem; font-size: 0.8rem; }
.payment-preview p { grid-column: 1 / -1; margin: 0; line-height: 1.4; }
.payment-status { align-self: start; padding: 0.2rem 0.4rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 0.62rem; font-weight: 800; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.secondary-action { min-height: 3rem; padding: 0.65rem 0.9rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--muted); font-weight: 750; }

.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: var(--z-toast); width: min(calc(100% - 2rem), 25rem); padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); color: var(--bg); font-size: 0.8rem; opacity: 0; pointer-events: none; transform: translateY(0.5rem); transition: opacity 160ms var(--ease), transform 160ms var(--ease); }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast[data-state="error"] { background: var(--accent-strong); }

@keyframes row-flash { from { background: var(--up-soft); } to { background: var(--surface); } }

@media (max-width: 62rem) {
  .market-entry { grid-template-columns: 1fr; }
  .bid-terms dl { grid-template-columns: repeat(3, 1fr); }
  .bid-terms dl div { display: block; }
  .bid-terms dd { margin-top: 0.15rem; }
  .bid-console { grid-template-columns: minmax(12rem, 1fr) minmax(10rem, 0.7fr); }
  .field-wide { grid-column: 1; }
  .field:not(.field-wide) { grid-column: 2; }
  .amount-control { grid-column: 1; grid-row: 2; }
  .bid-console > .primary-action { grid-column: 2; grid-row: 2; }
  .board-header, .rank-row { grid-template-columns: 3rem minmax(13rem, 1fr) minmax(6rem, 7rem) minmax(8.5rem, 9.5rem); }
  .featured-1 { grid-template-columns: minmax(0, 1fr) auto; }
  .featured-1 .featured-actions { grid-column: 1 / -1; }
  .board-header span:nth-child(4), .click-cell { display: none; }
}

@media (max-width: 46rem) {
  .app-shell { width: min(100% - 1rem, var(--content)); }
  .topbar { grid-template-columns: 1fr auto; }
  .time-tabs { justify-self: end; }
  .demo-state { display: none; }
  .site-nav { display: none; }
  .claim-stage { padding: 2.2rem 0 1.5rem; }
  .claim-panel h1 { font-size: 2.35rem; }
  .bid-console { grid-template-columns: 1fr; padding: 0.6rem; }
  .field-wide, .field:not(.field-wide), .amount-control, .bid-console > .primary-action { grid-column: 1; grid-row: auto; }
  .field-wide { order: 1; }
  .field:not(.field-wide) { order: 2; }
  .amount-control { order: 3; }
  .bid-console > .primary-action { order: 4; }
  .market-status span + span::before { display: none; }
  .category-market { align-items: flex-start; flex-direction: column; gap: 0.35rem; }
  .category-rail { width: 100%; }
  .board-toolbar { align-items: flex-start; flex-direction: column; gap: 0.3rem; }
  .board-toolbar p { text-align: left; }
  .board-context { justify-items: start; }
  .measurement-note { text-align: left; }
  .measurement-note p { right: auto; left: 0; width: min(21rem, calc(100vw - 2rem)); }
  .board-header { display: none; }
  .top-three { grid-template-columns: 1fr; }
  .featured-1 { grid-column: auto; }
  .featured-listing, .featured-1 { grid-template-columns: 1fr; padding: 0.9rem; }
  .featured-evidence { justify-content: flex-start; }
  .featured-actions, .featured-1 .featured-actions { grid-column: auto; justify-content: stretch; }
  .featured-actions .bid-button { flex: 1 1 auto; }
  .board-list { border-inline: 0; }
  .rank-row { grid-template-areas: "rank product" ". money" ". actions"; grid-template-columns: 2.75rem minmax(0, 1fr); align-items: start; gap: 0.55rem 0.35rem; padding: 0.85rem 0; }
  .rank-position { grid-area: rank; padding-top: 0.7rem; }
  .product-cell { grid-area: product; }
  .money-cell { grid-area: money; justify-items: start; }
  .click-cell { display: none; }
  .row-actions { grid-area: actions; justify-content: stretch; }
  .bid-button { flex: 1 1 auto; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .bid-terms dl { grid-template-columns: 1fr; }
  .amount-control > button, .dialog-stepper > button, .category-chip, .bid-button, .share-button { min-height: 2.75rem; }
  .product-meta, .listing-description, .money-cell, .click-cell, .demo-note, .bid-terms dt, .bid-terms dd, .bid-terms a { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
