.fighter-history {
  width: min(740px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: clamp(14px, 4vw, 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 68px #222a2438;
}

.fighter-history::backdrop { background: #25302660; }

.fighter-history-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.fighter-history-identity {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.5vw, 16px);
  min-width: 0;
  overflow-wrap: anywhere;
}

.fighter-history-portrait .fighter-portrait {
  --portrait-size: clamp(3.25rem, 12vw, 5rem);
  font-size: 1.2rem;
}

.fighter-history h2 { font-size: clamp(1.35rem, 4vw, 1.85rem); }
.history-period {
  min-height: 32px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 650;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.history-period::after { content: " ▾"; }
.history-period[aria-expanded="true"]::after { content: " ▴"; }

.history-period-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-surface);
}
.history-period-form label {
  display: grid;
  flex: 1 1 125px;
  gap: 4px;
  font-size: .8rem;
  font-weight: 650;
}
.history-period-form input, .history-period-actions button {
  min-width: 0;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid var(--control-edge);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.history-period-actions { display: flex; gap: 6px; }
.history-period-actions [type="submit"] {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.fighter-history-close {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--control-edge);
  border-radius: 7px;
  background: var(--control-surface);
  color: var(--text);
  font-size: .82rem;
}

.fighter-history-close:hover { border-color: var(--accent); }

.history-chart-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 12px;
}
.history-chart-heading p { color: var(--secondary); font-size: .82rem; }
#fighter-history-chart-picker {
  max-width: 100%;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--control-edge);
  border-radius: 7px;
  background: var(--control-surface);
  color: var(--text);
  font: inherit;
  font-size: .82rem;
}

.history-plot {
  position: relative;
  width: 100%;
  height: clamp(190px, 40vw, 282px);
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--control-surface);
}

.history-plot canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.history-chart-empty {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--secondary);
  font-size: .84rem;
}
.history-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 0;
  margin: 9px 0 0;
  list-style: none;
}
.history-chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-size: .74rem;
}
.history-chart-swatch {
  flex: none;
  width: 20px;
  border-top: 3px solid var(--series-color);
}
.history-chart-swatch[data-system="media"] { border-top-style: dashed; }

#fighter-history-values {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}
.history-series {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.history-series summary { cursor: pointer; font-size: .83rem; }
.history-series-name { font-weight: 650; }
.history-series-dates { display: block; margin-inline-start: 1.15em; color: var(--secondary); font-size: .75rem; }

.history-release-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 96px), 1fr));
  gap: 7px;
  margin: 8px 0 1px;
  padding: 0;
  list-style: none;
  max-height: min(42dvh, 20rem);
  overflow: auto;
}

.history-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; }
.history-actions .follow { width: auto; min-height: 44px; }
.history-actions .follow-note { margin: 0; }

.history-release-values li {
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-surface);
  font-size: .84rem;
}

.history-release-values time { color: var(--secondary); font-size: .75rem; }
.history-release-values [aria-current="date"] { border-color: var(--accent); background: #eaf2e4; }
