.history-page { padding-top: 28px; }
.history-heading { align-items: flex-end; margin-bottom: 22px; }
.history-heading h1 { margin-bottom: 4px; }
.history-refresh { flex: none; min-height: 44px; font-size: 22px; line-height: 1; }
.history-login { display: flex; margin: 16px auto 0; }
.history-results { margin-top: 22px; }
.history-results-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.history-results-heading h2 { margin-bottom: 3px; }
.history-results-caption { margin: 0; color: var(--ink-muted); font-size: 12px; }
.history-source-tag { flex: none; }
.history-status { min-height: 20px; margin: 0 0 7px; color: var(--ink-muted); font-size: 12px; }
.history-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.history-table { min-width: 840px; }
.history-table th { height: 44px; white-space: nowrap; }
.history-table td { min-height: 78px; padding-block: 10px; }
.history-table tbody tr { height: 82px; }
.history-time, .history-paint, .history-duration { font-variant-numeric: tabular-nums; }
.history-time { min-width: 112px; white-space: nowrap; }
.history-time strong, .history-time span { display: block; }
.history-time span { margin-top: 2px; color: var(--ink-muted); font-size: 12px; }
.history-participants { display: grid; gap: 5px; min-width: 270px; }
.history-participant { display: grid; grid-template-columns: 22px 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.history-winner-indicator { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 3px; color: var(--green); font-size: 11px; font-weight: 800; line-height: 1; }
.history-winner-indicator:not(:empty) { background: var(--green-soft); }
.history-portrait { width: 28px; height: 28px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 4px; object-fit: cover; object-position: center; background: var(--surface-muted); }
.history-portrait-fallback { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-muted); color: var(--ink-muted); font-size: 10px; font-weight: 700; }
.history-participant-info { display: grid; min-width: 0; }
.history-participant-name { color: var(--ink); font-weight: 650; overflow-wrap: anywhere; }
.history-participant-detail { color: var(--ink-muted); font-size: 11px; overflow-wrap: anywhere; }
.history-slot { color: var(--team-a); font-size: 11px; font-weight: 720; white-space: nowrap; }
.history-slot-b { color: var(--team-b); }
.history-result { min-width: 135px; max-width: 240px; }
.history-result strong, .history-result span { display: block; }
.history-result strong { line-height: 1.35; overflow-wrap: anywhere; }
.history-result span { margin-top: 3px; color: var(--ink-muted); font-size: 12px; }
.history-paint { white-space: nowrap; font-weight: 680; }
.history-duration { white-space: nowrap; }
.history-replay-link { min-height: 38px; }
.history-mobile-list { display: none; padding: 0; margin: 0; list-style: none; }
.history-mobile-item { padding: 14px 0; border-top: 1px solid var(--line); }
.history-mobile-item:last-child { border-bottom: 1px solid var(--line); }
.history-mobile-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--ink-muted); font-size: 12px; }
.history-mobile-participants { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.history-mobile-participant { display: grid; grid-template-columns: 18px 36px minmax(0, 1fr) auto; align-items: center; gap: 6px; min-width: 0; }
.history-mobile-participant .history-winner-indicator { width: 18px; height: 20px; font-size: 10px; }
.history-mobile-participant .history-portrait, .history-mobile-participant .history-portrait-fallback { width: 36px; height: 36px; }
.history-mobile-participant-info { display: grid; min-width: 0; }
.history-mobile-facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: end; margin-top: 10px; }
.history-mobile-facts .history-result { min-width: 0; max-width: none; }
.history-mobile-outcome { display: grid; gap: 2px; min-width: 0; }
.history-mobile-outcome strong { overflow-wrap: anywhere; }
.history-mobile-outcome span { color: var(--ink-muted); font-size: 12px; }
.history-mobile-stats { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 8px; color: var(--ink-muted); font-size: 12px; }
.history-mobile-stats strong { color: var(--ink); }
.history-mobile-item .history-replay-link { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.history-empty { margin-top: 4px; }
.history-empty strong { display: block; color: var(--ink); }
.history-empty p { margin: 3px 0 0; font-size: 12px; }
.history-load-error { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.history-load-error[hidden] { display: none; }
.history-load-error p { margin: 3px 0 0; font-size: 12px; }
.history-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.history-pagination p { margin: 0; color: var(--ink-muted); font-size: 12px; }
.history-page-actions { display: flex; align-items: center; gap: 7px; }
.history-page-actions .button { min-height: 44px; }
.history-page-number { min-width: 64px; color: var(--ink-muted); font-size: 12px; text-align: center; }

@media (max-width: 760px) {
  .history-page { padding-top: 22px; }
  .history-heading { align-items: flex-start; }
  .history-table-wrap { display: none !important; }
  .history-mobile-list:not([hidden]) { display: block; }
  .history-mobile-item .history-replay-link { grid-column: 2; }
}

@media (max-width: 430px) {
  .history-results-heading { align-items: flex-start; }
  .history-source-tag { max-width: 118px; white-space: normal; }
  .history-mobile-participants { gap: 6px; }
  .history-mobile-participant { grid-template-columns: 18px 32px minmax(0, 1fr) auto; gap: 6px; }
  .history-mobile-participant .history-portrait, .history-mobile-participant .history-portrait-fallback { width: 32px; height: 32px; }
  .history-participant-name { font-size: 12px; }
  .history-participant-detail { font-size: 10px; }
  .history-mobile-facts { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .history-mobile-stats { gap: 4px 10px; }
  .history-pagination { align-items: flex-start; flex-direction: column; }
  .history-page-actions { width: 100%; justify-content: space-between; }
  .history-page-actions .button { min-width: 44px; padding-inline: 9px; }
  .history-page-number { flex: 1; }
  .history-load-error { align-items: flex-start; flex-direction: column; }
}
