:root {
  --bg: #0d0d0f;
  --bg-elevated: #17171c;
  --border-subtle: #262630;
  --text: #f5f5f5;
  --muted: #aaaaaa;
  --accent: #e10600; /* F1 red-ish */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1d1d25 0, #050508 60%);
  color: var(--text);
}

/* font f1 */
@font-face {
  font-family: 'Formula1';
  src: url('/assets/fonts/Formula1-Regular.ttf') format('truetype');
}

.f1-heading {
  font-family: 'Formula1', system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .8rem 1.6rem;
  border-bottom: 2px solid var(--accent);
  background: #050507;
}

.topbar-left .brand {
  font-size: 1.1rem;
}
.topbar-left .brand-sub {
  font-size: .75rem;
  color: var(--muted);
}

.badge {
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  border: 1px solid var(--accent);
}
.live-badge {
  color: var(--accent);
}

/* layout */

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  border-right: 1px solid var(--border-subtle);
  padding: 1rem;
  background: #09090c;
}

.sidebar-section + .sidebar-section {
  margin-top: 1.5rem;
}

.sidebar-title {
  font-size: .8rem;
  margin-bottom: .5rem;
}

.select {
  width: 100%;
  padding: .4rem .5rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: #14141a;
  color: var(--text);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.list li {
  padding: .45rem .6rem;
  font-size: .85rem;
  border-bottom: 1px solid #15151e;
  cursor: pointer;
}
.list li:last-child { border-bottom: 0; }

.list li:hover {
  background: #20202a;
}
.list li.active {
  background: var(--accent);
  color: #fff;
}

.content {
  padding: 1rem 1.5rem 2rem;
  overflow: auto;
}

/* cards */

.card {
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: .9rem 1rem;
  box-shadow: 0 18px 35px rgba(0,0,0,.4);
  margin-bottom: 1rem;
}

.card-title {
  font-size: .85rem;
  margin: 0 0 .5rem;
}

/* session meta */

.session-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-title {
  margin: 0;
  font-size: 1.2rem;
}
.session-sub {
  font-size: .8rem;
  color: var(--muted);
}

/* tabs */

.tabs {
  display: flex;
  gap: .5rem;
  margin: 1rem 0 .8rem;
}

.tab {
  padding: .4rem .9rem;
  background: transparent;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  cursor: pointer;
  font-size: .8rem;
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* grids */

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

/* timing table */

.timing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}

.timing-table thead {
  background: #101018;
}
.timing-table th,
.timing-table td {
  padding: .3rem .4rem;
  border-bottom: 1px solid #1e1e28;
}
.timing-table tbody tr:hover {
  background: #20202a;
  cursor: pointer;
}

/* strategy */

.strategy-container {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.strategy-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.strategy-label {
  width: 130px;
  font-size: .75rem;
}

.strategy-bar {
  flex: 1;
  display: flex;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: #1c1c25;
}

.strategy-stint {
  height: 100%;
}

/* track placeholder */

.track-placeholder {
  height: 320px;
  border-radius: 12px;
  border: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  color: var(--muted);
}

/* responsive */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

#telemetryChart {
  height: 260px;
}
#lapChart {
  height: 260px;
}
#positionChart,
#weatherChart {
  height: 260px;
}