.stats-h2h {
  --h2h-win: #9ecc71;
  --h2h-draw: #bdc3c7;
  --h2h-loss: #a74c3c;
  --h2h-accent: #2476ad;
  --h2h-accent-soft: #e9f4fb;
  --h2h-ink: #111820;
  --h2h-soft: #283545;
  --h2h-muted: #667281;
  --h2h-line: rgba(17, 24, 32, 0.1);
}

.stats-h2h-pickers {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 54px minmax(210px, 1fr);
  align-items: end;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(36, 118, 173, 0.13);
  border-radius: 16px;
  background: rgba(36, 118, 173, 0.045);
}

.stats-h2h-versus {
  display: grid;
  align-self: end;
  justify-items: center;
  gap: 7px;
}

.stats-h2h-versus > span {
  color: var(--h2h-soft);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.85px;
  line-height: 1;
  text-transform: uppercase;
}

.stats-h2h-versus .stats-h2h-swap {
  grid-column: auto;
  margin: 0;
}

.stats-h2h .stats-field > span {
  color: var(--h2h-soft);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.85px;
}

.stats-page .stats-h2h .stats-field select {
  min-height: 46px;
  color: var(--h2h-ink);
  background: rgba(255, 255, 255, 0.98);
  font-size: 13px;
  font-weight: 600;
}

.stats-h2h .h2h-vs {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 2px;
  border: 1px solid rgba(17, 24, 32, 0.1);
  border-radius: 50%;
  color: var(--h2h-soft);
  background: #fff;
  font-family: var(--thl-display-font);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.35px;
  text-transform: uppercase;
}

.stats-h2h-swap {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(36, 118, 173, 0.2);
  border-radius: 12px;
  color: var(--stats-blue-deep);
  background: var(--stats-blue-pale);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.stats-h2h-swap:hover {
  border-color: rgba(36, 118, 173, 0.38);
  background: #dff1fb;
  transform: translateY(-1px);
}

.stats-h2h-swap svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.stats-h2h-scope {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 11px 2px 0;
  color: var(--h2h-muted);
  font-size: 11px;
  line-height: 1.4;
}

.stats-h2h-scope i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--stats-green);
  box-shadow: 0 0 0 4px rgba(37, 139, 102, 0.1);
}

#h2hResult {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

#h2hResult > .h2h-card:first-child,
#h2hResult > .h2h-card:nth-child(2),
#h2hResult > .h2h-card:nth-child(7),
#h2hResult > .h2h-card:nth-child(8) {
  grid-column: 1 / -1;
}

.h2h-card {
  min-width: 0;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--h2h-line);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 22px rgba(20, 32, 44, 0.07);
}

.h2h-card h3 {
  margin: 0 0 14px;
  color: var(--h2h-ink);
  font-family: var(--thl-display-font);
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.15px;
  line-height: 1.2;
}

.h2h-card--nested {
  margin: 0;
  padding: 14px;
  border-radius: 13px;
  background: rgba(248, 251, 253, 0.96);
  box-shadow: none;
}

#h2hResult > .h2h-card:first-child {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 50% -65%, rgba(36, 118, 173, 0.42), transparent 48%),
    linear-gradient(145deg, #111b25, #22313e);
  box-shadow: 0 16px 34px rgba(12, 20, 28, 0.18);
}

.h2h-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  text-align: center;
}

.h2h-head-team {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.h2h-head-logo {
  display: block;
  width: 112px;
  height: 112px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  object-fit: contain;
  object-position: center;
}

.h2h-head-logo--empty {
  display: grid;
  place-items: center;
  color: var(--stats-blue-deep);
  font-family: var(--thl-display-font);
  font-size: 16px;
  font-weight: 800;
}

.h2h-head .team-name {
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  font-family: var(--thl-display-font);
  font-size: 20px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h2h-head .gp {
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.h2h-head .gp b {
  display: block;
  margin-top: 2px;
  color: #fff;
  font-family: var(--thl-display-font);
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.team-tag {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.team-tag.a {
  color: #78c8f5;
}

.team-tag.b {
  color: #f28a72;
}

.wdl-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 13px;
  color: var(--h2h-muted);
  font-size: 11px;
}

.wdl-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: 0;
}

.dot-win {
  background: var(--h2h-win);
}

.dot-draw {
  background: var(--h2h-draw);
}

.dot-loss {
  background: var(--h2h-loss);
}

.wdl-wrap {
  display: grid;
  gap: 10px;
}

.wdl-row {
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(180px, 1fr) 92px;
  align-items: center;
  gap: 12px;
}

.wdl-row .lbl {
  overflow: hidden;
  color: var(--h2h-soft);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wdl-row .val {
  color: var(--h2h-ink);
  font-family: var(--thl-display-font);
  font-size: 13px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.wdl-bar {
  display: flex;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f2;
}

.wdl-seg {
  height: 100%;
}

.wdl-seg.win {
  background: var(--h2h-win);
}

.wdl-seg.draw {
  background: var(--h2h-draw);
}

.wdl-seg.loss {
  background: var(--h2h-loss);
}

.cmp-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(17, 24, 32, 0.075);
}

.cmp-row:last-child {
  border-bottom: 0;
}

.cmp-row .a,
.cmp-row .b {
  color: var(--h2h-ink);
  font-family: var(--thl-display-font);
  font-size: 16px;
  font-weight: 750;
}

.cmp-row .b {
  text-align: right;
}

.cmp-row .lab {
  color: var(--h2h-muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.cmp-mini {
  grid-column: 1 / -1;
  display: flex;
  height: 6px;
  margin-top: 1px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f2;
}

.cmp-mini .a-fill {
  height: 100%;
  background: var(--stats-blue);
}

.cmp-mini .b-fill {
  height: 100%;
  background: var(--stats-orange);
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.total-box {
  min-width: 0;
  padding: 13px 10px;
  text-align: center;
  border: 1px solid rgba(17, 24, 32, 0.08);
  border-radius: 12px;
  background: rgba(36, 118, 173, 0.045);
}

.total-box .num {
  color: var(--h2h-ink);
  font-family: var(--thl-display-font);
  font-size: 23px;
  font-weight: 800;
  line-height: 1.05;
}

.total-box .cap {
  margin-top: 5px;
  color: var(--h2h-muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
}

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

.scorer {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
}

.scorer .num {
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 30px;
  padding-inline: 7px;
  border-radius: 8px;
  color: #fff;
  background: var(--stats-blue);
  font-family: var(--thl-display-font);
  font-size: 11px;
  font-weight: 750;
}

.scorer .nm {
  overflow: hidden;
  color: var(--h2h-soft);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scorer .g {
  margin-left: auto;
  color: var(--h2h-ink);
  font-family: var(--thl-display-font);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.scorer .g small {
  color: var(--h2h-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
}

.pos-sub {
  margin: 6px 0 4px;
  color: var(--h2h-soft);
  font-size: 11px;
  font-weight: 800;
}

.pos-table {
  width: 100%;
  margin-top: 7px;
  border-collapse: collapse;
}

.pos-table th,
.pos-table td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(17, 24, 32, 0.07);
  color: var(--h2h-soft);
  font-size: 12px;
  text-align: left;
}

.pos-table th {
  color: var(--h2h-muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.65px;
  text-transform: uppercase;
}

.pos-table td:last-child,
.pos-table th:last-child {
  text-align: right;
}

.pos-bar {
  height: 6px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edef;
}

.pos-bar > span {
  display: block;
  height: 100%;
  background: var(--h2h-win);
}

.last5 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 5px;
}

.last5 .chip {
  min-width: 42px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-family: var(--thl-display-font);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.chip-A {
  background: var(--h2h-win);
}

.chip-B {
  background: var(--h2h-loss);
}

.chip-draw {
  background: var(--h2h-draw);
}

.h2h-muted {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--h2h-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

#h2hResult > .h2h-card:first-child.h2h-muted {
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 1050px) {
  .stats-h2h-pickers {
    grid-template-columns: minmax(190px, 1fr) 54px minmax(190px, 1fr);
  }
}

@media (max-width: 760px) {
  .stats-h2h-pickers {
    grid-template-columns: 1fr 46px 1fr;
    gap: 12px;
    padding: 13px;
  }

  .stats-h2h-pickers .h2h-vs {
    width: 38px;
    height: 38px;
  }

  .stats-h2h-swap {
    justify-self: center;
  }

  #h2hResult {
    grid-template-columns: 1fr;
  }

  #h2hResult > .h2h-card {
    grid-column: 1;
  }

  .h2h-head {
    grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
    gap: 10px;
  }

  .h2h-head-logo {
    width: 84px;
    height: 84px;
    padding: 8px;
    border-radius: 16px;
  }

  .h2h-head .team-name {
    font-size: 15px;
  }

  .h2h-head .gp b {
    font-size: 30px;
  }

  .wdl-row {
    grid-template-columns: minmax(76px, 108px) minmax(100px, 1fr) 72px;
    gap: 8px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .stats-h2h-pickers {
    grid-template-columns: 1fr;
  }

  .stats-h2h-pickers .h2h-vs,
  .stats-h2h-swap {
    grid-column: 1;
  }

  .stats-h2h-versus {
    grid-column: 1;
  }

  .stats-h2h .h2h-vs {
    justify-self: center;
    margin: -2px 0;
  }

  .h2h-card {
    padding: 14px;
    border-radius: 14px;
  }

  .h2h-head {
    grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
  }

  .h2h-head-logo {
    width: 68px;
    height: 68px;
    padding: 7px;
    border-radius: 14px;
  }

  .h2h-head .team-name {
    font-size: 13px;
    white-space: normal;
  }

  .h2h-head .gp {
    font-size: 8px;
  }

  .h2h-head .gp b {
    font-size: 25px;
  }

  .wdl-row {
    grid-template-columns: 1fr 62px;
  }

  .wdl-row .wdl-bar {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .wdl-row .val {
    grid-column: 2;
  }

  .cmp-row .lab {
    white-space: normal;
    text-align: center;
  }
}
