/* PlayLetics Overworld: same look as playletics.app (black, Outfit, green #00FF57, dark rounded cards). */
:root {
  --green: #00ff57;
  --green-hover: #00db4b;
  --green-soft: rgba(0, 255, 87, 0.12);
  --green-line: rgba(0, 255, 87, 0.45);
  --bg: #000;
  --panel: #0b0d0b;
  --card: #121612;
  --card-2: #171c17;
  --line: #232923;
  --line-2: #2f372f;
  --text: #fff;
  --muted: #a9b2a9;
  --dim: #6f786f;
  --gold: #ffd36a;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Outfit', 'Segoe UI', system-ui, sans-serif; font-size: 15px; color: var(--text);
  background: var(--bg); overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* Scrollbars: thin, dark, rounded; never the grey Windows bar. */
* { scrollbar-width: thin; scrollbar-color: #2f372f transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a312a; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3c463c; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; height: 0; width: 0; }

/* ---- Layout ---- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
/* Top navigation: brand, then the sections (Explore, Create, Free ride) underlined in green when chosen. */
.topbar { grid-column: 1 / -1; display: flex; align-items: stretch; gap: 48px; height: 56px; padding: 0 20px; border-bottom: 1px solid var(--line); background: #000; min-width: 0; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-size: 16px; flex: none; }
.brand img { width: 24px; height: 24px; display: block; }
.brand b { font-weight: 700; }
.brand span { font-weight: 400; }
.nav { display: flex; align-items: stretch; gap: 34px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav button { position: relative; border: 0; background: none; color: #e9eee9; padding: 0 2px; cursor: pointer; font-size: 16px; font-weight: 500; white-space: nowrap; }
.nav button:hover { color: #fff; }
.nav button[aria-selected='true'] { color: #fff; font-weight: 700; }
.nav button[aria-selected='true']::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--green); }
.nav button:focus-visible { outline-offset: -4px; }
/* Right of the navigation: notifications and Sign in (placeholders for now). */
.account { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.bell { display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: none; color: #fff; cursor: pointer; padding: 0; }
.bell:hover { background: var(--card); }
.signin { background: var(--green); color: #000; border: 0; border-radius: 10px; padding: 9px 16px; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.signin:hover { background: var(--green-hover); }
.toast { position: fixed; top: 64px; right: 20px; z-index: 2000; max-width: min(360px, calc(100vw - 32px)); background: rgba(12, 15, 12, .97); border: 1px solid var(--green-line); border-radius: 10px; padding: 10px 14px; font-size: 14px; color: #fff; box-shadow: 0 8px 28px rgba(0, 0, 0, .55); }

/* Under it: the games as pills (the chosen one green), and The Witcher's worlds after a divider. */
.subbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 20px 0; min-width: 0; }
.game-chips { display: flex; gap: 8px; flex: none; }
.game-chip { background: var(--card); border: 1px solid var(--line-2); color: #fff; border-radius: 999px; padding: 7px 18px; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.game-chip:hover { border-color: #485248; }
.game-chip[aria-pressed='true'] { background: var(--green); border-color: var(--green); color: #000; font-weight: 700; }
.game-chips:not(.hidden) + .regions { padding-left: 12px; border-left: 1px solid var(--line-2); }

.stage { grid-row: 3; position: relative; min-width: 0; min-height: 0; padding: 12px 0 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.regions { display: flex; flex-wrap: wrap; gap: 6px; }
.map-frame { position: relative; flex: 1; min-height: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #070907; }
#map, #routeMap { position: absolute; inset: 0; background: #070907; }
.map-hint { position: absolute; left: 12px; bottom: 12px; z-index: 600; background: rgba(0, 0, 0, .78); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; font-size: 13px; color: var(--muted); pointer-events: none; max-width: 70%; }
.link-banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 650; background: rgba(0, 0, 0, .86); border: 1px solid var(--green-line); border-radius: 10px; padding: 8px 14px; font-size: 14px; color: var(--green); font-weight: 600; max-width: 80%; text-align: center; box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }

.panel { grid-row: 3; min-height: 0; display: flex; flex-direction: column; padding: 12px 20px 14px 16px; gap: 10px; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h2 { font-size: 16px; font-weight: 700; margin: 0 0 10px; }
/* Ride options (steering, time, weather) fold; the heading shows what is chosen. */
.fold-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; cursor: pointer; margin-bottom: 10px; border-radius: 6px; }
.fold-head h2 { margin: 0; flex: none; }
.fold-head:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.fold-value { flex: 1; min-width: 0; text-align: right; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fold-arrow { flex: none; color: var(--muted); transform: rotate(180deg); transition: transform .15s; }
.card.fold.collapsed .fold-arrow { transform: none; }
.card.fold.collapsed .fold-head { margin-bottom: 0; }
.card.fold.collapsed > :not(.fold-head) { display: none; }
.note { color: var(--muted); font-size: 13px; line-height: 1.4; }
.muted { color: var(--muted); }

/* Chips and list buttons */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--card); border: 1px solid var(--line-2); color: var(--muted); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip:hover { color: #fff; border-color: #485248; }
.chip[aria-pressed='true'] { border-color: var(--green); background: var(--green-soft); color: var(--green); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.place-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.place { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); padding: 8px 10px; text-align: left; cursor: pointer; font-size: 13px; }
.place:hover { color: #fff; border-color: #485248; }
.place[aria-pressed='true'] { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.selected { font-size: 14px; min-height: 20px; }
.selected b { color: var(--green); font-weight: 600; }

/* Route list */
.route-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; color: #fff; }
.route-item:hover { border-color: #485248; }
.route-item[aria-pressed='true'] { border-color: var(--route, var(--green)); background: linear-gradient(180deg, #132013 0%, #0d140d 100%); }
.route-num { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: #1b221b; color: var(--route, var(--green)); font-weight: 700; font-size: 14px; }
.route-item[aria-pressed='true'] .route-num { background: var(--route, var(--green)); color: #000; }
.route-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-meta { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-km { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; }
.route-km small { display: block; text-align: right; color: var(--dim); font-weight: 500; font-size: 11px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.stat { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.cp-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; counter-reset: cp; }
.cp-list li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.cp-list li::before { counter-increment: cp; content: counter(cp); min-width: 20px; height: 20px; border-radius: 6px; background: #1b221b; color: var(--green); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); margin-left: 6px; vertical-align: middle; font-weight: 500; }
.badge.ok { border-color: var(--green-line); color: var(--green); }

/* Leaderboard */
.board-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.board-head h2 { margin: 0; }
.board { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.board th { color: var(--dim); font-weight: 500; text-align: left; padding: 4px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.board td { padding: 7px 6px; border-top: 1px solid var(--line); }
.board td.rank { width: 28px; color: var(--muted); font-weight: 700; }
.board tr.top1 td.rank { color: var(--gold); }
.board td.time { font-weight: 700; text-align: right; }
.board td.watts { color: var(--muted); text-align: right; }
.board-empty { color: var(--muted); font-size: 13px; padding: 10px 0 2px; }

.rider { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.rider-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rider-row b { color: #fff; }
.rider-form { display: flex; gap: 6px; margin-top: 8px; }
.rider-form input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; }

/* Time, toggle, select */
.time-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
input[type='range'] { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: #2a312a; outline: none; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--green); border: 3px solid #000; box-shadow: 0 0 0 1px var(--green); cursor: pointer; }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--green); border: 3px solid #000; }
.clock { font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 700; min-width: 64px; text-align: right; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--muted); gap: 12px; }
.toggle { width: 44px; height: 24px; border-radius: 12px; border: 1px solid #3a423a; background: #1d231d; padding: 0; position: relative; cursor: pointer; flex: none; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #9aa39a; transition: transform .15s, background .15s; }
.toggle[aria-checked='true'] { background: var(--green); border-color: var(--green); }
.toggle[aria-checked='true'] span { transform: translateX(20px); background: #000; }
.select-wrap { position: relative; }
.select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
select { width: 100%; appearance: none; -webkit-appearance: none; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 36px 10px 12px; cursor: pointer; }
select option { background: #121612; color: #fff; }

/* Actions */
.actions { display: flex; gap: 8px; padding-top: 4px; flex: none; }
.start-hint { text-align: center; flex: none; }
.app.boards .start-hint { display: none; }
.btn { border-radius: 10px; padding: 12px 16px; cursor: pointer; font-weight: 700; border: 1px solid transparent; font-size: 15px; text-decoration: none; text-align: center; }
.btn.primary { flex: 1; background: var(--green); color: #000; font-size: 16px; letter-spacing: .02em; }
.btn.primary:hover { background: var(--green-hover); }
.btn.primary:disabled { background: #1d231d; color: var(--dim); cursor: default; }
.btn.secondary { background: var(--card); border-color: var(--line-2); color: #fff; font-weight: 600; }
.btn.secondary:hover { border-color: #485248; }
.small-btn { background: none; border: 1px solid var(--line-2); color: var(--muted); border-radius: 8px; padding: 4px 9px; font-size: 12px; cursor: pointer; }
.small-btn:hover { color: #fff; }

/* Dialog (install prompt on the website) */
dialog { background: var(--card); color: #fff; border: 1px solid var(--line-2); border-radius: 18px; padding: 22px 24px; max-width: 420px; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog h2 { margin: 0 0 8px; }
dialog p { color: var(--muted); line-height: 1.5; }
dialog .actions { margin-top: 14px; }
/* The ride button's overlay: "Opening PlayLetics…", then "not installed yet" with the download */
#install { width: min(420px, calc(100vw - 32px)); position: relative; }
#install h2 { padding-right: 32px; }
#install p { margin: 0; min-height: 1.5em; }
.install-actions { flex-wrap: wrap; }
.install-actions .btn.primary { flex: 1 1 100%; order: -1; }
.install-actions .btn.secondary { flex: 1; }
/* The ride button on a phone: send the ride to the Windows PC */
#handoff { width: min(420px, calc(100vw - 32px)); position: relative; }
#handoff h2 { padding-right: 32px; }
#handoff p { margin: 0 0 14px; }
#handoffStatus { margin-top: 8px; min-height: 1.4em; overflow-wrap: anywhere; }
#handoffStatus.ok { color: var(--green); }
#handoffStatus.bad { color: #ff7a7a; }
@media (max-width: 420px) {
  #handoffForm { flex-wrap: wrap; }
  #handoffForm input { flex: 1 1 100%; }
  #handoffForm .btn { flex: 1; }
}

/* Leaflet, themed */
.leaflet-container { font-family: inherit; background: #070907; }
.leaflet-bar { border: 1px solid var(--line-2) !important; border-radius: 10px !important; overflow: hidden; box-shadow: none !important; }
.leaflet-bar a, .leaflet-bar a:hover { background: rgba(10, 12, 10, .92); color: #fff; border-bottom: 1px solid var(--line) !important; width: 32px; height: 32px; line-height: 30px; }
.leaflet-bar a:hover { color: var(--green); }
.leaflet-bar a.leaflet-disabled { color: #3c463c; background: rgba(10, 12, 10, .92); }
.leaflet-control-attribution { background: rgba(0, 0, 0, .65) !important; color: var(--dim) !important; font-size: 10px; border-top-left-radius: 8px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-tooltip.place-tip { background: rgba(8, 10, 8, .94); color: #fff; border: 1px solid var(--line-2); border-radius: 8px; box-shadow: none; font-size: 12px; padding: 4px 8px; }
.leaflet-tooltip.place-tip::before { display: none; }

.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--green); border: 2px solid #000; transform: rotate(-45deg); box-shadow: 0 0 0 3px rgba(0, 255, 87, .3); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.dot:hover { background: var(--green); }
.cp-marker { width: 22px; height: 22px; border-radius: 7px; background: #000; border: 2px solid var(--green); color: var(--green); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.cp-marker.start { background: var(--green); color: #000; }
.cp-marker.finish { background: #fff; border-color: #fff; color: #000; }

.build-actions { margin-top: 10px; }
.wp-marker { width: 20px; height: 20px; border-radius: 50%; background: #000; border: 2px solid var(--green); color: var(--green); font-size: 10px; font-weight: 700; display: grid; place-items: center; cursor: pointer; }
.wp-marker:hover { background: #3a0d0d; border-color: #ff5a5a; color: #ff5a5a; }
#bList li { align-items: center; }
.wp-remove { margin-left: auto; width: 24px; height: 24px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.wp-remove:hover, .wp-remove:focus-visible { color: #ff5a5a; border-color: #4a2020; background: #2a1212; }

/* Overworld */
.world-label { transform: translate(-50%, -50%); white-space: nowrap; font-size: 13px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 3px #000, 0 0 8px #000; letter-spacing: .02em; pointer-events: none; }

/* Route result viewer */
.route-wrap { display: flex; flex-direction: column; height: 100%; padding: 14px 18px; gap: 10px; }
.route-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.route-head h1 { font-size: 20px; margin: 0; }
.route-stats { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.route-stats b { color: var(--green); font-size: 16px; }
.route-wrap .map-card { position: relative; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.card.result { padding: 10px 14px; }
.card.result b { color: var(--green); font-size: 22px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); z-index: 500; background: rgba(0, 0, 0, .55); }

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto auto auto; height: auto; min-height: 100%; }
  .stage { grid-row: 3; padding: 12px 16px 0; }
  .panel { grid-row: 4; }
  .panel { padding: 12px 16px 16px; }
  .scroll { overflow: visible; }
  .topbar { flex-wrap: wrap; height: auto; padding: 0 16px; gap: 0 24px; }
  .brand { height: 48px; }
  .nav { order: 2; width: 100%; height: 44px; gap: 26px; overflow-x: auto; scrollbar-width: none; }
  .nav button { font-size: 15px; }
  .subbar { padding: 10px 16px 0; }
  /* The Witcher's worlds get their own line under the games, all in view (no sideways scrolling). */
  .game-chips:not(.hidden) + .regions { flex-basis: 100%; padding-left: 0; border-left: 0; }
  .regions .chip { flex: none; }
  .place-list { grid-template-columns: 1fr; }
}


/* Elevation profile: the route's colour, checkpoint or waypoint ticks, hover cursor */
.elev-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); margin-bottom: 6px; }
.elev-read { text-transform: none; letter-spacing: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.elev-plot { position: relative; height: 112px; background: #0b0f0b; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; touch-action: none; cursor: crosshair; }
.elev-plot svg { position: absolute; left: 0; top: 0; width: 100%; height: calc(100% - 22px); display: block; }
.elev-y { position: absolute; left: 6px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; background: rgba(11, 15, 11, .8); padding: 0 4px; border-radius: 4px; }
.elev-y.top { top: 4px; }
.elev-y.bottom { bottom: 26px; }
.elev-cps { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; border-top: 1px solid var(--line); pointer-events: none; }
.elev-cp { position: absolute; bottom: 3px; transform: translateX(-50%); min-width: 16px; height: 16px; padding: 0 3px; border-radius: 5px; background: #1b221b; color: var(--green); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.elev-cp::before { content: ''; position: absolute; left: 50%; bottom: 19px; width: 1px; height: 90px; background: rgba(255, 255, 255, .14); }
.elev-cp.start { transform: none; margin-left: 3px; }
.elev-cp.finish { transform: translateX(-100%); margin-left: -3px; }
.elev-cp.start::before, .elev-cp.finish::before { display: none; }
.elev-cp.start, .elev-cp.finish { background: #fff; color: #000; }
.elev-cursor { position: absolute; top: 0; bottom: 22px; width: 2px; margin-left: -1px; background: #fff; pointer-events: none; }
.elev-x { display: flex; justify-content: space-between; font-size: 10px; color: var(--dim); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Route builder: elevation and segments. Docked over the bottom of the map on wide screens (the hint and Leaflet's
   attribution move up above it), its own block under the map on narrow ones. --dock: its height, set by app.js. */
.elev-dock { background: rgba(8, 11, 8, .92); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.elev-dock .elev-head { align-items: center; margin-bottom: 6px; }
.elev-title { flex: none; color: var(--muted); font-weight: 600; }
.elev-sum { color: var(--dim); font-weight: 500; text-transform: none; letter-spacing: 0; }
.elev-dock .elev-read { flex: 1; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elev-toggle { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 7px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.elev-toggle:hover { color: #fff; border-color: #485248; }
.elev-toggle svg { transition: transform .15s; }
.elev-dock.collapsed .elev-body { display: none; }
.elev-dock.collapsed .elev-head { margin-bottom: 0; }
.elev-dock.collapsed .elev-read { visibility: hidden; }
.elev-dock.collapsed .elev-toggle svg { transform: rotate(180deg); }
.elev-dock .elev-plot { height: 78px; background: rgba(0, 0, 0, .35); }
.elev-dock .elev-cp::before { height: 56px; }
.elev-dock .elev-y.top { top: 2px; }
.elev-dock .elev-y.bottom { bottom: 24px; }
.elev-dock .elev-x { margin-top: 2px; }
.elev-band { fill: transparent; }
.elev-band.alt { fill: rgba(255, 255, 255, .045); }
.elev-band.on { fill: rgba(0, 255, 87, .14); }
/* Waypoint ticks: a segment boundary (solid) or inside a merged segment (dashed); a click toggles it. */
button.elev-cp { pointer-events: auto; border: 0; cursor: pointer; font: inherit; font-size: 10px; font-weight: 700; line-height: 1; }
.elev-cp.split { background: var(--green); color: #000; }
.elev-cp.split::before { background: rgba(0, 255, 87, .45); }
.elev-cp.joined { background: #0b0f0b; color: var(--muted); box-shadow: inset 0 0 0 1px #485248; }
.elev-cp.joined::before { background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .2) 0 3px, transparent 3px 7px); }
button.elev-cp:hover, button.elev-cp:focus-visible { outline: 1px solid #fff; outline-offset: 1px; z-index: 1; }
.seg-strip { display: flex; gap: 3px; margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
/* A segment chip: number (shows it on the map), name typed in place, distance · climb · grade. */
.seg { flex: 1 1 0; min-width: 28px; display: flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px 3px 3px; cursor: text; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; container-type: inline-size; transition: border-color .12s; }
.seg-n { flex: none; min-width: 20px; height: 20px; padding: 0 4px; border: 0; border-radius: 5px; background: #1b221b; color: var(--green); font: inherit; font-weight: 700; font-size: 11px; display: grid; place-items: center; cursor: pointer; }
.seg-n:hover { background: var(--green); color: #000; }
.seg-name { flex: 1 1 0; width: 0; min-width: 0; background: none; border: 0; border-radius: 4px; padding: 2px 3px; color: #fff; font: inherit; font-size: 12px; font-weight: 600; text-overflow: ellipsis; cursor: text; }
.seg-name::placeholder { color: var(--muted); font-weight: 500; opacity: 1; }
.seg-name:hover { background: rgba(255, 255, 255, .05); }
.seg-name:focus { outline: none; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px var(--green-line); }
.seg-km, .seg-more { flex: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.seg-more { margin-left: -2px; }
@container (max-width: 210px) { .seg-more { display: none; } }
@container (max-width: 120px) { .seg-km { display: none; } }
@container (max-width: 44px) { .seg-name { display: none; } }
/* A named segment keeps room for its name; the row scrolls sideways when the names do not all fit. */
.seg.named { min-width: 92px; }
.seg:hover, .seg.on { border-color: var(--green-line); color: #fff; }
.seg.on .seg-n { background: var(--green); color: #000; }
/* While named, a chip widens so the field fits, however short the segment. */
.seg.editing { flex: 0 0 auto !important; width: min(240px, 70%); border-color: var(--green); }
.wp-marker.joined { border-style: dashed; color: rgba(0, 255, 87, .75); }
@media (min-width: 861px) {
  .elev-dock { position: absolute; left: 32px; right: 12px; bottom: 26px; z-index: 1001; }
  .stage.docked .map-hint { bottom: calc(var(--dock, 0px) + 22px); }
  .stage.docked .leaflet-bottom { bottom: calc(var(--dock, 0px) + 14px); }
}
@media (max-width: 860px) {
  .map-frame { flex: none; height: 56vh; }
}

/* Explore: Route / Free ride, a switch at the top of the map */
.mode-switch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 700; display: flex; gap: 2px; padding: 3px; background: rgba(8, 10, 8, .9); border: 1px solid var(--line-2); border-radius: 999px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); }
/* Build a route: undo and redo on the map, where the Route / Free ride switch is on Explore */
.map-tools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 700; display: flex; gap: 2px; padding: 3px; background: rgba(8, 10, 8, .9); border: 1px solid var(--line-2); border-radius: 999px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); }
.map-tools button { display: grid; place-items: center; width: 40px; height: 32px; border: 0; background: none; color: #fff; border-radius: 999px; cursor: pointer; }
.map-tools button:hover:not(:disabled) { color: var(--green); background: rgba(255, 255, 255, .06); }
.map-tools button:disabled { color: #3c463c; cursor: default; }
/* The built route's name, where the card's heading would be */
.route-title { display: block; width: 100%; box-sizing: border-box; margin: 0 0 10px; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 16px; font-weight: 700; color: #fff; }
.route-title::placeholder { color: var(--muted); font-weight: 600; }
.mode-switch button { border: 0; background: none; color: var(--muted); border-radius: 999px; padding: 6px 16px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.mode-switch button:hover { color: #fff; }
.mode-switch button[aria-selected='true'] { background: var(--green); color: #000; }
.link-banner { top: 58px; }

/* Leaderboards: the route list with each record, and the chosen route's board under the map */
.gold { color: var(--gold); }
/* Leaderboards: the overall board takes the map's place; no game row (it is every game) and nothing to start. */
.app.boards .subbar, .app.boards .panel > .actions, .stage.boards .map-frame { display: none !important; }
.stage.boards .lb { flex: 1 1 auto; max-height: none; }
.lb { flex: 0 1 auto; max-height: 58%; min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 10px; }
.lb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.lb-head h2 { margin: 0 0 2px; font-size: 17px; }
.lb-scroll { overflow: auto; min-height: 0; flex: 0 1 auto; border: 1px solid var(--line); border-radius: 10px; }
.lb-scroll:has(table:empty) { display: none; }
.lb-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
.lb-table th, .lb-table td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); background: var(--card); }
.lb-table tbody tr:last-child td { border-bottom: 0; }
.lb-table thead th { position: sticky; top: 0; z-index: 2; color: var(--dim); font-weight: 500; font-size: 11px; vertical-align: bottom; background: #0f130f; }
/* Rank and rider stay in view while the segments scroll sideways. */
.lb-table .rank { position: sticky; left: 0; z-index: 1; width: 34px; min-width: 34px; text-align: left; color: var(--muted); font-weight: 700; }
.lb-table .rider { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 110px; color: #fff; font-weight: 600; border-right: 1px solid var(--line-2); }
.lb-table thead .rank, .lb-table thead .rider { z-index: 3; text-transform: uppercase; letter-spacing: .05em; }
.lb-table td.rank.p1 { color: var(--gold); }
.lb-table td.rank.p2 { color: #cfd6cf; }
.lb-table td.rank.p3 { color: #d09a62; }
.lb-col { display: block; width: 100%; border: 0; background: none; padding: 0; color: inherit; font: inherit; text-align: right; cursor: pointer; }
.lb-col span { display: block; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.lb-col small { display: block; color: var(--dim); font-size: 10px; font-weight: 500; }
.lb-col:hover span, th.hover .lb-col span { color: #fff; }
.lb-table th.sorted .lb-col span { color: var(--green); }
.lb-table th.sorted { box-shadow: inset 0 -2px 0 var(--green); }
.lb-table td.sorted { background: #131a13; }
.lb-table td.hover { background: #182018; }
.lb-table .col-route { border-right: 1px solid var(--line-2); font-weight: 700; }
.lb-table td.best { color: var(--gold); font-weight: 700; }
.lb-table .gap { display: block; color: var(--dim); font-size: 10px; font-weight: 500; }
.lb-table tr.me td { background: #10200f; }
.ap { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid var(--line-2); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 15px; vertical-align: 1px; }
.lb-foot { margin-top: 8px; font-size: 12px; }
.lb-foot:empty { display: none; }
@media (max-width: 860px) {
  .lb { max-height: none; }
  .mode-switch button { padding: 6px 13px; font-size: 13px; }
}

/* Overall board: points first, the rider's routes open under their row */
.game-tag { display: inline-block; margin-right: 4px; padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.rr-name { min-width: 0; border: 0; background: none; padding: 0; color: #fff; font: inherit; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-name:hover { color: var(--green); text-decoration: underline; }
@media (max-width: 860px) {
}
@media (max-width: 860px) {
  /* Narrow: rank, rider, points and records; a rider's routes say the rest. */
  .lb-table .c-routes, .lb-table .c-km, .lb-table .games { display: none; }
}

/* Leaderboards: the list takes the whole width, filters above it */
.lb-head-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.lb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.lb-filters .game-chips { flex-wrap: wrap; }
.game-chip.small { padding: 5px 12px; font-size: 13px; }
.lb-filters select { width: auto; min-width: 150px; max-width: 260px; padding: 6px 32px 6px 11px; font-size: 13px; }
.lb-table .rank ~ .rider { left: 34px; }
.lb-table .c-route { text-align: left; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.lb-table .c-route .rr-name { display: inline; color: #fff; }
.rr-name { border: 0; background: none; padding: 0; color: #fff; font: inherit; text-align: left; cursor: pointer; }
.rr-name:hover { color: var(--green); text-decoration: underline; }
.rec-star { margin-right: 6px; }
@media (max-width: 860px) {
  .lb-table .c-kmh, .lb-table .c-watts { display: none; }
  .lb-filters select { flex: 1 1 140px; max-width: none; min-width: 0; }
}
/* Route pictures: the line on a dark tile */
.lb-table .rank, .lb-table .rider, .lb-table .rank ~ .rider { position: static; }
.lb-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-table thead th.c-route { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.lb-sub { display: none; }
@media (max-width: 860px) {
  .lb-filters .game-chips { flex: 1 1 100%; }
  .lb-table .c-route, .lb-table .c-at { display: none; }
  .lb-table .rider { max-width: 190px; white-space: normal; }
  .lb-sub { display: block; margin-top: 2px; color: var(--dim); font-size: 11px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.btn.primary.long { font-size: 14px; letter-spacing: 0; padding-left: 10px; padding-right: 10px; white-space: nowrap; }
/* Gold medal feed (Leaderboards panel) */
.medal { flex: none; display: block; }
.rec-star { display: inline-block; vertical-align: -5px; margin-right: 6px; }
.rec-star .medal { width: 20px; height: 20px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: none; padding: 8px 6px; border-radius: 10px; color: var(--muted); font: inherit; font-size: 13px; line-height: 1.35; text-align: left; cursor: pointer; }
.feed-item:hover { background: var(--card-2); }
.feed-item .medal { margin-top: 1px; }
.feed-line b { color: #fff; font-weight: 600; }
.feed-meta { display: block; margin-top: 2px; color: var(--dim); font-size: 12px; }
@media (max-width: 860px) {
  .lb-head { flex-wrap: wrap; }
  .lb-title { flex: 1 1 100%; }
}
/* Leaderboard: the route's mini map and its elevation, under the title */
.lb-visual { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 12px; align-items: end; margin-bottom: 12px; }
.lb-visual.flat { grid-template-columns: minmax(0, 1fr); }
.lb-map { height: 180px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #070907; }
.lb-elev { margin: 0; }
.lb-elev .elev-plot { height: 100px; }
.lb-elev .elev-cp::before { height: 78px; }
@media (max-width: 860px) {
  .lb-visual { grid-template-columns: minmax(0, 1fr); }
  .lb-map { height: 170px; }
}
/* The filters come first; the title, map and ranking follow. */
.lb-filters { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
/* Filters button: segment, rider and steering fold out next to it */
.lb-more { display: contents; }
.lb-more-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; color: var(--muted); padding: 6px 11px; font-size: 13px; cursor: pointer; }
.lb-more-btn:hover, .lb-more-btn[aria-expanded='true'] { color: #fff; border-color: #485248; }
.lb-more-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green); color: #000; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
/* Map and elevation follow the ranking. */
.lb-visual { margin: 12px 0 0; }
.lb-visual { flex: none; }
/* The gold medal: its row bigger, bolder, gold */
.lb-table tr.first td { padding-top: 14px; padding-bottom: 14px; font-size: 18px; font-weight: 800; color: #fff; background: #1d1c12; border-bottom-color: #3a3418; }
.lb-table tr.first td.rank { color: var(--gold); font-size: 22px; }
.lb-table tr.first td.rider { color: var(--gold); }
.lb-table tr.first td.c-time { color: var(--gold); font-size: 20px; }
.lb-table tr.first .rec-star .medal { width: 28px; height: 28px; }
.lb-table tr.first .rec-star { vertical-align: -8px; margin-right: 8px; }
/* Map and elevation: quiet until the pointer is on them */
.lb-visual { opacity: .7; filter: saturate(.75); transition: opacity .2s, filter .2s; }
.lb-visual:hover, .lb-visual:focus-within { opacity: 1; filter: none; }
.lb-map { height: 190px; }
/* The route in 3D: drag turns it, hovering reads a point */
.lb-3d { position: relative; height: 190px; background: #0b0f0b; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; touch-action: none; cursor: grab; }
.lb-3d.turning { cursor: grabbing; }
.lb-3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lb-3d .elev-y.bottom { bottom: 4px; }
.lb-visual { align-items: stretch; }
.lb-elev { display: flex; flex-direction: column-reverse; }
.lb-elev .elev-head { margin: 6px 0 0; }
#lbMap:focus, #lbMap:focus-visible { outline: none; }
/* Leaderboard ⋯ menu: Copy link, Open route */
.lb-menu-wrap { position: relative; }
.lb-menu-btn { display: grid; place-items: center; width: 34px; height: 30px; border: 1px solid var(--line-2); border-radius: 9px; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.lb-menu-btn:hover, .lb-menu-btn[aria-expanded='true'] { color: #fff; border-color: #485248; }
.lb-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 1100; min-width: 160px; display: grid; padding: 4px; background: #0f130f; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }
.lb-menu button { border: 0; background: none; color: #fff; text-align: left; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.lb-menu button:hover, .lb-menu button:focus-visible { background: var(--card-2); outline: none; }
@media (max-width: 860px) {
  /* The ⋯ menu stays at the top right, next to the title. */
  .lb-head { flex-wrap: nowrap; }
  .lb-title { flex: 1 1 auto; min-width: 0; }
}

/* Account: the signed-in name in the header, with its menu */
.me-wrap { position: relative; }
.me-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--card); color: #fff; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; max-width: 200px; }
.me-btn:hover, .me-btn[aria-expanded='true'] { border-color: #485248; }
.me-initial { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #000; font-weight: 800; }
.me-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-menu { min-width: 200px; }
.me-email { padding: 6px 10px 8px; color: var(--dim); font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; }
.me-email:empty { display: none; }

/* Sign-in dialog */
#signin { width: min(400px, calc(100vw - 32px)); position: relative; }
#signin p { margin: 0 0 16px; }
.dialog-x { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.dialog-x:hover { color: #fff; background: var(--card-2); }
.signin-providers { display: grid; gap: 8px; }
.provider { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card-2); color: #fff; text-decoration: none; font-weight: 600; }
.provider:hover { border-color: #5a665a; background: #1c231c; }
.provider-mark { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.provider-mark.google { background: #fff; color: #4285f4; }
.provider-mark.discord { background: #5865f2; }
.provider-mark.strava { background: #fc4c02; }
.signin-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--dim); font-size: 12px; }
.signin-or::before, .signin-or::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.signin-email { display: flex; gap: 8px; }
.signin-email input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.signin-email .btn { flex: none; padding: 10px 14px; font-size: 14px; }
.signin-sent p { color: var(--muted); }
.signin-error { color: #ff7a7a; margin-top: 8px; }
.signin-error:empty { display: none; }

/* Create: save row, saved note, My routes */
.save-row { display: flex; gap: 8px; margin-top: 10px; }
.save-row .select-wrap { flex: 1; min-width: 0; }
.save-row select { padding: 9px 32px 9px 11px; font-size: 13px; }
.save-btn { flex: none; padding: 9px 22px; font-size: 15px; }
#bSaved { margin-top: 8px; }
#bSaved:empty { display: none; }
#bSaved a { color: var(--green); }
#bSaved .small-btn { margin-top: 6px; }
.my-routes { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.my-routes li { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 4px 2px 2px; }
.my-routes li.current { border-color: var(--green-line); background: var(--green-soft); }
.my-route { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center; border: 0; background: none; color: #fff; text-align: left; padding: 6px 8px; cursor: pointer; font: inherit; }
.my-route .game-tag { grid-row: 1 / span 2; }
.my-route-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.my-route-meta { color: var(--dim); font-size: 12px; }
#sharedCard .small-btn { margin-top: 10px; }
.me-menu .danger { color: #ff7a7a; border-top: 1px solid var(--line); border-radius: 0 0 7px 7px; margin-top: 4px; }
/* Waypoints are dragged to move them */
.leaflet-marker-draggable .wp-marker { cursor: grab; }
.leaflet-dragging .leaflet-marker-draggable .wp-marker { cursor: grabbing; }
/* Catalog mode (this machine only) */
.catalog-card { border-color: #5a4a1a; }
.catalog-card .badge { border-color: #8a6d1f; color: var(--gold); }
.catalog-card .select-wrap { margin-top: 10px; }
.field { display: grid; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--dim); }
.field input, .field textarea { background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; color: #fff; font: inherit; font-size: 14px; resize: vertical; }
.cp-names { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: cpn; }
.cp-names li { display: flex; align-items: center; gap: 8px; }
.cp-names li::before { counter-increment: cpn; content: counter(cpn); min-width: 20px; height: 20px; border-radius: 6px; background: #1b221b; color: var(--green); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.cp-names input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; font-size: 13px; }
#rdEdit { margin: 2px 0 8px; }
/* Catalog mode: routes that are not live yet, and the deploy */
.deploy-card { border-color: #5a4a1a; margin-bottom: 10px; }
.deploy-card.live { border-color: var(--line-2); }
.deploy-card .note.bad { color: #ff7a7a; }
.deploy-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.deploy-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.deploy-list button { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 2px 0; color: #fff; font: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-list button:disabled { cursor: default; color: var(--muted); }
.deploy-list .badge { flex: none; margin: 0; border-color: #8a6d1f; color: var(--gold); }
.deploy-code { margin-top: 10px; font-size: 13px; color: var(--muted); }
.deploy-code summary { cursor: pointer; }
.deploy-code ul { margin: 6px 0 0; padding-left: 18px; max-height: 140px; overflow: auto; font-size: 12px; color: var(--dim); word-break: break-all; }
.deploy-card .save-row { margin-top: 12px; }
.deploy-log { margin: 10px 0 0; max-height: 180px; overflow: auto; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font-size: 11px; line-height: 1.35; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.route-undeployed { color: var(--gold); }
/* Catalog mode: the Explore list can be reordered (grip), renamed (✎) and pruned (×) */
.route-row { display: flex; align-items: center; gap: 4px; border-radius: 12px; }
.route-row .route-item { flex: 1; min-width: 0; }
.route-row.dragging { opacity: .45; }
.route-row.drop-before { box-shadow: 0 -3px 0 var(--gold); }
.route-row.drop-after { box-shadow: 0 3px 0 var(--gold); }
.route-grip { flex: none; width: 18px; text-align: center; color: var(--dim); cursor: grab; font-size: 16px; user-select: none; }
.route-grip:hover { color: var(--gold); }
.route-admin { flex: none; display: flex; flex-direction: column; gap: 2px; }
.route-admin button { width: 26px; height: 24px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.route-admin button:hover { color: var(--gold); border-color: #8a6d1f; }
.route-admin button:last-child:hover { color: #ff7a7a; border-color: #4a2020; }
.route-rename { flex: 1; display: flex; gap: 6px; padding: 8px; border: 1px solid #8a6d1f; border-radius: 12px; background: var(--card); }
.route-rename input { flex: 1; min-width: 0; background: var(--card-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.route-deleted { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-2); }
.route-deleted-head { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 0 0 6px 22px; }
.route-deleted-row { display: flex; align-items: center; gap: 6px; padding: 4px 0 4px 22px; }
.route-deleted-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); text-decoration: line-through; text-decoration-color: var(--dim); font-size: 14px; }
.route-forget { flex: none; min-width: 26px; height: 24px; border: 1px solid var(--line-2); border-radius: 6px; background: none; color: var(--dim); cursor: pointer; font-size: 13px; padding: 0 6px; }
.route-forget:hover, .route-forget.armed { color: #ff7a7a; border-color: #4a2020; }
/* Route builder: handles to put a waypoint into the line (midpoint of each stretch; the one under the mouse) */
.wp-mid, .wp-ghost { width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box; cursor: grab; }
.wp-mid { background: rgba(0, 0, 0, .55); border: 2px solid rgba(0, 255, 87, .75); }
.wp-mid:hover, .wp-ghost { background: #fff; border: 2px solid var(--green); box-shadow: 0 0 0 2px rgba(0, 0, 0, .6); }
.build-hit { cursor: copy; }
.leaflet-dragging .wp-mid, .leaflet-dragging .wp-ghost { cursor: grabbing; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--green); text-decoration: underline; cursor: pointer; }
