/* Stints por kart — linha do tempo com eixo comum; tema escuro como a régua. */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

:root {
  --bg: #121418;
  --panel: #1b1e24;
  --panel-border: #2a2f38;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --team: #ff9800;
  --accent: #4a90e2;
  --ok: #4caf50;
  --pace-1: #7e57c2;
  --pace-2: #43a047;
  --pace-3: #c0ca33;
  --pace-4: #fb8c00;
  --pace-5: #e53935;
  --pace-none: #546e7a;
  --stop: #ffffff;
  --nav-height: 64px;
}

html,
body.heatmap-page {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", system-ui, sans-serif;
}

.stints {
  padding: calc(var(--nav-height) + 12px) 16px 32px;
  max-width: 1600px;
  margin: 0 auto;
  box-sizing: border-box;
}

.stints-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stints-header h1 { margin: 0 0 4px; font-size: 22px; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; max-width: 900px; }

.segmented {
  display: inline-flex;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
}

.segmented-option {
  padding: 6px 14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.segmented-option.is-active { background: var(--accent); color: #fff; }

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 14px 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.legend-title { color: var(--text); }

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: middle;
}

.pace-1 { background: var(--pace-1); }
.pace-2 { background: var(--pace-2); }
.pace-3 { background: var(--pace-3); color: #111; }
.pace-4 { background: var(--pace-4); }
.pace-5 { background: var(--pace-5); }
.pace-none { background: var(--pace-none); }
.swatch-stop { background: var(--stop); width: 4px; }
.swatch-current { background: transparent; border: 2px solid var(--text); box-sizing: border-box; }
.swatch-partial { background: transparent; border-left: 3px dashed var(--muted); border-radius: 0; width: 6px; }

.pace-1-text { color: #b39ddb; }
.pace-2-text { color: #81c784; }
.pace-3-text { color: #dce775; }
.pace-4-text { color: #ffb74d; }
.pace-5-text { color: #ef9a9a; }

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
}

/* Eixo de tempo de prova, compartilhado por todos os karts */
.axis {
  position: relative;
  height: 18px;
  margin: 8px 0 4px;
  font-size: 11px;
  color: var(--muted);
}

.axis-tick {
  position: absolute;
  transform: translateX(-50%);
}

.kart {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.kart.is-team { border-left: 4px solid var(--team); }

.kart-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.kart-id { display: flex; align-items: baseline; gap: 10px; }
.kart-number { font-size: 18px; font-weight: 700; }
.kart.is-team .kart-number { color: var(--team); }
.kart-team { color: var(--muted); font-size: 13px; }

.kart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.kart-stats b { color: var(--text); }
.stat-current { color: var(--text); }

.counter {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  font-size: 12px;
}

.counter.is-done { border-color: var(--ok); color: var(--ok); }
.counter.is-done b { color: var(--ok); }

/* Linha do tempo */
.timeline {
  position: relative;
  height: 34px;
  background:
    repeating-linear-gradient(to right, transparent 0, transparent calc(var(--hour) - 1px), #2a2f38 calc(var(--hour) - 1px), #2a2f38 var(--hour)),
    #15181d;
  border-radius: 4px;
  overflow: hidden;
}

.stint {
  position: absolute;
  top: 4px;
  bottom: 4px;
  min-width: 2px;
  border-radius: 3px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  color: #fff;
  line-height: 1.1;
  white-space: nowrap;
}

.stint.is-current { border: 2px solid var(--text); }
.stint.is-partial { border-left: 3px dashed rgba(255, 255, 255, 0.6); }
.stint-laps { font-weight: 700; font-size: 12px; }
.stint-driver { font-size: 10px; opacity: 0.85; }

.stop {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  background: var(--stop);
  opacity: 0.9;
}

/* Detalhes */
.kart-details { margin-top: 8px; font-size: 13px; }
.kart-details summary { cursor: pointer; color: var(--muted); }

.kart-details table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.kart-details th,
.kart-details td {
  padding: 5px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  white-space: nowrap;
}

.kart-details th { color: var(--muted); font-weight: 500; font-size: 12px; }
.kart-details th:nth-child(2), .kart-details td:nth-child(2) { text-align: left; }
.kart-details tr.row-current td { background: rgba(255, 255, 255, 0.05); }
.kart-details tr.row-stop td { color: var(--muted); font-style: italic; }
.muted { color: var(--muted); }

@media (max-width: 900px) {
  :root { --nav-height: 56px; }
  .stint-driver { display: none; }
  .kart-details { overflow-x: auto; }
}
