/* Corpus — layout, controls, panel, map states */

body { display: grid; grid-template-rows: auto 1fr; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; min-height: 60px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand-name { font-family: var(--serif); font-style: italic; font-size: 25px; letter-spacing: 0.005em; }
.brand-sub { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }

.search { position: relative; flex: 1 1 320px; max-width: 440px; margin-left: auto; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 38px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper-2);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  list-style: none; padding: 6px; max-height: min(60vh, 460px); overflow: auto;
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow);
}
#search-results li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 9px; cursor: pointer;
}
#search-results li[aria-selected="true"], #search-results li:hover { background: var(--paper-3); }
#search-results .r-name { font-weight: 550; }
#search-results .r-name mark { background: none; color: var(--sel); }
#search-results .r-meta { font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; }
#search-results .r-empty { color: var(--ink-3); cursor: default; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; flex: none;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper-2);
}
.seg button {
  padding: 6px 13px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.seg button:focus-visible { border-radius: 999px; }
.modes button[data-mode="hurt"][aria-checked="true"] { background: var(--sel); color: #fff; }
.modes .short { display: none; }

.icon-btn {
  height: 40px; min-width: 40px; padding: 0 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--paper-2); color: var(--ink-2);
  font-size: 13.5px;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn[aria-expanded="true"], .icon-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
/* Settings (cog): a small sheet of segmented switches under the top bar */
.settings-wrap { position: relative; flex: none; }
.settings {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 45; width: max-content; max-width: calc(100vw - 32px);
  padding: 14px 16px 16px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--paper-2);
  box-shadow: var(--shadow); display: grid; gap: 12px;
}
.settings h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.setting { display: grid; gap: 5px; }
.setting-label { font-size: 12px; color: var(--ink-3); }
.settings .seg { justify-self: start; } /* natural width, however wide the Offline note makes the sheet */
.settings .seg button { padding: 5px 12px; font-size: 13px; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.offline { max-width: 290px; padding-top: 10px; border-top: 1px solid var(--line); }
.offline-note { font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.offline-save {
  justify-self: start; margin-top: 3px; padding: 6px 13px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--paper); color: var(--ink); font-size: 13px;
}
.offline-save:hover { border-color: var(--ink-3); }
.offline-save:disabled { color: var(--ink-3); cursor: progress; }
/* Ko-fi support link: Ko-fi blue, dark text for contrast */
.kofi { background: #72a4f2; border-color: #72a4f2; color: #0f1e36; font-weight: 600; text-decoration: none; }
.kofi:hover { background: #8bb5f5; border-color: #8bb5f5; color: #0f1e36; }
@media (max-width: 1280px) { .kofi .label { display: none; } .kofi { padding: 0; } }

/* ---------------------------------------------------------------- stage */
.stage {
  position: relative; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 36vw, 460px);
}
.map-wrap {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(ellipse 60% 55% at 50% 42%, var(--paper-2), var(--paper) 75%);
}
#map {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
#map.dragging { cursor: grabbing; }
/* the 3D view (js/model3d.js): a canvas in the same place; the map's background shows through it */
.model3d {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab; outline: none;
}
.model3d[hidden], #map[hidden] { display: none; }
.model3d:active { cursor: grabbing; }
.model3d:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.model-status {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 4; margin: 0;
  max-width: calc(100% - 220px); width: max-content; text-align: center;
  font-size: 13px; color: var(--ink-2); background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); pointer-events: none;
}
.model-credit {
  position: absolute; right: 14px; bottom: 12px; z-index: 4; margin: 0;
  font-size: 11px; color: var(--ink-3);
}
.model-credit a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 2px; }
.model-credit a:hover { color: var(--ink-2); }

.layerbar {
  /* one column down the left edge, so every layer reads at a glance and none is cut off; the toggle above it
     collapses it to icons (desktop) or opens it as a menu (phones) */
  position: absolute; top: 14px; left: 14px; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: max-content;
}
.layer-list { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.layer-toggle, .layer-chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px 0 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-size: 13px; color: var(--ink-2);
}
.layer-toggle { height: 30px; padding: 0 11px 0 9px; font-size: 12px; color: var(--ink-3); border-style: dashed; }
.layer-toggle:hover { color: var(--ink); border-color: var(--ink-3); }
.layer-toggle svg { flex: none; }
/* the disc around each icon carries the state: filled in focus, tinted for context, an outline when off */
.layer-chip .sw {
  flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, currentColor 45%, transparent);
}
.layer-chip[data-state="active"] { color: var(--ink); border-color: var(--ink); }
.layer-chip[data-state="active"] .sw { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.layer-chip[data-state="context"] { color: var(--ink); }
.layer-chip[data-state="context"] .sw { background: color-mix(in srgb, var(--ink) 16%, transparent); border-color: color-mix(in srgb, var(--ink) 50%, transparent); }
.layer-chip[data-state="off"] { color: var(--ink-3); }
.layer-chip[data-state="na"] { color: var(--ink-3); opacity: 0.45; cursor: not-allowed; border-style: dashed; }
.layer-chip[data-state="na"]:hover { border-color: var(--line-2); }
.layer-chip:hover { border-color: var(--ink-3); }
/* collapsed (desktop): icons only; the names stay for screen readers */
.layerbar[data-collapsed="true"] .layer-chip { width: 36px; height: 36px; padding: 0; justify-content: center; }
.layerbar[data-collapsed="true"] :is(.layer-chip, .layer-toggle) .name {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.layerbar[data-collapsed="true"] .layer-toggle { width: 36px; padding: 0; justify-content: center; }

.side-label {
  position: absolute; top: 44%; z-index: 4; width: 64px;
  display: grid; justify-items: center; gap: 1px; text-align: center;
  color: var(--ink-3); pointer-events: none;
}
.side-label b { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1; color: var(--ink-2); }
.side-label small { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1.3; }
.side-label.l { left: 10px; }
/* clear of the layer column beside it: past the names, or past the icons when collapsed */
.layerbar ~ .side-label.l { left: 156px; }
.layerbar[data-collapsed="true"] ~ .side-label.l { left: 60px; }
.side-label.r { right: 10px; }

.map-controls {
  position: absolute; left: 14px; bottom: 16px; z-index: 5;
  display: flex; flex-direction: column; gap: 6px;
}
.map-controls .group {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-2); border-radius: 12px; background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.map-controls .group button { width: 40px; height: 38px; display: grid; place-items: center; color: var(--ink-2); }
.map-controls .group button + button { border-top: 1px solid var(--line); }
.map-controls .group button:hover { color: var(--ink); background: var(--paper-3); }
.map-controls .group button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.map-controls .group button:disabled { color: var(--ink-3); opacity: 0.45; cursor: not-allowed; background: none; }

.map-hint {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4;
  font-size: 12.5px; color: var(--ink-3); background: color-mix(in srgb, var(--paper-2) 85%, transparent);
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap;
  transition: opacity 0.4s;
}
.map-hint.gone { opacity: 0; pointer-events: none; }
.hurt-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 6;
  background: var(--sel); color: #fff; font-size: 13px; padding: 7px 14px; border-radius: 999px;
  box-shadow: var(--shadow); white-space: nowrap;
}

.tooltip {
  position: absolute; z-index: 8; pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink); color: var(--paper);
  font-size: 12.5px; line-height: 1.3; padding: 5px 9px; border-radius: 7px; white-space: nowrap;
  box-shadow: var(--shadow);
}
.tooltip .tt-sub { opacity: 0.7; margin-left: 6px; }

/* ---------------------------------------------------------------- browse drawer */
.browse {
  position: absolute; top: 0; bottom: 0; left: 0; z-index: 15;
  width: min(340px, 88vw); overflow: auto;
  background: var(--paper-2); border-right: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 16px 14px 40px;
}
.browse h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 4px 6px 12px; }
.browse details { margin: 2px 0; }
.browse summary {
  cursor: pointer; list-style: none; padding: 6px 8px; border-radius: 8px;
  display: flex; align-items: center; gap: 8px; font-weight: 550;
}
.browse summary::-webkit-details-marker { display: none; }
.browse summary::before { content: "›"; display: inline-block; width: 10px; color: var(--ink-3); transition: transform 0.15s; }
.browse details[open] > summary::before { transform: rotate(90deg); }
.browse summary:hover { background: var(--paper-3); }
.browse .count { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.browse ul { list-style: none; padding-left: 18px; }
.browse li button {
  width: 100%; text-align: left; padding: 5px 8px; border-radius: 7px; font-size: 14px; color: var(--ink-2);
  display: flex; gap: 8px; align-items: baseline;
}
.browse li button:hover { background: var(--paper-3); color: var(--ink); }
.browse li button .muted { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.browse .group-link { font-size: 12.5px; color: var(--rel); padding: 4px 8px; }

/* ---------------------------------------------------------------- panel */
.panel {
  position: relative; min-height: 0; overflow: auto; overscroll-behavior: contain;
  background: var(--paper-2); border-left: 1px solid var(--line);
}
.sheet-handle { display: none; }
.panel-inner { padding: 24px 26px 48px; }

.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.crumb:hover { color: var(--ink); }
.eyebrow { font-family: var(--serif); font-size: 14.5px; font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--ink-3); }
.eyebrow button { letter-spacing: inherit; font-variant-caps: inherit; color: inherit; }
.eyebrow button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.title { font-family: var(--serif); font-size: 31px; line-height: 1.1; font-weight: 600; margin: 6px 0 4px; text-wrap: balance; }
.subline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.subline .latin { font-size: 16.5px; }
.aka { font-size: 13px; color: var(--ink-3); }

.side-switch { margin: 14px 0 2px; }
.side-switch .seg button { padding: 4px 12px; font-size: 13px; }
.side-note { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }

.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 18px; }
.fact { padding: 6px 10px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.25; }
.fact b { display: block; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }

.summary { font-size: 17px; line-height: 1.58; color: var(--ink); }
.note-card {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--rel-soft); border: 1px solid color-mix(in srgb, var(--rel) 35%, transparent); font-size: 14px;
}

.section { margin-top: 26px; }
.section > h3 {
  font-family: var(--serif); font-size: 15px; font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--ink-3);
  font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.section > h3 .n { font-family: var(--sans); font-size: 12px; font-weight: 400; letter-spacing: 0; font-variant-caps: normal; }

.show-layer {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 13px; color: var(--rel); text-decoration: underline; text-underline-offset: 3px;
}
.show-layer::before { content: "+"; font-weight: 700; text-decoration: none; }
.show-layer:hover { color: var(--ink); }
.section-note { font-size: 12.5px; color: var(--ink-3); margin: -4px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper);
  font-size: 13.5px; line-height: 1.3; text-align: left; color: var(--ink);
  transition: background 0.12s, border-color 0.12s;
}
.chip:hover, .chip:focus-visible { border-color: var(--rel); background: var(--rel-soft); }
.chip .side { font-size: 11.5px; color: var(--ink-3); }
/* "female" / "male" tag on sex-specific text while no biological sex is chosen */
.sex-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border: 1px solid var(--line-2); border-radius: 999px; font-family: var(--sans); font-size: 11px; font-weight: 500; line-height: 17px; letter-spacing: 0.02em; color: var(--ink-3); vertical-align: 1px; white-space: nowrap; }
.chip-range { border-style: dashed; }
.chip .jdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.conn { list-style: none; }
.conn > li { padding: 11px 0; border-top: 1px solid var(--line); display: grid; gap: 7px; }
.conn > li:first-child { border-top: 0; padding-top: 2px; }
.conn .jhead { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.conn .jlink { font-weight: 600; text-align: left; display: inline-flex; align-items: center; gap: 7px; }
.conn .jlink:hover { color: var(--rel); }
.conn .jtype { font-size: 12.5px; color: var(--ink-3); }
.jdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--j-synovial); }
.jdot[data-c="cartilaginous"] { background: var(--j-cartilaginous); }
.jdot[data-c="fibrous"] { background: var(--j-fibrous); }

.lgroup + .lgroup { margin-top: 12px; }
.lgroup .section-note { margin: 0 0 6px; }

.linklist { display: grid; gap: 12px; }
.linklist .lt { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.linklist .lnote { font-size: 12px; color: var(--ink-3); }

.members { list-style: none; display: grid; gap: 0; }
.members li { padding: 8px 10px; border-radius: 9px; display: grid; gap: 1px; }
.members li + li { border-top: 1px solid var(--line); border-radius: 0; }
.members li.focus { background: var(--sel-soft); border-radius: 9px; border-top-color: transparent; }
.members .mn { font-weight: 600; }
.members .ml { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--ink-3); margin-left: 6px; font-weight: 400; }
.members .mt { font-size: 13.5px; color: var(--ink-2); }

.issues { list-style: none; }
.issues li { padding: 10px 0; border-top: 1px solid var(--line); }
.issues li:first-child { border-top: 0; padding-top: 0; }
.issues strong { display: block; font-weight: 600; margin-bottom: 2px; }
.issues span { font-size: 15px; color: var(--ink-2); }
.issues-from { font-size: 12px; color: var(--ink-3); font-weight: 400; letter-spacing: 0; text-transform: none; }

.movements { display: flex; flex-wrap: wrap; gap: 6px; }
.movements span { font-size: 13px; padding: 3px 9px; border-radius: 6px; background: var(--paper-3); color: var(--ink-2); }

.causes { display: grid; gap: 10px; }
.cause { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); display: grid; gap: 6px; }
.cause-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cause-title { font-weight: 650; }
.cause p { font-size: 15px; color: var(--ink-2); }
.urg {
  flex: none; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap;
}
.urg[data-u="self-care"] { color: var(--u-self); }
.urg[data-u="doctor"] { color: var(--u-doctor); }
.urg[data-u="urgent"] { color: #fff; background: var(--u-urgent); border-color: var(--u-urgent); }
.legend-urg { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12.5px; color: var(--ink-2); align-items: center; }

.flags {
  background: var(--sel-soft); border: 1px solid color-mix(in srgb, var(--sel) 35%, transparent);
  padding: 12px 14px; border-radius: 12px;
}
.flags h4 { font-size: 13px; margin-bottom: 6px; color: var(--sel); letter-spacing: 0.02em; }
.flags ul { padding-left: 18px; display: grid; gap: 4px; font-size: 15px; }
.flags .emergency { margin-top: 8px; font-weight: 600; font-size: 13.5px; }

.region-list { display: grid; gap: 14px; }
.region-list h4 { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-bottom: 6px; }

/* Reading text is set like a book: serif, old-style figures, hyphenated, no
   short last lines. Controls, chips and tags stay in the sans. */
.summary, .note-card, .issues, .cause, .flags, .howto, .disclaimer, .home-note, .members .mt, .side-note, .section-note {
  font-family: var(--serif); font-variant-numeric: oldstyle-nums proportional-nums;
  hyphens: auto; hyphenate-limit-chars: 7 3 3; text-wrap: pretty;
}
.cause-head .urg, .summary button, .note-card button, .issues button, .cause button, .flags button, .howto button, .members .mt button {
  font-family: var(--sans); font-variant-numeric: normal; hyphens: manual;
}
.home-lede { font-family: var(--serif); font-size: 21px; line-height: 1.4; text-wrap: pretty; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 20px 0 6px; }
.stats .stat:last-child:nth-child(4n + 3) { grid-column: span 2; }
.stats .stat:last-child:nth-child(4n + 2) { grid-column: span 3; }
.stats .stat:last-child:nth-child(4n + 1) { grid-column: span 4; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 9px 8px; background: var(--paper); min-width: 0; }
.stat b { display: block; font-family: var(--serif); font-size: 22px; line-height: 1; font-weight: 600; }
.stat span { font-size: 11.5px; color: var(--ink-3); }
.howto { list-style: none; display: grid; gap: 10px; }
.howto li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 15.5px; color: var(--ink-2); }
.howto li b { color: var(--ink); font-weight: 600; }
.howto .k { font-family: var(--serif); font-style: italic; color: var(--ink-3); font-size: 15px; }
.legend { display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.legend div { display: flex; align-items: center; gap: 9px; }
.legend .sq { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid; }
.legend .sq.sel { background: var(--sel-fill); border-color: var(--sel); }
.legend .sq.rel { background: var(--rel-fill); border-color: var(--rel); }
.legend .ln { width: 14px; height: 5px; border-radius: 3px; border: 1px solid; margin: 0 0 0 0; }
.legend .ln.artery { background: var(--artery); border-color: var(--artery-line); }
.legend .ln.vein { background: var(--vein); border-color: var(--vein-line); }
.legend .ln.nerve { background: var(--nerve); border-color: var(--nerve-line); }
.legend .ln.ligament { background: var(--ligament); border-color: var(--ligament-line); }
.legend .ln.lymph { background: var(--lymph); border-color: var(--lymph-line); }
.legend .nd { width: 10px; height: 7px; border-radius: 50%; border: 1px solid var(--lymph-line); background: var(--lymph); margin: 0 2px; }

.disclaimer {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 13.5px; line-height: 1.5; color: var(--ink-3);
}
.home-note {
  margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--paper-2); font-size: 14px; line-height: 1.5; color: var(--ink-2);
}
.home-note b { color: var(--sel); }
.kbd { font-family: var(--sans); font-size: 11.5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--ink-2); }

.debug-badge {
  position: fixed; right: 12px; bottom: 12px; z-index: 60;
  font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--ink); color: var(--paper); padding: 6px 10px; border-radius: 8px;
}

/* ---------------------------------------------------------------- SVG: structures */
#map .layer { transition: opacity 0.2s; }
#map .s, #map .jm, #map .rg { cursor: pointer; }
#map .deco { pointer-events: none; }
#map .s .b, #map .s .c { vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill 0.16s, stroke 0.16s; }
#map .s .d { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; pointer-events: none; }
#map .s { transition: opacity 0.18s; }

/* invisible hit area: a few px of tolerance around every shape */
#map .s .hit { fill: none; stroke: transparent; stroke-width: 6px; vector-effect: non-scaling-stroke; pointer-events: stroke; }
@media (pointer: coarse) { #map .s .hit { stroke-width: 12px; } }
#map .layer.context .hit, #map.mode-hurt .hit, #map.probing .hit, #map .s.back .hit { pointer-events: none; }

/* skeleton */
#map .s .b { fill: var(--bone); stroke: var(--bone-line); stroke-width: 1; }
#map .s .d { stroke: var(--bone-detail); stroke-width: 0.75; }
#map .s.back .b { fill: var(--bone-back); stroke: var(--bone-back-line); stroke-width: 0.8; }
#map .s.deep .b { fill: var(--bone-deep); }
#map .s .c { fill: var(--cart); stroke: var(--cart-line); stroke-width: 0.8; }
#map .s.jt .b { fill: var(--cart); stroke: var(--cart-line); stroke-width: 0.8; }
#map .deco.cav path { fill: var(--cavity); }
#map .deco.under path { fill: var(--bone); }
#map .deco.teeth path { fill: var(--tooth); stroke: var(--bone-line); stroke-width: 0.5; vector-effect: non-scaling-stroke; }

/* realistic drawings: form shading on top of the tissue fill (.sh bands, .hl lit rim, .f recesses) */
#map .layer[data-layer="skeleton"] { --shade: var(--bone-shade); --lit: var(--bone-light); --pore: var(--bone-pore); }
#map .s :is(.sh, .hl, .f) { stroke: none; pointer-events: none; transition: opacity 0.16s; }
#map .s .sh { fill: var(--shade); }
#map .s .sh1 { fill-opacity: 0.07; }
#map .s .sh2 { fill-opacity: 0.09; }
#map .s .sh3 { fill-opacity: 0.11; }
#map .s .sh4 { fill-opacity: 0.15; }
#map .s .hl { fill: var(--lit); fill-opacity: 0.75; }
#map .s .f { fill: var(--pore); fill-opacity: 0.55; }
#map .layer[data-style="realistic"] .s .b { stroke-width: 0.75; }
#map .layer[data-style="realistic"] .s .d { stroke-width: 0.6; }
#map .s.is-sel .sh { fill: color-mix(in srgb, var(--sel) 55%, var(--shade)); }
#map .s.is-rel .sh { fill: color-mix(in srgb, var(--rel) 55%, var(--shade)); }
#map .s:is(.is-sel, .is-rel) .hl { opacity: 0.5; }
/* soft tissue (tools/realistic/layers.py): the same shading, toned from each tissue's own colour, so it follows the
   theme; plus finer fibres (.fb) in muscles and ligaments and a sheen (.gl) on smooth organs and lymph nodes */
#map .s.m { --shade: color-mix(in srgb, var(--muscle) 30%, #1a0503); --lit: color-mix(in srgb, var(--muscle) 35%, #fff); }
#map .s.o { --shade: color-mix(in srgb, var(--organ) 35%, #1a0805); --lit: color-mix(in srgb, var(--organ) 25%, #fff); }
#map .s:is(.a, .v, .n, .ly, .lg) { --shade: color-mix(in srgb, var(--tone) 40%, #0d0807); --lit: color-mix(in srgb, var(--tone) 30%, #fff); }
#map .layer[data-style="realistic"]:not([data-layer="skeleton"]) .s .hl { fill-opacity: 0.45; }
#map .s :is(.fb, .gl) { pointer-events: none; transition: opacity 0.16s; }
#map .s .fb { fill: none; stroke: var(--muscle-fibre); stroke-width: 0.35; stroke-opacity: 0.6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
#map .s.lg .fb { stroke: var(--tone-line); stroke-opacity: 0.4; }
#map .s.m.is-sel .fb { stroke: color-mix(in srgb, var(--sel) 45%, transparent); }
#map .s .gl { fill: var(--lit); fill-opacity: 0.3; stroke: none; }
#map .s.is-sel .gl { opacity: 0.4; }

/* organs */
#map .s.o { --organ: var(--o-brain); }
#map .s.o .b { fill: var(--organ); stroke: var(--o-line); stroke-width: 1; }
#map .s.o .d { stroke: color-mix(in srgb, var(--o-line) 60%, transparent); stroke-width: 0.8; }
#map .s.o[data-id="thyroid"] { --organ: var(--o-thyroid); }
#map .s.o[data-id="trachea"] { --organ: var(--o-trachea); }
#map .s.o[data-id="esophagus"] { --organ: var(--o-esophagus); }
#map .s.o[data-id="lung"] { --organ: var(--o-lung); }
#map .s.o[data-id="heart"] { --organ: var(--o-heart); }
#map .s.o[data-id="liver"] { --organ: var(--o-liver); }
#map .s.o[data-id="gallbladder"] { --organ: var(--o-gallbladder); }
#map .s.o[data-id="stomach"] { --organ: var(--o-stomach); }
#map .s.o[data-id="spleen"] { --organ: var(--o-spleen); }
#map .s.o[data-id="pancreas"] { --organ: var(--o-pancreas); }
#map .s.o[data-id="kidney"] { --organ: var(--o-kidney); }
#map .s.o[data-id="small-intestine"] { --organ: var(--o-small-intestine); }
#map .s.o[data-id="large-intestine"] { --organ: var(--o-large-intestine); }
#map .s.o[data-id="appendix"] { --organ: var(--o-appendix); }
#map .s.o[data-id="bladder"] { --organ: var(--o-bladder); }
#map .s.o[data-id="ureter"] { --organ: var(--o-ureter); }
#map .s.o[data-id="duodenum"] { --organ: var(--o-duodenum); }
#map .s.o[data-id="rectum"] { --organ: var(--o-rectum); }
#map .s.o[data-id="pharynx"] { --organ: var(--o-pharynx); }
#map .s.o[data-id="larynx"] { --organ: var(--o-larynx); }
#map .s.o[data-id="adrenal-gland"] { --organ: var(--o-adrenal-gland); }
#map .s.o[data-id="pituitary"] { --organ: var(--o-pituitary); }
#map .s.o[data-id="parathyroid"] { --organ: var(--o-parathyroid); }
#map .s.o[data-id="pineal-gland"] { --organ: var(--o-pineal-gland); }
#map .s.o[data-id="eye"] { --organ: var(--o-eye); }
#map .s.o[data-id="ear"] { --organ: var(--o-ear); }
#map .s.o[data-id="nose"] { --organ: var(--o-nose); }
#map .s.o[data-id="tongue"] { --organ: var(--o-tongue); }
#map .s.o[data-id="salivary-glands"] { --organ: var(--o-salivary-glands); }
#map .s.o:is([data-id="ovary"], [data-id="testis"]) { --organ: var(--o-gonad); }
#map .s.o:is([data-id="uterus"], [data-id="vagina"], [data-id="prostate"], [data-id="penis"]) { --organ: var(--o-repro); }
#map .s.o:is([data-id="uterine-tube"], [data-id="vas-deferens"], [data-id="epididymis"], [data-id="seminal-vesicle"]) { --organ: var(--o-repro-duct); }
#map .s.o:is([data-id="breast"], [data-id="vulva"], [data-id="scrotum"]) { --organ: var(--o-breast); }
#map .s.o[data-id="breast"][data-sex="female"] .b { fill-opacity: 0.6; } /* lies over the lungs: let them show through */
#map .s.o[data-id="vas-deferens"] .b { stroke-width: 0.6; }
#map .s.o[data-id="ureter"] .b { stroke-width: 0.6; vector-effect: non-scaling-stroke; }

/* muscles */
#map .s.m .b { fill: var(--muscle); stroke: var(--muscle-line); stroke-width: 0.9; }
#map .s.m.deep .b { fill: var(--muscle-deep); }
#map .s.m .d { stroke: var(--muscle-fibre); stroke-width: 0.6; }
#map .s.m .c { fill: var(--tendon); stroke: var(--tendon-line); stroke-width: 0.7; }
#map .s.m:hover .b, #map .s.m.is-hover .b { fill: color-mix(in srgb, var(--muscle) 72%, #fff); }
#map .s.m.is-rel .b { fill: color-mix(in srgb, var(--muscle) 40%, var(--rel-fill)); stroke: var(--rel); stroke-width: 1.4; }
#map .s.m.is-sel .b { fill: var(--sel-fill); stroke: var(--sel); stroke-width: 1.8; }
#map .s.m.is-sel .d { stroke: color-mix(in srgb, var(--sel) 45%, transparent); }
#map .layer.context[data-layer="muscles"] .s { opacity: 0.18; }
#map .layer.context[data-layer="muscles"] .s :is(.d, .fb) { display: none; }
#map .layer.context[data-layer="muscles"] .s.is-sel, #map .layer.context[data-layer="muscles"] .s.is-rel { opacity: 0.9; }
#map.mode-hurt .layer[data-layer="muscles"] .s.m { opacity: 0.2; }
#map.mode-hurt .layer[data-layer="muscles"] .s.m :is(.d, .fb) { display: none; }
#map.mode-hurt .layer[data-layer="muscles"] .s.m.is-rel { opacity: 0.8; }

/* vessels & nerves: thin bands; .c marks a stretch behind bone, .deep a structure lying behind */
#map .s.a { --tone: var(--artery); --tone-line: var(--artery-line); }
#map .s.v { --tone: var(--vein); --tone-line: var(--vein-line); }
#map .s.n { --tone: var(--nerve); --tone-line: var(--nerve-line); }
#map .s.ly { --tone: var(--lymph); --tone-line: var(--lymph-line); }
#map .s.lg { --tone: var(--ligament); --tone-line: var(--ligament-line); }
#map .s:is(.a, .v, .n, .ly, .lg) .b { fill: var(--tone); stroke: var(--tone-line); stroke-width: 0.6; }
#map .s.ly.lo .b { fill-opacity: 0.75; } /* thymus and tonsils: soft lymphoid tissue */
#map .s:is(.a, .v, .n, .ly, .lg) .c { fill: var(--tone); stroke: none; opacity: 0.4; }
#map .s:is(.a, .v, .n, .ly, .lg).deep .b { fill-opacity: 0.5; stroke-opacity: 0.5; }
#map .s:is(.a, .v, .n, .ly, .lg):hover .b, #map .s:is(.a, .v, .n, .ly, .lg).is-hover .b { fill: color-mix(in srgb, var(--tone) 60%, #fff); }
#map .s:is(.a, .v, .n, .ly, .lg).is-rel .b { fill: var(--rel-fill); stroke: var(--rel); stroke-width: 1.1; fill-opacity: 1; }
#map .s:is(.a, .v, .n, .ly, .lg).is-sel .b { fill: var(--sel-fill); stroke: var(--sel); stroke-width: 1.4; fill-opacity: 1; }
#map .s:is(.a, .v, .n, .ly, .lg).is-sel .c { fill: var(--sel); stroke: none; }
#map.mode-hurt .layer:is([data-layer="vessels"], [data-layer="nerves"], [data-layer="lymphatics"], [data-layer="ligaments"]) .s { opacity: 0.22; }
#map.mode-hurt .layer:is([data-layer="vessels"], [data-layer="nerves"], [data-layer="lymphatics"], [data-layer="ligaments"]) .s.is-rel { opacity: 0.85; }

/* joint markers */
#map .jm {
  fill: var(--j-synovial); stroke: var(--paper); stroke-width: 1.4; vector-effect: non-scaling-stroke;
  transform-box: fill-box; transform-origin: center; transition: transform 0.18s var(--ease), opacity 0.18s;
}
#map .jm[data-jclass="cartilaginous"] { fill: var(--j-cartilaginous); }
#map .jm[data-jclass="fibrous"] { fill: var(--j-fibrous); }
#map .jm:hover, #map .jm.is-hover { transform: scale(1.35); }
#map.no-joints .jm { display: none; }
/* anatomical joints (realistic style): a capsule over the joint line and the cartilage of the joint space, not a dot.
   The realistic files also keep each one's dot (.jd); the Joints setting shows one or the other. */
#map:not(.joints-dots) .jm.jd, #map.joints-dots .jm.ja { display: none; }
#map .jm.ja { --jc: var(--j-synovial); fill: none; stroke: none; }
#map .jm.ja[data-jclass="cartilaginous"] { --jc: var(--j-cartilaginous); }
#map .jm.ja[data-jclass="fibrous"] { --jc: var(--j-fibrous); }
#map .jm.ja .cap {
  fill: color-mix(in srgb, var(--jc) 16%, transparent); stroke: color-mix(in srgb, var(--jc) 75%, transparent);
  stroke-width: 1; stroke-dasharray: 3 2; vector-effect: non-scaling-stroke; transition: fill 0.16s, stroke 0.16s;
}
#map .jm.ja .js { fill: var(--cart); stroke: var(--cart-line); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
#map .jm.ja:hover .cap, #map .jm.ja.is-hover .cap { stroke-dasharray: none; stroke-width: 1.4; }
/* sutures: a serrated band along the seam; the capsule is only a wider, invisible tap target until hovered or chosen */
#map .jm.ja.su .cap { fill: transparent; stroke: none; }
#map .jm.ja.su .js { fill: var(--jc); stroke: none; opacity: 0.75; }
#map .jm.ja.su:hover .cap, #map .jm.ja.su.is-hover .cap { fill: color-mix(in srgb, var(--jc) 12%, transparent); }

/* hover */
#map .s:hover .b, #map .s.is-hover .b { fill: var(--hover-fill); }
#map .s.o:hover .b, #map .s.o.is-hover .b { fill: color-mix(in srgb, var(--organ) 70%, #fff); }

/* selection */
#map.has-sel .layer.active .s:not(.is-sel):not(.is-rel):not(.is-hover) { opacity: 0.5; }
#map.has-sel .layer.active .deco { opacity: 0.5; }
#map .s.is-rel .b, #map .s.is-rel .c { fill: var(--rel-fill); stroke: var(--rel); }
#map .s.is-sel .b, #map .s.is-sel .c { fill: var(--sel-fill); stroke: var(--sel); stroke-width: 1.6; }
#map .s.o.is-rel .b { fill: color-mix(in srgb, var(--organ) 55%, var(--rel-fill)); stroke: var(--rel); stroke-width: 1.4; }
#map .s.o.is-sel .b { fill: color-mix(in srgb, var(--organ) 60%, var(--sel-fill)); stroke: var(--sel); stroke-width: 1.8; }
#map.has-sel .jm:not(.is-sel):not(.is-rel) { opacity: 0.35; }
#map .jm.is-rel { opacity: 1; animation: pulse 1.6s var(--ease) infinite; }
#map .jm.is-sel { transform: scale(1.6); fill: var(--sel); }
/* anatomical joints stay their size: the capsule colours carry the highlight */
#map .jm.ja:is(:hover, .is-hover, .is-sel, .is-rel) { transform: none; animation: none; }
#map .jm.ja.is-sel .cap { fill: color-mix(in srgb, var(--sel) 16%, transparent); stroke: var(--sel); stroke-dasharray: none; stroke-width: 1.6; }
#map .jm.ja.is-sel .js { fill: color-mix(in srgb, var(--sel) 75%, transparent); stroke: var(--sel); opacity: 1; }
#map .jm.ja.is-rel .cap { fill: color-mix(in srgb, var(--rel) 14%, transparent); stroke: var(--rel); stroke-dasharray: none; }
#map .jm.ja.su.is-rel .js { fill: var(--rel); opacity: 1; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.45); } }

/* context layers: visible for orientation, not interactive */
#map .layer.context { pointer-events: none; }
#map .layer.context .s, #map .layer.context .deco { opacity: 0.32; }
#map .layer.context[data-layer="skeleton"] .s, #map .layer.context[data-layer="skeleton"] .deco { opacity: 0.6; }
#map .layer.context[data-layer="skeleton"] .s .b, #map .layer.context[data-layer="skeleton"] .s .c { fill-opacity: 0.16; }
#map .layer.context[data-layer="skeleton"] .deco { opacity: 0.18; }
#map .layer.context .s.is-sel, #map .layer.context .s.is-rel { opacity: 0.95; }
#map .layer.context .s.is-sel .b, #map .layer.context .s.is-rel .b,
#map .layer.context .s.is-sel .c, #map .layer.context .s.is-rel .c { fill-opacity: 0.85; }
#map .layer.context .jm { display: none; }
#map .layer.context .s :is(.sh, .hl, .f, .gl) { opacity: 0.3; }
#map .layer.context .s:is(.is-sel, .is-rel) :is(.sh, .hl, .f, .gl) { opacity: 0.85; }
#map .layer.off { display: none; }
#map .view.off { display: none; } /* stays hidden while probing, so "Under this spot" only lists the current view */

/* selection outline overlay (also reveals structures hidden behind others) */
#map .ov path, #map .ov circle {
  fill: none; stroke: var(--sel); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none;
  stroke-linejoin: round;
}
#map .ov.hidden-behind path { stroke-dasharray: 5 4; }
#map .ov-rel path { fill: none; stroke: var(--rel); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0.85; }
#map.mode-hurt .ov-rel { display: none; }

/* regions (Where does it hurt?) */
#map .regions-layer { display: none; }
#map.mode-hurt .regions-layer { display: inline; }
#map.mode-hurt .layer:not(.regions-layer) { pointer-events: none; }
#map.mode-hurt .layer:not(.regions-layer) .s,
#map.mode-hurt .layer:not(.regions-layer) .deco { opacity: 0.55; }
#map.mode-hurt .layer[data-layer="skeleton"] .s .b { fill-opacity: 0.35; }
#map.mode-hurt .layer[data-layer="skeleton"] .s :is(.sh, .hl, .f) { opacity: 0.4; }
#map.mode-hurt .layer .s.is-rel { opacity: 0.95; }
#map.mode-hurt .jm { display: none; }
#map .rg path {
  fill: var(--rg-fill); stroke: var(--rg-line); stroke-width: 1; stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke; stroke-linejoin: round; transition: fill 0.15s;
}
#map .rg:hover path, #map .rg.is-hover path { fill: var(--rg-hover); }
#map .rg.is-sel path { fill: var(--rg-sel); stroke: var(--sel); stroke-dasharray: none; stroke-width: 1.8; }
#map .probe-dot { fill: var(--sel); stroke: var(--paper); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .brand-sub { display: none; }
}

@media (max-width: 760px) {
  body { grid-template-rows: auto 1fr; }
  /* one row: Browse, brand, search, mode switch, Ko-fi, cog. The search takes whatever width is left, down to a round
     search button on small phones, and widens over the whole bar while it has focus */
  .topbar { flex-wrap: nowrap; gap: 5px; padding: 8px 10px; min-height: 0; }
  .brand-name { font-size: 20px; }
  .seg { padding: 2px; }
  .seg button { padding: 6px 8px; font-size: 12.5px; }
  .icon-btn { height: 34px; min-width: 34px; }
  .search { flex: 1 1 0; min-width: 34px; max-width: none; margin: 0; container-type: inline-size; }
  .search input { height: 34px; padding: 0 10px 0 31px; text-overflow: ellipsis; }
  .search svg { left: 10px; }
  .search:focus-within { position: absolute; left: 10px; right: 10px; top: 8px; z-index: 30; }
  .search:focus-within input { padding-right: 14px; }
  .modes .long { display: none; }
  .modes .short { display: inline; }
  @container (max-width: 90px) { .search input::placeholder { color: transparent; } }
  .icon-btn .label { display: none; }
  .icon-btn { padding: 0; }

  /* the sheet's sizes (main.js reads --peek and --sheet-half off the panel to keep a revealed selection above it), and
     --above-sheet: how much of it is in view, which the map's bottom controls sit above. setSheet() mirrors the
     sheet's state onto the stage; when it is full they stay where half left them, under the sheet */
  .stage {
    grid-template-columns: 1fr;
    --peek: 92px; --sheet-half: 0.46; --sheet-h: 86vh;
    --above-sheet: var(--peek);
  }
  @supports (height: 1dvh) { .stage { --sheet-h: 86dvh; } }
  .stage[data-sheet="half"], .stage[data-sheet="full"] { --above-sheet: calc(var(--sheet-h) * (1 - var(--sheet-half))); }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    height: var(--sheet-h);
    border-left: 0; border: 1px solid var(--line); border-bottom: 0;
    border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
    transform: translateY(calc(100% - var(--peek)));
    transition: transform 0.3s var(--ease);
    overflow: hidden; display: flex; flex-direction: column;
  }
  .panel[data-sheet="half"] { transform: translateY(calc(var(--sheet-half) * 100%)); }
  .panel[data-sheet="full"] { transform: translateY(0); }
  .sheet-handle {
    display: grid; place-items: center; flex: none; height: 26px; width: 100%; cursor: grab; touch-action: none;
  }
  .sheet-handle::before { content: ""; width: 42px; height: 5px; border-radius: 3px; background: var(--line-2); }
  #panel-body { overflow: auto; overscroll-behavior: contain; flex: 1; }
  .panel-inner { padding: 4px 16px 40px; }
  .title { font-size: 26px; }
  /* the zoom buttons sit at the right edge and the layer chips down the left, so the two never meet */
  .map-controls, .hurt-banner, .model-credit { transition: bottom 0.3s var(--ease); }
  .map-controls { bottom: calc(var(--above-sheet) + 14px); left: auto; right: 12px; }
  .map-hint { display: none; }
  .model-status { top: 46px; max-width: calc(100% - 24px); border-radius: 12px; } /* below the R / L labels */
  .model-credit { right: auto; left: 12px; bottom: calc(var(--above-sheet) + 8px); font-size: 10.5px; } /* clear of the zoom buttons */
  /* phones: one Layers button; it opens the chips as a menu below it */
  .layerbar { top: 10px; left: 10px; gap: 6px; }
  .layer-toggle, .layerbar[data-collapsed="true"] .layer-toggle {
    width: 36px; height: 36px; padding: 0; justify-content: center; border-style: solid; color: var(--ink-2);
  }
  .layerbar .layer-toggle .name {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .layerbar[data-open="true"] .layer-toggle { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .layer-list, .layerbar[data-collapsed="true"] .layer-list {
    position: absolute; top: 42px; left: 0; min-width: 184px; padding: 8px; gap: 4px;
    border: 1px solid var(--line-2); border-radius: 14px; background: var(--paper-2); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-6px) scale(0.98); transform-origin: top left;
    transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0s linear 0.16s;
  }
  .layerbar[data-open="true"] .layer-list {
    opacity: 1; visibility: visible; transform: none; transition: opacity 0.16s var(--ease), transform 0.16s var(--ease);
  }
  .layer-chip, .layerbar[data-collapsed="true"] .layer-chip {
    width: auto; height: 38px; padding: 0 12px 0 7px; justify-content: flex-start; gap: 9px; font-size: 14px;
    border-color: transparent; background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .layerbar[data-collapsed="true"] .layer-chip .name { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .layer-chip .sw { width: 24px; height: 24px; }
  /* R / L at the top, either side of the head: clear of the layer column (left) and the zoom buttons (right) */
  .side-label { top: 12px; width: 28px; }
  .side-label small { display: none; }
  .side-label.l, .layerbar ~ .side-label.l, .layerbar[data-collapsed="true"] ~ .side-label.l { left: 56px; }
  .side-label.r { right: 10px; }
  .hurt-banner { top: auto; bottom: calc(var(--above-sheet) + 14px); left: 12px; transform: none; } /* bottom left is free on phones */
}

/* short phones: above a half-open sheet there isn't room for the zoom and move groups one above the other */
@media (max-width: 760px) and (max-height: 620px) {
  .stage[data-sheet="half"] .map-controls, .stage[data-sheet="full"] .map-controls { flex-direction: row; align-items: flex-end; }
}

@media (max-width: 420px) {
  .topbar { gap: 4px; padding: 8px 8px; }
  .search:focus-within { left: 8px; right: 8px; }
  .brand-name { font-size: 18px; }
  .seg button { padding: 5px 6px; font-size: 12px; }
  .icon-btn { height: 32px; min-width: 32px; }
  .search { min-width: 32px; }
  .search input { height: 32px; }
}
@media (max-width: 380px) {
  .brand { display: none; }
}

/* probe: make every layer hit-testable for an instant (no paint happens in between) */
#map.probing .layer.off { display: inline !important; opacity: 0 !important; }
#map.probing .layer, #map.probing .layer .s { pointer-events: visiblePainted !important; }
#map.probing .regions-layer, #map.probing .regions-layer *, #map.probing .jm { pointer-events: none !important; }
/* the drawing style that isn't shown stays hidden, even while probing ("Under this spot" lists each structure once) */
#map .view .layer.style-off { display: none !important; }
/* shapes for the biological sex that isn't chosen (or every sex-specific shape when none is) stay hidden too */
#map .sex-off { display: none !important; }

/* range chips expand in place */
.chipset, .chips-more { display: contents; }
