/* The web map's features (explore.js; 2026-12-04): the panel's Rides, Routes and Saved tabs, My rig, the path card's
   new sections, the results box (How far, a GPX's score), ride mode, the embed. Built on the page's own tokens and
   parts (page_template.html: .res, .figs, .btn, .chip, .cardnote), so the light and dark themes carry over. The
   desktop sizes follow the page's "a size down" block (a mouse, 761px and wider); phones keep 44px to tap. */

/* ---- the panel's tabs ---- */
.xnav { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.xnav button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 6px; border: 0;
  border-radius: 8px; background: transparent; color: var(--muted); font: 600 13px var(--f-ui); white-space: nowrap; cursor: pointer; }
.xnav button:hover { color: var(--ink); }
.xnav button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-seg); }
.xnav svg { flex: none; }
.panel.collapsed .xnav, .panel.view-search .xnav, .view-search .xnav { display: none; }

/* ---- a pane ---- */
.pbody > .xpane { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.xhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.xhead h2 { font-family: var(--f-display); font-size: 17px; font-weight: 800; letter-spacing: -0.015em; }
.xrow { display: flex; align-items: center; gap: 10px; }
.xlab { flex: none; width: 52px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.xchips { display: flex; flex-wrap: wrap; gap: 6px; }
.xpane .chip, .xrig .chip, .xbox .chip, .xhead .chip { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink); font: 500 13px var(--f-ui); white-space: nowrap; cursor: pointer; flex: none; }
.xpane .chip:hover, .xrig .chip:hover, .xbox .chip:hover { border-color: var(--ink); }
.xpane .chip[aria-pressed="true"], .xrig .chip[aria-pressed="true"], .xbox .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.xlist { display: flex; flex-direction: column; gap: 2px; margin: 0 -8px; }
.xlist:empty { display: none; }
.xres { text-align: left; color: var(--ink); font: inherit; cursor: pointer; }
.xres .k { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.xres .k small { font: 500 11px var(--f-ui); color: var(--muted); }
.xwait { margin: 0; padding: 6px 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.xlist .xwait { padding: 6px 8px; }
.xfilter { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.xfilter input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink); font: 14px var(--f-ui); outline: none; }
.xfilter:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.xtool { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: var(--surface-3); }
.xtool h3 { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-size: 14.5px; font-weight: 700; }
.xfile { position: relative; cursor: pointer; }
.xfile input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.xsaved { display: flex; align-items: center; gap: 2px; }
.xsaved .xres { flex: 1; min-width: 0; }
.xsavedacts { display: flex; gap: 2px; }
.xwx { font-size: 12px; color: var(--text-2); }
.xwx:empty { display: none; }

/* the surface ribbon (a network's mix of surfaces) and the share-car-free bar */
.xrib { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 4px; background: var(--rule); gap: 1px; }
.xrib.big { height: 8px; border-radius: 4px; margin: 0; }
.xbar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 4px; background: color-mix(in srgb, var(--g-missing) 30%, var(--rule)); }
.xbar > span { background: var(--g-found); }
.xbar > span.tr { background: var(--x-unverified); }
.xbar.big { height: 10px; border-radius: 5px; margin: 0; }

/* My rig, in the layers */
.xrig { gap: 8px; }
.xrig .grphead { cursor: default; }
.xrig output { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent); border-radius: 6px; padding: 2px 8px; }
.xrig output:empty { display: none; }

/* ---- the path card ---- */
@media (min-width: 761px) { .pathcard { max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; } }
.xsubhead { margin: -6px 0 0; font-size: 14px; color: var(--text-2); }
.xsub { margin: 6px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.xtools { display: flex; gap: 4px; margin: 0 -4px; }
.xtb { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 2px 6px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font: 600 11.5px var(--f-ui); cursor: pointer; white-space: nowrap; }
.xtb:hover { background: var(--surface-2); }
.xtb[aria-pressed="true"] { color: var(--accent); }
.xtb[aria-pressed="true"] svg { fill: currentColor; }
.xtb:disabled { opacity: 0.5; cursor: progress; }
.xrigline { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-3); font-size: 13px; line-height: 1.4; }
.xsec { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.xsec[hidden] { display: none; }
.xsec h3 { font-family: var(--f-display); font-size: 15px; font-weight: 700; }
.xsec p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.xsec .cardnote { font-size: 12px; }
.xbadges { display: flex; flex-wrap: wrap; gap: 6px; }
.xbadge-flat { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--g-found); color: #fff;
  font-size: 12px; font-weight: 700; }
.xprof { display: block; width: 100%; height: 46px; }
.xprof .f { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.xprof .l { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.xprofax { display: flex; justify-content: space-between; margin-top: -4px; font-size: 11px; color: var(--muted); }
.xess { display: flex; flex-wrap: wrap; gap: 6px; }
.xess > span { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 4px; border-radius: 999px; background: var(--surface-2);
  font-size: 12.5px; font-weight: 500; }
.xess b { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 9px;
  color: #fff; font-size: 9.5px; font-weight: 800; box-sizing: border-box; background: #555; }
.xpoi-parking b { background: #2b6cb0; } .xpoi-toilets b { background: #6b46c1; } .xpoi-water b { background: #0b7dda; }
.xpoi-shop b, .xpoi-rental b { background: #c05621; } .xpoi-play b { background: #2f855a; } .xpoi-station b { background: #2d3748; }
.xdrive { display: flex; gap: 8px; align-items: flex-start; }
.xdrive svg { flex: none; margin-top: 2px; color: var(--muted); }
.xends { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.45; }
.xpaths { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.xpaths li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: 13.5px; }
.xpaths li:last-child { border-bottom: 0; }
.xpaths li span:last-child { flex: none; font-weight: 600; }
.xnetname { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--gold-ink); }
.xlines { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.xlines a { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; color: var(--ink); }
.xnote { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.xnote textarea, .xembed textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 14px/1.4 var(--f-ui); resize: vertical; }
.xnote textarea:focus, .xembed textarea:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* ---- the results box over the map: How far, a GPX's score ---- */
.xbox { position: absolute; z-index: 6; top: 16px; right: 16px; width: 320px; max-height: calc(100% - 200px); overflow-y: auto; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.xbox[hidden] { display: none; }
.xboxhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.xboxhead h2 { font-family: var(--f-display); font-size: 18px; font-weight: 800; letter-spacing: -0.015em; }
.xbox .roundbtn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 16px;
  background: var(--surface-2); color: var(--ink); padding: 0; flex: none; cursor: pointer; }
.xbox p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.xbig { font-family: var(--f-display); font-size: 15px; }
.xbig strong { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; margin-right: 4px; }
.xreachfigs { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.xreachfigs > div { border-top: 4px solid; }
.xreachfigs .b1 { border-color: #1a9e6f; } .xreachfigs .b2 { border-color: #e8a317; } .xreachfigs .b3 { border-color: #d2442a; }
body.card-open .xbox { top: auto; bottom: 16px; right: 72px; }

/* ---- ride mode ---- */
.xride { position: fixed; z-index: 9; top: 12px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 24px)); box-sizing: border-box;
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); }
.xride[hidden] { display: none; }
.xridetop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.xridetop .btn { flex: none; height: 36px; font-size: 13px; }
.xridename { font-family: var(--f-display); font-weight: 800; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xridemain p { margin: 0; }
.xridestate { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.xridestate.on { color: var(--g-found); } .xridestate.off { color: var(--g-missing); }
.xridebig { font-family: var(--f-display); font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.xridesub { font-size: 18px; font-weight: 600; color: var(--text-2); min-height: 1.3em; }
.xridewarn { margin: 0; font-size: 11.5px; color: var(--muted); }
body.riding .panel, body.riding .mapkey { display: none; }

/* ---- a note at the foot of the screen ---- */
.xtoast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(420px, calc(100% - 32px)); box-sizing: border-box;
  padding: 10px 16px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow-ctrl); }
.xtoast[hidden] { display: none; }

/* ---- the map's long press ---- */
.xpop .maplibregl-popup-content { padding: 6px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); }
.xpop .maplibregl-popup-tip { display: none; }
.xpopbtn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font: 600 13px var(--f-ui); text-align: left; cursor: pointer; }
.xpopbtn:hover { background: var(--surface-2); }

/* ---- the share box's embed code ---- */
.xembed summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink); }
.xembed[open] { display: flex; flex-direction: column; gap: 8px; }
.xembed textarea { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- the embedded map (/embed): the map, its key, its credits and a way back, nothing else ---- */
html.embed .panel, html.embed .sharebox, html.embed .ctlbtn.layersfab, html.embed .pathcard .acts { display: none !important; }
.xbadge { position: absolute; z-index: 6; bottom: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px 0 7px;
  border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-ctrl); font: 700 13px var(--f-display); text-decoration: none; }
.xbadge:hover { color: var(--accent); }

/* ---- desktop, a size down (the page's own block) ---- */
@media (min-width: 761px) and (pointer: fine) {
  .xnav button { height: 28px; font-size: 12px; padding: 0 4px; }
  .xnav svg { display: none; }
  .xrow { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pbody > .xpane { gap: 12px; }
  .xhead h2 { font-size: 15px; }
  .xlab { font-size: 11.5px; width: 46px; }
  .xpane .chip, .xrig .chip, .xbox .chip, .xhead .chip { height: 26px; padding: 0 10px; font-size: 12px; gap: 5px; }
  .xpane .chip svg, .xhead .chip svg { width: 13px; height: 13px; }
  .xlist { margin: 0 -6px; }
  .xfilter { height: 32px; border-radius: 9px; }
  .xfilter input { font-size: 13px; }
  .xtool { padding: 10px 12px; border-radius: 10px; gap: 6px; }
  .xtool h3 { font-size: 13.5px; }
  .xtb { font-size: 10.5px; padding: 6px 2px 5px; gap: 3px; }
  .xtb svg { width: 16px; height: 16px; }
  .xsec { gap: 6px; padding-top: 10px; }
  .xsec h3 { font-size: 13.5px; }
  .xsec p, .xends, .xpaths li { font-size: 12.5px; }
  .xsubhead, .xsub, .xrigline { font-size: 12.5px; }
  .xess > span { height: 22px; font-size: 11.5px; }
  .xbox { top: 12px; right: 12px; width: 288px; padding: 14px; border-radius: 14px; gap: 10px; }
  .xboxhead h2 { font-size: 15.5px; }
  .xbox p { font-size: 12.5px; }
  body.card-open .xbox { bottom: 12px; right: 58px; }
}

/* ---- phones: the tabs live in the open sheet; the box and ride mode sit at the top, over the map ---- */
@media (max-width: 760px) {
  .panel:not(.collapsed) .xnav { margin-top: 8px; }
  .xnav button { height: 40px; font-size: 14px; }
  .xpane .chip, .xrig .chip, .xbox .chip, .xhead .chip { height: 40px; padding: 0 14px; font-size: 14px; }
  .xlab { width: auto; font-size: 13px; }
  .xrow { flex-direction: column; align-items: flex-start; gap: 6px; }
  .xlist { margin: 0; gap: 0; }
  .xfilter { height: 44px; }
  .xfilter input { font-size: 16px; }
  .xtb { font-size: 12px; padding: 8px 2px; }
  .xsec .figs, .xbox .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .xbox, body.card-open .xbox { top: calc(12px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; bottom: auto; width: auto; max-height: 55vh; z-index: 8; border-radius: 18px; }
  .xbox .roundbtn { width: 40px; height: 40px; border-radius: 20px; }
  .xnote textarea, .xembed textarea { font-size: 16px; }
  .xride { top: calc(10px + env(safe-area-inset-top, 0px)); }
  .xridebig { font-size: 44px; }
  .xtoast { bottom: calc(var(--sheet-h, 120px) + 16px); }
  html.embed .mapkey { display: grid; }
  html.embed .mapctl { bottom: 12px; }
}
