/* ── Singletrack — night-ride design system ─────────────────────── */
:root {
  --sky:    #1f2833;   /* header / dark chrome */
  --sky-2:  #2c3a47;
  --paper:  #f7f5f1;
  --ink:    #22272b;
  --muted:  #6d7681;
  --line:   #e0dcd3;
  --accent: #e0742a;   /* the orange */
  --dirt:   #8b694a;
  --green:  #2f9e44; --blue: #1c7ed6; --black: #212529; --dblack: #212529;
  --radius: 14px;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--paper); color: var(--ink); }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }

/* offline banner */
#offlineBar { display: none; }
body.offline #offlineBar { display: block; background: #4a3a12; color: #f7e7c2;
  font-size: 13px; text-align: center; padding: 7px 12px; }

/* header */
.top { position: sticky; top: 0; z-index: 900; background: var(--sky); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .02em; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
#tabs { display: flex; gap: 6px; }
#tabs button { background: none; border: 1px solid rgba(255,255,255,.18); color: #d8dee5;
  border-radius: 20px; padding: 6px 13px; font-size: 13.5px; font-weight: 600; }
#tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* views */
.view { display: none; }
.view.active { display: block; }

/* map */
.map-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; }
#map { height: calc(100vh - 118px); min-height: 420px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; }
.btn:disabled { opacity: .6; }
.muted { color: var(--muted); font-size: 12.5px; }

/* trails list */
.wrap { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }
.trail-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; display: flex; justify-content: space-between;
  gap: 12px; align-items: center; cursor: pointer; }
.trail-card:hover { border-color: var(--accent); }
.trail-card h3 { margin: 0 0 3px; font-size: 16.5px; }
.trail-card .meta { font-size: 13px; color: var(--muted); }
.diff { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid;
  place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.diff.green { background: var(--green); } .diff.blue { background: var(--blue); }
.diff.black { background: var(--black); } .diff.dblack { background: var(--black); outline: 3px double #fff; outline-offset: -6px; }
.badge-warn { display: inline-block; background: #fdf3e3; border: 1px solid #eccfa0;
  color: #6f5012; border-radius: 8px; padding: 2px 8px; font-size: 11.5px; font-weight: 700; }

/* offline kit + cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 8px; }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex;
  flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--sky); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 10px; opacity: 0; transform: translateY(8px);
  transition: .3s; max-width: 320px; }
.toast.show { opacity: 1; transform: none; }
.toast.warn { background: #8a6420; } .toast.err { background: #8d3a26; }

/* GPS dot */
.me-dot { width: 16px; height: 16px; border-radius: 50%; background: #2b6cb0;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  animation: ping-blue 2s ease-out infinite; }
@keyframes ping-blue {
  0%   { box-shadow: 0 0 0 0 rgba(43,108,176,.5), 0 1px 4px rgba(0,0,0,.35); }
  100% { box-shadow: 0 0 0 14px rgba(43,108,176,0), 0 1px 4px rgba(0,0,0,.35); }
}

@media (max-width: 560px) {
  .top { flex-direction: column; align-items: stretch; }
  #tabs { justify-content: space-between; }
  #map { height: calc(100vh - 170px); }
}
