:root {
  --bg: #0b0f14;
  --card: #131a22;
  --card-2: #182029;
  --line: #222d3a;
  --text: #f0f6fc;
  --muted: #8d9bab;
  --accent: #f5a524;
  --accent-dim: #6b4a12;
  --good: #3fd07f;
  --bad: #ff6b6b;
  --radius: 16px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}

.head h1 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(245, 165, 36, 0.6);
}

.gps-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.gps-btn[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 165, 36, 0.1);
}

.status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}

.status.error { color: #ffd7d7; border-color: #5c2b2b; background: #2a1717; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
}

.stepper {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 8px;
}

.step {
  appearance: none;
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.step:active { background: #202a35; }

.value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.value input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: clamp(44px, 14vw, 60px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  text-align: right;
  padding: 0;
}

.value input:focus { outline: none; color: var(--accent); }

.value input::-webkit-outer-spin-button,
.value input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.value input[type=number] { -moz-appearance: textfield; }

.unit { font-size: 16px; color: var(--muted); font-weight: 600; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin-top: 14px;
  background: transparent;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
}

.range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--card-2); }
.range::-moz-range-thumb { width: 24px; height: 24px; border: 3px solid var(--bg); border-radius: 50%; background: var(--accent); }

.chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.chips button {
  appearance: none;
  flex: 1 1 auto;
  min-width: 56px;
  padding: 10px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.chips button[aria-current="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245, 165, 36, 0.1);
}

.baseline { text-align: center; padding: 18px 14px; }

.baseline .lead { margin: 0; color: var(--muted); font-size: 14px; }
.baseline .lead b { color: var(--text); }

.baseline .time {
  margin: 6px 0 0;
  font-size: clamp(38px, 12vw, 52px);
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.baseline .eta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.rows li {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  overflow: hidden;
}

.rows li .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(245, 165, 36, 0.45), var(--accent));
  border-radius: 0 3px 0 0;
  transition: width 0.25s ease;
}

@media (prefers-reduced-motion: reduce) { .rows li .bar { transition: none; } }

.rows li > * { position: relative; }

.r-speed { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.r-speed small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; }
.r-time { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.r-save { font-size: 19px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; text-align: right; }
.r-save small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }

.foot { margin: 12px 2px 0; color: var(--muted); font-size: 13px; }

.legal { color: #5f6c7b; font-size: 12px; text-align: center; padding: 0 8px; }
.legal p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 10px 10px 16px;
  font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.toast button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1204;
  font: inherit;
  font-weight: 700;
  padding: 7px 14px;
  cursor: pointer;
}

[hidden] { display: none !important; }
