/* Live speed (2026-10-31, /malitools/cars/speed): the dash with the big
   number, this drive's four tiles, then the alert and notes cards (calc.css).
   .sp-over = above the alert: the dash goes red and a glow pulses
   (opacity only). */
.sp-page { --sp-red: #e8322a; }
.sp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sp-dash {
  position: relative; isolation: isolate; overflow: hidden; display: grid; justify-items: center; gap: 6px;
  margin: 0 0 14px; padding: 18px 18px 20px; border-radius: 28px;
  border: 2px solid var(--line-strong, var(--line)); background: var(--surface); color: var(--text);
  box-shadow: 0 6px 0 var(--ink-sh, var(--ink, #111111));
}
.sp-dash::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .28), transparent);
}
.sp-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; }
.sp-gps { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--muted); }
.sp-gps i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.sp-gps[data-s="good"] { color: #1f9d55; }
.sp-gps[data-s="weak"] { color: #d98a00; }
.sp-gps[data-s="wait"] i { animation: spBlink 1s ease-in-out infinite; }
.sp-limit { padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; background: color-mix(in srgb, var(--sp-red) 14%, transparent); color: var(--sp-red); }

.sp-now { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 0; line-height: 1; }
.sp-now b {
  font: 700 clamp(104px, 38vw, 220px)/.9 var(--sp-display, "Chakra Petch", system-ui, sans-serif);
  font-variant-numeric: tabular-nums; letter-spacing: -.03em; color: var(--text);
}
.sp-now span { font-size: 18px; font-weight: 800; color: var(--muted); }
.sp-msg { min-height: 1.4em; margin: 2px 0 6px; max-width: 34em; text-align: center; font-size: 14px; line-height: 1.45; color: var(--muted); }
.sp-btns { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; width: 100%; max-width: 460px; }
.sp-btns .fd-btn { justify-content: center; min-height: 56px; margin: 0; font-size: 17px; }
.sp-btns .fd-btn img { width: 26px; height: 26px; }
.sp-btns .fd-btn:disabled { opacity: .45; }

/* over the alert */
.sp-dash.sp-over { background: var(--sp-red); border-color: var(--sp-red); color: #fff; }
.sp-dash.sp-over :is(.sp-now b, .sp-now span, .sp-msg) { color: #fff; }
.sp-dash.sp-over .sp-limit { background: #fff; color: var(--sp-red); }
.sp-dash.sp-over .sp-gps { background: rgba(255, 255, 255, .2); color: #fff; }
.sp-dash.sp-over::after { animation: spPulse 1s ease-in-out infinite; }
.sp-dash.sp-over .fd-btn:not(.primary) { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .5); color: #fff; }

/* this drive */
.sp-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.sp-tile { display: grid; gap: 4px; min-width: 0; padding: 12px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.sp-tile small { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.sp-tile b { font: 700 24px/1.1 var(--sp-display, "Chakra Petch", system-ui, sans-serif); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-tile em { font: 700 12px/1 Inter, system-ui, sans-serif; font-style: normal; color: var(--muted); }

/* save to the car log (Phase B): the car chips look like the car log's */
.sp-save { margin: 0 0 14px; }
.sp-save .cc-body { display: grid; gap: 12px; }
.sp-save .cc-msg { margin: 0; }
.sp-save .fd-actions { margin: 0; }
.sp-save .fd-btn img { width: 22px; height: 22px; }
.sp-cars { display: flex; flex-wrap: wrap; gap: 8px; }
.sp-cars:empty { display: none; }
.sp-car { min-height: 42px; max-width: 100%; padding: 6px 16px; border: 2px solid var(--edge, #111111); border-radius: 999px; background: var(--bg); color: var(--text);
  font: 800 14.5px/1.2 var(--font-body); cursor: pointer; box-shadow: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-car[aria-pressed="true"] { background: var(--app, #ffc21a); color: var(--app-ink, #111111); box-shadow: 0 3px 0 var(--ink-sh, var(--ink, #111111)); }

.sp-notes { margin: 0 0 14px; padding-left: 1.2em; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.55; }
.sp-more .fd-btn { margin: 0; }

@media (max-width: 640px) {
  .sp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-dash { padding: 14px 14px 16px; border-radius: 24px; }
}
/* a phone on its side in a mount: the dash takes the screen */
@media (orientation: landscape) and (max-height: 500px) {
  .sp-dash { grid-template-columns: 1fr auto; align-items: center; min-height: calc(100vh - 120px); }
  .sp-top { grid-column: 1 / -1; }
  .sp-now { grid-area: 2 / 1; }
  .sp-btns { grid-area: 2 / 2; }
  .sp-msg { grid-area: 3 / 1 / 4 / -1; }
  .sp-now b { font-size: min(52vh, 30vw); }
  .sp-btns { grid-template-columns: 1fr; max-width: 220px; }
}
@keyframes spPulse { 50% { opacity: 1; } }
@keyframes spBlink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .sp-dash.sp-over::after, .sp-gps[data-s="wait"] i { animation: none; } }
