:root {
  --chrome: #f3f4f6;
  --chrome-2: #e5e7eb;
  --chrome-3: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --accent: #1d4ed8;
  --accent-soft: #dbeafe;
  --danger: #b91c1c;
  --topbar-h: 48px;
  --left-w: 360px;
  --right-w: 320px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #000;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top top" "left globe right";
  overflow: hidden;
}

/* ---------- top bar ---------- */
#topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 12px 0 16px;
  background: var(--chrome);
  border-bottom: 1px solid var(--chrome-3);
  z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: .01em; }
.brand-sub { color: var(--muted); font-size: 13px; }
.search { position: relative; flex: 0 1 300px; min-width: 150px; }
.search-icon { position: absolute; left: 9px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
#search-input {
  width: 100%; height: 32px; padding: 0 28px 0 32px; font: inherit; font-size: 13px; color: var(--text);
  border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; outline: none;
}
#search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 4px; }
.search-clear:hover { background: var(--chrome-2); color: var(--text); }
.search-close { display: none; }
.search-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; margin: 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid var(--chrome-3); border-radius: 6px; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto;
}
.search-item { padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item:hover, .search-item[aria-selected="true"] { background: var(--accent-soft); }
.search-item.coords { font-weight: 600; }
.search-item.none { color: var(--muted); cursor: default; background: transparent !important; }
.clock { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
/* Ten tool buttons since the analysis tools came: on a narrower desktop the subtitle goes first, then
   the clock's room, then the buttons pack tighter, so the bar never wraps or scrolls. */
.clock { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 1240px) { .brand-sub { display: none; } }
@media (max-width: 1100px) { .topbar-actions { gap: 1px; } .topbar-actions .icon-btn { width: 33px; } }
@media (max-width: 1000px) { .clock { display: none; } .topbar-actions { margin-left: auto; } }
.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent; color: #374151;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { background: var(--chrome-2); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: #bfdbfe; }

/* ---------- sidebars ---------- */
.sidebar {
  background: var(--chrome);
  width: 0; overflow: hidden;
  display: flex; flex-direction: column;
  transition: width .18s ease;
  z-index: 4;
}
.sidebar.left { grid-area: left; border-right: 1px solid var(--chrome-3); }
.sidebar.right { grid-area: right; border-left: 1px solid var(--chrome-3); }
.sidebar.left.open { width: var(--left-w); }
.sidebar.right.open { width: var(--right-w); }
.sidebar > * { min-width: var(--left-w); }
.sidebar.right > * { min-width: var(--right-w); }

.list-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--chrome-3); }
.list-head h2 { margin: 0 0 4px; font-size: 16px; line-height: 1.3; }
.list-cap { margin-top: 6px; padding: 6px 8px; border-radius: 6px; background: #fef3c7; color: #78350f; font-size: 12px; line-height: 1.4; }
.list-cap .btn-small { display: block; margin-top: 6px; padding: 3px 8px; }
.topbar-reset { flex: none; white-space: nowrap; padding: 4px 10px; }
.window-custom { margin-top: 8px; }
.window-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.window-dates label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.window-dates input { font: inherit; font-size: 13px; color: var(--text); padding: 5px 6px; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; min-width: 0; }
.window-dates input.invalid { border-color: var(--danger); }
#win-apply { margin-top: 8px; width: 100%; }
.window-custom .hint.error { color: var(--danger); }
.list-status { color: var(--muted); font-size: 13px; min-height: 18px; }
.list-status.error { color: var(--danger); }
.list-controls { margin-top: 10px; display: flex; gap: 8px; }
.list-check { margin-top: 6px; font-size: 13px; }
.only-view-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 0 24px; font-size: 12px; color: var(--muted); }
.only-view-hint .btn { white-space: nowrap; flex: none; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin-top: 8px; }
.field select, .field input {
  font: inherit; font-size: 14px; color: var(--text);
  padding: 6px 8px; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff;
}
.field input[type=number] { width: 90px; }
.mag-custom { margin-top: 8px; }
.mag-custom-row { display: flex; align-items: center; gap: 8px; }
.seg.seg-op { flex: none; }
.seg.seg-op button { width: 36px; flex: none; font-size: 15px; padding: 5px 0; }
.mag-field { flex: 1; }
.mag-field input { width: 100%; }
.field input.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(185,28,28,.15); outline: none; }
.hint.error { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.list { flex: 1; position: relative; overflow-y: auto; overscroll-behavior: contain; }
#list-spacer { position: relative; width: 100%; }
.row {
  position: absolute; left: 0; right: 0; height: 60px;
  padding: 0 14px 0 12px;
  border-bottom: 1px solid var(--chrome-2);
  border-left: 4px solid transparent;
  cursor: pointer; user-select: none;
}
.row-head { display: flex; align-items: center; gap: 12px; height: 59px; }
.row:hover { background: #fff; }
.row.selected { background: var(--accent-soft); }
.row .mag { width: 38px; text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.row.big .mag { font-weight: 700; }
.row .body { flex: 1; min-width: 0; }
.row .place { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.big .place { font-weight: 600; }
.row .meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.list-empty { padding: 24px 16px; color: var(--muted); text-align: center; }

/* ---------- detail panel ---------- */
.detail {
  position: relative;
  border-top: 2px solid var(--chrome-3);
  background: #fff;
  padding: 14px 16px 14px;
  max-height: 50%;
  overflow-y: auto;
}
/* With the list sidebar closed, the same panel floats over the globe (bottom-left, above the readout). */
.detail.floating {
  position: absolute; left: 12px; bottom: 96px; z-index: 6;
  width: 340px; max-width: calc(100% - 24px); max-height: calc(100% - 120px);
  border-top: 0; border-radius: var(--radius); box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.18);
}
.close-btn {
  position: absolute; top: 8px; right: 10px;
  width: 28px; height: 28px; border: 0; background: transparent; border-radius: 6px;
  font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer;
}
.close-btn:hover { background: var(--chrome-2); color: var(--text); }
.detail-title { display: block; font-size: 16px; font-weight: 700; color: var(--accent); text-decoration: none; padding-right: 28px; line-height: 1.3; }
.detail-title:hover { text-decoration: underline; }
.detail-title::after { content: " ↗"; font-weight: 400; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 12px 0 0; font-size: 13px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-variant-numeric: tabular-nums; }
/* The energy beside a magnitude: "≈ 197 GWh", quieter than the magnitude it explains. */
.energy { margin-left: 6px; color: var(--muted); white-space: nowrap; cursor: help; }
.detail-actions { display: flex; flex-wrap: wrap; column-gap: 8px; row-gap: 0; margin-top: 14px; }
.detail-actions .btn { flex: 1; }
/* Intensity contours and the moment tensor: a row of their own under the moment and antipode buttons,
   the contours taking what the moment tensor leaves. The ::after is the line break between the rows. */
.detail-actions::after { content: ''; order: 1; flex: 0 0 100%; height: 0; }
.detail-actions .btn-mmi, .detail-actions .btn-mt { order: 2; margin-top: 8px; }
.detail-actions .btn-mmi { flex: 1 1 0; min-width: 0; }   /* never pushes the beachball to a line of its own */
.detail-actions .btn-mt { flex: 0 0 auto; padding-left: 10px; padding-right: 10px; }
/* Nearest volcanoes joins them, between the two, so the card keeps two rows of buttons; alone (an earthquake
   too small for either) it has the row to itself. With all three (`three`, set by paintVolcButton in
   js/app.js) each takes a third and is a word: Intensity, Volcanoes, Beachball. */
.detail-actions .btn-volc { order: 2; flex: 1 1 auto; margin-top: 8px; white-space: nowrap; }
.detail-actions .btn-mmi { white-space: nowrap; }
.detail-actions.three .btn-mmi, .detail-actions.three .btn-volc, .detail-actions.three .btn-mt {
  flex: 1 1 0; min-width: 0; padding-left: 6px; padding-right: 6px; gap: 5px; white-space: nowrap;
}
/* "Intensity ↻" / "Beachball ↻" (USGS could not be reached; a tap retries): the ↻ stands in for the icon. */
.detail-actions.three .btn[data-state="error"] .opp-icon { display: none; }
.detail-actions .btn-mmi:disabled, .detail-actions .btn-mt:disabled { opacity: .55; cursor: default; font-weight: 500; }
.detail-actions .btn-mmi:disabled:hover, .detail-actions .btn-mt:disabled:hover { background: #fff; }
.mmi-icon { stroke-width: 1.6; }
.mt-icon { stroke-width: 1.6; }
.mt-icon .q { fill: currentColor; stroke: none; }
.btn {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--chrome-3); background: #fff; color: var(--text);
}
.btn:hover { background: var(--chrome-2); }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* ---------- globe area ---------- */
#globe-wrap { grid-area: globe; position: relative; min-width: 0; background: #000; }
#globe { position: absolute; inset: 0; }
#globe .cesium-viewer, #globe .cesium-widget, #globe .cesium-widget canvas { width: 100%; height: 100%; }
.cesium-viewer-bottom { display: none; }

.readout {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(255,255,255,.9); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 12px; font-size: 12.5px; font-variant-numeric: tabular-nums;
  pointer-events: none; min-width: 250px;
}
.readout .k { color: var(--muted); display: inline-block; width: 64px; }

/* + / − zoom, bottom right of the globe (desktop; hidden in the phone layout, which pinches) */
.zoom-ctl {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; flex-direction: column;
  background: rgba(255,255,255,.9); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.zoom-ctl button {
  width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--text);
  display: grid; place-items: center; cursor: pointer;
}
.zoom-ctl button + button { border-top: 1px solid var(--chrome-3); }
.zoom-ctl button:hover { background: var(--chrome-2); }
.zoom-ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.zoom-ctl svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
body.mobile .zoom-ctl { display: none; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 6;
  background: rgba(17,24,39,.92); color: #fff;
  padding: 5px 9px; border-radius: 6px; font-size: 12.5px; white-space: nowrap;
  transform: translate(12px, 12px);
}
.tooltip b { color: #fbbf24; }

.banner {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.94); border-radius: 999px; box-shadow: var(--shadow);
  padding: 6px 8px 6px 16px; font-size: 13px; z-index: 6; white-space: nowrap;
}
.banner .btn-small { border-radius: 999px; }

/* ---------- Sun & Moon moment panel (top-right of the globe area on a desktop) ---------- */
.moment-panel {
  position: absolute; top: 12px; left: 12px; z-index: 6; width: 250px;
  background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 14px 14px; font-size: 13px; display: flex; flex-direction: column;
  zoom: 0.85; /* 85% of the original panel size, text and all */
}
.moment-head { font-weight: 700; font-size: 14px; }
.moment-time { font-variant-numeric: tabular-nums; margin-top: 2px; }
.moment-quake { color: var(--muted); font-size: 12px; margin-top: 2px; }
.moment-moon { display: flex; align-items: center; gap: 12px; margin: 12px 0 10px; padding: 10px 0;
  border-top: 1px solid var(--chrome-2); border-bottom: 1px solid var(--chrome-2); }
.moment-moon .moon-icon { display: block; flex: none; }
.moment-phase { font-weight: 700; font-size: 14px; }
.moment-sub { color: var(--muted); font-variant-numeric: tabular-nums; }
.moment-grid { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 0; }
.moment-grid dt { color: var(--muted); }
.moment-grid dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.moment-panel .hint { margin: 10px 0 12px; line-height: 1.4; }
.moment-panel #mp-return { align-self: stretch; }

/* Cesium's own logo and data credits, pinned to the foot of the settings sidebar. */
.credits {
  flex: none; padding: 8px 16px; border-top: 1px solid var(--chrome-3);
  background: var(--chrome); font-size: 10px; color: var(--muted);
}
/* Cesium nests its credits in .cesium-widget-credits, which its own stylesheet pins to the
   bottom-left of the page. Keep it in the flow so it stays inside the sidebar. */
.credits .cesium-widget-credits {
  position: static; display: block; padding: 0; line-height: 1.5;
  color: inherit; font-size: inherit; text-shadow: none;
}
.credits .cesium-credit-logoContainer { display: inline; margin-right: 6px; }
.credits .cesium-credit-logoContainer img { height: 14px; opacity: .65; vertical-align: middle; }
.credits .cesium-credit-textContainer, .credits .cesium-credit-expand-link { display: inline; color: inherit; font-size: 10px; }
.credits .cesium-credit-expand-link { margin-left: 6px; cursor: pointer; text-decoration: underline; }
.credits a { color: inherit; }
/* The pop-up that "Data attribution" opens, over the top bar and sidebars. */
.cesium-credit-lightbox-overlay { z-index: 30; }
.cesium-credit-lightbox { z-index: 31; }

/* ---------- measure tool ---------- */
/* The tool panels (measure, inner Earth, faults, volcanoes, region, depth viewer, Sun, the intensity
   legend): a stack at the top LEFT of the globe, ending above the cursor readout in the bottom-left
   corner. The earthquake's own popups — Sun & Moon at this moment, the beachball — sit at the top right. */
.overlay-tools {
  position: absolute; top: 12px; left: 12px; z-index: 6; max-height: calc(100% - 24px - 64px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none;
}
.overlay-tools > * { pointer-events: auto; }
body:not(.mobile) .moment-panel { left: auto; right: 12px; }
body:not(.mobile) .mt-panel { left: auto; right: 12px; }
.measure-panel {
  width: 280px;
  background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.antipode-panel {
  width: 310px; min-height: 0; overflow-y: auto;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.opp-icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; vertical-align: -3px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ap-title { display: inline-flex; align-items: center; gap: 7px; }
.antipode-panel .measure-head .close-btn { position: static; }
/* Collapse to the title bar: antipode view stays on, the map gets the space back. */
.chevron-btn {
  width: 28px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chevron-btn:hover { background: var(--chrome-2); color: var(--text); }
.chevron-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease; }
.antipode-panel .ap-title { margin-right: auto; }
.ap-head-count { margin-right: 2px; font-weight: 400; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.antipode-panel.collapsed { padding-bottom: 4px; }
.antipode-panel.collapsed .measure-head { margin-bottom: 0; }
.antipode-panel.collapsed .ap-body { display: none; }
.antipode-panel.collapsed .ap-collapse svg { transform: rotate(180deg); }
.ap-focus { margin: 4px 0 8px; padding: 7px 8px; border-radius: 6px; background: var(--chrome); font-size: 12.5px; }
.ap-focus-quake { font-weight: 600; line-height: 1.35; }
.ap-focus-coords { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ap-focus-coords .k { color: var(--muted); }
/* The same cyan diamond that marks the antipode on the globe. */
.ap-diamond { width: 13px; height: 13px; flex: none; fill: #38bdf8; stroke: rgba(0,0,0,.85); stroke-width: 2.4; stroke-linejoin: round; }
.ap-quakes li .ap-num { flex: none; min-width: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ap-status { margin: 2px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.ap-top-actions { display: flex; gap: 6px; }
.ap-top-actions .ap-activate { flex: 1; }
.ap-globe-mode { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.ap-globe-mode .seg { flex: 1; margin: 0; }
/* Inner Earth section: the globe mode, one checkbox per interior layer, then the note. */
/* Each section folds away on its own chevron, independently of the whole panel. */
.ap-sec + .ap-sec { margin-top: 4px; }
.ap-sec-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 0 2px; padding: 4px 0; border: 0; border-top: 1px solid var(--chrome-2);
  background: transparent; cursor: pointer; text-align: left;
  font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.ap-sec:first-child .ap-sec-head { margin-top: 0; padding-top: 0; border-top: 0; }
.ap-sec-head:hover { color: var(--text); }
.sec-chevron { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .16s ease; }
.ap-sec.collapsed .sec-chevron { transform: rotate(180deg); }
.ap-sec.collapsed .ap-sec-body { display: none; }
/* Interior layers: one checkbox each, only meaningful on the see-through globe. */
/* Two columns: four short labels in half the height, leaving the map more room. */
.ap-shells { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; padding: 4px 0 0; }
.ap-shell-row { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; }
/* The dimming goes on the label, not the row: opacity on an ancestor would take the info panel
   with it (a descendant cannot opt back out of a parent's opacity group), and the description
   should stay readable for a layer the solid globe is hiding. */
.ap-shell-row.off .ap-shell { opacity: .45; cursor: default; }
.ap-shell { flex: 1; min-width: 0; font-size: 12.5px; padding: 3px 0; gap: 6px; }
.ap-shell-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-shell input { width: 15px; height: 15px; }
.ap-swatch { width: 12px; height: 12px; flex: none; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); }

/* The circled "i" and the panel it opens on hover or keyboard focus. */
.ap-info {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.3px solid var(--chrome-3); background: #fff; color: var(--muted);
  font-size: 11px; font-weight: 700; font-family: Georgia, "Times New Roman", serif;
  display: inline-flex; align-items: center; justify-content: center; cursor: help; user-select: none;
}
.ap-info:hover, .ap-info:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
/* Fixed, not absolute: the panel scrolls and would otherwise clip the panel off at its own edge.
   Parked off-screen until _placeInfo measures it and flips it above the icon if space is short. */
.ap-info-pop {
  display: none; position: fixed; top: -9999px; left: 0; z-index: 30; width: 278px;
  padding: 10px 12px 11px; border: 1px solid var(--chrome-3); border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow);
  font: 400 11.5px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text); cursor: default; white-space: normal;
  /* Nothing in here is clickable, and it overhangs the rows below it: let the
     pointer through so a neighbouring row's icon or checkbox stays reachable. */
  pointer-events: none;
}
.ap-info:hover .ap-info-pop, .ap-info:focus .ap-info-pop, .ap-info:focus-within .ap-info-pop,
.ap-info.open .ap-info-pop { display: block; }
.ap-info.open { border-color: var(--accent); color: var(--accent); }
.ap-info-title { display: block; font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.ap-info-text { display: block; color: var(--muted); }
.ap-info-facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--chrome-2);
}
.ap-info-facts .k { color: var(--muted); }
.ap-info-facts .v { font-weight: 600; }
.ap-info-note {
  display: block; margin-top: 8px; padding: 7px 8px; border-radius: 6px;
  background: var(--accent-soft); color: #1e3a8a;
}
.ap-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; color: var(--muted); }
.ap-hint.warn { color: #92400e; }
.ap-groups { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ap-group { border: 1px solid var(--chrome-3); border-radius: 6px; padding: 7px 8px; background: #fff; }
.ap-group.collecting { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ap-group-head { display: flex; align-items: center; gap: 6px; }
.ap-color { width: 26px; height: 22px; padding: 0; border: 1px solid var(--chrome-3); border-radius: 4px; background: none; cursor: pointer; flex: none; }
.ap-name { flex: 1; min-width: 0; font: inherit; font-size: 13px; font-weight: 600; border: 1px solid transparent; border-radius: 4px; padding: 2px 4px; background: transparent; color: var(--text); }
.ap-name:hover, .ap-name:focus { border-color: var(--chrome-3); background: #fff; outline: none; }
.ap-show { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ap-show input { margin: 0; accent-color: var(--accent); }
.ap-group .close-btn { position: static; width: 22px; height: 22px; font-size: 16px; flex: none; }
.ap-group-actions { display: flex; gap: 6px; margin-top: 6px; }
.ap-group-actions .btn { flex: 1; padding: 4px 6px; }
.ap-quakes { list-style: none; margin: 6px 0 0; padding: 0; max-height: 132px; overflow-y: auto; }
.ap-quakes li { display: flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 0; border-top: 1px solid var(--chrome-2); }
.ap-quakes li span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; border-radius: 3px; }
.ap-remove:hover { background: var(--chrome-2); color: var(--text); }
.ap-empty { margin: 6px 0 0; font-size: 12px; color: var(--muted); }
.ap-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); }
.antipode-panel .btn:disabled { opacity: .45; cursor: default; }
.measure-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.measure-head .close-btn { position: static; }
.measure-grid { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-variant-numeric: tabular-nums; }
.measure-grid dt { color: var(--muted); }
.measure-grid dd { margin: 0; font-weight: 600; }
/* The readout on the title row, between "Measure" and the ×: label and value side by side, a second
   line (Area) only once a shape is closed. */
.measure-panel .measure-head { gap: 10px; margin-bottom: 8px; }
.measure-panel .measure-head .measure-grid {
  flex: 1 1 auto; min-width: 0; gap: 1px 8px;
  font-size: 13px; font-weight: 400; line-height: 1.3;
}
.measure-panel .measure-head .measure-grid dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.measure-panel .m-tap { display: none; }
.measure-panel .hint { margin: 8px 0 0; line-height: 1.4; }

/* The intensity contours' legend: ShakeMap's scale, strongest at the top, the levels this map does not
   reach faded. */
.mmi-panel {
  width: 272px;
  background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.mmi-quake { margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.mmi-max { margin: 2px 0 8px; font-size: 12px; color: var(--muted); }
.mmi-max:empty { display: none; }
.mmi-scale { width: 100%; border-collapse: collapse; font-size: 12px; }
.mmi-scale th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 0 0 4px; }
.mmi-scale td { padding: 2px 0; vertical-align: middle; white-space: nowrap; }
.mmi-sw {
  display: block; width: 24px; height: 13px; border-radius: 3px;
  border: 1px solid rgba(0,0,0,.28); box-sizing: border-box;
}
.mmi-num { padding: 0 8px !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.mmi-scale .mmi-dmg { color: var(--muted); padding-left: 8px; }
.mmi-scale tr.off { opacity: .35; }
.mmi-scale tr.top .mmi-shake { font-weight: 700; }
.mmi-note, .mmi-src { margin: 8px 0 0; font-size: 11px; line-height: 1.4; }
.mmi-src a { color: var(--accent); }
/* The moment tensor popup: top right of the map (desktop), dragged by its header anywhere inside it. */
.mt-panel {
  position: absolute; top: 12px; left: 12px; z-index: 7; width: 256px;
  max-height: calc(100% - 24px); overflow-y: auto; box-sizing: border-box;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px 12px 10px; font-size: 12.5px;
}
.mt-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin: -8px -12px 0; padding: 8px 8px 4px 12px;
  font-weight: 700; font-size: 14px; cursor: move; user-select: none; -webkit-user-select: none; touch-action: none;
}
.mt-panel.dragging { box-shadow: 0 10px 28px rgba(0,0,0,.28); }
.mt-panel.dragging .mt-head { cursor: grabbing; }
.mt-head .close-btn { position: static; cursor: pointer; }
.mt-title { display: inline-flex; align-items: center; gap: 7px; }
.mt-quake { margin: 0 0 4px; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--muted); }
.mt-ball { display: block; margin: 0 auto; }
.mt-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.mt-facts dt { color: var(--muted); }
.mt-facts dd { margin: 0; font-weight: 600; }
.mt-facts [hidden] { display: none; }
.mt-src { margin: 6px 0 0; font-size: 11px; line-height: 1.4; }
.mt-src a { color: var(--accent); }
.mt-legend-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin: 8px 0 0; padding: 6px 2px 4px; border: 0; border-top: 1px solid var(--chrome-3); background: none;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer;
}
.mt-chev { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.mt-legend-toggle[aria-expanded="false"] .mt-chev { transform: rotate(-90deg); }
.mt-legend { font-size: 11.5px; line-height: 1.38; }
.mt-legend p { margin: 2px 0 6px; color: var(--muted); }
.mt-sdr { display: grid; grid-template-columns: max-content 1fr; gap: 3px 8px; margin: 0 0 7px; }
.mt-sdr dt { font-weight: 700; }
.mt-sdr dd { margin: 0; color: var(--muted); }
.mt-colors { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.mt-colors > div { display: flex; gap: 7px; align-items: flex-start; }
.mt-sw { flex: none; width: 13px; height: 13px; margin-top: 1px; border-radius: 50%; border: 1px solid #3b4252; box-sizing: border-box; }
.mt-sw-t { background: #83a6f3; }
.mt-sw-p { background: #fff; }
.mt-examples { display: flex; justify-content: space-between; gap: 4px; text-align: center; }
.mt-examples figure { margin: 0; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mt-examples canvas { display: block; }
.mt-examples figcaption { font-size: 10.5px; line-height: 1.2; color: var(--text); }
.measure-actions { display: flex; gap: 6px; margin-top: 10px; }
.measure-actions .btn:disabled { opacity: .45; cursor: default; }
.measure-actions .btn { flex: 1; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #1e40af; }
.measure-actions .btn-primary:disabled:hover { background: var(--accent); }
.seg.seg-small { margin: 2px 0 8px; }
.seg.seg-small button { padding: 4px 2px; font-size: 12px; }
.measure-actions .btn:disabled:hover { background: #fff; }

/* ---------- settings ---------- */
.settings { padding: 8px 16px 24px; overflow-y: auto; flex: 1; }
.settings h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 10px; }
.settings h2:first-child { margin-top: 10px; }
.group { margin-bottom: 14px; }
.group-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; border: 1px solid var(--chrome-3); border-radius: 6px; overflow: hidden; background: #fff; }
.seg button {
  flex: 1; padding: 7px 4px; font: inherit; font-size: 13px; cursor: pointer;
  border: 0; border-right: 1px solid var(--chrome-3); background: transparent; color: var(--text);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--chrome-2); }
.seg button.active { background: var(--accent); color: #fff; }
.seg.vertical { flex-direction: column; }
.seg.vertical button { text-align: left; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--chrome-3); display: flex; justify-content: space-between; }
.seg.vertical button:last-child { border-bottom: 0; }
.seg.vertical button small { color: var(--muted); font-size: 12px; }
.seg.vertical button.active small { color: #dbeafe; }
.check { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.hint a { color: var(--accent); }
.hint.about { margin-top: 16px; line-height: 1.5; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }

.legend {
  background: #fff; border: 1px solid var(--chrome-3); border-radius: 6px; padding: 8px 10px;
  display: grid; grid-template-columns: max-content 1fr; align-items: center; gap: 7px 10px;
}
.legend-title { font-size: 11.5px; font-weight: 600; margin: 0; }
.legend-mags { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.legend-mags .dot { border-radius: 50%; border: 1.5px solid #374151; background: #fff; flex: none; }
.legend-mags .lbl { font-size: 11px; color: var(--muted); }
.legend-ages { display: flex; justify-content: space-between; gap: 6px; }
.legend-ages div { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }
.legend-ages .dot { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid rgba(0,0,0,.45); flex: none; }
.legend-plates { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
.legend-row { display: flex; align-items: center; gap: 5px; font-size: 11.5px; white-space: nowrap; }
.legend-swatch { display: block; flex: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body { grid-template-columns: 0 1fr 0; }
  .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; }
  .sidebar.left { left: 0; }
  .sidebar.right { right: 0; }
  .sidebar.left.open { width: min(var(--left-w), 88vw); }
  .sidebar.right.open { width: min(var(--right-w), 88vw); }
  .brand-sub { display: none; }
}

/* Transient centre-screen message (polar-cap toggle, and anything else with no panel of its own). */
.toast {
  position: fixed; left: 50%; top: 72px; transform: translateX(-50%);
  z-index: 40; padding: 8px 14px; border-radius: 999px;
  background: rgba(17,24,39,.88); color: #fff; font-size: 13px; font-weight: 600;
  pointer-events: none; opacity: 0; transition: opacity .18s ease;
}
.toast.on { opacity: 1; }

/* Shortcuts list in the right sidebar. */
.keys {
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px;
  margin: 0; font-size: 12px; line-height: 1.4;
}
.keys dt { color: var(--text); }
.keys dd { margin: 0; color: var(--muted); }
.keys dt.keys-sep {
  grid-column: 1 / -1; margin-top: 6px; padding-top: 7px;
  border-top: 1px solid var(--chrome-2);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.keys dd.keys-sep { display: none; }
.keys kbd {
  display: inline-block; min-width: 15px; padding: 1px 5px;
  border: 1px solid var(--chrome-3); border-bottom-width: 2px; border-radius: 4px;
  background: #fff; font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text); text-align: center;
}

/* "The Sun now" panel: the latest solar imagery with NOAA region numbers over it. */
.sun-panel {
  width: 336px; max-height: calc(100vh - 110px); overflow-y: auto;
  background: rgba(255,255,255,.96); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.sun-stage {
  position: relative; margin: 8px 0 0; border-radius: 8px; overflow: hidden;
  background: #05070f; aspect-ratio: 1 / 1;
}
.sun-img, .sun-tint { display: block; width: 100%; height: 100%; object-fit: contain; }
/* Clipped a little wider than the disc's 39.06% so the limb is not shaved, and still far inside the
   corners where the watermark and logo sit (those are about 0.6 of the width from centre). */
/* Masked to the disc, with a short fade rather than a hard edge so a pixel of mismatch does not
   show as a ring. closest-side makes the gradient radius half the width, which is what the
   percentages below are against. */
.sun-tint {
  position: absolute; inset: 0; filter: url(#hmi-redtemp);
  -webkit-mask-image: radial-gradient(circle closest-side at 50% 50%, #000 0 79.6%, transparent 83%);
  mask-image: radial-gradient(circle closest-side at 50% 50%, #000 0 79.6%, transparent 83%);
}
.sun-panel.loading .sun-tint { opacity: .45; transition: opacity .15s ease; }
.sun-panel.failed .sun-tint { opacity: .2; }
/* Region numbers are positioned in per cent, so the overlay tracks the picture at any panel size. */
.sun-marks { position: absolute; inset: 0; pointer-events: none; }
.sun-mark { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; }
/* The number starts a little right of the group's centre (8px; it was 3px, which sat on the spots of a
   larger group), level with it. */
.sun-mark b {
  position: absolute; left: 8px; top: -6px; font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000;
}
.sun-status {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 7px 9px;
  background: rgba(5,7,15,.72); color: #fff; font-size: 11.5px; line-height: 1.35;
}
.sun-status:empty { display: none; }
.sun-panel.loading .sun-img { opacity: .45; transition: opacity .15s ease; }
.sun-panel.failed .sun-img { opacity: .2; }
/* One line, in a 336px panel: the checkbox on the left and the count on the right. Both are kept from
   wrapping inside themselves, and the row is allowed to tighten its gap before anything gives. */
.sun-regions-row {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 6px; font-size: 12.5px; white-space: nowrap;
}
.sun-regions-row .check { padding: 0; gap: 6px; min-width: 0; }
.sun-regions-row:has(input:disabled) .check { opacity: .5; }
.sun-caption { margin: 6px 0 0; }
.sun-meta {
  display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px;
  margin: 9px 0 0; font-size: 11.5px;
}
.sun-meta dt { color: var(--muted); }
.sun-meta dd { margin: 0; font-variant-numeric: tabular-nums; }
/* Data older than six hours is worth noticing rather than trusting. */
.sun-observed.stale { color: #b45309; font-weight: 600; }
.sun-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.sun-src { margin: 8px 0 0; font-size: 11px; }
/* The sunspot-number plot (SILSO's EISN): a fold at the foot of the panel on a desktop. */
.sun-eisn { margin-top: 10px; border-top: 1px solid var(--chrome-2); padding-top: 6px; }
.sun-eisn-head {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 650; color: var(--text); text-align: left;
}
.sun-eisn-head .sec-chevron { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .15s ease; }
.sun-eisn:not(.open) .sun-eisn-head .sec-chevron { transform: rotate(-90deg); }
.sun-eisn:not(.open) .sun-eisn-body { display: none; }   /* folded (a class: [hidden] is !important here) */
.sun-eisn-frame { display: block; margin-top: 4px; border: 1px solid var(--chrome-2); border-radius: 6px; overflow: hidden; background: #fff; min-height: 60px; }
.sun-eisn-img { display: block; width: 100%; height: auto; }
.sun-eisn-status { margin: 6px 0 0; color: #b45309; }
.sun-eisn-credit { margin: 6px 0 0; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }

/* ======================= the phone layout =======================
   Switched on by js/mobile.js adding `.mobile` to <body> (MOBILE_QUERY, or ?layout=mobile). The views
   are the same panels the desktop uses, re-laid out to fill the screen — nothing is duplicated, so
   every control keeps the listener it already had. A second class, .m-list / .m-map / .m-sun /
   .m-settings, says which one is showing. Colours, radii and type all come from the same variables as
   the desktop, so it reads as the same app. */

body.mobile {
  --m-bar-h: 73px;   /* the buttons, plus the 15px "updated" strip above them */
  --m-tool: 37px;                     /* one map button; four of them abreast make the grid */
  --m-top: calc(2 * var(--m-tool) + 4px + 12px);   /* the chip band: two rows of chips, or of map buttons, 90px */
  --m-grid-w: calc(4 * var(--m-tool) + 3 * 4px);
  --m-safe-b: env(safe-area-inset-bottom, 0px);
  --m-safe-t: env(safe-area-inset-top, 0px);
  grid-template-rows: 0 1fr;
  grid-template-columns: 0 minmax(0, 1fr) 0;
  overscroll-behavior: none;          /* no pull-to-refresh fighting a drag on the globe */
}
body.mobile #topbar,
body.mobile #banner,
body.mobile .toast { display: none; }
body.mobile .toast.on { display: block; bottom: auto; top: calc(var(--m-top) + var(--m-safe-t) + 12px); }

/* The globe is never torn down, only covered, so going back to the map is instant. */
body.mobile #globe-wrap { position: fixed; inset: 0; }
body.mobile #globe canvas { touch-action: none; }  /* the gesture belongs to Cesium, not the browser */

/* ---- the panels, as full-screen views ---- */
body.mobile .sidebar,
body.mobile #sun-panel {
  position: fixed; left: 0; right: 0;
  top: 0; bottom: calc(var(--m-bar-h) + var(--m-safe-b));
  width: auto !important; max-width: none; max-height: none;
  border: 0; border-radius: 0; box-shadow: none;
  background: var(--chrome);
  transition: none; z-index: 20;
  padding-top: var(--m-safe-t);
  overflow-y: auto; overscroll-behavior: contain;
}
body.mobile .sidebar > *,
body.mobile .sidebar.right > * { min-width: 0; }
body.mobile #sun-panel { background: #fff; padding: calc(var(--m-safe-t) + 12px) 14px 18px; }
body.mobile #left { display: none; padding-top: calc(var(--m-top) + var(--m-safe-t)); }
body.mobile #right { display: none; }
body.mobile.m-list #left { display: flex; }
body.mobile.m-settings #right { display: block; }
body.mobile.m-sun #sun-panel { display: block; }
body.mobile:not(.m-sun) #sun-panel { display: none; }
body.mobile #sun-panel .sun-close { display: none; }   /* the bottom bar is how you leave a view */
/* On a phone the sunspot-number plot is simply there, under the picture, in the room the view has: its
   heading is a heading, not a fold. */
body.mobile #sun-panel .sun-eisn .sun-eisn-body { display: block; }
body.mobile #sun-panel .sun-eisn-head { pointer-events: none; cursor: default; }
body.mobile #sun-panel .sun-eisn-head .sec-chevron { display: none; }
body.mobile .settings { padding-bottom: 8px; }

/* ---- filter chips: the top of the map and the list ---- */
.m-filters {
  position: fixed; z-index: 22;
  top: var(--m-safe-t); left: 0; right: 0;
  display: none; flex-direction: column; gap: 4px;
  padding: 6px 8px;
  /* Solid, like the bottom bar, with the same hairline at its edge — it used to fade out into the map
     below the second row, which read as a smudge rather than a band. */
  background: var(--chrome);
  box-shadow: inset 0 -1px 0 var(--chrome-3);   /* drawn inside, so the band stays var(--m-top) tall */
}
body.mobile.m-map .m-filters,
body.mobile.m-list .m-filters { display: flex; }
/* On the map the chips take the left of the strip and the button grid the right: the strip still runs
   the full width behind both, so it reads as one band. */
body.mobile.m-map .m-filters { padding-right: calc(8px + var(--m-grid-w) + 8px); }
.m-chips {
  display: flex; align-items: center; gap: 3px; height: var(--m-tool);
  overflow-x: auto; scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chips button {
  flex: 1 0 auto; min-width: 0; height: 33px;
  padding: 0 4px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text);
  background: #fff; border: 1px solid var(--chrome-3); border-radius: 999px;
  cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.m-chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-chips button.extra { font-style: italic; }
/* The narrowest phones (360-380 px) still fit "1 day" to "1 month" beside the four-wide button grid. */
@media (max-width: 380px) {
  .m-chips button { padding: 0 2.5px; font-size: 11px; letter-spacing: -.1px; }
  .m-chips { gap: 2px; }
}

/* ---- the map's buttons: 4 across, 2 down, at the right of the chip strip ---- */
.m-tools {
  position: fixed; z-index: 23;
  top: calc(var(--m-safe-t) + 6px); right: 8px;
  display: none;
  grid-template-columns: repeat(4, var(--m-tool)); grid-auto-rows: var(--m-tool); gap: 4px;
}
body.mobile.m-map .m-tools { display: grid; }
.m-tool {
  width: var(--m-tool); height: var(--m-tool); padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--chrome-3); border-radius: 999px;
  background: rgba(255,255,255,.95); color: var(--text);
  box-shadow: var(--shadow); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
/* Four abreast leaves each button 37 px across; its touch target reaches 2 px further all round (41 px),
   meeting its neighbours' in the 4 px between them, so a tap there still lands on one of the two. */
.m-tool::after { content: ''; position: absolute; inset: -3px; border-radius: 999px; }
.m-tool svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m-tool.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-tool:active { background: var(--accent-soft); }
.m-tool.active:active { background: var(--accent); }
/* The compass: a needle, red to the north, turned by js/mobile.js to point at north on screen. */
.m-compass svg { width: 24px; height: 24px; transition: transform .12s linear; }
.m-compass .n { fill: #dc2626; stroke: #dc2626; stroke-width: 1; }
.m-compass .s { fill: #fff; stroke: currentColor; stroke-width: 1.2; }
.m-compass:not(.turned) .s { stroke: var(--muted); }

/* ---- the detail card, floating over the map ---- */
body.mobile .detail.floating {
  left: 10px; right: 10px; width: auto; max-width: none;
  bottom: calc(var(--m-bar-h) + var(--m-safe-b) + 10px);
  max-height: 58%; z-index: 23;
}
body.mobile:not(.m-map) .detail.floating { display: none; }
body.mobile .detail-actions { flex-wrap: wrap; }
body.mobile .detail-actions .btn { min-height: 40px; }

/* Folding the card (phone only). Open, the chevron sits left of the ×. Folded, the card is one line —
   magnitude, date, time, depth — then the chevron and the ×, tucked into the bottom right corner and
   only as wide as that needs; tapping the line or the chevron opens it again. The Sun & Moon column of
   "Go to this moment" folds away with the rest, leaving the globe's lighting to look at. */
.detail-fold, .detail-bar { display: none; }
body.mobile .detail.floating .detail-fold { display: inline-flex; position: absolute; top: 8px; right: 42px; }
body.mobile .detail.floating .detail-title { padding-right: 64px; }
body.mobile #detail.floating.folded {
  display: flex; align-items: center; gap: 2px;
  left: auto; right: 10px; width: max-content; max-width: calc(100vw - 20px);
  padding: 3px 2px 3px 12px; overflow: hidden;
}
body.mobile #detail.floating.folded > :not(.close-btn):not(.detail-fold):not(.detail-bar) { display: none; }
body.mobile #detail.floating.folded .detail-bar {
  display: flex; align-items: baseline; gap: 0; order: 0; flex: 0 1 auto; min-width: 0;
  margin: 0 4px 0 0; padding: 6px 0; border: 0; background: none; cursor: pointer; text-align: left;
  font: inherit; font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
body.mobile #detail.floating.folded .detail-bar > * { flex: none; }
body.mobile #detail.floating.folded .detail-bar > :last-child { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
body.mobile #detail.floating.folded .detail-bar > * + *::before { content: '·'; margin: 0 4px; color: var(--muted); }
/* Date and time read as one item: "2026-10-15 07:34 UTC". */
body.mobile #detail.floating.folded .detail-bar > .db-time::before { content: ''; margin: 0 0 0 4px; }
body.mobile #detail.floating.folded .db-mag { color: var(--accent); font-weight: 700; }
@media (max-width: 370px) { body.mobile #detail.floating.folded .detail-bar { font-size: 12px; } }
body.mobile #detail.floating.folded .detail-fold,
body.mobile #detail.floating.folded .close-btn { position: static; flex: none; width: 32px; height: 34px; }
body.mobile #detail.floating.folded .detail-fold { order: 1; }
body.mobile #detail.floating.folded .close-btn { order: 2; }
body.mobile #detail.floating.folded .detail-fold svg { transform: rotate(180deg); }

/* ---- the bottom bar ---- */
.m-bar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: none;
  height: calc(var(--m-bar-h) + var(--m-safe-b));
  padding-bottom: var(--m-safe-b);
  background: var(--chrome);
  border-top: 1px solid var(--chrome-3);
}
body.mobile .m-bar { display: flex; flex-direction: column; }
/* How old the data is, in the one place that is on screen in every view — sharing its strip with the
   map's attribution, which sits at the left end on the map view. */
.m-strip {
  flex: none; display: flex; align-items: stretch; height: 15px;
  background: var(--chrome-2); border-bottom: 1px solid var(--chrome-3);
}
.m-strip:has(.m-updated.stale) { background: #fef3c7; }
.m-credits { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.m-updated {
  flex: 1 1 auto; min-width: 0; height: 15px; line-height: 15px;
  font-size: 10px; font-weight: 600; letter-spacing: .01em; text-align: center;
  color: var(--muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
/* With the attribution beside it (the map view), the age moves to the right end. */
body.mobile.m-map .m-updated { text-align: right; padding-right: 8px; }
.m-updated.stale { color: #92400e; background: #fef3c7; }
.m-bar-row { flex: 1; min-height: 0; display: flex; }
.m-bar button {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m-bar button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.m-bar button.active { color: var(--accent); }
.m-bar .m-refresh { color: var(--text); }
.m-bar .m-refresh:active svg { transform: rotate(-90deg); transition: transform .2s ease; }
.m-bar button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop-only chrome that has no place on a phone. */
body.mobile .readout, body.mobile #moment-panel, body.mobile #antipode-panel, body.mobile #measure-panel {
  bottom: calc(var(--m-bar-h) + var(--m-safe-b) + 8px);
}
body.mobile #measure-panel, body.mobile #antipode-panel {
  left: 8px; right: 8px; width: auto; max-width: none;
}
/* The intensity legend on a phone: just the scale — colour, numeral, wording — at its desktop size, in a
   box no wider than it, at the right under the band. The title, the earthquake, the strongest level, the
   damage column, the note and the source all go (the card above says which earthquake). The × stays,
   small, in the header row beside "Shaking": with the card closed it is the only way to take the
   contours off. */
body.mobile #mmi-panel { position: relative; align-self: flex-end; width: auto; max-width: none; padding: 6px 7px 7px; }
body.mobile #mmi-panel .measure-head > span,
body.mobile #mmi-panel .mmi-quake,
body.mobile #mmi-panel .mmi-max,
body.mobile #mmi-panel .mmi-dmg,
body.mobile #mmi-panel .mmi-note,
body.mobile #mmi-panel .mmi-src { display: none; }
body.mobile #mmi-panel .measure-head { position: absolute; top: 3px; right: 3px; margin: 0; }
body.mobile #mmi-close { width: 20px; height: 20px; font-size: 16px; border-radius: 4px; }
body.mobile #mmi-panel .mmi-scale { width: auto; }
body.mobile #mmi-panel .mmi-scale td { padding: 1px 0; }
/* The moment tensor popup on a phone: under the chip band at the left, narrower, the legend folded until
   asked for; only over the map. */
body.mobile #mt-panel {
  top: calc(var(--m-top) + var(--m-safe-t) + 6px); left: 8px; width: 214px;
  max-height: calc(100% - var(--m-top) - var(--m-safe-t) - var(--m-bar-h) - var(--m-safe-b) - 20px);
  padding: 6px 10px 8px; z-index: 24; font-size: 11.5px;
}
body.mobile .mt-head { margin: -6px -10px 0; padding: 6px 4px 2px 10px; font-size: 13px; }
body.mobile .mt-head .close-btn { width: 24px; height: 24px; font-size: 18px; }
body.mobile .mt-quake { font-size: 11px; }
body.mobile .mt-legend { font-size: 10.5px; }
body.mobile:not(.m-map) #mt-panel { display: none; }
/* The measure panel lives in the tool stack, which on a phone would put it under the chip band and
   the map buttons (drawn over the top of the map). The stack starts below the band instead, full width. */
body.mobile .overlay-tools {
  top: calc(var(--m-top) + var(--m-safe-t) + 6px); left: 8px; right: 8px;
  max-height: calc(100% - var(--m-top) - var(--m-safe-t) - var(--m-bar-h) - var(--m-safe-b) - 20px);
  align-items: stretch;
}
/* Measure on a phone is two rows: the title with the readout (or, before the first tap, what to do)
   and the ×; then the units and Done / Undo / Clear side by side. The hint line goes, and a closed
   shape's perimeter and area share one line. */
body.mobile #measure-panel { padding: 3px 4px 6px 12px; font-size: 12.5px; }
body.mobile #measure-panel .measure-head { margin-bottom: 2px; gap: 8px; font-size: 13.5px; }
body.mobile #measure-panel .measure-head .measure-grid { grid-template-columns: repeat(4, max-content); gap: 0 6px; font-size: 12.5px; }
body.mobile #measure-panel .measure-head .measure-grid dd + dt { margin-left: 6px; }
body.mobile #measure-panel .close-btn { width: 32px; height: 32px; }
body.mobile #measure-panel .hint { display: none; }
body.mobile #measure-panel.m-empty .measure-grid { display: none; }
body.mobile #measure-panel.m-empty .m-tap { display: block; flex: 1 1 auto; min-width: 0; font-weight: 400; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mobile #measure-panel .measure-row { display: flex; align-items: center; gap: 6px; padding-right: 2px; }
body.mobile #measure-panel .measure-row .seg { flex: 4 1 0; min-width: 0; }
body.mobile #measure-panel .measure-row .seg button { padding-left: 0; padding-right: 0; }
body.mobile #measure-panel .measure-actions { flex: 5 1 0; min-width: 0; margin-top: 0; gap: 4px; }
body.mobile #measure-panel .measure-actions .btn { padding-left: 2px; padding-right: 2px; min-width: 0; }

/* Place search. The desktop top bar already holds the field and its results list, so the phone
   borrows the bar rather than growing a second one: the magnifier (lit while it is open) shows it as a
   bar of its own just under the chip band — the band and the map buttons stay where they are — with a
   × at its left to close it; the magnifier still toggles it too.
   It used to take the band's place, the chips and buttons hidden, and the grid of buttons, though
   invisible, still lay over the right end of the field, so the field's own × (clear) could not be
   tapped. And the field's text was 13px: iOS zooms the page into any field under 16px when it takes
   focus, and leaves it zoomed. */
body.mobile.m-search #topbar {
  display: flex; align-items: center; gap: 8px; position: fixed; z-index: 24;
  top: calc(var(--m-top) + var(--m-safe-t)); left: 0; right: 0;
  height: 52px; padding: 0 8px;
  background: var(--chrome);
  box-shadow: inset 0 -1px 0 var(--chrome-3), 0 4px 10px rgba(0,0,0,.10);
}
body.mobile.m-search .brand,
body.mobile.m-search .topbar-reset,
body.mobile.m-search .clock,
body.mobile.m-search .topbar-actions { display: none; }
body.mobile.m-search .search { flex: 1; min-width: 0; }
body.mobile.m-search .search-close {
  display: flex; flex: none; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; border: 1px solid var(--chrome-3); border-radius: 999px;
  background: #fff; color: var(--text); font-size: 24px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent;
}
body.mobile.m-search .search-close:active { background: var(--accent-soft); }
body.mobile #search-input { height: 38px; font-size: 16px; padding: 0 40px 0 34px; border-radius: 8px; }
body.mobile .search-clear { width: 36px; height: 36px; right: 1px; font-size: 22px; }
body.mobile .search-list { max-height: min(320px, 50vh); }
/* The same for every other field a phone can type into or pick from (Settings' custom magnitude and
   dates, the time zone): under 16px, iOS zooms the page in when one takes focus and leaves it there. */
body.mobile input[type="text"], body.mobile input[type="number"], body.mobile input[type="date"],
body.mobile input[type="search"], body.mobile select, body.mobile textarea { font-size: 16px; }
body.mobile .search-item { padding: 10px 12px; font-size: 14px; }
body.mobile.m-search #m-search { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Phone trims. There is no cursor, so the position/elevation readout and the hover tooltip have
   nothing to say; the list header loses the room it spends on a desktop. Cesium's attribution stays —
   it has to — but off the map, in the strip above the bottom bar's buttons. */
body.mobile .readout, body.mobile #tooltip { display: none; }
/* Attribution has to stay with the map, but it need not cover any of it: js/app.js moves this node
   into the left end of the "Updated" strip, right under the map, where the logo and "Data
   attribution" are drawn as small as they can be and still read. It shows on the map view only. */
body.mobile #credits {
  position: static; flex: none;
  padding: 0 0 0 6px; border: 0; background: none; text-align: left;
  font-size: 9px; line-height: 15px; white-space: nowrap; overflow: hidden;
}
body.mobile #credits .cesium-widget-credits { display: flex; align-items: center; height: 15px; line-height: 15px; white-space: nowrap; }
body.mobile #credits .cesium-widget-credits * { white-space: nowrap; }
body.mobile #credits .cesium-credit-logoContainer,
body.mobile #credits .cesium-credit-logoContainer > div,
body.mobile #credits .cesium-credit-logoContainer a { display: inline-flex; align-items: center; }
body.mobile #credits .cesium-credit-textContainer:empty { display: none; }
body.mobile #credits .cesium-credit-textContainer { margin: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
body.mobile #credits .cesium-credit-logoContainer { margin-right: 4px; }
body.mobile #credits .cesium-credit-logoContainer img { height: 10px; width: auto; vertical-align: 0 !important; }
body.mobile #credits .cesium-credit-textContainer,
body.mobile #credits .cesium-credit-expand-link { font-size: 9px; }
body.mobile #credits .cesium-credit-expand-link { margin-left: 4px; }
body.mobile:not(.m-map) #credits { display: none; }

/* "Data attribution" on a phone. Cesium's lightbox fills the whole globe, and on a phone the globe runs
   under the chip band and the bottom bar — which sit above it — so its title, its first lines and its
   only way out, the × at the top right, were hidden under the band, with nothing outside the box to
   tap either. Here it is one of the app's popups instead: a white card at the bottom of the map, above
   the bar, as high as its list needs and scrolling past that, with the × at its top right; the rest
   of the map dims, and a tap there closes it too (Cesium's own handlers, so nothing in js/ changes). */
body.mobile .cesium-credit-lightbox-overlay {
  top: calc(var(--m-top) + var(--m-safe-t)); bottom: calc(var(--m-bar-h) + var(--m-safe-b));
  height: auto; background: rgba(0,0,0,.35);
}
body.mobile .cesium-credit-lightbox,
body.mobile .cesium-credit-lightbox.cesium-credit-lightbox-mobile,
body.mobile .cesium-credit-lightbox.cesium-credit-lightbox-expanded {
  position: absolute; left: 10px; right: 10px; bottom: 10px; top: auto;
  width: auto; height: auto; min-height: 0; max-width: none; max-height: calc(100% - 20px);
  margin: 0 !important;   /* Cesium centres the desktop box with an inline margin-top */
  display: flex; flex-direction: column;
  background: #fff; color: var(--text); border: 0; border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.18);
  font-size: 12.5px;
}
/* A phone on its side (or a tablet): a card of reading width at the right, not a strip across. */
@media (min-width: 520px) {
  body.mobile .cesium-credit-lightbox,
  body.mobile .cesium-credit-lightbox.cesium-credit-lightbox-mobile,
  body.mobile .cesium-credit-lightbox.cesium-credit-lightbox-expanded { left: auto; width: 440px; }
}
body.mobile .cesium-credit-lightbox-title {
  flex: none; padding: 11px 50px 6px 14px; font-weight: 700; font-size: 14px; color: var(--text);
}
body.mobile .cesium-credit-lightbox > ul {
  flex: 0 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: 0; padding: 2px 14px 12px 30px; font-size: 12.5px; line-height: 1.4; color: var(--text);
}
body.mobile .cesium-credit-lightbox > ul > li { padding-bottom: 5px; }
body.mobile .cesium-credit-lightbox > ul > li a,
body.mobile .cesium-credit-lightbox > ul > li a:visited { color: var(--accent); }
body.mobile .cesium-credit-lightbox-close {
  position: absolute; top: 5px; right: 5px; z-index: 1;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 24px; line-height: 1; color: var(--muted); text-decoration: none; cursor: pointer;
}
body.mobile .cesium-credit-lightbox-close:active { background: var(--chrome-2); color: var(--text); }
body.mobile .list-head { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
body.mobile .list-head h2 { margin: 0; font-size: 15px; }
body.mobile .list-status { min-height: 0; font-size: 12.5px; }
body.mobile .list-check { margin: 2px 0 0; font-size: 12.5px; }
body.mobile .list-controls { margin: 2px 0 0; }
body.mobile .list-controls .field { flex-direction: row; align-items: center; gap: 8px; }
body.mobile .row { height: 60px; padding-left: 14px; }

/* An earthquake tapped in the phone's list opens in place: its usual line, then the facts on the left
   and the thumbnail globe on the right. js/app.js measures the open row and moves the rows below it
   down by however much taller it is, so the list stays one long scroll. */
body.mobile .row.expanded { height: auto; cursor: default; background: #fff; }
body.mobile .row.expanded .row-head { cursor: pointer; }
.row-more {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 8px;
  align-items: start; padding: 0 0 12px;
  cursor: default; user-select: text;
}
.rm-grid {
  grid-column: 1; grid-row: 1;
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px;
  margin: 0; font-size: 12.5px; line-height: 1.35;
}
.rm-grid dt { color: var(--muted); }
.rm-grid dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rm-globe {
  grid-column: 2; grid-row: 1 / span 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px; border: 1px solid var(--chrome-3); border-radius: var(--radius);
  background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  font: inherit; font-size: 11.5px; font-weight: 600; color: var(--accent);
}
.rm-globe:active { background: var(--accent-soft); }
.rm-globe-img { display: block; width: 96px; height: 96px; }
.rm-link {
  grid-column: 1; grid-row: 2; align-self: end;
  display: block; padding: 8px 10px; border-radius: 6px;
  background: var(--accent); color: #fff; text-align: center;
  font-size: 12.5px; font-weight: 600; line-height: 1.25; text-decoration: none;
}

/* "Go to this moment" on a phone.
   The Sun & Moon panel floats at the top left of the globe on a desktop; on a phone that is exactly
   where the filter chips and the tool rail are, so it lands in the right half of the earthquake's own
   card instead — the sky belongs with the earthquake whose moment it is. With no card open it keeps
   its own panel, moved to the bottom where it is out of the way. js/app.js does the moving. */
body.mobile #moment-panel {
  position: fixed; top: auto; left: 10px; right: 10px; width: auto;
  bottom: calc(var(--m-bar-h) + var(--m-safe-b) + 10px);
  z-index: 22; zoom: 1; font-size: 12.5px;
}
body.mobile:not(.m-map) #moment-panel { display: none; }

body.mobile .detail.floating.with-moment {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 12px; row-gap: 8px; align-items: start;
}
body.mobile .with-moment .detail-title { grid-column: 1 / -1; }
body.mobile .with-moment .detail-grid { grid-column: 1; margin: 0; font-size: 12px; gap: 4px 8px; }
body.mobile .with-moment .detail-actions { grid-column: 1 / -1; margin-top: 0; }
/* In the card it is a column of the card, not a panel of its own: no box, just a rule down the side. */
body.mobile .with-moment #moment-panel {
  position: static; grid-column: 2; width: auto; z-index: auto;
  margin: 0; padding: 0 0 0 12px;
  background: none; box-shadow: none; border-radius: 0;
  border-left: 1px solid var(--chrome-2);
  font-size: 12px;
}
/* Four things the card is already saying, or has no room to say twice: the earthquake (it is the
   title), the moment itself (it is the Time row, three inches to the left), the way back (the card's
   own button), and the footnote about IAU boundaries, which is a desktop luxury. */
body.mobile .with-moment #mp-quake,
body.mobile .with-moment #mp-time,
body.mobile .with-moment #mp-return,
body.mobile .with-moment .moment-panel .hint { display: none; }
body.mobile .with-moment .moment-head { font-size: 12px; color: var(--muted); font-weight: 600; }
body.mobile .with-moment .moment-time { font-size: 12.5px; font-weight: 600; }
body.mobile .with-moment .moment-moon { margin: 7px 0; padding: 7px 0; gap: 8px; }
body.mobile .with-moment .moment-phase { font-size: 12.5px; }
body.mobile .with-moment .moment-sub { font-size: 11.5px; }
body.mobile .with-moment .moment-grid { gap: 3px 8px; font-size: 11.5px; }
body.mobile .with-moment .moment-moon .moon-icon { width: 30px; height: 30px; }

/* Inner Earth on a phone.
   The desktop panel is a column of its own: two foldable sections, four layer checkboxes, and the
   antipode groups — several earthquakes plotted at once, with a list, names and a running total. On a
   phone it landed over the chips and the tool rail while the earthquake card sat underneath it, two
   popups fighting for the same screen. So: one popup, ever. The panel moves to the bottom where the
   card was, the card gets out of its way (body.ap-on), and the groups half is gone — it is a desk
   activity. The layers all stay, each with its checkbox; js/antipodes.js decides which start on
   (MOBILE.interiorOffAtFirst) and remembers the phone's choices apart from the desktop's. */
body.mobile.ap-on .detail.floating,
body.mobile.ap-on #moment-panel { display: none; }

body.mobile #antipode-panel {
  position: fixed; z-index: 23; top: auto; left: 10px; right: 10px;
  bottom: calc(var(--m-bar-h) + var(--m-safe-b) + 10px);
  width: auto; max-width: none; max-height: 54vh; overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.18);
}
body.mobile:not(.m-map) #antipode-panel { display: none; }

/* The whole panel folds on its chevron, down to the title bar alone — icon, name, chevron, × — tucked
   into the bottom right corner and only as wide as those need, so the globe gets the rest of the screen
   back. Unfolded, it spans the width again. Bigger targets for a finger than a pointer needs. */
body.mobile #antipode-panel .ap-collapse,
body.mobile #antipode-panel .ap-close { width: 34px; height: 34px; }
body.mobile #antipode-panel .ap-collapse svg { width: 20px; height: 20px; }
body.mobile #antipode-panel.collapsed {
  left: auto; right: 10px; width: max-content; max-width: calc(100vw - 20px);
  overflow: hidden; padding: 3px 4px 3px 12px;
}
body.mobile #antipode-panel.collapsed .ap-title { margin-right: 8px; white-space: nowrap; }
/* (The phone lays the body out as a column, which would otherwise outrank the fold.) */
body.mobile #antipode-panel.collapsed .ap-body { display: none; }

/* The earthquake and its antipode first, then the layers (which still fold away on their own header,
   to hand the map back its room). The antipodes section has nothing else left in it on a phone, so it
   loses its header and moves to the top. */
body.mobile .ap-mobile .ap-body { display: flex; flex-direction: column; }
body.mobile .ap-mobile .ap-sec[data-sec="antipodes"] {
  order: -1; margin: 2px 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--chrome-2);
}
body.mobile .ap-mobile .ap-sec[data-sec="antipodes"] .ap-sec-body { display: block !important; }

/* Everything the short version does without: the whole of antipode groups. */
body.mobile .ap-mobile .ap-sec[data-sec="antipodes"] .ap-sec-head,
body.mobile .ap-mobile .ap-head-count,
body.mobile .ap-mobile .ap-top-actions,
body.mobile .ap-mobile .ap-hint,
body.mobile .ap-mobile .ap-groups,
body.mobile .ap-mobile .ap-foot { display: none; }
/* Every layer stays, with its checkbox: a finger needs a bigger box to tick than a pointer does. */
body.mobile .ap-mobile .ap-shell input[type="checkbox"] { width: 18px; height: 18px; }
body.mobile .ap-mobile .ap-shell-row { min-height: 34px; }
body.mobile .ap-mobile .ap-sec + .ap-sec { margin-top: 0; }
body.mobile .ap-mobile .ap-globe-mode { margin-top: 6px; }
body.mobile .ap-mobile .ap-shells { padding-top: 2px; }
body.mobile .ap-mobile .ap-status { margin: 0; }
body.mobile .ap-mobile .ap-focus { margin: 0; }
body.mobile .ap-mobile .ap-status:empty { display: none; }
/* With a focus to show, the standing instruction has done its job. */
body.mobile .ap-mobile .ap-focus:not([hidden]) ~ .ap-status { display: none; }

/* The circled i is a hover target on a desktop and a tap target on a phone, so it grows one there. */
body.mobile .ap-mobile .ap-info { width: 26px; height: 26px; font-size: 13px; }
body.mobile .ap-info-pop { width: min(300px, calc(100vw - 28px)); }

/* The way to this earthquake's moment, beside the earthquake it belongs to. Only on a phone: on a
   desktop the earthquake's own card is on screen next to this panel and already carries the button. */
.ap-moment { display: none; }
body.mobile .ap-mobile .ap-focus {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px; align-items: center;
}
body.mobile .ap-mobile .ap-focus-quake,
body.mobile .ap-mobile .ap-focus-coords { grid-column: 1; }
body.mobile .ap-mobile .ap-moment {
  display: block; grid-column: 2; grid-row: 1 / span 2;
  width: 100px; min-height: 42px; padding: 6px 8px;
  white-space: normal; line-height: 1.25; font-size: 12px;
}

/* The plate-motion line in the legend wraps, unlike the four boundary types above it. */
.legend-row.legend-motion { white-space: normal; align-items: flex-start; line-height: 1.35; }
.legend-row.legend-motion .legend-swatch { margin-top: 1px; }
.legend-row.legend-motion b { font-weight: 700; }

/* ---------- depth viewer ---------- */
/* Desktop only: the tool is a drag-a-shape-on-a-map affair with floating windows over it, and a
   phone has room for neither. The button is hidden rather than disabled, so it never invites a tap
   that does nothing. */
body.mobile #btn-depth { display: none; }
body.mobile .depth-panel, body.mobile .dv-win { display: none !important; }

.depth-panel {
  width: 330px; max-height: 100%; overflow-y: auto;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.depth-panel .measure-head { display: flex; align-items: center; justify-content: space-between; }
.dp-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.depth-panel .hint { margin: 6px 0 8px; line-height: 1.4; color: var(--muted); }
.dp-row { display: block; margin: 8px 0; }
.dp-row input[type="range"] { width: 100%; margin-top: 4px; }
.dp-label { font-weight: 600; }
.dp-base { display: flex; align-items: center; gap: 10px; }
.dp-base .seg { flex: 1; margin: 0; }
.dp-count { margin: 4px 0 8px; min-height: 1.2em; font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; }
.dp-groups-head { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.dp-groups-act { display: flex; gap: 6px; }
.dp-groups { display: flex; flex-direction: column; gap: 5px; margin-top: 7px; }
.dp-group {
  display: grid; grid-template-columns: auto auto 1fr 46px auto 46px auto auto auto;
  align-items: center; gap: 4px;
  background: var(--chrome); border: 1px solid var(--chrome-3); border-radius: 6px; padding: 4px 5px;
}
.dp-group input[type="text"] { min-width: 0; font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--chrome-3); border-radius: 4px; background: #fff; }
.dp-group input[type="number"] { width: 100%; font: inherit; font-size: 12px; padding: 3px 2px; text-align: right; border: 1px solid var(--chrome-3); border-radius: 4px; background: #fff; }
.dp-group input[type="color"] { width: 22px; height: 22px; padding: 0; border: 1px solid var(--chrome-3); border-radius: 4px; background: none; cursor: pointer; }
.dp-dash, .dp-km { color: var(--muted); font-size: 11px; }
.dp-up, .dp-del {
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px;
  background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1;
}
.dp-up:hover, .dp-del:hover { background: var(--chrome-2); color: var(--text); }
.dp-up:disabled { opacity: .3; cursor: default; }
.dp-del:hover { color: var(--danger); }
.dp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.dp-open { color: var(--muted); font-size: 12px; }

/* The windows: white, like the pictures they save (and every other analysis window). */
.dv-win {
  position: fixed; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: var(--text);
  border: 1px solid var(--chrome-3); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  font-size: 12px;
}
.dv-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px;
  background: var(--chrome); border-bottom: 1px solid var(--chrome-3); cursor: move; user-select: none;
}
.dv-kind { font-weight: 700; letter-spacing: .01em; }
.dv-title { color: #1d4ed8; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dv-sub { color: var(--muted); margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-png, .dv-close {
  flex: none; border: 1px solid var(--chrome-3); border-radius: 5px;
  background: #fff; color: var(--text); cursor: pointer; font: inherit; line-height: 1;
}
.dv-png { padding: 3px 7px; font-size: 11px; font-weight: 700; }
.dv-close { width: 22px; height: 22px; font-size: 15px; padding: 0; }
.dv-png:hover, .dv-close:hover { background: var(--chrome-2); }
.dv-png:disabled { opacity: .6; cursor: default; }
/* Holding shift aims at a dot rather than turning the box, so the cursor says so. */
.dv-win.shift-pick .dv-canvas { cursor: default !important; }
.dv-body { flex: 1; min-height: 0; position: relative; background: #fff; }
.dv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.dv-ctl {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-top: 1px solid var(--chrome-3); background: var(--chrome);
}
.dv-exag { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; color: var(--muted); }
.dv-exag input[type="range"] { flex: 1; min-width: 60px; }
.dv-exag-val, .dv-depth-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); white-space: nowrap; }
.dv-depth-val { flex: 1; }
.dv-views { display: flex; gap: 4px; flex: none; }
.dv-v {
  border: 1px solid var(--chrome-3); border-radius: 5px; padding: 3px 7px;
  background: #fff; color: var(--text); cursor: pointer; font: inherit; font-size: 11px;
}
.dv-v:hover { background: var(--chrome-2); }
.dv-legend {
  display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 10px 8px;
  border-top: 1px solid var(--chrome-3); background: var(--chrome); color: var(--text);
}
.dv-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.dv-key i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(8,12,24,.75); flex: none; }
.dv-key em { color: var(--muted); font-style: normal; }
.dv-pick-mag { color: var(--text); }
.dv-size { color: var(--muted); }
/* A colour ramp in the legend (time across the window, or magnitude): name, low end, bar, high end. */
.dv-ramp { gap: 6px; font-variant-numeric: tabular-nums; }
.dv-ramp em { color: var(--muted); font-style: normal; }
.dv-ramp b { display: inline-block; width: 90px; height: 9px; border-radius: 2px; border: 1px solid rgba(8,12,24,.45); }
.dv-magcol { gap: 5px; cursor: pointer; color: var(--text); margin-left: auto; }
.dv-magcol input { margin: 0; }
/* The map at the left of the plot, as in the PNG. */
.dv-main { flex: 1; min-height: 0; display: flex; }
.dv-main .dv-body { flex: 1; min-width: 0; }
.dv-mapcol {
  flex: none; width: clamp(150px, 32%, 230px); padding: 8px; box-sizing: border-box;
  border-right: 1px solid var(--chrome-3); background: #fff; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
}
.dv-map { display: block; }
.dv-map-cap { font-size: 11px; line-height: 1.35; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv-grip {
  position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(107,114,128,.55) 50%, rgba(107,114,128,.55) 60%, transparent 60%, transparent 72%, rgba(107,114,128,.55) 72%, rgba(107,114,128,.55) 82%, transparent 82%);
}

/* Depth viewer: Select / Cancel, the pick card, and the magnitude key. */
.dp-actions { display: flex; gap: 6px; margin: 8px 0 2px; }
.dp-actions .btn { flex: 1; }
.dp-actions .btn:disabled { opacity: .45; cursor: default; }
.dp-actions .btn:disabled:hover { background: #fff; }
#dp-select.active { background: #0f766e; border-color: #0f766e; }
.dp-note { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--chrome-3); color: var(--muted); font-size: 12px; line-height: 1.4; }
.dp-note b { color: var(--accent); }
/* The shift-click card. A ROW of the window rather than a layer over the plot: the shallow end of a
   section is the most crowded part of it and the least able to afford being covered. */
.dv-pick {
  position: relative; flex: none;
  background: #ecfeff; border-bottom: 1px solid rgba(8,145,178,.5);
  padding: 6px 28px 7px 11px; color: var(--text);
}
.dv-pick-head { display: flex; align-items: baseline; gap: 8px; }
.dv-pick-head b { font-size: 14px; font-variant-numeric: tabular-nums; flex: none; }
.dv-pick-head span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-pick-facts { color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.dv-pick-close {
  position: absolute; top: 4px; right: 5px; width: 20px; height: 20px; padding: 0; line-height: 1;
  border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer;
}
.dv-pick-close:hover { background: var(--chrome-2); color: var(--text); }
.dv-size svg { vertical-align: -2px; }

/* ---------- analysis windows (js/analysis-window.js): white, like the images they save ---------- */
.aw-win {
  position: fixed; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; color: var(--text);
  border: 1px solid var(--chrome-3); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,.35);
  font-size: 12.5px;
}
.aw-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 12px;
  background: var(--chrome); border-bottom: 1px solid var(--chrome-3); cursor: move; user-select: none;
}
.aw-title { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; max-width: 60%; }
.aw-sub { color: var(--muted); margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.aw-btn, .aw-close, .aw-seg {
  flex: none; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; color: var(--text);
  cursor: pointer; font: inherit; line-height: 1.2;
}
.aw-btn { padding: 4px 9px; font-size: 12px; font-weight: 600; }
.aw-btn:hover, .aw-seg:hover, .aw-close:hover { background: var(--chrome-2); }
.aw-btn:disabled { opacity: .55; cursor: default; }
.aw-close { width: 26px; height: 26px; font-size: 17px; padding: 0; }
.aw-top, .aw-ctl {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 7px 10px;
  border-bottom: 1px solid var(--chrome-3);
}
.aw-ctl { border-bottom: 0; border-top: 1px solid var(--chrome-3); }
.aw-ranges { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; width: 100%; }
.aw-seg { padding: 4px 10px; font-size: 12px; font-weight: 600; }
.aw-seg.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.aw-custom { display: inline-flex; align-items: center; gap: 5px; margin-left: 4px; }
.aw-custom input { font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--chrome-3); border-radius: 6px; }
.aw-bin { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.aw-body { flex: 1; min-height: 0; position: relative; background: #fff; }
.aw-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.aw-status {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: 80%;
  background: rgba(255,255,255,.96); border: 1px solid var(--chrome-3); border-radius: 8px;
  padding: 6px 12px; box-shadow: var(--shadow); font-size: 12.5px; text-align: center; pointer-events: none;
}
.aw-status.warn { border-color: #f59e0b; background: #fffbeb; }
.aw-status.error { border-color: #ef4444; background: #fef2f2; }
.aw-tip {
  position: absolute; z-index: 2; pointer-events: none; max-width: 300px;
  background: rgba(17,24,39,.94); color: #fff; border-radius: 7px; padding: 7px 10px;
  font-size: 12px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.aw-tip b { color: #fde68a; }
.aw-tip-top { margin-top: 2px; color: #d1d5db; }
.aw-dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.aw-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 7px 10px 9px;
  border-top: 1px solid var(--chrome-3); background: var(--chrome); color: var(--text); font-size: 12px;
}
.aw-key { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-weight: 600; }
.aw-key i { width: 12px; height: 12px; border-radius: 2px; flex: none; box-shadow: inset 0 0 0 1px rgba(17,24,39,.8); }
.aw-key em { font-style: normal; font-weight: 500; color: var(--muted); }
.aw-keys { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-weight: 700; cursor: help; }
.aw-tip-sub { margin-top: 2px; color: #d1d5db; font-size: 11.5px; }
/* The activity chart's tooltip: the globe's pale taupe, in black. */
.aw-activity .aw-tip { background: #bdb3a8; color: #111827; border: 1px solid rgba(17,24,39,.28); box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: none; }
.aw-activity .aw-tip > * { display: block; white-space: nowrap; }      /* five lines, each on one */
.aw-activity .aw-tip b, .aw-activity .aw-tip-top { color: #000; }
.aw-activity .aw-tip .aw-dot { box-shadow: inset 0 0 0 1px rgba(17,24,39,.8); }
/* The activity chart's source: EMSC or USGS, two buttons joined. */
.aw-src { display: inline-flex; align-items: center; margin-right: 8px; }
.aw-src-l { color: var(--muted); font-size: 11.5px; font-weight: 600; margin-right: 6px; }
.aw-src .aw-seg { border-radius: 0; }
.aw-src .aw-seg:first-of-type { border-radius: 6px 0 0 6px; }
.aw-src .aw-seg:last-of-type { border-radius: 0 6px 6px 0; margin-left: -1px; }
.aw-keys-unit { font-weight: 500; color: var(--muted); }
.aw-note { flex-basis: 100%; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
.aw-grip {
  position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, rgba(107,114,128,.55) 50%, rgba(107,114,128,.55) 60%, transparent 60%, transparent 72%, rgba(107,114,128,.55) 72%, rgba(107,114,128,.55) 82%, transparent 82%);
}
body.mobile .aw-win { display: none !important; }

/* ---------- the region tool (js/region.js) ---------- */
.region-panel {
  width: 300px; min-height: 0; overflow-y: auto;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.rg-title { display: inline-flex; align-items: center; gap: 7px; }
.rg-hint { margin: 2px 0 8px; line-height: 1.4; }
.rg-wide { width: 100%; }
.rg-label { margin: 10px 0 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.rg-label small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 4px; }
.region-panel .seg-small button { padding: 4px 7px; }
.rg-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 6px; font-size: 12px; }
.rg-inline input { font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--chrome-3); border-radius: 6px; }
.rg-inline input[type="number"] { width: 60px; }
.rg-status { margin: 8px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--chrome-2); font-size: 12px; line-height: 1.4; }
.rg-status.warn { background: #fffbeb; border: 1px solid #f59e0b; }
.rg-status.error { background: #fef2f2; border: 1px solid #ef4444; }
.rg-count { margin: 8px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.rg-count:empty { display: none; }
.rg-tools { display: flex; flex-direction: column; gap: 5px; }
.rg-tools .btn, .rg-row .btn { text-align: left; }
.rg-row { display: flex; gap: 6px; align-items: center; }
.rg-row .btn { flex: 1; text-align: center; }
/* 3D view and Cross-section side by side, one line each, the same height (the corridor's menu beside them). */
#rg-3d, #rg-section { white-space: nowrap; min-width: 0; padding-left: 6px; padding-right: 6px; }
.rg-row input[type="text"] { flex: 1.6; min-width: 0; font: inherit; font-size: 12px; padding: 5px 7px; border: 1px solid var(--chrome-3); border-radius: 6px; }
.rg-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--chrome-3); }
.region-panel .btn:disabled { opacity: .45; cursor: default; }
#rg-select.active, #rg-section.active { background: #0f766e; border-color: #0f766e; color: #fff; }
.rg-actions { margin: 4px 0 2px; }
.rg-corridor { flex: none; font: inherit; font-size: 12px; padding: 4px 3px; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; }
.rg-faults-row { margin-top: 6px; font-size: 12.5px; }
.rg-faults-row small { color: var(--muted); }
.rg-fault { margin: 2px 0 0; padding: 6px 8px; border: 1px solid #facc15; border-radius: 6px; background: #fefce8; font-size: 12px; line-height: 1.4; }
.rg-fault small { display: block; color: var(--muted); }
.rg-update-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rg-update-row .btn { flex: none; min-width: 74px; }
.rg-pending { font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.rg-save-note { margin: 4px 0 0; font-size: 11.5px; }
/* Saved selections: a library of past sequences, scrolling once it is longer than a few. */
.rg-saved { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; padding-bottom: 8px; }
.rg-saved-box { margin-top: 12px; }
/* A chart title of the reader's own: the row a "Title" button opens (analysis windows, depth windows,
   the region panel). */
.ct-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 10px; background: #f8fafc; border-bottom: 1px solid var(--chrome-3); font-size: 12px; }
.ct-label { display: flex; align-items: center; gap: 6px; flex: 1 1 260px; min-width: 0; font-weight: 600; color: var(--muted); }
.ct-in { flex: 1; min-width: 0; font: inherit; font-size: 12.5px; color: var(--text); padding: 4px 7px; border: 1px solid var(--chrome-3); border-radius: 6px; }
.ct-n { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.ct-clear, .ct-done { font: inherit; font-size: 11.5px; padding: 3px 8px; border: 1px solid var(--chrome-3); border-radius: 5px; background: #fff; cursor: pointer; }
.ct-clear:hover, .ct-done:hover { background: var(--chrome-2); }
.aw-ttl.active, .dv-ttl.active, .rg-ctitle.active { background: #e0e7ff; border-color: #6366f1; color: #3730a3; }
.dv-ttl { flex: none; border: 1px solid var(--chrome-3); border-radius: 5px; background: #fff; color: var(--text); cursor: pointer; font: inherit; line-height: 1; padding: 3px 7px; font-size: 11px; font-weight: 700; }
.dv-ttl:hover { background: var(--chrome-2); }
.rg-ctitle-box { margin-bottom: 6px; }
.rg-ctitle-box .rg-ctitle { width: 100%; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-ctitle-box .ct-row { margin-top: 5px; padding: 6px; border: 1px solid var(--chrome-3); border-radius: 6px; }
.rg-ctitle-box .ct-label { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 3px; }
.rg-sv-name { display: block; }
.rg-load .rg-sv-when, .rg-load .rg-sv-mag { font-variant-numeric: tabular-nums; }
.rg-saved-row { display: flex; gap: 4px; }
.rg-load {
  flex: 1; min-width: 0; text-align: left; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; padding: 4px 8px; color: var(--text);
}
.rg-load small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.rg-load:hover { background: var(--chrome-2); }
.rg-del { flex: none; width: 26px; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; cursor: pointer; font-size: 15px; color: var(--muted); }
.rg-del:hover { background: #fee2e2; color: #b91c1c; }
.rg-none { margin: 0; }
.region-note { margin: 0 0 10px; padding: 7px 9px; border-radius: 6px; background: #fffbeb; border: 1px solid #f59e0b; font-size: 12px; line-height: 1.4; }
body.region-on #seg-mag, body.region-on #seg-window, body.region-on #mag-custom-wrap, body.region-on #window-custom-wrap { opacity: .45; pointer-events: none; }
body.mobile #region-panel { display: none !important; }

/* The sequence player's and statistics' controls. */
.aw-sequence .aw-ctl { flex-wrap: nowrap; }
.sq-play { min-width: 84px; }
.sq-slider { flex: 1; min-width: 80px; }
.sq-time { font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--muted); white-space: nowrap; min-width: 150px; }
.sq-opt, .aw-bin label { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sq-opt select, .aw-bin select { font: inherit; font-size: 11.5px; padding: 2px 3px; border: 1px solid var(--chrome-3); border-radius: 5px; background: #fff; color: var(--text); max-width: 240px; }
.aw-stats .aw-bin { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.st-out { width: 100%; }
.st-res { font-size: 12.5px; line-height: 1.45; margin-bottom: 4px; }
.st-warn { color: #b45309; font-weight: 600; }
.aw-legend .aw-note sup { line-height: 0; }

/* ---------- active faults (js/faults.js) ---------- */
.fault-panel {
  width: 290px; min-height: 0; overflow-y: auto;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.ft-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; margin: 2px 0 6px; font-size: 12px; }
.ft-kind { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ft-kind i { width: 16px; height: 3px; border-radius: 2px; flex: none; }
.ft-hint { margin: 4px 0 2px; }
.ft-info { margin: 6px 0 2px; padding: 8px; border: 1px solid #facc15; border-radius: 8px; background: #fefce8; }
.ft-name { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.ft-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0 0 8px; font-size: 12px; }
.ft-facts dt { color: var(--muted); }
.ft-facts dd { margin: 0; font-weight: 600; }
.ft-note { margin: 6px 0 0; font-size: 11.5px; }
.ft-note:empty { display: none; }
.ft-regions-box { margin-top: 10px; border: 1px solid var(--chrome-3); border-radius: 8px; padding: 0 8px; }
.ft-regions-box > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 7px 0;
  font-size: 12.5px; font-weight: 700;
}
.ft-regions-box > summary::-webkit-details-marker { display: none; }
.ft-regions-box > summary::after {
  content: ''; margin-left: auto; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); transition: transform .15s ease;
}
.ft-regions-box[open] > summary::after { transform: rotate(-135deg); }
.ft-regions-sum { font-weight: 500; color: var(--muted); }
.ft-regions-box .ft-regions { padding-bottom: 8px; }
/* Settings: the regional networks, folded under the data source. */
.net-box { margin-top: 8px; }
.net-list { display: flex; flex-direction: column; }
.net-row { padding: 3px 0; font-size: 12.5px; }
.net-row .net-name { font-weight: 600; }
.net-row small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.net-box .hint { margin: 4px 0 8px; font-size: 11.5px; }
.net-box .hint + .hint { margin-top: -2px; }
/* A magnitude a regional network gave: on the card, a note beside it; in the list, underlined. */
.net-mag { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
a.net-mag { color: var(--accent); text-decoration: none; }
a.net-mag:hover { text-decoration: underline; }
.row .mag.net { text-decoration: underline dotted var(--accent); text-underline-offset: 3px; }
/* GEOFON's earthquake that the source has not listed yet. */
.row.provisional { border-left-style: dashed; }
.row.provisional .place { font-style: italic; }
.ft-allnone { display: flex; gap: 4px; margin-bottom: 4px; }
.ft-allnone .btn { padding: 1px 8px; font-size: 11px; }
.ft-regions { display: flex; flex-direction: column; gap: 3px; }
.ft-region { font-size: 12.5px; }
.ft-region small { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.ft-credit { margin: 10px 0 0; font-size: 11px; line-height: 1.4; }
.fault-panel .btn:disabled { opacity: .45; cursor: default; }
/* The fault panel folds to its title bar, as the inner-Earth one does. */
.fault-panel.collapsed { padding-bottom: 4px; }
.fault-panel.collapsed .measure-head { margin-bottom: 0; }
.fault-panel.collapsed .ft-body { display: none; }
.fault-panel.collapsed .ft-collapse svg { transform: rotate(180deg); }
.fault-panel .measure-head .rg-title { margin-right: auto; }
.fault-panel .measure-head { gap: 2px; }

/* ---------- volcanoes (js/volcanoes.js) ---------- */
/* A small triangle in a volcano's colour (--c) with a dark edge: the swatch in the panels, the tooltip and
   the legend, matching the triangles on the globe. */
.vt-tri {
  position: relative; display: inline-block; flex: none; width: 13px; height: 12px; vertical-align: -1px;
}
.vt-tri::before, .vt-tri::after {
  content: ''; position: absolute; clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.vt-tri::before { inset: 0; background: rgba(0,0,0,.8); }
.vt-tri::after { inset: 3px 2.6px 1.4px; background: var(--c); }
.tooltip .vt-tri { margin: 0 4px 0 0; }
.tooltip .vt-tri::before { background: rgba(255,255,255,.85); }

.volcano-panel, .nearvolc-panel {
  width: 300px; min-height: 0; overflow-y: auto;
  background: rgba(255,255,255,.97); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px 12px; font-size: 13px;
}
.vt-title { display: inline-flex; align-items: center; gap: 7px; margin-right: auto; }
.volcano-panel .measure-head, .nearvolc-panel .measure-head { gap: 2px; }
.volcano-panel.collapsed { padding-bottom: 4px; }
.volcano-panel.collapsed .measure-head { margin-bottom: 0; }
.volcano-panel.collapsed .vt-body { display: none; }
.volcano-panel.collapsed .vt-collapse svg { transform: rotate(180deg); }
.vt-rows { display: grid; grid-template-columns: 1fr; gap: 0 12px; padding: 2px 0 0; }
body.mobile .vt-rows { grid-template-columns: 1fr 1fr; }
.vt-rows .ap-shell { gap: 6px; }
.vt-n { margin-left: auto; padding-left: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.vt-hint { margin: 8px 0 0; }
.vt-info { margin: 8px 0 2px; padding: 8px; border: 1px solid #67e8f9; border-radius: 8px; background: #ecfeff; }
.vt-name { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.vt-facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0 0 8px; font-size: 12px; }
.vt-facts dt { color: var(--muted); }
.vt-facts dd { margin: 0; font-weight: 600; }
.vt-info .rg-row { display: flex; gap: 6px; }
.vt-link { text-decoration: none; }
.vt-credit { margin: 10px 0 0; font-size: 11px; line-height: 1.4; }

/* The card's nearest three: each with its colour, name and type, and its distance at the right. */
.nv-quake { margin: 0 0 6px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.nv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nv-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 8px; }
.nv-what { display: flex; flex-direction: column; min-width: 0; }
.nv-name { font-weight: 700; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-name:hover { text-decoration: underline; }
.nv-type { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nv-dist { font-weight: 600; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--chrome-2); font-size: 11.5px; color: var(--muted); }
.nv-key { display: inline-flex; align-items: center; gap: 5px; }
.nv-credit { margin: 6px 0 0; font-size: 11px; line-height: 1.4; }

/* "All layers" above the inner-Earth view's checkboxes, and the volcanoes' heading among them. */
.ap-shell-sub { grid-column: 1 / -1; margin: 6px 0 0; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ap-all { font-size: 12.5px; font-weight: 600; padding: 4px 0 2px; gap: 6px; }
.ap-all input { width: 15px; height: 15px; }

/* On a phone: the fault and volcano panels and the nearest three sit under the chip band, full width
   (the right-hand stack moves there), and fold to just their title bar at the right. No 3D plot of a
   fault on a phone. Bigger targets for a finger. */
body.mobile #ft-plot3d, body.mobile #ft-3d-note { display: none; }
body.mobile #fault-panel, body.mobile #volcano-panel, body.mobile #nearvolc-panel {
  width: auto; max-width: none; padding: 4px 4px 8px 12px; font-size: 12.5px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 8px 24px rgba(0,0,0,.18);
}
body.mobile #fault-panel .measure-head, body.mobile #volcano-panel .measure-head, body.mobile #nearvolc-panel .measure-head { margin-bottom: 2px; font-size: 13.5px; }
body.mobile #fault-panel .chevron-btn, body.mobile #volcano-panel .chevron-btn,
body.mobile #fault-panel .close-btn, body.mobile #volcano-panel .close-btn, body.mobile #nearvolc-panel .close-btn { width: 34px; height: 34px; }
body.mobile #fault-panel .chevron-btn svg, body.mobile #volcano-panel .chevron-btn svg { width: 20px; height: 20px; }
body.mobile #fault-panel.collapsed, body.mobile #volcano-panel.collapsed {
  align-self: flex-end; width: max-content; max-width: calc(100vw - 20px); padding: 3px 4px 3px 12px;
}
body.mobile #fault-panel .ft-body, body.mobile #volcano-panel .vt-body { padding-right: 8px; }
body.mobile #fault-panel .ft-kinds { margin-bottom: 4px; }
body.mobile #fault-panel .ft-regions-box { margin-top: 6px; }
body.mobile #fault-panel .ft-region input, body.mobile #volcano-panel .ap-shell input { width: 18px; height: 18px; }
body.mobile #volcano-panel .ap-shell-row { min-height: 34px; }
body.mobile #volcano-panel .ap-info { width: 26px; height: 26px; font-size: 13px; }
body.mobile #nearvolc-panel { padding-right: 4px; }
body.mobile #nearvolc-panel .nv-list, body.mobile #nearvolc-panel .nv-legend, body.mobile #nearvolc-panel .nv-quake { padding-right: 8px; }
body.mobile #nearvolc-panel .nv-credit { display: none; }

/* Panels over the map move by their headers (js/draggable.js). */
.drag-handle { cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.drag-handle button, .drag-handle summary { cursor: pointer; }
.dragging { box-shadow: 0 10px 28px rgba(0,0,0,.3) !important; }
.cu-final { font-size: 12.5px; line-height: 1.4; }
.cu-final b { font-variant-numeric: tabular-nums; }

/* The activity chart's moons (js/activity.js, js/lunar.js): the button, the key, the tooltip line. */
.aw-moonb { display: inline-flex; align-items: center; gap: 5px; }
.aw-moonb:disabled { opacity: .5; cursor: default; }
.aw-moonb:disabled:hover { background: #fff; }
.aw-moon-ico { width: 12px; height: 12px; flex: none; }
.aw-moon { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1px solid; box-sizing: border-box; flex: none; vertical-align: -1px; margin-right: 5px; }
.aw-moonkeys { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.aw-moonkeys .aw-moon { margin-right: 0; }
.aw-moon-note { color: var(--muted); font-size: 11.5px; }
.aw-tip-moon b { font-weight: 700; }
.aw-key i.aw-moon { width: 11px; height: 11px; border-radius: 50%; box-shadow: none; }

/* The three nearest volcanoes' names over the globe (VolcanoLayer._placeTags in js/volcanoes.js): page
   text, crisp at any screen density, each on a dark chip with its kind's triangle; a tag lifted clear of
   another has a thin line down to its volcano. */
.nv-tags { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.nv-tag {
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px 3px 6px; border-radius: 999px; white-space: nowrap;
  font: 600 12.5px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #fff; background: rgba(17,24,39,.86); box-shadow: 0 1px 4px rgba(0,0,0,.35); letter-spacing: .1px;
}
.nv-tag .vt-tri { margin: 0; }
.nv-lead { position: absolute; left: 0; top: 0; width: 1.5px; margin-left: -0.75px; background: rgba(255,255,255,.92); box-shadow: 0 0 0 .5px rgba(17,24,39,.55); }
.nv-tag[hidden], .nv-lead[hidden] { display: none; }
.nv-tag .vt-tri::before { background: rgba(255,255,255,.88); }
.nv-lead { z-index: 0; }
.nv-tag { z-index: 1; }

/* The region panel folds to its title bar (the chevron beside its ×), remembered. */
.region-panel .measure-head { gap: 2px; }
.region-panel.collapsed { padding-bottom: 4px; }
.region-panel.collapsed .measure-head { margin-bottom: 0; }
.region-panel.collapsed .rg-fold { display: none; }
.region-panel.collapsed .rg-collapse svg { transform: rotate(180deg); }
/* A custom window to the hour: From and To each a day and an hour (UTC), one per line. */
.rg-dates-custom { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; font-size: 12px; }
.rg-when { display: grid; grid-template-columns: 36px auto auto 1fr; align-items: center; gap: 5px; }
.rg-when > span:first-child { color: var(--muted); font-weight: 600; }
.rg-when input, .rg-hour { font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--chrome-3); border-radius: 6px; background: #fff; color: var(--text); }
.rg-hour { padding: 3px 2px; font-variant-numeric: tabular-nums; }
.rg-utc { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.rg-emsc-note { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; }
.rg-linkbtn { font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.rg-linkbtn:hover { color: #1e40af; }
