:root {
  /* The colours come from the logo: its orange, its blue and its near-black background. */
  --bg: #0a0e12;
  --panel: #131a21;
  --panel-2: #1b242d;
  --line: #2a3541;
  --text: #f2f5f7;
  --muted: #9ba7b3;
  --accent: #faaf51; /* the logo's orange: actions (primary buttons) and rides */
  --accent-ink: #14100a;
  --accent-2: #52ddf6; /* the logo's blue: links, whatever is selected, and events */
  --accent-2-ink: #04222b;
  --map-orange: #e0700a; /* deeper tones for pins drawn on the light map */
  --map-blue: #11748f;
  --good: #3ccf7a;
  --danger: #ff5a5a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .25rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: .25rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Top bar & tabs */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1rem; background: rgba(10,14,18,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 800; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
/* The whole logo (mark and word), shrunk to the height of the bar. */
.brand img { height: 46px; width: auto; display: block; }
.tabs { display: flex; gap: .25rem; }
.tabs a { color: var(--muted); padding: .45rem .8rem; border-radius: 999px; font-weight: 600; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent-2-ink); background: var(--accent-2); }

@media (max-width: 720px) {
  /* backdrop-filter would trap the fixed tab bar inside the header */
  .topbar { justify-content: center; backdrop-filter: none; background: var(--bg); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; justify-content: space-around;
    padding: .5rem .25rem calc(.5rem + env(safe-area-inset-bottom));
    background: rgba(10,14,18,.96); border-top: 1px solid var(--line);
  }
  .tabs a { font-size: .85rem; padding: .45rem .6rem; }
}
@media (min-width: 721px) { body { padding-bottom: 2rem; } }

/* Layout */
.view { max-width: 1080px; margin: 0 auto; padding: 1.25rem 16px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.head .actions select { width: auto; }
.grid { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack { display: grid; gap: .75rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.spacer { flex: 1; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0;
}
.card.link { cursor: pointer; transition: border-color .15s; }
.card.link:hover { border-color: var(--accent-2); }
.card img.cover { width: calc(100% + 2rem); margin: -1rem -1rem .25rem; height: 160px; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; background: var(--panel-2); }

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; justify-content: space-between;
  background: linear-gradient(90deg, rgba(250,175,81,.16), rgba(82,221,246,.07));
  border: 1px solid rgba(250,175,81,.4); border-radius: var(--radius); padding: .85rem 1rem; margin-bottom: 1rem;
}

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: .25rem; }

/* Buttons & inputs */
button, .btn {
  font: inherit; font-weight: 650; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); padding: .5rem .9rem; display: inline-flex; align-items: center; gap: .4rem;
}
button:hover, .btn:hover { border-color: var(--muted); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); }
button.going { background: rgba(60,207,122,.15); border-color: var(--good); color: var(--good); }
button.danger { color: #ff8585; } /* lighter than --danger, so it reads on the grey button */
button.small, .btn.small { padding: .3rem .65rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: wait; }

label { display: grid; gap: .3rem; font-weight: 600; font-size: .9rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: .55rem .7rem; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent-2); }
textarea { resize: vertical; min-height: 80px; }
.form { display: grid; gap: .85rem; }
.form .two { display: grid; gap: .85rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .form .two { grid-template-columns: 1fr; } }
.hint { font-weight: 400; color: var(--muted); font-size: .8rem; }

/* Chips & badges */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip { padding: .3rem .75rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: .85rem; }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .5rem; border-radius: 6px; background: var(--panel-2); color: var(--muted); }
.badge.instagram { background: linear-gradient(45deg, #f58529, #dd2a7b 60%, #8134af); color: #fff; }
.badge.facebook { background: #1877f2; color: #fff; }
.badge.eventbrite { background: #f05537; color: #fff; }
.badge.meetup { background: #f64060; color: #fff; }
.badge.tiktok { background: #000; color: #fff; border: 1px solid #444; }
.badge.x { background: #000; color: #fff; border: 1px solid #444; }
.badge.youtube { background: #ff0000; color: #fff; }
.badge.cyclefish { background: #2b6cb0; color: #fff; }
.badge.ride { background: var(--accent); color: var(--accent-ink); }
.badge.pace { background: rgba(250,175,81,.16); color: var(--accent); }

/* Ride card */
.ride { flex-direction: row; gap: .9rem; }
.date {
  flex: none; width: 58px; text-align: center; border-radius: 10px; background: var(--panel-2);
  padding: .4rem 0; align-self: flex-start;
}
.date .m { font-size: .72rem; font-weight: 800; color: var(--accent); text-transform: uppercase; }
.date .d { font-size: 1.45rem; font-weight: 800; line-height: 1.1; }
.date .t { font-size: .7rem; color: var(--muted); }
.ride .body { display: grid; gap: .3rem; min-width: 0; flex: 1; }
.ride .title { font-weight: 750; font-size: 1.02rem; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem .75rem; color: var(--muted); font-size: .85rem; }

/* Rider card */
.rider { flex-direction: row; align-items: center; gap: .8rem; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; color: var(--accent-ink); background: var(--accent);
}
.rider .body { min-width: 0; flex: 1; }
.rider .name { font-weight: 700; }

/* Map */
.map { height: 380px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 1rem; z-index: 0; }
.map.small { height: 240px; margin: 0; }
.leaflet-container { background: var(--panel-2); font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.leaflet-container .leaflet-popup-content a { color: var(--accent-2); }
.pin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.pin.rider { background: var(--map-orange); }
.pin.ride { background: var(--map-blue); width: 20px; height: 20px; border-radius: 6px; }
.pin.me { background: var(--good); }

/* Detail */
.detail { display: grid; gap: 1rem; grid-template-columns: 1.4fr 1fr; align-items: start; }
@media (max-width: 820px) { .detail { grid-template-columns: 1fr; } }
.detail .card { gap: .75rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.people { display: flex; flex-wrap: wrap; gap: .4rem; }
.person { display: flex; align-items: center; gap: .4rem; background: var(--panel-2); border-radius: 999px; padding: .2rem .7rem .2rem .2rem; font-size: .88rem; }
.person .avatar { width: 26px; height: 26px; font-size: .72rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Dialog */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem;
}
dialog::backdrop { background: rgba(0,0,0,.65); }
/* z-index keeps the × above a long title that wraps under it: the rider site's titles are painted layers. */
dialog .close { position: absolute; z-index: 1; right: .75rem; top: .75rem; padding: .1rem .6rem; font-size: 1.3rem; border: 0; background: transparent; color: var(--muted); }
dialog h2 { margin-bottom: 1rem; padding-right: 2rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-weight: 650;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 2000; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #fff; }

/* View toggle */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--bg); }

/* Month calendar */
.cal-bar { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.cal-bar h2 { margin: 0 .25rem; min-width: 10ch; text-align: center; }
.legend { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .8rem; }
.legend i, .dots i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.legend i.ride, .dots i.ride { background: var(--accent); }
.legend i + i { margin-left: .5rem; }

.cal {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel);
}
.cal-dow { padding: .45rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); }
.cal-day {
  min-height: 112px; padding: .3rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; transition: background .12s;
}
.cal-day:nth-child(7n + 7) { border-right: 0; }
.cal-day:hover { background: var(--panel-2); }
.cal-day.other { background: rgba(0,0,0,.25); }
.cal-day.other .num { color: #5b6772; }
.cal-day .num { font-size: .8rem; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.cal-day.today .num { background: var(--accent); color: var(--accent-ink); }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--accent-2); }
.cal-item {
  font-size: .74rem; line-height: 1.3; padding: 2px 5px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(82,221,246,.13); border-left: 3px solid var(--accent-2); color: var(--text);
}
.cal-item:hover { filter: brightness(1.25); }
.cal-item .t { color: var(--muted); font-weight: 600; }
.cal-item.ride { background: rgba(250,175,81,.16); border-left-color: var(--accent); }
.cal-item.facebook { border-left-color: #1877f2; }
.cal-item.instagram { border-left-color: #dd2a7b; background: rgba(221,42,123,.14); }
.cal-day .more { font-size: .72rem; color: var(--muted); padding-left: 4px; }
.cal-day .dots { display: none; gap: 3px; justify-content: center; margin-top: auto; }
.cal-agenda-title { margin: 1.25rem 0 .75rem; }

@media (max-width: 720px) {
  .cal-day { min-height: 54px; align-items: center; padding: .25rem .1rem; }
  .cal-day .cal-item, .cal-day .more { display: none; }
  .cal-day .dots { display: flex; }
  .cal-dow { font-size: .65rem; padding: .35rem 0; }
  .legend { width: 100%; }
  .legend .star-key { display: none; }
}

/* Live status & sync info */
.live { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; color: var(--muted); margin-top: .35rem; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(60,207,122,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(60,207,122,0); } 100% { box-shadow: 0 0 0 0 rgba(60,207,122,0); } }
@media (prefers-reduced-motion: reduce) { .live .dot { animation: none; } }
button.link { background: none; border: 0; padding: 0; color: var(--accent-2); font-weight: 650; }
button.link:hover { text-decoration: underline; }
.stack-tight { display: grid; gap: .15rem; }
.warn { color: #ffd166; }
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.posts a { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; }
.posts img { width: 100%; height: 100%; object-fit: cover; }

/* Sponsored listings: always clearly labeled */
:root { --gold: #f5c542; }
.card.sponsored { border-color: rgba(245,197,66,.55); box-shadow: inset 0 0 0 1px rgba(245,197,66,.15); }
.badge.sponsored { background: rgba(245,197,66,.16); color: var(--gold); }
.featured { margin-bottom: 1rem; }
.small-caps { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .5rem; }
.pin.sponsor { width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #0a0e12; display: grid; place-items: center; font-size: 14px; font-weight: 900; border: 2px solid #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.4); }
.cal-item.sponsored { border-left-color: var(--gold); background: rgba(245,197,66,.14); }
.cal-item.sponsored::before { content: "\2605\00a0"; color: var(--gold); }
.legend .star { color: var(--gold); margin-left: .5rem; }

/* Rider availability & search */
.availbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.availbar.on { border-color: var(--good); background: rgba(60,207,122,.08); }
.warnline { color: #ffd166; margin-top: .25rem; }
.avail { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--muted); margin: .1rem 0 .2rem; }
.avail.now { color: var(--good); }
.finder { display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-bottom: .6rem; }
.finder select { width: auto; }
@media (max-width: 520px) { .finder { grid-template-columns: 1fr; } .finder select { width: 100%; } }
.chip.pick { cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.chip.pick input { width: auto; accent-color: var(--accent-2); }
.chip.pick:has(input:checked) { background: var(--text); color: var(--bg); border-color: var(--text); }
.optin { display: grid; gap: .2rem; background: var(--panel-2); border-radius: 12px; padding: .7rem .8rem; }

/* Ride routes */
.route-card { gap: .5rem; }
.pin.stop { width: 24px; height: 24px; border-radius: 50%; background: #fff; color: #0a0e12; border: 3px solid var(--map-orange); display: grid; place-items: center; font-size: 11px; font-weight: 800; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.pin.stop.finish { background: #0a0e12; border-color: #fff; font-size: 12px; }

/* Area picker */
.areapick select { width: auto; padding: .35rem .6rem; border-radius: 999px; font-weight: 650; font-size: .88rem; background: var(--panel); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 720px) { .topbar { justify-content: space-between; } }

/* Step-by-step profile setup */
.wizard { max-width: 560px; margin: 0 auto; display: grid; gap: .6rem; }
.wizard h1 { text-wrap: balance; }
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.steps span { height: 5px; border-radius: 3px; background: var(--panel-2); }
.steps span.on { background: var(--accent); }
.ghostbtn { background: transparent; border-color: transparent; color: var(--muted); }
label.check.big { font-size: 1.05rem; }
label.check.big input { width: 1.4rem; height: 1.4rem; }
.photo-pick { display: grid; place-items: center; gap: .6rem; border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg); }
.photo-pick > span { font-size: 2.2rem; }
.photo-pick.has { border-style: solid; padding: .5rem; }
.photo-pick img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 10px; }

/* Welcome (signed out) */
.welcome { max-width: 640px; margin: 2rem auto; text-align: center; display: grid; gap: .9rem; justify-items: center; }
.welcome h1 { font-size: clamp(2rem, 6vw, 3rem); }
.welcome .lede { color: var(--muted); font-size: 1.1rem; max-width: 46ch; }
.row.center { justify-content: center; }
.welcome-points { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .6rem; text-align: left; width: 100%; }
.welcome-points li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--muted); }
.welcome-points strong { color: var(--text); display: block; }

/* Home dashboard */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; margin-bottom: 1rem; }
.dash-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); }
/* Whole photo in front of a blurred, dimmed copy that fills the frame (no letterbox bars). */
.framed { position: relative; overflow: hidden; }
.framed img { position: absolute; inset: 0; width: 100%; height: 100%; }
.framed .bg { object-fit: cover; filter: blur(22px) brightness(.45) saturate(1.2); transform: scale(1.15); }
.framed .fg { object-fit: contain; transition: transform .2s ease; }
.framed.fill .fg { object-fit: cover; }
.framed .fitbtn { position: absolute; right: .6rem; bottom: .6rem; z-index: 1; background: rgba(10,14,18,.65); backdrop-filter: blur(6px); color: #fff; }
.small-frame { width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; }
.dash-photo.empty { display: grid; place-items: center; align-content: center; gap: .6rem; }
.dash-photo.empty span { font-size: 3rem; }
.dash-id { display: grid; gap: .45rem; min-width: 0; }
.dash-id h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); overflow-wrap: anywhere; }
.dash-bike { color: var(--text); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.stat-row .stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; display: grid; }
.stat-row .stat b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat-row .stat span { color: var(--muted); font-size: .82rem; }
.row.quick { margin-bottom: 1rem; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.person img.avatar { object-fit: cover; }
@media (max-width: 820px) {
  .dash-hero, .dash-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

/* Public / private rides */
.badge.private { background: rgba(255,255,255,.1); color: var(--text); text-transform: none; letter-spacing: 0; font-size: .75rem; vertical-align: middle; }
fieldset.vis { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; display: grid; gap: .4rem; margin: 0; }
fieldset.vis legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
fieldset.vis input { width: auto; accent-color: var(--accent-2); }

/* ===================== Premium raised controls =====================
   Buttons, chips, tabs and toggles are soft-edged and raised (top highlight, dark bottom
   edge, drop shadow). They lift on hover, press in on click, and turn orange or blue with a glow
   when selected. Kept last so it layers over the earlier, flatter styles. */
:root {
  --raise-top: #2f3a46;
  --raise-bottom: #1a222b;
  --raise-edge: #05080b;
  --accent-top: #fdc87b;
  --accent-bottom: #f3983c;
  --accent-edge: #a9641c;
  --accent-2-top: #86e9fb;
  --accent-2-bottom: #2fc4e6;
  --accent-2-edge: #11748f;
  --good-top: #4fdc8c;
  --good-bottom: #24a95f;
  --raised: inset 0 1px 0 rgba(255,255,255,.10), inset 0 -2px 0 rgba(0,0,0,.35), 0 2px 3px rgba(0,0,0,.45), 0 8px 16px -8px rgba(0,0,0,.85);
  --raised-hover: inset 0 1px 0 rgba(255,255,255,.12), inset 0 -2px 0 rgba(0,0,0,.35), 0 4px 6px rgba(0,0,0,.45), 0 14px 24px -10px rgba(0,0,0,.9);
  --pressed: inset 0 2px 5px rgba(0,0,0,.6), inset 0 -1px 0 rgba(255,255,255,.05);
  --glow: 0 0 0 1px rgba(253,200,123,.35), 0 10px 24px -8px rgba(243,152,60,.65);
  --glow-2: 0 0 0 1px rgba(134,233,251,.35), 0 10px 24px -8px rgba(47,196,230,.6);
}

button, .btn, .chip, .tabs a {
  border-radius: 14px;
  border: 1px solid var(--raise-edge);
  background: linear-gradient(180deg, var(--raise-top), var(--raise-bottom));
  color: var(--text);
  box-shadow: var(--raised);
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease, color .16s ease, filter .16s ease;
}
.chip, .tabs a { border-radius: 999px; }
button:hover, .btn:hover, .chip:hover, .tabs a:hover { transform: translateY(-1px); box-shadow: var(--raised-hover); border-color: var(--raise-edge); text-decoration: none; filter: brightness(1.06); }
button:active, .btn:active, .chip:active, .tabs a:active { transform: translateY(1px); box-shadow: var(--pressed); filter: none; }
button:focus-visible, .btn:focus-visible, .chip:focus-visible, .tabs a:focus-visible { outline: 2px solid var(--accent-2-top); outline-offset: 2px; }

/* Primary actions: the logo's orange, raised, glowing */
button.primary, .btn.primary {
  background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom));
  border-color: var(--accent-edge);
  color: var(--accent-ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  box-shadow: var(--raised), var(--glow);
}
/* Whatever is selected (the current tab, a chosen filter): the logo's blue */
.chip.active, .chip.pick:has(input:checked),
.tabs a.active,
.seg button.on {
  background: linear-gradient(180deg, var(--accent-2-top), var(--accent-2-bottom));
  border-color: var(--accent-2-edge);
  color: var(--accent-2-ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  box-shadow: var(--raised), var(--glow-2);
}
button.primary:hover, .btn.primary:hover { box-shadow: var(--raised-hover), var(--glow); filter: brightness(1.05); }
.chip.active:hover, .tabs a.active:hover { box-shadow: var(--raised-hover), var(--glow-2); filter: brightness(1.05); }
button.primary:active, .btn.primary:active, .chip.active:active { box-shadow: var(--pressed); }

/* "Going" is a selected state too: green */
button.going { background: linear-gradient(180deg, var(--good-top), var(--good-bottom)); border-color: #157a42; color: #052414; text-shadow: 0 1px 0 rgba(255,255,255,.25); box-shadow: var(--raised), 0 10px 24px -8px rgba(60,207,122,.6); }
button.danger { color: #ff8585; } /* lighter than --danger, so it reads on the grey button */

/* Unselected chips and tabs read quieter */
.chip:not(.active), .tabs a:not(.active) { color: var(--muted); }
.chip:not(.active):hover, .tabs a:not(.active):hover { color: var(--text); }

/* Two-option toggles: a recessed track with a raised selected half */
.seg { border: 1px solid var(--raise-edge); background: var(--bg); border-radius: 16px; padding: 4px; gap: 4px; box-shadow: inset 0 2px 6px rgba(0,0,0,.7); }
.seg button { border-radius: 12px; background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.seg button:hover { transform: none; box-shadow: none; color: var(--text); }
.seg button.on:hover { color: var(--accent-2-ink); box-shadow: var(--raised), var(--glow-2); }

/* Plain text-style buttons stay flat */
button.link, .ghostbtn, dialog .close, .tabs { box-shadow: none; }
button.link, .ghostbtn, dialog .close { background: transparent; border-color: transparent; }
button.link:hover, .ghostbtn:hover, dialog .close:hover { transform: none; box-shadow: none; filter: none; }

/* Top bar tabs get a little more room for the raised pills */
.tabs { gap: .4rem; }
.tabs a { padding: .45rem .95rem; }
@media (max-width: 720px) { .tabs a { padding: .45rem .7rem; } }

/* Area picker matches */
.areapick select { border-radius: 999px; border: 1px solid var(--raise-edge); background: linear-gradient(180deg, var(--raise-top), var(--raise-bottom)); box-shadow: var(--raised); }

@media (prefers-reduced-motion: reduce) {
  button, .btn, .chip, .tabs a { transition: none; }
  button:hover, .btn:hover, .chip:hover, .tabs a:hover, button:active, .btn:active, .chip:active, .tabs a:active { transform: none; }
}

/* Top riders leaderboard */
.lb { list-style: none; margin: 0 0 .75rem; padding: 0; }
.lb-row { display: flex; align-items: center; gap: .75rem; padding: .55rem .25rem; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: rgba(250,175,81,.12); border-radius: 10px; }
.lb-rank { width: 2.2rem; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-miles { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-miles small { color: var(--muted); font-weight: 600; font-size: .8rem; }
.lb-log { align-items: center; }

/* Report dialog: reasons as a tappable list */
.reasons { display: grid; gap: .4rem; }
.reasons label { display: flex; flex-direction: row; align-items: center; gap: .7rem; text-align: left; font-weight: 600;
  padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.reasons label:has(input:checked) { border-color: var(--accent-2); background: rgba(82,221,246,.1); }
.reasons input { width: auto; margin: 0; accent-color: var(--accent-2); }

/* ===================== Holographic 3D headings =====================
   Page and section titles are painted like the logo: orange on the left running into blue on the
   right, with a glint of light that crosses now and then and a stacked dark edge that makes them
   stand off the page. The area label (.muted) and emoji (.emo) inside a heading keep their own colors. */
:root {
  /* The logo's mark, left to right: orange, then through pale yellow and mint into blue. */
  --brand: linear-gradient(90deg, #faaf51 0%, #f9ad50 40%, #f0c572 56%, #8ed5c7 74%, #5cd8eb 90%, #52ddf6 100%);
  --glint: linear-gradient(100deg, rgba(255,255,255,0) 43%, rgba(255,255,255,.75) 50%, rgba(255,255,255,0) 57%);
}
.view h1, .view h2, dialog.app h2 {
  width: fit-content; max-width: 100%; position: relative;
  font-weight: 900; letter-spacing: -.01em;
  /* Two layers, both cut to the letters: the glint on top (it waits off to the left), the logo's colours under it. */
  background: var(--glint) 100% 0 / 300% 100% no-repeat, var(--brand) 0 0 / 100% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: #faaf51;
  filter: drop-shadow(0 1px 0 #223039) drop-shadow(0 1px 0 #16212a) drop-shadow(0 1px 0 #0a1118) drop-shadow(0 5px 7px rgba(0,0,0,.75));
  animation: foil 9s ease-in-out infinite;
}
.view h1 { font-size: 2rem; padding-bottom: .1em; }
.view h2 { font-size: 1.5rem; line-height: 1.25; padding-bottom: .1em; margin-bottom: .25rem; }
/* The glint rests, then crosses the letters once from left to right. The colours under it never move. */
@keyframes foil { 0%, 62% { background-position: 100% 0, 0 0; } 100% { background-position: 0% 0, 0 0; } }
:is(.view h1, .view h2, dialog.app h2) .muted { -webkit-text-fill-color: #d5dce3; font-weight: 650; letter-spacing: 0; }
:is(.view h1, .view h2, dialog.app h2) .emo { -webkit-text-fill-color: #fff; }
:is(.view h1, .view h2, dialog.app h2)::selection, :is(.view h1, .view h2, dialog.app h2) ::selection { -webkit-text-fill-color: #fff; background: #0f5a70; }
.view h2.small-caps { font-size: .95rem; letter-spacing: .1em; }
.view .cal-bar h2 { margin: 0 .25rem; padding-bottom: 0; }
@media (max-width: 520px) { .view h1 { font-size: 1.75rem; } .view h2 { font-size: 1.35rem; } }
@media (prefers-reduced-motion: reduce) { .view h1, .view h2, dialog.app h2 { animation: none; } }
@media (forced-colors: active) {
  .view h1, .view h2, dialog.app h2 { background: none; -webkit-text-fill-color: currentColor; filter: none; animation: none; }
}

/* Sponsors on the rider's dashboard */
.dash-sponsors .card.sponsored {
  background: linear-gradient(135deg, rgba(245,197,66,.16), rgba(250,175,81,.06) 45%, var(--panel) 80%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 12px 24px -14px rgba(245,197,66,.55);
}
.dash-sponsors h3 { font-size: 1.15rem; }

/* The daily-views chart in a sponsor's report. It keeps its colour on paper, in a shade that reads on white. */
.bars { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin: .5rem 0; }
.bars i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

/* Anything marked hidden stays hidden, even when a class sets its display (cards, forms, grids). */
[hidden] { display: none !important; }

/* Phone bottom bar: six equal columns, so every tab fits on the narrowest phones. A column never gets
   narrower than its word, so with enlarged text the bar scrolls sideways instead of the words overlapping. */
@media (max-width: 720px) {
  .tabs { display: grid; grid-template-columns: repeat(6, minmax(max-content, 1fr)); gap: 4px; padding-inline: 6px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: .7rem .3rem; font-size: .8rem; text-align: center; white-space: nowrap; }
}
@media (max-width: 350px) { .tabs a { font-size: .72rem; } }

/* Quiet text buttons (Report, Skip): no dark edge on hover, just brighter text. */
.ghostbtn:hover { color: var(--text); border-color: transparent; }

/* Pop-up titles on the rider site match the page headings. The admin page keeps plain titles: its reports get printed. */
dialog.app h2 { font-size: 1.35rem; line-height: 1.25; }

/* On paper, headings are plain text: a see-through fill would print as nothing. */
@media print {
  .view h1, .view h2, dialog.app h2 { background: none; color: #000; -webkit-text-fill-color: currentColor; filter: none; animation: none; }
  .bars i { background: #b05c0c; }
}

/* Events on a phone: the sponsor card and the filters stay slim, so the calendar is on the first screen.
   The slim card keeps its Sponsored label, name, one line of tagline and one button; the full card
   (address, directions) is on Home and on the map. */
@media (max-width: 720px) {
  .featured { margin-bottom: .6rem; }
  .featured .small-caps { display: none; }
  .featured .grid { display: flex; gap: .6rem; overflow-x: auto; scrollbar-width: none; }
  .featured .grid::-webkit-scrollbar { display: none; }
  .featured .grid > .card { flex: 1 0 86%; }
  .featured .sponsor-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .15rem .75rem; padding: .7rem .9rem; }
  .featured .sponsor-card > * { grid-column: 1; min-width: 0; }
  .featured .sponsor-card > p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .featured .sponsor-card > .small.muted { display: none; }
  .featured .sponsor-card > .row:last-child { grid-column: 2; grid-row: 1 / span 3; }
  .featured .sponsor-card > .row:last-child .primary ~ .btn { display: none; }
  /* A sideways scroller also clips above and below, so the room the selected chip's glow and the keyboard
     focus ring need is padding inside it. The negative margins keep the row where it was. */
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -6px -16px -.75rem; padding: 6px 16px 1.75rem; }
  .chips.scroll::-webkit-scrollbar { display: none; }
  .chips.scroll .chip { flex: none; }
}
