/* SideMax terrain: 3D map panel, map controls, markers, fallback profile, mountain page, live dashboard.
   UI chrome uses the app.css variables (so the light theme works); map and SVG drawings keep fixed brand colours. */

/* ---------- map panel */
.tr-wrap{position:relative;width:100%;height:100%;min-height:inherit;overflow:hidden;border-radius:inherit;background:#0B1530;color:#F3F5FB;isolation:isolate}
.tr-map{position:absolute;inset:0}
.tr-map .maplibregl-canvas{outline:none}
.tr-map .maplibregl-canvas:focus-visible{outline:2px solid var(--yellow);outline-offset:-2px}
.tr-loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:999px;background:#0B1530E6;border:1px solid #24346A;font-size:13px;font-weight:600;color:#C5CDE6;z-index:3}
.tr-loading span{width:14px;height:14px;border-radius:50%;border:2px solid #FFC61A;border-right-color:transparent;animation:tr-spin .8s linear infinite}
@keyframes tr-spin{to{transform:rotate(360deg)}}

/* controls: real 44px buttons, top right */
.tr-ctrl{position:absolute;top:10px;right:10px;z-index:4;display:flex;flex-direction:column;gap:6px}
.tr-ctrl button{width:44px;height:44px;display:flex;align-items:center;justify-content:center;border-radius:13px;border:1px solid #2A3C74;background:#0B1530D9;color:#F3F5FB;padding:0;font-weight:800;font-size:13px;letter-spacing:.2px;backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);transition:background var(--dur) var(--ease),transform var(--dur) var(--ease)}
.tr-ctrl button:hover{background:#13214A}
.tr-ctrl button:active{transform:scale(.94)}
.tr-ctrl button svg{width:20px;height:20px}
.tr-ctrl .tr-modebtn{background:#FFC61A;border-color:#FFC61A;color:#0B1530}
.tr-wrap.compact .tr-ctrl{display:none}

/* attribution: always visible, small */
.tr-wrap .maplibregl-ctrl-attrib{background:#0B1530B3;color:#C5CDE6;font-size:10.5px;line-height:1.4;border-radius:8px 0 0 0;padding:2px 8px}
.tr-wrap .maplibregl-ctrl-attrib a{color:#E8ECF8}
.tr-wrap .maplibregl-ctrl-bottom-right{z-index:3}
.tr-wrap .maplibregl-ctrl-attrib-button{display:none}

/* checkpoint labels: pill + stem, anchored at the bottom of the stem */
.tr-cp{display:flex;flex-direction:column;align-items:center;pointer-events:none;font-family:var(--font)}
.tr-cp-label{display:flex;align-items:center;gap:6px;padding:4px 9px 4px 8px;border-radius:9px;background:#0B1530EB;border:1px solid #33467F;color:#F3F5FB;white-space:nowrap;box-shadow:0 4px 14px #0007;font-size:12px;line-height:1.2}
.tr-cp-label b{font-weight:700}
.tr-cp-label small{font-size:11px;color:#AEB9DA;font-weight:600}
.tr-cp i{display:block;width:2px;height:16px;background:linear-gradient(#33467F,#FFC61A)}
.tr-cp i::after{content:'';display:block;width:9px;height:9px;border-radius:50%;background:#FFC61A;border:2px solid #0B1530;margin:14px 0 0 -3.5px}
.tr-cp.summit .tr-cp-label{background:#FFC61A;border-color:#FFC61A;color:#0B1530;font-size:13px;padding:5px 10px 5px 8px}
.tr-cp.summit .tr-cp-label small{color:#0B1530;opacity:.8;font-weight:700}
.tr-cp.summit .tr-cp-label svg{width:13px;height:13px}
.tr-cp.summit i{height:22px;background:#FFC61A}
.tr-cp.summit i::after{margin-top:20px}
.tr-cp.start .tr-cp-label{border-color:#5FD4B0}
.tr-wrap.compact .tr-cp:not(.summit){display:none}

/* hikers: small numbered yellow dots; off-trail = orange ring + words */
.tr-hk{width:22px;height:22px;border-radius:50%;background:#FFC61A;border:2px solid #0B1530;box-shadow:0 2px 8px #0009;display:flex;align-items:center;justify-content:center;font:800 10px/1 var(--font);color:#0B1530}
.tr-hk.guide{background:#0B1530;color:#FFC61A;border-color:#FFC61A}
.tr-hk.off{width:28px;height:28px;background:#FF8A3D;border:3px solid #fff;box-shadow:0 0 0 4px #FF8A3D88,0 3px 10px #000a;font-size:11px;z-index:2}
.tr-hk em{position:absolute;left:50%;top:calc(100% + 6px);transform:translateX(-50%);white-space:nowrap;font:800 11px/1 var(--font);font-style:normal;color:#0B1530;background:#FF8A3D;padding:4px 7px;border-radius:7px;box-shadow:0 3px 10px #0008}
.tr-hk.off::before{content:'';position:absolute;inset:-9px;border-radius:50%;border:2px solid #FF8A3D;animation:tr-ping 1.6s ease-out infinite}
@keyframes tr-ping{from{transform:scale(.7);opacity:1}to{transform:scale(1.5);opacity:0}}

/* ---------- fallback: profile + plan */
.tr-fallback{background:var(--surface2);color:var(--text)}
.tr-fb{position:absolute;inset:0;display:flex;flex-direction:column;gap:10px;padding:14px 14px 8px}
.tr-fb-head{display:flex;align-items:center;gap:10px}
.tr-fb-head>svg{width:34px;height:34px;flex:none;padding:7px;border-radius:11px;background:var(--yellow);color:var(--on-yellow)}
.tr-fb-head b{display:block;font-size:14px;font-weight:800;line-height:1.25}
.tr-fb-head span{display:block;font-size:12px;color:var(--muted)}
.tr-fb-body{flex:1;min-height:0;display:flex;gap:12px;align-items:stretch}
.tr-fb-prof{flex:1 1 auto;min-width:0;display:flex;align-items:center}
.tr-fb-prof svg{width:100%;height:100%;max-height:100%}
.tr-fb-plan{flex:0 0 30%;max-width:220px;display:flex;align-items:center;border-left:1px solid var(--line);padding-left:10px}
.tr-fb-plan svg{width:100%;height:auto;max-height:100%}
.tr-fb-note{margin:0;font-size:12.5px;color:var(--text2);display:flex;gap:8px;align-items:center}
.tr-fb-note::before{content:'';width:8px;height:8px;border-radius:50%;background:var(--warn);flex:none}
.tr-attr{font-size:10.5px;color:var(--muted)}
.tr-attr a{text-decoration:underline}
@media (max-width:560px){.tr-fb-plan{display:none}}
.tr-wrap.compact .tr-fb-plan,.tr-wrap.compact .tr-fb-head span{display:none}

/* elevation profile SVG (shared by the fallback, mountain page and dashboard) */
svg.tp{display:block;width:100%;height:auto;overflow:visible;font-family:var(--font)}
.tp-grid{stroke:var(--line);stroke-width:1}
.tp-ax{fill:var(--muted);font-size:11px;font-weight:600}
.tp-area{fill:#2B3F7D;fill-opacity:.55}
[data-theme="light"] .tp-area{fill-opacity:.22}
.tp-line{fill:none;stroke:#8EA3DD;stroke-width:2;stroke-linejoin:round}
[data-theme="light"] .tp-line{stroke:#2B3F7D}
.tp-walked{fill:#FFC61A;fill-opacity:.28}
.tp-walkline{fill:none;stroke:#FFC61A;stroke-width:3;stroke-linejoin:round}
[data-theme="light"] .tp-walkline{stroke:#C99600}
.tp-now{stroke:#FFC61A;stroke-width:1.5;stroke-dasharray:3 3}
.tp-cpline{stroke:var(--line);stroke-width:1;stroke-dasharray:2 4}
.tp-cp{fill:var(--surface);stroke:#8EA3DD;stroke-width:2}
.tp-cp.on{fill:#FFC61A;stroke:#0B1530}
.tp-cpname{fill:var(--text2);font-size:11.5px;font-weight:700}
.tp-dot{fill:#FFC61A;stroke:#0B1530;stroke-width:1.5}
.tp-dot.guide{fill:#0B1530;stroke:#FFC61A;stroke-width:2}
.tp-dot.off{fill:#FF8A3D;stroke:#fff;stroke-width:2.5}
svg.tpl{display:block;font-family:var(--font)}
.tpl-case{fill:none;stroke:#0B1530;stroke-width:6;stroke-linecap:round;stroke-linejoin:round}
[data-theme="light"] .tpl-case{stroke:#2B3F7D}
.tpl-line{fill:none;stroke:#FFC61A;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.tpl-cp{fill:var(--surface);stroke:#FFC61A;stroke-width:2}
.tpl-summit{fill:#FFC61A;stroke:#0B1530;stroke-width:1.5}

.sr-tr{position:absolute!important;left:0;top:0;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- mountain page */
.mt-cols{display:flex;flex-wrap:wrap;gap:18px;align-items:flex-start}
.mt-left{flex:999 1 560px;min-width:0;display:flex;flex-direction:column;gap:10px}
.mt-right{flex:1 1 340px;min-width:0;display:flex;flex-direction:column;gap:14px}
.mt-map{height:58vh;min-height:360px;border-radius:var(--r);overflow:hidden;border:1px solid var(--line);background:#0B1530}
.mt-under{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.mt-modes{display:flex;gap:8px}
.mt-modes .chip{min-height:44px;padding:0 18px}
.mt-disclaim{margin:0;flex:1;min-width:200px}
.mt-facts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.mt-facts .fact b{display:block;line-height:1.3}
.mt-trail{display:flex;flex-direction:column;gap:12px}
.mt-stats{display:flex;gap:6px;padding:4px 0 2px}
.mt-stats .stat b{font-size:19px}
.mt-prof{margin:2px -2px 0}
.mt-tl{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.mt-tl li{position:relative;display:flex;align-items:center;gap:12px;padding:9px 0}
.mt-tl li+li{border-top:1px solid var(--line)}
.mt-tl i{position:relative;width:12px;height:12px;flex:none;border-radius:50%;border:2px solid var(--yellow);background:var(--surface)}
.mt-tl li.top i{background:var(--yellow)}
.mt-tl b{display:block;font-size:14px}
.mt-tl span{font-size:12px;color:var(--muted)}
.mt-tl .mt-tl-ele{font-size:14px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.mt-skel{height:120px;border-radius:12px;background:var(--surface2)}
.mt-skel.short{height:60px;margin-top:10px}
.mt-notes p{margin:8px 0 0}
.mt-ph-h{margin-bottom:10px}
.mt-photos{display:flex;gap:10px;overflow-x:auto;scroll-snap-type:x mandatory;padding-bottom:6px}
.mt-photos figure{margin:0;flex:0 0 72%;max-width:300px;scroll-snap-align:start}
.mt-photos .photo{aspect-ratio:4/3;height:auto}
.mt-photos figcaption{font-size:11px;color:var(--muted);margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mt-cta{position:sticky;bottom:86px;z-index:5}
.mt-cta .btn{box-shadow:0 10px 30px #0006}
@media (min-width:900px){
  .mt-left{position:sticky;top:76px}
  .mt-map{height:calc(100vh - 170px);min-height:480px}
  .mt-photos figure{flex-basis:46%}
  .mt-cta{bottom:16px}
}

/* ---------- live dashboard */
.ol{gap:14px}
.ol-head{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px}
.ol-head-meta{flex:1 1 320px;display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;font-size:13px}
.ol-head-meta svg{width:16px;height:16px;vertical-align:-3px;margin-right:5px}
.ol-head-act{display:flex;gap:8px;flex-wrap:wrap}
.ol-head-act .btn svg{width:18px;height:18px}
.ol-close{border-color:var(--warn-text);color:var(--warn-text)}
.ol-live{display:inline-flex;align-items:center;gap:8px;padding:5px 12px 5px 10px;border-radius:999px;background:#FF4D4D1F;border:1px solid #FF6B6B;color:#FF8A8A;font-weight:800;font-size:12px;letter-spacing:.6px}
[data-theme="light"] .ol-live{color:#B3261E;border-color:#D84B4B;background:#FFE3E0}
.ol-live-t{font-weight:600;letter-spacing:0;opacity:.9}
.ol-live i{position:relative;width:8px;height:8px;border-radius:50%;background:currentColor}
.ol-live i::after{content:'';position:absolute;inset:-4px;border-radius:50%;border:2px solid currentColor;animation:ol-pulse 1.8s ease-out infinite}
@keyframes ol-pulse{from{transform:scale(.5);opacity:.9}to{transform:scale(1.6);opacity:0}}

.ol-banner{display:flex;flex-wrap:wrap;align-items:center;gap:12px 14px;padding:14px 16px;border-radius:var(--r);background:var(--surface);border:2px solid var(--warn);animation:rise var(--dur) var(--ease)}
.ol-banner.calm{border-style:dashed;border-color:var(--warn-text)}
.ol-banner>.grow{flex:1 1 260px}
.ol-bn-ic{width:42px;height:42px;flex:none;border-radius:12px;background:var(--warn);color:#0B1530;display:flex;align-items:center;justify-content:center}
.ol-bn-ic svg{width:24px;height:24px}
.ol-bn-h{margin:0;font-size:16px;font-weight:800;color:var(--warn-text)}
.ol-bn-d{margin:3px 0 0;color:var(--text)}
.ol-bn-g{margin:3px 0 0;color:var(--ok);font-weight:600}
.ol-bn-g:empty{display:none}
.ol-bn-act{display:flex;gap:8px;flex-wrap:wrap}
.ol-safe{border-color:var(--text2)}

.ol-cols{display:flex;flex-wrap:wrap;gap:14px;align-items:flex-start}
.ol-main{flex:999 1 560px;min-width:0;display:flex;flex-direction:column;gap:14px}
.ol-side{flex:1 1 340px;min-width:0;display:flex;flex-direction:column;gap:14px}
.ol-mapcard{padding:0;overflow:hidden}
.ol-map{height:46vh;min-height:320px;background:#0B1530}
.ol-mapbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px 14px;padding:10px}
.ol-follow{flex:0 1 auto;background:var(--surface2)}
.ol-follow>button{display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:0 14px;min-height:44px;font-size:13px}
.ol-follow svg{width:17px;height:17px}
.ol-legend{display:flex;gap:12px;flex-wrap:wrap}
.ol-legend span{display:inline-flex;align-items:center;gap:6px}
.ol-legend i{width:12px;height:12px;border-radius:50%;background:#FFC61A;border:2px solid #0B1530}
.ol-legend i.lg-g{background:#0B1530;border-color:#FFC61A}
.ol-legend i.lg-off{background:#FF8A3D;border-color:#fff;box-shadow:0 0 0 2px #FF8A3D}
@media (min-width:900px){.ol-map{height:min(62vh,640px);min-height:440px}}

.ol-progress{display:flex;flex-direction:column;gap:8px}
.ol-pct{font-size:22px;font-weight:800;font-variant-numeric:tabular-nums}
.ol-progress>p{margin:0}
.ol-bar{height:12px}
.ol-steps{list-style:none;margin:6px 0 0;padding:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.ol-steps li{display:flex;flex-direction:column;gap:3px;font-size:12px;min-width:0}
.ol-steps li b{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ol-steps li span:last-child{color:var(--muted);font-variant-numeric:tabular-nums}
.ol-dot{width:24px;height:24px;border-radius:50%;border:2px solid var(--line);display:flex;align-items:center;justify-content:center;background:var(--surface2)}
.ol-dot svg{width:14px;height:14px}
.ol-steps .done .ol-dot{background:var(--yellow);border-color:var(--yellow);color:var(--on-yellow)}
.ol-steps .now .ol-dot{border-color:var(--yellow);box-shadow:0 0 0 4px #FFC61A33}
.ol-steps .now .ol-dot::after{content:'';width:10px;height:10px;border-radius:50%;background:var(--yellow)}
.ol-steps .now span:last-child{color:var(--accent-text);font-weight:700}
.ol-prof{margin-top:6px}

.ol-counts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:12px 0}
.ol-count{background:var(--surface2);border:1px solid var(--line);border-radius:12px;padding:10px;text-align:center}
.ol-count b{display:block;font-size:26px;font-weight:800;line-height:1.1;font-variant-numeric:tabular-nums}
.ol-count span{font-size:11.5px;color:var(--muted)}
.ol-count.warn.hot{border-color:var(--warn);background:transparent}
.ol-count.warn.hot b{color:var(--warn-text)}
.ol-checks{list-style:none;margin:0 0 12px;padding:0}
.ol-checks li{display:flex;align-items:center;gap:10px;padding:9px 0;font-size:14px}
.ol-checks li+li{border-top:1px solid var(--line)}
.ol-checks b{font-variant-numeric:tabular-nums}
.ol-checks .small{min-width:58px;text-align:right}
.ol-ck{width:24px;height:24px;flex:none;border-radius:50%;border:2px dashed var(--line);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px}
.ol-ck svg{width:14px;height:14px}
.ol-ck.ok{background:var(--ok);border:none;color:#06231A}
.ol-ck.part{border-style:solid;border-color:var(--yellow)}
.ol-ck.bad{background:var(--warn);border:none;color:#0B1530}

.ol-tablebox{position:relative;overflow-x:auto;contain:inline-size;margin:10px -14px 10px;padding:0 14px;-webkit-overflow-scrolling:touch}
.ol-table{width:100%;border-collapse:collapse;font-size:13px;min-width:520px}
.ol-table th{text-align:left;font-size:11px;font-weight:700;color:var(--muted);padding:6px 8px 8px 0;border-bottom:1px solid var(--line);white-space:nowrap}
.ol-table td{padding:9px 8px 9px 0;border-bottom:1px solid var(--line);vertical-align:middle}
.ol-table tr.off td{background:#FF8A3D14}
.ol-name{font-weight:700;white-space:nowrap}
.ol-name .pill{margin-left:6px;font-size:10.5px;padding:1px 7px}
.ol-where{color:var(--text2);min-width:150px}
.ol-table td:nth-child(4),.ol-table td:nth-child(5){white-space:nowrap;font-variant-numeric:tabular-nums}
.ol-low{color:var(--warn-text);font-weight:700}
.ol-tag{display:inline-flex;align-items:center;justify-content:center;min-width:30px;height:26px;padding:0 6px;border-radius:8px;background:var(--yellow);color:var(--on-yellow);font-weight:800;font-size:12px}
.ol-tag.off{background:var(--warn);color:#0B1530;outline:2px solid var(--warn);outline-offset:2px}
.ol-bat{display:inline-block;width:20px;height:10px;border:1.5px solid currentColor;border-radius:3px;margin-right:6px;vertical-align:-1px;opacity:.85;position:relative}
.ol-bat i{display:block;height:100%;background:currentColor}
.ol-more{min-height:44px}

.ol-compose{display:flex;flex-direction:column;gap:10px}
.ol-compose textarea{min-height:88px}
.ol-sendrow{display:flex;gap:8px;flex-wrap:wrap}
.ol-sendrow .btn{flex:1 1 auto}
.ol-sendrow svg{width:17px;height:17px}
.ol-sent{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.ol-sent li{background:var(--surface2);border:1px solid var(--line);border-radius:12px;padding:9px 11px}
.ol-sent p{margin:4px 0 0;font-size:13px;color:var(--text2);overflow-wrap:anywhere}

.ol-sheet{display:flex;flex-direction:column;gap:12px}
.ol-sheet .h2{font-size:18px}
.ol-sheet p{margin:0}
.ol-sheet-ic{width:48px;height:48px;border-radius:14px;display:flex;align-items:center;justify-content:center}
.ol-sheet-ic svg{width:26px;height:26px}
.ol-sheet-ic.ok{background:var(--ok);color:#06231A}
.ol-sheet-ic.bad{background:var(--warn);color:#0B1530}
.ol-missing{list-style:none;margin:0;padding:0}
.ol-missing li{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.ol-missing b,.ol-missing span.small{display:block}
.ol-gate,.ol-closed{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:20px}
.ol-gate p,.ol-closed p{margin:0}
.ol-gate-ic{width:48px;height:48px;border-radius:14px;background:var(--yellow);color:var(--on-yellow);display:flex;align-items:center;justify-content:center}
.ol-gate-ic svg{width:26px;height:26px}
@media (max-width:420px){.ol-steps b{font-size:12px}.ol-steps li{font-size:11px}}
.mt-modes[hidden],.ol-follow[hidden]{display:none}
