/* Tracked rides (docs/architecture.md 19): the Track screen (handlebar layout like ride mode), home's Plan / Track pair
   and recording banner, ride lists and one ride. */

/* ---------- home ---------- */
.shell .homeacts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
.shell .homeacts .btn { min-height: 64px; font-size: 18px; padding: 0 10px; white-space: normal; text-align: center; line-height: 1.1 }
.shell .homeacts .ic { width: 24px; height: 24px; flex: none }
.shell .trackbtn { border-color: var(--guide); color: var(--ink) }
.shell .recbanner { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 12px 10px 14px; border-radius: var(--radius); background: var(--warnbg); color: var(--warnink); text-decoration: none; margin-bottom: 10px; border: 1px solid color-mix(in srgb, var(--warnink) 30%, transparent) }
.shell .recbanner b { flex: 1; min-width: 0; font: 800 18px/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.shell .recbanner .mono { font: 700 18px/1 var(--font-mono) }
.shell .pushnudge { margin-top: 12px }
.shell .pushnudge h3 { display: flex; align-items: center; gap: 8px; margin: 0 }

/* ---------- ride lists ---------- */
.shell .ridelist { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px }
.shell .ridecard { display: flex; gap: 12px; align-items: center; min-height: 76px; padding: 12px 10px 12px 14px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow) }
.shell .ridecard:hover { border-color: var(--ink-3) }
.shell .rideicon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #D9480F; color: #fff; flex: none }
.shell .ridemain { flex: 1; min-width: 0; display: grid; gap: 2px }
.shell .ridemain b { font: 800 19px/1.2 var(--font-display); overflow-wrap: anywhere; margin-right: 6px }
.shell .ridemain small { color: var(--ink-3); font-size: 13px }
.shell .ridenums { color: var(--ink-2); font-size: 15px }
.shell .ridecard > .ic:last-child { color: var(--ink-3); width: 20px; height: 20px }
.shell.rides .btn.block { margin-bottom: 16px; min-height: 56px }

/* ---------- one ride ---------- */
.shell .ridemap { position: relative; margin: 0 0 14px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--rule); background: var(--sunk); aspect-ratio: 4 / 3; max-height: 70vh }
.shell .ridemap canvas, .tk-map canvas { display: block; width: 100%; height: 100% }
.ridestats, .tk-small { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; margin: 0 0 14px }
.ridestats > div, .tk-small > div { padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule) }
.ridestats dt, .tk-small dt { font: 700 12px/1.2 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3) }
.ridestats dd { margin: 2px 0 0; font: 700 24px/1.1 var(--font-mono); letter-spacing: -0.02em }
.rideprofile { margin: 0 0 14px; padding: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--rule) }
.rideprofile svg { display: block; width: 100%; height: auto }
.rideprofile text { font: 600 12px var(--font-mono); fill: var(--ink-3) }
.rp-area { fill: color-mix(in srgb, #D9480F 18%, transparent) }
.rp-line { fill: none; stroke: #D9480F; stroke-width: 2.5; stroke-linejoin: round }
.shell .rideacts { display: grid; gap: 10px; margin-top: 12px }
.shell .rideacts .btn { min-height: 56px }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.rp-line) { stroke: #FF9A5C } :root:not([data-theme="light"]) .rp-area { fill: rgba(255,154,92,.18) } }
:root[data-theme="dark"] .rp-line { stroke: #FF9A5C }
:root[data-theme="dark"] .rp-area { fill: rgba(255,154,92,.18) }

/* ---------- the Track screen (/track) ---------- */
.tk { position: fixed; inset: 0; z-index: 30; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: 8px; background: var(--bg);
  padding: calc(var(--safe-t) + 8px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 8px) calc(var(--safe-l) + 8px) }
.tk-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 32px }
.tk-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 4px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); font: 800 14px/1.1 var(--font-display); letter-spacing: .04em; text-transform: uppercase }
.tk-pill.rec { background: var(--nobg); color: var(--no) }
.tk-pill.rec::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: currentColor; animation: tkpulse 1.6s ease-in-out infinite }
.tk-pill.paused { background: var(--warnbg); color: var(--warnink) }
@keyframes tkpulse { 50% { opacity: .3 } }
@media (prefers-reduced-motion: reduce) { .tk-pill.rec::before { animation: none } }
.tk-gps { font: 600 14px/1.2 var(--font-mono); color: var(--ink-3) }
.tk-gps.ok { color: var(--ok) }
.tk-big { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px }
.tk-big p { margin: 0; padding: 6px 12px 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); display: grid }
.tk-big b { font: 700 clamp(48px, 15vw, 76px)/1 var(--font-mono); letter-spacing: -0.04em }
.tk-big span { font: 800 14px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3) }
.tk-small { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 8px 0 0 }
.tk-small > div { padding: 6px 8px }
.tk-small dt { font-size: 10.5px }
.tk-small dd { margin: 2px 0 0; font: 700 clamp(17px, 5vw, 22px)/1.1 var(--font-mono); letter-spacing: -0.03em; white-space: nowrap }
.tk-small small, .tk-big small { font-size: .55em; margin-left: .15em; letter-spacing: 0 }
.tk-map { position: relative; overflow: hidden; border-radius: 14px; background: var(--sunk); border: 1px solid var(--rule); min-height: 140px }
.tk-acts { display: grid; gap: 8px }
.tk-primary { min-height: 80px; font-size: 26px; width: 100% }
.tk-primary .ic { width: 28px; height: 28px }
.tk-secrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px }
.tk-secrow .btn { min-height: 56px; font-size: 17px; padding: 0 8px }
.tk-note { margin: 0; font-size: 14px; line-height: 1.35; color: var(--ink-2) }
@media (orientation: landscape) and (max-height: 560px) {
  .tk { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto }
  .tk-map { grid-column: 1; grid-row: 1 / -1 }
  .tk-status { grid-column: 2; grid-row: 1 }
  .tk-stats { grid-column: 2; grid-row: 2 }
  .tk-acts { grid-column: 2; grid-row: 4 }
  .tk-note { display: none }
  .tk-big b { font-size: 40px }
  .tk-small { margin-top: 6px }
  .tk-small dt { font-size: 9.5px; letter-spacing: .03em }
  .tk-small dd { font-size: 16px }
  .tk-primary { min-height: 64px; font-size: 22px }
  .tk-secrow .btn { min-height: 56px }
}
