:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #15191f;
  --panel-2: #1d232b;
  --text: #f2f4f7;
  --muted: #9da8b7;
  --line: #2a323d;
  --gold: #e3bd66;
  --red: #d44b38;
  --blue: #3da7cb;
  --green: #50b56f;
  --focus: #f2d48b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(8, 10, 14, 0.68), rgba(8, 10, 14, 0.9)),
    linear-gradient(90deg, rgba(8, 10, 14, 0.58), rgba(8, 10, 14, 0.16) 52%, rgba(8, 10, 14, 0.7)),
    url("assets/backgrounds/home-starfield.jpg") center / cover fixed no-repeat;
  color: var(--text);
}

body.ibh-set-page {
  background:
    linear-gradient(180deg, rgba(7, 14, 24, 0.74), rgba(7, 14, 24, 0.9)),
    linear-gradient(90deg, rgba(7, 14, 24, 0.48), rgba(7, 14, 24, 0.18) 45%, rgba(7, 14, 24, 0.72)),
    url("assets/backgrounds/ibh-hoth.png") center / cover fixed no-repeat;
}

body.shd-set-page {
  background:
    linear-gradient(180deg, rgba(8, 7, 20, 0.76), rgba(8, 7, 20, 0.91)),
    linear-gradient(90deg, rgba(8, 7, 20, 0.58), rgba(8, 7, 20, 0.2) 48%, rgba(8, 7, 20, 0.7)),
    url("assets/backgrounds/shd-key-art.jpg") center / cover fixed no-repeat;
}

body.sor-set-page {
  background:
    linear-gradient(180deg, rgba(9, 10, 15, 0.72), rgba(9, 10, 15, 0.9)),
    linear-gradient(90deg, rgba(9, 10, 15, 0.54), rgba(9, 10, 15, 0.18) 48%, rgba(9, 10, 15, 0.72)),
    url("assets/backgrounds/sor-key-art.jpg") center / cover fixed no-repeat;
}

body.twi-set-page {
  background:
    linear-gradient(180deg, rgba(24, 8, 8, 0.74), rgba(24, 8, 8, 0.9)),
    linear-gradient(90deg, rgba(24, 8, 8, 0.54), rgba(24, 8, 8, 0.18) 48%, rgba(24, 8, 8, 0.72)),
    url("assets/backgrounds/twi-key-art.png") center / cover fixed no-repeat;
}

body.jtl-set-page {
  background:
    linear-gradient(180deg, rgba(5, 10, 19, 0.74), rgba(5, 10, 19, 0.9)),
    linear-gradient(90deg, rgba(5, 10, 19, 0.56), rgba(5, 10, 19, 0.2) 48%, rgba(5, 10, 19, 0.72)),
    url("assets/backgrounds/jtl-key-art.jpg") center / cover fixed no-repeat;
}

body.ash-set-page {
  background:
    linear-gradient(180deg, rgba(9, 8, 14, 0.74), rgba(9, 8, 14, 0.9)),
    linear-gradient(90deg, rgba(9, 8, 14, 0.58), rgba(9, 8, 14, 0.2) 48%, rgba(9, 8, 14, 0.72)),
    url("assets/backgrounds/ash-key-art.jpg") center / cover fixed no-repeat;
}

body.law-set-page {
  background:
    linear-gradient(180deg, rgba(20, 8, 9, 0.75), rgba(20, 8, 9, 0.91)),
    linear-gradient(90deg, rgba(20, 8, 9, 0.58), rgba(20, 8, 9, 0.2) 48%, rgba(20, 8, 9, 0.72)),
    url("assets/backgrounds/law-key-art.jpg") center / cover fixed no-repeat;
}

body.sec-set-page {
  background:
    linear-gradient(180deg, rgba(9, 9, 18, 0.76), rgba(9, 9, 18, 0.92)),
    linear-gradient(90deg, rgba(9, 9, 18, 0.6), rgba(9, 9, 18, 0.24) 48%, rgba(9, 9, 18, 0.76)),
    url("assets/backgrounds/sec-key-art.jpg") center / cover fixed no-repeat;
}

body.lof-set-page {
  background:
    linear-gradient(180deg, rgba(3, 10, 17, 0.74), rgba(3, 10, 17, 0.91)),
    linear-gradient(90deg, rgba(3, 10, 17, 0.58), rgba(3, 10, 17, 0.2) 48%, rgba(3, 10, 17, 0.74)),
    url("assets/backgrounds/lof-key-art.jpg") center / cover fixed no-repeat;
}

button,
select,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header,
.site-footer,
.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  min-height: 124px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 16px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4.35vw, 4.7rem);
  line-height: 0.96;
  max-width: 1320px;
  letter-spacing: 0;
}

.title-accent {
  display: inline-block;
  color: var(--gold);
  font-style: italic;
  font-weight: 950;
  transform: skewX(-7deg);
  text-shadow: 0 0 18px rgba(227, 189, 102, 0.28);
}

.site-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 800;
  margin-top: 12px;
}

.site-subtitle img {
  width: 22px;
  height: 22px;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  line-height: 1;
  letter-spacing: 0;
}

h3 {
  font-size: 1rem;
  line-height: 1.2;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  font-weight: 800;
}

.ghost-button,
.solid-button,
.page-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: rgba(21, 25, 31, 0.86);
  padding: 0 14px;
  font-weight: 800;
}

.solid-button,
.page-button.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
}

.ghost-button:hover,
.solid-button:hover,
.page-button:hover {
  border-color: var(--focus);
}

.ghost-button:disabled,
.solid-button:disabled,
.page-button:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 18px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 36px 0 16px;
}

.section-head p {
  color: var(--muted);
  max-width: 650px;
  line-height: 1.5;
}

.section-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: 650px;
  text-align: right;
}

.section-side p {
  max-width: 560px;
}

.section-actions {
  justify-content: flex-end;
}

.top-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.top-card {
  min-width: 0;
  background: rgba(21, 25, 31, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  display: grid;
  grid-template-rows: 230px auto;
}

.card-art-frame {
  position: relative;
  display: block;
  overflow: hidden;
  background: #080a0d;
}

.card-art-frame .card-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.foil-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 18%, rgba(140, 220, 255, 0.8) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 68%, rgba(255, 226, 138, 0.82) 0 1px, transparent 2px),
    radial-gradient(circle at 32% 78%, rgba(255, 255, 255, 0.72) 0 1px, transparent 2px),
    linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.22) 43%, transparent 62%);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 220% 220%;
  mix-blend-mode: screen;
  opacity: 0.58;
}

.foil-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    135deg,
    transparent 8%,
    rgba(109, 215, 255, 0.16) 26%,
    rgba(255, 228, 128, 0.18) 42%,
    rgba(255, 116, 216, 0.14) 58%,
    transparent 78%
  );
  mix-blend-mode: color-dodge;
  opacity: 0.48;
}

.top-card > .card-art-frame {
  width: 100%;
  height: 100%;
  padding: 10px;
}

.top-card-body {
  padding: 12px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 8px 0;
}

.price-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.price-trio {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.price-box {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  padding: 8px;
}

.price-box span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}

.price-box strong {
  font-size: 1.05rem;
}

.card-title-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.card-title-line h3,
.card-title-line strong {
  min-width: 0;
}

.tcg-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  opacity: 0.72;
  margin-top: 0;
}

.tcg-link:hover,
.tcg-link:focus-visible {
  opacity: 1;
}

.tcg-link img {
  width: 24px;
  height: 24px;
  display: block;
}

.tcg-link span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.set-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.set-logo {
  --accent: var(--gold);
  --accent-mid: var(--gold);
  --accent-light: #f2f4f7;
  min-height: 156px;
  border: 1px solid color-mix(in srgb, var(--accent), white 18%);
  border-radius: 8px;
  padding: 16px;
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--accent-light), transparent 78%), transparent 15rem),
    linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 70%), transparent 58%),
    linear-gradient(180deg, color-mix(in srgb, var(--accent), #11151a 78%), #0e1116);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  color: var(--text);
  position: relative;
  overflow: hidden;
}

.set-logo.has-logo {
  justify-content: center;
  gap: 14px;
}

.set-logo::after {
  content: "";
  position: absolute;
  inset: auto -24px -42px auto;
  width: 170px;
  height: 170px;
  border: 2px solid color-mix(in srgb, var(--accent-mid), transparent 35%);
  transform: rotate(22deg);
}

.set-logo.has-logo::after {
  opacity: 0.35;
}

.set-logo-image {
  width: 100%;
  height: 92px;
  object-fit: contain;
  z-index: 1;
  filter:
    drop-shadow(0 8px 16px rgba(0, 0, 0, 0.52))
    drop-shadow(0 0 18px color-mix(in srgb, var(--accent), transparent 55%));
}

.set-code {
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: 0.8;
  font-weight: 950;
  letter-spacing: 0;
  color: color-mix(in srgb, var(--accent), white 25%);
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.set-title {
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  color: var(--text);
  font-weight: 900;
  width: 100%;
}

.set-title span:last-child {
  color: var(--muted);
  white-space: nowrap;
}

.color-chits {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 5px;
}

.color-chits span {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: var(--chit);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.32);
}

.panel {
  border: 1px solid var(--line);
  background: rgba(21, 25, 31, 0.92);
  border-radius: 8px;
}

.booster-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
  margin: 18px 0 14px;
}

.booster-search-panel,
.booster-summary,
.booster-list-panel {
  padding: 14px;
}

.booster-search input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10141a;
  color: var(--text);
  padding: 0 14px;
  font-weight: 800;
}

.booster-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.booster-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
}

.booster-card > .card-art-frame {
  width: 78px;
  height: 108px;
  border-radius: 5px;
}

.booster-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.booster-value-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  font-weight: 950;
}

.booster-summary {
  position: sticky;
  top: 14px;
}

.booster-summary strong {
  display: block;
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 8px;
}

.booster-summary > span {
  color: var(--muted);
  font-weight: 800;
}

.booster-actions {
  margin-top: 16px;
}

.booster-list-panel {
  margin-top: 14px;
}

.booster-list-head {
  margin: 0 0 10px;
}

.quantity-controls {
  display: inline-grid;
  grid-template-columns: 32px minmax(34px, auto) 32px;
  align-items: center;
  gap: 6px;
}

.quantity-controls button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(21, 25, 31, 0.9);
  color: var(--text);
  font-weight: 950;
}

.quantity-controls button:hover {
  border-color: var(--focus);
}

.quantity-controls strong {
  min-width: 34px;
  text-align: center;
}

.quantity-delete-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trash-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(21, 25, 31, 0.9);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 950;
}

.trash-button:hover,
.trash-button:focus-visible {
  color: #fff;
  border-color: var(--red);
  background: rgba(212, 75, 56, 0.18);
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px 160px;
  gap: 10px;
  margin: 14px 0;
}

.filter-row input,
.filter-row select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10141a;
  color: var(--text);
  padding: 0 12px;
}

.view-sort-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}

.segmented-control,
.sort-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.segmented-control {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  background: rgba(21, 25, 31, 0.86);
}

.segmented-control button {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.segmented-control button.active {
  background: var(--gold);
  color: #111;
}

.sort-controls select {
  height: 42px;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #10141a;
  color: var(--text);
  padding: 0 12px;
}

.rarity-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.rarity-filter span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 2px;
}

.rarity-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(21, 25, 31, 0.86);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.rarity-button.active {
  background: rgba(227, 189, 102, 0.16);
  border-color: var(--gold);
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1050px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.02);
}

.sort-header {
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
}

.sort-header.active {
  color: var(--gold);
}

td {
  color: #dfe4eb;
}

.rank {
  width: 56px;
  color: var(--gold);
  font-weight: 950;
}

.card-cell {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.card-cell > .card-art-frame {
  width: 54px;
  height: 74px;
  border-radius: 4px;
}

.card-cell > .foil-card::before {
  background-size: 140% 140%, 120% 120%, 130% 130%, 115% 115%, 260% 260%;
  opacity: 0.7;
}

.card-cell a,
.card-cell strong {
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
}

.card-cell a:hover {
  color: var(--gold);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.pagination-panel {
  margin-top: 14px;
}

.page-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.empty-state {
  padding: 36px;
  text-align: center;
  color: var(--muted);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  padding: 34px 0;
  font-size: 0.86rem;
}

.list-intro,
.freshness-note {
  color: var(--muted);
  line-height: 1.5;
}

.freshness-note {
  margin-top: 10px;
}

@media (max-width: 1120px) {
  .top-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .set-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .top-grid,
  .set-grid,
  .filter-row,
  .booster-layout,
  .booster-match-grid {
    grid-template-columns: 1fr;
  }

  .booster-summary {
    position: static;
  }

  .top-card {
    grid-template-rows: 260px auto;
  }

  .toolbar,
  .section-head,
  .view-sort-bar,
  .pagination,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-side {
    align-items: flex-start;
    text-align: left;
  }

  .section-actions {
    justify-content: flex-start;
  }

  .page-buttons {
    justify-content: start;
  }
}
