/* Focused, independently scrollable lap, pit-stop and penalty summaries. */
.car-drawer { width: min(600px, 100vw); --history-pit: #78baff; --history-penalty: #ffad72; }
html[data-theme="light"] .car-drawer { --history-pit: #1765a8; --history-penalty: #a54a0b; }
.car-drawer .drawer-header { padding: 12px 18px; }
.car-drawer .drawer-body { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.lap-drawer-overview { flex: none; display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.lap-drawer-overview .drawer-number { width: 42px; height: 42px; font-size: 20px; border-radius: 8px; }
.lap-drawer-identity { min-width: 0; flex: 1; }
.lap-drawer-identity h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; font-size: 18px; line-height: 1.25; font-weight: 650; }
.lap-drawer-context { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; color: var(--muted); font-size: 11px; }
.lap-drawer-context .class-badge { font-size: 10px; padding: 2px 5px; }
.lap-drawer-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 18px 12px; color: var(--muted); font-size: 11px; }
.lap-drawer-summary .lh-source-demo { color: var(--accent); }
.car-lap-history { display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; border-top: 1px solid var(--line); }
.lh-tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.lh-tab { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 38px; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.lh-tab:hover { background: var(--surface); color: var(--text); }
.lh-tab[aria-selected="true"] { background: var(--surface-raised); color: var(--text); border-color: var(--line); }
.lh-tab-pits { --tab-color: var(--history-pit); }
.lh-tab-penalties { --tab-color: var(--history-penalty); }
.lh-tab-pits[aria-selected="true"], .lh-tab-penalties[aria-selected="true"] { border-color: color-mix(in srgb, var(--tab-color) 65%, transparent); }
.lh-tab-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--tab-color); }
.lh-tab-count { color: var(--muted); font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.lh-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; }
.lh-heading { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; }
.lh-heading h3 { margin: 0; font-size: 11px; font-weight: 600; white-space: nowrap; }
.lh-heading > span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.lh-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--line) transparent; }
.lh-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lh-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 12px; text-align: left; font-variant-numeric: tabular-nums; }
.lh-table caption { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; clip: rect(0,0,0,0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.lh-lap-col { width: 16%; }
.lh-driver-col { width: 54%; }
.lh-time-col { width: 30%; }
.lh-table thead { position: sticky; top: 0; z-index: 1; }
.lh-table thead th { padding: 9px 8px; border-block: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .055em; }
.lh-table td, .lh-table tbody th { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.lh-table th:first-child { padding-left: 18px; }
.lh-table th:last-child, .lh-table td:last-child { padding-right: 18px; text-align: right; }
.lh-table tbody th { font-weight: 550; }
.lh-table tbody tr:hover, .lh-table tbody tr:focus { background: var(--surface-hover); }
.lh-table tbody tr:focus { outline: 1px solid var(--muted); outline-offset: -1px; }
.lh-has-pit > th { box-shadow: inset 3px 0 var(--history-pit); }
.lh-has-penalty > th { box-shadow: inset 3px 0 var(--history-penalty); }
.lh-has-pit.lh-has-penalty > th { box-shadow: none; background-image: linear-gradient(var(--history-pit) 50%, var(--history-penalty) 50%); background-size: 3px 100%; background-position: left; background-repeat: no-repeat; }
.lh-driver { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; overflow-wrap: anywhere; line-height: 1.4; }
.lh-event-marks { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.lh-event-tag-pit { --event-color: var(--history-pit); }
.lh-event-tag-penalty { --event-color: var(--history-penalty); }
.lh-event-tag { padding: 3px 6px; border: 1px solid color-mix(in srgb, var(--event-color) 40%, transparent); border-radius: 4px; background: color-mix(in srgb, var(--event-color) 9%, transparent); color: var(--event-color); font-size: 10px; line-height: 1.4; font-weight: 600; }
.lh-event-tag:hover { background: color-mix(in srgb, var(--event-color) 20%, transparent); }
.lh-time { white-space: nowrap; }
.lh-time small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; white-space: normal; }
.lh-unknown { color: var(--muted); font-size: 10px; font-weight: 400; }
.lh-compare { display: inline-flex; align-items: center; justify-content: flex-start; gap: 4px; padding: 2px 0; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.lh-compare > span { color: var(--subtle); font-size: 10px; }
.lh-compare:hover, .lh-compare:hover > span { color: var(--accent); }
.lh-compare:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.lh-empty, .lh-table .lh-empty { padding: 35px 22px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.65; }
.lh-empty strong { display: block; color: var(--text); font-weight: 600; }
.lh-empty p { max-width: 330px; margin: 8px auto 0; font-size: 11px; }
.lh-event-list { padding: 0 18px 12px; }
.lh-event-row { border-bottom: 1px solid var(--line); }
.lh-event-row-pit { --event-color: var(--history-pit); }
.lh-event-row-penalty { --event-color: var(--history-penalty); }
.lh-event-row > summary { display: flex; align-items: center; gap: 10px; padding: 15px 0; list-style: none; cursor: pointer; }
.lh-event-row > summary::-webkit-details-marker { display: none; }
.lh-event-row > summary:hover .lh-event-main > strong { color: var(--event-color); }
.lh-event-row > summary:focus-visible { outline-offset: -2px; border-radius: 4px; }
.lh-event-symbol { flex: none; padding: 4px 5px; border-radius: 4px; background: color-mix(in srgb, var(--event-color) 10%, transparent); color: var(--event-color); font-size: 9px; font-weight: 750; letter-spacing: .03em; }
.lh-event-main { flex: 1; min-width: 0; }
.lh-event-main > strong { display: block; font-size: 12px; line-height: 1.5; font-weight: 550; overflow-wrap: anywhere; }
.lh-event-main > small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.lh-event-value { flex: none; max-width: 26%; color: var(--event-color); font-size: 12px; line-height: 1.5; font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.lh-disclosure { flex: none; color: var(--muted); font-size: 17px; transition: transform .15s ease; }
.lh-event-row[open] .lh-disclosure { transform: rotate(180deg); }
.lh-event-detail { margin-bottom: 14px; padding: 14px; border-left: 2px solid var(--event-color); border-radius: 0 6px 6px 0; background: var(--surface); }
.lh-event-detail dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.lh-event-detail dt { margin: 0 0 4px; color: var(--muted); font-size: 10px; }
.lh-event-detail dd { margin: 0; font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lh-detail-wide { grid-column: 1 / -1; }
.lh-event-note { margin-top: 12px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.lh-lap-link { display: inline-block; margin-top: 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: var(--surface-raised); font-size: 11px; }
.lh-lap-link:hover { border-color: var(--event-color); }
.lh-note { flex: none; margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 10px; line-height: 1.5; }
.lap-drawer-actions { display: flex; flex: none; gap: 8px; padding: 10px 18px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.lap-drawer-actions .btn { flex: 1; min-width: 0; justify-content: center; padding: 9px 10px; font-size: 11px; }
.lap-drawer-actions .icon { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .car-drawer .drawer-header { padding: 10px 12px; }
  .lap-drawer-overview { padding: 13px 12px 10px; gap: 9px; }
  .lap-drawer-identity h2 { font-size: 16px; }
  .lap-drawer-context { font-size: 10px; }
  .lap-drawer-summary { padding: 0 12px 10px; font-size: 10px; }
  .lh-tabs { padding: 8px; gap: 3px; }
  .lh-tab { gap: 5px; padding: 7px 5px; font-size: 11px; min-height: 40px; }
  .lh-tab-count { font-size: 9px; }
  .lh-tab-dot { width: 5px; height: 5px; }
  .lh-heading { padding: 9px 12px; }
  .lh-heading h3 { font-size: 10px; }
  .lh-heading > span { font-size: 9px; }
  .lh-table { font-size: 11px; }
  .lh-table thead th { padding: 8px 6px; font-size: 8px; letter-spacing: .025em; }
  .lh-table td, .lh-table tbody th { padding: 9px 6px; }
  .lh-table th:first-child { padding-left: 12px; }
  .lh-table th:last-child, .lh-table td:last-child { padding-right: 12px; }
  .lh-lap-col { width: 15%; }
  .lh-driver-col { width: 54%; }
  .lh-time-col { width: 31%; }
  .lh-compare > span { display: none; }
  .lh-event-tag { font-size: 9px; padding: 3px 5px; }
  .lh-unknown { font-size: 9px; }
  .lh-event-list { padding: 0 12px 10px; }
  .lh-event-row > summary { gap: 7px; padding: 13px 0; }
  .lh-event-symbol { font-size: 8px; }
  .lh-event-main > strong, .lh-event-value { font-size: 11px; }
  .lh-event-main > small { font-size: 9px; }
  .lh-event-detail { padding: 12px; }
  .lh-note { padding: 8px 12px; font-size: 9px; }
  .lap-drawer-actions { padding: 9px 12px max(12px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .lh-disclosure { transition: none; } }
