:root {
  color-scheme: dark;
  --bg: #10141c;
  --panel: #151b25;
  --inset: #0c1017;
  --line: #293343;
  --text: #f1f5fb;
  --muted: #a0aec2;
  --accent: #ffb17d;
  --green: #97e6bc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1, h2, h3, p { margin: 0; }
button, select { font: inherit; color: inherit; }
button, select {
  display: inline-grid;
  place-items: center;
  background: #1d2532;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
  padding: 0 11px;
  font-size: .875rem;
  font-weight: 600;
}
button:hover:not(:disabled), select:hover:not(:disabled) { background: #293647; }
button:disabled, select:disabled { opacity: .45; cursor: default; }
button:focus-visible, select:focus-visible, canvas:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button[aria-pressed="true"] { background: #343039; border-color: #765542; color: #ffd0ad; }
.icon { width: 38px; padding: 0; font-size: 1.25rem; }
.top {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; font-weight: 750; }
.brand-icon {
  display: grid;
  place-items: center;
  height: 33px;
  width: 33px;
  border-radius: 9px;
  background: var(--accent);
  color: #271a15;
  font-size: 1.45rem;
  line-height: 1;
}
.connection { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--muted); }
.connection::before { content: ""; width: 7px; height: 7px; border-radius: 100%; background: currentColor; }
.connection.connected { color: var(--green); }
.workspace {
  display: grid;
  max-width: 1900px;
  margin: auto;
  grid-template-columns: clamp(199px, 20vw, 272px) minmax(0, 1fr) clamp(188px, 18vw, 244px);
  min-height: calc(100dvh - 68px);
}
.library, .notes { padding: 24px 16px; background: var(--panel); min-width: 0; }
.library { border-right: 1px solid var(--line); }
.notes { border-left: 1px solid var(--line); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 19px; gap: 8px; }
.sidebar-head h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.sidebar-head p, .marker-empty { color: var(--muted); font-size: .875rem; line-height: 1.5; margin-top: 3px; }
.recording-list { max-height: calc(100dvh - 181px); overflow-y: auto; padding: 1px 4px 4px 1px; }
.rides { display: grid; gap: 5px; }
.rides h3 { font-size: .78rem; color: var(--muted); font-weight: 650; margin: 12px 0 3px 7px; }
.rides h3:first-child { margin-top: 0; }
.ride-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px;
  background: transparent;
  border-color: transparent;
  text-align: left;
  width: 100%;
}
.ride-row img { width: 58px; height: 38px; border-radius: 5px; background: var(--inset); object-fit: cover; }
.ride-row b, .ride-row small { display: block; }
.ride-row b { font-size: .92rem; }
.ride-row small { font-size: .75rem; color: var(--muted); margin-top: 3px; }
.review { min-width: 0; padding: 27px clamp(16px, 2.1vw, 35px); }
.ride-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ride-date { color: var(--muted); font-size: .875rem; line-height: 1.4; }
.ride-heading h1 { font-size: clamp(1.5rem, 2.5vw, 2.25rem); letter-spacing: -.04em; line-height: 1.15; margin-top: 3px; }
.quality { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: .75rem; text-align: center; }
.player { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.viewport { aspect-ratio: 16 / 9; position: relative; background: var(--inset); }
canvas, .fallback { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
canvas { touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas:focus-visible { outline-offset: -3px; }
#video:not(.fallback) { width: 1px; height: 1px; position: absolute; opacity: 0; pointer-events: none; }
.viewer-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: 82%;
  padding: 12px 16px;
  background: #10141ced;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: .9rem;
  text-align: center;
  pointer-events: none;
}
.floating { position: absolute; bottom: 12px; }
.floating { right: 12px; background: #10141cea; border-color: #ffffff35; }
.transport { padding: 8px 12px 11px; }
.timeline { padding-top: 13px; position: relative; }
.timeline input {
  --progress: 0%;
  appearance: none;
  width: 100%;
  height: 5px;
  display: block;
  margin: 0;
  border-radius: 9px;
  background: linear-gradient(to right, var(--accent) var(--progress), #3b4960 var(--progress));
  cursor: pointer;
}
.timeline input::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); }
.timeline input::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; }
.marker-track { position: absolute; top: 0; left: 6px; right: 6px; height: 12px; pointer-events: none; }
.pin { position: absolute; pointer-events: auto; height: 12px; width: 10px; min-height: 0; background: var(--accent); border: 0; padding: 0; border-radius: 2px; transform: translateX(-50%); clip-path: polygon(0 0, 100% 0, 100% 68%, 50% 100%, 0 68%); }
.pin:hover:not(:disabled) { background: white; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 13px; }
.controls-end { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.play { background: var(--accent); color: #2a1a12; border-color: transparent; font-size: 1rem; }
.play:hover:not(:disabled) { background: #ffc7a3; }
select { appearance: none; padding-right: 23px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='m3 5 3 3 3-3' fill='none' stroke='%23a0aec2' stroke-width='1.5'/%3E%3C/svg%3E"); background-position: right 5px center; background-repeat: no-repeat; }
select:hover:not(:disabled) { background-color: #293647; }
.timecode { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; margin: 0 4px; white-space: nowrap; }
.timecode b { color: var(--text); }
.view-options { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.view-options p { color: var(--muted); font-size: .82rem; }
.view-options div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.view-options button { background: transparent; min-height: 33px; }
.view-options button[aria-pressed="true"] { background: #343039; }
.flag { display: flex; justify-content: flex-start; align-items: center; gap: 8px; width: 100%; color: #2a1a12; background: var(--accent); border-color: transparent; padding: 0 9px; }
.flag:hover:not(:disabled) { background: #ffc7a3; }
.flag kbd { margin-left: auto; padding: 1px 5px; background: #a9633a45; border: 1px solid #9c5b391f; border-radius: 4px; }
.marker-empty { margin-top: 13px; }
.markers { display: grid; gap: 7px; margin-top: 12px; }
.marker { display: flex; align-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.moment { display: flex; flex-wrap: wrap; justify-content: flex-start; border: 0; border-radius: 0; background: transparent; text-align: left; gap: 6px; flex: 1; padding: 7px 8px; }
.moment b { color: var(--accent); font-size: .81rem; font-variant-numeric: tabular-nums; }
.moment span { font-size: .75rem; color: var(--muted); }
.remove { background: transparent; border: none; width: 26px; color: var(--muted); }
#marker-error { margin-top: 12px; color: var(--accent); font-size: .8rem; }
.player:fullscreen { border: 0; border-radius: 0; display: flex; flex-direction: column; }
.player:fullscreen .viewport { flex: 1; min-height: 0; aspect-ratio: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 190px minmax(0, 1fr); }
  .library { grid-row: span 2; }
  .notes { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); }
  .flag, .markers { max-width: 360px; }
}
@media (max-width: 610px) {
  .workspace { display: flex; flex-direction: column; }
  .review { order: -1; }
  .library, .notes { border: 0; border-top: 1px solid var(--line); padding: 16px; }
  .recording-list { max-height: 40vh; }
  .top { padding-inline: 14px; }
  .floating { bottom: 7px; right: 7px; }
  .view-options { align-items: start; }
}

#ride-title { overflow-wrap: anywhere; }

#speed { display: inline-flex; gap: 1px; padding: 2px; margin: 0; border: 1px solid var(--line); border-radius: 9px; }
#speed button { min-height: 30px; padding: 0 6px; border-radius: 6px; font-size: .78rem; }
#speed button[aria-pressed="false"] { background: transparent; border-color: transparent; }
.quality { white-space: nowrap; }

#connect { width: 100%; margin-bottom: 12px; }
