:root {
  --bg: #0b0d11;
  --card: #151820;
  --card-alt: #1c202b;
  --accent: #e10600;
  --gold: #f59e0b;
  --purple: #a855f7;
  --text: #f3f4f6;
  --muted: #9ca3af;
  --border: #262b36;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); padding: 20px; line-height: 1.5; }
header { max-width: 1320px; margin: 0 auto 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--accent); padding-bottom: 14px; flex-wrap: wrap; gap: 12px; }
header h1 { font-size: 1.65rem; letter-spacing: 1px; text-transform: uppercase; }
header span.live { background: var(--accent); color: #fff; padding: 5px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: 800; letter-spacing: 0.5px; }
.grid { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card.full { grid-column: 1 / -1; }
h2 { font-size: 1.05rem; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; letter-spacing: 0.6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.countdown { font-size: 1.75rem; font-weight: 900; margin: 10px 0; color: #fff; font-variant-numeric: tabular-nums; }
.next-meta { color: var(--muted); font-size: 0.92rem; margin-bottom: 12px; }
.sessions-box { background: var(--card-alt); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin: 14px 0; }
.session-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.session-row:last-child { border-bottom: none; }
.session-name { font-weight: 700; color: #e5e7eb; }
.session-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.track-box { background: #ffffff; border-radius: 8px; padding: 12px; text-align: center; margin-top: 12px; }
.track-box img { max-width: 100%; max-height: 190px; object-fit: contain; }
.track-caption { color: #374151; font-size: 0.78rem; font-weight: 700; margin-top: 6px; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; }
tr.past { opacity: 0.5; }
tr.next-row { background: rgba(225, 6, 0, 0.16); font-weight: 700; }
.pos { font-weight: 800; color: var(--accent); width: 30px; }
.pts { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.fl-badge { display: inline-block; background: rgba(168, 85, 247, 0.2); color: var(--purple); border: 1px solid var(--purple); font-size: 0.68rem; font-weight: 800; padding: 1px 5px; border-radius: 4px; margin-left: 6px; }
.tyre { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 900; font-size: 0.75rem; border: 2px solid; }
.tyre-SOFT { border-color: #ef4444; color: #ef4444; }
.tyre-MEDIUM { border-color: #eab308; color: #eab308; }
.tyre-HARD { border-color: #f3f4f6; color: #f3f4f6; }
.tyre-INTERMEDIATE { border-color: #22c55e; color: #22c55e; }
.tyre-WET { border-color: #3b82f6; color: #3b82f6; }
.rc-list { max-height: 290px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.rc-item { background: var(--card-alt); border-left: 3px solid var(--accent); padding: 9px 12px; border-radius: 6px; font-size: 0.83rem; }
.rc-item.flag-YELLOW, .rc-item.flag-DOUBLE\ YELLOW { border-left-color: #eab308; }
.rc-item.flag-GREEN { border-left-color: #22c55e; }
.rc-item.flag-RED { border-left-color: #ef4444; background: rgba(239,68,68,0.12); }
.rc-meta { font-size: 0.74rem; color: var(--muted); margin-bottom: 2px; font-weight: 700; }
.chart-row { margin-bottom: 11px; }
.chart-label { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 4px; font-weight: 600; }
.bar-bg { background: #222632; height: 10px; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }
.champ-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.champ-card { background: var(--card-alt); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 8px; padding: 14px; }
.champ-title { font-size: 1.05rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.champ-badge { display: inline-block; background: rgba(245, 158, 11, 0.18); color: var(--gold); padding: 2px 8px; border-radius: 4px; font-size: 0.78rem; font-weight: 800; margin-bottom: 8px; }
.champ-stats { font-size: 0.84rem; color: var(--muted); line-height: 1.45; }
.btn-cal { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none; padding: 8px 14px; border-radius: 6px; font-size: 0.8rem; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.4px; }
.btn-cal:hover { opacity: 0.88; }
.btn-cal.secondary { background: #262b36; border: 1px solid #3a4152; }

.header-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-status { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.btn-refresh { background: #1c202b; color: #f3f4f6; border: 1px solid #374151; padding: 5px 11px; border-radius: 5px; font-size: 0.76rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-refresh.active { border-color: #22c55e; color: #22c55e; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: #6b7280; display: inline-block; }
.btn-refresh.active .dot-live { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.h2h-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; }
.h2h-card { background: var(--card-alt); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 8px; padding: 14px; }
.h2h-team { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.5px; }
.h2h-drivers { display: flex; justify-content: space-between; font-weight: 800; font-size: 0.98rem; margin-bottom: 10px; }
.h2h-stat { margin-bottom: 8px; }
.h2h-stat-labels { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 3px; font-weight: 700; }
.h2h-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: #262b36; gap: 2px; }
.h2h-left { height: 100%; transition: width 0.5s ease; }
.h2h-right { height: 100%; opacity: 0.55; transition: width 0.5s ease; }

.h2h-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.team-badge {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
  border: 1px solid rgba(255,255,255,0.22);
  flex-shrink: 0;
}
.h2h-header .h2h-team { margin-bottom: 0; font-size: 0.86rem; color: #f3f4f6; }

html { scroll-behavior: smooth; }
.quick-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 17, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  margin: -12px auto 20px;
  max-width: 1320px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-nav::-webkit-scrollbar { display: none; }
.quick-nav a {
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}
.quick-nav a:hover, .quick-nav a:focus {
  border-color: var(--accent);
  background: rgba(225, 6, 0, 0.15);
  color: #fff;
}
.card[id] { scroll-margin-top: 62px; }
footer.senna-footer {
  max-width: 1320px;
  margin: 36px auto 10px;
  padding: 24px 20px;
  background: linear-gradient(135deg, #151820, #1c202b);
  border: 1px solid var(--border);
  border-left: 4px solid #facc15;
  border-radius: 10px;
  text-align: center;
}
.senna-quote {
  font-size: 1.05rem;
  font-style: italic;
  color: #f3f4f6;
  margin-bottom: 8px;
  line-height: 1.6;
}
.senna-author {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #facc15;
}
