/* Teton Conditions: mobile first, large type, high contrast, glove-size targets. */
:root {
  /* Punk palette: black, mint and hot pink. Avalanche danger colors live in js/danger.js
     and are never restyled here. */
  --bg: #0a0a0b;          /* black */
  --topo: url('../img/topo-dark.svg'); /* contour lines traced from the bundled Teton elevation tiles */
  --card: #141416;
  --card-2: #1f2023;
  --ink: #f4f3ee;
  --muted: #b9bcb6;
  --line: #3b3d42;
  --accent: #5ff2b4;      /* mint */
  --accent-ink: #03130c;
  --hot: #ff3d8b;         /* hot pink, decoration only */
  --ok: #8fd19e;
  --warn: #ffd166;
  --tap: 56px;
  --r: 6px;
  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="night"]) {
    --topo: url('../img/topo-light.svg');
    --bg: #f4f1e9; --card: #ffffff; --card-2: #e9e5da; --ink: #0a0a0b; --muted: #45474c;
    --line: #0a0a0b; --accent: #06724c; --accent-ink: #ffffff; --hot: #c2125f; --ok: #1f7a3a; --warn: #8a5a00;
    color-scheme: light;
  }
}
:root[data-theme="sun"] {
  --topo: url('../img/topo-light.svg');
  --bg: #f4f1e9; --card: #ffffff; --card-2: #e9e5da; --ink: #0a0a0b; --muted: #45474c;
  --line: #0a0a0b; --accent: #06724c; --accent-ink: #ffffff; --hot: #c2125f; --ok: #1f7a3a; --warn: #8a5a00;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.45 var(--body);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.1; margin: 0 0 .4em; letter-spacing: .01em; }
h1 { font-size: 2.1rem; font-weight: 800; text-transform: uppercase; }
h2 { font-size: 1.45rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 1.2rem; font-weight: 700; margin-top: .8em; }
h4 { font-size: 1.15rem; }
p { margin: .35em 0; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
.loading { color: var(--muted); font-style: italic; }

/* Header */
header#top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.brand { color: var(--card-2); height: 26px; overflow: hidden; }
.skyline { width: 100%; height: 26px; display: block; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; margin-top: -18px; }
.title { font-family: var(--display); font-weight: 800; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); text-decoration: none; }
.tools { display: flex; gap: 8px; }
.icon-btn { min-width: var(--tap); min-height: var(--tap); border-radius: var(--r); border: 2px solid var(--line); background: var(--card); color: var(--ink); font-size: 1.5rem; }
.tabs { display: flex; gap: 6px; padding: 8px 12px 10px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: 0 0 auto; min-height: 48px; display: flex; align-items: center; padding: 0 18px; border-radius: 999px; border: 2px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.tabs a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.offline { margin: 0; padding: 8px 12px; background: var(--warn); color: #1b1300; font-weight: 700; }

main { padding: 16px 12px 8px; max-width: 760px; margin: 0 auto; outline: none; }
.date { color: var(--muted); font-weight: 600; margin-top: -4px; }
footer#foot { max-width: 760px; margin: 0 auto; padding: 8px 16px 40px; color: var(--muted); }
.scope { border-left: 4px solid var(--accent); padding: 8px 12px; background: var(--card); border-radius: 0 var(--r) var(--r) 0; color: var(--ink); font-size: .95rem; }

/* Cards and sections */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 14px 0; border: 1px solid var(--line); position: relative; overflow: hidden; }
.card::before { /* contour-line texture */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .05;
  background: repeating-radial-gradient(circle at 85% -20%, var(--ink) 0 1px, transparent 1px 22px);
}
.card > * { position: relative; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 20px; border-radius: var(--r); border: 0; background: var(--accent); color: var(--accent-ink); font: 700 1.05rem var(--body); text-decoration: none; margin-top: 12px; }
.btn.wide { width: 100%; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.seg button { flex: 1 1 calc(50% - 8px); min-height: var(--tap); border-radius: var(--r); border: 2px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 1rem var(--body); padding: 6px 10px; }
.seg button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.q { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--muted); background: transparent; color: var(--ink); font: 800 1rem var(--body); vertical-align: middle; padding: 0; margin-left: 2px; position: relative; }
.q::after { content: ""; position: absolute; inset: -6px; } /* larger tap area */

/* Danger */
.danger { display: grid; grid-template-columns: 1fr; gap: 8px; align-items: center; }
@media (min-width: 540px) { .danger { grid-template-columns: 1.1fr 1fr; } }
.danger.expired { opacity: .45; filter: grayscale(.8); }
.mtn { width: 100%; height: auto; display: block; }
.bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bands li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.band-name { font-weight: 700; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 8px; font-weight: 800; white-space: nowrap; font-size: .95rem; }
.chip.lg { font-size: 1.15rem; padding: 6px 12px; }
.valid, .tomorrow { color: var(--muted); font-size: .95rem; }
.tomorrow .chip { margin: 2px 2px; }
.bottom-line { margin: 12px 0 0; padding: 12px 14px; border-left: 4px solid var(--ink); background: var(--card-2); border-radius: 0 var(--r) var(--r) 0; }
.kicker { text-transform: uppercase; font: 800 .8rem var(--body); letter-spacing: .08em; color: var(--muted); margin: 0 0 4px; }
.warn { background: var(--warn); color: #1b1300; padding: 8px 12px; border-radius: 10px; font-weight: 700; }

/* High and Extreme banner */
.banner { border-radius: var(--r); padding: 18px; margin: 10px 0 4px; border: 3px solid #000; }
.banner.lvl5 { border-color: #ED1C24; }
.banner-level { font: 800 1.3rem var(--display); text-transform: uppercase; letter-spacing: .05em; margin: 0; }
.banner-advice { font: 800 1.7rem/1.15 var(--display); margin: 8px 0; }
.banner-src { font-size: .9rem; margin: 0; }

/* Problems */
.problems { margin-top: 16px; }
.problem { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.problem-head .meta { color: var(--muted); font-weight: 600; }
.problem-body { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: start; }
@media (max-width: 380px) { .problem-body { grid-template-columns: 1fr; } .rose-wrap { max-width: 200px; } }
.rose { width: 100%; height: auto; }
.learn { font-size: 1rem; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--card-2); border-radius: 12px; padding: 10px 12px; }
.stat-label { font-weight: 700; font-size: .92rem; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.stat-value { font: 800 2.4rem/1 var(--display); margin: 6px 0 2px; }
.unit { font-size: 1.05rem; font-weight: 700; margin-left: 4px; color: var(--muted); }
.stat-sub { font-size: .85rem; color: var(--muted); margin: 0; }
.stat-group { margin-bottom: 14px; }
.elev { color: var(--muted); font-weight: 600; font-size: .95rem; }
.spark { width: 100%; max-width: 360px; height: auto; display: block; }

.stamp { font-size: .82rem; color: var(--muted); margin-top: 10px; }
.stamp .src { font-weight: 700; color: var(--ink); }
.stamp.stale strong { color: var(--warn); }
.note-box { background: var(--card-2); border-radius: 10px; padding: 10px 12px; font-size: .95rem; }
.err { background: var(--card-2); border: 2px dashed var(--warn); padding: 10px 12px; border-radius: 10px; }
.gap { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .95rem; }

/* Links */
.links { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 8px; }
.links a { display: flex; align-items: center; min-height: var(--tap); padding: 8px 14px; border-radius: 12px; background: var(--card-2); color: var(--ink); text-decoration: none; font-weight: 700; }
.links .ext { margin-left: auto; color: var(--accent); }

/* Cues */
.intro { font-size: 1rem; }
.cues { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; }
.cue { background: var(--card-2); border-radius: 12px; padding: 10px 12px; border-left: 6px solid var(--line); }
.cue.flag { border-left-color: var(--accent); }
.cue.clear { border-left-color: var(--ok); }
.cue.field { border-left-style: dashed; }
.cue-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; }
.cue-mark { font-size: 1.1rem; width: 1.2em; text-align: center; }
.cue.flag .cue-mark { color: var(--accent); }
.cue-status { margin-left: auto; font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cue.flag .cue-status { color: var(--accent); }

/* Forecast table */
.fc-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); margin-top: 6px; }
.fc { border-collapse: collapse; font-size: 1rem; }
.fc th, .fc td { padding: 8px 10px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--line); }
.fc th { position: sticky; left: 0; background: var(--card); text-align: left; font-size: .9rem; z-index: 1; border-right: 1px solid var(--line); }
.fc tr:first-child td { font-weight: 700; font-size: .85rem; color: var(--muted); }
.th-day { color: var(--ink); }
.fc td.hot { background: var(--accent); color: var(--accent-ink); font-weight: 800; }

/* Discussions */
.disc { border-top: 1px solid var(--line); }
.disc summary { min-height: var(--tap); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-weight: 700; cursor: pointer; padding: 8px 0; }
.disc pre { white-space: pre-wrap; font-size: .8rem; background: var(--card-2); padding: 10px; border-radius: 10px; overflow-x: auto; }

/* Camera */
.cam { margin: 10px 0; }
.cam img { width: 100%; height: auto; border-radius: 10px; display: block; background: var(--card-2); }
.cam figcaption { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* Learning note */
.learning { border: 2px solid var(--accent); border-radius: var(--r); padding: 14px 16px; margin: 18px 0; background: var(--card); }

/* Explain sheet */
.sheet { border: 0; border-radius: 18px 18px 0 0; margin: auto auto 0; width: 100%; max-width: 640px; background: var(--card); color: var(--ink); padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.sheet::backdrop { background: rgba(0, 0, 0, .55); }
.sheet .btn { width: 100%; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 700; z-index: 20; }

@media (prefers-reduced-motion: no-preference) { .card { animation: rise .25s ease-out backwards; } @keyframes rise { from { opacity: 0; transform: translateY(6px); } } }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-weight: 700; font-size: .92rem; }
.pill { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 .95rem var(--body); }
.tomorrow { margin-top: 10px; }
.tmr-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tmr-row > span { display: grid; gap: 4px; justify-items: start; }

/* Terrain map */
.tmap { margin-top: 8px; }
.map-box { overflow: auto; border-radius: 12px; border: 1px solid var(--line); max-height: 72vh; -webkit-overflow-scrolling: touch; background: #ddd; }
.map-inner { position: relative; width: 100%; }
.map-base { display: block; width: 100%; height: auto; }
.map-overlay, .map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-overlay { image-rendering: auto; }
.map-svg .clabel { font-weight: 600; font-family: var(--body); fill: rgba(70,45,10,.85); paint-order: stroke; stroke: rgba(255,255,255,.8); }
.map-svg .maplabel { font-weight: 800; font-family: var(--body); fill: #17202a; paint-order: stroke; stroke: #fff; stroke-linejoin: round; }
.map-svg .maplabel.sm { font-weight: 700; }
.pill.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.map-legend ul { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 6px; }
.map-legend li { display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.sw { flex: 0 0 28px; height: 20px; border-radius: 4px; border: 1px solid var(--line); }
.readout { background: var(--card-2); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.read-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 12px; margin: 0 0 6px; }
.read-grid dt { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.read-grid dd { margin: 0; font-weight: 800; font-size: 1.1rem; }
.no-fc { border: 3px dashed var(--warn); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.tabs a { white-space: nowrap; }

/* Range map (Leaflet) */
.rmap-wrap { position: relative; margin: 8px 0; }
.rmap-top { display: flex; gap: 8px; align-items: flex-start; }
.rmap-top .rmap-layers { flex: 1; margin: 0 0 8px; }
.rmap-full-btn { min-height: var(--tap); border-radius: var(--r); border: 2px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 .95rem var(--body); padding: 0 12px; }
.rmap { height: 62vh; min-height: 340px; max-height: 640px; border-radius: var(--r); border: 1px solid var(--line); background: #9aa3ab; touch-action: none; }
.rmap-wrap.full { position: fixed; inset: 0; z-index: 60; background: var(--bg); margin: 0; padding: calc(8px + env(safe-area-inset-top)) 8px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.rmap-wrap.full .rmap { flex: 1; height: auto; max-height: none; }
body.rmap-lock { overflow: hidden; }
.rmap-views { margin-top: 8px; }
.rmap-views button { flex: 1 1 calc(33% - 8px); font-size: .95rem; }
.rmap-views .rmap-full-btn { flex: 1 1 calc(50% - 8px); background: var(--card); }
.rmap-layers { margin: 0 0 8px; }
.rmap-wrap.full .seg { flex: 0 0 auto; }
.rmap-wrap.full .rmap-views button { min-height: 48px; }
.rmap .leaflet-control-zoom a { width: 48px; height: 48px; line-height: 46px; font-size: 26px; }
.rmap .leaflet-control-attribution { font-size: 10px; }
.rlabel { background: none; border: 0; white-space: nowrap; pointer-events: none; }
.rlabel span { display: inline-block; transform: translate(-50%, -50%); font: 700 13px var(--body); color: #111; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.rlabel.peak span { font-size: 12.5px; }
.rlabel.town span { font-weight: 800; letter-spacing: .03em; text-transform: uppercase; font-size: 11.5px; color: #333; }
.rlabel.terrain span { font-style: italic; color: #102a5c; }
.rlabel.landmark span { color: #4a2a00; }
.zlabel { background: rgba(255,255,255,.85); border: 1px solid #555; color: #111; font: 700 12px var(--body); box-shadow: none; }
.zlabel::before { display: none; }
.legend-box { margin: 10px 0; }
.legend-box .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; margin: 6px 0; }
.legend-box .legend li { display: flex; align-items: center; gap: 6px; font-size: .95rem; }
.legend-box .sw { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid #0006; vertical-align: middle; }
.plain { list-style: none; padding: 0; margin: 4px 0; }
.rmap.locked { touch-action: pan-y; height: 48vh; min-height: 300px; }
.rmap-wrap.full .rmap.locked { touch-action: none; }
.rmap-wrap.full .rmap-hint { display: none; }
.rmap-2f { position: absolute; inset: 0; z-index: 1100; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center;
  background: rgba(10, 10, 11, .55); color: #fff; font: 700 1.05rem var(--body); pointer-events: none; opacity: 0; transition: opacity .2s; }
.rmap-2f.on { opacity: 1; }
.rmap-wrap.full .rmap-2f { display: none; }
.rmap { position: relative; z-index: 0; isolation: isolate; }
.rlabel.run span { font: 600 11.5px var(--body); color: #3b0764; }
.rlabel.resort span { font: 800 12px var(--body); color: #5b21b6; text-transform: uppercase; letter-spacing: .04em; }
.rmap .leaflet-control-rotate a, .rmap .leaflet-control-rotate-toggle { width: 48px; height: 48px; line-height: 48px; }

.av-mark { background: none; border: 0; }
.av-dia { position: absolute; left: 11px; top: 11px; width: 20px; height: 20px; transform: rotate(45deg); background: #ed1c24; border: 3px solid #fff; box-shadow: 0 0 0 2px #111; }
.av-date { position: absolute; left: 36px; top: 12px; white-space: nowrap; font: 800 12px var(--body); color: #111; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.av-thumbs { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.av-thumb { flex: 0 0 auto; width: 96px; height: 96px; padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; }
.av-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-view { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #000; }
.photo-view[open] { display: flex; flex-direction: column; }
.photo-view img { flex: 1; min-height: 0; width: 100%; object-fit: contain; touch-action: pinch-zoom; }
.photo-bar { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); color: #fff; }


/* Plain-language lines under snow and weather numbers */
.stat-means { font-size: .95rem; line-height: 1.35; margin: 8px 0 0; color: var(--ink); }
.stat-means strong { font-weight: 800; }
.trend { display: inline-flex; align-items: center; gap: 2px; margin-left: 8px; font: 700 .85rem var(--body); vertical-align: middle; color: var(--muted); }
.trend.up { color: var(--accent); }
.stat.has-flag { box-shadow: inset 4px 0 0 #ed1c24; }
.flag-tag { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 0 12px; border-radius: 999px; background: #ed1c24; color: #fff; font: 800 .9rem var(--body); text-decoration: none; }
.stats:has(.stat-means) { grid-template-columns: 1fr; }

/* ---------- Punk styling, refined ---------- */
:root { --r: 10px; --gap: 14px; --shadow: 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent), 0 10px 24px -14px #000; }
body { font-size: 17px; line-height: 1.5; }
/* Contour background, pinned to the screen (a fixed layer works on iOS where background-attachment: fixed does not) */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: var(--topo) center / cover no-repeat; }
main { padding: 18px 16px 8px; }
h1 { font-size: clamp(1.7rem, 7vw, 2.3rem); letter-spacing: .03em; margin-bottom: .15em; }
h1::after { content: ""; display: block; width: 56px; height: 5px; margin-top: 10px; background: linear-gradient(90deg, var(--accent) 0 70%, var(--hot) 70%); border-radius: 3px; }
h2 { font-size: 1.15rem; letter-spacing: .08em; margin: 0; }
h3 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1.1em; }
header#top { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); box-shadow: inset 0 -3px 0 var(--accent); }
.brand { color: var(--hot); opacity: .35; }
.title { color: var(--ink); letter-spacing: .08em; white-space: nowrap; font-size: clamp(1.05rem, 5.2vw, 1.4rem); }
.title::first-letter { color: var(--accent); }
.tabs { gap: 4px; padding: 6px 10px 8px; }
.tabs a { min-height: 44px; padding: 0 14px; border: 0; border-radius: 999px; font: 800 .95rem var(--display); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.icon-btn { min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; font-size: 1.3rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: var(--gap) 0; box-shadow: var(--shadow); position: relative; }
.card::before { content: ""; position: absolute; left: 0; top: 14px; width: 4px; height: 26px; border-radius: 0 4px 4px 0; background: var(--hot); opacity: 1; inset: 14px auto auto 0; }
.card > h2 { margin-bottom: 12px; }

/* collapsible cards */
.fold { padding: 0; }
.fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 0 16px; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary h2 { font-size: 1.05rem; }
.chev { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; background: var(--card-2); position: relative; }
.chev::after { content: ""; position: absolute; left: 10px; top: 8px; width: 7px; height: 7px; border: solid var(--ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); transition: transform .15s; }
.fold[open] .chev { background: var(--accent); }
.fold[open] .chev::after { border-color: var(--accent-ink); transform: translateY(3px) rotate(-135deg); }
.fold-body { padding: 0 16px 16px; }
.more { border-top: 1px solid var(--line); margin-top: 12px; }
.more > summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--accent); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid currentColor; font-weight: 800; line-height: 1; }
.more[open] > summary::before { content: "−"; }
.more-body { padding-bottom: 6px; }

/* controls */
.select-row { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.select-label { flex: 0 0 auto; font: 800 .78rem var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); min-width: 48px; }
.select { flex: 1; min-height: 48px; padding: 0 40px 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235ff2b4' stroke-width='2.5'/%3E%3C/svg%3E") no-repeat right 14px center; color: var(--ink); font: 700 1rem var(--body); -webkit-appearance: none; appearance: none; }
.segtabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--card-2); border-radius: 12px; margin-bottom: 12px; }
.segtabs button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 800 .92rem var(--body); }
.segtabs button.on { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; margin-bottom: 8px; }
.chips button { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink); font: 700 .9rem var(--body); }
.chips button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.switches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.switch { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 .88rem var(--body); text-align: left; }
.switch .knob { flex: 0 0 auto; width: 30px; height: 18px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch.on { border-color: var(--accent); }
.switch.on .knob { background: var(--accent); }
.switch.on .knob::after { transform: translateX(12px); background: var(--accent-ink); }
@media (max-width: 360px) { .switch { flex-direction: column; justify-content: center; gap: 4px; font-size: .8rem; } }
.rmap-views { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }
.rmap-views .select-row { flex: 1; margin: 0; }
.rmap-full-btn { min-height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 .9rem var(--body); }
.rmap { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.map-key { margin-top: 10px; }

.btn { border-radius: 10px; box-shadow: none; text-transform: none; letter-spacing: 0; font-weight: 800; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.seg button { border-width: 1px; border-radius: 10px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: none; }
.pill { border-radius: 999px; border-width: 1px; }
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.links a { border-radius: 10px; border: 1px solid var(--line); background: transparent; min-height: 52px; }
.links a:active { background: var(--accent); color: var(--accent-ink); }
.scope, .bottom-line { border-left: 3px solid var(--hot); }
.stat { border-radius: 10px; border: 0; background: var(--card-2); }
.trend.up { color: var(--hot); }
a { color: var(--accent); }
.legend-zone { margin: .8em 0 .2em; font: 800 .85rem var(--body); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.problem { border-top: 1px solid var(--line); padding: 0; margin: 0; }
.problem > summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.problem > summary::-webkit-details-marker { display: none; }
.problem > summary h4 { margin: 0; }
.problem > summary::after { content: "+"; color: var(--accent); font-weight: 800; margin-left: auto; }
.problem[open] > summary::after { content: "−"; }

/* Learn */
.lead-warn { font: 800 1.2rem/1.25 var(--display); text-transform: uppercase; letter-spacing: .04em; padding: 14px 16px; background: var(--hot); color: #fff; border-radius: var(--r); margin: 14px 0 10px; }
.lede { font-size: 1.05rem; color: var(--ink); margin-bottom: 4px; }
.flags { counter-reset: f; list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.flags li { counter-increment: f; display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--card-2); border-radius: 10px; font-weight: 700; }
.flags li::before { content: counter(f); flex: 0 0 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #ed1c24; color: #fff; font-weight: 800; }
.code-intro { font-size: 1.02rem; }
.checks { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.checks li { padding-left: 30px; position: relative; }
.checks li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 12px; height: 7px; border: solid var(--accent); border-width: 0 0 3px 3px; transform: rotate(-45deg); }
.code-list { padding-left: 1.4em; display: grid; gap: 6px; }
.course { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 8px 0; background: var(--card-2); }
.course h4 { margin: 2px 0 2px; font-size: 1.05rem; }
.course .when { font: 800 .82rem var(--body); color: var(--accent); text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.course-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.course-actions .btn { margin: 0; min-height: 44px; }
.cal { border: 0; margin: 0; }
.cal > summary { min-height: 44px; }
.cal-row { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.cal-row .pill { display: inline-flex; align-items: center; text-decoration: none; }
.videos { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.video { margin: 0; }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play { position: absolute; inset: 0; padding: 0; border: 0; background: #000; cursor: pointer; }
.video-play img { width: 100%; height: 100%; object-fit: cover; opacity: .8; display: block; }
.play-icon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 1.5rem; padding-left: 4px; }
.video figcaption { margin-top: 6px; font-size: .95rem; }
.rmap-views .rmap-full-btn { flex: 0 0 auto; }
.select, .select-row, .switch, .rmap-views .select-row { min-width: 0; }
.select { width: 100%; text-overflow: ellipsis; }
.switches > * { min-width: 0; }
@media (max-width: 460px) { .switch { flex-direction: column; justify-content: center; gap: 5px; padding: 6px 4px; font-size: .82rem; text-align: center; min-height: 58px; } }
.no-fc.compact { font-size: .9rem; line-height: 1.4; padding: 8px 12px; border-width: 2px; border-radius: 10px; }

/* Burial survival bars */
.burial { margin: 1rem 0; padding: .8rem; border: 1px solid var(--line, #333); border-radius: 10px; }
.burial h3 { margin: 0 0 .4rem; font-size: 1rem; }
.burial-rows { list-style: none; margin: .6rem 0; padding: 0; display: grid; gap: .5rem; }
.burial-rows li { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) 11.5rem; align-items: center; gap: .6rem; }
.b-bar { height: .7rem; background: color-mix(in srgb, currentColor 12%, transparent); border-radius: 99px; overflow: hidden; }
.b-bar span { display: block; height: 100%; background: var(--hot, #ff3d8b); border-radius: 99px; }
.b-pct { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .9rem; text-align: right; }
@media (max-width: 460px) {
  .burial-rows li { grid-template-columns: minmax(0, 1fr) auto; }
  .b-bar { grid-column: 1 / -1; order: 3; }
}

/* Partner questions */
.squad { margin: 1rem 0; padding: .8rem .9rem; border-left: 4px solid var(--hot, #ff3d8b); background: color-mix(in srgb, var(--hot, #ff3d8b) 7%, transparent); border-radius: 0 10px 10px 0; }
.squad h3 { margin: 0 0 .35rem; font-size: 1rem; }
.squad p { margin: 0 0 .4rem; }
.squad-q { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.books { list-style: none; margin: .5rem 0; padding: 0; display: grid; gap: .8rem; }
.books li { padding-bottom: .7rem; border-bottom: 1px solid var(--line); min-width: 0; }
.books p { margin: .25rem 0 0; }
.jump { margin: .2rem 0 .8rem; }
.pill-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; text-decoration: none; }
.pill-link:hover, .pill-link:focus-visible { background: var(--accent); color: var(--accent-ink); }
.act-table { margin: .8rem 0; }
.act-table table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.act-table caption { text-align: left; font-weight: 700; padding-bottom: .4rem; }
.act-table th, .act-table td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
.act-table thead th { font-size: .8rem; color: var(--muted, inherit); }
.act-table th:first-child { text-align: left; }
.act-table figcaption { margin-top: .4rem; }

/* Problem views: flat rose or 3D mountain */
.pv { min-width: 0; }
.pv-seg { margin-bottom: .5rem; }
.m3d { width: 100%; max-width: 520px; }
.m3d canvas { display: block; touch-action: none; cursor: grab; border-radius: 12px; background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--ink) 8%, transparent), transparent 70%); }
.m3d canvas:active { cursor: grabbing; }
.m3d canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.m3d-hint { margin: .35rem 0 0; }
.today-problems .problems > h3 { display: none; }

/* Wide screens: a main column and a sidebar about half its width */
.col-main, .col-side { min-width: 0; }
@media (min-width: 1100px) {
  main.wide { max-width: 1200px; }
  main.wide-map { max-width: 1320px; }
  body:has(main.wide) footer#foot { max-width: 1200px; }
  body:has(main.wide-map) footer#foot { max-width: 1320px; }
  .cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); column-gap: 28px; align-items: start; }
  .col-side { padding: 0 0 12px 24px; border-left: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
  .col-side > * { font-size: .95rem; }
  .col-side .m3d { max-width: 100%; }
  main.wide > h1 { font-size: 2.1rem; margin-bottom: .1rem; }
  main.wide .lede, main.wide .lead-warn { max-width: 68ch; }
}
.problem-body:has(.m3d) { display: block; }
.problem-body:has(.m3d) .m3d { margin: 0 auto .6rem; }

/* Phones: fit all five tabs in one row without hiding any */
@media (max-width: 480px) {
  .tabs { gap: 0; padding: 6px 6px 8px; justify-content: space-between; }
  .tabs a { padding: 0 9px; font-size: .8rem; letter-spacing: .04em; }
}
@media (max-width: 360px) {
  .tabs a { padding: 0 6px; font-size: .74rem; letter-spacing: .02em; }
}
/* Near me: report list */
.reports { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.report { border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); }
.report > summary { list-style: none; cursor: pointer; padding: 12px 14px; min-height: var(--tap); display: grid; gap: 2px; }
.report > summary::-webkit-details-marker { display: none; }
.report[open] > summary { border-bottom: 1px solid var(--line); }
.rep-date { font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); }
.rep-place { font-weight: 800; font-size: 1.08rem; }
.rep-meta { font-size: .9rem; color: var(--muted); }
.rep-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.flag { font-size: .8rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; border: 1.5px solid var(--ink); }
.rep-body { padding: 10px 14px 14px; }
.rep-av { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.near-st { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.near-st:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
button.btn:disabled { opacity: .7; }
/* Three header buttons: let the title shrink on narrow phones */
.bar { gap: 8px; }
.title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: clamp(.95rem, 4.6vw, 1.4rem); }
.tools { flex: 0 0 auto; gap: 6px; }
@media (max-width: 400px) { .tools .icon-btn { min-width: 46px; min-height: 46px; } .title { letter-spacing: .03em; font-size: 4.4vw; } }

/* Near me: visible change after allowing location */
.fine { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
details.fine > summary { cursor: pointer; list-style: none; }
details.fine > summary::-webkit-details-marker { display: none; }
details.fine .how { text-decoration: underline; text-underline-offset: 3px; }
details.fine p { margin: 6px 0 0; }
.you-banner { border-radius: 12px; padding: 12px 16px; margin: 14px 0 -4px; border: 2px solid var(--ink); scroll-margin-top: 12px; }
.you-banner.pending, .you-banner.out { background: var(--card-2); color: var(--ink); }
.you-where { margin: 0; font: 800 1.25rem var(--display); text-transform: uppercase; letter-spacing: .04em; }
.you-sub { margin: 2px 0 0; font-weight: 700; }
@media (prefers-reduced-motion: no-preference) { .near-map.shown, .you-banner { animation: rise .35s ease-out backwards; } }
.place-form { margin-top: 14px; }
.place-row { display: flex; gap: 8px; margin-top: 6px; }
.place-input { flex: 1; min-width: 0; min-height: var(--tap); padding: 0 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--card-2); color: var(--ink); font: 600 1rem var(--body); }
.place-row .pill { min-height: var(--tap); padding: 0 18px; }
.place-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.place-pick { width: 100%; min-height: 48px; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font: 600 .95rem var(--body); }

/* Road status */
.road-head { margin: 0 0 8px; }
.road-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.road-seg { border-left: 4px solid var(--line); padding: 4px 0 4px 10px; }
.road-seg p { margin: 0; }
.road-where { font-weight: 700; }
.road-seg.imp-low { border-left-color: var(--ok); }
.road-seg.imp-moderate, .road-seg.imp-longterm { border-left-color: var(--warn); }
.road-seg.imp-high, .road-seg.imp-closed { border-left-color: var(--hot); }
.road-seg.imp-seasonal { border-left-color: var(--muted); }
.road-closed { background: var(--hot); color: var(--bg); padding: 10px 12px; border-radius: 10px; font-weight: 800; margin: 0 0 10px; }

/* My location button, pasted positions and Gaia GPS / onX files on the map */
.rmap-views .rmap-loc-btn.on { border-color: #2b7cff; color: var(--ink); box-shadow: inset 0 0 0 2px #2b7cff; }
.rmap-views .rmap-loc-btn::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 7px; border-radius: 50%; background: #2b7cff; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #2b7cff; vertical-align: 1px; }
@media (max-width: 400px) { .rmap-views { flex-wrap: wrap; } .rmap-views .select-row { flex: 1 1 100%; } .rmap-views .rmap-full-btn { flex: 1 1 calc(50% - 4px); } }
.rmap-loc-note:empty { display: none; }
.rmap-loc-note { margin-top: 8px; }
.rmap-loc-note p { margin: 0; }
.linkish { background: none; border: 0; padding: 10px 2px; min-height: 44px; color: var(--accent); font: 700 .95rem var(--body); text-decoration: underline; cursor: pointer; }
.map-find { margin-top: 10px; }
.map-find .pill { margin-top: 8px; }
.file-btn { position: relative; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.file-btn:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.gps-wpt { background: none; border: 0; }
.gps-dot { position: absolute; left: 4px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #ff3fa4; border: 3px solid #fff; box-shadow: 0 0 0 1.5px #111; }
.gps-name { position: absolute; left: 26px; top: 2px; white-space: nowrap; font: 700 12px/1.2 var(--body); color: #111; background: rgba(255, 255, 255, .88); padding: 2px 5px; border-radius: 4px; }
.gps-file { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.gps-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Map tools on the map, top right: big enough for gloves, still there in full screen */
.rmap { position: relative; }
.rmap-fabs { position: absolute; top: 10px; right: 10px; z-index: 1000; display: grid; gap: 8px; }
.rmap-fab { width: 56px; height: 56px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 700 .72rem/1 var(--body); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; }
.rmap-fab svg { width: 24px; height: 24px; }
.rmap-fab.on { color: #fff; background: #2b7cff; border-color: #2b7cff; }
.rmap-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.rmap.locked .rmap-fabs, .rmap-wrap:not(.full) .rmap-fabs { gap: 6px; }
@media (max-height: 700px) { .rmap-fab { width: 50px; height: 50px; } }

/* BTAC field reports: type chips, day choice, map markers */
.obs-filter { margin: 0 0 10px; }
.obs-filter-title { margin: 0 0 6px; font-weight: 800; }
.obs-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin: 0 0 8px; }
.obs-chip { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font: 700 .88rem var(--body); text-align: left; opacity: .72; }
.obs-chip.on { opacity: 1; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.obs-chip:not(.on) .obs-dot { filter: grayscale(1); opacity: .6; }
.obs-dot { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #111; color: #fff; font: 900 13px/1 var(--body); vertical-align: middle; }
.obs-dot.k-avalanche { background: #b3121a; }
.obs-dot.k-instability { background: #111; }
.obs-dot.k-snowpack { background: #1f5fa8; }
.obs-dot.k-weather { background: #0f766e; }
.obs-dot.k-other { background: #57534e; }
.obs-mark { background: none; border: 0; }
.obs-mark .obs-dot { position: absolute; left: 8px; top: 8px; width: 28px; height: 28px; font-size: 15px; border-width: 3px; }
.obs-fold { margin: 8px 0; }
.obs-note p { margin: 6px 0; }
.obs-part { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.obs-prob { margin: 6px 0; }
.obs-link { background: var(--accent); color: var(--accent-ink); }
/* Zone names and top ratings, above the map */
.zkeys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 6px; font-size: .85rem; }
.zkey { display: inline-flex; align-items: center; gap: 6px; }
.zkey-sw { width: 14px; height: 14px; border: 1.5px solid #111; flex: 0 0 auto; }
/* Refresh note at the top of every screen */
.refresh-note { margin: 0; padding: 6px 12px; font-size: .85rem; border-bottom: 1px solid var(--line); }
.refresh-note .linkish { min-height: 44px; padding: 0 4px; font-weight: 700; }
