/* Layout: sticky control bar, then form column + side panel (spec check / data record); stacks on phones. */
:root {
  --bg: #f3f6f8;          /* snow-light grey with a cold bias */
  --surface: #ffffff;
  --ink: #14232e;          /* deep slate */
  --muted: #5a6b77;
  --line: #d5dee5;
  --accent: #0b6a8a;       /* glacier blue */
  --accent-ink: #ffffff;
  --accent-soft: #e1eff5;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --ok: #2e7d4f;
  --ok-soft: #e2f3e8;
  --f-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0e171d; --surface: #15222b; --ink: #e3ecf1; --muted: #93a6b3; --line: #2a3a46;
  --accent: #5cc3e6; --accent-ink: #062330; --accent-soft: #163543;
  --warn: #f0b860; --warn-soft: #33270f; --bad: #ff8a80; --bad-soft: #3a1a18; --ok: #7fd3a0; --ok-soft: #12301f;
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0e171d; --surface: #15222b; --ink: #e3ecf1; --muted: #93a6b3; --line: #2a3a46;
  --accent: #5cc3e6; --accent-ink: #062330; --accent-soft: #163543;
  --warn: #f0b860; --warn-soft: #33270f; --bad: #ff8a80; --bad-soft: #3a1a18; --ok: #7fd3a0; --ok-soft: #12301f;
  color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line);
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.bar-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.brand { display: flex; flex-direction: column; margin-right: auto; }
.brand h1 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.brand h1 .beta { display: inline-block; vertical-align: 3px; margin-left: 4px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
/* Intro text under the title, broken into two lines so it stays left of the Kartta / Uusi havainto buttons */
.bar .sub { color: var(--muted); font-size: 12px; line-height: 1.4; }
.bar .sub a { color: var(--accent); }
.ctl { display: flex; flex-direction: column; gap: 2px; }
.ctl > span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 5px 11px; cursor: pointer; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
select.small { padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13px; }

.wrap { max-width: 1240px; margin: 0 auto; padding-block: 20px 60px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .wrap { grid-template-columns: minmax(0, 1fr); } }

.banner { grid-column: 1 / -1; background: var(--accent-soft); border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; }
.banner b { font-weight: 600; }

form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.sec-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sec-h h2 { font-size: 16px; font-weight: 700; margin-right: auto; }
.tag { font-family: var(--f-mono); font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.expert { color: var(--accent); border-color: var(--accent); }
.sec-b { padding: 14px 16px; display: flex; flex-direction: column; gap: 16px; }
.inst { display: flex; flex-direction: column; gap: 14px; }
.inst + .inst { border-top: 1px dashed var(--line); padding-top: 14px; }
.inst-h { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.empty-sec { color: var(--muted); font-size: 13.5px; padding: 12px 16px; }
.empty-sec code { font-family: var(--f-mono); font-size: 12.5px; }

.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld > label, .fld > .lbl { font-weight: 600; font-size: 14px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.req { color: var(--bad); font-weight: 700; }
.fid { font-family: var(--f-mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.help { font-size: 12.5px; color: var(--muted); }
.info-btn { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--accent); background: transparent; color: var(--accent);
  font: italic 700 12px/1 Georgia, serif; padding: 0; cursor: pointer; align-self: center; flex: none; }
.info-btn[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); }
.info-box { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; font-weight: 400; }
.info-box p { margin: 0; } .info-box p + dl { margin-top: 8px; }
.info-box dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.info-box dt { font-weight: 600; } .info-box dd { margin: 0; }
@media (max-width: 520px) { .info-box dl { grid-template-columns: 1fr; } .info-box dd { margin-bottom: 6px; } }
.sec-h h2 .info-btn { vertical-align: 2px; margin-left: 4px; }
.type-pick { grid-column: 1 / -1; max-width: 820px; width: 100%; margin: 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.type-pick .seg button { padding: 8px 16px; font-size: 14px; font-weight: 600; }
.err { font-size: 12.5px; color: var(--bad); }
.fld.invalid input, .fld.invalid select, .fld.invalid textarea { border-color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface); width: 100%; max-width: 100%; }
textarea { min-height: 76px; resize: vertical; }
.num { display: flex; align-items: center; gap: 8px; max-width: 220px; }
.num input { font-variant-numeric: tabular-nums; }
.num .neg { flex: none; min-width: 40px; height: 40px; padding: 0; font-size: 18px; border: 1px solid var(--line, #ccc); border-radius: 6px; background: var(--bg, #fff); color: inherit; cursor: pointer; }
.num .neg { font-size: 22px; font-weight: 700; }
.num .neg[aria-pressed="true"] { background: var(--accent, #0b6a8a); color: #fff; border-color: var(--accent, #0b6a8a); }
.unit { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.icons { display: flex; flex-wrap: wrap; gap: 8px; }
.ico { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 84px; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font-size: 12px; text-align: center; line-height: 1.2; }
.ico[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ico svg { width: 36px; height: 36px; }
.ico:not(:has(svg)) { justify-content: center; min-height: 56px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.point { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.point .full { grid-column: 1 / -1; }
.coords { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); grid-column: 1 / -1; font-variant-numeric: tabular-nums; }
.map-slot { height: 360px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.map-el { width: 100%; height: 100%; }
.layers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.layers .lbl-sm { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.layers .chip { padding: 4px 10px; font-size: 12.5px; }
.layers .chip:disabled { opacity: .5; cursor: not-allowed; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 14px; border-radius: 2px; display: inline-block; opacity: .75; border: 1px solid var(--line); }
.legend .help { font-family: var(--f-body); }
.legend .lbl-sm { font-family: var(--f-body); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.terrain-legend .help { flex-basis: 100%; }
.note { font-size: 13px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r); padding: 10px 12px; }

.rose-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.rose { width: 150px; height: 150px; }
.rose path { fill: var(--bg); stroke: var(--line); stroke-width: 1; cursor: pointer; }
.rose path.on { fill: var(--accent); }
.rose text { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); pointer-events: none; }
.rose text.on { fill: var(--accent-ink); }
.elev { display: flex; flex-direction: column; gap: 6px; }

.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }

.tbl-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; min-width: 100%; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 4px 6px; white-space: nowrap; }
table.grid td { padding: 4px 6px; vertical-align: top; }
table.grid input, table.grid select { padding: 5px 7px; min-width: 90px; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 12px; cursor: pointer; font-size: 13.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 11px 18px; font-size: 15px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.sum { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12.5px; }
.sum span { padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.sum .e { background: var(--bad-soft); color: var(--bad); } .sum .w { background: var(--warn-soft); color: var(--warn); } .sum .i { background: var(--bg); color: var(--muted); }
pre.json { font-family: var(--f-mono); font-size: 12px; margin: 0; white-space: pre-wrap; word-break: break-word; }

.result { background: var(--ok-soft); border: 1px solid var(--ok); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.result h3 { font-size: 16px; }
.card dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; font-size: 13.5px; }
.card dt { color: var(--muted); } .card dd { margin: 0; }
.card h4 { margin: 8px 0 4px; font-family: var(--f-display); font-size: 14px; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

/* navigation */
.nav { display: inline-flex; gap: 4px; }
.nav button { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 14px; }
.nav button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* photos in the form */
.photos .ph { position: relative; }
.photos .ph button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }

/* observer block + honeypot */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.form-msg-ok { color: var(--ok); }

/* map view */
.mv { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .mv { grid-template-columns: minmax(0, 1fr); } }
.mv-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mv-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.mv-tools .grow { margin-left: auto; }
.mv-map { height: calc(100vh - 210px); min-height: 380px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
@media (max-width: 900px) { .mv-map { height: 62vh; } }
.mv-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); max-height: calc(100vh - 130px); overflow: auto; }
@media (max-width: 900px) { .mv-list { max-height: none; } }
.mv-list h2 { font-size: 15px; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.obs-item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 10px 14px; cursor: pointer; }
.obs-item:hover, .obs-item[aria-current="true"] { background: var(--accent-soft); }
.obs-item b { font-size: 14px; }
.obs-item .meta { font-size: 12.5px; color: var(--muted); }
.obs-item .sum { font-size: 13px; }
.mv-empty { padding: 16px 14px; color: var(--muted); font-size: 13.5px; }
.age-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); align-items: center; }
.age-legend span { display: inline-flex; align-items: center; gap: 4px; }
.age-legend svg { filter: drop-shadow(0 0 .5px rgba(0,0,0,.5)); }
.toast { background: var(--ok-soft); border: 1px solid var(--ok); border-radius: var(--r); padding: 8px 12px; font-size: 14px; }
.toast.bad { background: var(--bad-soft); border-color: var(--bad); }
.op { grid-column: 1 / -1; width: 100%; max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.op-h { font-size: 21px; }
.op .meta { color: var(--muted); font-size: 13.5px; }
.op-map { height: 280px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.op-loc { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; font-size: 13.5px; }
.op-loc dt { color: var(--muted); } .op-loc dd { margin: 0; font-variant-numeric: tabular-nums; }
.op .card h4 { font-size: 15px; margin: 14px 0 4px; }
.op .thumbs img { width: 150px; height: 150px; }
@media (max-width: 520px) { .op .thumbs { display: grid; grid-template-columns: 1fr 1fr; } .op .thumbs img { width: 100%; height: auto; aspect-ratio: 1; } }
a.obs-item { color: inherit; text-decoration: none; }
.obs-tip { pointer-events: none; }
.obs-tip .maplibregl-popup-content { background: var(--surface); color: var(--ink); font-family: var(--f-body); font-size: 13px; line-height: 1.4;
  padding: 8px 11px; border-radius: var(--r); box-shadow: 0 3px 14px rgba(0,0,0,.22); display: flex; flex-direction: column; gap: 2px; }
.obs-tip b { font-size: 14px; }
.obs-tip .tip-img { display: block; width: 240px; max-width: 100%; max-height: 170px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; background: var(--line); }
.obs-tip .meta { color: var(--muted); font-size: 12.5px; }
.obs-tip .more { color: var(--accent); font-size: 12px; margin-top: 2px; }
.obs-tip.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .obs-tip.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .obs-tip.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.obs-tip.maplibregl-popup-anchor-top .maplibregl-popup-tip, .obs-tip.maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .obs-tip.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.obs-tip.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.obs-tip.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
@media (max-width: 600px) { .bar .sub { font-size: 11px; } .bar .sub br { display: none; } .bar { padding-block: 8px; position: static; } } /* phones: the taller header scrolls away instead of covering the screen */
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs img { width: 92px; height: 92px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); display: block; }
.acct { display: flex; gap: 4px; align-items: center; }
.acct a { font-weight: 600; font-size: 14px; color: var(--accent); text-decoration: none; padding: 7px 10px; border-radius: var(--r); }
.acct a:hover { background: var(--accent-soft); }
.acct a.who { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.btn { text-decoration: none; display: inline-block; }
.auth { grid-column: 1 / -1; width: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .intro { margin: 0; color: var(--muted); font-size: 13.5px; }
.auth .links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; }
.auth .links a { color: var(--accent); }
.signin-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.flake-mk svg { width: 34px; height: 34px; display: block; }
.otype { color: var(--accent); font-weight: 600; }
.banner.pelastus { background: #fff4d6; border: 1px solid #e8c766; margin-bottom: 14px; }
.banner.pelastus a { color: inherit; font-weight: 600; }
.banner.pelastus { background: #fff4d6; border: 1px solid #e8c766; margin-bottom: 14px; }
.banner.pelastus a { color: inherit; font-weight: 600; }
.op-top { display: flex; justify-content: space-between; gap: 8px; }
.banner.editing { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 820px; width: 100%; margin: 0 auto; }
.banner.editing .btn { margin-left: auto; }

/* Analytics consent banner (consent.js) */
.consent { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1000; width: min(640px, calc(100% - 24px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 6px 24px rgba(0,0,0,.18);
  padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.consent p { margin: 0; flex: 1 1 300px; line-height: 1.45; }
.consent-btns { display: flex; gap: 8px; margin-left: auto; }
.consent-btns .btn.primary { padding: 7px 14px; font-size: 14px; }
