/* Renaiss Pack Radar — dashboard stylesheet.
 * Dark analytics aesthetic: palette/type/layout take loose inspiration from
 * Renaiss's own product surface (near-black base, alpha-overlay surfaces,
 * hairline borders, sans+mono type split) but uses its own hues/typefaces
 * and carries none of Renaiss's logo, wordmark, or literal brand assets —
 * this is a clearly third-party transparency tool.
 *
 * Hierarchy is the whole point of this rewrite: verdict > real-EV-vs-
 * marketing-avgFMV gap > everything else. Two data panels are kept
 * structurally and visually separate — "Draw odds (published)" is a
 * percent table, "Premium inventory" is a count/FMV table — so a percent
 * and a raw count are never one undifferentiated column again.
 */

@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/vendor/fonts/sora-400.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/vendor/fonts/sora-600.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/vendor/fonts/sora-700.woff2") format("woff2");
}
@font-face {
  font-family: "Sora";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/vendor/fonts/sora-800.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/vendor/fonts/jbmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/vendor/fonts/jbmono-500.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/vendor/fonts/jbmono-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/vendor/fonts/jbmono-700.woff2") format("woff2");
}

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0a0c11;
  --bg-noise: #0d0f15;
  --surface: rgba(255, 255, 255, 0.036);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --surface-sunken: rgba(0, 0, 0, 0.22);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* text */
  --text: #eef1f6;
  --text-secondary: #99a3b6;
  --text-tertiary: #626c80;

  /* brand accent — our own single solid hue (not Renaiss's holo gradient) */
  --accent: #7c8cff;
  --accent-strong: #a6b2ff;
  --accent-soft: rgba(124, 140, 255, 0.14);

  /* semantic verdict colors */
  --pos: #34d399;
  --pos-soft: rgba(52, 211, 153, 0.12);
  --neg: #fb7185;
  --neg-soft: rgba(251, 113, 133, 0.13);
  --warn: #ffc15e;
  --warn-soft: rgba(255, 193, 94, 0.1);

  /* chart lines — deliberately distinct from --pos/--neg so a chart legend
     dot can never be mistaken for a verdict color again */
  --line-ev: var(--accent);
  --line-marketing: #838ca3;
  --line-inventory: #ffc15e;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 7px;

  --font-display: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  font-family: var(--font-display);
  background:
    radial-gradient(1200px 480px at 12% -10%, rgba(124, 140, 255, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0 0 64px;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
  text-decoration-color: rgba(166, 178, 255, 0.4);
}
a:hover {
  text-decoration-color: var(--accent-strong);
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 40px) 0;
}

/* ---------------------------------------------------------------------- */
/* Header                                                                  */
/* ---------------------------------------------------------------------- */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.brand-mark {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(155deg, var(--accent-soft), rgba(255, 193, 94, 0.1));
  border: 1px solid var(--border);
  color: var(--accent-strong);
  font-size: 1.1rem;
  font-weight: 700;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1rem + 1vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 3px;
  color: #fff;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin: 0;
  max-width: 46ch;
}

.freshness-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.freshness-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.freshness-pill time {
  font-family: var(--font-mono);
  color: var(--text);
}

.dot-live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-soft);
  flex: none;
}

/* Small, honest "this page auto-refreshes" signal — separate from
   `.freshness-pill` (which states the server's last poll ts) since these
   are two different real facts: the client re-fetches `#board-root` every
   30s (`hx-trigger="every 30s"` on the div itself, unconditionally true
   whenever this page is open) while the poller behind it runs on its own
   ~5-minute cycle. Never implies data is sub-30s-fresh, only that the
   page is watching for updates that often. */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.01em;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.live-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-soft);
  flex: none;
  animation: live-pulse 2.2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px var(--pos-soft);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 6px transparent;
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge__dot {
    animation: none;
  }
}

/* ---------------------------------------------------------------------- */
/* Notices: disclaimer / caveat / methodology / sources                    */
/* ---------------------------------------------------------------------- */

.notices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 0.78rem;
  line-height: 1.5;
  border: 1px solid var(--border);
}

.notice__icon {
  flex: none;
  font-size: 0.9rem;
  line-height: 1.5;
}

.notice--info {
  background: var(--surface);
  color: var(--text-secondary);
}

.notice--warn {
  background: var(--warn-soft);
  border-color: rgba(255, 193, 94, 0.28);
  color: var(--warn);
}

.methodology {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  overflow: hidden;
}

.methodology summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  padding: 9px 13px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}
.methodology summary::-webkit-details-marker {
  display: none;
}
.methodology summary::before {
  content: "▸";
  color: var(--accent-strong);
  transition: transform 0.15s ease;
  font-size: 0.7rem;
}
.methodology[open] summary::before {
  transform: rotate(90deg);
}

.methodology-body {
  padding: 0 15px 14px 15px;
  line-height: 1.65;
  color: var(--text-secondary);
}
.methodology-body p {
  margin: 0 0 10px;
}
.methodology-body ul {
  margin: 0 0 10px;
  padding-left: 1.15em;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.methodology-body strong {
  color: var(--text);
}
.methodology-body code {
  font-family: var(--font-mono);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.92em;
  color: var(--accent-strong);
}

.meta-line {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.9;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 8px;
}
.meta-line a {
  color: var(--accent-strong);
}
.meta-line .sep {
  color: var(--border-strong);
}

/* ---------------------------------------------------------------------- */
/* Pack grid + card shell                                                  */
/* ---------------------------------------------------------------------- */

.packs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
}

.pack-card {
  background: linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  /* Container query anchor for `.stat-flow`/`.panels`/`.charts` below: the
     `.packs` grid is `auto-fit, minmax(340px, 1fr)`, so a card's actual
     rendered width is NOT a monotonic function of viewport width — it
     troughs back down near 340px every time the grid gains a column (e.g.
     a 900px-viewport 2-col layout can be just as cramped as a 390px-
     viewport 1-col one). A `max-width` media query keyed to the viewport
     can't express "this card itself is narrow" in general; a container
     query keyed to the card's own inline size can, and is what actually
     fixes the price/EV/pool-avg truncation bug (see `.stat-flow__value`
     below) at every grid configuration, not just the ones a hand-picked
     set of viewport breakpoints happens to cover. */
  container-type: inline-size;
}

.pack-card--best {
  border-color: rgba(124, 140, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(124, 140, 255, 0.12), 0 18px 40px -24px rgba(124, 140, 255, 0.5);
}

.pack-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.pack-card__head h2 {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  color: #fff;
}

.rank-pill {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface-sunken);
  white-space: nowrap;
}
.rank-pill--best {
  color: #0a0c11;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}
.rank-pill--muted {
  color: var(--text-tertiary);
  font-style: italic;
}

/* limited/event-pack lifecycle status (SOON / LIVE / ENDED) — replaces the
   rank-pill for pack_type='limited' cards; a lottery drop has no relative
   rank against the perpetual packs (see `web.app._fetch_board`). */
.status-pill {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.status-pill--upcoming {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(255, 193, 94, 0.32);
}
.status-pill--live {
  color: var(--pos);
  background: var(--pos-soft);
  border-color: rgba(52, 211, 153, 0.32);
}
.status-pill--ended {
  color: var(--text-tertiary);
  background: var(--surface-sunken);
}

/* ---------------------------------------------------------------------- */
/* Verdict — the single most important number on the card                  */
/* ---------------------------------------------------------------------- */

.verdict-block {
  border-radius: var(--radius-md);
  padding: 15px 17px;
  border: 1px solid var(--border);
}
.verdict-block--pos {
  background: var(--pos-soft);
  border-color: rgba(52, 211, 153, 0.3);
}
.verdict-block--neg {
  background: var(--neg-soft);
  border-color: rgba(251, 113, 133, 0.3);
}

.verdict-number {
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 1.5rem + 1.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.verdict-block--pos .verdict-number {
  color: var(--pos);
}
.verdict-block--neg .verdict-number {
  color: var(--neg);
}

.verdict-label {
  margin-top: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.verdict-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}
.verdict-block--pos .verdict-tag {
  color: #05221a;
  background: var(--pos);
}
.verdict-block--neg .verdict-tag {
  color: #2a0910;
  background: var(--neg);
}

/* ---------------------------------------------------------------------- */
/* Price → real EV → marketing avgFMV flow                                 */
/* ---------------------------------------------------------------------- */

.stat-flow {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.stat-flow__item {
  flex: 1;
  min-width: 0;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* .stat-flow__label/__caption are short, fixed strings ("PRICE"/"pack
   cost") — a single-line ellipsis on THEM is a safe no-op in practice.
   `.stat-flow__value` (the actual dollar amount — EXPECTED is the single
   most important number on this whole dashboard) must NEVER go through
   this: `text-overflow: ellipsis` used to apply to every child here
   (`.stat-flow__item > *`), silently clipping a real value like
   "$392,847.10" down to "$392..." whenever this flex item's allotted
   share of a narrow-but-not-narrow-enough-to-hit-the-720px-breakpoint
   card ran out of room (see `.pack-card`'s container-type doc comment for
   why viewport width alone can't predict that). Fixed by (a) scoping
   ellipsis to label/caption only, (b) letting the value wrap + shrink
   instead of clip, and (c) the `@container` rules below that stack this
   row to one-value-per-line before the value ever needs to wrap. */
.stat-flow__label,
.stat-flow__caption {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-flow__label {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.stat-flow__value {
  font-family: var(--font-mono);
  font-size: clamp(0.86rem, 0.74rem + 0.5vw, 1.02rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  /* Never truncated: at worst this wraps onto a 2nd line (rare — the
     `@container` stacking below gives it a full card's width well before
     that), it never clips a digit off a dollar amount. */
  white-space: normal;
  overflow-wrap: break-word;
  overflow: visible;
}

.stat-flow__caption {
  font-size: 0.62rem;
  color: var(--text-tertiary);
}

.stat-flow__item--real {
  border-color: rgba(124, 140, 255, 0.35);
  background: var(--accent-soft);
}
.stat-flow__item--real .stat-flow__label {
  color: var(--accent-strong);
}
.stat-flow__item--real .stat-flow__value {
  color: var(--accent-strong);
}
.stat-flow__item--real .stat-flow__caption {
  color: var(--accent-strong);
  opacity: 0.85;
}

.stat-flow__item--marketing .stat-flow__value {
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-flow__arrow {
  flex: none;
  align-self: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.meta-row {
  font-size: 0.74rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  line-height: 1.6;
}

/* ---------------------------------------------------------------------- */
/* Limited/event packs — countdown, honest lottery EV, supply depletion.
 * Deliberately its own visual language, never the pos/neg verdict colors:
 * a limited pack has no verified buyback, so nothing here is allowed to
 * read as a "+EV"/"-EV" judgment (see `_pack_board`'s CRITICAL HONESTY
 * note in web/app.py).                                                    */
/* ---------------------------------------------------------------------- */

.limited-block {
  border-radius: var(--radius-md);
  padding: 15px 17px;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
}
.limited-block--upcoming,
.limited-block--live {
  background: var(--accent-soft);
  border-color: rgba(124, 140, 255, 0.3);
}

.limited-block__kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.countdown {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
}

.countdown__value {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.15rem + 1.1vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.countdown__caption {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.limited-block__state {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
}
.limited-block__state--live {
  color: var(--pos);
}
.limited-block__state--ended {
  color: var(--text-tertiary);
  font-weight: 600;
}

.ev-honest {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 2px 2px 0;
}

.ev-honest__value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ev-honest__label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-style: italic;
  line-height: 1.5;
}

.chase-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 12px;
}

.chase-line__icon {
  flex: none;
  color: #9adcff;
  font-size: 0.85rem;
}

.chase-line__body {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.chase-line__fmv {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

/* card-name link-outs (IP-safe: text only, never an image/artwork) --
   reused by both the limited-pack chase line and the perpetual "Premium
   inventory" top-cards list. */
.card-link {
  color: var(--accent-strong);
}
.card-link__affordance {
  margin-left: 5px;
  font-size: 0.85em;
  color: var(--text-tertiary);
}

.supply-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.supply-block__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.supply-block__label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.supply-block__count {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.supply-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  overflow: hidden;
}

.supply-bar__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.supply-bar__fill--imminent {
  background: var(--warn);
}

.supply-block__meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.chase-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}
.chase-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-soft);
  flex: none;
}
.chase-status--gone {
  color: var(--text-tertiary);
}

/* ---------------------------------------------------------------------- */
/* Two separate panels: published draw odds VS finish inventory            */
/* ---------------------------------------------------------------------- */

.panels {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 12px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 13px 14px 14px;
  min-width: 0;
}

.panel__title {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.panel__hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-tertiary);
  font-size: 0.68rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
th, td {
  text-align: left;
  padding: 5px 4px;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  font-weight: 600;
}
tbody tr:last-child td {
  border-bottom: none;
}
td.num, th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.odds-table td:first-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
}
.odds-table td.num {
  color: var(--text-secondary);
}

/* finish inventory: counts + means only, never a percent in sight */

.finish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.finish-cell {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.finish-cell__top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  color: var(--text-secondary);
  text-transform: capitalize;
}

.finish-cell__icon {
  font-size: 0.78rem;
}
.finish-cell--diamond .finish-cell__icon { color: #9adcff; }
.finish-cell--golden .finish-cell__icon { color: #ffd873; }
.finish-cell--silver .finish-cell__icon { color: #c9d2e0; }
.finish-cell--plain .finish-cell__icon,
.finish-cell--unknown .finish-cell__icon { color: var(--text-tertiary); }

.finish-cell__count {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.finish-cell__mean {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.top-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.top-cards li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2px 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}
.top-cards li:last-child {
  border-bottom: none;
}

.top-cards__name-wrap {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  /* Widen the name's share of the row (was a single-line-ellipsis 0 1 auto
     that only ever showed as much of the name as fit unwrapped) — it can
     now grow to fill whatever room `.top-cards__fmv` doesn't need. */
  flex: 1 1 160px;
}

/* Card names link out (no images — see web.ts module doc "NO CARD
   ARTWORK"), so the full name matters. Wraps up to 2 lines instead of a
   single-line ellipsis (e.g. "Special Art Rare — ..." used to hard-clip
   here) — a native `title=` on the `<a>` itself (see web.ts's
   `renderTopCards`) still surfaces the complete name on hover for the
   rare name too long even for 2 lines. */
.top-cards__name {
  min-width: 0;
  flex: 1 1 auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
  color: var(--text-secondary);
  text-decoration: none;
}
a.top-cards__name:hover {
  color: var(--accent-strong);
}

.top-cards__count {
  flex: none;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.top-cards__fmv {
  flex: none;
  /* With `.top-cards li`'s new `flex-wrap: wrap` (see above), a long
     2-line name pushes the price onto its own line on a narrow row — keep
     it right-aligned there too rather than snapping to the left edge. */
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.empty {
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 0.8rem;
  margin: 0;
}

/* ---------------------------------------------------------------------- */
/* Charts                                                                   */
/* ---------------------------------------------------------------------- */

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  /* `.packs` stretches every card in a row to equal height (CSS grid's
     default `align-items: stretch`); pinning this last block to the
     bottom of its `.pack-card` flex column keeps the chart row level
     across the 3 cards even when one pack's draw-odds/inventory panels
     are taller than its neighbors'. */
  margin-top: auto;
}

.chart-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px 13px 10px;
  min-width: 0;
  /* Containment backstop: uPlot sizes its canvas once, at construction,
     from the container's width at that instant (app.js's
     `chartResizeObserver` keeps it re-synced on layout changes) — if a
     resize is ever missed, `overflow: hidden` here clips the chart to
     this card's own column instead of letting it bleed into a sibling
     pack's card. */
  overflow: hidden;
}

.chart-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.chart-block h3 {
  font-size: 0.72rem;
  margin: 0;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chart {
  width: 100%;
  height: 210px;
  overflow: hidden;
  position: relative;
}

.metric-select {
  background: var(--surface-sunken);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  padding: 3px 6px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.68rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top-width: 2px;
  border-top-style: solid;
}
.legend-swatch--ev {
  border-color: var(--line-ev);
}
.legend-swatch--avgfmv {
  border-color: var(--line-marketing);
  border-top-style: dashed;
}
.legend-swatch--inv {
  border-color: var(--line-inventory);
}

/* uPlot theme overrides (scoped; vendored CSS ships its own base) */
.chart .u-legend { display: none; }
.chart .u-axis .u-label { color: var(--text-tertiary); }

/* ---------------------------------------------------------------------- */
/* Drop history — every recorded LIMITED-drop closure. Lives inside         */
/* `#board-root` (see web.ts's `renderDashboardPage`) so it refreshes on   */
/* the same 30s htmx cycle as the pack grid.                                */
/* ---------------------------------------------------------------------- */

.drop-history {
  margin: 26px 0 4px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.drop-history__heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.drop-history__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Hairline row separators via the container's own background peeking
     through 1px gaps, matching `.finish-grid`'s technique — no extra
     border-bottom rules to keep in sync on the last row. */
  background: var(--border);
}

.drop-history__row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: 4px 14px;
  align-items: baseline;
  background: var(--surface);
  padding: 12px 16px;
}

.drop-history__name {
  min-width: 0;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
}

.drop-history__date,
.drop-history__price,
.drop-history__duration {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

.drop-history__duration {
  color: var(--pos);
  font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/* Footer                                                                   */
/* ---------------------------------------------------------------------- */

footer.disclaimer-footer {
  max-width: 1240px;
  margin: 34px auto 0;
  padding: 16px clamp(16px, 4vw, 40px) 0;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------------- */
/* Responsive                                                               */
/* ---------------------------------------------------------------------- */

@media (max-width: 900px) {
  .charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .panels {
    grid-template-columns: 1fr;
  }
  .stat-flow {
    flex-direction: column;
  }
  .stat-flow__arrow {
    transform: rotate(90deg);
    align-self: flex-start;
    margin-left: 2px;
  }
  .page-header {
    flex-direction: column;
  }
  .freshness-group {
    align-items: flex-start;
  }
  .supply-block__row {
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 600px) {
  /* Drop-history: 4 grid columns (name/date/price/duration) can't hold a
     legible row this narrow — reflow into a 2-col label grid, name given
     its own full-width row so it's never squeezed. */
  .drop-history__row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "date price"
      "duration duration";
    row-gap: 5px;
  }
  .drop-history__name {
    grid-area: name;
  }
  .drop-history__date {
    grid-area: date;
  }
  .drop-history__price {
    grid-area: price;
    text-align: right;
  }
  .drop-history__duration {
    grid-area: duration;
  }
}

@media (max-width: 480px) {
  .wrap {
    padding: 14px 14px 0;
  }
  .pack-card {
    padding: 16px 15px 18px;
    border-radius: var(--radius-md);
  }
  .verdict-number {
    font-size: 1.85rem;
  }
  .finish-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
  }
  .chart {
    height: 180px;
  }
  .countdown__value {
    font-size: 1.35rem;
  }
  .chase-line {
    flex-direction: column;
    gap: 3px;
  }
  .drop-history__row {
    padding: 10px 12px;
  }
}

/* ---------------------------------------------------------------------- */
/* Container-queried narrow-CARD layout (supplements the viewport-keyed     */
/* @media rules above). `.packs` is `auto-fit, minmax(340px, 1fr)`, so a    */
/* card's rendered width troughs back down near its 340px floor every time */
/* the grid gains a column — at some viewport widths (e.g. ~780-900px,     */
/* right after the 1-col -> 2-col transition) a card can be just as        */
/* cramped as it is on a 390px phone, even though no viewport media query  */
/* fires there. `.pack-card { container-type: inline-size }` (declared     */
/* above) lets these rules key off the CARD's own width instead, so the    */
/* stat-flow/panels/charts stacking below actually fires whenever the      */
/* content is tight, at any viewport size or grid column count.            */
/* ---------------------------------------------------------------------- */

@container (max-width: 460px) {
  .stat-flow {
    flex-direction: column;
  }
  .stat-flow__arrow {
    transform: rotate(90deg);
    align-self: flex-start;
    margin-left: 2px;
  }
}

@container (max-width: 560px) {
  .panels {
    grid-template-columns: 1fr;
  }
}

@container (max-width: 620px) {
  .charts {
    grid-template-columns: 1fr;
  }
}
