:root {
  color-scheme: dark;
  --ink: #f2f0e8;
  --muted: #918f89;
  --line: rgba(242, 240, 232, 0.13);
  --line-strong: rgba(242, 240, 232, 0.24);
  --panel: #171817;
  --panel-light: #1d1f1e;
  --black: #0c0d0c;
  --signal: #d8ff34;
  --signal-soft: rgba(216, 255, 52, 0.12);
  --danger: #ff6d57;
  --font-sans: "Manrope", sans-serif;
  --font-mono: "DM Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 80% 0%, rgba(216, 255, 52, 0.055), transparent 26rem),
    var(--black);
  color: var(--ink);
  font-family: var(--font-sans);
}

button,
select {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 0 32px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 13px;
  align-items: center;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.brand-mark {
  display: flex;
  gap: 3px;
  align-items: end;
  width: 21px;
  height: 21px;
}

.brand-mark span {
  display: block;
  width: 5px;
  background: var(--signal);
}

.brand-mark span:nth-child(1) {
  height: 10px;
}

.brand-mark span:nth-child(2) {
  height: 18px;
}

.brand-mark span:nth-child(3) {
  height: 13px;
}

.tournament-pill,
.data-status {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: #bbb9b2;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.live-dot,
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 4px rgba(216, 255, 52, 0.09);
}

.hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.72fr) minmax(600px, 1.28fr);
  gap: 5vw;
  align-items: center;
  min-height: 145px;
  padding: 12px 0 16px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

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

h1 {
  max-width: 650px;
  margin-bottom: 14px;
  font-size: clamp(32px, 3.4vw, 50px);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.hero-description {
  max-width: 510px;
  margin-bottom: 0;
  color: #a5a39d;
  font-size: 13px;
  line-height: 1.55;
}

.compare-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 12px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line-strong);
  background: rgba(23, 24, 23, 0.76);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.selector-grid {
  display: grid;
  grid-template-columns: 1fr 42px 1fr;
  gap: 12px;
  align-items: end;
}

.team-field {
  display: grid;
  gap: 11px;
}

.team-field > span:first-child {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line);
  background: #111211;
}

.flag-chip {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: 9px;
  border-radius: 50%;
  background: #e2e0d7;
  color: #131413;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
}

select {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 30px 0 9px;
  border: 0;
  outline: 0;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #8c8c87 50%) calc(100% - 17px) 21px / 5px 5px
      no-repeat,
    linear-gradient(135deg, #8c8c87 50%, transparent 50%) calc(100% - 12px) 21px / 5px 5px
      no-repeat;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
}

.versus {
  display: grid;
  place-items: center;
  height: 48px;
  color: #777873;
  font-family: var(--font-mono);
  font-size: 11px;
}

.compare-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  margin-top: 0;
  padding: 0 17px;
  border: 0;
  background: var(--signal);
  color: #0b0c0a;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.compare-button:hover {
  transform: translateY(-2px);
  background: #e1ff61;
}

.compare-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.form-error {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: -5px 0 -10px;
  color: var(--danger);
  font-size: 12px;
}

.results {
  padding: 30px 0 55px;
  border-top: 1px solid var(--line);
}

.results-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 10px;
}

.results-intro .eyebrow {
  margin-bottom: 5px;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(28px, 3vw, 44px);
  font-weight: 500;
  letter-spacing: -0.045em;
}

h2 span {
  color: #656660;
  font-family: var(--font-mono);
  font-size: 0.35em;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: middle;
}

.data-status.error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 109, 87, 0.1);
}

.notice {
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 191, 71, 0.26);
  background: rgba(255, 191, 71, 0.07);
  color: #d7c49d;
  font-size: 10px;
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 14px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.summary-card {
  min-width: 0;
  min-height: 68px;
  padding: 11px 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.summary-card > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.summary-values {
  display: grid;
  grid-template-columns: auto auto 1px auto auto;
  gap: 7px;
  align-items: baseline;
  justify-content: start;
  margin-top: 9px;
}

.summary-values strong {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.summary-values small {
  color: #7e807b;
  font-family: var(--font-mono);
  font-size: 10px;
}

.summary-values i {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.summary-card.active {
  box-shadow: inset 0 -2px 0 var(--signal);
  background: var(--signal-soft);
}

.section-label {
  margin: 0 0 5px;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.filter-panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.filter-header {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.filter-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.filter-groups,
.filter-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.filter-groups {
  min-width: 0;
  gap: 12px;
}

.filter-group {
  min-width: 0;
}

#metric-filter {
  max-width: min(760px, 62vw);
  overflow-x: auto;
  scrollbar-width: thin;
}

.period-filter {
  flex: 0 0 auto;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.filter-button {
  flex: 0 0 auto;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #111211;
  color: #858681;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
}

.filter-button[aria-pressed="true"] {
  border-color: var(--signal);
  background: var(--signal-soft);
  color: var(--ink);
}

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

.filtered-team + .filtered-team {
  border-left: 1px solid var(--line);
}

.filtered-team > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-light);
}

.filtered-team > header > div:first-child {
  display: flex;
  gap: 9px;
  align-items: center;
}

.team-code {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 8px;
}

.filtered-team h4 {
  margin: 0;
  font-size: 14px;
}

.filtered-average {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.filtered-average span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.filtered-average strong {
  color: var(--signal);
  font-size: 22px;
}

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

.compact-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.compact-table th,
.compact-table td {
  height: 36px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(242, 240, 232, 0.08);
  font-size: 10px;
}

.compact-table th {
  height: 28px;
  color: #696b66;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-align: left;
}

.compact-table th:nth-child(1),
.compact-table td:nth-child(1) {
  width: 31px;
}

.compact-table th:nth-child(3),
.compact-table td:nth-child(3) {
  width: 34px;
  text-align: center;
}

.compact-table th:nth-child(4),
.compact-table td:nth-child(4),
.compact-table th:nth-child(5),
.compact-table td:nth-child(5) {
  width: 48px;
  text-align: center;
}

.match-index {
  color: #555752;
  font-family: var(--font-mono);
}

.filtered-fixture {
  overflow: hidden;
}

.filtered-fixture strong,
.filtered-fixture span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filtered-fixture strong {
  font-size: 10px;
}

.filtered-fixture span {
  margin-top: 2px;
  color: #666863;
  font-family: var(--font-mono);
  font-size: 7px;
}

.outcome {
  display: inline-grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 8px;
}

.outcome-w {
  border-color: rgba(216, 255, 52, 0.32);
  color: var(--signal);
}

.outcome-l {
  color: var(--danger);
}

.filter-value {
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 13px !important;
  font-weight: 500;
}

.opponent-value {
  color: #7c7e79;
  font-family: var(--font-mono);
}

.detailed-results {
  margin-top: 12px;
  border: 1px solid var(--line);
}

.detailed-results > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
  color: #8b8d87;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.detailed-results > summary::-webkit-details-marker {
  display: none;
}

.detailed-results > summary span:last-child::after {
  content: "+";
  margin-left: 9px;
  color: var(--signal);
}

.detailed-results[open] > summary {
  border-bottom: 1px solid var(--line);
}

.detailed-results[open] > summary span:last-child::after {
  content: "−";
}

.details-body {
  padding: 12px;
}

.team-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.team-tab {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: #858681;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.team-tab[aria-selected="true"] {
  border-color: var(--signal);
  background: var(--signal-soft);
  color: var(--ink);
}

.team-tab .mini-code {
  color: var(--signal);
  font-family: var(--font-mono);
  font-size: 9px;
}

.match-list {
  display: grid;
  gap: 6px;
}

.match-card {
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.match-card summary {
  display: grid;
  grid-template-columns: 120px minmax(260px, 1fr) 96px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 12px;
  cursor: pointer;
  list-style: none;
}

.match-card summary::-webkit-details-marker {
  display: none;
}

.match-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--panel-light);
}

.match-meta {
  display: grid;
  gap: 3px;
}

.match-meta time {
  color: #cac8c1;
  font-family: var(--font-mono);
  font-size: 10px;
}

.match-meta span {
  overflow: hidden;
  color: #6f716c;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scoreline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.score-team {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  font-size: 11px;
  font-weight: 700;
}

.score-team.away {
  justify-content: flex-end;
  text-align: right;
}

.score-team span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-disc {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  background: #272927;
  color: #d8d7d0;
  font-family: var(--font-mono);
  font-size: 8px;
}

.score {
  min-width: 56px;
  padding: 6px 8px;
  background: #0d0e0d;
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.expand-label {
  justify-self: end;
  color: #7c7e79;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.expand-label::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  margin-left: 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

.match-card[open] .expand-label::after {
  content: "−";
}

.stats-scroll {
  overflow-x: auto;
  padding: 0 12px 12px;
}

.stats-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.stats-table th,
.stats-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
}

.stats-table thead th {
  color: #72746f;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-align: center;
}

.stats-table thead th:first-child,
.stats-table tbody th {
  padding-left: 0;
  text-align: left;
}

.stats-table tbody th {
  color: #bab8b1;
  font-size: 11px;
  font-weight: 600;
}

.stat-pair {
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.stat-pair span:nth-child(2) {
  color: #50524e;
  font-size: 8px;
}

.stat-pair.total {
  color: var(--signal);
}

.loading-state,
.empty-state {
  display: grid;
  min-height: 310px;
  place-items: center;
  align-content: center;
  border: 1px solid var(--line);
  color: #858681;
  font-family: var(--font-mono);
  font-size: 11px;
}

.setup-state {
  padding: 38px;
  text-align: center;
}

.setup-state strong {
  margin-bottom: 12px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
}

.setup-state p {
  max-width: 620px;
  margin-bottom: 20px;
  line-height: 1.7;
}

.setup-state code {
  color: var(--signal);
}

.setup-state a {
  padding-bottom: 5px;
  border-bottom: 1px solid var(--signal);
  color: var(--signal);
  text-decoration: none;
}

.loader {
  width: 38px;
  height: 38px;
  margin-bottom: 18px;
  border: 2px solid #323431;
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.player-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

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

.player-team + .player-team {
  border-left: 1px solid var(--line);
}

.player-team > header {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 46px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-light);
}

.player-team h4 {
  margin: 0;
  font-size: 13px;
}

.player-table th:nth-child(3),
.player-table td:nth-child(3) {
  width: 38px;
  text-align: center;
}

.player-table th:nth-child(4),
.player-table td:nth-child(4) {
  width: 48px;
  text-align: center;
}

.player-table th:nth-child(5),
.player-table td:nth-child(5),
.player-table th:nth-child(6),
.player-table td:nth-child(6) {
  width: 52px;
  text-align: center;
}

.player-name {
  overflow: hidden;
}

.player-name strong {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-name span {
  display: inline-block;
  margin-top: 2px;
  margin-right: 6px;
  color: #666863;
  font-family: var(--font-mono);
  font-size: 7px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 30px 0 38px;
  border-top: 1px solid var(--line);
  color: #595b57;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.09em;
}

footer a {
  color: inherit;
  text-decoration: none;
}

footer a:hover {
  color: var(--signal);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .page-shell {
    padding: 0 28px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: auto;
    padding: 28px 0 32px;
  }

  .compare-card {
    display: block;
    max-width: none;
  }

  .compare-button {
    margin-top: 14px;
  }

  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-groups {
    width: 100%;
    overflow-x: auto;
  }

  #metric-filter {
    max-width: 100%;
  }
}

@media (max-width: 680px) {
  .page-shell {
    padding: 0 18px;
  }

  .site-header {
    min-height: 56px;
  }

  .hero {
    padding: 24px 0 28px;
  }

  h1 {
    font-size: 40px;
  }

  .compare-card {
    padding: 14px;
  }

  .selector-grid {
    grid-template-columns: 1fr;
  }

  .versus {
    height: 20px;
  }

  .results {
    padding: 26px 0 50px;
  }

  .results-intro {
    display: grid;
    gap: 18px;
  }

  .data-status {
    justify-self: start;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-card {
    min-height: 68px;
    padding: 10px;
  }

  .filtered-comparison {
    grid-template-columns: 1fr;
  }

  .filtered-team + .filtered-team {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .player-comparison {
    grid-template-columns: 1fr;
  }

  .player-team + .player-team {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .filter-groups {
    align-items: flex-start;
    flex-direction: column;
    overflow: visible;
  }

  .filter-group {
    max-width: 100%;
    overflow-x: auto;
  }

  .period-filter {
    padding-top: 6px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .team-tabs {
    overflow-x: auto;
  }

  .team-tab {
    flex: 0 0 auto;
  }

  .match-card summary {
    grid-template-columns: 1fr auto;
    gap: 15px;
  }

  .match-meta {
    grid-column: 1 / -1;
  }

  .expand-label {
    font-size: 0;
  }

  footer {
    display: grid;
    gap: 8px;
  }
}

@media (max-width: 430px) {
  h1 {
    font-size: 34px;
  }

  .tournament-pill {
    font-size: 9px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .selector-grid {
    gap: 6px;
  }

  .scoreline {
    gap: 8px;
  }

  .score-team {
    font-size: 11px;
  }

  .team-disc {
    width: 25px;
    height: 25px;
  }
}
