.historical-summary-grid:has(.historical-scoreboard-layout) {
  display: block;
}

.historical-panel__note:empty {
  display: none;
}

#match-detail-timeline-section[hidden] {
  display: none !important;
}

.historical-table--players tbody tr.historical-player-row--allies td:first-child {
  box-shadow: inset 4px 0 0 rgba(104, 162, 214, 0.82);
}

.historical-table--players tbody tr.historical-player-row--axis td:first-child {
  box-shadow: inset 4px 0 0 rgba(190, 82, 64, 0.82);
}

.historical-table--players tbody tr.historical-player-row--unknown td:first-child {
  box-shadow: inset 4px 0 0 rgba(159, 168, 141, 0.5);
}

.historical-table--players tbody tr.historical-player-row--allies {
  background: linear-gradient(90deg, rgba(74, 126, 178, 0.14), transparent 42%);
}

.historical-table--players tbody tr.historical-player-row--axis {
  background: linear-gradient(90deg, rgba(156, 66, 49, 0.16), transparent 42%);
}

.historical-table--players tbody tr.historical-player-row--unknown {
  background: linear-gradient(90deg, rgba(159, 168, 141, 0.08), transparent 42%);
}

.historical-table--players {
  min-width: 760px;
}

.historical-player-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 190px));
  gap: 10px;
  align-items: end;
}

.historical-player-controls[hidden] {
  display: none;
}

.historical-player-control {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.historical-player-control span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-player-control input,
.historical-player-control select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(159, 168, 141, 0.28);
  border-radius: 8px;
  background: rgba(10, 13, 10, 0.82);
  color: var(--text);
  font: inherit;
}

.historical-player-control input::placeholder {
  color: var(--muted);
}

.historical-player-control input:focus-visible,
.historical-player-control select:focus-visible {
  outline: 2px solid rgba(210, 182, 118, 0.72);
  outline-offset: 1px;
}

.historical-player-row {
  outline: 0;
}

.historical-player-row.is-inactive {
  color: var(--muted);
}

.historical-player-row.is-inactive .historical-player-row__details-button span:first-child {
  color: var(--text-soft);
  font-style: italic;
}

.historical-player-row:hover td,
.historical-player-row:focus-within td,
.historical-player-row.is-expanded td {
  background: rgba(210, 182, 118, 0.06);
}

.historical-player-row__details-button:focus-visible {
  outline: 2px solid rgba(210, 182, 118, 0.78);
  outline-offset: -2px;
}

.historical-player-row__details-button {
  display: flex;
  width: 100%;
  min-width: 220px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.historical-player-row__details-button span:first-child {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.historical-player-row__details-button span:last-child {
  flex: 0 0 auto;
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(210, 182, 118, 0.28);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.historical-player-detail-row {
  display: none;
}

.historical-player-detail-row.is-open {
  display: table-row;
}

.historical-player-detail-row td {
  padding: 0 12px 16px;
  background: rgba(7, 9, 7, 0.76);
  border-bottom-color: rgba(210, 182, 118, 0.16);
}

.historical-player-stats-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(210, 182, 118, 0.18);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(19, 24, 17, 0.96), rgba(10, 13, 10, 0.98)),
    rgba(10, 13, 10, 0.96);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.historical-player-stats-panel__header {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.historical-player-stats-panel__header p,
.historical-player-stats-panel__section p,
.historical-player-stats-panel__empty {
  margin: 0;
  color: var(--muted);
}

.historical-player-stats-panel__header p {
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.historical-player-stats-panel__header h4,
.historical-player-stats-panel__section h5 {
  margin: 0;
  color: var(--text);
}

.historical-player-stats-panel__header h4 {
  font-size: 1.08rem;
}

.historical-player-stats-panel__summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(70px, 1fr));
  gap: 8px;
}

.historical-player-stats-panel__summary article {
  padding: 9px 10px;
  border: 1px solid rgba(159, 168, 141, 0.14);
  border-radius: 10px;
  background: rgba(13, 17, 12, 0.68);
}

.historical-player-stats-panel__summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-player-stats-panel__summary strong {
  color: var(--text);
}

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

.historical-player-stats-panel__section {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 13px;
  border: 1px solid rgba(159, 168, 141, 0.14);
  border-radius: 12px;
  background: rgba(13, 17, 12, 0.52);
}

.historical-player-stats-panel__section--wide {
  grid-column: 1 / -1;
}

.historical-player-stats-panel__profiles {
  padding: 13px;
}

.historical-player-profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.historical-player-profile-links a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 11px;
  border: 1px solid rgba(210, 182, 118, 0.34);
  border-radius: 999px;
  color: var(--accent-warm);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.historical-player-profile-links a:hover,
.historical-player-profile-links a:focus-visible {
  border-color: rgba(210, 182, 118, 0.62);
  color: var(--text);
}

.historical-player-stats-panel__section h5 {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-player-stats-panel__section ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.historical-player-stats-panel__section li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
}

.historical-player-stats-panel__section li span {
  overflow: hidden;
  min-width: 0;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.historical-player-stats-panel__section li strong {
  color: var(--accent-strong);
}

.historical-player-matchups {
  display: grid;
  gap: 0;
  overflow-x: auto;
}

.historical-player-matchups [role="row"] {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(72px, auto));
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(159, 168, 141, 0.1);
}

.historical-player-matchups [role="row"]:last-child {
  border-bottom: 0;
}

.historical-player-matchups [role="columnheader"] {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-player-matchups [role="cell"] {
  color: var(--text-soft);
}

.historical-player-matchups strong[role="cell"] {
  color: var(--text);
}

.historical-player-team-cell {
  white-space: nowrap;
}

.historical-player-team-badge {
  display: inline-flex;
  align-items: center;
  min-width: 96px;
  justify-content: center;
  padding: 5px 10px;
  border: 1px solid rgba(159, 168, 141, 0.24);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.historical-player-team-badge--allies {
  border-color: rgba(118, 175, 229, 0.46);
  background: rgba(61, 109, 163, 0.2);
  color: #c8e1ff;
}

.historical-player-team-badge--axis {
  border-color: rgba(213, 105, 83, 0.48);
  background: rgba(129, 45, 35, 0.22);
  color: #f2beb2;
}

.historical-player-team-badge--unknown {
  border-color: rgba(159, 168, 141, 0.28);
  background: rgba(159, 168, 141, 0.1);
  color: var(--muted);
}

@media (max-width: 760px) {
  .historical-player-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .historical-player-control--search {
    grid-column: 1 / -1;
  }

  .historical-player-stats-panel__header,
  .historical-player-stats-panel__grid {
    grid-template-columns: 1fr;
  }

  .historical-player-stats-panel__summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .historical-player-matchups [role="row"] {
    min-width: 520px;
  }
}

.historical-scoreboard-layout {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.historical-scoreboard-layout__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px) minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 28px 30px;
  border: 1px solid rgba(210, 182, 118, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 10%, rgba(210, 182, 118, 0.1), transparent 44%),
    linear-gradient(180deg, rgba(11, 14, 10, 0.72), rgba(11, 14, 10, 0.94));
  box-shadow: var(--shadow-soft);
}

.historical-scoreboard-side {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 148px;
}

.historical-scoreboard-side--axis {
  grid-template-columns: minmax(0, 1fr) 124px;
  text-align: right;
}

.historical-scoreboard-side--axis .historical-scoreboard-side__emblem {
  order: 2;
}

.historical-scoreboard-side--axis .historical-scoreboard-side__text {
  order: 1;
}

.historical-scoreboard-side.is-emblem-missing,
.historical-scoreboard-side--axis.is-emblem-missing {
  grid-template-columns: minmax(0, 1fr);
}

.historical-scoreboard-side__emblem {
  width: 124px;
  height: 124px;
  border-radius: 999px;
  object-fit: contain;
  padding: 10px;
  border: 1px solid rgba(210, 182, 118, 0.26);
  background:
    radial-gradient(circle at center, rgba(210, 182, 118, 0.15), transparent 60%),
    rgba(7, 9, 7, 0.72);
}

.historical-scoreboard-side__text {
  display: grid;
  gap: 5px;
}

.historical-scoreboard-side__text strong {
  color: var(--text);
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.historical-scoreboard-side__text em {
  color: var(--accent-strong);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.historical-scoreboard-side.is-winner .historical-scoreboard-side__emblem {
  border-color: rgba(210, 182, 118, 0.62);
  box-shadow: 0 0 26px rgba(210, 182, 118, 0.14);
}

.historical-scoreboard-center {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.historical-scoreboard-center__timer {
  color: var(--text-soft);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-scoreboard-center__score {
  color: var(--text);
  font-size: clamp(4.6rem, 8.6vw, 7.6rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.historical-scoreboard-center__map {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 800;
}

.historical-scoreboard-center__mode,
.historical-scoreboard-center__winner {
  color: var(--text-soft);
  font-size: 0.86rem;
}

.historical-scoreboard-center__winner {
  color: var(--accent-strong);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.historical-scoreboard-layout__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
}

.historical-scoreboard-layout__meta article {
  padding: 13px 14px;
  border: 1px solid rgba(159, 168, 141, 0.14);
  border-radius: 16px;
  background: rgba(13, 17, 12, 0.44);
}

.historical-scoreboard-layout__meta span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.historical-scoreboard-layout__meta strong {
  display: block;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

@media (max-width: 920px) {
  .historical-scoreboard-layout__main {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .historical-scoreboard-center {
    order: -1;
  }

  .historical-scoreboard-side,
  .historical-scoreboard-side--axis {
    grid-template-columns: 96px minmax(0, 1fr);
    text-align: left;
  }

  .historical-scoreboard-side--axis .historical-scoreboard-side__emblem,
  .historical-scoreboard-side--axis .historical-scoreboard-side__text {
    order: initial;
  }

  .historical-scoreboard-side__emblem {
    width: 96px;
    height: 96px;
  }
}


.historical-player-control--team-toggle {
  border: 0;
  margin: 0;
  padding: 0;
}

.historical-player-control--team-toggle legend {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.historical-player-team-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.historical-player-team-toggle label {
  cursor: pointer;
}

.historical-player-team-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.historical-player-team-toggle span {
  border: 1px solid rgba(210, 196, 130, 0.34);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.55rem 0.8rem;
  text-transform: uppercase;
}

.historical-player-team-toggle input:checked + span {
  background: rgba(210, 196, 130, 0.12);
  border-color: rgba(210, 196, 130, 0.72);
  color: var(--text);
}

.historical-player-team-toggle input:focus-visible + span {
  outline: 2px solid rgba(210, 196, 130, 0.9);
  outline-offset: 2px;
}

.historical-player-stats-panel__profiles code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  word-break: break-all;
}


/* Player controls refinement: team selector above search/sort. */
.historical-player-control--team-toggle {
  border: 0;
  grid-column: 1 / -1;
  margin: 0;
  order: -1;
  padding: 0;
}

.historical-player-control--team-toggle legend {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 0.45rem;
  text-transform: uppercase;
}

.historical-player-team-toggle {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.historical-player-team-toggle label {
  cursor: pointer;
}

.historical-player-team-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.historical-player-team-toggle span {
  border: 1px solid rgba(210, 196, 130, 0.34);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.58rem 0.9rem;
  text-transform: uppercase;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.historical-player-team-toggle__item--all input:checked + span {
  background: rgba(210, 196, 130, 0.13);
  border-color: rgba(210, 196, 130, 0.78);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(210, 196, 130, 0.18);
}

.historical-player-team-toggle__item--allies span {
  border-color: rgba(109, 171, 255, 0.42);
  color: #b8d7ff;
}

.historical-player-team-toggle__item--allies input:checked + span {
  background: rgba(72, 135, 220, 0.24);
  border-color: rgba(133, 190, 255, 0.9);
  color: #e4f1ff;
  box-shadow: 0 0 0 1px rgba(109, 171, 255, 0.22);
}

.historical-player-team-toggle__item--axis span {
  border-color: rgba(225, 113, 86, 0.48);
  color: #ffb6a6;
}

.historical-player-team-toggle__item--axis input:checked + span {
  background: rgba(170, 72, 54, 0.28);
  border-color: rgba(255, 143, 113, 0.92);
  color: #ffe1d9;
  box-shadow: 0 0 0 1px rgba(225, 113, 86, 0.24);
}

.historical-player-team-toggle input:focus-visible + span {
  outline: 2px solid rgba(210, 196, 130, 0.9);
  outline-offset: 2px;
}

.historical-player-stats-panel__profiles code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  word-break: break-all;
}
