:root {
  color-scheme: light;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ink: #111315;
  --ink-muted: #535b62;
  --ink-soft: #737d85;
  --paper: #f3f4ef;
  --surface: #ffffff;
  --surface-2: #f7f8f4;
  --line: #d9dee0;
  --line-strong: #aeb8bf;
  --rubber: #101315;
  --rubber-2: #1d2327;
  --red: #d9362e;
  --gold: #f0ad2f;
  --green: #168b63;
  --blue: #2d779f;
  --shadow-soft: 0 22px 60px rgba(17, 19, 21, 0.16);
  --shadow-tight: 0 12px 30px rgba(17, 19, 21, 0.12);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --topbar-height: 52px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  /* `.drive-watch` bleeds full width via `100vw`, which includes the vertical
     scrollbar gutter and adds a sliver of horizontal scroll on narrow widths.
     Clip it (not `hidden`, which would break the sticky `.drive-topbar`). */
  overflow-x: clip;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(17, 19, 21, 0.04) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 82%, white);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.drive-container {
  width: min(100% - 24px, 960px);
  margin-inline: auto;
}

.drive-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(17, 19, 21, 0.95);
  color: white;
  backdrop-filter: blur(16px);
}

.drive-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  gap: 10px;
}

.drive-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: white;
  text-align: left;
  text-decoration: none;
  text-transform: uppercase;
}

.drive-brand > span:last-child {
  min-width: 0;
}

.drive-brand-bars {
  display: grid;
  gap: 4px;
  width: 30px;
  flex: 0 0 auto;
}

.drive-brand-bars i {
  display: block;
  width: 18px;
  height: 4px;
  background: currentColor;
}

.drive-brand-bars i:nth-child(2) {
  width: 30px;
  background: var(--red);
}

.drive-brand-bars i:nth-child(3) {
  width: 23px;
}

.drive-brand-name,
.drive-brand-subtitle {
  display: block;
  line-height: 1;
}

.drive-brand-name {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-brand-subtitle {
  margin-top: 3px;
  color: var(--red);
  font-size: 0.46rem;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.drive-topbar-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.drive-topbar-meta > span,
.drive-topbar-action {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 900;
}

.drive-topbar-action:hover {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.drive-topbar-share {
  border-color: color-mix(in srgb, var(--red) 82%, white);
  background: var(--red);
  color: white;
  text-transform: uppercase;
}

.drive-topbar-share:hover {
  background: #bd3029;
}

.drive-topbar-meta .watch-lap-dd,
.drive-topbar-meta .watch-play,
.drive-topbar-meta .watch-download-dd {
  display: none;
}

body.is-watch .drive-topbar-meta .watch-lap-dd {
  display: inline-block;
}

body.is-watch .drive-topbar-meta .watch-play {
  display: inline-flex;
}

.watch-download-dd {
  position: relative;
}

body.is-watch .drive-topbar-meta .watch-download-dd {
  display: inline-flex;
  align-items: stretch;
}

.watch-download-trigger {
  min-height: 30px;
}

.watch-play {
  min-height: 30px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 900;
}

.watch-ico,
.ico-play,
.ico-pause,
.ico-share,
.ico-download {
  display: none;
}

.watch-play-text,
.watch-share-text,
.watch-download-text,
.lap-full {
  display: inline;
}

.lap-short,
.watch-lap-caption {
  display: none;
}

.watch-lap-dd {
  position: relative;
}

.watch-lap-trigger {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 120px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 900;
  white-space: nowrap;
}

.watch-lap-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-lap-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.8;
}

.watch-lap-dd.is-open .watch-lap-caret {
  transform: rotate(180deg);
}

.watch-lap-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 40;
  min-width: 190px;
  max-width: min(70vw, 280px);
  max-height: 60vh;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: #15191c;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  list-style: none;
}

.watch-lap-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.watch-lap-option:hover,
.watch-lap-option:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.watch-lap-option.is-active {
  background: rgba(255, 255, 255, 0.16);
}

.watch-lap-option .opt-label {
  color: white;
}

.watch-lap-option .opt-time {
  color: rgba(255, 255, 255, 0.72);
}

.watch-lap-option.is-best .opt-label {
  color: var(--gold);
}

.watch-download-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  z-index: 42;
  min-width: 176px;
  max-width: min(70vw, 240px);
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: #15191c;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  list-style: none;
}

.watch-download-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: white;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.watch-download-menu button:hover,
.watch-download-menu button:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.watch-download-menu button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.watch-play {
  align-items: center;
  padding: 0 9px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
}

.drive-main {
  padding: 16px 0 34px;
}

body.is-watch .drive-main {
  padding-top: 0;
}

body.is-watch {
  background: var(--rubber);
}

.drive-auth {
  display: grid;
  gap: 18px;
}

.drive-auth-copy,
.drive-auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.drive-auth-copy {
  position: relative;
  overflow: hidden;
  display: grid;
  align-content: end;
  min-height: 360px;
  padding: 210px 22px 24px;
  background:
    linear-gradient(116deg, transparent 0 47%, rgba(217, 54, 46, 0.1) 47.2% 48.4%, transparent 48.6%),
    linear-gradient(90deg, rgba(17, 19, 21, 0.05) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--surface);
}

.drive-auth-copy::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  top: 40px;
  height: 132px;
  border: 12px solid var(--rubber);
  border-left-color: var(--red);
  border-bottom-color: var(--gold);
  border-radius: 999px;
  transform: skewX(-14deg);
}

.drive-auth-copy::after {
  content: "";
  position: absolute;
  right: 48px;
  top: 86px;
  width: 86px;
  height: 48px;
  border: 8px solid var(--blue);
  border-radius: 999px;
  transform: rotate(-8deg);
}

.drive-auth-copy > * {
  position: relative;
  z-index: 1;
}

.drive-auth-copy h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.5rem, 13vw, 5.4rem);
  line-height: 0.9;
}

.drive-auth-copy p:not(.drive-eyebrow) {
  margin: 18px 0 0;
  color: var(--ink-muted);
  font-size: 1.02rem;
  font-weight: 760;
}

.drive-auth-panel {
  display: grid;
  align-content: center;
  min-height: 320px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(247, 248, 244, 0.82), white 44%),
    var(--surface);
}

.drive-auth-form {
  display: grid;
  gap: 14px;
}

.drive-auth-form label {
  display: grid;
  gap: 7px;
}

.drive-auth-form span,
.drive-auth-phone {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drive-auth-form input,
.drive-auth-form select,
.drive-filters select {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink);
  font-weight: 820;
}

.drive-auth-button,
.drive-auth-secondary,
.drive-primary-action,
.drive-secondary-action,
.drive-back-button {
  min-height: 48px;
  border-radius: var(--radius-sm);
  font-weight: 950;
}

.drive-auth-button,
.drive-primary-action {
  border: 1px solid var(--red);
  background: var(--red);
  color: white;
}

.drive-auth-button:hover,
.drive-primary-action:hover {
  background: #bd3029;
}

.drive-auth-secondary,
.drive-secondary-action,
.drive-back-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.drive-auth-actions {
  display: grid;
  gap: 10px;
}

.drive-auth-phone {
  margin: 0 0 2px;
}

.drive-auth-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.drive-auth-message[data-tone="error"] {
  color: var(--red);
}

.drive-auth-message[data-tone="ok"] {
  color: var(--green);
}

.drive-workspace,
.drive-screen {
  display: grid;
  gap: 16px;
}

.drive-eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.drive-home-head,
.drive-screen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drive-screen-head {
  align-items: flex-start;
  justify-content: flex-start;
}

.drive-screen-head h1 {
  margin: 0;
  /* 11vw oversized the date+time screen title on phones so it broke mid-date
     ("Sunday 24 May" / "2026 12.31pm"); a gentler vw keeps the clean date/time
     wrap while the 4rem cap leaves wide screens unchanged. */
  font-size: clamp(2rem, 8.6vw, 4rem);
  line-height: 1.03;
}

.drive-screen-head p:not(.drive-eyebrow) {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-weight: 780;
}

.drive-icon-button {
  position: relative;
  display: inline-grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.drive-icon-button::before,
.drive-icon-button::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.drive-icon-button::before {
  width: 17px;
  height: 17px;
  border: 3px solid var(--ink);
  border-right-color: transparent;
}

.drive-icon-button::after {
  right: 10px;
  top: 14px;
  width: 0;
  height: 0;
  border-left: 7px solid var(--ink);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: rotate(-22deg);
}

.drive-back-button {
  min-width: 78px;
  flex: 0 0 auto;
}

.drive-back-light {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.drive-latest-card,
.drive-empty-state,
.drive-session-card,
.drive-lap-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.drive-latest-card {
  display: grid;
  width: 100%;
  overflow: hidden;
  padding: 0;
  color: var(--ink);
  text-align: left;
}

.drive-latest-card:hover,
.drive-session-card:hover,
.drive-lap-row:hover,
.drive-driver-row:hover {
  border-color: color-mix(in srgb, var(--red) 56%, var(--line));
  transform: translateY(-1px);
}

.drive-poster {
  position: relative;
  display: grid;
  min-height: 168px;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, rgba(240, 173, 47, 0.25), transparent 24%),
    linear-gradient(130deg, #080a0b, #1e282f);
}

.drive-poster::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  width: 86px;
  height: 24px;
  background:
    linear-gradient(90deg, var(--red) 0 34%, var(--gold) 34% 68%, rgba(255, 255, 255, 0.68) 68%);
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}

.drive-poster-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.92;
  pointer-events: none;
}

.drive-poster-has-media::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(5, 7, 8, 0.08), rgba(5, 7, 8, 0.36)),
    linear-gradient(90deg, rgba(5, 7, 8, 0.18), transparent 42%);
}

.drive-poster-has-media .drive-track-mark {
  display: none;
}

.drive-other-poster {
  background:
    radial-gradient(circle at 24% 20%, rgba(45, 119, 159, 0.26), transparent 24%),
    linear-gradient(130deg, #090b0c, #252018);
}

.drive-latest-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.drive-latest-title {
  display: grid;
  gap: 8px;
}

.drive-latest-title h1 {
  margin: 0;
  font-size: clamp(1.45rem, 7.4vw, 2.35rem);
  /* The date+time title wraps to two lines on phone widths; 0.98 crowded the
     lines, so give the wrap a little breathing room. */
  line-height: 1.06;
}

.drive-latest-title p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 1rem;
  font-weight: 780;
}

.drive-fact-row,
.drive-session-meta,
.drive-lap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.drive-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 92px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: center;
}

.drive-home-actions {
  display: grid;
  gap: 10px;
}

.drive-primary-action,
.drive-secondary-action {
  width: 100%;
}

.drive-empty-state {
  padding: 24px;
}

.drive-empty-state h2 {
  margin: 0;
  font-size: 1.5rem;
}

.drive-empty-state p {
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-weight: 740;
}

.drive-filters {
  display: grid;
  gap: 7px;
}

.drive-filters span {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drive-session-list,
.drive-lap-list,
.drive-driver-list {
  display: grid;
  gap: 10px;
}

.drive-session-card,
.drive-lap-row,
.drive-driver-row {
  display: grid;
  width: 100%;
  min-width: 0;
  padding: 14px;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.drive-driver-row {
  min-height: 82px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-tight);
}

.drive-driver-row-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.drive-driver-row-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.18;
}

.drive-driver-row-main span,
.drive-driver-shared {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 900;
}

.drive-driver-row-main span {
  white-space: nowrap;
}

.drive-driver-shared {
  color: var(--red);
}

.drive-session-card {
  min-height: 126px;
  gap: 12px;
}

.drive-session-card[aria-current="true"],
.drive-lap-row[aria-current="true"] {
  border-color: var(--red);
  background:
    linear-gradient(135deg, rgba(217, 54, 46, 0.08), transparent 48%),
    var(--surface);
}

.drive-session-name,
.drive-lap-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.drive-session-name strong,
.drive-lap-main strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.18;
}

.drive-session-name strong {
  font-size: 1.12rem;
}

.drive-session-subtitle {
  color: var(--ink-muted);
  font-size: 0.96rem;
  font-weight: 780;
  line-height: 1.25;
}

.drive-session-name span,
.drive-lap-main span {
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 950;
  white-space: nowrap;
}

.drive-lap-row {
  min-height: 74px;
  gap: 8px;
}

.drive-best-badge {
  border-color: color-mix(in srgb, var(--gold) 65%, var(--line));
  background: rgba(240, 173, 47, 0.14);
  color: #725000;
}

.drive-status {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-muted);
  font-weight: 820;
}

.drive-watch {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0 0 12px;
  background: var(--rubber);
  color: white;
}

.drive-rpm-panel,
.drive-map-row {
  width: min(100% - 24px, 960px);
  margin-inline: auto;
}

body.is-video-only .drive-rpm-panel,
body.is-video-only .drive-map-row,
body.is-video-only .drive-overlay-layer,
body.is-video-only .drive-turn-gg-canvas {
  display: none;
}

body.is-telemetry-overlay-disabled .drive-rpm-panel,
body.is-telemetry-overlay-disabled .drive-overlay-layer,
body.is-telemetry-overlay-disabled .drive-turn-gg-canvas {
  display: none;
}

body.is-speedometer-rpm-renderers-inert .drive-rpm-panel {
  display: none;
}

body.is-rpm-graph-renderer-inert .drive-rpm-panel {
  display: none;
}

body.is-speedometer-renderer-inert .drive-overlay-stage .telemetry-hud,
body.is-speedometer-rpm-renderers-inert .drive-overlay-stage .telemetry-hud {
  display: none;
}

.drive-player-stage {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 0;
  background: transparent;
}

.drive-player-frame {
  position: relative;
  overflow: hidden;
  width: min(100% - 14px, 1080px);
  margin-inline: auto;
  aspect-ratio: 16 / 9;
  min-height: 188px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: #050708;
  box-shadow: 0 22px 62px rgba(0, 0, 0, 0.34);
}

.drive-player-frame::before {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  pointer-events: none;
  border-top: 2px solid rgba(255, 255, 255, 0.38);
  border-left: 2px solid rgba(255, 255, 255, 0.22);
}

.drive-player-frame::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 2;
  width: 76px;
  height: 22px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--red) 0 34%, var(--gold) 34% 68%, rgba(255, 255, 255, 0.65) 68%);
  clip-path: polygon(10% 0, 100% 0, 90% 100%, 0 100%);
}

.drive-player-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050708;
}

.drive-lap-clock {
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 5;
  display: inline-flex;
  gap: 2px;
  align-items: baseline;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(5, 7, 8, 0.55);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.drive-lap-clock[hidden] {
  display: none;
}

.drive-lap-clock-sep,
#watchLapClockTotal {
  color: rgba(255, 255, 255, 0.72);
}

.drive-video-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 24px;
  background:
    radial-gradient(circle at 75% 18%, rgba(240, 173, 47, 0.22), transparent 22%),
    linear-gradient(130deg, #080a0b, #182026);
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.drive-video-empty[hidden] {
  display: none;
}

.drive-video-empty p {
  margin: 0;
  font-weight: 820;
}

.drive-track-mark {
  position: relative;
  width: min(70%, 380px);
  aspect-ratio: 2.6 / 1;
}

.drive-track-mark span {
  position: absolute;
  display: block;
  border: 4px solid var(--gold);
  border-radius: 999px;
  filter: drop-shadow(0 0 14px rgba(240, 173, 47, 0.34));
}

.drive-track-mark span:nth-child(1) {
  inset: 16% 8% 16% 8%;
  transform: skewX(-16deg);
}

.drive-track-mark span:nth-child(2) {
  left: 22%;
  top: 26%;
  width: 28%;
  height: 24%;
  border-color: var(--red);
}

.drive-track-mark span:nth-child(3) {
  right: 20%;
  bottom: 22%;
  width: 20%;
  height: 22%;
  border-color: var(--blue);
}

.drive-rpm-panel {
  position: relative;
  min-height: 76px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius-md);
  background: rgba(5, 7, 8, 0.42);
}

.drive-rpm-panel canvas {
  display: block;
  width: 100%;
  height: 76px;
  cursor: crosshair;
  touch-action: none;
}

.drive-overlay-status {
  position: absolute;
  inset: 5px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: calc(var(--radius-md) - 4px);
  background: rgba(5, 7, 8, 0.78);
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 900;
}

.drive-overlay-status[hidden] {
  display: none;
}

.drive-overlay-status span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-overlay-status button {
  min-height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 900;
  cursor: pointer;
}

.drive-control-button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-weight: 900;
}

.drive-control-button:hover {
  background: rgba(255, 255, 255, 0.13);
  color: white;
}

.drive-control-primary {
  border-color: color-mix(in srgb, var(--red) 82%, white);
  background: var(--red);
  color: white;
}

.drive-control-primary:hover {
  background: #bd3029;
}

.drive-topbar-meta .watch-play,
.drive-topbar-meta .watch-play:hover {
  min-height: 30px;
  padding: 0 9px;
  border-color: rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.7rem;
}

.drive-topbar-meta .watch-play:hover {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.drive-map-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.drive-map-row.no-stats {
  grid-template-columns: minmax(0, 1fr);
}

.drive-inline-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.track-map-rail {
  display: grid;
  grid-template-rows: 58px 1fr 1fr 44px 32px;
  gap: 4px;
  min-width: 0;
  height: 100%;
  min-height: 218px;
}

.track-map-mode-control {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
}

.track-map-mode-control button {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: calc(var(--radius-xs) - 1px);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.track-map-mode-control button:focus-visible,
.track-map-nav-button:focus-visible,
.track-map-comparison-control button:focus-visible {
  outline: 2px solid #ff982f;
  outline-offset: 2px;
}

.track-map-mode-control button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.track-map-comparison-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
}

.track-map-comparison-control button {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius-xs) - 1px);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  font-weight: 900;
}

.track-map-comparison-control button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.track-map-comparison-control button:disabled {
  cursor: default;
  opacity: 0.44;
}

.track-map-nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  cursor: pointer;
}

.track-map-nav-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.track-map-nav-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
  color: white;
}

.track-map-nav-button:disabled {
  cursor: default;
  opacity: 0.38;
}

.track-map-turn-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 38px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  line-height: 1;
  text-align: center;
}

.track-map-turn-readout span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.track-map-turn-readout strong {
  color: white;
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: 0;
}

.track-map-message {
  box-sizing: border-box;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 7px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  overflow: hidden;
  padding-inline: 6px;
  border-radius: var(--radius-xs);
  background: rgba(5, 7, 8, 0.72);
  color: rgba(255, 255, 255, 0.74);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.track-map-message:empty {
  visibility: hidden;
  opacity: 0;
}

.track-map-legend {
  position: absolute;
  top: 6px;
  left: 8px;
  z-index: 3;
  display: inline-grid;
  grid-template-columns: repeat(2, max-content);
  align-items: center;
  gap: 8px;
  width: 148px;
  height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(246, 250, 252, 0.16);
  border-radius: var(--radius-xs);
  background: #050708;
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  white-space: nowrap;
}

.track-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.track-map-legend b {
  font: inherit;
}

.track-map-legend-sample {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 6px;
  flex: 0 0 24px;
}

.track-map-legend-sample::before,
.track-map-legend-sample::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.track-map-legend-sample-actual::before {
  height: 4px;
  border-radius: 999px;
  background: rgba(4, 7, 9, 0.9);
}

.track-map-legend-sample-actual::after {
  height: 2px;
  border-radius: 999px;
  background: #00BFFF;
}

.track-map-legend-sample-ghost::before {
  height: 4px;
  background: radial-gradient(circle, rgba(4, 7, 9, 0.92) 0 2px, transparent 2.1px) 0 50% / 8px 4px repeat-x;
}

.track-map-legend-sample-ghost::after {
  height: 2px;
  background: radial-gradient(circle, #FF4050 0 1px, transparent 1.1px) 0 50% / 8px 2px repeat-x;
}

.track-map-canvas-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 218px;
  min-height: 120px;
  max-height: 218px;
  margin-inline: auto;
}

#trackMapCanvas {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  background: transparent;
}

.track-map-turn-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.track-map-turn-layer[hidden] {
  display: none;
}

.track-map-turn-button {
  position: absolute;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  translate: -50% -50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(8, 12, 15, 0.86);
  color: #f3f4f4;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.34);
}

.track-map-turn-button:focus-visible {
  outline: 2px solid #ff982f;
  outline-offset: 2px;
}

.drive-turn-stats {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  font-family: var(--font-mono);
}

.drive-turn-stats[hidden] {
  display: none;
}

.turn-stat-current {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.turn-stat-cell {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  line-height: 1.1;
}

.turn-stat-cell .cap {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.turn-stat-cell strong {
  color: white;
  font-size: 0.92rem;
  font-weight: 900;
  margin-left: auto;
}

.turn-stat-cell .unit {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.5rem;
  font-weight: 900;
  margin-left: 3px;
}

.pwa-install {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100% - 24px));
  padding: 12px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: #15191c;
  color: white;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  font-family: var(--font-sans);
}

.pwa-install[hidden] {
  display: none !important;
}

body.is-watch .pwa-install {
  display: none !important;
}

.pwa-install-mark {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  width: 26px;
}

.pwa-install-mark i {
  display: block;
  height: 4px;
  background: currentColor;
}

.pwa-install-mark i:nth-child(1) {
  width: 16px;
}

.pwa-install-mark i:nth-child(2) {
  width: 26px;
  background: var(--red);
}

.pwa-install-mark i:nth-child(3) {
  width: 20px;
}

.pwa-install-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pwa-install-title {
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.1;
}

.pwa-install-text {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.74rem;
  font-weight: 720;
  line-height: 1.2;
}

.pwa-install-action {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--red);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.pwa-install-action[hidden] {
  display: none;
}

.pwa-install-close {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.pwa-install-close::before,
.pwa-install-close::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 14px;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: white;
}

.pwa-install-close::before {
  transform: rotate(45deg);
}

.pwa-install-close::after {
  transform: rotate(-45deg);
}

.drive-turn-gg-canvas {
  position: absolute;
  z-index: 6;
  pointer-events: none;
}

.share-dialog,
.download-dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.share-dialog {
  border-radius: var(--radius-md);
}

.share-dialog::backdrop,
.download-dialog::backdrop {
  background: rgba(17, 19, 21, 0.56);
}

.share-dialog-panel,
.download-dialog-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 14px;
}

.share-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-dialog-head h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.1;
}

.share-dialog-close {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.share-dialog-close::before,
.share-dialog-close::after {
  background: var(--ink);
}

.share-choice-list {
  display: grid;
  gap: 8px;
}

.share-choice {
  width: 100%;
  min-height: 44px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 900;
  text-align: left;
  overflow-wrap: anywhere;
}

.share-choice:hover:not(:disabled),
.share-choice:focus-visible {
  border-color: color-mix(in srgb, var(--red) 56%, var(--line));
  background: white;
}

.share-choice:disabled {
  cursor: default;
  opacity: 0.52;
}

.share-dialog-status {
  min-height: 22px;
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.86rem;
  font-weight: 780;
}

.share-dialog-status[data-tone="error"] {
  color: var(--red);
}

.share-dialog-status[data-tone="ok"] {
  color: var(--green);
}

.share-dialog-url {
  display: grid;
  gap: 8px;
}

.share-dialog-url label {
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.share-dialog-url input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.share-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-dialog-actions .drive-secondary-action,
.share-dialog-actions .drive-primary-action {
  min-height: 40px;
}

.download-dialog {
  width: min(760px, calc(100vw - 24px));
}

.download-preview {
  display: block;
  width: 100%;
  aspect-ratio: var(--download-preview-ratio, 16 / 9);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #050708;
}

.download-progress {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.download-progress span {
  display: block;
  width: var(--download-progress, 0%);
  height: 100%;
  background: var(--red);
  transition: width 120ms linear;
}

.drive-detail-grid {
  display: grid;
  gap: 10px;
}

.drive-detail-card {
  position: relative;
  overflow: hidden;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.drive-detail-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green), var(--blue));
}

.drive-detail-card span,
.drive-detail-card strong {
  display: block;
}

.drive-detail-card span {
  margin-top: 5px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drive-detail-card strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 1rem;
}

.drive-hidden {
  display: none !important;
}

@media (max-width: 380px) {
  .drive-container {
    width: min(100% - 16px, 960px);
  }

  .drive-brand {
    gap: 8px;
  }

  .drive-brand-bars {
    gap: 3px;
    width: 26px;
  }

  .drive-brand-bars i {
    width: 16px;
    height: 3px;
  }

  .drive-brand-bars i:nth-child(2) {
    width: 26px;
  }

  .drive-brand-bars i:nth-child(3) {
    width: 20px;
  }

  .drive-brand-name {
    font-size: 0.92rem;
  }

  .drive-brand-subtitle {
    font-size: 0.37rem;
  }

  .drive-topbar-meta {
    gap: 5px;
  }

  .drive-topbar-action {
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.66rem;
  }
}

@media (max-width: 719px) and (orientation: portrait) {
  body.is-watch .drive-topbar-inner {
    gap: 8px;
  }

  body.is-watch .drive-brand {
    flex: 0 0 auto;
  }

  body.is-watch .drive-brand-name {
    overflow: visible;
    text-overflow: clip;
  }

  body.is-watch .drive-topbar-meta {
    flex: 0 1 auto;
    min-width: 0;
  }

  body.is-watch .watch-lap-trigger {
    min-height: 40px;
    max-width: 58px;
    padding: 0 7px;
    justify-content: center;
    gap: 4px;
  }

  body.is-watch .watch-lap-trigger .lap-full,
  body.is-watch .watch-lap-option .lap-full {
    display: none;
  }

  body.is-watch .watch-lap-trigger .lap-short,
  body.is-watch .watch-lap-option .lap-short {
    display: inline;
  }

  body.is-watch .watch-play,
  body.is-watch .drive-topbar-share,
  body.is-watch .watch-download-trigger {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
  }

  body.is-watch .watch-play:hover {
    min-height: 40px;
    padding: 0;
  }

  body.is-watch .watch-play-text,
  body.is-watch .watch-share-text,
  body.is-watch .watch-download-text {
    display: none;
  }

  body.is-watch .watch-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.is-watch .watch-ico svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  body.is-watch .watch-play .ico-play {
    display: block;
  }

  body.is-watch .watch-play .ico-pause {
    display: none;
  }

  body.is-watch .watch-play.is-playing .ico-play {
    display: none;
  }

  body.is-watch .watch-play.is-playing .ico-pause {
    display: block;
  }

  body.is-watch .drive-topbar-share .ico-share {
    display: block;
  }

  body.is-watch .watch-download-trigger .ico-download {
    display: block;
  }
}

@media (max-width: 340px) and (orientation: portrait) {
  body.is-watch .drive-topbar-inner {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 6px;
    padding-block: 6px;
  }

  body.is-watch .drive-brand {
    flex-basis: 100%;
    justify-content: center;
  }

  body.is-watch .drive-topbar-meta {
    flex-basis: 100%;
    justify-content: center;
  }
}

@media (min-width: 720px) {
  :root {
    --topbar-height: 72px;
  }

  .drive-container {
    width: min(100% - 40px, 1080px);
  }

  .drive-main {
    padding: 28px 0 44px;
  }

  .drive-brand-name {
    font-size: 1.3rem;
  }

  .drive-brand-subtitle {
    font-size: 0.52rem;
  }

  .drive-auth {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
    align-items: stretch;
    min-height: calc(100vh - var(--topbar-height) - 72px);
  }

  .drive-auth-copy,
  .drive-auth-panel {
    min-height: 520px;
  }

  .drive-auth-copy {
    padding: clamp(24px, 6vw, 62px);
  }

  .drive-auth-copy::before {
    left: clamp(24px, 6vw, 62px);
    right: clamp(24px, 6vw, 62px);
    top: clamp(28px, 6vw, 68px);
    height: clamp(150px, 22vw, 260px);
    border-width: 14px;
  }

  .drive-auth-copy::after {
    right: clamp(34px, 8vw, 116px);
    top: clamp(76px, 11vw, 150px);
    width: clamp(90px, 12vw, 160px);
    height: clamp(48px, 7vw, 86px);
    border-width: 10px;
  }

  .drive-auth-copy h1 {
    width: min(100%, 760px);
    font-size: clamp(2.8rem, 7vw, 6.2rem);
  }

  .drive-auth-copy p:not(.drive-eyebrow) {
    width: min(100%, 620px);
    font-size: 1.1rem;
  }

  .drive-auth-panel {
    padding: clamp(22px, 4vw, 34px);
  }

  .drive-auth-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .drive-latest-card {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  }

  .drive-poster {
    min-height: 260px;
  }

  .drive-latest-body {
    align-content: center;
    padding: 22px;
  }

  .drive-latest-title h1 {
    font-size: clamp(1.85rem, 3.1vw, 3.1rem);
  }

  .drive-home-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .drive-session-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drive-lap-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .drive-player-frame {
    width: min(100% - 40px, 1080px);
    border-radius: var(--radius-md);
  }

  .drive-rpm-panel,
  .drive-map-row {
    width: min(100% - 40px, 1080px);
  }

  .track-map-canvas-wrap {
    min-height: 146px;
    max-height: 220px;
  }

}

/* Watch viewport shell: fixed, orientation-aware layout. */
body.is-watch {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-watch .drive-topbar {
  position: static;
  flex: 0 0 auto;
}

body.is-watch .drive-main {
  flex: 1 1 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.is-watch .drive-workspace {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
}

body.is-watch .drive-watch {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin-left: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

body.is-watch .drive-player-stage {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.is-watch .drive-player-frame {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  margin: 0;
  aspect-ratio: auto;
}

body.is-watch .drive-rpm-panel {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
}

body.is-watch .drive-map-row {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
}

@media (orientation: landscape) {
  body.is-watch {
    flex-direction: row;
  }

  body.is-watch .drive-topbar {
    position: relative;
    z-index: 80;
    flex: 0 0 auto;
    width: clamp(64px, 13vw, 88px);
    height: 100%;
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    overflow: visible;
  }

  body.is-watch .drive-topbar-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 0;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 4px;
  }

  body.is-watch .drive-brand {
    justify-content: center;
    gap: 0;
  }

  body.is-watch .drive-brand > span:last-child {
    display: none;
  }

  body.is-watch .drive-topbar-meta {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
  }

  body.is-watch .watch-lap-dd {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
  }

  body.is-watch .watch-lap-caption {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-mono);
    font-size: 0.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
  }

  body.is-watch .watch-lap-trigger {
    width: 100%;
    max-width: none;
    min-height: 34px;
    padding: 0 4px;
    justify-content: center;
    gap: 4px;
  }

  body.is-watch .watch-lap-trigger .lap-full {
    display: none;
  }

  body.is-watch .watch-lap-trigger .lap-short {
    display: inline;
  }

  body.is-watch .watch-lap-caret {
    display: inline-block;
  }

  body.is-watch .watch-lap-option .lap-full {
    display: none;
  }

  body.is-watch .watch-lap-option .lap-short {
    display: inline;
  }

  body.is-watch .watch-play,
  body.is-watch .drive-topbar-share,
  body.is-watch .watch-download-dd,
  body.is-watch .watch-download-trigger {
    width: 100%;
    min-height: 34px;
    padding: 0;
    justify-content: center;
  }

  body.is-watch .watch-play:hover {
    min-height: 34px;
    padding: 0;
  }

  body.is-watch .watch-play-text,
  body.is-watch .watch-share-text,
  body.is-watch .watch-download-text {
    display: none;
  }

  body.is-watch .watch-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  body.is-watch .watch-ico svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  body.is-watch .watch-play .ico-play {
    display: block;
  }

  body.is-watch .watch-play .ico-pause {
    display: none;
  }

  body.is-watch .watch-play.is-playing .ico-play {
    display: none;
  }

  body.is-watch .watch-play.is-playing .ico-pause {
    display: block;
  }

  body.is-watch .drive-topbar-share .ico-share {
    display: block;
  }

  body.is-watch .watch-download-trigger .ico-download {
    display: block;
  }

  /* In the left rail the menu would clip off-screen with right:0; open it
     rightward over the video instead. */
  body.is-watch .watch-lap-menu {
    right: auto;
    left: calc(100% + 4px);
    min-width: 214px;
    max-width: min(72vw, 320px);
  }

  body.is-watch .watch-download-menu {
    right: auto;
    left: calc(100% + 4px);
  }

  body.is-watch .drive-main {
    flex: 1 1 0;
    min-height: 0;
  }

  body.is-watch .drive-player-stage {
    display: grid;
    gap: 6px;
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "video rpm"
      "video map";
  }

  body.is-watch .drive-player-frame {
    grid-area: video;
    min-height: 0;
    height: 100%;
    width: 100%;
    margin: 0;
  }

  body.is-watch .drive-rpm-panel {
    grid-area: rpm;
    min-height: 0;
  }

  body.is-watch .drive-map-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    grid-area: map;
    min-height: 0;
    overflow: hidden;
  }

  body.is-watch .drive-map-row .drive-inline-map {
    flex: 1 1 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px;
    align-content: stretch;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.is-watch .drive-map-row .drive-turn-stats {
    flex: 0 0 auto;
  }

  body.is-watch .drive-map-row .track-map-canvas-wrap {
    min-height: 0;
    height: 100%;
    max-height: none;
    align-self: stretch;
  }

  body.is-watch .drive-map-row .track-map-rail {
    min-height: 0;
  }
}

body.is-share #logoutButton,
body.is-share #topbarShareButton,
body.is-share #topbarDownloadButton {
  display: none !important;
}
