/* map-mode — the rules that only ever match inside this engine, moved out of
   core/styles.css so other pages don't download them. Loaded by core/app.js after
   core/styles.css (the ENGINES table's css). */

/* Line-category chip (map journey legs): a short bar instead of a dot. */
.chip-line .chip-line-ico {
  width: 16px; height: 3px;
  border-radius: 2px;
  background: var(--cat, var(--accent));
}

.chip.off .chip-line-ico { background: var(--text-dim); }

/* ---- Location pins (CSS divIcons — no image assets) ------------------- */
.map-pin { background: none; border: none; }

.map-pin-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--pin, var(--accent));
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 0 1px var(--pin, var(--accent)), 0 2px 6px rgba(0, 0, 0, .5);
  transition: transform .15s ease;
}

.map-pin:hover .map-pin-dot { transform: scale(1.25); }

.map-pin-glyph {
  font-size: 11px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.4));
}

/* Pulsing ring over the currently-focused place. */
.map-highlight { background: none; border: none; }

.map-highlight-ring {
  display: block;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-soft);
  box-shadow: 0 0 16px rgba(var(--accent-rgb), .6);
  animation: mapPing 1.7s ease-out infinite;
}

/* Journey route lines + the moving "traveler" dot at the growing tip. */
/* Route lines render on a canvas (see preferCanvas) for performance — no per-path
   CSS filter, which the SVG renderer recomputed every animation frame and lagged. */

/* Permanent / hover place labels. */
.leaflet-tooltip.map-tip {
  background: var(--ctrl-bg);
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 12px;
  letter-spacing: .02em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
  white-space: nowrap;
}

.leaflet-tooltip.map-tip::before { display: none; }

/* ---- Map labels (engines/map.js "Map labels") --------------------------------------
   Atlas-style names in the `labels` pane (above rivers, below routes and pins).
   Each label is a zero-size Leaflet divIcon at its anchor holding one span centred
   on it (rotated by --a); a city's dot sits on the anchor with the name beside it.
   Non-interactive: the pane and the labels never take pointer events. engines/map.js hides
   collision losers with .is-culled (visibility keeps their measured size). Colours
   come from the --map-label-* theme variables, so a theme switch restyles them. */
.map-label-anchor { background: none; border: 0; width: 0; height: 0; pointer-events: none; }

.map-label {
  --halo: var(--map-label-halo);
  position: absolute;
  left: 0; top: 0;
  transform: translate(-50%, -50%) rotate(var(--a, 0deg));
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.15;
  color: var(--map-label-land);
  text-shadow: 1px 0 1px var(--halo), -1px 0 1px var(--halo), 0 1px 1px var(--halo),
               0 -1px 1px var(--halo), 0 0 3px var(--halo), 0 0 3px var(--halo);
  transition: opacity .25s ease, visibility 0s linear 0s;
}

.map-label.is-culled { opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility 0s linear .2s; }

/* Just added (engines/map.js removes this at the next update): born culled, no transition, so a
   collision loser is never painted and a winner appears at once without a fade. */
.map-label.map-label-new, .map-label.map-label-new.is-culled { transition: none; }

/* Letter-spaced kinds: pad the left by the spacing so the text stays centred. */
.map-label-sea, .map-label-nation, .map-label-region, .map-label-people,
.map-label-mountains, .map-label-desert { padding-left: var(--ls); letter-spacing: var(--ls); }

.map-label-sea {
  --halo: var(--map-sea);                       /* seas sit on the sea */
  --ls: .3em;
  font: italic 14px/1.15 var(--font-display);
  color: var(--map-label-water);
}

.map-label-lake, .map-label-river { font-style: italic; color: var(--map-label-water); }

.map-label-lake { font-size: 11px; }

.map-label-river { font-size: 10px; letter-spacing: .04em; }

.map-label-mountains, .map-label-desert {
  --ls: .14em;
  font-size: 10px;
  font-variant: small-caps;
  font-weight: 600;
  color: var(--map-label-land);
}

.map-label-nation, .map-label-region {
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--map-label-region);
}

.map-label-nation { --ls: .2em; font-size: 13px; font-weight: 700; }

.map-label-region { --ls: .24em; font-size: 11px; }

.map-label-people {
  --ls: .2em;
  font-size: 10px;
  font-style: italic;
  text-transform: uppercase;
  color: var(--map-label-region);
}

.map-label-city {
  transform: translate(-3px, -50%);            /* the dot's centre on the anchor */
  padding-left: 9px;
  font-size: 11px;
  color: var(--map-label-region);
}

.map-label-city::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 6px; height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--map-label-region);
  box-shadow: 0 0 0 1px var(--halo);
}

.map-label-note { font-size: 10px; font-style: italic; color: var(--map-label-note); }

@media (max-width: 640px) {
  .map-label-sea { font-size: 12px; }
  
  .map-label-nation { font-size: 12px; }
  
  .map-label-region, .map-label-city, .map-label-lake { font-size: 10px; }
  
  .map-label-river, .map-label-mountains, .map-label-desert,
  .map-label-people, .map-label-note { font-size: 9px; }
}

/* Lite mode / reduced motion: no fades. (No fade-in on add either: ~30 labels
   animating at load measurably added main-thread time on a 4x-throttled CPU.) */
body.low-power .map-label { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .map-label, .map-label.is-culled { transition: none; }
}

/* ---- Map HUD (title / subtitle / legend) ------------------------------ */
#mapHud {
  position: fixed;
  top: 22px;
  left: 0; right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

#mapTitle {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--ink);                              /* follows the theme */
  /* Halo uses the theme's base background, so the title stays legible over the
     base map in BOTH light and dark themes (light halo on light, dark on dark). */
  text-shadow: 0 1px 4px var(--bg-0), 0 0 14px var(--bg-0);
}

#mapSubtitle {
  font-size: 13px;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-top: 4px;
  text-shadow: 0 1px 8px var(--bg-0);
}

#mapLegend {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  pointer-events: auto;
}

/* ---- Side panel: the per-step "side view" ----------------------------- */
/* Height FITS the content (capped), and the top is set by JS to sit just below
   the HUD/legend so the panel never covers the toggle chips. The values here are
   fallbacks for before JS runs / if measurement is unavailable. */
#mapPanel {
  position: fixed;
  z-index: 30;
  top: 96px;
  max-height: calc(100dvh - 188px);   /* leave room for the HUD above + nav below */
  width: min(380px, 86vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}

#mapPanel[data-side="right"] { right: 24px; }

#mapPanel[data-side="left"]  { left: 24px; }

#mapPanelClose {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--soft-fill);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  cursor: pointer;
  transition: color .2s ease, background .2s ease;
}

#mapPanelClose:hover { color: var(--text); background: var(--soft-fill-2); }

#mapPanelMedia {
  flex: 0 0 auto;
  height: 150px;
  background: var(--bg-1);
}

#mapPanelMedia img { display: block; width: 100%; height: 100%; object-fit: cover; }

#mapPanelBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 20px;
}

#mapPanelEyebrow {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* The scripture reference / verse above the title — deliberately prominent. */
#mapPanelEyebrow .map-ref {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--accent-soft);
}

#mapPanelEyebrow .map-step-count {
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--text-dim);
  background: var(--soft-fill);
  border-radius: 999px;
  padding: 3px 10px;
}

#mapPanelTitle {
  margin: 0 0 12px;
  font-size: 22px;
  line-height: 1.25;
  color: var(--ink);
}

/* A place's glyph (a location's `icon`: "?" for a site in doubt, ✝, ⛺ …) is a small
   round badge before the title, drawn like the pin it came from, not a letter
   run into the words ("? Back to Ziklag" read as a question). */
#mapPanelTitle .map-panel-icon {
  display: inline-grid; place-items: center; vertical-align: 0.18em;
  width: 1.5em; height: 1.5em; margin-right: 10px; border-radius: 50%;
  font-size: 13px; font-weight: 700; line-height: 1; font-style: normal;
  color: var(--text); background: var(--soft-fill, rgba(127, 127, 127, .14));
  box-shadow: inset 0 0 0 1.5px var(--text-dim);
}

/* Summary + the inline detail share one readable text style. */
#mapPanelSummary, #mapPanelDetail { font-size: 14px; line-height: 1.6; color: var(--text-dim); }

#mapPanelSummary p, #mapPanelDetail p { margin: 0 0 .8em; }

#mapPanelSummary a, #mapPanelDetail a { color: var(--accent-soft); }

#mapPanelSummary strong, #mapPanelDetail strong { color: var(--ink); }

/* The inline detail sits a little apart from the summary, with its own headings. */
#mapPanelDetail { margin-top: 4px; }

#mapPanelDetail h1, #mapPanelDetail h2, #mapPanelDetail h3 {
  margin: 1em 0 .4em;
  font-size: 15px;
  color: var(--ink);
}

#mapPanelDetail ul, #mapPanelDetail ol { margin: 0 0 .8em; padding-left: 1.3em; }

#mapPanelDetail li { margin: .25em 0; }

#mapPanelDetail blockquote {
  margin: 0 0 .8em;
  padding: 2px 12px;
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
}

#mapPanelDetail hr { border: none; border-top: 1px solid var(--card-border); margin: 1em 0; }

#mapPanelActions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.map-link { font-size: 13px; letter-spacing: .04em; color: var(--accent-soft); text-decoration: none; }

.map-link:hover { text-decoration: underline; }

/* ---- Bottom-left key: explains the circled map symbols (MAP.iconLegend) ---- */
#mapKey {
  position: fixed;
  z-index: 20;
  left: 24px;
  bottom: 92px;                 /* clears the Leaflet attribution + Prev button */
  max-width: 240px;
  padding: 12px 14px;
  background: var(--ctrl-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  backdrop-filter: blur(4px);
  pointer-events: none;          /* a reference, not a control */
}

.map-key-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  margin-bottom: 9px;
}

.map-key-list { display: grid; gap: 8px; }

.map-key-row { display: flex; align-items: center; gap: 10px; }

.map-key-dot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  font-size: 11px;
  line-height: 1;
  border-radius: 50%;
  background: var(--pin, var(--accent));
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 0 1px var(--pin, var(--accent));
}

.map-key-label { font-size: 13px; line-height: 1.3; color: var(--text); }

@media (max-width: 640px) {
  #mapKey { display: none; }
}

/* ---- Regions (MAP.regions): areas on the map + the tile grid ------------ */
/* Routes' canvas sits above the regions pane; it has no click handlers, so on a map
   with regions it lets clicks through to the areas beneath. */
#map.has-regions .leaflet-overlay-pane canvas { pointer-events: none; }

/* Leaflet sets fill/stroke from the data colour; opacities and widths are CSS so every
   theme works (CSS beats SVG presentation attributes). */
path.map-region { fill-opacity: .30; stroke-width: 1.2px; stroke-opacity: .9; cursor: pointer;
  transition: fill-opacity .18s ease; }

path.map-region.is-dim { fill-opacity: .14; }

path.map-region.is-hover { fill-opacity: .45; stroke-width: 2.5px; }

path.map-region.is-selected { fill-opacity: .55; stroke: var(--ink); stroke-width: 3px; stroke-opacity: 1; }

body.low-power path.map-region, body.low-power .map-region-tile { transition: none; }

@media (prefers-reduced-motion: reduce) {
  path.map-region, .map-region-tile { transition: none; }
}

#mapRegions {
  position: fixed;
  z-index: 20;
  left: 24px;
  top: 112px;                     /* under ⌂ Library + Reset */
  width: 256px;
  max-height: calc(100dvh - 200px);
  overflow-y: auto;
  padding: 12px;
  background: var(--card-bg);     /* opaque enough on its own: no backdrop blur needed */
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

#mapRegions[hidden] { display: none; }

.map-regions-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-dim); margin-bottom: 9px;
}

.map-regions-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.map-region-tile {
  display: flex; align-items: center; gap: 8px;
  min-width: 0;
  text-align: left;
  font-family: var(--font); font-size: 12.5px; line-height: 1.2;
  color: var(--text);
  background: var(--soft-fill);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  padding: 6px 8px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.map-region-tile:hover, .map-region-tile.is-hover { border-color: var(--reg); background: var(--soft-fill-2); }

.map-region-tile:focus-visible { outline: 2px solid var(--reg); outline-offset: 1px; }

.map-region-tile[aria-pressed="true"] { border-color: var(--reg); box-shadow: inset 0 0 0 1px var(--reg); color: var(--ink); font-weight: 600; }

.map-region-swatch { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px; background: var(--reg); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }

.map-region-text { min-width: 0; }

.map-region-name { display: block; }

.map-region-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--text-dim); }

.map-regions-note { margin-top: 9px; font-size: 11px; line-height: 1.35; color: var(--text-dim); }

@media (max-width: 640px) {
  #mapRegions {
    top: auto; left: 12px; right: 12px; bottom: 30px; width: auto;
    max-height: none; overflow: visible; padding: 4px 8px;
    display: flex; flex-direction: column-reverse; gap: 2px;
  }
  
  #mapRoot.has-region-tiles #mapStartBtn { bottom: 100px; }
  
  #mapRoot.has-region-tiles #mapPanel { bottom: 100px; }
  
  #mapRoot.has-region-tiles.in-journey #mapRegions { display: none; }
  
  .map-regions-title { display: none; }
  
  .map-regions-list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 2px; scrollbar-width: thin; }
  
  .map-region-tile { flex: 0 0 auto; padding: 5px 9px; min-height: 34px; }
     /* touch target */
  .map-region-sub { display: none; }
  
  .map-regions-note { margin: 0; font-size: 10px; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  
  #mapRoot.has-region-tiles #mapHint { display: none; }
}

/* ---- Map control positions (reuse .ctrl / .nav from the timeline) ----- */
#mapResetBtn { top: 66px; left: 24px; }

/* below the ⌂ Library link */
#mapPlayBtn  { top: 22px; right: 132px; }

/* shifted left to make room for ⛶ and ⚙ */
#mapPlayBtn.playing {
  color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border-color: var(--accent-soft);
}

/* ⚙ settings button (top-right) + the style menu it opens. */
#mapSettingsBtn { top: 22px; right: 24px; padding: 11px 14px; font-size: 16px; line-height: 1; }

#mapSettingsBtn.on { background: var(--ctrl-bg-hover); border-color: var(--accent-soft); }

#mapDownloadBtn { top: 66px; right: 24px; }

/* under ⚙ (the style menu opens over it) */
/* ⛶ Full screen (HL.immersive), between ▶ Play and ⚙, the size of ⚙. Phones have no
   room in their one top row (and the map already fills the screen): no ⛶ there. */
#mapFsBtn { top: 22px; right: 78px; padding: 11px 14px; font-size: 16px; line-height: 1; }

@media (max-width: 640px) {
  #mapFsBtn { display: none; }
}

@media (min-width: 641px) and (min-height: 501px) {
  #mapLegend { display: block; text-align: center; text-indent: 152px; margin-top: 8px; }
  
  #mapLegend::before { content: ""; float: right; width: 152px; height: 1px; }
  
  #mapLegend > .chip { margin: 4px; vertical-align: top; text-indent: 0; }
}

@media (max-width: 640px) {
  #mapDownloadBtn { padding: 11px 14px; min-width: 43px; font-size: 16px; line-height: 1; }
  
  #mapDownloadBtn .dl-lbl { display: none; }
  
  #mapHud::before { content: ""; float: right; width: 0; height: 92px; }
  
  #mapLegend { clear: right; }
}

#mapSettings {
  position: fixed;
  z-index: 30;
  top: 64px; right: 24px;
  width: 210px;
  padding: 12px;
  background: var(--ctrl-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  backdrop-filter: blur(4px);
}

.map-settings-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.map-style-list { display: grid; gap: 6px; }

.map-style-opt {
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--soft-fill);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.map-style-opt:hover { background: var(--soft-fill-2); }

.map-style-opt.on {
  color: var(--ink);
  background: rgba(var(--accent-rgb), .18);
  border-color: var(--accent-soft);
}

#mapHint {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: .04em;
  z-index: 10;
  pointer-events: none;
  transition: opacity .4s ease;
}

#mapHint kbd {
  background: var(--soft-fill);
  border: 1px solid var(--card-border);
  border-radius: 5px;
  padding: 1px 6px;
  font-family: var(--font);
}

/* Credit, matching the timeline's (the ⌂ Library pill is the shared .lib-link).
   Phones drop it: it lay over Leaflet's attribution, which must stay readable. */
#mapCredit {
  position: fixed;
  z-index: 1;
  left: 0; right: 0;
  bottom: 10px;
  pointer-events: none;
}

@media (max-width: 640px) {
  #mapCredit { display: none; }
}

@media (max-width: 640px) {
  #mapPanel {
    top: auto;
    left: 12px; right: 12px;
    bottom: 86px;
    width: auto;
    max-height: 46vh;
  }
  
  #mapPanel[data-side="left"], #mapPanel[data-side="right"] { left: 12px; right: 12px; }
}

@media (max-width: 640px) {
  #mapSettingsBtn { right: 12px; font-size: 15px; padding: 6px 11px; }
  
  #mapPlayBtn { right: 58px; }
  
  #mapDownloadBtn { right: 152px; min-width: 0; font-size: 15px; padding: 6px 11px; }
  
  #mapSettings { top: 50px; right: 12px; }
  
  #mapHud::before { content: none; }
}

body.map-mode #mapRoot { display: block; }

/* ---- Phones: the map gets the screen -------------------------------------
   Kept LAST in this file: the desktop rules above (#mapHud top: 22px, #mapDownloadBtn
   top: 66px) load after core/styles.css, so core's phone block alone lost to them and
   the title ran under ⌂ Library / ▶ Play. The legend is one sideways-scrolling row
   (core/styles.css); engines/map.js fits the home view below the HUD and above Start. */
@media (max-width: 640px) {
  #mapHud { top: 54px; padding: 0 12px; }
  #mapDownloadBtn, #mapPlayBtn, #mapSettingsBtn { top: 12px; }
  #mapResetBtn { top: auto; left: 50%; }   /* bottom-centre: see core/styles.css */
  #mapLegend {   /* one sideways-scrolling row (core/styles.css); repeated here to beat #mapLegend above */
    flex-wrap: nowrap; justify-content: flex-start; margin: 8px -12px 0; gap: 6px; overflow-x: auto;
  }
  #mapTitle { font-size: clamp(18px, 5.2vw, 22px); line-height: 1.2; letter-spacing: .01em; text-wrap: balance; }
  #mapSubtitle { font-size: 12px; letter-spacing: .18em; }
  #mapPanel { max-height: min(46vh, 46dvh); bottom: 84px; }
  #mapPanelBody { padding: 16px 16px 18px; }
  #mapPanelTitle { font-size: 20px; padding-right: 36px; }
  #mapPanelSummary, #mapPanelDetail { font-size: 15px; }
  #mapPanelClose { width: 40px; height: 40px; top: 8px; right: 8px; font-size: 16px; }
  #mapPanelMedia { height: 120px; }
  #mapHint { bottom: 86px; width: max-content; max-width: calc(100vw - 32px); text-align: center; }
  #mapRoot.has-region-tiles.map-focus #mapRegions { display: none; }   /* Reset takes the bottom */
  .map-style-opt { min-height: 40px; font-size: 14px; }
  #mapSettings { width: min(240px, calc(100vw - 24px)); }
}
/* Sideways phone: 390px tall. One-line title, no subtitle (core/styles.css), the
   legend one row (repeated here to beat #mapLegend above), no hint. */
@media (min-width: 641px) and (max-height: 500px) {
  #mapLegend { flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; margin: 12px 110px 0; }
  #mapHud { top: 28px; }
  #mapTitle { font-size: 17px; max-width: calc(100% - 560px); }
  #mapDownloadBtn { top: 22px; right: 232px; padding: 11px 14px; font-size: 16px; line-height: 1; }
  #mapDownloadBtn .dl-lbl { display: none; }
  #mapHint, #mapCredit { display: none; }
}
/* Tablets and narrow windows (core/styles.css has the reasons): the title block
   under the corner pills, ⤓ up in their row as an icon, the legend one row
   (repeated here to beat #mapLegend's wrapped desktop form above). */
@media (min-width: 641px) and (max-width: 1100px) and (min-height: 501px) {
  #mapHud { top: 74px; }
  #mapDownloadBtn { top: 22px; right: 232px; padding: 11px 14px; font-size: 16px; line-height: 1; min-width: 0; }
  #mapDownloadBtn .dl-lbl { display: none; }
  #mapLegend { display: flex; text-indent: 0; text-align: left; flex-wrap: nowrap; justify-content: flex-start; gap: 6px; overflow-x: auto; margin: 10px -24px 0; }
  #mapLegend::before { content: none; }
  #mapLegend > .chip { margin: 0; }
  #mapLegend > .chip:first-child { margin-left: auto; }
  #mapLegend > .chip:last-child { margin-right: auto; }
}
/* Touch: a pin keeps its 18px dot but answers taps within 40px; region tiles 40px tall. */
@media (pointer: coarse) {
  .map-pin::after { content: ""; position: absolute; inset: -11px; border-radius: 50%; }
}
@media (max-width: 640px) {
  .map-region-tile { min-height: 40px; }
  .map-regions-note { font-size: 12px; }
  /* The tile credit is a label: 12px on a phone (docs/MOBILE.md rule 3), not Leaflet's 10px. */
  .leaflet-control-attribution { font-size: 12px; }
}

/* Parchment, light: its accent-soft subtitle and its dim text on the map's own
   ground (the hint, the credit, the key's title) sat at 4.3–4.4:1 on #e7dcc6. The
   subtitle takes the accent as text (--accent-ink); the dim ink is deepened for
   the whole map, as in Berean, Hard and Controversy. */
:root[data-mode="light"][data-theme="parchment"] body.map-mode { --text-dim: #5e5143; }
:root[data-mode="light"][data-theme="parchment"] body.map-mode #mapSubtitle { color: var(--accent-ink); }
