:root {
  --bg: #111214;
  --surface: #1b1c20;
  --surface-2: #25262b;
  --border: #2f3036;
  --text: #f3f3f5;
  --muted: #9a9ba3;
  --accent: #ffcb05;
  --pos: #3ecf8e;
  --neg: #ff5c5c;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}

main,
.site-header,
.site-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  padding-top: 48px;
  padding-bottom: 24px;
}

.logo {
  font-size: clamp(2.25rem, 8vw, 3.5rem);
  letter-spacing: -0.03em;
  line-height: 1;
}

.logo span {
  color: var(--accent);
}

.tagline {
  margin-top: 8px;
  color: var(--muted);
}

.notice {
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.875rem;
}

/* Toolbar: search + price mode */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.search {
  position: relative;
  flex: 1 1 260px;
}

.search input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search input:focus {
  border-color: var(--accent);
  outline: none;
}

.search-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  list-style: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.search-results li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.search-results li.is-active,
.search-results li:hover {
  background: var(--surface-2);
}

.search-kind {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-label {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-sub {
  color: var(--muted);
  font-size: 0.8125rem;
}

.search-results .search-empty {
  display: block;
  color: var(--muted);
  cursor: default;
}

.price-mode {
  display: flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.price-mode button {
  padding: 8px 16px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.price-mode button[aria-pressed="true"] {
  background: var(--accent);
  color: #111;
}

/* Valuation options */
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-bottom: 12px;
}

.switch {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 8px;
  cursor: pointer;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.switch span {
  font-weight: 600;
}

.switch small {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.75rem;
}

/* Leaderboard */
.leaderboard {
  margin-top: 32px;
}

.lb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.lb-head h2 {
  font-size: 1.25rem;
}

.lb-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.875rem;
}

.lb-sort select {
  width: auto;
  padding: 8px 10px;
  font-size: 0.875rem;
}

.lb-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.875rem;
}

.lb-list {
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.lb-list li + li {
  margin-top: 6px;
}

.lb-row {
  display: grid;
  grid-template-columns: 2rem 1fr 4.5rem 6.5rem 11rem;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lb-row:hover {
  border-color: var(--accent);
}

.lb-rank {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lb-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lb-name span {
  color: var(--muted);
  font-size: 0.8125rem;
}

.lb-metric {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lb-label {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lb-money {
  font-weight: 500;
  font-size: 0.875rem;
}

.lb-metric .pos {
  color: var(--pos);
}

.lb-metric .neg {
  color: var(--neg);
}

#lb-toggle {
  margin-top: 10px;
}

@media (max-width: 640px) {
  .lb-row {
    grid-template-columns: 1.5rem 1fr 1fr;
    gap: 8px 10px;
  }

  .lb-name {
    grid-column: 2 / -1;
  }

  .lb-metric:nth-of-type(3) {
    grid-column: 2;
  }

  .lb-money {
    grid-column: 2 / -1;
  }
}

/* Steps */
.step {
  margin-top: 32px;
}

.step h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 1.125rem;
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #111;
  font-size: 0.875rem;
}

select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

/* Products */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.product {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.product:hover {
  border-color: var(--muted);
}

.product.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.product-name {
  font-weight: 600;
}

.product-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

/* Custom price */
.price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
}

.price-row label {
  font-weight: 600;
}

.price-field {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.price-field:focus-within {
  border-color: var(--accent);
}

.price-field span {
  color: var(--muted);
}

.price-field input {
  width: 8ch;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  outline: none;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* Results */
.verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
}

.verdict-label {
  font-size: 1.75rem;
  font-weight: 800;
}

.verdict-rip .verdict-label {
  color: var(--pos);
}

.verdict-skip .verdict-label {
  color: var(--neg);
}

.verdict-detail {
  color: var(--muted);
}

.set-note {
  margin-top: 10px;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}

/* Skip-to-Rip meter */
.meter {
  margin-top: 10px;
  padding: 18px 16px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}

.meter-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--neg), var(--accent) 50%, var(--pos));
}

/* Break-even tick */
.meter-track::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 2px;
  background: var(--text);
  opacity: 0.35;
  transform: translateX(-50%);
}

.meter-marker {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 24px;
  height: 24px;
  border: 4px solid var(--bg);
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--text);
  transform: translate(-50%, -50%);
}

.meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.meter-labels span:first-child {
  color: var(--neg);
}

.meter-labels span:last-child {
  color: var(--pos);
}

.meter-caption {
  margin-top: 6px;
  font-size: 0.875rem;
  text-align: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-label {
  color: var(--muted);
  font-size: 0.8125rem;
}

.stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat.pos .stat-value {
  color: var(--pos);
}

.stat.neg .stat-value {
  color: var(--neg);
}

/* Odds table */
.odds {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.odds th,
.odds td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.odds th {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
}

.est {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.6875rem;
  cursor: help;
}

.bar {
  height: 6px;
  margin-bottom: 4px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* Stack table rows into cards on small screens */
@media (max-width: 640px) {
  .odds thead {
    display: none;
  }

  .odds tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }

  .odds td {
    padding: 0;
    border: 0;
  }

  .odds td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
  }

  .odds td:nth-child(n + 2)::before {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
  }

  .odds td:nth-child(2)::before { content: "Per pack"; }
  .odds td:nth-child(3)::before { content: "At least one"; }
  .odds td:nth-child(4)::before { content: "Expected pulls"; }
  .odds td:nth-child(5)::before { content: "Avg value"; }
}

/* Chase cards */
.subhead {
  margin-top: 28px;
  margin-bottom: 8px;
  font-size: 1rem;
}

.chase {
  padding: 0;
  list-style: none;
}

.chase li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.chase-name {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.chase-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.subhead-hint {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 400;
}

/* Card view */
.card-view {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.card-view::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.card-close {
  float: right;
  width: 32px;
  height: 32px;
  margin: -8px -8px 0 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.card-top {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.card-img {
  width: 110px;
  height: auto;
  flex-shrink: 0;
  align-self: flex-start;
  border-radius: 6px;
}

.card-top h2 {
  font-size: 1.125rem;
  line-height: 1.3;
}

.card-sub {
  color: var(--muted);
  font-size: 0.875rem;
}

.card-price {
  margin: 4px 0;
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.card-facts {
  margin: 12px 0;
  padding-left: 18px;
}

.card-facts li + li {
  margin-top: 6px;
}

.card-products {
  margin-top: 8px;
}

@media (max-width: 640px) {
  .card-products thead {
    display: table-header-group;
  }

  .card-products tr {
    display: table-row;
    padding: 0;
  }

  .card-products td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border);
  }

  .card-products td::before {
    display: none !important;
  }
}

.chase-price {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chase-meta {
  color: var(--muted);
  font-size: 0.8125rem;
}

.source {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.source a {
  color: var(--muted);
}

.site-footer {
  margin-top: 64px;
  padding-bottom: 32px;
  color: var(--muted);
  font-size: 0.8125rem;
}
