/* Top 5 — ritmo agora e melhor volta; 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;
  --danger: #f44336;
  --nav-height: 64px;
}

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

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

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

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

.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.status.is-error .status-dot { background: var(--danger); }
.status.is-error { color: var(--text); }
.status.is-replay .status-dot { background: var(--danger); }
.status.is-replay { color: var(--text); }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 12px;
  min-width: 0;
}

.panel-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.panel-sub { font-weight: 400; font-size: 12px; color: var(--muted); }

/* Equipe */
.team-panel { margin-bottom: 14px; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}

.team-card {
  border: 1px solid var(--panel-border);
  border-left: 4px solid var(--team);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.team-card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.team-card-head .kart-number { font-size: 18px; }
.team-line { display: flex; gap: 8px; align-items: baseline; margin-top: 4px; color: var(--muted); }
.team-line b { color: var(--text); }
.team-line .label { width: 48px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

/* Rankings */
.rankings {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
  align-items: start;
}

.table-wrap { overflow-x: auto; }

.rank {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.rank th {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-align: right;
  padding: 6px 8px;
  border-bottom: 1px solid var(--panel-border);
}

.rank td {
  padding: 7px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.rank th:nth-child(2), .rank td:nth-child(2),
.rank th:nth-child(3), .rank td:nth-child(3) { text-align: left; }

.rank tr.is-first td { background: rgba(74, 144, 226, 0.1); }
.rank tr.is-team td { background: rgba(255, 152, 0, 0.08); }
.rank tr.gap td { text-align: center; color: var(--muted); padding: 2px; }

.kart-number { font-weight: 700; }
.kart-number.is-team { color: var(--team); }
.driver { color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.center { text-align: center !important; }

.delta {
  position: relative;
  display: inline-block;
  min-width: 96px;
  padding-left: 6px;
  text-align: right;
}

.delta .bar {
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  background: rgba(74, 144, 226, 0.25);
  border-radius: 2px;
  z-index: 0;
}

.link {
  margin-top: 8px;
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.link[hidden] { display: none; }

@media (max-width: 900px) {
  :root { --nav-height: 56px; }
  .rankings { grid-template-columns: 1fr; }
}
