/* The app's styles (index.html). Colours come from the shared palette in tokens.css (accent, status
   and map marks are used under their palette names); the app's own roles, text sizes and corners
   are named here. */
:root {
  --bg: var(--forest);
  --bg-deep: var(--forest-deep);   /* under the map tiles while they load */
  --panel: var(--forest-2);
  --panel2: var(--forest-3);
  --border: var(--forest-line);
  --border-strong: var(--forest-line-strong);
  --handle: #4d7059;          /* the sheet's grab line */
  --track: #3a5544;           /* a switch that is off */
  --knob: #cfe3d3;
  --text: var(--on-forest);
  --muted: var(--on-forest-soft);

  /* text sizes; icon glyphs (emoji, ✕, ▾) keep their own px sizes */
  --fs-2xs: 10px;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 15px;
  --fs-xl: 16px;              /* also the floor that keeps iOS from zooming into an input */
  --fs-2xl: 18px;

  /* corners; circles stay 50 % */
  --r-xs: 3px;
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  --shadow: 0 4px 18px rgba(0,0,0,.35);
  --shadow-s: 0 2px 6px rgba(0,0,0,.35);   /* small marks: the multi-species cluster's minis */
  --shadow-up: 0 -6px 30px rgba(0,0,0,.5);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
#map { position: fixed; inset: 0; height: 100dvh; background: var(--bg-deep); z-index: 0; transition: transform .7s ease-out; }
/* the Leaflet controls, lifted out of #map so they stay upright while following turns it (js/heading.js) */
.map-controls { position: fixed; inset: 0; height: 100dvh; z-index: 0; pointer-events: none; background: transparent; outline: 0; }

/* ---------- top bar ---------- */
.topbar {
  /* centred, so a long name ("Suppilovahvero") still fits on a narrow phone */
  position: fixed; top: calc(8px + var(--safe-t)); left: 10px; right: 10px;
  margin-inline: auto; width: fit-content; max-width: 100%;
  z-index: 1000; display: flex; align-items: center; gap: 6px;
  background: var(--panel); border-radius: var(--r-pill); padding: 6px 6px 6px 14px;
  box-shadow: var(--shadow);
}
/* long names ("Suppilovahvero") must still fit the pill on a 360 px phone */
.topbar .title { font-weight: 700; font-size: clamp(12.5px, 3.45vw, 15px);
  white-space: nowrap; letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; }
.topbar .spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--muted); border-top-color: transparent;
  animation: spin 1s linear infinite; opacity: 0; transition: opacity .2s;
}
.topbar .spinner.on { opacity: 1; }
/* connection badge (js/netstatus.js): shown only while something is unreachable; tap explains */
.netbtn { border: 0; background: transparent; width: 28px; height: 44px; padding: 0; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.netbtn[hidden] { display: none; }
.netbtn span { width: 12px; height: 12px; border-radius: 50%; background: var(--bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 25%, transparent); }
@keyframes spin { to { transform: rotate(360deg); } }
.iconbtn {
  border: 0; background: var(--panel2); color: var(--text);
  width: 44px; height: 44px; border-radius: 50%;
  font-size: 18px; line-height: 1; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- place search ---------- */
.searchpanel {
  position: fixed; top: calc(70px + var(--safe-t)); left: 10px; right: 10px; z-index: 1500;
  background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 8px; display: none;
}
.searchpanel.open { display: block; }
.searchpanel input {
  width: 100%; box-sizing: border-box; border: 0; border-radius: var(--r-sm);
  background: var(--panel2); color: var(--text); font-size: var(--fs-xl); padding: 11px 12px;
}
.searchpanel input::placeholder { color: var(--muted); }
.searchpanel ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 46dvh; overflow-y: auto; }
.searchpanel li {
  padding: 10px 12px; border-radius: var(--r-sm); font-size: var(--fs-md); line-height: 1.35; cursor: pointer;
  color: var(--text);
}
.searchpanel li + li { margin-top: 2px; }
.searchpanel li small { display: block; color: var(--muted); font-size: var(--fs-sm); }
.searchpanel li:active, .searchpanel li:hover { background: var(--panel2); }
.searchpanel .hint { color: var(--muted); font-size: var(--fs-sm); padding: 8px 12px; }
/* "Lähellä sinua" section: a header that must not look tappable, and rows that
   carry the area on the right the way a price sits in a list */
.searchpanel li.sect { font-size: var(--fs-xs); letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px 4px; cursor: default; }
.searchpanel li.sect:hover, .searchpanel li.sect:active { background: none; }
.searchpanel li.sect small { text-transform: none; letter-spacing: 0; }
.searchpanel li.spot { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.searchpanel li.spot .area { margin-left: auto; color: var(--accent); font-weight: 600;
  font-size: var(--fs-sm); white-space: nowrap; }
.searchpanel li.spot small { flex-basis: 100%; }
.searchpanel li.act { color: var(--accent); }

/* ---------- species badges ----------
   icons/species/<key>.svg, through spIcon() in js/species.js. Sized per place rather than by
   font-size the way the emoji were; `.inline` is the one that sits in running text. */
.spi { display: inline-block; flex: 0 0 auto; vertical-align: middle;
  width: 24px; height: 24px; user-select: none; -webkit-user-drag: none; }
.spi.inline { width: 1.6em; height: 1.6em; margin: -.35em .1em -.25em; }
.sp .spi { width: 36px; height: 36px; }
.result-head .big .spi { display: block; width: 48px; height: 48px; }
.toast .spi { width: 28px; height: 28px; margin: -5px 0 -5px -8px; }
.searchpanel li.spot .spi { width: 22px; height: 22px; align-self: center; }
.sheet h2 .spi { width: 44px; height: 44px; }
/* the app's neutral mushroom mark: icons/mushroom.svg, MUSHROOM_ICON in js/constants.js */
.mi { display: inline-block; flex: 0 0 auto; vertical-align: middle; width: 1.4em; height: 1.4em;
  margin: -.3em .05em -.2em; user-select: none; -webkit-user-drag: none; }
.fab .mi { width: 36px; height: 36px; margin: 0; }
/* the UI icons (the sprite at the top of index.html): line drawings in the colour of the text
   around them, sized to it, so in running text they sit like a letter */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { display: inline-block; flex: 0 0 auto; width: 1.25em; height: 1.25em; vertical-align: -.25em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .ic { width: 22px; height: 22px; }
.fab .ic { width: 28px; height: 28px; }
.fab .ic.i-layer { width: 34px; height: 34px; }
.modal-close .ic { width: 18px; height: 18px; }
.sheet h2 .ic { width: 26px; height: 26px; }
.result-head .big .ic { display: block; width: 36px; height: 36px; }
.toast .ic { width: 20px; height: 20px; }
.checks .mark .ic { width: 1.1em; height: 1.1em; vertical-align: -.15em; stroke-width: 2.6; }
.howto .mark .ic { width: 24px; height: 24px; vertical-align: 0; stroke-width: 2; }
/* the ones that carried a meaning in their emoji colour keep it */
.ic.i-warn, .ic.i-star { color: var(--accent); }
.ic.i-miss { color: var(--bad); }
.ic.i-okc { color: var(--good); }
.sheet h2 .mi { width: 28px; height: 28px; margin: 0; }
.toast .mi { width: 26px; height: 26px; margin: -5px 0 -5px -6px; }

/* ---------- floating action buttons ---------- */
.fabs {
  position: fixed; right: 10px; bottom: calc(96px + var(--safe-b));
  z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
/* the bottom row: 🛰 to the left of Paikanna, which stays in the column. The column is now as wide
   as the row, so its empty part lets taps through to the map. */
.fab-row { display: flex; gap: 12px; }
.fabs { pointer-events: none; }
.fabs .fab { pointer-events: auto; }
.fab {
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--panel); color: var(--text); font-size: 24px;
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
}
.fab.active { background: var(--accent); color: var(--on-accent); }
/* 🛰 has no button where the browser has no WebGL; display:flex above outranks the UA's [hidden] */
.fab[hidden] { display: none; }
/* first-use label (js/ui.js initFabLabels): the button's name beside it until it is first used */
.fab { position: relative; }
.fab.labelled::before {
  content: attr(aria-label); position: absolute; right: calc(100% + 10px); top: 50%;
  transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  background: var(--panel); color: var(--text); font-size: var(--fs-md); font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-pill); box-shadow: var(--shadow);
}
/* Paikanna's label goes left of 🛰 rather than over it (56 px button + 12 px gap) */
.fab-row .fab:not(:first-child).labelled::before { right: calc(100% + 78px); }
.fab-row .fab[hidden] + .fab.labelled::before { right: calc(100% + 10px); }
/* "Paikanna": a crosshair drawn in currentColor, so the active (following) state inverts with the
   button. Not 📍 — that pin means "a place on the map" elsewhere in the app. */
.fab .loc { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.fab .loc .c { fill: currentColor; stroke: none; }
/* while following has turned the map, the crosshair turns with it and grows a north tip */
.fab .loc { transition: transform .7s ease-out; overflow: visible; }
.fab .loc .n { fill: currentColor; stroke: none; display: none; }
.fab.turned .loc .n { display: inline; }
/* on the map but kept level while it is turned: the counter-turn follows the map's (js/heading.js) */
.upright { transform: rotate(var(--map-bearing, 0deg)); transition: transform .7s ease-out; }
/* the instant reset to 0° once back at north, so nothing spins round through whole turns */
.map-snap #map, .map-snap .fab .loc, .map-snap .upright { transition: none !important; }

/* ---------- 🛰 Lintuperspektiivi (js/panels/birdseye.js) ----------
   Covers the whole screen. The 2D map under it is hidden, not just covered, so the compositor
   does not keep painting it. The canvas is drawn at a fraction of the screen's pixels and
   stretched by CSS: the "low res" is the point. */
.birdseye { position: fixed; inset: 0; height: 100dvh; z-index: 2200; background: var(--sky); overflow: hidden; }
.birdseye[hidden] { display: none; }
.birdseye-on #map, .birdseye-on .map-controls { visibility: hidden; }
.be-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.be-car { position: absolute; left: -20px; top: -20px; width: 40px; height: 40px; will-change: transform;
  fill: var(--info); stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; pointer-events: none; }
.be-car[hidden] { display: none; }
.be-bar { position: absolute; top: calc(10px + var(--safe-t)); left: 10px; display: flex; gap: 8px; align-items: flex-start; }
.be-bar.right { left: auto; right: 10px; flex-wrap: wrap; justify-content: flex-end; max-width: 60%; }
/* the count: the number large enough to read at a glance, what it counts in small under it */
.be-count { background: var(--panel); color: var(--text); border-radius: var(--r-md); padding: 5px 14px 6px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; line-height: 1.15; }
.be-count[hidden] { display: none; }
.be-count .be-num { font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.be-count small { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.be-bar .iconbtn { background: var(--panel); box-shadow: var(--shadow); }
.be-view { border: 0; height: 44px; padding: 0 18px; border-radius: var(--r-pill); cursor: pointer;
  background: var(--panel); color: var(--text); font: inherit; font-size: var(--fs-md); font-weight: 600;
  box-shadow: var(--shadow); }
.be-hint { position: absolute; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); margin: 0;
  background: var(--panel); color: var(--text); padding: 7px 14px; border-radius: var(--r-pill);
  font-size: var(--fs-md); box-shadow: var(--shadow); white-space: nowrap; }
.be-fps { flex-basis: 100%; text-align: right; margin: 0;
  background: var(--panel); color: var(--text); padding: 6px 10px; border-radius: var(--r-sm);
  font: var(--fs-xs) / 1.3 ui-monospace, monospace; }
.be-credit { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 3px 8px calc(3px + var(--safe-b));
  font-size: var(--fs-2xs); color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, transparent); }
.be-credit a { color: inherit; }
.be-hint[hidden], .be-fps[hidden] { display: none; }

/* ---------- legend chip ---------- */
.legend {
  position: fixed; left: 10px; bottom: calc(28px + var(--safe-b)); z-index: 1000;
  background: var(--panel); border-radius: var(--r-pill); padding: 7px 13px;
  display: flex; align-items: center; gap: 7px; font-size: var(--fs-sm);
  box-shadow: var(--shadow); color: var(--muted);
  max-width: calc(100vw - 92px);   /* never under the FAB column */
}
/* a class rule with display:flex outranks the UA's [hidden] { display: none }, so the model
   chip kept claiming a layer that was switched off */
.legend[hidden] { display: none; }
.legend .dot { width: 12px; height: 12px; border-radius: var(--r-xs); background: var(--spot); opacity: .85; }
.legend.prob { bottom: calc(64px + var(--safe-b)); }
.legend.finding { bottom: calc(100px + var(--safe-b)); }
/* Three dots rather than one: the layer now says two things at once, and a phone-width chip
   has room for a key but not for a legend. Tapping it opens the full key in the sheet. */
.legend.finding { gap: 3px; border: 0; font-family: inherit; cursor: pointer; }
.legend.finding > span:last-child { margin-left: 5px; }
.legend.finding .dot { border-radius: 50%; background: var(--finding); border: 1.5px solid var(--on-accent); }
.legend.finding .dot.gone { background: var(--cut-grey); }
.legend.finding .dot.none { background: transparent; border-color: var(--finding-unknown); border-style: dashed; }

/* 🚶 Kävelymatka (js/accesslayer.js): the eight minute bins, above the model's chips */
.legend.access { bottom: calc(136px + var(--safe-b)); border-radius: var(--r-md); padding: 5px 10px 4px;
                 flex-direction: column; align-items: stretch; gap: 2px; }
.legend.access .lbl { font-size: var(--fs-xs); }
.legend.access .key { display: flex; flex-direction: column; }
.legend.access .bins, .legend.access .ticks { display: grid; grid-template-columns: repeat(8, 34px); }
.legend.access .bins span { height: 9px; }
.legend.access .bins span:first-child { border-radius: var(--r-xs) 0 0 var(--r-xs); }
.legend.access .bins span:last-child { border-radius: 0 var(--r-xs) var(--r-xs) 0; }
.legend.access .ticks i { font-style: normal; font-size: var(--fs-2xs); text-align: center; }
/* 🌦 Olosuhteet nyt shares the chip: same eight columns, a longer label that may wrap */
.legend.cond .lbl { white-space: normal; max-width: 272px; }
/* while 🚶 is on the model's fill is ringed by outlines, and its chip says so */
.legend.prob.relief .grad { box-shadow: 0 0 0 1.5px #fff, 0 0 0 3px var(--relief); }
/* Animoi: breathes the model fill 0 → 100 → 0 % over the walking colours */
.legend.access .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legend.access .anim { font: inherit; font-size: var(--fs-xs); color: inherit; background: rgba(255,255,255,.14);
                       border: 1px solid rgba(255,255,255,.35); border-radius: var(--r-pill); padding: 1px 9px;
                       cursor: pointer; pointer-events: auto; }
.legend.access .anim[aria-pressed="true"] { background: #fff; color: var(--bg); }
/* car parks: a white P on a blue square, as in the prototype figures */
.pmark-icon .pmark { display: block; width: 100%; height: 100%; }
.pmark { background: var(--parking); color: #fff; font: 700 13px/18px system-ui, sans-serif; text-align: center;
         border: 1px solid #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.45); box-sizing: border-box;
         cursor: pointer; }
/* a finger is wider than the square: the tap area reaches 8 px past it on every side */
.leaflet-marker-icon.pmark-icon::before { content: ""; position: absolute; inset: -8px; }
.pmark.big { display: inline-block; width: 40px; height: 40px; font-size: 26px; line-height: 38px; border-radius: 7px; }

/* the full key, where there is vertical room for it */
.fkey { font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; margin: 2px 0 6px; }
.fkey div { display: flex; align-items: center; gap: 8px; }
.fdot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--on-accent); }
.fdot.ennallaan    { background: var(--finding); }
.fdot.epavarma     { background: var(--finding-suspect); }
.fdot.muuttunut    { background: var(--cut-grey); }
.fdot.ulkopuolella { background: transparent; border-color: var(--finding); border-width: 2px; }
.fdot.karkea       { background: transparent; border-color: var(--finding-unknown); border-style: dashed; }
.fdot.ei_tietoa    { background: color-mix(in srgb, var(--finding-unknown) 45%, transparent); }
.legend .grad { width: 34px; height: 12px; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--finding), var(--spot)); }
.note { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; margin: 4px 0 8px; }

/* ---------- seasonality chart ---------- */
.schart { display: block; width: 100%; height: auto; margin: 2px 0 0; touch-action: pan-y; }
.schart .sgrid { stroke: var(--border); stroke-width: 1; }
.schart .sgrid.base { stroke: var(--border-strong); }
.schart .sax { fill: var(--muted); font-size: 9px; font-family: inherit; }
/* where today sits in the season — a hairline and a whisper, never a fourth series */
.schart .sax.now { fill: var(--accent); }
.schart .snow { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
/* the hit target is the whole column, not the bar: a three-record week is 3 px of ink */
.schart .shit { fill: #fff; fill-opacity: 0; outline: 0; cursor: pointer; }
.schart .shit.on, .schart .shit:focus-visible { fill-opacity: .07; }
/* the readout the hovered column writes into — two lines of height are reserved, so the
   legend below it does not jump as the reader moves along the axis */
.sread { font-size: var(--fs-sm); line-height: 1.4; color: var(--text); margin: 4px 0 10px;
  min-height: 2.8em; }
.sread .sc { display: inline-flex; align-items: center; gap: 4px; margin-left: 11px;
  font-variant-numeric: tabular-nums; }
.sread .sc i { width: 9px; height: 9px; border-radius: var(--r-xs); }
.seas { font-size: var(--fs-sm); color: var(--muted); }
.srow { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 3px 0; }
.sdot { width: 11px; height: 11px; flex: 0 0 auto; border-radius: var(--r-xs); }
.srow .sname { color: var(--text); }
.srow .sval { margin-left: auto; color: var(--text); font-weight: 600;
  font-variant-numeric: tabular-nums; }
.srow .smeta { flex-basis: 100%; margin-left: 19px; font-size: var(--fs-sm); }

/* ---------- season outlook chart (js/panels/outlook.js): the seasonality chart's frame, as lines ---------- */
.schart .oline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* today's end of each line: a dot with a surface ring, so overlapping ends stay apart */
.schart .odot { stroke: var(--panel); stroke-width: 2; }
.schart .ocross { stroke: var(--muted); stroke-width: 1; }
.schart .ohit { fill: #fff; fill-opacity: 0; cursor: crosshair; }

/* ---------- sheets ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000;
  background: var(--panel); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-up);
  padding: 0 18px calc(18px + var(--safe-b));
  transform: translateY(105%); transition: transform .28s ease, visibility 0s linear .28s;
  max-height: 82dvh; overflow-y: auto;
  /* A closed sheet is hidden, not only moved off screen. On iOS a scrolling box that a transform
     has moved away can keep taking touches where it used to be, so after a long drawer
     (Pikavalinnat, Monta sientä) had been open, the first tap on the Sienitaso or Kartta button
     went to it and only the second opened anything. Hidden boxes are out of hit-testing and out
     of the tab order. The visibility switch waits for the slide-out to finish. */
  visibility: hidden; pointer-events: none;
}
.sheet.open { transform: translateY(0); visibility: visible; pointer-events: auto;
  transition: transform .28s ease, visibility 0s; }
.sheet.dragging { transition: none; }
/* The whole top bar of a sheet is its drag handle, and it stays pinned while the content
   scrolls, so a swipe down from the top always closes the sheet — gloves and all. */
.sheet .sheet-head {
  position: sticky; top: 0; z-index: 1; margin: 0 -18px 4px; padding: 10px 18px 8px;
  min-height: 34px; background: var(--panel); touch-action: none; cursor: grab;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.sheet .grab {
  width: 48px; height: 5px; border-radius: var(--r-xs); background: var(--handle); margin: 2px auto 10px;
}
.sheet h2 { font-size: var(--fs-2xl); margin: 0; display: flex; align-items: center; gap: 8px; }
.sheet h3 { font-size: var(--fs-sm); margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.sheet p { font-size: var(--fs-md); line-height: 1.5; color: var(--muted); margin: 6px 0; }
.sheet a { color: var(--accent); }
.sheet b { color: var(--text); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: var(--fs-lg); min-height: 48px; }
.row > label:not(.switch) { flex: 1; }
.row small { color: var(--muted); }
.row .val { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; text-align: right; }
input[type="range"] { width: 38vw; max-width: 230px; min-height: 44px; accent-color: var(--accent); }
.row > label:not(.switch) { min-width: 120px; }
.switch { position: relative; display: block; width: 46px; height: 26px; flex: 0 0 auto; cursor: pointer; }
.switch::before { content: ""; position: absolute; inset: -11px -8px; } /* 48 px hit area */
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--track); transition: .2s; cursor: pointer;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--knob); transition: .2s;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--on-accent); }

.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; border: 0; border-radius: var(--r-sm); padding: 9px 4px; font-size: var(--fs-md); min-height: 44px;
  background: var(--panel2); color: var(--muted); cursor: pointer;
}
.seg[hidden] { display: none; }
#accessSeg { margin: -2px 0 10px; }
.seg button.active { background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ---------- modals ---------- */
.modal {
  position: fixed; z-index: 2000; left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.94);
  width: min(340px, calc(100vw - 32px));
  background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 15px 15px 13px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal.wide { width: min(400px, calc(100vw - 32px)); max-height: 86dvh; overflow-y: auto; overflow-x: hidden; }
/* One slim, theme-tinted scrollbar for every scrolling panel: sheets, wide modals and the
   search results. Add a new scroller to this list, not its own CSS. */
.sheet, .modal.wide, .searchpanel ul {
  overscroll-behavior: contain; scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text) 25%, transparent) transparent; }
:is(.sheet, .modal.wide, .searchpanel ul)::-webkit-scrollbar { width: 6px; }
:is(.sheet, .modal.wide, .searchpanel ul)::-webkit-scrollbar-track { background: transparent; margin: 14px 0; }
:is(.sheet, .modal.wide, .searchpanel ul)::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text) 25%, transparent); border-radius: var(--r-xs); }
.modal .result-head { padding-right: 44px; }   /* clear of the close button */
.modal-close {
  position: absolute; top: 10px; right: 10px; border: 0; background: var(--panel2); color: var(--text);
  width: 40px; height: 40px; border-radius: 50%; font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal h3 {
  margin: 0 0 11px; font-size: var(--fs-sm); color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
}

/* ---------- species drawers (docs/plans/SPECIES_SELECTOR_PLAN.md §9) ----------
   Favourites (+) and the multi selection (stacked badge), opened from the Sienitaso badge row.
   One line per species, 48 px, and the whole line is the target: badge, name, season word, then
   the mark of its state (star / tick), so on and off read without the colour. */
.sheet h2 .spweek { font-size: var(--fs-md); font-weight: 400; color: var(--muted); }
/* the drawer's close button, top right like .modal-close; it returns to Sienitaso */
.sheet-close { flex: 0 0 auto; width: 40px; height: 40px; margin: 0 -6px 0 auto; border: 0; border-radius: 50%;
  background: var(--panel2); color: var(--text); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center; }
.sheet h2 .sheet-close .ic { width: 20px; height: 20px; }
.sheet .spcap { margin: 0 0 10px; font-size: var(--fs-sm); }
.spcap .ic { width: 1.1em; height: 1.1em; vertical-align: -.15em; }
.splist { display: flex; flex-direction: column; gap: 6px; }
.sp {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left;
  border: 0; border-radius: var(--r-md); padding: 4px 12px 4px 8px; cursor: pointer;
  background: var(--panel2); color: var(--text); font: inherit;
}
.sp.on { background: color-mix(in srgb, var(--accent) 18%, var(--panel2)); }
.sp .n { font-weight: 700; font-size: var(--fs-lg); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp .ss { margin-left: auto; flex: 0 0 auto; font-size: var(--fs-xs); color: var(--muted); }
.sp .ss.now { color: var(--good); }
.sp .ss.off { opacity: .7; }
.sp .mk { flex: 0 0 auto; display: flex; color: var(--muted); }
.sp .ss + .mk { margin-left: 4px; }
.sp .n + .mk, .sp .spnew + .mk { margin-left: auto; }
.sp .mk .ic { width: 24px; height: 24px; }
.sp.on .mk { color: var(--accent); }
.sp.on .mk .i-ok { stroke-width: 3; }
.sp:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.spnew { display: inline-block; flex: 0 0 auto; padding: 0 6px; border-radius: var(--r-pill);
  background: var(--info); color: var(--text); font-size: var(--fs-2xs); font-weight: 700; }
.spclear { display: block; width: 100%; min-height: 48px; margin-top: 12px; border: 0;
  border-radius: var(--r-md); background: transparent; color: var(--accent); font: inherit;
  font-weight: 700; cursor: pointer; }
.spclear:disabled { color: var(--muted); opacity: .6; cursor: not-allowed; }
/* the season mark on a badge: dot = kausi nyt, ring = alkaa pian, dimmed = ei kautta nyt.
   Three shapes, so it reads without the colour. */
.spb { position: relative; display: inline-flex; flex: 0 0 auto; }
.spb.now::after, .spb.soon::after { content: ""; position: absolute; right: -2px; top: -2px;
  width: 11px; height: 11px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid var(--panel2); }
.spb.now::after { background: var(--good); }
.spb.soon::after { background: var(--panel2); border: 2.5px solid var(--good); }
.spb.off .spi { opacity: .45; filter: grayscale(.7); }
.active .spb.now::after, .active .spb.soon::after { border-color: var(--accent); }
.sp.on .spb.now::after { border-color: color-mix(in srgb, var(--accent) 18%, var(--panel2)); }
.sp.on .spb.soon::after { background: color-mix(in srgb, var(--accent) 18%, var(--panel2)); }
.active .spb.soon::after { background: var(--accent); border-color: var(--good); }
/* the species switch, at the top of the Sienitaso sheet: thumb reach, one tap each */
.sprow { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px 10px; padding: 2px 18px 6px;
  scrollbar-width: none; }
.sprow::-webkit-scrollbar { display: none; }
.sprow button { flex: 0 0 auto; width: 56px; height: 56px; border: 0; border-radius: var(--r-md);
  background: var(--panel2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sprow button.active { background: var(--accent); }
.sprow .spi { width: 44px; height: 44px; }

/* ---------- multi-species mode (docs/plans/SPECIES_SELECTOR_PLAN.md §5–§8) ----------
   The stacked-badge glyph (#i-stack) fills its front discs with --stack-fill so they hide the disc
   behind them on whatever surface it sits on. */
.sprow button.multi .ic { width: 40px; height: 40px; --stack-fill: var(--panel2); color: var(--text); }
.sprow button.multi.active .ic { --stack-fill: var(--accent); }
/* the multi button wearing its selection: the map's cluster mark, and a small + past three
   or on a single badge, which would otherwise look like a species button */
.sprow button.multi { position: relative; }
.sprow button.multi .mbadge { cursor: inherit; }
.sprow button.multi .mmore { position: absolute; right: 2px; bottom: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--text); color: var(--panel2); z-index: 10;
  display: flex; align-items: center; justify-content: center; }
.sprow button.multi .mmore .ic { width: 12px; height: 12px; stroke-width: 3; color: inherit; }
.sprow button.add .ic { width: 28px; height: 28px; color: var(--text); }
.legend.multi .ic { width: 18px; height: 18px; }
.legend.multi .grad[hidden] { display: none; }
.result-head .big .ic.i-stack { width: 40px; height: 40px; }
/* one mark per map cell: up to three species' own discs as a tight cluster, best first, no "+n"
   (docs/MULTI_BADGE_STUDY.md, draft H; the layout is CLUSTER in js/layers/multilayer.js, which
   sets each mini's place and size) */
/* staging only: forest listings for sale (js/panels/listings.js). A chip with the asking €/ha
   on the parcel, a dot when zoomed out; the outline itself takes no taps. */
.leaflet-marker-icon.tila-chip-icon, .leaflet-marker-icon.tila-dot { background: none; border: 0; }
.tila-chip { position: absolute; transform: translate(-50%, -50%); display: inline-flex; align-items: center;
  gap: 4px; white-space: nowrap; padding: 3px 8px; border-radius: var(--r-pill); cursor: pointer;
  background: var(--panel); color: var(--text); border: 1.5px solid var(--info); box-shadow: var(--shadow-s);
  font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; }
.tila-chip.point { border-style: dashed; }
.tila-chip .ic { width: 12px; height: 12px; color: var(--info); }
.tila-dot { border-radius: 50%; background: var(--info); outline: 1.5px solid var(--text); cursor: pointer; }
.tila-cluster { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; color: var(--muted); font-size: var(--fs-sm); }
.leaflet-marker-icon.mbadge-icon { background: none; border: 0; }
.leaflet-marker-icon.mbadge-icon::before { content: ""; position: absolute; left: 50%; top: 50%;
  width: max(100%, 48px); height: max(100%, 48px); transform: translate(-50%, -50%); }   /* ≥ 48 px to tap */
.mbadge { position: relative; display: block; cursor: pointer; }
.mbadge .mb { position: absolute; border-radius: 50%; box-shadow: var(--shadow-s);
  outline: 1.5px solid var(--on-forest); }
.mbadge .spi { display: block; width: 100%; height: 100%; }
/* out of season: dimmed like the badge row's badges, never hidden, per species */
.mbadge .mb.off .spi { opacity: .5; filter: grayscale(.7); }
.checks .c.off { opacity: .6; }
.checks .k .spi.inline { margin-right: .3em; }
.checks .k small { font-size: var(--fs-xs); }

/* ---------- result card ---------- */
.result-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.result-head .big { font-size: 30px; }
.result-head .verdict { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.25; }
.result-head .sub { font-size: var(--fs-sm); color: var(--muted); }
.warn {
  margin: 10px 0 2px; padding: 10px 12px; border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 13%, transparent); border-left: 3px solid var(--accent);
  font-size: var(--fs-sm); line-height: 1.5; color: var(--muted);
}
.warn b { color: var(--text); }
.checks { margin: 8px 0 4px; }
.checks .c { display: flex; align-items: baseline; gap: 9px; padding: 7px 0; font-size: var(--fs-lg); border-bottom: 1px solid var(--border);
               flex-wrap: wrap; }
.checks .c:last-child { border-bottom: 0; }
.checks .mark { width: 20px; text-align: center; flex: 0 0 auto; }
.checks .ok { color: var(--good); }
.checks .no { color: var(--bad); }
.checks .meh { color: var(--muted); }
.checks .k { color: var(--muted); }
.checks .v { margin-left: auto; text-align: right; font-weight: 600;
             min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
/* 🚶 the walking times: one sentence beside its mark, never pushed onto a line of its own */
.checks .c.walk { flex-wrap: nowrap; }
.checks .c.walk .k { color: var(--text); min-width: 0; }
/* a row whose value is a sentence, not a number: it gets its own line under the label */
.checks .c.wide { flex-wrap: wrap; }
.checks .c.wide .v {
  flex: 1 0 calc(100% - 29px); margin: 3px 0 0 29px; text-align: left;
  font-weight: 400; font-size: var(--fs-md); line-height: 1.45; color: var(--text);
}
/* secondary detail the card keeps one tap away instead of in the reader's face */
.more { margin: 8px 0 0; }
.more summary { cursor: pointer; color: var(--accent); font-size: var(--fs-md); font-weight: 600;
  padding: 10px 0; list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: "▸ "; }
.more[open] summary::before { content: "▾ "; }
.navlink {
  display: block; text-align: center; margin-top: 14px; padding: 15px;
  background: var(--panel2); border-radius: var(--r-md); color: var(--accent);
  text-decoration: none; font-weight: 700; font-size: var(--fs-lg);
}
button.navlink { width: 100%; border: 0; font-family: inherit; cursor: pointer; }
.note.legal { text-align: center; margin-top: 10px; }
.howto .c { align-items: center; flex-wrap: nowrap; }
.howto .mark { width: 28px; display: inline-flex; justify-content: center; }
.howto .k { color: var(--text); font-size: var(--fs-md); }
.howto .spi.inline, .howto .mi { width: 26px; height: 26px; margin: 0; }

/* ---------- account (paid site) ---------- */
.upsell {
  display: block; width: 100%; margin-top: 14px; padding: 12px; border: 0; border-radius: var(--r-md);
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; font-size: var(--fs-lg); cursor: pointer;
}
.plans { display: flex; gap: 8px; margin: 8px 0; }
.plan {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center;
  border: 0; border-radius: var(--r-md); padding: 10px 12px; background: var(--accent);
  color: var(--on-accent); font-size: var(--fs-md); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .08s, filter .15s;
}
.plan:hover { filter: brightness(1.08); }
.plan:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.plan span { font-weight: 800; font-size: var(--fs-xl); }
.plan small { color: var(--on-accent); opacity: .75; font-size: var(--fs-sm); }
.plan:disabled, .login button:disabled { opacity: .5; }
.login { display: flex; gap: 6px; flex-wrap: wrap; }
.login .ts { flex-basis: 100%; }
/* the email step before Stripe (js/core/account.js emailStepHTML) */
.plan-pick { margin: 8px 0 12px; }
.plan-pick button b { color: inherit; }
.field-label { display: block; font-weight: 700; font-size: var(--fs-md); margin: 0 0 6px; }
.note.steps { padding-left: 18px; margin-top: 10px; }
.note.steps li { margin-bottom: 4px; }
.login input {
  flex: 1 1 180px; min-width: 0; border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 9px 10px;
  background: var(--panel2); color: var(--text); font-size: var(--fs-lg);
}
.login button {
  border: 0; border-radius: var(--r-sm); padding: 9px 12px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: var(--fs-md); cursor: pointer;
}
#legendProb { cursor: pointer; }
/* the chip's quick slider (js/layers/problayer.js initProbQuick): the sheet's "Näytä parhaat"
   right above the chip, so the share can be tried against the map without a sheet covering it.
   A chip itself (pill, .legend's side padding) holding only the slider: the chip under it already
   reads "parhaat X %" and follows the drag, so a label and a value would only narrow the slider.
   The height is the range's own 44 px touch target, with no padding on top of it. */
.qpop {
  position: fixed; left: 10px; bottom: calc(100px + var(--safe-b)); z-index: 1001;
  background: var(--panel); border-radius: var(--r-pill); padding: 0 13px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; font-size: var(--fs-sm); color: var(--muted);
  width: calc(100vw - 92px); max-width: 340px; box-sizing: border-box;
}
.qpop[hidden] { display: none; }
.qpop input[type="range"] { width: 100%; max-width: none; margin: 0; }
/* the locked account's offer line makes it two rows, too tall for a pill */
.qpop:has(.note:not([hidden])) { border-radius: var(--r-md); }
.qpop .note { margin: 0 0 8px; }

/* ---------- toast ----------
   Under the top bar, not at the bottom: there it covered the legend chips and the Paikanna button,
   the very things a hint is often about, and an open sheet hid it. */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(70px + var(--safe-t)); z-index: 3000;
  background: color-mix(in srgb, var(--bg) 94%, transparent); color: var(--text);
  padding: 10px 18px; border-radius: var(--r-pill); font-size: var(--fs-md);
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .3s;
  width: max-content; max-width: 86vw; text-align: center;
  display: flex; align-items: center; gap: 9px;
}
.toast.on { opacity: 1; }

/* ---------- GPS marker ---------- */
.gps-dot { position: relative; }
.gps-dot .core {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--info); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5);
}
.gps-dot .pulse {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 16px; height: 16px; border-radius: 50%; background: color-mix(in srgb, var(--info) 50%, transparent);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { transform: translate(-50%,-50%) scale(1); opacity: .8; }
  100% { transform: translate(-50%,-50%) scale(3.4); opacity: 0; }
}

.leaflet-control-attribution { font-size: 9.5px !important; background: rgba(255,255,255,.75) !important; }
.backdrop { position: fixed; inset: 0; z-index: 1500; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .25s; }
.backdrop.on { opacity: 1; pointer-events: auto; }

/* ---------- first-visit walkthrough (js/panels/intro.js) ----------
   Above the sheets and FABs, below the toast. The root takes every tap, so the map and the
   buttons cannot be used half-way through; the ring's own shadow is the dimming. */
.intro { position: fixed; inset: 0; z-index: 2500; }
.intro-ring {
  position: fixed; pointer-events: none; transition: all .25s ease;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 200vmax color-mix(in srgb, var(--bg-deep) 72%, transparent);
}
.intro.free { background: color-mix(in srgb, var(--bg-deep) 55%, transparent); }
.intro.free .intro-ring { display: none; }
.intro-bubble {
  position: fixed; left: 50%; width: min(340px, calc(100vw - 32px));
  background: var(--panel); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 14px 16px 12px;
}
.intro-count { font-size: var(--fs-xs); color: var(--muted); }
.intro-bubble h3 { margin: 2px 0 4px; font-size: var(--fs-xl); }
.intro-bubble p { margin: 0 0 12px; font-size: var(--fs-md); line-height: 1.45; color: var(--muted); }
.intro-btns { display: flex; justify-content: flex-end; gap: 8px; }
.intro-btns button {
  border: 0; border-radius: var(--r-pill); padding: 10px 16px; min-height: 44px; cursor: pointer;
  font: inherit; font-size: var(--fs-md); font-weight: 700;
}
.intro-btns .skip { background: transparent; color: var(--muted); }
.intro-btns .next { background: var(--accent); color: var(--on-accent); }
.intro-btns .next:disabled { opacity: .5; cursor: not-allowed; }
/* the "Mitä sieniä etsit?" step: a badge per species, lit when chosen */
.intro-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 12px;
  max-height: 46vh; overflow-y: auto; }
/* display:grid outranks the UA's [hidden], so the badges stayed on every later step */
.intro-pick[hidden] { display: none; }
.intro-pick button { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  border: 2px solid transparent; border-radius: var(--r-md); padding: 6px 2px; cursor: pointer;
  background: var(--panel2); color: var(--muted); font: inherit; font-size: var(--fs-2xs); }
.intro-pick button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.intro-pick button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.intro-pick button[aria-pressed="false"] .spi { opacity: .5; }
.intro-pick .spi { width: 40px; height: 40px; }
