:root {
  color-scheme: dark;
  --page: #101310;
  --surface: #171b17;
  --raised: #1e241e;
  --border: #2b342a;
  --border-bright: #41503d;
  --foreground: #eff3ea;
  --muted: #a3afa0;
  --subtle: #8d9a89;
  --accent: #cbfa84;
  --accent-text: #18250d;
  --up: #a4e775;
  --down: #f6a99e;
  --chart-grid: #2b342a;
  --chart-line: #c6f584;
  --chart-fill: rgba(185, 237, 113, 0.15);
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --numeric: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--foreground);
  font: 1rem/1.5 var(--font);
}

button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { width: min(100% - 64px, 1200px); margin-inline: auto; }

.topbar {
  background: #141814;
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  min-height: 69px;
  align-items: center;
  gap: 48px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 1.25rem;
  font-weight: 740;
  letter-spacing: -0.055em;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  width: 31px;
  height: 31px;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 8px;
  border-radius: 8px;
  background: var(--accent);
}

.brand-mark i {
  width: 4px;
  border-radius: 1px;
  background: var(--accent-text);
}

.brand-mark i:nth-child(1) { height: 6px; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 15px; }

.navigation { display: flex; gap: 23px; align-self: stretch; }

.nav-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0 3px;
  background: none;
  color: var(--muted);
  font-size: .9375rem;
  font-weight: 600;
}

.nav-button:hover, .nav-button[aria-current] { color: var(--foreground); }
.nav-button[aria-current]::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  content: "";
}

.nav-count {
  padding: 0 6px;
  border-radius: 5px;
  background: var(--raised);
  color: var(--accent);
  font-family: var(--numeric);
  font-size: .8125rem;
}

.market-source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
  font-size: .875rem;
  white-space: nowrap;
}

.source-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.source-date { color: var(--subtle); }
.source-date::before { margin-inline: 6px; content: "·"; }

.main { padding-top: 43px; }
.page-intro {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 18px;
  margin-bottom: 26px;
}
.page-intro h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: 1.12;
}
.page-intro p { margin-top: 8px; color: var(--muted); }

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

.load-state { padding: 24px; color: var(--muted); }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.65fr) minmax(243px, 1fr);
  gap: 18px;
  margin-bottom: 23px;
  align-items: stretch;
}

.chart-panel, .stats-panel { padding: 22px; }
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.card-heading-text h2 {
  font-size: 1.375rem;
  font-weight: 660;
  letter-spacing: -.035em;
}
.card-meta { color: var(--muted); font-size: .875rem; }

.watch-button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  background: var(--raised);
  color: var(--foreground);
  font-size: .875rem;
  font-weight: 600;
}
.watch-button:hover { border-color: var(--accent); }
.watch-button[aria-pressed="true"] { border-color: #65844b; color: var(--accent); }
.star { font: 1.375rem/1 Arial, sans-serif; }

.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 13px;
  margin-top: 19px;
}

.price-label { color: var(--muted); font-size: .875rem; }
.price-line { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; }
.price-value {
  font-size: clamp(1.9rem, 4vw, 2.625rem);
  font-weight: 670;
  letter-spacing: -.055em;
  font-variant-numeric: tabular-nums;
  line-height: 1.19;
}

.price-change {
  padding: 3px 8px;
  border-radius: 5px;
  background: #293229;
  color: var(--muted);
  font: 500 .8125rem/1.5 var(--numeric);
  white-space: nowrap;
}
.positive { color: var(--up); }
.negative { color: var(--down); }
.price-change.positive { background: #283a24; }
.price-change.negative { background: #3c2927; }

.time-ranges {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121713;
}
.time-ranges button {
  min-width: 36px;
  min-height: 30px;
  padding: 3px 7px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font-size: .875rem;
  font-weight: 620;
}
.time-ranges button:hover { color: var(--foreground); }
.time-ranges button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.chart-wrap {
  position: relative;
  height: 248px;
  margin-top: 15px;
}
.chart-wrap canvas { display: block; width: 100%; height: 100%; }
.chart-caption { margin-top: 8px; color: var(--subtle); font-size: .8125rem; }
.chart-caption a { text-underline-offset: 2px; }
.chart-caption a:hover { color: var(--accent); }

.chart-tooltip {
  position: absolute;
  z-index: 1;
  min-width: 124px;
  padding: 7px 10px;
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  background: #222b20;
  pointer-events: none;
}
.chart-tooltip time, .chart-tooltip strong { display: block; }
.chart-tooltip time { color: var(--muted); font-size: .8125rem; }
.chart-tooltip strong { color: var(--foreground); font: 620 1rem/1.5 var(--numeric); }
.chart-empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-size: .9375rem;
}

.stats-panel { display: flex; flex-direction: column; }
.stats-panel h2, .browse-heading h2 {
  font-size: 1.1875rem;
  font-weight: 660;
  letter-spacing: -.03em;
}
.stats { margin-top: 16px; }
.stats div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding-block: 15px;
  border-bottom: 1px solid var(--border);
}
.stats dt { color: var(--muted); font-size: .875rem; }
.stats dd { font-size: 1rem; font-family: var(--numeric); }
.stats-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.55;
}
.market-link {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--accent);
  text-align: center;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
}
.market-link:hover { border-color: var(--accent); background: var(--raised); }
.card-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 15px;
}
.trade-button {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .875rem;
  font-weight: 660;
}
.trade-button:hover { background: #dbffa4; }
.target-status {
  color: var(--muted);
  font-size: .8125rem;
}
.target-status.target-reached { color: var(--accent); }

.browse-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 17px 22px;
}
.browse-title-block { flex-shrink: 0; }
.result-count { color: var(--muted); font-size: .875rem; }
.filters { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.filters input, .filters select, .currency-picker select {
  min-height: 39px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121713;
  color: var(--foreground);
  font-size: .875rem;
}
.filters input::placeholder { color: var(--subtle); }
.search { width: min(31vw, 278px); }
.select-field { position: relative; }
.select-field select { appearance: none; padding-right: 29px; }
.select-field::after {
  position: absolute;
  top: calc(50% - 4px);
  right: 12px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  pointer-events: none;
  content: "";
}

.cards-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.cards-table thead { background: #141914; }
.cards-table th {
  padding: 9px 14px;
  border-block: 1px solid var(--border);
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 590;
  white-space: nowrap;
}
.cards-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
}
.cards-table tr:last-child td { border-bottom: 0; }
.cards-table th:first-child, .cards-table td:first-child { padding-left: 22px; }
.cards-table th:last-child, .cards-table td:last-child { padding-right: 22px; }
.cards-table tbody tr:hover { background: #1c221b; }
.cards-table tbody tr[data-selected="true"] { background: #20291c; }

.number-column { text-align: right; white-space: nowrap; }
.row-price, .row-change, .row-relative { font-family: var(--numeric); }
.row-price { font-weight: 550; }
.spark-column { width: 155px; text-align: center; }
.sparkline { display: block; width: 108px; height: 30px; margin-inline: auto; }
.star-column { width: 60px; text-align: right; }

.card-button {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--foreground);
  text-align: left;
}
.card-button:hover .row-name { color: var(--accent); }
.card-identity { min-width: 0; }
.row-name { display: block; font-weight: 630; }
.row-meta { display: block; color: var(--muted); font-size: .8125rem; }
.row-target { display: block; margin-top: 2px; }
.row-relative-mobile { display: none; }

.card-tile {
  --tile: #d4efac;
  display: grid;
  width: 34px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tile) 23%, var(--border));
  border-radius: 7px;
  background: color-mix(in srgb, var(--tile) 11%, var(--surface));
}
.card-tile[data-set="evolving-skies"] { --tile: #c8a7f0; }
.card-tile[data-set="paldea-evolved"] { --tile: #9bceae; }
.card-tile[data-set="surging-sparks"] { --tile: #f4c676; }
.card-tile[data-set="prismatic-evolutions"] { --tile: #edabc5; }
.card-tile i {
  display: block;
  width: 14px;
  height: 18px;
  border: 1px solid var(--tile);
  border-radius: 3px;
  background: linear-gradient(135deg, transparent 34%, var(--tile) 36%, transparent 44%, transparent 53%, var(--tile) 56%, transparent 62%);
  opacity: .83;
  transform: rotate(-11deg);
}
.row-watch {
  display: inline-grid;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  color: var(--muted);
}
.row-watch:hover { border-color: var(--border-bright); color: var(--accent); }
.row-watch[aria-pressed="true"] { color: var(--accent); }

.empty-list {
  padding: 36px 22px 42px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.empty-list h3 { font-size: 1.125rem; }
.empty-list p { margin: 6px 0 15px; color: var(--muted); }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 20px 0 27px;
  color: var(--muted);
  font-size: .8125rem;
}
.footer a { text-underline-offset: 3px; }
.footer a:hover { color: var(--accent); }
.mobile-source-date { display: none; }

.trade-dialog {
  width: min(590px, calc(100% - 26px));
  max-height: calc(100% - 26px);
  padding: 23px;
  color: var(--foreground);
  box-shadow: 0 16px 70px #0008;
}
.trade-dialog::backdrop { background: #0b0e0bd9; }
.trade-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.trade-header h2 {
  font-size: 1.375rem;
  letter-spacing: -.035em;
}
.trade-context {
  margin-block: 12px 16px;
  color: var(--muted);
  font-size: .875rem;
}
.trade-fields, .trade-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 15px;
}
.trade-fields label {
  display: grid;
  align-content: space-between;
  gap: 4px;
  color: var(--muted);
  font-size: .875rem;
}
.trade-fields input {
  min-width: 0;
  width: 100%;
  min-height: 41px;
  padding: 7px 9px;
  border: 1px solid var(--border-bright);
  border-radius: 7px;
  background: var(--page);
  color: var(--foreground);
  font: 1rem/1.5 var(--numeric);
}
.trade-fields input::placeholder {
  color: var(--subtle);
  font: .8125rem/1.5 var(--font);
}
.trade-results {
  margin-top: 18px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--raised);
}
.trade-results dt { color: var(--muted); font-size: .8125rem; }
.trade-results output { overflow-wrap: anywhere; font: 600 1.0625rem/1.5 var(--numeric); }
.trade-feedback { margin-top: 10px; color: var(--muted); font-size: .875rem; }
.trade-feedback:empty { display: none; }
.trade-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 850px) {
  .shell { width: min(100% - 36px, 1200px); }
  .topbar-inner { gap: 23px; }
  .chart-panel, .stats-panel { padding: 17px; }
  .detail-grid { gap: 12px; }
  .browse-heading { flex-wrap: wrap; padding-inline: 17px; }
  .filters { justify-content: flex-start; }
  .search { width: min(38vw, 278px); }
  .spark-column { width: 100px; }
  .sparkline { width: 83px; }
}

@media (max-width: 660px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .main { padding-top: 30px; }
  .topbar-inner { gap: 16px; min-height: 60px; }
  .navigation { gap: 13px; }
  .market-source { display: none; }
  .mobile-source-date { display: inline; }
  .chart-wrap { height: 220px; }
  .spark-column { display: none; }
  .cards-table th, .cards-table td { padding-inline: 9px; }
  .cards-table th:first-child, .cards-table td:first-child { padding-left: 15px; }
  .cards-table th:last-child, .cards-table td:last-child { padding-right: 15px; }
  .star-column { width: 44px; }
  .filters { width: 100%; flex-wrap: wrap; }
  .search { flex: 1 0 100%; }
  .select-field { flex: 1 1 110px; min-width: 0; }
}

@media (max-width: 430px) {
  .shell { width: calc(100% - 26px); }
  .chart-controls { flex-wrap: wrap; align-items: flex-start; }
  .chart-wrap { height: 184px; }
  .brand { gap: 8px; font-size: 1.125rem; }
  .brand-mark { width: 29px; height: 29px; }
  .topbar-inner { gap: 10px; }
  .navigation { gap: 8px; }
  .nav-button { gap: 5px; padding-inline: 2px; }
  .nav-count { padding-inline: 4px; }
  .detail-grid { margin-bottom: 18px; }
  .change-column, .relative-column { display: none; }
  .row-relative-mobile { display: block; font-size: .8125rem; }
  .row-meta { font-size: .8125rem; }
  .card-heading .watch-button { padding-inline: 7px; }
  .card-tile { width: 28px; }
  .card-button { gap: 8px; }
  .trade-dialog { padding: 16px; }
  .trade-fields, .trade-results { column-gap: 9px; }
}

@media (pointer: coarse) {
  .watch-button, .row-watch, .time-ranges button, .trade-button { min-height: 44px; }
  .row-watch { min-width: 44px; }
  .filters input, .filters select, .currency-picker select { min-height: 44px; font-size: 1rem; }
}
