
:root {
  /* Legacy font aliases — now deferred to motorsport.css --vg-font-* tokens */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-display: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'Menlo', monospace;
}
body { font-family: var(--font-sans); }


:root {
  --bg-deep: #050608;
  --bg-panel: rgba(255, 255, 255, 0.055);
  --bg-elevated: rgba(255, 255, 255, 0.085);
  --line: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.55);
  --accent: #409cff;
  --accent-dim: #1a6ed8;
  --warn: #ff9f0a;
  --map-line: #5ac8fa;
}


* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

img,
svg {
  max-width: 100%;
}

table {
  max-width: 100%;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font-sans), "Exo 2", "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg-deep);
  overflow-x: hidden;
  letter-spacing: 0.01em;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Vision GlassUI: No background photo — deep space via motorsport.css */
body::before {
  display: none;
}

body::after {
  display: none;
}

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

.lang-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.lang-flags--login {
  margin-bottom: 4px;
  gap: 10px;
}

.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.04) 45%, transparent 100%),
    rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 6px 18px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.lang-flag:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-1px);
}

.lang-flag.is-active {
  border-color: rgba(61, 214, 140, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 1px rgba(61, 214, 140, 0.25),
    0 8px 22px rgba(0, 0, 0, 0.22);
}

.lang-flag-emoji {
  font-size: 1.35rem;
  line-height: 1;
}

.lang-flag-label {
  font-size: 13px;
  font-weight: 600;
}

.lang-flags--compact .lang-flag {
  min-width: 40px;
  min-height: 40px;
  padding: 6px 8px;
}

.lang-flags--compact .lang-flag-emoji {
  font-size: 1.2rem;
}

.home-header-actions .lang-flags {
  margin-right: 2px;
}


.leaflet-container {
  background: #0f1714;
  font: inherit;
  touch-action: pan-x pan-y;
}

html {
  -webkit-text-size-adjust: 100%;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 48px 24px 80px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
  padding-bottom: max(80px, calc(24px + env(safe-area-inset-bottom)));
}

.page-shell--narrow {
  max-width: 980px;
}

.page-shell--wide {
  max-width: 1180px;
}

.page-shell--share {
  max-width: 960px;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 80;
  background: rgba(10, 16, 14, 0.78);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.site-nav-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}

.site-nav-brand {
  font-family: var(--font-display), "Teko", sans-serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 8px 2px 0;
  margin-right: 4px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.45);
}

.site-nav-links,
.site-nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.site-nav-actions {
  margin-left: auto;
}

.site-nav .btn-ghost,
.site-nav .btn-accent,
.site-nav .upload-btn,
.site-nav .logout-btn {
  font-size: 13px;
  padding: 8px 12px;
  min-height: 0;
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

.site-nav .btn-ghost.is-active {
  color: var(--accent);
  border-color: rgba(61, 214, 140, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(61, 214, 140, 0.18);
}

.has-site-nav .page-shell {
  padding-top: 28px;
}

.mono {
  font-family: var(--font-mono), ui-monospace, monospace;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-hero,
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}

.page-hero-main,
.home-header-main {
  min-width: 0;
  flex: 1;
}

.page-hero h1,
.home-header h1 {
  margin: 8px 0 0;
  font-size: clamp(1.7rem, 6vw, 2.85rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.page-hero-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.page-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--accent);
}

.glass-panel,
.live-share-box,
.device-ping-help {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 24, 20, 0.62);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 16px 40px rgba(0, 0, 0, 0.2);
}

.live-share-box,
.device-ping-help {
  margin: 0 0 18px;
  padding: 16px 18px;
}

.panel-title {
  margin: 0 0 8px;
  font-weight: 650;
}

.panel-copy {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.panel-msg {
  display: none;
  margin: 10px 0 0;
  color: var(--accent);
  font-size: 13px;
}

.live-share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}

.live-share-row .field-input {
  flex: 1;
  min-width: min(100%, 220px);
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 11, 0.55);
  color: var(--text);
  border-radius: 12px;
  font: inherit;
}

.field-input:focus {
  outline: none;
  border-color: rgba(61, 214, 140, 0.5);
}

.form-error {
  color: #e88a6a;
  margin: 14px 0 0;
  font-size: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  padding-top: max(28px, env(safe-area-inset-top));
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px;
}

.auth-title {
  margin: 10px 0 18px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.auth-lead {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-footer {
  margin: 22px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

.auth-card .profile-form {
  margin-top: 22px;
}

.auth-card .btn-accent,
.auth-card .btn-ghost {
  width: 100%;
}

.ride-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ride-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.ride-list-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ride-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.share-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 420px;
}

.home-header-main {
  flex-shrink: 0;
  min-width: 0;
}

.year-km-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.year-km-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(16, 24, 20, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.year-km-card .eyebrow {
  color: var(--muted);
}

.year-km-value {
  margin: 8px 0 0;
  font-size: 1.45rem;
  font-weight: 650;
}

/* GlassUI headings — Inter, no forced uppercase */
h1,
h2,
.home-header h1 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}


.share-card-wrap .share-card-title {
  font-family: var(--font-display), "Teko", sans-serif;
  line-height: 1.15 !important;
  margin-bottom: 0 !important;
}

.share-card-wrap .share-card-date {
  position: relative;
  z-index: 1;
  clear: both;
}

.home-header-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.home-header-actions .btn-ghost,
.home-header-actions .btn-accent,
.home-header-actions .upload-btn,
.home-header-actions .logout-btn,
.home-header-actions .upload-btn button {
  font-size: 13px;
  padding: 8px 12px;
  min-height: 0;
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

.home-header-actions .upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.home-header-main {
  flex-shrink: 0;
  min-width: 0;
}

.home-header-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  align-self: flex-end;
  padding: 0 8px 2px;
}

.home-header-bike-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 6px;
  padding: 5px 10px;
  line-height: 0;
}

.home-header-bike-logo img {
  height: 22px;
  width: auto;
  max-width: 120px;
  display: block;
}

.home-header-avatar {
  display: block;
  flex-shrink: 0;
  border: 1px solid var(--line);
  overflow: hidden;
  border-radius: 10px;
}

.home-header-avatar img {
  width: 48px;
  height: 60px;
  object-fit: cover;
  display: block;
}

.device-stat {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.device-stats .device-stat:first-child {
  border-top: 0;
}

.device-stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.device-stat-value {
  margin: 6px 0 0;
  font-size: 1.2rem;
  font-weight: 650;
}

.device-stat--muted .device-stat-value {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.device-battery-bar {
  margin-top: 10px;
  height: 6px;
  background: rgba(180, 210, 190, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.device-battery-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.device-map {
  min-height: 420px;
}

.tg-chat {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(20, 28, 24, 0.65);
  display: flex;
  flex-direction: column;
  min-height: 280px;
  max-height: 420px;
}

.tg-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.tg-chat-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.tg-chat-sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.tg-chat-open {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.tg-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
}

.tg-bubble {
  max-width: 85%;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.tg-bubble--in {
  align-self: flex-end;
  background: rgba(61, 214, 140, 0.16);
  border: 1px solid rgba(61, 214, 140, 0.28);
}

.tg-bubble--out {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.tg-bubble-meta {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.tg-chat-compose {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.tg-chat-compose input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 10px;
}

.tg-chat-compose .btn-accent {
  padding: 8px 12px;
  min-height: 0;
  font-size: 13px;
}

.tg-chat-empty {
  margin: auto;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.tg-chat-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ride-list-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.ride-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.ride-row-copy {
  min-width: 0;
}

.ride-row-title {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.ride-row-file {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 2px;
  font-weight: 600;
}

.ride-row-metrics {
  display: contents;
}

.ride-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 28px;
  align-items: stretch;
}

.ride-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 18px;
  height: 100%;
}

.stat-row {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.stat-row:first-child {
  border-top: 0;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  margin: 6px 0 0;
  font-size: 1.25rem;
  font-weight: 650;
}

.stat-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ride-map-panel {
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-panel);
}

.ride-detail-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.ride-telemetry {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(20, 28, 24, 0.55);
  padding: 18px 16px 20px;
}

.ride-telemetry-heading {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ride-telemetry-readout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.ride-telemetry-readout-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.ride-telemetry-readout-value {
  font-size: 15px;
  font-weight: 600;
}

.ride-telemetry-charts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.lean-bike {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px 16px;
  width: 100%;
  overflow: visible;
}

.lean-bike[hidden] {
  display: none !important;
}

.lean-bike-stage {
  position: relative;
  width: 144px;
  max-width: 144px;
  aspect-ratio: 260 / 438;
  overflow: visible;
}

.lean-bike-upright {
  position: absolute;
  left: 50%;
  top: 6%;
  bottom: 5%;
  width: 0;
  border-left: 1px dashed rgba(180, 210, 190, 0.28);
  transform: translateX(-50%);
  pointer-events: none;
}

.lean-bike-ground {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 3%;
  height: 3px;
  border-radius: 2px;
  background: rgba(180, 210, 190, 0.28);
  pointer-events: none;
}

.lean-bike-pivot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: 50% 96%;
  will-change: transform;
  transition: transform 0.08s linear;
}

.lean-bike-photo {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}

.lean-bike-angle {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
  min-height: 1.2em;
}

@media (prefers-reduced-motion: reduce) {
  .lean-bike-pivot {
    transition: none;
  }
}

.telemetry-chart {
  margin-bottom: 16px;
}

.telemetry-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.telemetry-chart-head-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.telemetry-chart-zoom-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.telemetry-chart-zoom-hint--mobile {
  display: none;
}

@media (max-width: 768px) {
  .telemetry-chart-zoom-hint--desktop {
    display: none;
  }

  .telemetry-chart-zoom-hint--mobile {
    display: block;
  }
}

.telemetry-chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.telemetry-chart-value {
  font-size: 18px;
  font-weight: 650;
  color: var(--accent);
}

.telemetry-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  touch-action: none;
  cursor: crosshair;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.2);
}

.ride-telemetry-transport {
  margin-top: 8px;
}

.ride-play-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ride-play-toggle {
  min-width: 148px;
}

.ride-play-rate.is-active {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(61, 214, 140, 0.45);
}

.ride-telemetry.is-playing .lean-bike-pivot {
  transition: none;
}

.ride-telemetry-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.ride-telemetry-slider {
  width: 100%;
  accent-color: var(--accent);
  min-height: 32px;
}

.ride-telemetry-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.share-card-wrap {
  width: 100%;
  max-width: 420px;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 36px;
  align-items: start;
}

.profile-photo-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.profile-photo-frame {
  aspect-ratio: 4 / 5;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-panel);
  overflow: hidden;
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-photo-empty {
  height: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13;
  text-align: center;
  padding: 24px;
}

.profile-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ==========================================================================
   LEGACY BUTTON COMPATIBILITY — Defers to motorsport.css .ms-btn system
   ========================================================================== */

/* Base reset for button element — minimal, lets .ms-btn classes take over */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

/* Legacy .btn-accent → maps to ms-btn-primary feel */
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 12px;
  border: 1px solid rgba(64, 156, 255, 0.40);
  background: rgba(64, 156, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #409cff;
  text-decoration: none;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.18s ease;
}

.btn-accent:hover {
  background: rgba(64, 156, 255, 0.28);
  border-color: rgba(64, 156, 255, 0.60);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Legacy .btn-danger */
.btn-danger,
.ride-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 12px;
  border: 1px solid rgba(255, 55, 95, 0.35);
  background: rgba(255, 55, 95, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ff375f;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.18s ease;
}

.btn-danger:hover,
.ride-delete-btn:hover {
  background: rgba(255, 55, 95, 0.28);
  border-color: rgba(255, 55, 95, 0.60);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Legacy .btn-ghost */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.80);
  text-decoration: none;
  cursor: pointer;
  min-height: 40px;
  transition: all 0.18s ease;
}

.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.085);
}

.btn-ghost.is-active {
  color: #409cff;
  border-color: rgba(64, 156, 255, 0.40);
  background: rgba(64, 156, 255, 0.18);
}

/* upload-btn wrapper */
.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

/* Disabled state */
button:disabled,
.btn-accent:disabled,
.btn-danger:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

/* Leaflet controls */
.leaflet-bar {
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.leaflet-bar a,
.leaflet-control-layers-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px !important;
  height: 36px !important;
  min-height: 36px;
  line-height: 36px !important;
  padding: 0 !important;
  margin-bottom: 6px !important;
  font-family: var(--font-sans);
  font-size: 14px;
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,0.10) !important;
  background: rgba(255,255,255,0.055) !important;
  backdrop-filter: blur(12px);
  color: rgba(255,255,255,0.80) !important;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.18s ease;
}

.leaflet-bar a:hover,
.leaflet-control-layers-toggle:hover {
  border-color: rgba(255,255,255,0.25) !important;
  background: rgba(255,255,255,0.10) !important;
  color: #fff !important;
}

.leaflet-bar a:last-child {
  margin-bottom: 0 !important;
}

/* Telemetry chart controls */
.telemetry-chart-reset,
.telemetry-chart-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.055);
  color: rgba(255,255,255,0.70);
  cursor: pointer;
  transition: all 0.15s ease;
}

.telemetry-chart-zoom-btn {
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  font-size: 16px;
}

.telemetry-chart-zoom-btns {
  display: inline-flex;
  gap: 6px;
  margin-top: 2px;
}

/* Month accordion trigger */
.month-accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 14px 16px;
  min-height: 52px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.92);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}

.month-accordion-trigger:hover {
  background: rgba(255,255,255,0.04);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .btn-accent { background: rgba(30, 70, 130, 0.95); }
  .btn-danger, .ride-delete-btn { background: rgba(90, 20, 30, 0.95); }
  .btn-ghost { background: rgba(28, 32, 40, 0.95); }
}

@media (prefers-reduced-transparency: reduce) {
  .btn-accent { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(30, 70, 130, 0.95); }
  .btn-danger, .ride-delete-btn { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(90, 20, 30, 0.95); }
  .btn-ghost { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(28, 32, 40, 0.95); }
}





.home-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.month-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 4px;
}

.month-picker-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.month-picker-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.month-select {
  appearance: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background-color: var(--bg-panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238fa396' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px 40px 12px 14px;
  min-height: 48px;
  min-width: min(100%, 280px);
  max-width: 100%;
  cursor: pointer;
  outline: none;
}

.month-select:focus {
  border-color: rgba(61, 214, 140, 0.45);
}

.month-picker-meta {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.month-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.month-accordion-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(20, 28, 24, 0.45);
}

.month-accordion-item.is-open {
  border-color: rgba(61, 214, 140, 0.28);
}

.month-accordion-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}

.month-accordion-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.month-accordion-chevron {
  color: var(--accent);
  font-size: 14px;
  width: 1.2em;
  text-align: center;
}

.month-accordion-panel {
  border-top: 1px solid var(--line);
  padding: 8px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.month-day-heading {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (min-width: 721px) {
  .home-header-actions {
    width: auto;
  }
}

/* —— Mobile —— */
@media (max-width: 720px) {
  .page-shell {
    padding: 28px 16px 56px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(56px, calc(16px + env(safe-area-inset-bottom)));
  }

  .has-site-nav .page-shell {
    padding-top: 20px;
  }

  .site-nav-inner {
    padding: 8px 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .site-nav-brand {
    width: 100%;
    margin-right: 0;
  }

  .site-nav-actions {
    margin-left: 0;
  }

  .page-hero,
  .home-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main identity"
      "actions actions";
    align-items: end;
    gap: 12px 14px;
    margin-bottom: 24px;
    padding-bottom: 18px;
  }

  .page-hero-main,
  .home-header-main {
    grid-area: main;
    min-width: 0;
  }

  .page-hero-main h1,
  .home-header-main h1 {
    font-size: clamp(1.45rem, 7vw, 2.2rem);
  }

  .page-hero-actions {
    grid-area: actions;
    width: 100%;
  }

  .home-header-identity {
    grid-area: identity;
    justify-content: flex-end;
    align-self: end;
    flex: initial;
    padding: 0;
    gap: 8px;
  }

  .home-header-bike-logo {
    padding: 4px 8px;
  }

  .home-header-bike-logo img {
    height: 18px;
    max-width: 88px;
  }

  .home-header-avatar img {
    width: 40px;
    height: 50px;
  }

  .home-header-actions {
    grid-area: actions;
    justify-content: flex-start;
    width: 100%;
  }

  .month-accordion-trigger {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title chevron"
      "meta chevron";
    gap: 4px 12px;
  }

  .month-accordion-title {
    grid-area: title;
  }

  .month-accordion-meta {
    grid-area: meta;
    white-space: normal;
  }

  .month-accordion-chevron {
    grid-area: chevron;
  }

  .month-accordion-panel {
    padding: 10px 12px 14px;
    gap: 16px;
  }

  .home-lead {
    display: none;
  }

  .year-km-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
  }

  .ride-list-toolbar {
    flex-direction: column;
    align-items: stretch !important;
  }

  .ride-list-toolbar button {
    width: 100%;
    min-height: 44px;
  }

  .ride-list-item {
    grid-template-columns: 28px 1fr;
    gap: 10px 12px;
    padding: 12px;
  }

  .ride-delete-btn {
    grid-column: 2;
    justify-self: start;
    margin-top: 4px;
  }

  .ride-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ride-row-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
  }

  .ride-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ride-map-panel {
    order: -1;
    min-height: 0;
    height: min(58vh, 420px);
  }

  .ride-detail-main {
    order: -1;
  }

  .ride-telemetry-readout {
    grid-template-columns: 1fr 1fr;
  }

  .lean-bike-stage {
    width: 132px;
    max-width: 132px;
  }

  .ride-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }

  .ride-stats-legend {
    grid-column: 1 / -1;
  }

  .ride-topbar {
    gap: 10px;
  }

  .ride-topbar-actions {
    width: 100%;
  }

  .ride-topbar-actions a,
  .ride-topbar-actions button {
    flex: 1;
    text-align: center;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .share-card-wrap {
    max-width: min(420px, 100%);
    margin: 0 auto;
  }

  .profile-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .profile-photo-frame {
    max-width: 360px;
    margin: 0 auto;
  }

  .profile-photo-actions {
    justify-content: stretch;
  }

  .profile-photo-actions .btn-accent,
  .profile-photo-actions .btn-danger {
    flex: 1;
  }

  /* Prevent iOS input zoom */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 380px) {
  .year-km-grid {
    grid-template-columns: 1fr;
  }

  .ride-row-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .home-nav-row {
    grid-template-columns: 1fr;
  }
}
/* Leaflet layer switcher */
.leaflet-control-layers {
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 40%, transparent 100%),
    rgba(255, 255, 255, 0.1) !important;
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  color: var(--text);
  border-radius: 14px !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 8px 24px rgba(0, 0, 0, 0.22) !important;
}

.leaflet-control-layers-toggle {
  background-color: transparent !important;
}

.leaflet-control-layers-expanded {
  padding: 10px 12px !important;
  font: 600 13px "Exo 2", sans-serif !important;
}

.leaflet-control-layers label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  color: var(--text) !important;
}

.leaflet-control-layers-separator {
  border-top-color: rgba(255, 255, 255, 0.16) !important;
}

.leaflet-control-attribution {
  background: rgba(12, 18, 16, 0.55) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--muted) !important;
  font-size: 10px !important;
  border-radius: 8px 0 0 0;
}

.leaflet-control-attribution a {
  color: var(--accent) !important;
}

.label-toggle-control {
  border: 0 !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
}

.label-toggle-control a {
  width: auto !important;
  min-width: 44px;
  padding: 0 12px !important;
  font-family: var(--vg-font-sans, var(--font-display)) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
}

.label-toggle-control .label-toggle-btn {
  border-bottom: 1px solid rgba(0, 0, 0, 0.25) !important;
}

.label-toggle-control .label-toggle-btn:last-child {
  border-bottom: 0 !important;
}

.label-toggle-control .label-toggle-btn:hover {
  filter: brightness(1.08);
}

.speedcam-pin {
  background: none !important;
  border: 0 !important;
}

.speedcam-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5c518;
  border: 2px solid #111;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  font-family: var(--font-display), Teko, sans-serif;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: #111;
}
}

.wx-search {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 0 0 18px;
}

.wx-search-label {
  flex: 1;
  min-width: min(100%, 220px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wx-search-label span {
  color: var(--muted);
  font-size: 13px;
}

.wx-search-label input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  color: var(--text);
  border-radius: 8px;
  font: inherit;
}

.wx-place {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.wx-place span {
  opacity: 0.8;
}

.wx-now {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.wx-now-icon {
  flex-shrink: 0;
  line-height: 0;
}

.wx-icon {
  display: block;
}

.wx-day {
  padding: 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-panel);
  min-height: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.wx-day:hover,
.wx-day.is-open {
  border-color: rgba(61, 214, 140, 0.55);
}

.wx-day-icon {
  margin: 0 0 8px;
  line-height: 0;
}

.wx-day-sum {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.3;
  min-height: 2.5em;
}

.wx-detail {
  margin: 18px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.wx-detail-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.wx-detail-day {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wx-detail-sum {
  margin: 4px 0 0;
  font-weight: 600;
}

.wx-detail-temp {
  margin: 6px 0 0;
  font-size: 1.35rem;
}

.wx-detail-temp span {
  color: var(--muted);
  margin-left: 6px;
}

.wx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wx-stat {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
}

.wx-stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wx-stat-value {
  margin: 6px 0 0;
  font-weight: 650;
  font-size: 14px;
}

.wx-wind-arrow {
  display: inline-block;
  font-size: 16px;
  line-height: 1;
}

.wx-hourly-title {
  margin: 18px 0 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.wx-hourly {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.wx-hour {
  flex: 0 0 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-panel);
}

.wx-hour-t {
  font-size: 11px;
  color: var(--muted);
}

.wx-hour-temp {
  font-weight: 650;
  font-size: 13px;
}

.wx-hour-pop {
  font-size: 11px;
  color: #7eb6ff;
}

@media (max-width: 900px) {
  .wx-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.wx-now-temp {
  margin: 0;
  font-family: var(--font-display), "Teko", sans-serif;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}

.wx-now-summary {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.wx-now-wind {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.wx-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.wx-day.is-today {
  border-color: rgba(61, 214, 140, 0.45);
}

.wx-day-week {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
}

.wx-day-date {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.wx-day-temp {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.wx-day-temp span {
  color: var(--muted);
  margin-left: 6px;
  font-weight: 500;
}

.wx-day-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.wx-credit {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.wa-keys {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.wa-key {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.wa-key strong {
  font-weight: 650;
}

@media (max-width: 900px) {
  .wx-days {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

