:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --tint: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #fff; --muted: #8e8e93; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 720px; margin: 0 auto; padding: 16px; padding-bottom: 40px; }
h1 { font-size: 30px; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 20px 0 10px; }
button { font: inherit; cursor: pointer; }
.btn {
  background: var(--tint); color: #fff; border: none; border-radius: 12px;
  padding: 12px 16px; font-weight: 600; width: 100%;
}
.btn.secondary { background: rgba(120,120,128,0.16); color: var(--text); }
.btn.link { background: none; color: var(--tint); width: auto; padding: 6px 0; font-weight: 500; }
input {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(120,120,128,0.25); background: var(--card); color: var(--text);
  margin-bottom: 10px;
}
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.center { min-height: 70vh; display: flex; flex-direction: column; justify-content: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab { padding: 8px 14px; border-radius: 999px; background: rgba(120,120,128,0.14); color: var(--text); border: none; }
.tab.active { background: var(--tint); color: #fff; }
.trip { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; background: var(--card);
        border: none; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; color: var(--text); }
.badge { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; font-size: 18px; }
.badge.car { background: var(--tint); } .badge.scooter { background: var(--green); }
.trip .title { font-weight: 600; }
.trip .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pill { color: var(--red); }
#map { height: 300px; border-radius: var(--radius); overflow: hidden; }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.legend .ramp { width: 70px; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, rgb(158,23,31), rgb(242,158,26), rgb(92,209,107)); }
.readout { display: flex; align-items: baseline; justify-content: space-between; margin: 12px 2px; }
.readout .spd { font-size: 34px; font-weight: 700; }
#chart { width: 100%; height: 160px; touch-action: none; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; text-align: center; }
.stat .v { font-size: 18px; font-weight: 600; }
.stat .k { font-size: 12px; color: var(--muted); }
.hotspot { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(120,120,128,0.15); }
.hotspot .cost { margin-left: auto; color: var(--red); font-weight: 600; }
.err { color: var(--red); font-size: 14px; margin-top: 8px; }
.spinner { width: 22px; height: 22px; border: 3px solid rgba(120,120,128,0.3); border-top-color: var(--tint);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
