/* Route Creator — dark, warm-neutral single theme (the base theme for the pivot).
   Bright terracotta route line is the visual hero over the satellite map. */

:root {
    --rc-terracotta: #e8623a;              /* brand accent — lines, borders, focus, text-on-dark */
    --rc-terracotta-deep: #c9502e;
    /* Fill behind WHITE text (CTAs, active toggles). #b8461f ≈ 5.3:1 on #fff → passes WCAG AA;
       the #e8623a brand tone is only 3.37:1 and must NOT sit under white text. */
    --rc-terracotta-btn: #b8461f;
    --rc-terracotta-btn-hover: #a23c18;
    --rc-sage: #86a86a;
    --rc-bg: rgba(24, 21, 17, 0.84);
    --rc-bg-solid: #1a1712;
    --rc-elev-bg: rgba(20, 17, 14, 0.9);
    --rc-ink: #f4efe6;
    --rc-ink-soft: #ab9f90;
    --rc-line: rgba(255, 255, 255, 0.1);
    --rc-chip: rgba(255, 255, 255, 0.05);
    --rc-hover: rgba(255, 255, 255, 0.07);
    --rc-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
    --rc-line-strong: rgba(255, 255, 255, 0.28); /* grab-handle bar */
    --rc-sheet-top: rgba(23, 20, 16, 0.97);      /* near-opaque strip behind the sticky handle */
    --rc-radius: 16px;
    --rc-radius-md: 12px;                        /* host module, CTA */
    --rc-radius-sm: 10px;                        /* badge, social buttons */
    --rc-tint: rgba(232, 98, 58, 0.14);          /* terracotta wash (badge fill) */
    --rc-tint-line: rgba(232, 98, 58, 0.30);     /* terracotta hairline */
    --rc-tint-hover: rgba(232, 98, 58, 0.12);    /* social hover fill */
    --rc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: #000;
    font-family: var(--rc-font);
    color: var(--rc-ink);
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation; /* drop the 300ms tap delay / double-tap zoom on bare body */
}

/* Kill accidental *page* pinch-zoom on all UI chrome. On iOS/WebKit (incl. every
   in-app browser) the native pinch gesture is recognised before JS runs, so
   preventDefault can't stop it — `touch-action` is the only reliable lever, read
   declaratively before the gesture starts. `pan-x pan-y` allows scroll/pan but
   excludes pinch-zoom (and double-tap zoom). Applied to every direct child of body
   EXCEPT #mapbox-container, so the map's own gesture handling is provably untouched
   (this rule never enters the map's ancestor chain). Covers .rc-bottom, .rc-fabs,
   .rc-panel, modals, topbar — every surface a stray pinch can land on. */
body > *:not(#mapbox-container) { touch-action: pan-x pan-y; }

#mapbox-container { position: fixed; inset: 0; width: 100%; height: 100%; }

.mapboxgl-ctrl-group { border-radius: 12px !important; overflow: hidden; }

/* --- Top bar ---
   Placement + size mirror the DirtbagMaps site header (.site-header/.logo-img)
   exactly, so the DirtbagRoute mark sits identically flush-left in the gutter:
   left = header padding-left (1.5rem / 1rem), top = header padding-top
   (0.5rem / 0.75rem) + safe-area inset, height 72px / 52px, matching shadow. */
.rc-topbar {
    position: fixed;
    top: calc(0.5rem + env(safe-area-inset-top, 0px));
    left: 1.5rem;
    z-index: 5;
    pointer-events: none;
}
.rc-logo { height: 72px; width: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45)); }

@media (max-width: 768px) {
    .rc-topbar { top: calc(0.75rem + env(safe-area-inset-top, 0px)); left: 1rem; }
    .rc-logo { height: 52px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.7)); }
}

/* --- Place search (top-center) --- */
.rc-search { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 6; width: min(420px, calc(100vw - 220px)); }
.rc-search-input {
    width: 100%;
    padding: 11px 18px;
    border-radius: 999px;
    border: 1px solid var(--rc-line);
    background: var(--rc-bg);
    backdrop-filter: blur(14px);
    color: var(--rc-ink);
    font: inherit;
    font-size: 16px; /* >=16px so iOS/WKWebView doesn't auto-zoom on focus */
    box-shadow: var(--rc-shadow);
}
.rc-search-input::placeholder { color: var(--rc-ink-soft); }
.rc-search-input:focus { outline: none; border-color: var(--rc-terracotta); }
.rc-search-results { margin-top: 6px; background: var(--rc-bg-solid); border: 1px solid var(--rc-line); border-radius: 12px; box-shadow: var(--rc-shadow); overflow: hidden; }
.rc-search-results[hidden] { display: none; }
.rc-search-item { display: block; width: 100%; text-align: left; padding: 10px 14px; background: none; border: none; color: var(--rc-ink); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-search-item:hover { background: var(--rc-hover); }

/* Collapsed-search loupe button (mobile only) — expands the pill on tap. */
.rc-search-toggle { display: none; place-items: center; position: fixed; top: 12px; right: 12px; z-index: 7; width: 44px; height: 44px; border-radius: 50%; background: var(--rc-bg); backdrop-filter: blur(14px); border: 1px solid var(--rc-line); box-shadow: var(--rc-shadow); color: var(--rc-ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rc-search-toggle svg { width: 20px; height: 20px; }
.rc-search-toggle:focus-visible { outline: 2px solid var(--rc-terracotta); outline-offset: 2px; }

@media (max-width: 700px) {
    /* Search hides behind a top-right loupe; tapping it expands the pill (leaving room for the button). */
    .rc-search-toggle { display: grid; }
    .rc-search { display: none; top: 12px; left: 12px; right: 64px; width: auto; transform: none; }
    body.rc-searching .rc-search { display: block; }
    body.rc-searching .rc-search-toggle { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }
}

/* --- Left control panel --- */
.rc-panel {
    position: fixed;
    top: 88px;
    right: 16px;
    z-index: 5;
    width: 300px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 104px);
    overflow-y: auto;
    padding: 18px;
    background: var(--rc-bg);
    backdrop-filter: blur(18px);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius);
    box-shadow: var(--rc-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
/* Drag handle — only the mobile bottom sheet shows it (desktop panel has none). */
.rc-sheet-handle { display: none; }

.rc-panel-head h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.02em; }
.rc-sub { margin: 0; font-size: 13px; line-height: 1.4; color: var(--rc-ink-soft); }

/* Distance readout at the top of the panel (replaces the old floating card). */
.rc-hud { text-align: center; padding: 2px 0 12px; border-bottom: 1px solid var(--rc-line); }

/* Edit-only controls are hidden when viewing a shared course (preview mode). */
.rc-preview .rc-edit-only { display: none !important; }
.rc-preview .rc-station-del { display: none; }
.rc-preview .rc-station { cursor: default; }

/* --- Distance card (floating, top-right) --- */
.rc-hud-card {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 5;
    min-width: 168px;
    padding: 16px 22px;
    text-align: center;
    background: var(--rc-bg);
    backdrop-filter: blur(18px);
    border: 1px solid var(--rc-line);
    border-radius: var(--rc-radius);
    box-shadow: var(--rc-shadow);
}
.rc-dist { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--rc-ink); font-variant-numeric: tabular-nums; }
.rc-delta { margin-top: 7px; font-size: 13px; font-weight: 600; color: var(--rc-ink-soft); min-height: 16px; }

/* Route variants switcher (an event's 5K/10K/21K, each its own colour). */
.rc-variants-hint { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--rc-ink-soft); }
.rc-variant-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.rc-variant { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 1px solid var(--rc-line); border-radius: 10px; cursor: pointer; transition: all 0.12s ease; }
.rc-variant:hover { background: var(--rc-hover); }
.rc-variant-active { border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c); }
.rc-variant-dot { width: 14px; height: 14px; padding: 0; border-radius: 50%; background: var(--c); flex-shrink: 0; border: 1px solid rgba(255, 255, 255, 0.28); cursor: pointer; }
.rc-preview .rc-variant-dot { cursor: default; }
.rc-variant-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-variant-dist { font-size: 12px; color: var(--rc-ink-soft); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.rc-variant-del { flex-shrink: 0; width: 20px; height: 20px; border: none; background: transparent; color: var(--rc-ink-soft); font-size: 13px; cursor: pointer; border-radius: 5px; line-height: 1; }
.rc-variant-del:hover { color: var(--rc-terracotta); background: var(--rc-hover); }
.rc-variant-edit { flex-shrink: 0; width: 20px; height: 20px; border: none; background: transparent; color: var(--rc-ink-soft); font-size: 12px; cursor: pointer; border-radius: 5px; line-height: 1; }
.rc-variant-edit:hover { color: var(--rc-terracotta); background: var(--rc-hover); }
.rc-variant-add { font-size: 13px; padding: 8px 10px; }
.rc-delta.is-on { color: var(--rc-sage); }
.rc-delta.is-over { color: var(--rc-terracotta); }

/* --- Sections & chips --- */
.rc-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--rc-ink-soft); margin-bottom: 8px; }
.rc-send-label { margin-top: 4px; margin-bottom: 0; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Target distance: Backyard preset full-width, then an even 4-up row. */
.rc-targets { display: flex; flex-direction: column; gap: 7px; }
.rc-target-row { display: flex; gap: 7px; }
.rc-target-row .rc-chip { flex: 1 1 0; padding-left: 4px; padding-right: 4px; }
.rc-chip-wide { width: 100%; }
.rc-chip-sub { color: var(--rc-ink-soft); font-weight: 600; }
.rc-chip-wide.rc-chip-active .rc-chip-sub { color: rgba(255, 255, 255, 0.82); }
.rc-chip {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--rc-line);
    border-radius: 999px;
    background: transparent;
    color: var(--rc-ink);
    cursor: pointer;
    transition: all 0.12s ease;
    white-space: nowrap;
}
.rc-chip:hover { border-color: var(--rc-terracotta); background: var(--rc-hover); }
.rc-chip-active { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }

/* --- Actions --- */
.rc-actions { display: flex; flex-direction: column; gap: 10px; }
.rc-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 14px;
    border: 1px solid var(--rc-line);
    border-radius: 12px;
    background: transparent;
    color: var(--rc-ink);
    cursor: pointer;
    transition: all 0.12s ease;
}
.rc-btn:hover:not(:disabled) { border-color: var(--rc-terracotta); color: var(--rc-terracotta); background: var(--rc-hover); }
.rc-btn:disabled { opacity: 0.35; cursor: default; }
.rc-btn-primary { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; font-size: 15px; padding: 13px 14px; }
.rc-btn-primary:hover:not(:disabled) { background: var(--rc-terracotta-btn-hover); border-color: var(--rc-terracotta-btn-hover); color: #fff; }
.rc-btn-primary.is-drawing { background: var(--rc-terracotta-btn-hover); border-color: var(--rc-terracotta-btn-hover); box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.32); } /* "pressed/engaged" — distinct from hover, no green clash with Download GPX */
.rc-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-btn-row .rc-btn { flex: 1 1 auto; padding: 9px 10px; font-size: 13px; }
.rc-btn-ghost { background: transparent; }
.rc-btn-download { background: var(--rc-sage); border-color: var(--rc-sage); color: #14140f; }
.rc-btn-download:hover:not(:disabled) { filter: brightness(1.08); border-color: var(--rc-sage); color: #14140f; }
.rc-btn-share { background: transparent; border-color: var(--rc-line); color: var(--rc-ink); }
.rc-btn-share:hover:not(:disabled) { border-color: var(--rc-terracotta); color: var(--rc-terracotta); background: var(--rc-hover); }

/* --- Toast --- */
.rc-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    z-index: 20;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--rc-bg-solid);
    color: var(--rc-ink);
    border: 1px solid var(--rc-line);
    box-shadow: var(--rc-shadow);
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.rc-toast[hidden] { display: none; }
.rc-toast.rc-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Boot-failure overlay (fatal) + connectivity banner (transient) --- */
.rc-boot { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(10, 8, 6, 0.86); backdrop-filter: blur(6px); }
.rc-boot[hidden] { display: none; }
.rc-boot-card { max-width: 340px; text-align: center; padding: 24px; background: var(--rc-bg-solid); border: 1px solid var(--rc-line); border-radius: var(--rc-radius); box-shadow: var(--rc-shadow); display: flex; flex-direction: column; gap: 8px; }
.rc-boot-title { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.rc-boot-msg { font-size: 14px; line-height: 1.5; color: var(--rc-ink-soft); }
.rc-boot-retry { margin-top: 8px; align-self: center; min-width: 150px; }
.rc-netbanner { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%); z-index: 40; max-width: calc(100vw - 24px); padding: 9px 16px; border-radius: 999px; background: #7a2e16; color: #fff; border: 1px solid rgba(255, 255, 255, 0.16); box-shadow: var(--rc-shadow); font-size: 13px; font-weight: 600; text-align: center; }
.rc-netbanner[hidden] { display: none; }

/* --- First-run coach hint (makes the core loop discoverable) --- */
/* pointer-events:none so the pill never swallows the first map click/tap it points at;
   only the dismiss button opts back into pointer events. */
.rc-coach { position: fixed; top: 118px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 24px)); padding: 10px 12px 10px 14px; border-radius: 12px; background: var(--rc-bg); backdrop-filter: blur(14px); border: 1px solid var(--rc-line); box-shadow: var(--rc-shadow); font-size: 13px; line-height: 1.4; color: var(--rc-ink); pointer-events: none; }
.rc-coach[hidden] { display: none; }
.rc-coach-x { flex-shrink: 0; width: 28px; height: 28px; border-radius: 7px; border: none; background: var(--rc-chip); color: var(--rc-ink-soft); font-size: 18px; line-height: 1; cursor: pointer; pointer-events: auto; }
.rc-coach-x:hover { color: var(--rc-ink); }

/* --- Mobile floating draw controls (FAB) — desktop uses the in-panel buttons --- */
.rc-fabs { display: none; }


/* --- Toggle switch (snap to paths) --- */
.rc-toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--rc-ink); cursor: pointer; padding: 2px; }
.rc-toggle input {
    appearance: none; -webkit-appearance: none;
    width: 36px; height: 20px; flex: 0 0 auto;
    border-radius: 999px; background: var(--rc-chip); border: 1px solid var(--rc-line);
    position: relative; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.rc-toggle input::after { content: ""; position: absolute; top: 1px; left: 1px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s ease; }
.rc-toggle input:checked { background: var(--rc-terracotta); border-color: var(--rc-terracotta); }
.rc-toggle input:checked::after { transform: translateX(16px); }
.rc-toggle span { display: inline-flex; align-items: center; gap: 6px; }
.rc-toggle em { font-style: normal; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; padding: 1px 5px; border-radius: 4px; background: var(--rc-chip); color: var(--rc-ink-soft); }
.rc-snap-hint { margin: -6px 2px 0; font-size: 11.5px; line-height: 1.45; color: var(--rc-ink-soft); }
.rc-snap-hint b { color: var(--rc-ink); font-weight: 600; }

/* --- Aid-station markers on the map --- */
.rc-marker {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #211d18;
    border: 3px solid var(--rc-mk, var(--rc-terracotta));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* --- Station list --- */
.rc-station-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 178px; overflow-y: auto; }
.rc-station { padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.rc-station:hover { background: var(--rc-hover); }
.rc-station-main { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rc-station-emoji { width: 18px; text-align: center; }
.rc-station-label { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-station-sub { font-size: 11.5px; color: var(--rc-ink-soft); padding-left: 26px; font-variant-numeric: tabular-nums; }
.rc-crew { font-size: 11px; }
.rc-station-empty { list-style: none; font-size: 12px; line-height: 1.45; color: var(--rc-ink-soft); padding: 8px 6px; border: 1px dashed var(--rc-line); border-radius: 8px; }

/* --- My routes modal --- */
.rc-routes-note { margin: 0; font-size: 12.5px; color: var(--rc-ink-soft); line-height: 1.45; }
.rc-routes-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
.rc-route-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--rc-line); border-radius: 10px; }
.rc-route-row:hover { background: var(--rc-hover); }
.rc-route-info { flex: 1; min-width: 0; }
.rc-route-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-route-meta { font-size: 11.5px; color: var(--rc-ink-soft); font-variant-numeric: tabular-nums; }
.rc-route-actions { display: flex; gap: 6px; flex-shrink: 0; }
.rc-route-btn { font: inherit; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--rc-line); background: transparent; color: var(--rc-ink); cursor: pointer; transition: all 0.12s ease; }
.rc-route-btn:hover { border-color: var(--rc-terracotta); color: var(--rc-terracotta); }
.rc-route-btn-load { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }
.rc-route-btn-load:hover { background: var(--rc-terracotta-btn-hover); border-color: var(--rc-terracotta-btn-hover); color: #fff; }
.rc-routes-empty { list-style: none; padding: 16px 6px; text-align: center; color: var(--rc-ink-soft); font-size: 13px; line-height: 1.5; }
.rc-station-del { border: none; background: none; color: var(--rc-ink-soft); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; }
.rc-station-del:hover { color: var(--rc-terracotta); }
/* Scannable aid-station pills (contents + facilities), read from bitmasks. */
.rc-station-pills { display: flex; flex-wrap: wrap; gap: 3px; padding-left: 26px; margin-top: 3px; }
.rc-pill { font-size: 11px; line-height: 1.5; padding: 0 5px; border-radius: 6px; background: var(--rc-chip); }
.rc-pill-flag { background: rgba(232, 98, 58, 0.16); }
/* Editor toggle-chips (aid contents + facilities). */
.rc-ed-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.rc-tog { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border: 1px solid var(--rc-line); border-radius: 999px; background: transparent; color: var(--rc-ink); cursor: pointer; transition: all 0.12s ease; white-space: nowrap; }
.rc-tog:hover { border-color: var(--rc-terracotta); }
.rc-tog.rc-tog-on { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }
/* Route-membership toggles carry the route's own colour dot. */
.rc-route-tog { display: inline-flex; align-items: center; gap: 7px; }
.rc-route-tog-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--rc-terracotta)); border: 1px solid rgba(255, 255, 255, 0.28); flex-shrink: 0; }
.rc-route-tog.rc-tog-on { background: var(--c, var(--rc-terracotta)); border-color: var(--c, var(--rc-terracotta)); color: #fff; }
.rc-route-tog.rc-tog-on .rc-route-tog-dot { background: #fff; border-color: rgba(255, 255, 255, 0.6); }

/* --- Event header (race-page metadata on the shared link) --- */
/* Container + terracotta→sage bib stripe (the signature) */
.rc-event-header { position: relative; padding-top: 14px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--rc-line); }
.rc-event-header::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--rc-terracotta) 0%, var(--rc-terracotta) 45%, var(--rc-sage) 100%); opacity: 0.9; }

/* Eyebrow: format badge + trailing rule */
.rc-event-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.rc-event-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; padding: 4px 9px 4px 8px; border-radius: var(--rc-radius-sm); white-space: nowrap; color: var(--rc-terracotta); background: var(--rc-tint); border: 1px solid var(--rc-tint-line); }
.rc-event-badge::before { content: ""; width: 5px; height: 5px; border-radius: 1.5px; background: var(--rc-terracotta); transform: rotate(45deg); }
.rc-event-eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--rc-line), transparent); }

/* Name */
.rc-event-name { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; color: var(--rc-ink); text-wrap: balance; }

/* When (hero date — the single accent icon in the meta zone) */
.rc-event-when { display: flex; align-items: center; gap: 9px; margin-top: 12px; font-size: 13.5px; font-weight: 700; color: var(--rc-ink); line-height: 1.3; }
.rc-event-when svg { flex-shrink: 0; width: 16px; height: 16px; color: var(--rc-terracotta); }

/* Secondary meta (location, price) — hairline rows */
.rc-event-meta { margin-top: 12px; display: flex; flex-direction: column; }
.rc-meta-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--rc-line); font-size: 12.5px; font-weight: 600; color: var(--rc-ink); line-height: 1.35; }
.rc-meta-row svg { flex-shrink: 0; width: 15px; height: 15px; color: var(--rc-ink-soft); }
.rc-meta-row span { min-width: 0; overflow-wrap: anywhere; }

/* Hosted-by / race-director module */
.rc-event-host { margin-top: 14px; padding: 12px; border: 1px solid var(--rc-line); border-radius: var(--rc-radius-md); background: var(--rc-chip); }
.rc-host-top { display: flex; align-items: center; gap: 10px; }
.rc-host-avatar { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; letter-spacing: 0.02em; background: linear-gradient(150deg, var(--rc-terracotta), var(--rc-terracotta-deep)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 10px rgba(201, 80, 46, 0.30); }
.rc-host-avatar svg { width: 18px; height: 18px; color: #fff; }
/* Uploaded race-director photo fills the badge circle. */
.rc-host-avatar-img { background: var(--rc-chip); box-shadow: inset 0 0 0 1px var(--rc-line); overflow: hidden; }
.rc-host-avatar-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-host-body { min-width: 0; }
.rc-host-label { font-size: 9.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--rc-ink-soft); }
.rc-host-name { font-size: 14px; font-weight: 700; color: var(--rc-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-host-socials { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.rc-event-host.is-bare .rc-host-socials { display: none; }
.rc-social { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--rc-radius-sm); color: var(--rc-ink-soft); background: var(--rc-hover); border: 1px solid var(--rc-line); text-decoration: none; transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease, transform 0.14s ease; }
.rc-social svg { width: 17px; height: 17px; }
.rc-social:hover { color: var(--rc-terracotta); background: var(--rc-tint-hover); border-color: var(--rc-tint-line); transform: translateY(-1px); }
.rc-social:active { transform: translateY(0); }
.rc-social:focus-visible { outline: 2px solid var(--rc-terracotta); outline-offset: 2px; }

/* Description */
.rc-event-desc { margin-top: 13px; font-size: 12.5px; line-height: 1.55; color: var(--rc-ink); max-height: 128px; overflow-y: auto; }

/* Register CTA — flat solid terracotta (no glow), hover just deepens the fill */
.rc-event-cta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 12px 14px; border-radius: var(--rc-radius-md); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; background: var(--rc-terracotta-btn); border: 1px solid var(--rc-terracotta-btn); transition: background 0.14s ease, border-color 0.14s ease, transform 0.1s ease; }
.rc-event-cta:hover { background: var(--rc-terracotta-btn-hover); border-color: var(--rc-terracotta-btn-hover); }
.rc-event-cta:active { transform: translateY(1px); }
.rc-event-cta:focus-visible { outline: 2px solid var(--rc-ink); outline-offset: 2px; }
.rc-event-cta svg { flex-shrink: 0; width: 15px; height: 15px; transition: transform 0.16s ease; }
.rc-event-cta:hover svg { transform: translateX(2px); }

/* Race-director photo/logo uploader (Hosted-by section) */
.rc-avatar-field { gap: 8px; }
.rc-avatar-upload { display: flex; align-items: center; gap: 12px; }
.rc-avatar-preview { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; background: var(--rc-chip) center / cover no-repeat; border: 1px solid var(--rc-line); display: grid; place-items: center; position: relative; }
.rc-avatar-preview::after { content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px dashed var(--rc-ink-soft); opacity: 0.5; }
.rc-avatar-preview.has-img::after { display: none; }
.rc-avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rc-avatar-pick { display: inline-flex; align-items: center; font-size: 13px; padding: 8px 12px; cursor: pointer; }
.rc-avatar-remove { font-size: 13px; padding: 8px 12px; }

/* Form: icon-prefixed social inputs (Hosted-by section) */
.rc-field-hint { display: block; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--rc-ink-soft); margin-top: 2px; line-height: 1.4; }
.rc-social-fields { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.rc-social-input { position: relative; display: flex; align-items: center; }
.rc-social-input .rc-si-ic { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--rc-ink-soft); pointer-events: none; transition: color 0.14s ease; display: inline-flex; }
.rc-social-input .rc-si-ic svg { width: 16px; height: 16px; }
.rc-social-input input { width: 100%; font: inherit; font-size: 16px; font-weight: 500; padding: 9px 10px 9px 35px; border-radius: 10px; border: 1px solid var(--rc-line); background: var(--rc-chip); color: var(--rc-ink); }
.rc-social-input input::placeholder { color: var(--rc-ink-soft); }
.rc-social-input input:focus { outline: none; border-color: var(--rc-terracotta); }
.rc-social-input:focus-within .rc-si-ic { color: var(--rc-terracotta); }
.rc-event-summary { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border: 1px solid var(--rc-line); border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; }
.rc-event-summary:hover { background: var(--rc-hover); }
.rc-event-summary .rc-event-summary-sub { color: var(--rc-ink-soft); font-weight: 500; margin-left: auto; }
.rc-field-row { display: flex; gap: 8px; }
.rc-field-row .rc-field { flex: 1; min-width: 0; }
.rc-field-narrow { flex: 0 0 110px !important; }
.rc-ev-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; color: var(--rc-terracotta); margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--rc-line); }

/* --- Marker info popup (tap a pin on the map) --- */
.rc-popup .mapboxgl-popup-content { background: var(--rc-bg-solid); color: var(--rc-ink); border: 1px solid var(--rc-line); border-radius: 12px; box-shadow: var(--rc-shadow); padding: 12px 30px 12px 14px; }
.rc-popup .mapboxgl-popup-close-button { color: var(--rc-ink-soft); font-size: 17px; padding: 3px 8px; right: 1px; top: 1px; }
.rc-popup .mapboxgl-popup-close-button:hover { color: var(--rc-ink); background: none; }
.rc-popup .mapboxgl-popup-tip { display: none; }
.rc-mkpop-title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.rc-mkpop-sub { margin-top: 3px; font-size: 12px; color: var(--rc-ink-soft); font-variant-numeric: tabular-nums; }
.rc-mkpop-pills { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 3px; }
.rc-mkpop-notes { margin-top: 8px; font-size: 12.5px; line-height: 1.45; color: var(--rc-ink); }
.rc-mkpop-edit { margin-top: 10px; font: inherit; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 8px; border: 1px solid var(--rc-line); background: transparent; color: var(--rc-ink); cursor: pointer; }
.rc-mkpop-edit:hover { border-color: var(--rc-terracotta); color: var(--rc-terracotta); }

/* --- Per-segment snap popup (click a course vertex in edit mode) --- */
.rc-segpop-pop .mapboxgl-popup-content { padding: 10px 12px; }
.rc-segpop-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--rc-ink-soft); margin-bottom: 8px; }
.rc-segpop-btns { display: flex; gap: 6px; }
.rc-segpop-btn { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--rc-line); background: transparent; color: var(--rc-ink); cursor: pointer; white-space: nowrap; }
.rc-segpop-btn:hover { border-color: var(--rc-terracotta); }
.rc-segpop-btn.is-active { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }

/* Station editor modal */
.rc-modal { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); padding: 20px; }
.rc-modal[hidden] { display: none; }
.rc-modal-card { width: 340px; max-width: 100%; max-height: 90vh; overflow-y: auto; padding: 20px; background: var(--rc-bg-solid); border: 1px solid var(--rc-line); border-radius: var(--rc-radius); box-shadow: var(--rc-shadow); display: flex; flex-direction: column; gap: 12px; }
/* Event details carries the most fields — give it more room to breathe. */
#rc-event .rc-modal-card { width: 460px; }
.rc-modal-card h2 { margin: 0; font-size: 17px; }
.rc-field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; color: var(--rc-ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
/* Author `display:flex` above beats the UA `[hidden]{display:none}`, so a field the editor
   hides via `.hidden` would still render (phantom "On route" / "What's here" / "Facilities").
   Restore hiding explicitly. */
.rc-field[hidden] { display: none; }
.rc-field input, .rc-field select, .rc-field textarea { font: inherit; font-size: 16px; font-weight: 500; text-transform: none; letter-spacing: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rc-line); background: var(--rc-chip); color: var(--rc-ink); }
.rc-field input:focus, .rc-field select:focus, .rc-field textarea:focus { outline: none; border-color: var(--rc-terracotta); }
.rc-field textarea { resize: vertical; }
.rc-field-toggle { flex-direction: row; align-items: center; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--rc-ink); }
.rc-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.rc-spacer { flex: 1; }
.rc-btn-danger { color: var(--rc-terracotta); border-color: transparent; background: transparent; }
.rc-btn-danger:hover:not(:disabled) { background: rgba(232, 98, 58, 0.12); border-color: transparent; color: var(--rc-terracotta); }

/* --- Elevation profile: centered, compact, dark --- */
/* Bottom cluster: a map/marker toolbar stacked above the elevation profile. */
.rc-bottom {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: calc(100vw - 32px);
}
/* No wrapping card — the pill groups float directly on the map. */
.rc-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    width: max-content;
    max-width: calc(100vw - 32px);
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
}
/* Every toolbar group is the same segmented pill, in the elevation-chart's glass. */
.rc-seg, .rc-tb-markers { display: inline-flex; align-items: center; background: var(--rc-elev-bg); backdrop-filter: blur(16px); box-shadow: var(--rc-shadow); border: 1px solid var(--rc-line); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: nowrap; }
.rc-seg-btn, .rc-mk-chip { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border: none; border-radius: 999px; background: none; color: var(--rc-ink-soft); cursor: pointer; transition: all 0.12s ease; white-space: nowrap; }
.rc-seg-btn:hover, .rc-mk-chip:hover { color: var(--rc-ink); background: var(--rc-hover); }
.rc-seg-active, .rc-seg-active:hover, .rc-mk-chip.rc-chip-active { background: var(--rc-terracotta-btn); color: #fff; }
.rc-mk-chip { color: var(--rc-ink); display: inline-flex; align-items: center; gap: 5px; } /* marker labels stay readable (actions, not toggles) */
/* Compass pill — the needle rotates with bearing; click resets to north. */
.rc-compass-btn { padding: 5px 7px; display: inline-flex; align-items: center; justify-content: center; }
.rc-compass-svg { width: 18px; height: 18px; display: block; transition: transform 0.15s ease-out; }
/* The creator has a custom compass in the toolbar — hide Mapbox's floating one. */
.mapboxgl-ctrl-bottom-left { display: none !important; }

.rc-elev {
    position: relative;
    align-self: stretch; /* match the toolbar width so the two stack as one aligned unit */
    width: auto;
    max-width: calc(100vw - 32px);
    padding: 9px 14px 8px;
    background: var(--rc-elev-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--rc-line);
    border-radius: 14px;
    box-shadow: var(--rc-shadow);
}
.rc-elev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.rc-elev-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; color: var(--rc-ink-soft); }
.rc-elev-stats { font-size: 12.5px; font-weight: 700; color: var(--rc-ink); font-variant-numeric: tabular-nums; }
/* Distance readout lives in the sheet HUD on desktop; on mobile it moves in here (see @media). */
.rc-elev-dist { display: none; font-weight: 800; color: var(--rc-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; }
.rc-elev-delta { font-size: 11px; font-weight: 600; color: var(--rc-ink-soft); letter-spacing: 0; margin-left: 5px; }
.rc-elev-delta.is-on { color: var(--rc-sage); }
.rc-elev-delta.is-over { color: var(--rc-terracotta); }
.rc-elev-plot { position: relative; height: 84px; }
.rc-elev-svg { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.rc-elev-cursor { position: absolute; inset: 0; pointer-events: none; }
.rc-elev-cursor[hidden] { display: none; }
.rc-elev-cursor-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(244, 239, 230, 0.5); transform: translateX(-0.5px); }
.rc-elev-cursor-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid var(--rc-terracotta);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%);
}

/* Elevation axis labels + on-profile aid-station markers + peak */
.rc-elev-axis-y { position: absolute; inset: 0; pointer-events: none; }
.rc-elev-axis-y span { position: absolute; left: 5px; font-size: 10px; font-weight: 600; color: var(--rc-ink-soft); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); font-variant-numeric: tabular-nums; }
.rc-ax-ytop { top: 2px; }
.rc-ax-ybot { bottom: 2px; }
.rc-elev-axis-x { position: relative; height: 13px; margin-top: 3px; font-size: 10px; color: var(--rc-ink-soft); font-variant-numeric: tabular-nums; }
.rc-elev-axis-x span { position: absolute; top: 0; }
.rc-ax-x0 { left: 2px; }
.rc-ax-xmid { left: 50%; transform: translateX(-50%); }
.rc-ax-xend { right: 2px; }
.rc-elev-stations { position: absolute; inset: 0; pointer-events: none; }
.rc-elev-stn { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }
.rc-elev-stn-dot { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--rc-bg-solid); border: 2.5px solid var(--rc-terracotta); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.5); }
.rc-elev-stn-emoji { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 11px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85)); }
.rc-elev-peak { position: absolute; transform: translate(-50%, -100%); margin-top: -2px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid #fff; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }

/* Map scrub marker (driven by hovering the elevation chart). */
.rc-scrub {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 4px solid var(--rc-terracotta);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* --- Mobile: detented bottom-sheet shell ------------------------------- */
@media (max-width: 700px) {
    /* Detented bottom sheet — JS sets --rc-sheet-h (peek / mid / full) + --rc-peek. */
    .rc-panel {
        top: auto; bottom: 0; left: 0; right: 0; z-index: 8;
        width: 100%; max-width: 100%;
        height: var(--rc-sheet-h, 33dvh);
        max-height: 94dvh;
        border-radius: 18px 18px 0 0;
        padding: 0 16px calc(16px + env(safe-area-inset-bottom));
        gap: 14px;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        transition: height 0.26s cubic-bezier(0.22, 0.61, 0.36, 1);
    }
    .rc-panel.rc-sheet-dragging { transition: none; } /* live drag = no lag */
    /* Tight upward lift instead of the default 44px-blur shadow, which spilled up
       full-width and read as a "box" behind the floating toolbar. */
    .rc-panel { box-shadow: 0 -4px 14px -10px rgba(0, 0, 0, 0.6); }

    /* Sticky grab handle — bled to the sheet edges, near-opaque so content scrolls under it. */
    .rc-sheet-handle {
        display: block; position: sticky; top: 0; z-index: 3;
        width: calc(100% + 32px); margin: 0 -16px 2px;
        padding: 11px 0 9px; border: 0; cursor: grab;
        background: var(--rc-sheet-top);
        border-radius: 18px 18px 0 0;
        -webkit-tap-highlight-color: transparent;
        touch-action: none; /* the handle owns the drag gesture */
    }
    .rc-sheet-handle::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 999px; background: var(--rc-line-strong); margin: 0 auto; }
    .rc-sheet-handle:active { cursor: grabbing; }
    .rc-sheet-handle:focus-visible { outline: 2px solid var(--rc-terracotta); outline-offset: -4px; }

    .rc-hud-card { top: 12px; right: 12px; min-width: 120px; padding: 10px 14px; }
    /* Distance moves out of the (bulky) sheet HUD and into the elevation strip to free map space. */
    .rc-hud { display: none; }

    /* Toolbar + elevation ride just above the sheet's peek; the sheet (z 8) covers them when expanded. */
    .rc-bottom { bottom: calc(var(--rc-peek, 128px) + 8px); left: 8px; right: 78px; width: auto; max-width: none; transform: none; align-items: stretch; z-index: 5; }
    .rc-toolbar { flex-wrap: nowrap; width: 100%; max-width: 100%; justify-content: flex-start; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .rc-toolbar::-webkit-scrollbar { display: none; }
    /* Declutter: marker chips collapse to their emoji (labels live in the editor / aria-label). */
    .rc-mk-label { display: none; }
    .rc-mk-chip { gap: 0; padding: 7px 10px; font-size: 17px; }

    /* Toolbar pills keep their glass background (base rule), but with a tight shadow —
       the default 44px-blur one spilled a soft halo that read as a box on the map. */
    .rc-seg, .rc-tb-markers { box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.5); gap: 4px; }
    /* Tighter, lower-profile elevation strip — now the home of the distance readout. */
    .rc-elev { width: 100%; padding: 7px 11px 6px; }
    .rc-elev-title { display: none; } /* the chart is self-evident; the distance takes this slot */
    .rc-elev-dist { display: inline; font-size: 15px; }
    .rc-elev-stats { font-size: 11.5px; }
    .rc-elev-plot { height: 58px; }
    .rc-topbar { top: calc(env(safe-area-inset-top, 0px) + 2px); left: 4px; padding: 0; }
    /* Bottom-sheet: keep race-card tap targets >= 44px */
    .rc-event-name { font-size: 23px; }
    .rc-social { width: 44px; height: 44px; }
    .rc-social svg { width: 18px; height: 18px; }
    .rc-event-cta { padding: 14px; }

    /* Floating draw controls — a terracotta pencil FAB (bottom, thumb-closest), with an undo
       satellite (shown when there's history) and a snap toggle (shown while drawing) above it. */
    /* Anchored to the LIVE sheet height (not just peek) so the draw FAB always rides ~8px
       above the sheet's top edge — reachable at peek & mid, tracking the sheet as it drags. */
    .rc-fabs { display: flex; flex-direction: column; align-items: center; gap: 10px; position: fixed; right: 12px; bottom: calc(var(--rc-sheet-h, 128px) + 8px); z-index: 9; transition: bottom 0.26s cubic-bezier(0.22, 0.61, 0.36, 1); }
    .rc-fabs.rc-sheet-dragging { transition: none; } /* track the finger 1:1 while dragging the handle */
    /* The FAB is the draw action at peek & mid (where an in-sheet button would sit clipped at
       the fold); the in-sheet Start/Stop button only appears once the sheet is fully open. */
    .rc-panel:not([data-detent="full"]) #rc-draw { display: none; }
    .rc-fab { border-radius: 50%; border: 1px solid var(--rc-line); display: grid; place-items: center; background: var(--rc-bg-solid); color: var(--rc-ink); box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.55); cursor: pointer; line-height: 1; -webkit-tap-highlight-color: transparent; transition: transform 0.12s ease, background 0.14s ease, opacity 0.15s ease; }
    .rc-fab:active { transform: scale(0.94); }
    .rc-fab:focus-visible { outline: 2px solid var(--rc-terracotta); outline-offset: 2px; }
    .rc-fab-draw { width: 58px; height: 58px; background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); color: #fff; }
    .rc-fab-draw.is-drawing { background: var(--rc-terracotta-btn-hover); border-color: var(--rc-terracotta-btn-hover); }
    .rc-fab-draw svg { width: 26px; height: 26px; }
    .rc-fab-undo { width: 46px; height: 46px; font-size: 22px; }
    .rc-fab-undo:disabled { opacity: 0; pointer-events: none; }
    /* Snap toggle: appears while drawing (that's when it matters); terracotta fill = ON. */
    .rc-fab-snap { width: 46px; height: 46px; font-size: 21px; opacity: 0; pointer-events: none; }
    .rc-fabs.is-drawing.has-points .rc-fab-snap { opacity: 1; pointer-events: auto; } /* only after the first dot */
    .rc-fab-snap.is-on { background: var(--rc-terracotta-btn); border-color: var(--rc-terracotta-btn); }

    .rc-coach { top: 70px; left: 12px; right: 12px; transform: none; max-width: none; width: auto; } /* full-width, tucked just under the logo / loupe */

    /* Touch targets — bring the smallest controls up toward 44px (Apple HIG). */
    .rc-btn, .rc-chip { min-height: 44px; }
    .rc-seg-btn, .rc-mk-chip, .rc-tog, .rc-route-btn { min-height: 40px; }
    .rc-variant-del, .rc-variant-edit { width: 34px; height: 34px; }
    .rc-station-del { min-width: 36px; min-height: 36px; }
    .rc-mkpop-edit, .rc-segpop-btn { min-height: 38px; }
    .rc-popup .mapboxgl-popup-close-button { width: 36px; height: 36px; font-size: 20px; }

    /* Modals: anchor to top, keep Save pinned above the keyboard, dvh so the in-app chrome can't clip the card. */
    .rc-modal { align-items: flex-start; padding: 12px; }
    .rc-modal-card, #rc-event .rc-modal-card { width: 100%; max-width: 100%; max-height: 92dvh; margin-top: max(10px, env(safe-area-inset-top)); }
    .rc-modal-actions { position: sticky; bottom: 0; margin: 4px -20px 0; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--rc-bg-solid); border-top: 1px solid var(--rc-line); }
}

/* Landscape phones / small tablets (700–900px, short height): stop the floating
   toolbar overflowing by letting it scroll horizontally instead of overflowing the map. */
@media (min-width: 701px) and (max-width: 900px) and (max-height: 560px) {
    .rc-toolbar { flex-wrap: nowrap; overflow-x: auto; max-width: calc(100vw - 32px); }
}

@media (prefers-reduced-motion: reduce) {
    .rc-social, .rc-event-cta, .rc-event-cta svg { transition: none; }
    .rc-social:hover, .rc-event-cta:hover { transform: none; }
    .rc-panel, .rc-fab, .rc-fabs { transition: none; } /* no sheet-resize / FAB animation for vestibular-sensitive users */
}
