/* V0.9.6: self-hosted fonts (web/fonts, SIL Open Font License 1.1) */
@font-face { font-family: "Oswald"; font-style: normal; font-display: swap; font-weight: 200 700; src: url("../fonts/oswald-latin-wght.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 500; src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 600; src: url("../fonts/ibm-plex-mono-latin-600.woff2") format("woff2"); }

:root {
  --asphalt: #14171A;
  --panel: #1B1F23;
  --panel-raised: #20252A;
  --hairline: #2C3136;
  --text: #ECEDEE;
  --text-muted: #8B9199;
  --signal: #E0472B;
  --signal-dim: #7A2A20;
  --valid: #4CA771;
  --gold: #D8A83E;

  --font-display: "Oswald", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 0px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--asphalt);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, .btn, nav {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- layout shell ---------- */

.frame {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.pitwall {
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.pitwall__brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 32px;
}

.pitwall__brand-mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--text);
}

.pitwall__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--signal);
}

.pitwall__links {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
/* V0.9.6: the menu in groups */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group__label { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); opacity: 0.7; padding: 0 12px 4px; }
.nav-group--foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--hairline); }
.nav-group--foot a { font-size: 14px; padding: 7px 12px; }

.pitwall__links a {
  padding: 10px 12px;
  font-size: 15px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
}

.pitwall__links a:hover {
  color: var(--text);
  background: var(--panel-raised);
}

.pitwall__links a.active {
  color: var(--text);
  border-left-color: var(--signal);
  background: var(--panel-raised);
}

.pitwall__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.on { background: var(--valid); }

.mobile-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
  padding: 14px 16px;
}

.mobile-bar__brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text);
}
.mobile-bar__brand span { color: var(--signal); font-weight: 700; }

.mobile-bar__toggle {
  background: none;
  border: 1px solid var(--hairline);
  color: var(--text);
  font-size: 18px;
  padding: 4px 10px;
  cursor: pointer;
}

.panel {
  padding: 40px 48px;
  max-width: 1120px;
}

@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .pitwall {
    position: fixed;
    inset: 0 20% 0 0;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    height: 100vh;
  }
  .pitwall.open { transform: translateX(0); }
  .mobile-bar { display: flex; }
  .panel { padding: 24px 20px; }
}

/* ---------- typography ---------- */

h1 {
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 6px;
}

h2 {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 16px;
  color: var(--text);
}
/* V0.9.6: a heading that follows a card / table gets room above it */
.card + h2, .card + h3, table + h2, .empty-state + h2, .notice + h2, .timing-table + h2, div + h2 { margin-top: 32px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 32px;
  max-width: 60ch;
}

.section {
  margin-bottom: 40px;
}

.hero {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 32px;
}

/* ---------- form controls ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-width: 360px;
}

.field label {
  font-size: 13px;
  color: var(--text-muted);
}

.field input {
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
}

.field input:focus {
  border-color: var(--signal);
}

.inline-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.btn {
  background: var(--signal);
  color: #14171A;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  border-radius: var(--radius);
}

.btn:hover { background: #f0553a; }
.btn:disabled { background: var(--hairline); color: var(--text-muted); cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text);
}

.btn--ghost:hover { border-color: var(--text-muted); background: var(--panel-raised); }

.btn--danger {
  background: transparent;
  border: 1px solid var(--signal-dim);
  color: var(--signal);
}

.btn--danger:hover { background: var(--signal-dim); color: var(--text); }
.btn--danger:disabled { border-color: var(--hairline); color: var(--text-muted); }

/* ---------- data table / timing screen ---------- */

.timing-table {
  width: 100%;
  border-collapse: collapse;
}

.timing-table th {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--hairline);
  padding: 8px 10px;
}

.timing-table td {
  padding: 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}

.timing-table tr.is-new {
  animation: flash 2.2s ease;
}

@keyframes flash {
  0% { background: rgba(216, 168, 62, 0.35); }
  100% { background: transparent; }
}

.pos-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 13px;
}

.pos-badge.p1 { border-color: var(--gold); color: var(--gold); }

.lap-time {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--hairline);
  color: var(--text-muted);
}

.tag--valid { color: var(--valid); border-color: var(--valid); }
.tag--invalid { color: var(--signal); border-color: var(--signal-dim); }

/* ---------- panel / card ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  padding: 24px;
}

.card + .card { margin-top: 16px; }

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}

.card-row:last-child { border-bottom: none; }

/* ---------- alerts / empty states ---------- */

.notice {
  border: 1px solid var(--hairline);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.notice--error { border-color: var(--signal-dim); color: var(--signal); }
.notice--success { border-color: var(--valid); color: var(--valid); }

.empty-state {
  padding: 40px 20px;
  text-align: left;
  color: var(--text-muted);
  border: 1px dashed var(--hairline);
}

.credential-box {
  background: var(--panel-raised);
  border: 1px solid var(--gold);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  word-break: break-all;
  margin: 16px 0;
}

.credential-box code {
  display: block;
  margin-top: 4px;
  color: var(--gold);
}


/* ======================================================================
   V0.9.0 — lap analysis, circuit library
   ====================================================================== */

.panel--wide { max-width: none; }

.field select,
.awin__bar select,
.editor select,
.trackmap__controls select {
  background: var(--panel-raised);
  border: 1px solid var(--hairline);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
}

.picker { margin-bottom: 24px; }
.picker__tabs { margin-bottom: 14px; }
.btn.active { border-color: var(--signal); color: var(--signal); }

/* summary of the two laps */
.analysis-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.analysis-summary .card + .card { margin-top: 0; }
.analysis-lap__tag { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.1em; color: var(--text-muted); margin-bottom: 4px; }
.analysis-lap__who { font-size: 17px; font-weight: 600; }
.analysis-lap__time { font-size: 30px; line-height: 1.2; }
.analysis-lap__sectors { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.analysis-diff--loss { color: var(--signal); }
.analysis-diff--gain { color: var(--valid); }

/* map + values */
.analysis-top {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.analysis-top .card + .card { margin-top: 0; }
@media (max-width: 1100px) { .analysis-top { grid-template-columns: 1fr; } }

.trackmap__controls { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--text-muted); }
.trackmap__canvas { display: block; width: 100%; cursor: crosshair; background: var(--asphalt); border: 1px solid var(--hairline); }
.trackmap__legend { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.trackmap__bar { flex: 1; height: 8px; }

.cursor-wrap { max-height: 430px; overflow: auto; }
.cursor-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cursor-table th,
.cursor-table td { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.cursor-table th:not(:first-child),
.cursor-table td:not(:first-child) { text-align: right; font-family: var(--font-mono); }
.cursor-table thead th { position: sticky; top: 0; background: var(--panel); font-family: var(--font-display); font-weight: 500; }
.cursor-table small { color: var(--text-muted); }
.cursor-group td { color: var(--text-muted); font-family: var(--font-display); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; padding-top: 12px; text-align: left !important; }
.cursor-meta td { background: var(--panel-raised); }
.cursor-diff { color: var(--text-muted); }


/* charts */
.charts { margin-bottom: 24px; }
.chart { background: var(--panel); border: 1px solid var(--hairline); border-bottom: none; }
.charts .chart:last-child { border-bottom: 1px solid var(--hairline); }
.chart__head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 12px 0; font-size: 12px; gap: 12px; }
.chart__title { font-family: var(--font-display); letter-spacing: 0.03em; font-size: 13px; }
.chart__title small { color: var(--text-muted); font-family: var(--font-mono); }
.chart__legend { display: flex; gap: 16px; font-family: var(--font-mono); font-weight: 500; }
.chart__canvas { display: block; width: 100%; cursor: crosshair; touch-action: pan-y; }

/* car physics */
.analysis-physics > summary { cursor: pointer; font-family: var(--font-display); font-size: 16px; padding: 10px 0; }
.phys { display: grid; grid-template-columns: minmax(0, 1fr) 330px minmax(0, 1fr); gap: 16px; margin-top: 12px; }
@media (max-width: 1200px) { .phys { grid-template-columns: 1fr; } }
.phys .card + .card { margin-top: 0; }
.phys__title { font-family: var(--font-display); border-bottom: 2px solid var(--hairline); padding-bottom: 6px; margin-bottom: 12px; }
.phys__car { display: flex; flex-direction: column; gap: 8px; }
.phys__row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phys__chassis { height: 26px; border: 1px dashed var(--hairline); margin: 0 26%; }
.phys__wheel { border: 1px solid var(--hairline); padding: 8px; background: var(--panel-raised); font-size: 11px; }
.phys__wheel-title { font-family: var(--font-display); font-size: 13px; margin-bottom: 4px; }
.phys__row { display: grid; grid-template-columns: 44px 1fr 64px; gap: 6px; align-items: center; margin: 4px 0; }
.phys__name { color: var(--text-muted); }
.phys__bar { display: block; height: 6px; background: var(--hairline); }
.phys__fill { display: block; height: 100%; width: 0; }
.phys__num { text-align: right; font-family: var(--font-mono); }
.phys__needle-box { position: relative; display: block; height: 16px; }
.phys__needle { position: absolute; left: 50%; top: 0; width: 2px; height: 16px; margin-left: -1px; background: var(--text); transform-origin: 50% 100%; }
.phys__gg { display: block; width: 100%; }
.phys__gg-readout { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* circuit library */
.circuits { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.circuits .circuit + .circuit { margin-top: 0; }
.circuit__layout + .circuit__layout { border-top: 1px solid var(--hairline); margin-top: 16px; padding-top: 16px; }
.circuit__name { font-weight: 600; margin-bottom: 8px; }
.circuit__canvas { display: block; width: 100%; height: 170px; }
.circuit__outline { background: var(--asphalt); border: 1px solid var(--hairline); margin-bottom: 8px; min-height: 40px; }
.circuit__meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px; }
.circuit__fastest { margin-bottom: 10px; }
.circuit__action { display: inline-block; font-size: 13px; padding: 8px 14px; }

/* laps recorded by a client older than 0.9.0 */
.tag--basic { color: var(--gold); border-color: var(--gold); }
.notice--basic { border-color: var(--gold); color: var(--text); background: rgba(216, 168, 62, 0.08); }


/* ---------------------------------------------------------------------------
   V0.9.1 — configurable analysis windows
   V0.9.5 — a real grid: 12 columns of equal width, rows of a fixed height (--row), and every
   tile placed on whole cells (grid-column / grid-row set inline from layout.js x, y, w, h), so
   tiles can never overlap, be cut off or push the page sideways. Gaps the user leaves stay.
     desktop / laptop / tablet (>700px)  the grid as arranged
     phone (<=700px)                     tiles stacked full width in reading order, natural height
   --------------------------------------------------------------------------- */
.awin-grid {
  --row: 40px; --gap: 12px; --rows: 1;
  position: relative; display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), var(--row));
  gap: var(--gap); margin-bottom: 24px;
}
.awin { grid-column: span 12; min-width: 0; min-height: 0; position: relative; z-index: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--panel); border: 1px solid var(--hairline); padding: 7px; }
.awin__body { flex: 1 1 auto; min-width: 0; min-height: 0; max-width: 100%; overflow-x: auto; overflow-y: auto; }
.awin__body > .card, .awin__body > * > .card:only-child { border: none; padding: 6px 8px; background: transparent; }
.awin__body .chart { border: none; }
.awin .card { margin-top: 0; }
.awin__body h2 { margin-top: 0; }
@media (max-width: 700px) {
  .awin-grid { display: flex; flex-direction: column; gap: var(--gap); }
  .awin { height: auto; overflow: visible; }
  .awin__body { overflow-y: visible; }
  .awin-cells, .awin-ghost, .awin__resize { display: none !important; }
}

/* edit mode: the cells, the ghost of a tile being moved / drawn / dropped */
.awin-cells { display: contents; }
.awin-cell { z-index: 0; border: 1px dashed var(--hairline); background: rgba(255, 255, 255, 0.015); cursor: crosshair; touch-action: none; }
.awin-cell:hover { background: rgba(216, 168, 62, 0.08); }
.awin-ghost { z-index: 3; pointer-events: none; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 13px; letter-spacing: 0.04em; border: 2px solid var(--valid); background: rgba(76, 167, 113, 0.16); color: var(--text); }
.awin-ghost[hidden] { display: none; }
.awin-ghost--push { border-color: var(--gold); background: rgba(216, 168, 62, 0.18); }
.awin-ghost--bad { border-color: var(--signal); background: rgba(224, 71, 43, 0.18); }
.awin-grid--editing .awin { z-index: 2; outline: 1px dashed var(--text-muted); outline-offset: -1px; }
.awin__bar { flex: 0 0 auto; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; padding: 0 0 6px; min-width: 0; overflow-x: auto; }
.awin__bar select { padding: 4px 6px; font-size: 12px; }
.awin__bar .btn { padding: 4px 8px; font-size: 12px; }
.awin__name { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.04em; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.awin__handle { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; min-width: 36px; min-height: 30px; font-size: 18px; line-height: 1; background: var(--panel-raised, transparent); color: var(--text); border: 1px solid var(--hairline); border-radius: 4px; }
.awin__handle:active { cursor: grabbing; }
.awin__resize { position: absolute; right: 0; bottom: 0; z-index: 4; width: 22px; height: 22px; padding: 0; border: none; background: var(--panel-raised); color: var(--gold); font-size: 14px; line-height: 22px; cursor: nwse-resize; touch-action: none; }
.awin--dragging { opacity: 0.45; }
.awin__bar select { max-width: 45%; }
.awin__colors { display: inline-flex; align-items: center; gap: 4px; }
.awin__colors input[type="color"], .editor__color input[type="color"] { width: 32px; height: 28px; padding: 0; border: 1px solid var(--hairline); background: none; }
.editor { margin-bottom: 16px; }
.editor__row { margin-bottom: 8px; flex-wrap: wrap; align-items: center; gap: 10px; }
.editor__color { display: inline-flex; align-items: center; gap: 6px; }
.analysis-customize { margin-left: auto; opacity: 0.85; }
.analysis-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 20px; }
/* V0.9.6: small buttons and button groups */
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn-group { display: inline-flex; flex-wrap: wrap; }
.btn-group > .btn + .btn { margin-left: -1px; }

/* V0.9.5 — the tile picker (side panel in edit mode) and its preview dialog */
.analysis-workspace--editing { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.analysis-workspace--editing .analysis-picker-slot { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
@media (max-width: 1100px) { .analysis-workspace--editing { grid-template-columns: minmax(0, 1fr); } .analysis-workspace--editing .analysis-picker-slot { position: static; max-height: none; } }
.tpick { padding: 14px; }
.tpick h2 { margin: 0 0 4px; }
.tpick__intro { margin: 0 0 8px; font-size: 12px; }
.tpick__crumbs { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin: 8px 0 6px; }
.tpick__search { width: 100%; background: var(--panel-raised); border: 1px solid var(--hairline); color: var(--text); font-family: var(--font-mono); font-size: 13px; padding: 8px 10px; }
.tpick__purpose { border-top: 1px solid var(--hairline); }
.tpick__purpose > summary { cursor: pointer; padding: 8px 2px; display: grid; grid-template-columns: 1fr auto; gap: 0 8px; font-family: var(--font-display); letter-spacing: 0.03em; }
.tpick__phint { grid-column: 1 / -1; color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0; }
.tpick__count { color: var(--text-muted); font-size: 11px; font-family: var(--font-mono); margin-left: 6px; }
.tpick__kinds { padding: 0 0 6px 10px; }
.tpick__kind > summary { cursor: pointer; padding: 4px 0; font-size: 13px; color: var(--gold); }
.tpick__tiles { list-style: none; margin: 0; padding: 0 0 4px 6px; }
.tpick__item { display: flex; align-items: stretch; gap: 4px; margin: 2px 0; }
.tpick__grip { flex: 0 0 auto; display: inline-flex; align-items: center; padding: 0 6px; cursor: grab; touch-action: none; user-select: none; color: var(--text-muted); border: 1px solid var(--hairline); }
.tpick__grip:active { cursor: grabbing; }
.tpick__tile { flex: 1 1 auto; text-align: left; background: var(--panel-raised); color: var(--text); border: 1px solid var(--hairline); padding: 5px 8px; font-family: var(--font-mono); font-size: 12px; cursor: pointer; min-width: 0; }
.tpick__tile:hover:not([disabled]) { border-color: var(--gold); }
.tpick__tile[disabled] { opacity: 0.45; cursor: default; }
.tpick__taken { display: block; color: var(--text-muted); font-size: 10px; }
.tpick__empty { font-size: 12px; }
.tdrag { position: fixed; z-index: 1001; pointer-events: none; background: var(--panel-raised); border: 1px solid var(--gold); padding: 4px 8px; font-size: 12px; white-space: nowrap; }
.tprev-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.tprev-backdrop--dragging { background: transparent; pointer-events: none; }
.tprev-backdrop--dragging .tprev { opacity: 0; }
.tprev { width: min(980px, 100%); padding: 18px; }
.tprev__head { display: flex; align-items: center; gap: 10px; }
.tprev__head h2 { margin: 0; margin-right: auto; font-size: 20px; }
.tprev__desc { margin: 6px 0 10px; }
.tprev__sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.tprev__stage-slot { overflow-x: auto; margin-bottom: 12px; }
.tprev__stage { position: relative; }
.tprev__stage > .awin { height: 100%; }
.tprev__actions { flex-wrap: wrap; gap: 8px; }
.tprev__drag { cursor: grab; touch-action: none; }
.tprev__tree { max-height: 60vh; overflow-y: auto; margin-top: 8px; }
.tprev__fit { display: flex; align-items: center; gap: 8px; }
.tsize { display: flex; flex-wrap: wrap; gap: 6px; }
.tsize__option { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; background: var(--panel-raised); color: var(--text); border: 1px solid var(--hairline); padding: 6px 8px; font-family: var(--font-mono); font-size: 11px; cursor: pointer; }
.tsize__option[aria-checked="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.tsize__icon { display: inline-block; position: relative; border: 1px solid var(--hairline); background: var(--asphalt); }
.tsize__box { position: absolute; left: 0; top: 0; background: var(--gold); opacity: 0.7; }

/* delta facts, sector table */
.delta-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.delta-fact { font-family: var(--font-mono); font-size: 13px; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 4px; background: transparent; color: var(--text); }
button.delta-fact { cursor: pointer; }
.delta-fact--gain { border-color: rgba(76, 190, 120, 0.7); }
.delta-fact--loss { border-color: rgba(224, 71, 43, 0.7); }
.delta-fact--none { color: var(--text-muted); }
.sector-title { font-family: var(--font-display); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 8px 0 4px; }
.sector-row { font-family: var(--font-mono); font-size: 14px; padding: 3px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.sector-row--total { border-top: 1px solid var(--hairline); margin-top: 4px; padding-top: 6px; font-weight: 600; }
.sector-row__badge { font-family: var(--font-body, inherit); font-size: 11px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--hairline); }
.sector-row__badge--gain { border-color: rgba(76, 190, 120, 0.7); }
.sector-row__badge--loss { border-color: rgba(224, 71, 43, 0.7); }
.sector-row--best { background: rgba(76, 190, 120, 0.08); }
.sector-row--worst { background: rgba(224, 71, 43, 0.08); }

/* "Runde vergleichen" dialog */
.compare-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.compare-dialog { width: min(480px, 100%); max-height: 100%; overflow-y: auto; background: var(--panel, #1B1F23); border: 1px solid var(--hairline); border-radius: 6px; padding: 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.compare-dialog h2 { margin-top: 0; }
.compare-dialog__option { display: block; padding: 8px 0; cursor: pointer; }
.compare-dialog__hint { font-size: 12px; color: var(--text-muted); margin-left: 24px; }
.compare-dialog__lapid { margin: 4px 0 8px 24px; }
.compare-dialog__lapid input { width: 12em; }
.compare-dialog__message { min-height: 1.4em; margin: 8px 0; font-size: 14px; }
.compare-dialog__message--error { color: #E8715A; }
.compare-dialog__message--info { color: var(--text); }
.compare-dialog__actions { margin-top: 8px; }
.quick__status { margin-top: 8px; min-height: 1.2em; font-size: 14px; }
.quick__status--error { color: #E8715A; }


/* ---------------------------------------------------------------------------
   V0.9.1 — language: first-visit popup and the EN | DE switch in the menu
   --------------------------------------------------------------------------- */
.pitwall__lang { display: flex; align-items: center; padding: 12px 0; }
.lang-switch { display: inline-flex; border: 1px solid var(--hairline); border-radius: 4px; overflow: hidden; }
.lang-switch__button { background: transparent; color: var(--text-muted); border: 0; padding: 4px 9px; min-height: 28px; cursor: pointer; font-family: var(--font-display); font-size: 12px; letter-spacing: 0.08em; }
.lang-switch__button + .lang-switch__button { border-left: 1px solid var(--hairline); }
.lang-switch__button.active { background: var(--panel-raised); color: var(--text); }
.lang-switch__button:focus-visible { outline: 2px solid var(--gold, #D8A83E); outline-offset: -2px; }
.lang-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.75); }
.lang-popup { width: min(420px, 100%); background: var(--panel, #1B1F23); border: 1px solid var(--hairline); border-radius: 6px; padding: 24px; text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.lang-popup h2 { margin: 0 0 18px; font-size: 20px; }
.lang-popup__buttons { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lang-popup__button { min-width: 140px; min-height: 44px; font-size: 16px; }
.lang-popup__button--suggested { outline: 2px solid var(--gold, #D8A83E); outline-offset: 2px; }
.lang-popup__note { margin: 16px 0 0; font-size: 12px; color: var(--text-muted); }

/* V0.9.1 — the track search fields show their whole hint ("Search a track, e.g. Fuji, Le Mans,
   Spa…", in German even longer); they were cut off at ~200px. Never wider than the screen. */
.field:has(input[type="search"]) { width: 420px; max-width: 100%; }
.field input[type="search"] { width: 100%; box-sizing: border-box; }

/* V0.9.1 — on phones nothing may push the page sideways. The content column is a grid item,
   whose default min-width (auto = its widest content) let one wide table stretch the whole page
   (dashboard, team and driver pages overflowed by up to ~200px). Now the column keeps the screen
   width, tables scroll inside themselves, and rows of a card wrap instead of overflowing. */
.panel { min-width: 0; }
@media (max-width: 860px) {
  .panel table { display: block; max-width: 100%; overflow-x: auto; }
  .card-row { flex-wrap: wrap; gap: 4px 12px; }
  .card-row > * { min-width: 0; overflow-wrap: anywhere; }
  .inline-form { flex-wrap: wrap; }
  .inline-form > * { max-width: 100%; }
}

/* V0.9.1 — corner analysis */
.corners__wrap { overflow-x: auto; }
.corners__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.corners__table th, .corners__table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.corners__table th:first-child, .corners__table td:first-child { text-align: left; }
.corners__table thead th { font-family: var(--font-display); font-weight: 500; color: var(--text-muted); }
.corners__table td { font-family: var(--font-mono); }
.corner-row { cursor: pointer; }
.corner-row:hover, .corner-row:focus-visible { background: var(--panel-raised); outline: none; }
.corner-row--loss { background: rgba(224, 71, 43, 0.08); }
.corner-row--gain { background: rgba(76, 190, 120, 0.08); }
.corner-row--total { cursor: default; font-weight: 600; }
.corner-row--total:hover { background: none; }

/* V0.9.2 — download page: the two client editions side by side (stacked on narrow screens) */
.download-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 16px 0; }
.download-card, .download-grid > .card + .card { display: flex; flex-direction: column; margin: 0; min-width: 0; }
.download-card--app { border-color: var(--signal); }
.download-card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.download-card__head h2 { margin: 0; }
.download-card__tag { font-size: 12px; color: var(--signal); text-transform: uppercase; letter-spacing: 0.06em; }
.download-card__points { margin: 12px 0 16px; padding-left: 18px; line-height: 1.6; flex: 1; }
.download-card__action .btn { display: inline-block; text-align: center; }
.download-notes p { margin: 4px 0; }

/* V0.9.3 — histograms (damper window, histogram window) */
.dist__body { min-width: 0; }
.dist__wheels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 640px) { .dist__wheels { grid-template-columns: minmax(0, 1fr); } }
.dist__tile { min-width: 0; }
.dist__tile-title { font-family: var(--font-display); color: var(--text-muted); font-size: 13px; margin-bottom: 2px; }
.dist__canvas { display: block; width: 100%; }
.dist__table-wrap { overflow-x: auto; margin-top: 12px; }
.dist__table { border-collapse: collapse; font-size: 12px; width: 100%; }
.dist__table th, .dist__table td { padding: 3px 8px; text-align: right; border-bottom: 1px solid var(--hairline); white-space: nowrap; font-family: var(--font-mono); }
.dist__table th:first-child, .dist__table td:first-child { text-align: left; font-family: var(--font-display); }
.dist__table thead th { color: var(--text-muted); font-weight: 500; }
.dist__facts { display: grid; gap: 4px; margin-top: 8px; font-size: 12px; }
.dist__fact { padding-left: 8px; }
.dist__caption { margin: 8px 0 0; font-size: 12px; }

/* V0.9.3 — track limits & events */
.events__verdicts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; }
.events__verdict { display: flex; align-items: center; gap: 6px; }
.events__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.tl-badge { font-size: 12px; padding: 1px 8px; border: 1px solid var(--hairline); text-transform: uppercase; letter-spacing: 0.04em; }
.tl-badge--valid { color: var(--valid); border-color: var(--valid); }
.tl-badge--review { color: #f5a524; border-color: #f5a524; }
.tl-badge--invalid { color: #e5484d; border-color: #e5484d; }
.tl-badge--none { color: var(--text-muted); }
.events__wrap { overflow-x: auto; max-height: 320px; overflow-y: auto; }
.events__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.events__table td { padding: 4px 8px; border-bottom: 1px solid var(--hairline); }
.events__table td:nth-child(2) { font-family: var(--font-mono); white-space: nowrap; text-align: right; }
.event-row { cursor: pointer; }
.event-row:hover, .event-row:focus-visible { background: var(--panel-raised); outline: none; }
.event-row--invalid td:last-child { color: #e5484d; }
.event-row--review td:last-child { color: #f5a524; }
.event-row--warning td:last-child { color: #f2d544; }
.event-row--info { color: var(--text-muted); }
.event-row__sev { font-size: 11px; text-transform: uppercase; white-space: nowrap; }
.events__caption { margin: 8px 0 0; font-size: 12px; }

/* V0.9.3 — coaching */
.coach__list { margin: 8px 0 0; padding-left: 22px; }
.coach__item { margin-bottom: 10px; }
.coach__corner { background: none; border: 0; color: inherit; font: inherit; padding: 0; cursor: pointer; text-align: left; }
.coach__corner:hover strong, .coach__corner:focus-visible strong { text-decoration: underline; }
.coach__hints { margin: 4px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.coach__strengths { margin-top: 10px; font-size: 13px; }
.coach__caption, .coach__potential { margin: 6px 0 0; font-size: 12px; }

/* V0.9.3 — tyres */
.tyres__cars { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }
.tyres__car { background: var(--panel-raised); padding: 8px 10px; min-width: 0; }
.tyres__label { font-family: var(--font-display); font-size: 13px; margin-bottom: 6px; }
.tyres__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.tyre__title { font-family: var(--font-display); color: var(--text-muted); font-size: 12px; }
.tyre__zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 2px 0 4px; }
.tyre__zone { text-align: center; font-size: 12px; padding: 3px 0; color: #0b0d0f; font-weight: 600; background: var(--hairline); }
.tyre__line { display: flex; justify-content: space-between; font-size: 12px; gap: 6px; }
.tyre__name { color: var(--text-muted); }
.tyres__details { margin-top: 10px; }
.tyres__details summary { cursor: pointer; font-family: var(--font-display); }
.tyres__cursor { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 8px; }

/* V0.9.3 — sessions page */
.sess__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.sess__head h2 { margin: 0; overflow-wrap: anywhere; }
.sess__stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 16px; margin: 12px 0; }
.sess__stat-label { color: var(--text-muted); font-size: 12px; }
.sess__stat-value { font-family: var(--font-mono); font-size: 15px; }
.sess__bars { display: flex; align-items: flex-end; gap: 3px; height: 84px; overflow-x: auto; padding-bottom: 2px; border-bottom: 1px solid var(--hairline); }
.sess__bar { flex: 0 0 12px; background: var(--signal); opacity: 0.85; display: block; }
.sess__bar:hover, .sess__bar:focus-visible { opacity: 1; outline: 1px solid var(--text); }
.sess__bar--invalid { background: var(--hairline); }
.sess__bar--best { background: var(--valid); }
.sess__bar--outlier { opacity: 0.4; }
.sess__legend { margin: 6px 0 10px; font-size: 12px; }
.sess__ideal { margin-top: 8px; }
.sess__ideal-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.sess__contrib { font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }

/* V0.9.3 — admin: review queue, car models */
.review__findings { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.alias--conflict td { color: #f5a524; }

/* ---------- V0.9.4: Stint Analyzer ---------- */
.stint-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 12px; }
.stint-head__title { margin: 0; overflow-wrap: anywhere; }
.stint-open { margin: 8px 0 4px; }
.stint-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 10px; }
.stint-filters { display: flex; flex-direction: column; gap: 6px; }
.stint-filters__flags { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.stint-filters__row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; }
.stint-filter { white-space: nowrap; }
.stint-filter--none { color: var(--text-muted); }
.stint-filter__pct { width: 64px; }
.stint-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 16px; margin-top: 16px; }
.stint-body .card + .card { margin-top: 0; }
#stint-pace, #stint-stints, #stint-laps, #stint-strategy, #stint-drivers { grid-column: 1 / -1; }
.stint-card { min-width: 0; }
.stint-card__title { margin: 0 0 8px; font-size: 18px; }
.stint-note { font-size: 12px; margin: 6px 0; }
.stint-tag { display: inline-block; font-size: 10px; line-height: 1.4; padding: 0 5px; border: 1px solid var(--hairline); text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; }
.stint-tag--estimate { color: var(--gold); border-color: var(--gold); }
.stint-tag--measured { color: var(--valid); border-color: var(--valid); }
.stint-table-wrap { overflow-x: auto; max-width: 100%; }
.stint-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.stint-table th, .stint-table td { padding: 4px 8px; border-bottom: 1px solid var(--hairline); text-align: left; white-space: nowrap; }
.stint-table thead th { font-family: var(--font-display); font-weight: 500; color: var(--text-muted); }
.stint-row--best td { background: rgba(76, 167, 113, 0.15); }
.stint-row--impossible td { color: var(--text-muted); text-decoration: line-through; }
.stint-row--impossible td:last-child { text-decoration: none; }
.stint-row--filtered td { color: var(--text-muted); }
.stint-row--own td { background: rgba(224, 71, 43, 0.10); }
.stint-reason { color: var(--signal); white-space: normal; font-size: 11px; }
#stint-laps .stint-table td:last-child { white-space: normal; min-width: 240px; }
.stint-dot { display: inline-block; min-width: 20px; padding: 0 4px; text-align: center; color: #14171A; font-weight: 600; }
.stint-chart { width: 100%; height: auto; display: block; margin: 6px 0; }
.stint-chart__grid line { stroke: var(--hairline); stroke-width: 1; }
.stint-chart__grid text, .stint-chart__marker-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }
.stint-chart__axis { fill: var(--text-muted); font-size: 11px; }
.stint-chart__marker { stroke: var(--text-muted); stroke-dasharray: 3 3; }
.stint-chart__dot--link { cursor: pointer; }
.stint-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--text-muted); }
.stint-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.stint-legend__swatch { width: 16px; height: 3px; border: 1px solid; display: inline-block; }
.stint-legend__swatch--dot { width: 9px; height: 9px; border-radius: 50%; }
.stint-legend__swatch--dashed { border-style: dashed; height: 0; }
.stint-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; margin: 8px 0; }
.stint-form__field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-muted); }
.stint-form__field .input { width: 100%; }
.stint-form__check { font-size: 13px; align-self: end; }
.stint-input--short { width: 70px; }
.stint-strategy { margin-top: 8px; }
.stint-card .input, .stint-filters .input, .stint-toolbar .input { background: var(--asphalt); color: var(--text); border: 1px solid var(--hairline); padding: 4px 6px; font-family: var(--font-mono); }
@media (max-width: 600px) {
  .stint-body { grid-template-columns: 1fr; }
  .stint-form { grid-template-columns: 1fr 1fr; }
}

/* ---------- V0.9.4: LapTime Analyzer — racing lines, corner detail, sectors, extra laps ---------- */
.linemap__controls { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.linemap__btn { padding: 4px 10px; min-width: 34px; }
.linemap__opt { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.linemap__opt--off { opacity: 0.55; cursor: help; }
.linemap__follow, .linemap__range, .cdetail__select, .delta-widget__mode, .corners__order, .ops__period select {
  background: var(--panel-raised); border: 1px solid var(--hairline); color: var(--text); font-family: var(--font-mono); font-size: 13px; padding: 4px 6px;
}
.linemap__range { width: 80px; }
.linemap__follow { width: auto; max-width: 100%; }
.linemap__corners { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.linemap__chip { background: var(--panel-raised); border: 1px solid var(--hairline); color: var(--text); font-family: var(--font-mono); font-size: 12px; padding: 2px 8px; cursor: pointer; }
.linemap__chip:hover, .linemap__chip:focus-visible, .linemap__chip--on { border-color: var(--gold); color: var(--gold); }
.linemap__canvas { width: 100%; height: 440px; display: block; background: var(--asphalt); touch-action: none; cursor: grab; }
.linemap__canvas:active { cursor: grabbing; }
.linemap__foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 6px; font-size: 12px; }
.linemap__legend { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--text-muted); }
.linemap__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.linemap__swatch { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.linemap__swatch--c { border-top-style: dashed; }
.linemap__swatch--d { border-top-style: dotted; }
.linemap__info { font-family: var(--font-mono); }
.linemap__caption { font-size: 11px; margin: 4px 0 0; }
.cdetail h2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.cdetail__phases { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 6px 0; }
.cdetail__phase { border: 1px solid var(--hairline); padding: 4px 6px; text-align: center; font-size: 12px; }
.cdetail__phase--worst { border-color: var(--signal); }
.cdetail__phase-name { color: var(--text-muted); font-size: 11px; }
.cdetail__phase-delta { font-family: var(--font-mono); font-size: 14px; }
.cdetail__wrap { overflow-x: auto; }
.cdetail__table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.cdetail__table th, .cdetail__table td { padding: 3px 8px; border-bottom: 1px solid var(--hairline); text-align: right; white-space: nowrap; }
.cdetail__table th:first-child, .cdetail__table td:first-child { text-align: left; white-space: normal; min-width: 9em; }
.cdetail__history { overflow-x: auto; }
.cdetail__table .stint-tag { margin-left: 6px; }
.cdetail__now td { font-weight: 600; }
.cdetail__history { margin-top: 8px; font-size: 13px; }
.cdetail__history-line { margin-top: 4px; }
.lsectors__best { color: var(--valid); font-weight: 600; }
.lsectors__this td { background: rgba(224, 71, 43, 0.10); }
.lsectors__invalid td { color: var(--text-muted); }
.lsectors__line { margin-top: 6px; font-size: 13px; }
.coach__phases { list-style: none; padding-left: 0; margin: 4px 0; }
.coach__phase { margin: 2px 0; }
.coach__phase-head { font-family: var(--font-mono); font-size: 12px; }
.coach__phase .coach__hints { margin: 2px 0 4px; }
.coach__history { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.delta-widget__bar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.analysis-extra-laps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.analysis-extra-lap { border: 1px solid; border-left-width: 4px; padding: 2px 4px 2px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.analysis-extra-lap--c { border-style: dashed; }
.analysis-extra-lap--d { border-style: dotted; }
.analysis-extra-lap__remove { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; padding: 0 4px; }
.analysis-extra-lap__remove:hover { color: var(--text); }
@media (max-width: 600px) {
  .cdetail__phases { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .linemap__canvas { height: 360px; }
}

/* V0.9.5: the physics tile loads its (many) channels only when opened — on the grid the closed
   state is a clear button in the middle of its tile instead of a lone line at the top */
.awin--physics .analysis-physics:not([open]) { display: flex; min-height: calc(var(--h, 200px) - 60px); align-items: center; justify-content: center; }
.awin--physics .analysis-physics:not([open]) > summary { cursor: pointer; list-style: none; border: 1px dashed var(--gold); padding: 14px 22px; font-family: var(--font-display); letter-spacing: 0.03em; color: var(--text); }
.awin--physics .analysis-physics:not([open]) > summary::-webkit-details-marker { display: none; }
.awin--physics .analysis-physics:not([open]) > summary::before { content: "▶ "; color: var(--gold); }


/* V0.9.6 — wide tables never push the page sideways on a phone: they scroll inside their box */
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 640px) {
  .timing-table { display: block; max-width: 100%; overflow-x: auto; white-space: nowrap; }
  .timing-table th, .timing-table td { padding-left: 8px; padding-right: 8px; }
}

/* V0.9.6 — dashboard: quick actions, two columns, the record feed, the lap filter */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 0 0 8px; }
.quick-action { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--hairline); color: var(--text); }
.quick-action strong { font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: 0.02em; }
.quick-action span { font-size: 12px; color: var(--text-muted); }
.quick-action:hover { border-color: var(--text-muted); }
.quick-action--primary { border-color: var(--signal); }
.quick-action--primary strong::after { content: " →"; color: var(--signal); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 32px; }
.dash-grid__col > h2 { margin-top: 0; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.small-link { font-size: 12px; color: var(--text-muted); }
.small-link:hover { color: var(--text); }
.activity__row { gap: 12px; }
.activity__main { min-width: 0; }
.activity__badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.activity__what { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.activity__where { color: var(--text-muted); }
.activity__side { text-align: right; white-space: nowrap; }
.activity__side a .lap-time { text-decoration: underline dotted; text-underline-offset: 3px; }
.activity__when { margin: 2px 0 0; }
.tag--gold { color: var(--gold); border-color: var(--gold); }
.tag--team { color: #7fb8e6; border-color: #4f7ea5; }
.laps-filter { align-items: flex-end; flex-wrap: wrap; gap: 16px; }
.laps-filter .field { margin-bottom: 0; }
.laps-filter__check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; padding-bottom: 10px; }
.laps-filter__count { margin: 0 0 10px auto; }
.board-title { margin: 8px 0 12px; font-size: 16px; color: var(--text-muted); }
.lap-gap { color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.sector-cells { color: var(--text-muted); white-space: nowrap; font-size: 13px; }
[aria-busy="true"] { opacity: 0.6; transition: opacity 0.15s; }

/* V0.9.6 — lap picker: grouped per track, the whole row selects, the best lap marked */
.picker__group { border-top: 1px solid var(--hairline); }
.picker__group > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 2px; }
.picker__group-meta { margin: 0; font-size: 12px; }
.picker__row { cursor: pointer; }
.picker__row:hover td { background: var(--panel-raised); }
.picker__row--off { cursor: default; opacity: 0.55; }
.picker__row--best .lap-time { color: var(--gold); }
.picker__best { margin-left: 6px; }
@media (max-width: 640px) { .picker__when { display: none; } }

/* V0.9.6 — folded sections (rarely needed settings) and the team overview */
details.fold { margin-top: 32px; border: 1px solid var(--hairline); background: var(--panel); }
details.fold > summary { cursor: pointer; padding: 14px 18px; font-family: var(--font-display); font-size: 16px; letter-spacing: 0.02em; }
details.fold > summary:hover { background: var(--panel-raised); }
details.fold > .card { border: none; margin: 0; padding-top: 4px; }
details.fold--single > .card > h2:first-child { display: none; }
.team-overview__fixed { display: flex; gap: 24px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.account-profile__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
details.fold > .card + .card { border-top: 1px solid var(--hairline); }
.account-profile { margin-bottom: 16px; }
.inline-form + .inline-form.section { margin-top: 16px; }
.circuit--undriven { grid-column: 1 / -1; }
.circuit__names { display: flex; flex-wrap: wrap; gap: 6px; }
.circuit__names .tag { font-size: 12px; padding: 4px 10px; }

/* V0.9.6 — nothing may be wider than a phone: long select texts are cut, rows wrap tidily */
select, input, textarea { max-width: 100%; }
.field { min-width: 0; }
.card-row { gap: 12px; }
.card-row > :last-child { margin-left: auto; }
@media (max-width: 640px) {
  .field { max-width: 100%; }
  .inline-form .field, .inline-form .field select, .inline-form .field input { width: 100%; }
  .card-row { flex-wrap: wrap; }
}

/* V0.9.7 — data quality tile */
.card.health { overflow-y: auto; min-height: 0; }
.health__body { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.health__lap { flex: 1 1 300px; min-width: 0; }
.health__head { margin-bottom: 4px; }
.health__status--good { color: var(--valid); border-color: var(--valid); }
.health__status--limited { color: var(--gold); border-color: var(--gold); }
.health__status--unreliable { color: var(--signal); border-color: var(--signal-dim); }
.health__validity { margin: 0 0 8px; }
.health__list { list-style: none; margin: 0; padding: 0; font-size: 0.78rem; line-height: 1.35; }
.health__item { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--hairline); }
.health__dot { flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--valid); transform: translateY(-1px); }
.health__item--warn .health__dot { background: var(--gold); }
.health__item--bad .health__dot { background: var(--signal); }
.health__caption { flex: 1 1 100%; margin: 4px 0 0; }
.analysis-summary__quality { grid-column: 1 / -1; font-size: 0.8rem; }
.coach__uncertain { color: var(--text-muted); font-size: 0.8rem; }
.corner-rank { list-style: none; margin: 0; padding: 0; }
.corner-rank__row { display: grid; grid-template-columns: 5.5em 1fr 5.5em; gap: 8px; align-items: center; width: 100%; background: none; border: 0; color: inherit; font: inherit; padding: 3px 0; cursor: pointer; text-align: left; }
.corner-rank__row:hover { background: var(--panel-raised); }
.corner-rank__bar { height: 10px; background: var(--hairline); position: relative; }
.corner-rank__bar span { position: absolute; top: 0; bottom: 0; }
.corner-rank__bar .loss { background: var(--signal); left: 50%; }
.corner-rank__bar .gain { background: var(--valid); right: 50%; }
.corners__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.corners__head h2 { margin: 0; }
.corners__order { max-width: 14em; }
@media (max-width: 640px) { .corners__share { display: none; } }

/* V0.9.8 — operations: uploads per hour */
.ops-timeline { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin: 4px 0 12px; overflow-x: auto; }
.ops-timeline__bar { flex: 0 0 8px; background: var(--valid); position: relative; display: flex; align-items: flex-end; }
.ops-timeline__failed { display: block; width: 100%; background: var(--signal); }

/* V1.0 — legal pages, sign-up form, setup guide */
.nav-group--foot a.nav-legal { font-size: 12px; color: var(--text-muted); }
.legal-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.legal-text { max-width: 860px; line-height: 1.6; }
.legal-text h2 { font-size: 1.05rem; margin: 26px 0 8px; }
.legal-text h2:first-of-type { margin-top: 4px; }
.legal-text p, .legal-text li { color: var(--text); }
.legal-text ul { padding-left: 1.2em; }
.legal-operator { font-style: normal; border-left: 2px solid var(--signal); padding: 6px 0 6px 14px; margin: 8px 0 12px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 8px 0 12px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--hairline); }
.legal-table th { color: var(--text-muted); font-family: var(--font-display); font-weight: 400; letter-spacing: 0.03em; white-space: nowrap; }
.legal-links { list-style: none; padding: 0; display: flex; gap: 6px 18px; flex-wrap: wrap; }
@media (max-width: 640px) { .legal-table { min-width: 560px; } }

.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; line-height: 1.45; }
.check-row input { margin-top: 3px; flex: 0 0 auto; accent-color: var(--signal); width: 16px; height: 16px; }
.signup-card .btn { margin-top: 8px; }
.advanced-signin { margin-top: 16px; }
.advanced-signin > summary { cursor: pointer; color: var(--text-muted); font-size: 0.9rem; }
.advanced-signin[open] > summary { margin-bottom: 12px; }
.advanced-signin > .card { margin: 0; padding: 0; border: 0; background: none; }

.setup-step h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.setup-step__num { flex: 0 0 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--signal); color: var(--signal); font-family: var(--font-mono); font-size: 0.95rem; }
.setup-step--done .setup-step__num { border-color: var(--valid); color: var(--valid); }
.setup-list { padding-left: 1.3em; line-height: 1.6; }
.setup-list li + li { margin-top: 4px; }
.setup-downloads { margin: 12px 0 4px; flex-wrap: wrap; }
.setup-faq__row { display: grid; grid-template-columns: minmax(12em, 1fr) 2fr; gap: 6px 18px; align-items: start; }
@media (max-width: 640px) { .setup-faq__row { grid-template-columns: 1fr; } }
.download-next { margin-top: 16px; }

.site-footer { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 0.82rem; color: var(--text-muted); }
.site-footer a { color: var(--text-muted); }
.site-footer span { flex: 1 1 100%; }
/* the hidden attribute wins over component display rules (e.g. the sign-up form's secret field) */
[hidden] { display: none !important; }

/* V1.0.1 — the terms dialog (terms_gate.js) uses the language popup's frame, left-aligned text */
.terms-popup { text-align: left; width: min(520px, 100%); }
.terms-popup .check-row { margin: 10px 0; }
.terms-popup .lang-popup__buttons { justify-content: flex-start; margin-top: 16px; }

/* ---------- V1.0.1: landing page ---------- */
.hero__title { font-size: 2.4em; margin-bottom: 4px; }
.hero__claim { font-size: 1.2em; margin-bottom: 12px; }
.hero__lead { max-width: 62ch; color: var(--text); margin: 0 0 4px; line-height: 1.6; }
.hero__actions { margin-top: 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--hairline); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.feature__art { width: 100%; height: auto; display: block; background: var(--asphalt); border: 1px solid var(--hairline); }
.feature__title { font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: 0.02em; }
.feature__body { margin: 0; font-size: 13px; line-height: 1.55; }
.features__more { margin-top: 12px; }
.empty-state--loading { border-style: solid; }

/* ---------- V1.0.1: the menu on short windows (laptops, browser not full screen) ---------- */
@media (min-width: 861px) and (max-height: 760px) {
  .pitwall { padding: 18px 16px; }
  .pitwall__brand { margin-bottom: 16px; }
  .pitwall__links { gap: 10px; }
  .pitwall__links a { padding: 6px 12px; font-size: 14px; }
  .nav-group__label { padding-bottom: 2px; }
  .nav-group--foot { padding-top: 8px; }
  .nav-group--foot a { padding: 4px 12px; font-size: 13px; }
  .pitwall__lang { padding: 6px 0; }
  .pitwall__status { padding-top: 10px; }
}
/* very short windows: the whole menu scrolls as one, nothing hides behind an inner scroll bar */
@media (min-width: 861px) and (max-height: 600px) {
  .pitwall { overflow-y: auto; }
  .pitwall__links { flex: 1 0 auto; overflow: visible; }
}
/* V1.0.1: "Your Best" as a table over both columns */
.dash-grid__col--wide { grid-column: 1 / -1; }
.best-table { width: 100%; }
.best-table__link { text-align: right; white-space: nowrap; }
.best-table__when { color: var(--text-muted); }
/* V1.0.1: further classes of the same track — no repeated track name, a lighter divider */
.best-table__more td { border-top-color: transparent; }
.best-table__gap { color: var(--text-muted); white-space: nowrap; }
@media (max-width: 640px) {
  .feature__art { height: 96px; }
}
