/* ===========================================================================
   GPS lap timer page.

   The standalone pages' dark graphite (install.html, the generated pages),
   restated here rather than inlined because this page has state to style.
   Mobile first; 720px is where the masthead nav comes back, as everywhere.
   Rules from CLAUDE.md that bite here: targets >= 44px (the Start button is
   much bigger, it is pressed in gloves), inputs >= 16px, wide tables scroll
   in their own box.
   ========================================================================= */

:root {
  --lt-bg: #0a0b0c;
  --lt-card: #15181b;
  --lt-field: #0e1012;
  --lt-line: #2e353b;
  --lt-rule: #24282b;
  --lt-text: #f2f3f0;
  --lt-dim: #a4a9a8;
  --lt-faint: #6b7170;
  --lt-green: #3fd07f;
  --lt-blue: #5aa2f0;
  --lt-amber: #e6b450;
  --lt-red: #ef6b5f;
}

/* ---- the standalone page shell (same as install.html) ------------------ */
body.ld { margin: 0; background: var(--lt-bg); color: var(--lt-text); font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
.ld a { color: inherit; }
.ld-wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.ld-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.ld-mast { border-bottom: 1px solid #3b4045; background: var(--lt-bg); position: sticky; top: 0; z-index: 10; padding-top: env(safe-area-inset-top); }
.ld-mast__in { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.ld-mast__brand { font: 600 18px 'IBM Plex Sans Condensed', sans-serif; letter-spacing: .1em; text-decoration: none; }
.ld-mast__nav { flex: 1; display: flex; gap: 26px; font: 400 13px 'IBM Plex Sans', sans-serif; }
.ld-mast__nav a { color: var(--lt-dim); text-decoration: none; }
.ld-mast__nav a:hover, .ld-mast__nav a[aria-current] { color: var(--lt-text); }
@media (max-width: 720px) { .ld-mast__nav { display: none; } .ld-mast__in { justify-content: space-between; } }
.ld-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; box-sizing: border-box; font: 600 14.5px 'IBM Plex Sans', sans-serif; text-decoration: none; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--lt-line); color: var(--lt-text); background: var(--lt-card); white-space: nowrap; }
.ld .ld-btn--solid { background: var(--lt-green); border-color: var(--lt-green); color: #06231b; }
.ld-clause__no { font: 400 12px 'IBM Plex Mono', monospace; color: var(--lt-faint); letter-spacing: .08em; display: block; margin-bottom: 10px; }
h1.ld-h1 { font: 600 clamp(32px, 6vw, 54px)/1.05 'IBM Plex Sans Condensed', sans-serif; margin: 6px 0 14px; text-wrap: balance; }
.ld-lede { color: var(--lt-dim); margin: 0 0 12px; max-width: 68ch; }
.ld-lede strong { color: var(--lt-text); font-weight: 600; }
.ld-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ld-steps { counter-reset: step; margin: 12px 0 0; padding: 0; list-style: none; }
.ld-steps li { counter-increment: step; position: relative; padding: 0 0 14px 44px; color: var(--lt-dim); }
.ld-steps li strong { color: var(--lt-text); }
.ld-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border: 1px solid var(--lt-line); border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 600 13px 'IBM Plex Mono', monospace; color: var(--lt-green); }
.ld-bigfoot { border-top: 1px solid #3b4045; margin-top: 24px; padding: 28px 0 calc(18px + env(safe-area-inset-bottom)); }
.ld-bigfoot__brand { font: 600 16px 'IBM Plex Sans Condensed', sans-serif; letter-spacing: .1em; text-decoration: none; }
.ld-bigfoot__tag { font: 400 13px 'IBM Plex Sans', sans-serif; color: var(--lt-faint); margin: 6px 0 16px; }
.ld-bigfoot__legal { font: 400 11px/1.8 'IBM Plex Mono', monospace; color: var(--lt-faint); }

.pro-tag { display: inline-block; font: 600 10px/1 'IBM Plex Mono', monospace; letter-spacing: .08em; color: var(--lt-green); border: 1px solid #2f4a3c; background: #0f1f17; border-radius: 4px; padding: 3px 5px; vertical-align: middle; }

/* ---- page ---------------------------------------------------------------- */
.lt2-hero { padding: 28px 0 8px; }
.lt2-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .lt2-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; } }

.lt2-card { background: var(--lt-card); border: 1px solid var(--lt-line); border-radius: 16px; padding: 16px; margin: 16px 0 0; min-width: 0; }
.lt2-grid .lt2-card { margin: 0; }
.lt2-card__h { font: 600 18px 'IBM Plex Sans Condensed', sans-serif; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.lt2-h3 { font: 600 16px 'IBM Plex Sans Condensed', sans-serif; margin: 22px 0 6px; }
.lt2-small { font-size: 13px; color: var(--lt-dim); margin: 4px 0 10px; }
.lt2-note { font-size: 13px; color: var(--lt-dim); margin: 10px 0 0; max-width: 68ch; }
.lt2-warn { font-size: 13px; color: var(--lt-dim); border-left: 3px solid var(--lt-amber); background: #1b1a14; padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 0 0 14px; }

.lt2-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.lt2-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; min-width: 0; }
.lt2-field--grow { flex: 1 1 180px; }
.lt2-label { font: 400 12px 'IBM Plex Sans', sans-serif; color: var(--lt-dim); }
.lt2 input, .lt2 select { font: 400 16px 'IBM Plex Sans', sans-serif; color: var(--lt-text); background: var(--lt-field); border: 1px solid var(--lt-line); border-radius: 12px; padding: 10px 12px; min-height: 44px; box-sizing: border-box; width: 100%; }
.lt2 input:focus-visible, .lt2 select:focus-visible, .lt2 button:focus-visible, .lt2 summary:focus-visible { outline: 2px solid var(--lt-blue); outline-offset: 2px; }
.lt2 input:disabled, .lt2 select:disabled { opacity: .55; }

.lt2-btn { font: 600 14.5px 'IBM Plex Sans', sans-serif; min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--lt-line); background: #1b2127; color: var(--lt-text); cursor: pointer; }
.lt2-btn--solid { background: var(--lt-green); border-color: var(--lt-green); color: #06231b; }
.lt2-btn--danger { color: var(--lt-red); }
.lt2-btn:disabled { opacity: .45; cursor: not-allowed; }
.lt2-btn--small { min-height: 44px; padding: 6px 12px; font-size: 13px; }

.lt2-seg { display: inline-flex; border: 1px solid var(--lt-line); border-radius: 12px; padding: 3px; background: var(--lt-field); margin-top: 8px; }
.lt2-seg__b { font: 600 14px 'IBM Plex Sans', sans-serif; min-height: 44px; min-width: 104px; border: 0; border-radius: 9px; background: transparent; color: var(--lt-dim); cursor: pointer; }
.lt2-seg__b[aria-checked="true"] { background: #1d3a2b; color: var(--lt-green); }
.lt2-seg__b:disabled { cursor: not-allowed; }

/* the circuit, north up */
.lt2-map { margin: 6px 0 12px; }
.lt2-map svg { width: 100%; height: auto; display: block; background: #0d1012; border: 1px solid var(--lt-rule); border-radius: 12px; color: var(--lt-green); }
.lt2-map img { width: 100%; height: auto; display: block; background: #0d1012; border: 1px solid var(--lt-rule); border-radius: 12px; padding: 12px; box-sizing: border-box; filter: invert(1) hue-rotate(180deg) brightness(.9); }
.lt2-map figcaption { margin-top: 6px; }

/* timing lines */
.lt2-lines { border: 1px solid var(--lt-line); border-radius: 12px; padding: 0 12px; margin-top: 4px; }
.lt2-lines summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; font-weight: 600; }
.lt2-lines[open] { padding-bottom: 12px; }
.lt2-lineform { border-top: 1px solid var(--lt-rule); padding-top: 10px; margin-top: 10px; }
.lt2-lineform h4 { margin: 0 0 8px; font: 600 14px 'IBM Plex Sans Condensed', sans-serif; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.lt2-lineform .lt2-row .lt2-field { flex: 1 1 130px; }
.lt2-reviewed { border: 1px solid #2f4a3c; background: #0f1f17; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }

/* live */
.lt2-live__top { display: flex; justify-content: space-between; align-items: center; }
.lt2-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lt-faint); display: inline-block; }
.lt2-dot[data-s="timing"] { background: var(--lt-green); box-shadow: 0 0 10px var(--lt-green); }
.lt2-dot[data-s="waiting"] { background: var(--lt-amber); }
.lt2-dot[data-s="warn"] { background: var(--lt-red); }
.lt2-clock { font-size: clamp(52px, 15vw, 88px); font-weight: 600; line-height: 1; letter-spacing: -.02em; margin: 6px 0 14px; overflow-wrap: anywhere; }
.lt2-stats, .lt2-sectors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin-bottom: 12px; }
.lt2-sectors { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.45fr); border-top: 1px solid var(--lt-rule); padding-top: 10px; }
.lt2-k { display: block; font: 400 10.5px 'IBM Plex Mono', monospace; letter-spacing: .1em; color: var(--lt-faint); }
.lt2-v { display: block; font-size: 17px; font-weight: 500; overflow-wrap: anywhere; }
.lt2-v--best { color: var(--lt-green); }
.lt2-go { width: 100%; min-height: 72px; border-radius: 14px; border: 0; background: var(--lt-green); color: #06231b; font: 700 22px 'IBM Plex Sans Condensed', sans-serif; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; }
.lt2-go[data-running="true"] { background: #3a1d1b; color: var(--lt-red); border: 1px solid #6a2c27; }
.lt2-go:disabled { opacity: .5; cursor: not-allowed; }
.lt2-msg { min-height: 1.4em; font-size: 13px; color: var(--lt-amber); margin: 8px 0; }

.lt2-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.lt2-table th { text-align: left; font: 400 10.5px 'IBM Plex Mono', monospace; letter-spacing: .1em; color: var(--lt-faint); padding: 6px 8px; border-bottom: 1px solid var(--lt-rule); white-space: nowrap; }
.lt2-table td { padding: 8px; border-bottom: 1px solid var(--lt-rule); font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lt2-table td.lt2-wrap { white-space: normal; font-family: 'IBM Plex Sans', sans-serif; color: var(--lt-dim); font-size: 13px; min-width: 120px; }
.lt2-table tr.is-best td { color: var(--lt-green); }
.lt2-table tr.is-invalid td { color: var(--lt-faint); }
.lt2-table tr.is-own td { background: #0f1f17; }
.lt2-table .lt2-empty { text-align: center; color: var(--lt-faint); font-family: 'IBM Plex Sans', sans-serif; padding: 18px 8px; white-space: normal; }
.lt2-nosec .lt2-sec { display: none; }

/* sessions */
.lt2-sess { border: 1px solid var(--lt-line); border-radius: 12px; margin: 0 0 10px; background: #121518; }
.lt2-sess summary { padding: 10px 12px; min-height: 44px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; list-style: none; }
.lt2-sess summary::-webkit-details-marker { display: none; }
.lt2-sess__t { font-weight: 600; }
.lt2-sess__best { font-family: 'IBM Plex Mono', monospace; color: var(--lt-green); text-align: right; }
.lt2-sess__meta { font-size: 12.5px; color: var(--lt-dim); grid-column: 1 / -1; }
.lt2-sess__body { padding: 0 12px 12px; }
.lt2-badge { font: 600 10px 'IBM Plex Mono', monospace; letter-spacing: .08em; border-radius: 4px; padding: 2px 5px; border: 1px solid var(--lt-line); color: var(--lt-dim); margin-left: 6px; vertical-align: middle; }
.lt2-badge--demo { color: var(--lt-amber); border-color: #5a4a22; }
.lt2-empty-box { border: 1px dashed var(--lt-line); border-radius: 12px; padding: 24px 16px; text-align: center; color: var(--lt-dim); }

.lt2-locked { border: 1px dashed #2f4a3c; border-radius: 12px; padding: 16px; color: var(--lt-dim); }
.lt2-locked a { color: var(--lt-green); }
.lt2-howto { margin-bottom: 8px; }

/* Pro parts: hidden while Pro is not on sale, shown locked when it is. */
.lt2-pro[data-state="hidden"] { display: none !important; }
.lt2-pro[data-state="locked"] input, .lt2-pro[data-state="locked"] select { pointer-events: none; }

.lt2-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); max-width: min(92vw, 480px); background: #1b2127; border: 1px solid var(--lt-line); color: var(--lt-text); border-radius: 12px; padding: 12px 16px; font-size: 14px; z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.lt2-toast[data-tone="warn"] { border-color: #6a2c27; }

@media (prefers-reduced-motion: no-preference) {
  .lt2-dot[data-s="timing"] { animation: lt2-pulse 1.6s ease-in-out infinite; }
}
@keyframes lt2-pulse { 50% { opacity: .45; } }
