/* The tree map (map.html, js/map/), on top of css/tree-app.css: the whole screen is the map, the northern lights in
   deep teal and indigo (assets/map/northern-lights.json) with the tree pages' gold. Round glass buttons at the top, one thing at
   the bottom (the call to action, the countries' ranking, a tree's card, or the place a tree goes), markers in the
   trees' own artwork with a gold glow. The tree pages' pine gives way to indigo here: sheets, cards and the cream
   buttons' ink. */

.map-page { --aura: drop-shadow(0 0 5px rgba(246, 196, 83, 0.55)) drop-shadow(0 3px 3px rgba(0, 0, 0, 0.55));
  --glass-dark: rgba(16, 26, 51, 0.94); --deep: #050719; --edge: rgba(246, 196, 83, 0.26);
  --popup: #101a33; --bg-top: #1b2556; --bg-bottom: #050719; --cream-ink: #0d1236;
  height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; overscroll-behavior: none; }
html:has(.map-page) { height: 100%; overflow: hidden; background: #050719; }
.map-page::before { display: none; }

/* ---------- Behind the globe: night sky, the glow round the globe (js/map/ui/sky.js moves it with the globe), stars ---------- */
.map-sky { position: fixed; inset: 0; z-index: 0; background: radial-gradient(120% 75% at 50% 52%, #1b2556 0%, #0d1236 55%, #050719 100%); }
/* The northern lights: a faint green and violet glow across the top of the sky, drawn once (it doesn't move) */
.map-sky::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 22% at 28% 10%, rgba(80, 255, 200, 0.13), transparent 70%), radial-gradient(48% 20% at 78% 6%, rgba(150, 120, 255, 0.12), transparent 70%); }
/* Painted once for a globe 300px round (js/map/config.js SKY.haloPx), 390px with its glow; js/map/ui/sky.js moves its
   middle onto the globe's and scales it to the globe's size */
.map-halo { position: absolute; left: 0; top: 0; width: 780px; height: 780px; margin: -390px 0 0 -390px; border-radius: 50%;
  transform: translate(50vw, 55vh) scale(0.5); pointer-events: none; will-change: transform; transition: opacity 0.3s;
  background: radial-gradient(closest-side, rgba(246, 196, 83, 0.2) 77%, rgba(246, 196, 83, 0.06) 88.5%, rgba(246, 196, 83, 0)); }
.map-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: var(--gold); }
.map-canvas { position: fixed; inset: 0; z-index: 1; background: transparent; opacity: 0; transition: opacity 0.5s ease; }
.map-page.is-ready .map-canvas { opacity: 1; }

/* ---------- While the map loads: a dark globe where the globe comes (the world view's size: js/map/config.js ZOOM.world,
   ZOOM.worldWide), in the middle of the free space, with a soft light passing over it; the counts and the bottom's button
   wait as faint lines. No glow until the globe is drawn. ---------- */
.map-skeleton { position: absolute; left: 50%; top: calc((100vh + env(safe-area-inset-top, 0px) - 46px) / 2); width: 362px; height: 362px;
  margin: -181px 0 0 -181px; overflow: hidden; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #1d4a52 0%, #143840 52%, #0c2329 100%);
  box-shadow: inset 0 0 0 1px rgba(244, 241, 232, 0.06), 0 0 60px rgba(0, 0, 0, 0.35); transition: opacity 0.5s ease; }
@supports (height: 100dvh) { .map-skeleton { top: calc((100dvh + env(safe-area-inset-top, 0px) - 46px) / 2); } }
.map-skeleton i { position: absolute; inset: 0; background: linear-gradient(105deg, transparent 32%, rgba(244, 241, 232, 0.08) 50%, transparent 68%);
  transform: translateX(-100%); animation: map-shimmer 1.8s ease-in-out infinite; }
@keyframes map-shimmer { to { transform: translateX(100%); } }
@media (min-width: 600px) { .map-skeleton { width: 494px; height: 494px; margin: -247px 0 0 -247px; } }
.map-page.is-ready .map-skeleton, .map-page.is-failed .map-skeleton { opacity: 0; pointer-events: none; }
.map-page.is-ready .map-skeleton i, .map-page.is-failed .map-skeleton i { animation: none; }
.map-page:not(.is-ready) .map-halo { opacity: 0 !important; }
/* The tree pages' loading spinner isn't needed over the skeleton, and the title waits as a line until its words come */
.map-page.is-loading::after { display: none; }
.map-page.is-loading .map-title { width: fit-content; margin-inline: auto; border-radius: 14px; background: rgba(244, 241, 232, 0.08); color: transparent; text-shadow: none; }
.map-page:not(.is-ready) .map-sub:empty { display: block; width: 150px; height: 14px; margin: 10px auto 0; border-radius: 7px; background: rgba(244, 241, 232, 0.08); }
.map-page:not(.is-ready):not(.is-failed) .map-bottom:empty { display: block; height: 52px; border-radius: 26px; background: rgba(244, 241, 232, 0.08); }
.map-canvas:focus-visible { outline: none; }
.maplibregl-map { font: inherit; }

/* ---------- The bars over the map (only their buttons and cards take taps) ---------- */
.map-ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.map-top { position: absolute; top: calc(env(safe-area-inset-top) + 12px); left: 16px; right: 16px; display: flex; align-items: center; gap: 12px; }
.map-top > * { pointer-events: auto; }
.map-round {
  position: relative; flex: none; width: 44px; height: 44px; padding: 0; border: 1px solid rgba(244, 241, 232, 0.14); border-radius: 50%;
  background: var(--glass-dark); color: var(--text); cursor: pointer; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.8);
  transition: background-color 0.15s, transform 0.15s;
}
.map-round:hover { background: #1c2850; }
.map-round:active { transform: scale(0.94); }
.map-round svg { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
[dir='rtl'] #map-back svg { transform: scaleX(-1); }

.map-heading { flex: 1; min-width: 0; pointer-events: none !important; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 14px rgba(5, 7, 25, 0.9); }
.map-title { margin: 0; overflow: hidden; font-size: 1.22rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }
.map-title:focus { outline: none; }
.map-sub { margin: 0; color: var(--text-soft); font-size: 0.82rem; font-weight: 600; }
.map-sub:empty { display: none; }
/* Zoomed out: the big title in the middle, under the two buttons */
[data-level='world'] .map-heading { position: absolute; top: 60px; left: 0; right: 0; text-align: center; }
[data-level='world'] .map-title { font-size: clamp(1.85rem, 1.3rem + 2.6vw, 2.4rem); letter-spacing: -0.03em; white-space: normal; }
[data-level='world'] .map-sub { margin-top: 6px; font-size: 0.98rem; font-weight: 500; }

/* The search: a round button that opens into a box; the places it finds drop down under it */
.map-search { position: relative; display: flex; justify-content: flex-end; margin-inline-start: auto; }
.map-searchbox {
  display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; height: 46px; padding: 0 16px; border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 23px; background: var(--glass-dark); color: var(--text-soft); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.8); cursor: text;
}
.map-searchbox svg { flex: none; width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; }
.map-search-input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: var(--text); font-size: 16px; font-weight: 500; outline: none; }
.map-search-input::placeholder { color: var(--text-soft); }
.map-search-input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.6; }
.map-top.is-searching .map-heading { display: none; }
/* Safari won't make a box narrower than its text field's 20 letters on its own, which ran it (and its list) off a
   phone's screen: min-width lets it take only the room left */
.map-top.is-searching .map-search { flex: 1; min-width: 0; }
.map-top.is-searching #map-search-open { display: none; }
/* The list ends above a phone's keyboard (--view-height: js/map/ui/layout.js followView), its last place in reach */
.map-results {
  position: absolute; top: 54px; left: 0; right: 0; z-index: 2; margin: 0; padding: 6px; overflow-y: auto; list-style: none;
  max-height: min(52vh, 420px, calc(var(--view-height, 100vh) - env(safe-area-inset-top) - 78px));
  border: 1px solid var(--edge); border-radius: 22px; background: var(--popup); box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.85);
}
.map-result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 14px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.map-result:hover, .map-result:focus-visible { background: var(--control); outline: none; }
.map-result img { flex: none; width: 28px; height: 28px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--gold-edge); }
.map-result span { display: grid; min-width: 0; }
.map-result b { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.map-result small { overflow: hidden; color: var(--text-soft); font-size: 0.82rem; text-overflow: ellipsis; white-space: nowrap; }
.map-results-note { padding: 14px; color: var(--text-soft); text-align: center; }

/* ---------- The bottom, just over the credits line (.map-credits) ---------- */
.map-bottom { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 28px); width: min(100% - 24px, 440px); transform: translateX(-50%); pointer-events: auto; }
.map-bottom:empty { display: none; }
/* The countries with the most trees in view, biggest first */
/* ---------- The bottom bar (js/map/ui/bottom.js): the visitor's own way in on the left, the countries to visit on the
   right, scrolling under a soft edge; on wide screens it spans the screen, corner to corner ---------- */
.map-bottom.is-bar { width: calc(100% - 24px); }
.map-bar { display: flex; align-items: center; gap: 10px; }
/* Alone (no country in view has trees yet), the visitor's own button stands in the middle */
.map-bar > .map-own:only-child { margin-inline: auto; }
.map-own { flex: none; gap: 8px; min-height: 50px; padding: 0 20px 0 16px; font-size: 0.98rem; font-weight: 700;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(246, 196, 83, 0.3), 0 0 22px -6px rgba(246, 196, 83, 0.35); }
.map-own svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* The first country shows whole: the soft edge at the start comes once the row has scrolled under it (is-scrolled:
   js/map/ui/bottom.js) */
.map-ranks { --start: 0px; --to: 90deg; display: flex; flex: 1; gap: 8px; min-width: 0; padding: 2px 0; overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(var(--to), transparent 0, #000 var(--start), #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(var(--to), transparent 0, #000 var(--start), #000 calc(100% - 26px), transparent); }
.map-ranks.is-scrolled { --start: 10px; }
[dir='rtl'] .map-ranks { --to: 270deg; }
.map-ranks::-webkit-scrollbar { display: none; }
.map-rank {
  display: flex; flex: none; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 14px; border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 23px; background: var(--glass-dark); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.map-rank.is-first { border-color: var(--gold); }
.map-rank b { color: var(--gold); font-size: 0.88rem; }
.map-rank img { width: 24px; height: 24px; border-radius: 50%; }
/* A card: a tree, or the place a tree goes */
.map-card { position: relative; padding: 18px; border: 1px solid var(--edge); border-radius: 28px; background: var(--popup); box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5); animation: rise 0.22s ease-out; }
.map-close { flex: none; width: 36px; height: 36px; }
.map-close svg { width: 19px; height: 19px; }
.map-card > .map-close { position: absolute; top: 12px; inset-inline-end: 12px; }
.map-card-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.map-art { display: grid; flex: none; place-items: center; width: 92px; height: 92px; border: 1px solid var(--edge); border-radius: 24px;
  background: radial-gradient(circle at 50% 62%, #23606a 0, #15394a 62%, #0f2235 100%); }
.map-art img { width: 78px; height: 78px; filter: var(--aura); }
.map-card-text { min-width: 0; }
.map-card h2 { margin: 0; padding-inline-end: 34px; font-size: 1.22rem; line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.map-meta { display: flex; align-items: center; gap: 7px; margin: 6px 0 0; color: var(--text-soft); font-size: 0.9rem; font-weight: 500; }
.map-meta img { flex: none; width: 18px; height: 18px; border-radius: 50%; }
.map-meta svg { flex: none; width: 18px; height: 18px; color: var(--gold); }
.map-meta.is-gifts { color: var(--text); font-weight: 600; }
.map-where { display: flex; align-items: center; gap: 10px; min-height: 30px; margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
.map-where img { flex: none; width: 26px; height: 26px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--gold); }
.map-where.is-hint { color: var(--text-soft); font-size: 1rem; font-weight: 600; }
.map-note { margin: 6px 0 16px; color: var(--text-soft); font-size: 0.9rem; }
.map-card .link-btn { display: block; margin: 10px auto 0; }
.map-failed { padding: 18px; border-radius: 22px; background: var(--popup); text-align: center; }

/* ---------- Markers (js/map/markers.js): forests, trees and flags in the trees' artwork with a gold glow ---------- */
.mk { display: flex; flex-direction: column; align-items: center; padding: 0; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 5px rgba(5, 7, 25, 0.9); -webkit-tap-highlight-color: transparent; }
.mk:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 14px; }
.mk-forest { position: relative; width: calc(88px * var(--s, 1)); height: calc(66px * var(--s, 1)); }
.mk-forest img { position: absolute; bottom: 0; filter: var(--aura); }
.mk-forest .c { left: 50%; z-index: 2; width: calc(64px * var(--s, 1)); height: calc(64px * var(--s, 1)); margin-left: calc(-32px * var(--s, 1)); }
.mk-forest .l, .mk-forest .r { bottom: calc(5px * var(--s, 1)); width: calc(46px * var(--s, 1)); height: calc(46px * var(--s, 1)); }
.mk-forest .l { left: 0; }
.mk-forest .r { right: 0; }
.mk-place .mk-forest { --s: 0.62; }
/* A continent: its forest, count and name */
.mk-cont b { margin-top: 2px; font-size: calc(19px * var(--s, 1)); font-weight: 700; line-height: 1.1; }
.mk-cont span { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
/* A crowded place (or places close together): a small forest, the count in gold, the name */
.mk-pill { position: relative; z-index: 3; margin-top: -2px; padding: 1px 8px; border-radius: 999px; background: var(--gold); color: var(--gold-ink);
  font-size: 12.5px; font-weight: 700; line-height: 18px; text-shadow: none; font-variant-numeric: tabular-nums; }
.mk-name { max-width: 120px; margin-top: 2px; overflow: hidden; font-size: 11.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
/* One tree: its artwork and its name */
.mk-tree img { width: 40px; height: 40px; filter: var(--aura); }
.mk-tree .mk-name { margin-top: -1px; font-size: 12px; }
/* Zoomed in, a place's trees one by one round its middle (js/map/markers.js spreadPlace), each coming out of it, and a
   "+N" there for the rest */
.mk-tree.is-spread .mk-in { display: flex; flex-direction: column; align-items: center; animation: mk-spread 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.15) both; }
@keyframes mk-spread { from { opacity: 0; transform: translate(var(--fx, 0), var(--fy, 0)) scale(0.5); } }
.mk-rest .mk-pill { margin-top: 0; }
/* A country: its round flag in a gold ring and its count */
.mk-flag img { width: var(--d, 40px); height: var(--d, 40px); border-radius: 50%; box-shadow: 0 0 0 2px var(--gold), 0 4px 10px rgba(0, 0, 0, 0.55); }
.mk-flag b { margin-top: 6px; padding: 0 8px; border: 1px solid var(--edge); border-radius: 999px; background: rgba(5, 7, 25, 0.86); font-size: 12.5px;
  font-weight: 700; line-height: 20px; text-shadow: none; font-variant-numeric: tabular-nums; }
/* The visitor's own tree: a gold ring under it and "Your tree" over it */
.mk.is-mine { position: relative; }
.mk.is-mine::before { content: attr(data-mine); order: -1; margin-bottom: 3px; padding: 0 10px; border-radius: 11px; background: var(--cream); color: var(--cream-ink);
  font-size: 11.5px; font-weight: 700; line-height: 22px; text-shadow: none; }
.mk.is-mine .mk-name { color: var(--gold); }
/* While a tree is being put on the map, the others step back */
.mk.is-dim { opacity: 0.5; pointer-events: none; }
.mk.is-dim .mk-name, .mk.is-dim .mk-pill { display: none; }

/* ---------- Putting a tree on the map (js/map/ui/drag-tree.js): the owner's tree, held and dragged over the still map;
   the middle of its ring is its point ---------- */
.map-drag { z-index: 5; display: flex; flex-direction: column; align-items: center; cursor: grab; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.map-drag.is-held { cursor: grabbing; }
.map-drag-chip { position: relative; height: 26px; margin-bottom: 4px; padding: 0 12px; border-radius: 13px; background: var(--cream); color: var(--cream-ink);
  font-size: 13px; font-weight: 700; line-height: 26px; white-space: nowrap; }
.map-drag-chip::after { content: ''; position: absolute; left: 50%; bottom: -5px; margin-left: -5px; border: 5px solid transparent; border-bottom: 0; border-top-color: var(--cream); }
.map-drag-tree { position: relative; z-index: 1; width: 76px; height: 76px; filter: drop-shadow(0 0 9px rgba(246, 196, 83, 0.7)) drop-shadow(0 5px 5px rgba(0, 0, 0, 0.6));
  transition: transform 0.18s ease-out; -webkit-user-drag: none; }
.map-drag-ring { display: block; width: 96px; height: 26px; margin-top: -17px; border: 2px dashed var(--gold); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(246, 196, 83, 0.28), rgba(246, 196, 83, 0)); transition: transform 0.18s ease-out; }
.map-drag.is-held .map-drag-tree { transform: translateY(-14px) scale(1.08); }
.map-drag.is-held .map-drag-ring { transform: scale(1.15); }
/* While the tree is held the card steps back, so the tree can pass over it */
.map-page.is-dragging .map-bottom { opacity: 0.45; pointer-events: none; transition: opacity 0.15s; }
/* Where the tree landed: is it here? No, or yes */
.map-ask { margin: 10px 0 0; font-weight: 600; line-height: 1.35; }
.map-ask + .map-note { margin-top: 4px; }
.map-answer { display: flex; gap: 10px; }
.map-answer .btn-ghost { flex: none; padding-inline: 22px; }
.map-answer .btn-primary { flex: 1; min-width: 0; }
/* The owner's switch on their tree's card: on the map, or hidden */
.map-visible { margin: 14px 2px 0; }
.map-visible .switch { margin: 0; font-weight: 600; }
.map-visible .fine-print { margin: 6px 0 0; font-size: 0.8rem; }

/* ---------- The website's visitors (js/map/ui/online.js): a small pill beside the search, the people now with a live
   dot and all so far; a tap opens a sheet with the day, the week and the day's top countries ---------- */
.map-online { display: inline-flex; flex: none; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border: 1px solid rgba(244, 241, 232, 0.14);
  border-radius: 22px; background: var(--glass-dark); color: var(--text); font: inherit; font-size: 0.86rem; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.8); transition: background-color 0.15s; }
.map-online:hover { background: #1c2850; }
.map-online[hidden], .map-top.is-searching .map-online, [data-level='picking'] .map-online { display: none; }
/* Over the world the title has its own line: the pill still sits by the search */
[data-level='world'] .map-online { margin-inline-start: auto; }
.map-online b { font-weight: 800; }
.map-online-now, .map-online-total { display: inline-flex; align-items: center; gap: 6px; }
.map-online-total { padding-inline-start: 10px; border-inline-start: 1px solid rgba(244, 241, 232, 0.2); color: var(--text-soft); }
.map-online-total svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.map-online-word { color: var(--text-soft); font-weight: 600; }
/* The live dot breathes on the compositor (scale and fade only) */
.map-online-dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; }
.map-online-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: #3ddc84; animation: online-ping 2s ease-out infinite; }
@keyframes online-ping { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.8); opacity: 0; } }
/* Once its Lottie is in (ui/online.js lightUp): the canvas is 3.2 times the dot, which keeps its place, with a little
   more room before the number so the rings never cross it */
.map-online-dot.is-lottie { width: 26px; height: 26px; margin-block: -9px; margin-inline: -9px -4px; background: none; }
.map-online-dot.is-lottie::after { content: none; }
.map-online-dot.is-lottie svg { display: block; }
@media (max-width: 719px) {
  /* Closer in the title shares the row: the numbers only */
  body:not([data-level='world']) .map-online-word { display: none; }
  .map-online { gap: 8px; padding: 0 12px; }
  .map-online-total { padding-inline-start: 8px; }
}
.map-online-box { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
.map-online-head { display: flex; align-items: center; gap: 10px; }
.map-online-head .map-online-dot { width: 11px; height: 11px; }
.map-online-head .map-online-dot.is-lottie { width: 35px; height: 35px; margin-block: -12px; margin-inline: -12px -6px; }
/* The sheet's titles cut what runs over; this short one keeps the light's rings whole */
.map-list-head .map-online-head { overflow: visible; }
.map-online-head b { font-size: 1.9rem; letter-spacing: -0.02em; }
.map-online-head span { color: var(--text-soft); font-size: 1.05rem; font-weight: 600; }
.map-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 4px; }
.map-stat { display: grid; gap: 2px; padding: 12px 12px 10px; border: 1px solid var(--hairline); border-radius: 18px; background: var(--glass); }
.map-stat b { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.map-stat span { color: var(--text-soft); font-size: 0.8rem; font-weight: 600; line-height: 1.25; }
.map-online-sub { margin: 18px 2px 8px; color: var(--text-soft); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.02em; }
.map-online-countries { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.map-online-countries li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 14px; background: var(--glass); }
.map-online-countries img { width: 24px; height: 24px; border-radius: 50%; }
.map-online-countries span { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.map-online-countries b { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- The first opening's Santa (js/map/ui/intro.js): over the world's title, which moves down while it plays and
   back once it goes. Only transform and opacity change, which a phone's compositor does without redrawing ---------- */
.map-page { --intro: clamp(124px, 36vw, 168px); }
.map-intro { position: absolute; top: -6px; left: 50%; width: var(--intro); height: var(--intro); margin-left: calc(var(--intro) / -2);
  pointer-events: none; transition: opacity 0.25s ease, transform 0.3s ease; }
.map-intro.is-done { opacity: 0; transform: scale(0.85); }
.map-heading > :not(.map-intro) { transition: transform 0.3s ease; }
.map-heading.has-intro > :not(.map-intro) { transform: translateY(calc(var(--intro) - 6px)); will-change: transform; }

/* ---------- "Add your tree to the map" (js/map/ui/add-sheet.js): a search box with what it finds, or the map ---------- */
.map-add-sheet { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.map-add .map-list-head p { margin-top: 4px; }
.map-searchbox.is-inline { margin: 16px 0 0; box-shadow: none; }
/* Above a phone's keyboard the list takes the room left under the sheet's title and box (176px with the sheet's top),
   so they all show together */
.map-results.is-inline { position: static; max-height: min(42vh, 360px, calc(var(--view-height, 100vh) - 176px)); margin: 8px 0 0; box-shadow: none; }
.map-add-here { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; }
.map-add-here svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.map-add-here:disabled { opacity: 0.6; }
.map-add-pick { margin-top: 10px; }
.map-searchbox + .map-add-pick, .map-results + .map-add-pick { margin-top: 14px; }

/* ---------- A crowded place's trees (a sheet over the dimmed map) ---------- */
.map-list-sheet { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.map-list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.map-list-head > div { flex: 1; min-width: 0; }
.map-list-head h2:focus { outline: none; }
.map-list-head p:not(:has(img)) { display: block; }
.map-list-head h2 { margin: 0; overflow: hidden; font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.02em; text-overflow: ellipsis; white-space: nowrap; }
.map-list-head p { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; color: var(--text-soft); font-size: 0.86rem; font-weight: 500; }
.map-list-head p img { width: 16px; height: 16px; border-radius: 50%; }
.map-tabs { display: flex; gap: 8px; margin: 14px 0 6px; }
.map-tabs .chip { padding: 6px 14px; font-size: 0.85rem; }
.map-list { margin: 0; padding: 0; list-style: none; }
.map-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 6px 2px; border: 0; border-bottom: 1px solid var(--hairline);
  background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.map-row:hover { background: rgba(255, 255, 255, 0.03); }
.map-row-rank { width: 22px; flex: none; color: var(--gold); font-size: 0.82rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.map-row-art { display: grid; flex: none; place-items: center; width: 50px; height: 50px; border: 1.5px solid var(--edge); border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, #23606a, #101a33); }
.map-row-art img { width: 40px; height: 40px; filter: drop-shadow(0 0 3px rgba(246, 196, 83, 0.45)); }
.map-row-text { display: grid; flex: 1; min-width: 0; }
.map-row-text b { overflow: hidden; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.map-row-text small { display: flex; align-items: center; gap: 5px; color: var(--text-soft); font-size: 0.82rem; font-weight: 500; }
.map-row-text small svg { width: 15px; height: 15px; color: var(--gold); }
.map-row-go { flex: none; color: var(--text-faint); font-size: 1.4rem; line-height: 1; }
[dir='rtl'] .map-row-go { transform: scaleX(-1); }
.map-list-note { padding: 22px 8px; color: var(--text-soft); text-align: center; }
.map-list-note .spinner { margin: 0 auto; }
.map-list-more { display: block; margin: 12px auto 4px; }

/* ---------- Whose data the map shows: one faint line at the very bottom, under the bottom bar and the cards ---------- */
.map-credits { position: absolute; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 4px); max-width: calc(100% - 24px); margin: 0;
  padding: 1px 8px; border-radius: 8px; background: rgba(5, 7, 25, 0.55); color: var(--text-faint); font-size: 9.5px; line-height: 14px;
  white-space: nowrap; text-align: end; pointer-events: auto; }
.map-credits a { color: inherit; text-decoration: none; }
.map-credits a:hover { color: var(--text-soft); text-decoration: underline; }
[dir='rtl'] .map-credits { right: auto; left: 12px; }
/* Still one line on the narrowest phones */
@media (max-width: 340px) { .map-credits { font-size: 8.5px; } }

/* Dialogs and sheets darken the map in indigo, not the tree pages' pine. They keep to the part of the page in view
   (--view-top, --view-height: js/map/ui/layout.js followView): with a phone's keyboard up, a sheet sits right above it
   and what's typed and found shows, not under it */
.map-page .modal-backdrop { top: var(--view-top, 0px); bottom: auto; height: var(--view-height, 100%); background: rgba(4, 6, 20, 0.72); }
.map-page .modal { max-height: calc(var(--view-height, 100vh) - 32px); }
.map-page .modal.sheet { max-height: min(92dvh, 880px, calc(var(--view-height, 100dvh) - 12px)); }
.map-noscript { position: fixed; inset: auto 16px 24px; z-index: 20; padding: 16px; border-radius: 18px; background: var(--popup); text-align: center; }

@media (min-width: 720px) {
  .map-top { left: 24px; right: 24px; }
  [data-level='world'] .map-heading { top: 64px; }
  .map-bottom.is-bar { width: calc(100% - 48px); }
  .map-bar .map-ranks { flex: 0 1 auto; margin-inline-start: auto; }
  /* Under the bar's right end */
  .map-credits { right: 24px; }
  [dir='rtl'] .map-credits { left: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .map-card, .mk-tree.is-spread .mk-in { animation: none; }
  .map-drag-tree, .map-drag-ring { transition: none; }
  .map-online-dot::after { animation: none; }
  .map-skeleton i { animation: none; }
}
