:root {
  color-scheme: light;
  --bg: oklch(0.965 0.008 88);
  --surface: oklch(0.99 0.006 88);
  --surface-strong: oklch(0.94 0.012 88);
  --ink: oklch(0.22 0.025 260);
  --muted: oklch(0.48 0.025 260);
  --line: oklch(0.86 0.012 88);
  --accent: oklch(0.58 0.16 24);
  --accent-soft: oklch(0.91 0.05 24);
  --blue: oklch(0.55 0.13 252);
  --green: oklch(0.58 0.12 148);
  --purple: oklch(0.56 0.13 310);
  --gold: oklch(0.72 0.13 86);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --shadow: 0 20px 50px oklch(0.32 0.03 260 / 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, oklch(0.9 0.045 24 / 0.75), transparent 32rem),
    radial-gradient(circle at 84% 14%, oklch(0.9 0.06 252 / 0.58), transparent 30rem),
    var(--bg);
  color: var(--ink);
}

.shell {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  padding: 42px 0 28px;
}

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

h1 {
  font-size: clamp(2.4rem, 6vw, 6.7rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
  max-width: 900px;
}

h2 {
  font-size: clamp(1.35rem, 2.2vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

h3 {
  font-size: 1.05rem;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 760px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 800;
  font-size: 0.74rem;
  margin-bottom: 8px;
}

.status-panel {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 15px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  color: var(--muted);
  white-space: nowrap;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 6px oklch(0.72 0.13 86 / 0.18);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.metric .label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric .value {
  margin-top: 10px;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  line-height: 1;
  font-weight: 850;
  letter-spacing: -0.055em;
}

.metric .sub {
  color: var(--muted);
  margin-top: 8px;
  font-size: 0.92rem;
}

.panel {
  background: oklch(0.99 0.006 88 / 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 16px 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.panel-head.compact { align-items: center; }

.controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: end;
}

label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select, button {
  font: inherit;
}

select {
  display: block;
  min-width: 180px;
  margin-top: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 34px 10px 12px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: transform 160ms ease-out, border-color 160ms ease-out, background 160ms ease-out;
}

.chip[aria-pressed="true"] {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: oklch(0.72 0.08 24);
}

.chip:hover { transform: translateY(-1px); }

.chart-wrap {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, oklch(0.985 0.007 88), oklch(0.955 0.01 88));
  overflow: hidden;
}

#share-chart {
  width: 100%;
  height: 360px;
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.table-wrap.wide { max-height: 620px; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: var(--surface);
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th:first-child, td:first-child { text-align: left; }

th {
  position: sticky;
  top: 0;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 2;
}

tr:last-child td { border-bottom: 0; }

.inclusion-summary,
.subhead-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 12px 0 14px;
}

.inclusion-summary {
  align-items: stretch;
  justify-content: start;
  flex-wrap: wrap;
}

.decklist-grid,
.difference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.deck-card,
.difference-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 16px;
}

.difference-card strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 8px;
}

.diff-more { color: var(--green); font-weight: 850; }
.diff-less { color: var(--accent); font-weight: 850; }

.deck-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 0.82rem;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 12px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.card-line {
  display: flex;
  gap: 6px;
  min-width: 0;
}

.card-line b { color: var(--accent); }
.card-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  margin-top: 12px;
  border: 1px solid oklch(0.7 0.08 24);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 760;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  padding: 22px 0 38px;
  font-size: 0.9rem;
}

.positive { color: var(--green); font-weight: 800; }
.negative { color: var(--accent); font-weight: 800; }
.muted { color: var(--muted); }

@media (max-width: 980px) {
  .masthead, .panel-head, .footer { flex-direction: column; align-items: stretch; }
  .overview-grid, .split { grid-template-columns: 1fr; }
  .controls { justify-content: start; }
  select { width: 100%; }
  .decklist-grid { grid-template-columns: 1fr; }
}
