:root {
  color-scheme: dark;
  --bg: #080d0a;
  --panel: #121a14;
  --line: #293329;
  --muted: #97a397;
  --lime: #c4ff00;
  --cyan: #39d3ef;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 70% 0, #182318 0, transparent 45%), var(--bg);
  color: #f5f7f3;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #1a231b;
  color: #f7f9f4;
  padding: 11px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover:not(:disabled) {
  background: #303d2a;
  border-color: #6a7e4d;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
button.primary {
  background: var(--lime);
  color: #101600;
  font-weight: 750;
  border-color: var(--lime);
}
button.primary:hover:not(:disabled) {
  background: #d8ff66;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.danger {
  color: #ff9c8c;
}
.muted,
p,
small {
  color: var(--muted);
}
p {
  line-height: 1.6;
}
h1 {
  font-size: 36px;
  letter-spacing: -1.25px;
  margin: 10px 0 14px;
  font-weight: 650;
}
h2 {
  font-size: 24px;
  letter-spacing: -0.6px;
  margin: 0 0 12px;
}
h3 {
  font-size: 16px;
  margin: 0 0 12px;
}
header {
  height: 82px;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 22px;
  background: #0a100ce8;
}
.brand img, .brand svg {
  width: 130px;
  height: 40px;
  object-fit: contain;
}
.header-title {
  font-size: 18px;
  border-left: 1px solid #35402f;
  padding-left: 24px;
  white-space: nowrap;
}
.header-title small {
  display: inline-block;
  margin-left: 12px;
  font-size: 9px;
  letter-spacing: 1.3px;
  background: #273020;
  padding: 6px 8px;
  color: #c6d3b5;
  border-radius: 5px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
#saved {
  font-size: 11px;
}
main {
  max-width: 1580px;
  margin: auto;
  padding: 28px 34px 45px;
}
.steps {
  display: flex;
  gap: 10px;
  margin: 0 0 32px;
  max-width: 780px;
}
.step {
  display: flex;
  gap: 10px;
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 20px 8px 0;
}
.step b {
  border: 1px solid #42523b;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.step.active {
  color: white;
}
.step.active b {
  background: var(--lime);
  color: #172000;
  border-color: var(--lime);
}
.step.done b {
  border-color: var(--lime);
  color: var(--lime);
}
.step-line {
  height: 1px;
  width: 38px;
  background: #36432f;
  align-self: center;
  margin-right: 12px;
}
.eyebrow {
  color: var(--lime);
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 750;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.heading h1 {
  font-size: 28px;
  margin: 5px 0;
}
.heading p {
  margin: 5px 0;
}
.local-pill {
  padding: 9px 12px;
  border: 1px solid #34442e;
  border-radius: 25px;
  color: #b7c2ac;
  font-size: 12px;
}
.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 38px;
  align-items: center;
  min-height: 520px;
}
.intro-copy {
  max-width: 545px;
}
.upload {
  border: 1px dashed #66754b;
  border-radius: 18px;
  background: #171f13;
  padding: 30px;
  text-align: center;
  margin-top: 27px;
}
.upload.drag {
  border: 2px solid var(--lime);
}
.upload-icon {
  font-size: 32px;
  color: var(--lime);
  margin-bottom: 12px;
}
.upload h3 {
  font-size: 18px;
}
.upload p {
  margin: 7px 0 18px;
}
.footnote {
  font-size: 12px;
  margin-top: 12px;
}
.intro-preview {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: #0c120d;
  box-shadow: 0 20px 75px #0006;
  position: relative;
}
.intro-image {
  width: 100%;
  height: 380px;
  object-fit: cover;
  filter: brightness(0.85);
}
.preview-tag {
  position: absolute;
  top: 18px;
  left: 18px;
  border-radius: 6px;
  padding: 7px 10px;
  background: #0b130be0;
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--lime);
}
.mock-stat {
  position: absolute;
  left: 20px;
  bottom: 90px;
  background: #0b130be8;
  padding: 16px 20px;
  border-radius: 12px;
}
.mock-stat strong {
  display: block;
  font-size: 33px;
}
.mock-stat small {
  font-size: 10px;
  color: var(--lime);
  letter-spacing: 1px;
}
.mock-bike {
  position: absolute;
  bottom: 90px;
  right: 20px;
  width: 210px;
  background: #0b130be8;
  padding: 15px;
  border-radius: 12px;
}
.mock-bike img {
  width: 100px;
  float: right;
  transform: rotate(12deg);
}
.mock-bike strong {
  font-size: 29px;
}
.mock-bike small {
  display: block;
  font-size: 10px;
  color: var(--lime);
  margin: 0 0 8px;
}
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
}
.preview-footer span {
  font-size: 12px;
  color: var(--muted);
}
.info-strip {
  display: flex;
  gap: 26px;
  margin-top: 22px;
  color: #aab6a0;
  font-size: 12px;
}
.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 22px;
}
.player {
  background: #000;
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid #2e392c;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 610px;
}
.player video,
.player .demo-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.player .demo-image {
  object-fit: cover;
}
.player canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.player-error {
  position: absolute;
  top: 35%;
  left: 15%;
  right: 15%;
  padding: 20px;
  background: #21150fee;
  border: 1px solid #bb814b;
  border-radius: 12px;
}
.player-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}
.play {
  width: 40px;
  height: 36px;
  padding: 0;
  background: var(--lime);
  color: #142000;
  border: 0;
  border-radius: 8px;
  font-size: 18px;
}
.time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 12px;
}
.scrub {
  width: 100%;
  accent-color: var(--lime);
  cursor: pointer;
}
input[type="range"] {
  accent-color: var(--lime);
}
.card {
  background: #121a14;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-title h3 {
  margin: 0;
}
.tag {
  font-size: 10px;
  letter-spacing: 0.6px;
  background: #27341d;
  color: var(--lime);
  padding: 5px 7px;
  border-radius: 5px;
}
.card p {
  font-size: 12px;
  margin: 8px 0 14px;
}
.card input[type="text"],
.card input[type="number"],
.card select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3d4836;
  background: #0a100c;
  color: white;
  margin: 7px 0;
}
.card label {
  font-size: 12px;
  color: #c0c9ba;
}
.card button.full {
  width: 100%;
}
.ride-item {
  width: 100%;
  text-align: left;
  margin: 5px 0;
}
.ride-item strong,
.ride-item small {
  display: block;
}
.ride-item small {
  margin-top: 5px;
  font-size: 11px;
}
.selected-ride {
  border-left: 3px solid var(--lime);
  padding-left: 12px;
  margin: 14px 0;
}
.selected-ride strong {
  display: block;
}
.selected-ride small {
  display: block;
  margin-top: 6px;
  font-size: 11px;
}
.route-map {
  width: 100%;
  height: 150px;
  border-radius: 10px;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 8px;
}
.legend span:before {
  content: " ";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--trail-colour, #ff4b4b);
  margin-right: 5px;
}
.legend span:last-child:before {
  background: var(--cyan);
}
.row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.row input {
  min-width: 0;
}
.sync-status {
  font-size: 13px;
  color: var(--lime);
  margin-bottom: 10px;
}
.warning {
  color: #efc775;
}
.details {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 16px;
}
.details summary {
  cursor: pointer;
  color: #c5ceb9;
  font-size: 12px;
}
.details p {
  margin-bottom: 0;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #253022;
  font-size: 13px;
}
.toggle-row:last-child {
  border: 0;
}
.toggle-row small {
  display: block;
  font-size: 10px;
  margin-top: 4px;
}
.toggle-row input {
  appearance: none;
  width: 33px;
  height: 19px;
  background: #3b433a;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  flex: none;
}
.toggle-row input:before {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  top: 3px;
  left: 3px;
  background: #c5cbc1;
  border-radius: 50%;
  transition: all 0.15s;
}
.toggle-row input:checked {
  background: var(--lime);
}
.toggle-row input:checked:before {
  left: 17px;
  background: #172400;
}
.toggle-row input:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.timeline {
  background: #111912;
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 12px;
}
.timeline-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.timeline-top strong {
  font-size: 12px;
}
.timeline-top small {
  font-size: 11px;
}
.track {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}
.track-lane {
  height: 20px;
  background: #26371d;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.track-lane.video-track {
  background: repeating-linear-gradient(
    90deg,
    #3d482b 0px,
    #3d482b 48px,
    #202a1b 49px,
    #202a1b 50px
  );
}
.track-lane.camera-track {
  background: #19373b;
}
.track-lane.no-data {
  background: repeating-linear-gradient(
    120deg,
    #222820 0px,
    #222820 5px,
    #151b15 5px,
    #151b15 10px
  );
}
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f8ffe8;
  left: 0;
}
.timeline-caption {
  font-size: 10px;
  color: #8e9a83;
  margin: 13px 0 0;
}
.below-player {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  align-items: center;
}
.below-player button {
  margin-left: auto;
}
.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.note {
  font-size: 11px;
  line-height: 1.5;
  color: #a1af96;
}
.badge-good {
  color: var(--lime);
}
.page-footer {
  border-top: 1px solid #263121;
  margin-top: 28px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #75836d;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.project-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 23px;
}
.project-card p {
  font-size: 12px;
}
.project-card .row {
  margin-top: 25px;
}
.empty {
  padding: 70px;
  text-align: center;
  border: 1px dashed #3d4a32;
  border-radius: 20px;
  margin-top: 30px;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #263221;
  color: white;
  padding: 12px 20px;
  border: 1px solid #556744;
  border-radius: 11px;
  max-width: 90%;
  z-index: 30;
  display: none;
  box-shadow: 0 8px 30px #0009;
}
#toast.visible {
  display: block;
}
dialog {
  width: min(560px, 92vw);
  border: 1px solid #45513a;
  border-radius: 18px;
  background: #10180f;
  color: #f2f7ee;
  padding: 28px;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-size: 25px;
}
dialog p {
  font-size: 13px;
}
progress {
  width: 100%;
  accent-color: var(--lime);
  height: 10px;
  margin: 16px 0;
}
a {
  color: var(--lime);
}
.download {
  display: inline-block;
  text-decoration: none;
  background: var(--lime);
  color: #132000;
  padding: 12px 20px;
  border-radius: 9px;
  font-weight: 700;
}
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #40502d;
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (max-width: 1050px) {
  header {
    padding: 0 20px;
  }
  .header-title {
    font-size: 15px;
  }
  .header-title small,
  #saved {
    display: none;
  }
  main {
    padding: 24px 20px;
  }
  .studio-grid {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
  .intro-grid {
    gap: 25px;
  }
  h1 {
    font-size: 30px;
  }
  .intro-image {
    height: 320px;
  }
  .mock-bike {
    width: 180px;
  }
}
@media (max-width: 780px) {
  header {
    height: auto;
    min-height: 75px;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .header-title {
    font-size: 15px;
  }
  .steps {
    gap: 0;
    margin-bottom: 18px;
  }
  .step {
    font-size: 11px;
    padding-right: 7px;
    gap: 5px;
  }
  .step-line {
    width: 12px;
    margin-right: 5px;
  }
  .intro-grid,
  .studio-grid {
    grid-template-columns: 1fr;
  }
  .intro-preview {
    margin-top: 8px;
  }
  .heading {
    align-items: flex-start;
    gap: 10px;
  }
  .heading h1 {
    font-size: 25px;
  }
  .local-pill {
    font-size: 10px;
    white-space: nowrap;
  }
  .player {
    max-height: 75vh;
  }
  .info-strip {
    flex-wrap: wrap;
    gap: 12px;
  }
  .empty {
    padding: 35px 15px;
  }
}
.editing main {
  padding-top: 18px;
}
.editing .steps {
  margin-bottom: 16px;
}
.editing .heading {
  margin-bottom: 16px;
}
.editing .heading h1 {
  font-size: 26px;
}
.editing .heading p {
  font-size: 13px;
}
.editing .player {
  max-height: none;
  width: min(100%, calc(max(300px, 100vh - 440px) * var(--player-ratio, 1.777778)));
  margin-inline: auto;
}
@media (max-width: 780px) {
  .editing .player { width: min(100%, calc(max(360px, 100svh - 300px) * var(--player-ratio, 1.777778))); }
  .editing .heading p { font-size: 12px; }
}
.shape-controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.shape-choice { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; padding: 10px 6px; border: 1px solid #42503d; background: #111a13; border-radius: 12px; color: #eaf1e4; }
.shape-choice[aria-pressed="true"] { border-color: var(--lime); background: #283411; color: var(--lime); }
.shape-choice:focus-visible { outline: 2px solid white; outline-offset: 3px; }
.shape-choice strong { display: block; font-size: 14px; }
.shape-choice small { display: block; font-size: 12px; margin-top: 3px; text-transform: capitalize; }
.shape-icon { display: block; width: min(30px, calc(25px * var(--shape-ratio))); aspect-ratio: var(--shape-ratio); border: 2px solid currentColor; border-radius: 3px; flex: 0 0 auto; }
.shape-hint { color: #bac5b4; font-size: 13px; margin: 0 0 14px; }
@media (max-width: 540px) {
  .shape-choice { gap: 5px; flex-direction: column; min-height: 76px; }
  .shape-choice strong { font-size: 13px; }
  .shape-icon { max-height: 22px; }
}

#cloud-ride-list {max-height:52vh;overflow:auto} #login-form label {display:block;margin:14px 0} #login-form input {display:block;width:100%;margin-top:8px} #login-error {color:#ffb057} .card .full+.full {margin-top:10px}

/* Composite fullscreen keeps telemetry, transport controls and aspect ratio together. */
.player-expanded { overflow: hidden; }
.player-shell.expanded-player {
  position: fixed; inset: 0; z-index: 10000; width: 100%; height: 100dvh;
  box-sizing: border-box; padding: 16px; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.player-shell.expanded-player .player { flex: 0 0 auto; max-height: none; border: 0; border-radius: 0; margin: 0; }
.player-shell.expanded-player .player-controls { flex: 0 0 auto; width: 100%; max-width: 1500px; box-sizing: border-box; }
#fullscreen { white-space: nowrap; min-height: 44px; }
.player-controls .scrub { min-width: 40px; flex: 1; margin: 0; }
@media(max-width:600px) {
  .player-controls { flex-wrap: wrap; gap: 8px; }
  .player-controls .scrub { order: 5; flex-basis: 100%; }
}

.overlay-layout { margin: -4px 0 16px; padding: 12px; border: 1px solid #34402d; border-radius: 10px; }
.overlay-layout summary { cursor: pointer; color: var(--lime); font-size: 14px; }
.overlay-layout label { display: block; margin: 12px 0; font-size: 14px; }
.overlay-layout output { float: right; font-variant-numeric: tabular-nums; }
.overlay-layout input, .overlay-layout select { width: 100%; margin-top: 8px; }
.overlay-layout input[type=range] { min-height: 32px; margin-bottom: 0; accent-color: var(--lime); }

.preset-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.layout-warning { color: #ffbf69; }
.layout-warning:empty { display: none; }
/* Optional sensor-assisted analysis workspace. */
.workspace-tabs,.analysis-types{display:flex;gap:10px;flex-wrap:wrap;margin:14px 0 22px}
.workspace-tabs button[aria-pressed=true],.analysis-types button[aria-pressed=true]{background:#c6ff00;color:#111;border-color:#c6ff00}
.analysis-grid{align-items:start}.analysis-grid>section{min-width:0}
.analysis-phases{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:14px 0}
.phase-card{padding:10px;background:#101a13;border:1px solid #29372e;border-radius:12px;display:flex;flex-direction:column;gap:8px;min-width:0}
.phase-card button{padding:9px 6px;font-size:12px}.phase-card img{width:100%;height:90px;object-fit:contain;background:#000;border-radius:6px}
.analysis-frame-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px;color:#a9b5ab;margin-bottom:18px}
.analysis-legend{display:flex;flex-wrap:wrap;gap:12px;font-size:13px;margin:14px 0}
.analysis-chart{margin:18px 0}.analysis-chart strong{font-size:14px}.analysis-chart canvas{display:block;width:100%;height:130px;background:#070e09;cursor:crosshair;border-radius:8px;margin-top:8px}
.analysis-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:14px}.analysis-metrics span{font-size:12px;color:#b6c2b8}.analysis-metrics strong{display:block;font-size:19px;color:#fff;margin-top:5px}
.analysis-grid textarea{display:block;width:100%;box-sizing:border-box;background:#080f0a;color:white;border:1px solid #3a483e;border-radius:9px;padding:12px;font:inherit;margin-top:8px}
.analysis-grid label{display:block;margin-top:20px}.analysis-grid h4{margin:22px 0 8px}.analysis-grid small{color:#b3bdb5}
.analysis-candidate{display:block;width:100%;text-align:left;margin:8px 0}.analysis-candidate small,.analysis-history small{display:block;margin-top:5px}
.analysis-history{display:flex;gap:8px;align-items:center;margin:10px 0}.analysis-history button:first-child{flex:1;text-align:left}.analysis-history button:last-child{font-size:12px}
.analysis-warning{border-left:3px solid #f5b84e;padding-left:12px;color:#f5c875}
.analysis-grid .full{margin-top:10px}.analysis-grid .route-map{margin-top:15px}
@media(max-width:700px){.analysis-phases{grid-template-columns:repeat(2,minmax(0,1fr))}.analysis-frame-controls span{max-width:150px}.analysis-metrics strong{font-size:16px}}
.phase-results{overflow-x:auto}.phase-results table{width:100%;font-size:13px;border-collapse:collapse;text-align:left}.phase-results caption{text-align:left;font-weight:700;margin:15px 0 8px}.phase-results th,.phase-results td{border-bottom:1px solid #2c3930;padding:9px 5px}.phase-results small{display:block;font-weight:400;font-variant-numeric:tabular-nums}
.analysis-active .workspace-tabs{margin:0 0 12px}.analysis-active .steps{margin-bottom:18px}.analysis-active .heading{margin-bottom:12px}.analysis-active .analysis-types{margin:8px 0 16px}
