/* BC Trail Conditions alpha. Look carried over from prototype v2 (colour tokens, fonts, blocks, collapsible sections). */
:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --ink: #18241f;
  --muted: #56655e;
  --line: #d3ddd8;
  --accent: #1d6670;
  --accent-ink: #ffffff;
  --snow: #c9dcea;
  --trail: #1d6670;
  --info: #3d5a80;
  --info-ink: #ffffff;
  --warn: #8f5509;
  --warn-bg: #fbf1e2;
  --alert: #a63a29;
  --sample: #5d6180;
  --pro: #4b3f8f;
  --pro-ink: #ffffff;
  --frame: #c9d3ce;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --top-h: 52px;
  --tab-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1614; --surface: #17211e; --surface-2: #1d2925; --ink: #e4ece8; --muted: #a3b3ac; --line: #2e3d38;
    --accent: #5fb3bd; --accent-ink: #0f1614; --snow: #3c5468; --trail: #5fb3bd;
    --info: #a9c1e0; --info-ink: #0f1614; --warn: #e6ae57; --warn-bg: #2b2418; --alert: #ee8673;
    --sample: #b4b8d4; --pro: #b9adf2; --pro-ink: #141026; --frame: #050807;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--frame); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- app frame ---------- */
.app {
  position: relative; width: 100%; height: 100vh; height: 100dvh; margin: 0 auto;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden; background: var(--bg);
}
.topbar {
  display: flex; align-items: center; gap: 8px; min-height: var(--top-h);
  padding: calc(env(safe-area-inset-top) + 6px) calc(env(safe-area-inset-right) + 10px) 6px calc(env(safe-area-inset-left) + 14px);
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5;
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1; letter-spacing: .01em;
  text-transform: uppercase; margin: 0; flex: 1; min-width: 0; text-wrap: balance; }
.brand span { color: var(--accent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; cursor: pointer; color: var(--ink); flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px; border: 1px solid currentColor; white-space: nowrap; line-height: 1.35;
}
.tag.sample { color: var(--sample); }
.tag.hc { color: var(--accent); }
.tag.ltd { color: var(--sample); border-style: dashed; }
.tag.unv { color: var(--warn); font-size: 10.5px; padding: 0 5px; }
.tag.pro { color: var(--pro); }
.tag.free { color: var(--info); }
.tag.solid { background: var(--pro); color: var(--pro-ink); border-color: var(--pro); }

.views { position: relative; overflow: hidden; min-height: 0; }
.view { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { padding: 14px calc(env(safe-area-inset-right) + 14px) 28px calc(env(safe-area-inset-left) + 14px); display: grid; gap: 14px; align-content: start; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.05; text-transform: uppercase; margin: 2px 0 0; }
.lede { margin: 0; color: var(--muted); }

/* ---------- tab bar ---------- */
.tabbar {
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); z-index: 5;
}
.tab {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tab-h);
  border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 6px 0;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] .tab-ico { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tab .pv { font-size: 10.5px; font-weight: 700; background: var(--pro); color: var(--pro-ink); border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.tab-ico { display: grid; place-items: center; width: 52px; height: 28px; border-radius: 14px; }

/* ---------- map (MapLibre, real tiles) ---------- */
.view-map { overflow: hidden; background: #dcdbd3; }
.map { position: absolute; inset: 0; }
.map:focus-visible { outline-offset: -4px; }
.map-ph {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; padding: 24px; text-align: center;
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, var(--bg) 14px 28px); color: var(--ink);
}
.map-ph p { margin: 0; max-width: 34ch; justify-self: center; }
.map-ph .ph-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; text-transform: uppercase; }
.region-sw {
  position: absolute; z-index: 3; top: 8px; left: 8px; right: 64px; display: flex; gap: 0; justify-content: flex-start;
  pointer-events: none;
}
.region-sw .seg { display: inline-flex; pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.16); overflow: hidden; max-width: 100%; }
.region-sw button { border: 0; background: none; min-height: 44px; padding: 4px 12px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink); line-height: 1.15; }
.region-sw button + button { border-left: 1px solid var(--line); }
.region-sw button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.map-btn {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.16);
}
.map-btn svg { width: 20px; height: 20px; }
.layers-btn { top: 8px; right: 8px; padding: 0; width: 46px; justify-content: center; }
.layers-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--pro); }
.map-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; gap: 6px; pointer-events: none; }
.map-foot > * { pointer-events: auto; }
.map-legend summary { font-weight: 700; cursor: pointer; padding: 2px 0; font-size: 12.5px; min-height: 24px; }
.map-legend[open] summary { margin-bottom: 2px; }
.map-legend #mapLegend { display: grid; gap: 2px; }
.map-legend {
  justify-self: start; margin-left: 8px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; font-size: 12px; line-height: 1.25; display: grid; gap: 2px;
  max-width: calc(100% - 16px); box-shadow: 0 1px 5px rgba(0,0,0,.12);
}
.map-legend .lg { display: flex; align-items: center; gap: 7px; }
.map-legend svg { flex: none; }
.map-legend .ov { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; display: grid; gap: 3px; }
.map-legend .note { color: var(--muted); font-size: 11.5px; }
.sw { display: inline-block; width: 16px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); }
.map-credit {
  margin: 0; padding: 4px 8px calc(4px + 0px); font-size: 11px; line-height: 1.3;
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
}
.map-msg { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 4; margin: 0; max-width: calc(100% - 24px);
  font-weight: 600; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--warn); border-left-width: 4px;
  border-radius: 10px; padding: 6px 12px; box-shadow: 0 2px 8px rgba(0,0,0,.16); }
/* MapLibre controls: keep them clear of our buttons and inside safe areas */
.map .maplibregl-ctrl-top-right { top: 58px; right: calc(env(safe-area-inset-right) + 0px); }
.map .maplibregl-ctrl-group button { width: 44px; height: 44px; }
.map .maplibregl-ctrl-bottom-right { bottom: var(--credit-h, 44px); }
.map .maplibregl-ctrl-top-left { top: 58px; }
.map .maplibregl-ctrl-attrib { font-size: 11px; }
.map .maplibregl-ctrl-attrib a { color: #1d3f45; }
/* trail markers (HTML markers, so they are real buttons for keyboard and screen readers) */
.tmk { position: relative; width: 0; height: 0; }
.tmk .dot { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff;
  background: #0e5560; box-shadow: 0 1px 4px rgba(0,0,0,.4); padding: 0; cursor: pointer; }
.tmk .dot.warn { background: #8f5509; }
.tmk .dot.closure { background: #a63a29; }
.tmk .dot.approx { border-style: dashed; }
.tmk.sel .dot { outline: 3px solid #111; outline-offset: 1px; }
.tmk .lbls { position: absolute; left: 14px; top: -14px; display: grid; gap: 3px; width: max-content; max-width: 210px; }
.tmk.left .lbls { left: auto; right: 14px; }
.tmk .lbl { display: grid; text-align: left; border: 1px solid rgba(0,0,0,.25); background: rgba(255,255,255,.95); color: #0b3d44; border-radius: 7px;
  padding: 2px 7px 3px; font: inherit; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tmk .lbl .n { font-size: 13px; font-weight: 700; line-height: 1.2; }
.tmk .lbl .s { font-size: 11.5px; font-weight: 600; color: #24323a; line-height: 1.25; }
.tmk .lbl .s.warn { color: #8f5509; }
.tmk .lbl .s.closure { color: #a63a29; }
.tmk .lbl.sel { outline: 3px solid #111; }
.map.lo-zoom .tmk .lbls { display: none; }
.hlpt { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #d23f8a; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }

/* ---------- blocks (trail conditions) ---------- */
.blk { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 8px; }
.blk-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.blk h3, .h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: .03em; margin: 0; line-height: 1.15; }
.blk p { margin: 0; }
.src { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.src a { white-space: nowrap; }
.sev { font-weight: 700; }
.sev.warn { color: var(--warn); }
.sev.info { color: var(--info); }
.stale {
  display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--warn); border-left-width: 5px; border-radius: 8px;
  background: var(--warn-bg); padding: 7px 10px; font-size: 14px; font-weight: 600;
}
.stale svg { flex: none; width: 18px; height: 18px; color: var(--warn); margin-top: 1px; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--info); color: var(--info-ink); white-space: nowrap; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14.5px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.notes { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--warn); color: var(--warn); background: var(--warn-bg); }
.chip.none { border-color: var(--line); color: var(--muted); background: var(--surface-2); font-weight: 600; }
.kv { display: grid; gap: 2px; }
.kv b { font-weight: 700; }
.ph { border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.linkbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--accent); color: var(--accent); background: var(--surface); text-decoration: none; font-weight: 700; cursor: pointer; text-align: center;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 10px;
  border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn.pro { background: var(--pro); color: var(--pro-ink); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--surface); color: var(--alert); border: 1px solid var(--alert); }
.btn svg, .linkbtn svg { width: 18px; height: 18px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* round 2 additions */
.blk-head .tags { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.locked { display: grid; }
.locked .stub { position: absolute; inset: 0; }
.locked .locked-over { position: relative; inset: auto; padding: 14px 12px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); white-space: normal; }
.estline { font-size: 14.5px; }
.flaglist, .acc { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14.5px; }
.flaglist li, .acc li { display: flex; gap: 6px; align-items: flex-start; }
.flaglist li { color: var(--warn); font-weight: 700; }
.flaglist svg, .acc svg { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--warn); }
.acc li.warn span { font-weight: 600; }
.acc li:not(.warn) span { padding-left: 22px; }
.h4 { font-weight: 700; margin: 2px 0 0; font-size: 15px; }
.small { font-size: 14px; }
.replist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.replist li { display: grid; gap: 3px; border-left: 3px solid var(--line); padding-left: 8px; font-size: 14.5px; }
.replist .rdate { font-weight: 700; }
.tag.avy { color: var(--warn); }
.tag.avy.ltdavy { border-style: dashed; }
.tag.estbtn { background: var(--surface); color: var(--ink); cursor: pointer; min-height: 32px; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.explain { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 8px 10px; display: grid; gap: 6px; font-size: 14px; }
.elev-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--snow) 55%, transparent); border-left: 1px dashed var(--accent); }
.inline-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.panel-foot { font-size: 13px; color: var(--muted); display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.panel-foot p { margin: 0; }
details.newbc summary { cursor: pointer; display: flex; gap: 8px; align-items: center; min-height: 32px; list-style-position: inside; }
details.newbc[open] summary { margin-bottom: 6px; }

/* round 4: collapsible blocks */
.cblk { padding: 0; gap: 0; }
.cblk.flag.is-closed { border-left: 5px solid var(--warn); }
.cb-h { margin: 0; }
.cb-btn {
  display: grid; gap: 3px; width: 100%; min-height: 48px; padding: 11px 12px; margin: 0; border: 0; border-radius: 10px;
  background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; text-transform: inherit; letter-spacing: inherit;
}
.cb-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.cb-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cb-chev { flex: none; width: 22px; height: 22px; color: var(--muted); transition: transform .15s ease; }
.cb-btn[aria-expanded="true"] .cb-chev { transform: rotate(180deg); }
.cb-sum { font-family: var(--font-body); font-size: 14.5px; font-weight: 400; text-transform: none; letter-spacing: 0; line-height: 1.35; color: var(--muted); }
.cb-btn[aria-expanded="true"] .cb-sum { display: none; }
.cb-warn svg { width: 16px; height: 16px; color: var(--warn); vertical-align: -3px; margin-right: 4px; }
.cb-sum .cb-wtxt { color: var(--ink); font-weight: 600; }
.cb-stale { display: inline-block; margin-left: 6px; font-size: 12.5px; font-weight: 700; color: var(--warn); background: var(--warn-bg);
  border: 1px solid var(--warn); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.cb-body { display: grid; gap: 8px; padding: 0 12px 12px; }
.cb-body[hidden] { display: none; }
.cb-tags { justify-content: flex-start; }
.cb-all { display: flex; justify-content: flex-end; gap: 8px; }
.cb-all .btn { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.slope-key { display: grid; grid-template-columns: repeat(3, auto); gap: 2px 8px; justify-content: start; font-size: 11.5px; }
.slope-key span { display: inline-flex; gap: 4px; align-items: center; }
.tr-status.warn { color: var(--warn); display: flex; gap: 5px; align-items: flex-start; }
.tr-status svg { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.trow .tr-snow { font-size: 14px; }
.trow .tr-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.field select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--muted); border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 44px; }
.field input[type="text"] { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--muted); border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 44px; }
.confirm:focus { outline: 3px solid var(--accent); }

/* elevation bar (v1) */
.elev { display: grid; gap: 4px; }
.elev-track { position: relative; height: 18px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.elev-snow { position: absolute; top: 0; bottom: 0; right: 0; background: repeating-linear-gradient(135deg, var(--snow) 0 6px, transparent 6px 10px); border-left: 2px dashed var(--accent); }
.elev-trail { position: absolute; top: 5px; bottom: 5px; border-radius: 3px; background: var(--trail); }
.elev-trail.unv { background: repeating-linear-gradient(90deg, var(--trail) 0 5px, transparent 5px 8px); }
.elev-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* locked Pro preview */
.locked { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.stub { padding: 12px; display: grid; gap: 8px; filter: blur(2.5px); opacity: .7; }
.stub i { display: block; height: 10px; border-radius: 5px; background: var(--line); }
.stub .ph-row { display: flex; gap: 6px; }
.stub .ph-row i { width: 64px; height: 44px; border-radius: 6px; }
.locked-over { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; padding: 10px;
  background: color-mix(in srgb, var(--surface) 55%, transparent); }
.locked-over p { margin: 0; font-size: 13.5px; color: var(--ink); max-width: 30ch; }
.locked-over b { font-size: 15px; display: inline-flex; gap: 5px; align-items: center; }
.locked-over svg { width: 16px; height: 16px; }

/* ad */
.ad { border: 1px dashed var(--muted); border-radius: 10px; padding: 10px 12px; background: var(--bg); display: grid; gap: 4px; font-size: 13.5px; color: var(--muted); }
.ad .ad-label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--ink); border-radius: 3px; padding: 0 5px; justify-self: start; }
.ad .ad-box { height: 52px; border-radius: 6px; background: repeating-linear-gradient(45deg, var(--surface-2) 0 8px, var(--surface) 8px 16px); display: grid; place-items: center; font-weight: 600; }
.sep-label { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 -6px; }

/* ---------- sheet ---------- */
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; height: 52%;
  background: var(--bg); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.22);
  display: grid; grid-template-rows: auto 1fr; overflow: hidden; transition: height .22s ease;
}
.sheet.dragging { transition: none; }
.sheet-head { background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 8px 8px 14px; touch-action: none; cursor: grab; }
.grab { display: block; width: 100%; height: 22px; border: 0; background: none; cursor: grab; padding: 0; position: relative; }
.grab::before { content: ""; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--line); }
.sheet-title-row { display: flex; align-items: flex-start; gap: 4px; }
.sheet-title-wrap { flex: 1; min-width: 0; display: grid; gap: 3px; }
.sheet-title { font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.05; text-transform: uppercase; margin: 0; outline: none; }
.sheet-sub { font-size: 13.5px; color: var(--muted); margin: 0; }
.sheet-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sample-flag { color: var(--surface); background: var(--sample); border-color: var(--sample); }
.sheet-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; padding: 12px calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 24px) calc(env(safe-area-inset-left) + 12px); display: grid; gap: 12px; align-content: start; overscroll-behavior: contain; }
.star[aria-pressed="true"] { color: #b7791f; }
.star[aria-pressed="true"] svg path { fill: currentColor; }
.ltd-panel { border: 2px dashed var(--sample); border-radius: 10px; padding: 10px 12px; background: var(--surface); display: grid; gap: 6px; }
.ltd-panel h3 { color: var(--sample); }

/* layers sheet */
.layer-list { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.layer-list legend { padding: 0; margin-bottom: 4px; }
.layer {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; min-height: 60px;
}
.layer.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.layer .thumb { width: 52px; height: 40px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); }
.layer .ttl { font-weight: 700; display: block; }
.layer .cr { font-size: 12.5px; color: var(--muted); display: block; line-height: 1.3; }
.layer .warnline { font-size: 12.5px; color: var(--warn); font-weight: 700; display: block; }
.layer .state svg { width: 20px; height: 20px; }
.layer input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }

/* list */
.search { display: grid; gap: 4px; }
.search input { font: inherit; width: 100%; min-height: 46px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--muted); background: var(--surface); color: var(--ink); }
.list-sec { display: grid; gap: 8px; }
.list-sec h3 { font-family: var(--font-display); font-weight: 600; font-size: 18px; text-transform: uppercase; letter-spacing: .03em; margin: 4px 0 0; }
.trow {
  display: grid; gap: 4px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-left: 5px solid var(--accent); border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.trow.rs { border-left: 5px dashed var(--sample); }
.trow:hover { border-color: var(--accent); }
.trow .tr-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.trow .tr-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; text-transform: uppercase; line-height: 1.05; }
.trow .tr-park { font-size: 13.5px; color: var(--muted); }
.trow .tr-status { font-size: 14.5px; font-weight: 600; }
.trow .tr-age { font-size: 13px; color: var(--muted); }
.trow .tr-flag { font-size: 13.5px; color: var(--warn); font-weight: 700; }
.empty { color: var(--muted); }

/* forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; }
.field > label, .field > .lbl, fieldset.field legend { font-weight: 700; font-size: 15px; padding: 0; }
.field .hint { font-size: 13px; color: var(--muted); }
.field input[type="date"], .field input[type="number"], .field textarea, .field input[type="file"] {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--muted); border-radius: 8px; padding: 9px 10px; width: 100%; min-height: 44px;
}
.field textarea { min-height: 84px; resize: vertical; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-size: 15px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; cursor: pointer; background: var(--surface); min-height: 44px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.msg { border-radius: 8px; padding: 9px 12px; font-weight: 600; font-size: 14.5px; }
.msg.ok { background: var(--surface); border: 1px solid var(--info); border-left-width: 5px; }
.msg.err { background: var(--warn-bg); border: 1px solid var(--warn); border-left-width: 5px; }
.msg:empty { display: none; }

/* favourites / pro */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.signin-btns { display: grid; gap: 10px; }
.signin-btns .btn { width: 100%; }
.proto-note { font-size: 13.5px; color: var(--muted); border-left: 3px solid var(--sample); padding-left: 8px; margin: 0; }
.free-box { border: 2px solid var(--info); border-radius: 12px; padding: 12px 14px; background: var(--surface); font-weight: 600; display: grid; gap: 4px; }
.free-box .big { font-size: 17px; line-height: 1.35; }
.plan-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.plan-list li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; }
.plan-list svg { width: 24px; height: 24px; color: var(--pro); }
.plan-list b { display: block; }
.plan-list span { color: var(--muted); font-size: 14px; }
.price { font-family: var(--font-display); font-size: 26px; font-weight: 700; text-transform: uppercase; margin: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 15px; border: 1px solid var(--muted); background: var(--surface-2); cursor: pointer; flex: none; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--pro); border-color: var(--pro); }
.switch[aria-checked="true"]::after { left: 25px; background: var(--pro-ink); }
.fav-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.foot { font-size: 13px; color: var(--muted); display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.foot p { margin: 0; }
.about p, .about li { font-size: 15px; }
.about h3 { margin-top: 4px; }
.about ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }


/* ---------- alpha additions ---------- */
.pill.closure { background: var(--warn-bg); color: var(--alert); border: 1px solid var(--alert); white-space: normal; }
.pill.snow, .pill.info { white-space: normal; }
.tr-status.closure { color: var(--alert); display: flex; gap: 5px; align-items: flex-start; }
.acc li.closure { color: var(--alert); }
.acc li.closure svg { color: var(--alert); }
.sheet { height: 60%; }
.sheet-body > .msg { margin: 0; }
.alpha-note { font-size: 13.5px; color: var(--muted); border-left: 3px solid var(--sample); padding-left: 8px; margin: 0; }
.evlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.evlist li { display: grid; gap: 2px; border-left: 3px solid var(--line); padding-left: 8px; font-size: 14.5px; }
.evlist li.warn { border-left-color: var(--warn); }
.evlist li.closure { border-left-color: var(--alert); }
.evlist .meta { font-size: 13px; color: var(--muted); }
.list-region { display: grid; gap: 8px; }
.loading { color: var(--muted); }

/* elevation profile */
.prof { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 8px; display: grid; gap: 6px; }
.prof-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.prof-head h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.prof-read { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1.4em; }
.prof-svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; border-radius: 6px; }
.prof-svg:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.prof-svg .ax { stroke: var(--line); stroke-width: 1; }
.prof-svg .axt { fill: var(--muted); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.prof-svg .area { fill: color-mix(in srgb, var(--muted) 16%, transparent); }
.prof-svg .ln { fill: none; stroke: var(--trail); stroke-width: 2.4; stroke-linejoin: round; }
.prof-svg .band { fill: color-mix(in srgb, var(--snow) 60%, transparent); }
.prof-svg .bandh { pointer-events: none; }
.prof-svg .hatch { stroke: var(--accent); stroke-width: 1.2; opacity: .35; }
.prof-svg .bandedge { stroke: var(--accent); stroke-width: 1.2; stroke-dasharray: 4 3; }
.prof-svg .bandt { fill: var(--ink); font-size: 11.5px; font-weight: 700; font-family: var(--font-body); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.prof-svg .mk { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.prof-svg .mkt { fill: var(--ink); font-size: 11.5px; font-weight: 700; font-family: var(--font-body); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.prof-svg .cur { stroke: #d23f8a; stroke-width: 1.6; }
.prof-svg .curpt { fill: #fff; stroke: #d23f8a; stroke-width: 3; }
.prof table { border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; width: 100%; }
.prof th, .prof td { text-align: right; padding: 2px 8px; border-bottom: 1px solid var(--line); }
.prof th:first-child, .prof td:first-child { text-align: left; }
.prof details summary { cursor: pointer; font-size: 14px; font-weight: 600; min-height: 32px; display: flex; align-items: center; }

/* desktop: map fills the window, trail panel docks on the left */
@media (min-width: 900px) {
  .app { max-width: none; }
  .sheet { left: 0; right: auto; top: 0; bottom: 0; width: 440px; height: 100% !important; border-radius: 0; box-shadow: 4px 0 18px rgba(0,0,0,.18); }
  .sheet .grab { display: none; }
  .sheet #sizeBtn { display: none; }
  .page { max-width: 760px; margin: 0 auto; width: 100%; }
  .app.sheet-open .region-sw { left: 452px; }
  .app.sheet-open .map-legend { margin-left: 452px; }
  .app.sheet-open .map-credit { padding-left: 452px; }
  .app.sheet-open .map .maplibregl-ctrl-top-left { left: 444px; }
}

/* alpha: snowline key under the profile, open-ended band, closure blocks */
.prof-key { display: flex; align-items: center; gap: 6px; margin: 0; }
.key-band { display: inline-block; width: 18px; height: 10px; flex: none; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent) 35%, transparent) 0 1.2px, transparent 1.2px 4px), color-mix(in srgb, var(--snow) 60%, transparent); border-top: 1.5px dashed var(--accent); border-bottom: 1.5px dashed var(--accent); }
.prof-svg .band.open { fill: color-mix(in srgb, var(--snow) 55%, transparent); }
.cblk.closure { border-left: 4px solid var(--alert); }
.prof-none { border-style: dashed; }

/* list region switcher */
.list-seg { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 4px 0 2px; }
.list-seg button { flex: 1 1 auto; border: 0; background: none; min-height: 44px; padding: 4px 10px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--ink); line-height: 1.15; }
.list-seg button + button { border-left: 1px solid var(--line); }
.list-seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.list-seg button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Critic C1 R4 (2026-11-18): no string, however long, may widen the panel or list on a phone. */
.sheet-body > *, .cblk, .cb-body, .cb-btn, .cb-sum { min-width: 0; max-width: 100%; }
.sheet-body p, .sheet-body li, .sheet-body dd, .sheet-body dt, .src, .stale, .cb-sum, .cb-title, .pill, .tag,
.trow, .tr-status, .tr-flag, .tr-snow, .tr-age, .map-credit, .foot p { overflow-wrap: anywhere; word-break: normal; }
.src a { white-space: normal; }
.pill { white-space: normal; max-width: 100%; }
