/* The map pages (2026-11-16, the redesign; the 3D map and the Map tab share it): the map fills the screen under the
   site's header, the tools spread around it as map apps do (the owner: "spreading around the tool usages ... don't
   clutter the screen"): the title and search at the top, a column of tool buttons on the left that each open their own
   panel, round buttons bottom right, small readouts in the corners. Phones: the tool column is a bar along the bottom
   and panels open as sheets. Built from site.css's tokens; map-page.js sets --m3-top to the header's height. */
.m3-app { position: fixed; z-index: 25; /* over the footer, under the header (30) */ top: var(--m3-top, 66px); right: 0; bottom: 0; left: 0;
  overflow: hidden; background: var(--bg); --glass: rgba(14, 24, 22, 0.88); }
body:has(.m3-app) .site-foot { display: none; } /* the map is the whole page */
body:has(.m3-app) main { z-index: 2; } /* site.css gives main and the footer the same layer */
.m3-view { position: absolute; inset: 0; }
.m3-view canvas { display: block; }
.m3-glass, .m3-title, .m3-coords, .m3-compass, .m3-fly, .m3-rail, .m3-fab, .m3-toast, .ml-foot > * {
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }

/* the top: title left, search in the middle, the other map right */
.m3-top { position: absolute; z-index: 6; top: 14px; left: 14px; right: 14px; display: flex; align-items: flex-start; gap: 10px; pointer-events: none; }
.m3-top > * { pointer-events: auto; }
.m3-title { display: flex; flex-direction: column; padding: 8px 14px; border-radius: var(--radius-sm); }
.m3-title .eyebrow { margin: 0 0 3px; font-size: 0.7rem; }
.m3-title b { font: 700 1.25rem/1 var(--display); letter-spacing: 0.6px; text-transform: uppercase; }
.m3-searchbox { flex: 0 1 420px; margin: 0 auto; }
.m3-search { width: 100%; padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); color: var(--text);
  font: inherit; font-size: 0.95rem; box-shadow: var(--shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.m3-search:focus { border-color: var(--accent); outline: none; }
.m3-hint { margin: 6px 0 0; padding: 0 16px; color: var(--text); text-shadow: 0 1px 3px #000; }
.m3-hint:empty { display: none; }
.m3-hint.bad { color: var(--orange); }
.m3-switch { margin-left: auto; padding: 10px 16px; box-shadow: var(--shadow); }
.m3-switch.ghost { background: var(--glass); }
.ml-state { align-self: center; }

/* the tool column, left; each button opens its own panel beside it */
.m3-rail { position: absolute; z-index: 7; top: 92px; left: 14px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: var(--radius); box-shadow: var(--shadow); }
.m3-rail-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 62px; padding: 8px 2px; border: 0; border-radius: 10px;
  background: none; color: var(--muted); font: 600 0.68rem var(--body); cursor: pointer; }
.m3-rail-btn span { font-size: 1.3rem; line-height: 1; }
.m3-rail-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
.m3-rail-btn[aria-expanded=true] { background: rgba(244, 178, 95, 0.16); color: var(--accent); }
.m3-fly { position: absolute; z-index: 7; top: 92px; left: 96px; width: 330px; max-height: calc(100% - 106px); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 16px 14px; border-radius: var(--radius); box-shadow: var(--shadow); }
.m3-fly[hidden] { display: none; }
.m3-fly-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; margin: 0 -16px 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.m3-fly-head h2 { margin: 0; color: var(--text); }
.m3-fly-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2);
  color: var(--muted); cursor: pointer; }
.m3-fly-close:hover { color: var(--text); }
.m3-fly h3 { margin: 14px 0 6px; font-size: 0.92rem; }
.m3-note { margin: 4px 0 8px; font-size: 0.78rem; }
.m3-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.m3-row .button { flex: 1 1 auto; padding: 8px 12px; font-size: 0.9rem; }
.m3-places { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.m3-place { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--text);
  font: 500 0.92rem var(--body); text-align: left; cursor: pointer; }
.m3-place:hover, .m3-place:focus-visible { background: rgba(255, 255, 255, 0.05); }
.m3-place.kind-landmark { color: var(--accent); }
.m3-place-ico { flex: none; width: 1.2em; text-align: center; }
/* a toggle: its label, and a switch drawn after it by its aria-pressed */
.m3-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 6px 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--bg-2); color: var(--text); font: 500 0.92rem var(--body); text-align: left; cursor: pointer; }
.m3-toggle::after { content: ""; flex: none; width: 34px; height: 18px; border-radius: 999px; background-color: #6d7d76;
  box-shadow: inset -16px 0 0 2px #33433d, inset 0 0 0 2px #33433d; transition: box-shadow 0.15s; }
.m3-toggle[aria-pressed=true]::after { background-color: #1b1206; box-shadow: inset 16px 0 0 2px var(--accent), inset 0 0 0 2px var(--accent); }
.m3-field { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 14px; }
.m3-label { display: flex; justify-content: space-between; color: var(--text); font-weight: 600; font-size: 0.9rem; }
.m3-field input[type=range] { width: 100%; accent-color: var(--accent); }
.m3-seg { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.m3-seg button { padding: 8px 4px; border: 0; border-right: 1px solid var(--line); background: var(--bg-2); color: var(--muted); font: 600 0.82rem var(--body); cursor: pointer; }
.m3-seg button:last-child { border-right: 0; }
.m3-seg button[aria-pressed=true] { background: rgba(244, 178, 95, 0.16); color: var(--accent); }
.m3-helplist { margin: 0; padding-left: 18px; color: #c9d6cf; font-size: 0.88rem; }
.m3-helplist li { margin: 8px 0; }
.m3-fly kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-2); font: 600 0.75rem var(--body); }

/* readouts and round buttons */
.m3-hud { position: absolute; z-index: 6; top: 80px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.m3-compass { position: relative; width: 52px; height: 52px; border-radius: 50%; }
.m3-compass svg { position: absolute; inset: 6px; }
.m3-compass span { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); padding: 0 4px; border-radius: 4px; background: var(--bg); color: var(--red); font: 700 0.7rem var(--body); }
.m3-coords { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text); font: 600 0.8rem var(--body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.m3-coords:empty { display: none; }
.m3-actions { position: absolute; z-index: 6; right: 14px; bottom: 250px; display: flex; flex-direction: column; gap: 8px; }
.m3-fab { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border-radius: 50%; color: var(--text); font: 700 1.25rem/1 var(--body);
  box-shadow: var(--shadow); cursor: pointer; }
.m3-fab:hover { border-color: var(--accent); }
.m3-fab[aria-pressed=true] { border-color: var(--accent); background: rgba(244, 178, 95, 0.22); }
.m3-minimap { position: absolute; z-index: 6; right: 14px; bottom: 14px; width: 220px; height: 220px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); box-shadow: var(--shadow); cursor: crosshair; }
.m3-foot { position: absolute; z-index: 5; left: 14px; bottom: 10px; max-width: min(520px, 50vw); margin: 0; color: #c9d6cf; text-shadow: 0 1px 3px #000; pointer-events: none; }
.m3-toast { position: absolute; z-index: 6; top: 80px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  max-width: min(560px, calc(100% - 200px)); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.m3-toast p { margin: 0; }

/* ----- the Map tab: the view fills the page; map.js keeps the map square inside it, never stretched ----- */
.ml-app .map-view.ml-view { position: absolute; inset: 0; width: auto; height: auto; margin: 0; aspect-ratio: auto; border: 0; border-radius: 0; background: #0f2a3c; }
.ml-app .map-world { right: auto; bottom: auto; }
.ml-app .m3-actions { bottom: 64px; }
.ml-foot { position: absolute; z-index: 6; left: 14px; right: 80px; bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; pointer-events: none; }
.ml-foot > * { pointer-events: auto; border-radius: var(--radius-sm); }
.ml-source { padding: 7px 12px; font-size: 0.85rem; }
.ml-credit { padding: 5px 10px; color: var(--muted); }
.ml-app .legend { grid-template-columns: 1fr; gap: 4px; margin: 6px 0 8px; }
.ml-app .legend-actions { display: flex; gap: 14px; margin-bottom: 4px; }
.ml-form { flex-direction: column; align-items: stretch; }
.ml-form .text, .ml-form .button { width: 100%; }
.ml-app .feed { margin-top: 10px; }

/* phones and narrow windows: the tool column is a bar along the bottom; panels open as sheets above it */
@media (max-width: 760px) {
  .m3-top { flex-wrap: wrap; }
  .m3-title { display: none; }
  .m3-searchbox { order: 3; flex: 1 1 100%; }
  .m3-rail { top: auto; bottom: 10px; left: 10px; right: 10px; flex-direction: row; justify-content: space-around; }
  .m3-rail-btn { width: auto; flex: 1; }
  .m3-fly { top: auto; left: 10px; right: 10px; bottom: 84px; width: auto; max-height: 60%; }
  .m3-actions, .ml-app .m3-actions { bottom: 92px; }
  .m3-minimap { display: none; }
  .m3-foot { display: none; }
  .ml-foot { bottom: 84px; right: 70px; }
  .ml-credit { display: none; }
  .m3-hud { top: 128px; }
  .m3-toast { top: 70px; max-width: calc(100% - 28px); }
  .m3-switch span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .m3-toggle::after { transition: none; } }
/* the panel's forms stack their boxes: site.css's "flex: 1 1 170px" for them turned into 170 px of height (the owner,
   2026-11-16: "the boxes you can type in are huge") */
.ml-form .text, .ml-form select.text { flex: 0 0 auto; min-width: 0; height: auto; padding: 9px 12px; font-size: 0.92rem; }
.ml-form .check { margin: 2px 0; }
