:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, sans-serif;
  color: #15251f;
  background: #f4f5ee;
  --forest: #15251f;
  --muted: #526357;
  --paper: #fffef9;
  --line: #e2e7dc;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, p, dl, dd { margin: 0; }
[hidden] { display: none !important; }
button, summary { font: inherit; }
button:focus-visible, summary:focus-visible { outline: 3px solid #098760; outline-offset: 3px; }

.tracker { min-height: 100dvh; display: flex; flex-direction: column; }
.top { background: var(--forest); color: var(--paper); padding-top: env(safe-area-inset-top); }
.top-inner {
  max-width: 1152px; margin: auto; padding: 0 20px; min-height: 62px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { font-size: 1.1rem; font-weight: 800; letter-spacing: -.05em; white-space: nowrap; }
.brand span { color: #bce6a1; margin-left: .12em; }
.status {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid #53665a;
  padding: 6px 9px; border-radius: 30px; font-size: .72rem; font-weight: 700;
}
.status::before { content: ''; flex: 0 0 7px; height: 7px; border-radius: 50%; background: #a3b6a9; }
.status[data-state="live"]::before { background: #a8ed82; }
.status[data-state="stale"]::before, .status[data-state="offline"]::before { background: #ffc779; }

#dashboard {
  display: flex; flex: 1; flex-direction: column; width: 100%; max-width: 1152px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.map-section { flex: 1; position: relative; min-height: max(260px, 52dvh); background: #e7eee0; isolation: isolate; }
#map { position: absolute; inset: 0; background: #e7eee0; font-family: inherit; }
#map[aria-hidden="true"] { visibility: hidden; }
.map-empty {
  position: absolute; z-index: 1000; inset: 0; display: grid; align-content: center; justify-items: center;
  padding: 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 42%, #f3f7eb 0%, #e7eee0 70%);
}
.map-empty h1, .message h1 { font-size: clamp(1.65rem, 5vw, 2.5rem); letter-spacing: -.055em; line-height: 1.1; }
.map-empty p, .message > p:last-child { color: var(--muted); max-width: 34ch; line-height: 1.5; margin-top: .75rem; }
.map-actions { position: absolute; z-index: 800; bottom: 28px; right: 12px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.map-actions button {
  min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; color: var(--forest);
  background: var(--paper); box-shadow: 0 2px 8px #15251f24; font-size: .8rem; font-weight: 750; cursor: pointer;
}
.map-actions button[aria-pressed="true"] { background: var(--forest); color: white; border-color: var(--forest); }
.position-icon { display: grid; place-items: center; border: 2px solid white; border-radius: 50%; background: #09764e; box-shadow: 0 1px 8px #15251f65; }
.position-icon.stale { background: #526357; }
.position-icon span { width: 8px; height: 8px; border-radius: 50%; background: white; }
.position-icon span.direction { width: 15px; height: 17px; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%); }

.telemetry { background: var(--paper); }
.quick-stats { display: grid; grid-template-columns: 1fr 1fr 1.28fr; padding: 17px 16px; }
.quick-stats > div { padding: 0 12px; min-width: 0; }
.quick-stats > div:first-child { padding-left: 0; }
.quick-stats > div + div { border-left: 1px solid var(--line); }
dt { color: var(--muted); font-size: .75rem; font-weight: 650; margin-bottom: 6px; }
dd { font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 760; }
.quick-stats dd { font-size: clamp(.9rem, 4.6vw, 1.5rem); letter-spacing: -.05em; }
.ride-details { border-top: 1px solid var(--line); padding: 0 16px; }
.ride-details summary { padding: 15px 0; color: var(--forest); font-size: .86rem; font-weight: 720; cursor: pointer; }
.extra-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 12px; padding: 1px 0 20px; }

.standalone { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.message { width: min(100%, 520px); border: 1px solid var(--line); border-radius: 18px; padding: clamp(24px, 6vw, 46px); background: var(--paper); }
.message .brand { color: #09764e; margin-bottom: 24px; }

@media (min-width: 720px) {
  #dashboard { padding: 18px 20px max(18px, env(safe-area-inset-bottom)); gap: 12px; }
  .map-section, .telemetry { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
  .quick-stats { padding: 18px 24px; }
  .quick-stats > div { padding: 0 24px; }
  .ride-details { padding: 0 24px; }
  .extra-stats { grid-template-columns: repeat(3, 1fr); }
}
