.history-link {
  margin-top: auto;
  padding: 11px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--lime);
  font: 700 12px var(--mono);
  letter-spacing: .45px;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.history-link span { display: inline-block; margin-left: 5px; transition: transform .18s ease; }
.history-link:hover span { transform: translateX(4px); }
.race-card { padding-bottom: 78px; }
.race-card .race-footer { bottom: 48px; }
.race-card .history-link { position: absolute; right: 20px; bottom: 14px; left: 20px; margin: 0; padding-top: 8px; }
.elephant-card .history-link { position: absolute; right: 20px; bottom: 16px; left: 20px; display: block; margin: 0; padding-top: 8px; }
.history-modal { width: min(1180px, calc(100% - 36px)); }
.history-modal-frame { width: 100%; max-width: none; max-height: min(88vh, 940px); padding: 36px; overflow-x: hidden; overflow-y: auto; }
.history-modal-frame h2 { margin: 2px 44px 6px 0; font: 800 clamp(40px, 6vw, 72px)/.92 var(--condensed); letter-spacing: -1px; }
.history-intro { max-width: 760px; margin: 14px 0 22px; color: var(--muted); font-size: 16px; }
.history-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.history-legend span { border: 1px solid var(--line); padding: 6px 9px; color: var(--lime); font: 700 10px var(--mono); letter-spacing: .45px; }
.history-standings, .history-simple-list, .elephant-timeline { display: grid; gap: 9px; }
.history-team-card { border: 1px solid var(--line); background: #080e19; }
.history-team-card[open] { border-color: #647b35; }
.history-team-card summary { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; list-style: none; }
.history-team-card summary::-webkit-details-marker { display: none; }
.history-team-card summary:hover { background: #0d1523; }
.history-rank { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid #435166; color: var(--lime); font: 700 12px var(--mono); }
.history-team-name { display: grid; min-width: 0; }
.history-team-name b { overflow: hidden; color: var(--white); font: 700 19px var(--condensed); letter-spacing: .25px; text-overflow: ellipsis; white-space: nowrap; }
.history-team-name small, .history-result-row small { display: block; color: var(--muted); font: 500 10px var(--mono); letter-spacing: .1px; }
.history-total { color: var(--lime); font: 800 20px var(--condensed); white-space: nowrap; }
.history-team-body { display: grid; grid-template-columns: minmax(210px, .8fr) minmax(0, 1.5fr); gap: 22px; padding: 3px 16px 18px 66px; border-top: 1px solid #263142; background: #0b121f; }
.history-team-body > *, .history-week, .history-player-list { min-width: 0; }
.history-label { margin: 14px 0 9px; color: var(--muted); font: 700 9px var(--mono); letter-spacing: .65px; }
.history-player-list { display: flex; flex-wrap: wrap; gap: 7px; }
.history-player-rollup { display: grid; }
.contributor-chip { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; align-items: center; border: 1px solid #344258; background: #111b2b; padding: 7px 9px; color: #e9eff7; font: 600 12px var(--sans); }
.contributor-chip strong { color: var(--lime); font: 700 12px var(--mono); white-space: nowrap; }
.contributor-chip small { grid-column: 1/-1; color: #8796a9; font: 500 9px var(--mono); }
.history-week-list { display: grid; gap: 7px; }
.history-week { padding: 9px 10px; border: 1px solid #263449; background: #0d1625; }
.history-week-head { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font: 700 10px var(--mono); }
.history-week-head strong { color: var(--white); }
.history-missing { color: var(--muted); font: 500 11px var(--mono); }
.history-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.history-result-card { border: 1px solid var(--line); background: #09111e; }
.history-result-head { display: flex; justify-content: space-between; padding: 13px 14px; background: var(--lime); color: var(--ink); font: 800 13px var(--mono); }
.history-result-row { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); background: #0b1320; }
.history-result-card .history-result-row { border: 0; border-top: 1px solid #273447; }
.history-result-row b { font: 700 17px var(--condensed); }
.history-result-row > strong { color: var(--lime); font: 700 15px var(--mono); }
.elephant-history-card { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); background: #0b1320; }
.elephant-history-card.is-current { border-color: var(--lime); box-shadow: inset 4px 0 0 var(--lime); }
.elephant-history-card small { color: var(--lime); font: 700 10px var(--mono); }
.elephant-history-card h3 { margin: 2px 0; font: 800 24px var(--condensed); }
.elephant-history-card p { margin: 0; color: var(--muted); }

@media (max-width: 760px) {
  .history-modal-frame { padding: 28px 16px; }
  .history-modal-frame h2 { font-size: 44px; }
  .history-team-body { grid-template-columns: 1fr; padding: 3px 12px 14px; }
  .history-card-grid { grid-template-columns: 1fr; }
  .history-team-card summary { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 12px 10px; }
  .history-team-name b { font-size: 16px; }
  .history-team-name small { font-size: 8px; }
  .history-total { font-size: 16px; }
}

@media (max-width: 600px) {
  .history-modal { width: 100%; max-height: 100dvh; }
  .history-modal-frame { height: 100dvh; max-height: 100dvh; }
}
