/* ==========================================================================
   ImageIngest — base + components (Stellaria institutional language)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-weight: 600; line-height: var(--lh-tight); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
p { margin: 0; max-width: var(--measure-body); }
a { color: var(--c-accent-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
img, canvas, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

::selection { background: var(--c-accent-dim); color: var(--c-white); }

/* focus ring on every interactive element */
:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-2);
}

.skip-link {
  position: absolute; left: var(--sp-2); top: -3rem;
  background: var(--c-accent); color: var(--c-white);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-2);
  z-index: 999; transition: top var(--dur-1) var(--ease);
}
.skip-link:focus { top: var(--sp-2); }

/* --- mono label / eyebrow ------------------------------------------------ */
.eyebrow, .label, .mono {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: var(--fs-eyebrow);
  color: var(--c-text-dim);
  font-weight: 500;
}
.mono { text-transform: none; letter-spacing: 0; }

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  min-height: 40px; padding: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm); font-weight: 500;
  color: var(--c-text);
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--c-surface-3); border-color: var(--c-line-strong); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--primary {
  background: var(--c-accent); border-color: var(--c-accent);
  color: var(--c-white); font-weight: 600;
}
.btn--primary:hover { background: var(--c-accent-hi); border-color: var(--c-accent-hi); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--c-text-mut); }
.btn--ghost:hover { background: var(--c-surface-2); color: var(--c-text); }
.btn--danger:hover { border-color: var(--c-crit); color: var(--c-crit); }
.btn--sm { min-height: 32px; padding: var(--sp-1) var(--sp-3); font-size: var(--fs-label); }
.btn--icon { min-height: 40px; width: 40px; padding: 0; }
.btn--block { width: 100%; }

/* --- inputs -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label {
  font-family: var(--font-mono); font-size: var(--fs-label);
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--c-text-mut);
}
.input, .select, .textarea {
  width: 100%;
  min-height: 40px; padding: var(--sp-2) var(--sp-3);
  font-family: var(--font-display); font-size: var(--fs-body);
  color: var(--c-text);
  background: var(--c-inset);
  border: 1px solid var(--c-line);
  border-radius: var(--r-2);
  transition: border-color var(--dur-1) var(--ease);
}
.input::placeholder { color: var(--c-text-dim); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-accent); box-shadow: var(--shadow-focus);
}
.textarea { min-height: 72px; resize: vertical; line-height: var(--lh-body); }
.select { appearance: none; cursor: pointer; }
.input--mono { font-family: var(--font-mono); font-size: var(--fs-sm); }

/* --- panel --------------------------------------------------------------- */
.panel {
  background: var(--c-surface-1);
  border: 1px solid var(--c-line);
  border-radius: var(--r-3);
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-line-soft);
}
.panel__body { padding: var(--sp-4); }

/* --- tags / chips -------------------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-mono); font-size: var(--fs-label);
  padding: 2px var(--sp-2); border-radius: var(--r-1);
  border: 1px solid var(--c-line); color: var(--c-text-mut);
  background: var(--c-surface-2);
}
.dot { width: 8px; height: 8px; border-radius: var(--r-pill); flex: none; }

/* --- toast --------------------------------------------------------------- */
#toasts {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 400; max-width: 340px;
}
.toast {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface-3); border: 1px solid var(--c-line-strong);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-2); font-size: var(--fs-sm);
  animation: toast-in var(--dur-2) var(--ease);
}
.toast--good { border-left-color: var(--c-good); }
.toast--warn { border-left-color: var(--c-warn); }
.toast--crit { border-left-color: var(--c-crit); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   AUTH PAGES
   ========================================================================== */
.auth {
  min-height: 100vh;
  display: grid; grid-template-columns: 1.1fr 0.9fr;
}
.auth__aside {
  position: relative; overflow: hidden;
  padding: var(--sp-7) var(--sp-7);
  display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--c-line);
  background: var(--c-inset);
}
.auth__aside canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.auth__aside > * { position: relative; z-index: 1; }
.auth__brand { display: flex; align-items: center; gap: var(--sp-3); }
.auth__mark {
  width: 34px; height: 34px; border-radius: var(--r-2);
  border: 1px solid var(--c-line-strong);
  display: grid; place-items: center;
  background: var(--c-surface-1);
}
.auth__mark span { width: 12px; height: 12px; border-radius: var(--r-pill); background: var(--c-accent); box-shadow: 0 0 0 4px var(--c-accent-tint); }
.auth__aside h1 { font-size: 2.1rem; max-width: 16ch; }
.auth__specs { display: flex; flex-direction: column; gap: var(--sp-3); }
.auth__spec { display: flex; gap: var(--sp-3); align-items: baseline; }
.auth__spec b { font-family: var(--font-mono); color: var(--c-accent-hi); font-weight: 500; min-width: 3.5ch; }
.auth__main {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
}
.auth__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--sp-5); }
.auth__card form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth__error {
  display: none;
  padding: var(--sp-3); border-radius: var(--r-2);
  border: 1px solid var(--c-crit); color: var(--c-crit);
  background: color-mix(in oklab, var(--c-crit) 12%, transparent);
  font-size: var(--fs-sm);
}
.auth__error.show { display: block; }
.auth__alt { font-size: var(--fs-sm); color: var(--c-text-mut); }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app { display: grid; grid-template-rows: auto 1fr; height: 100vh; overflow: hidden; }

/* view container: each view fills the main region */
#main { position: relative; min-height: 0; }
.view { position: absolute; inset: 0; }
.view.hidden { display: none; }
.workspace { height: 100%; }

/* globe home surface */
#globeView { background: var(--c-inset); }
#globeView #globe { position: absolute; inset: 0; }
.globe-hint {
  position: absolute; top: var(--sp-4); left: 50%; transform: translateX(-50%); z-index: 10;
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--c-surface-1); border: 1px solid var(--c-accent-dim);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-2);
  font-size: var(--fs-sm); box-shadow: none;
}
.globe-hint[hidden] { display: none; } /* [hidden] must beat display:flex */
.globe-empty {
  position: absolute; top: var(--sp-5); left: var(--sp-5); z-index: 8;
  width: min(260px, 76vw); text-align: left;
  display: flex; flex-direction: column; gap: var(--sp-1); align-items: flex-start;
  background: color-mix(in oklab, var(--c-surface-1) 82%, transparent);
  border: 1px solid var(--c-line); border-radius: var(--r-2);
  padding: var(--sp-3);
}
.globe-empty.hidden { display: none; }
.globe-empty h3 { font-size: var(--fs-sm); }
.globe-empty p.muted { font-size: var(--fs-label); }
.globe-pop strong { font-size: var(--fs-body); }

.topbar {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4); height: 56px;
  border-bottom: 1px solid var(--c-line);
  background: var(--c-surface-1);
}
.topbar__brand { display: flex; align-items: center; gap: var(--sp-3); }
.topbar__brand .auth__mark { width: 28px; height: 28px; }
.topbar__brand .auth__mark span { width: 9px; height: 9px; box-shadow: 0 0 0 3px var(--c-accent-tint); }
.topbar__title { font-weight: 600; font-size: var(--fs-body); }
.topbar__title small { display: block; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-text-dim); }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); color: var(--c-text-mut); }
.topbar__user .dot { background: var(--c-good); }

.workspace {
  display: grid;
  grid-template-columns: 56px 1fr 320px;
  min-height: 0;
}

/* --- tool rail ----------------------------------------------------------- */
.rail {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  padding: var(--sp-3) 0;
  border-right: 1px solid var(--c-line);
  background: var(--c-surface-1);
  overflow-y: auto;
}
.rail__group { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-2) 0; }
.rail__group + .rail__group { border-top: 1px solid var(--c-line-soft); }
.tool {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--r-2);
  background: transparent; color: var(--c-text-mut); cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
  position: relative;
}
.tool:hover { background: var(--c-surface-3); color: var(--c-text); }
.tool[aria-pressed="true"] {
  background: var(--c-accent-tint); color: var(--c-accent-hi); border-color: var(--c-accent-dim);
}
.tool svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tool[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 48px; top: 50%; transform: translateY(-50%);
  background: var(--c-surface-3); border: 1px solid var(--c-line-strong);
  padding: var(--sp-1) var(--sp-2); border-radius: var(--r-1);
  font-family: var(--font-mono); font-size: var(--fs-label); white-space: nowrap;
  color: var(--c-text); z-index: 50; pointer-events: none;
}
.tool[data-tip]:hover::before {
  content: ""; position: absolute; left: 42px; top: 50%; transform: translateY(-50%);
  border: 5px solid transparent; border-right-color: var(--c-line-strong);
}

/* --- stage (canvas viewport) --------------------------------------------- */
.stage {
  position: relative; min-width: 0; min-height: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, var(--c-line-soft) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--c-line-soft) 23px 24px),
    var(--c-inset);
  overflow: hidden;
  cursor: crosshair;
}
.stage.is-empty { cursor: default; }
.stage__viewport { position: absolute; inset: 0; touch-action: none; }
.stage__canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; image-rendering: auto; }
#annotationCanvas { z-index: 2; }
#imageCanvas { z-index: 1; }

.stage__empty {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-4); text-align: center; padding: var(--sp-6);
}
.stage__empty p { color: var(--c-text-mut); max-width: 44ch; }

.stage__hud {
  position: absolute; left: var(--sp-3); bottom: var(--sp-3); z-index: 6;
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
}
.stage__hud .tag { background: var(--c-surface-1); }
.stage__toolbar {
  position: absolute; right: var(--sp-3); top: var(--sp-3); z-index: 6;
  display: flex; gap: var(--sp-2);
  background: var(--c-surface-1); border: 1px solid var(--c-line);
  padding: var(--sp-1); border-radius: var(--r-2);
}

/* --- inspector ----------------------------------------------------------- */
.inspector {
  border-left: 1px solid var(--c-line);
  background: var(--c-surface-1);
  display: flex; flex-direction: column; min-height: 0;
}
.inspector__section { border-bottom: 1px solid var(--c-line-soft); }
.inspector__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
}
.inspector__head h3 { font-size: var(--fs-sm); font-weight: 600; }
.inspector__scroll { overflow-y: auto; }
.inspector__body { padding: var(--sp-3) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }

.count { font-family: var(--font-mono); font-size: var(--fs-label); color: var(--c-text-dim); }

/* image list */
.imglist { display: flex; flex-direction: column; gap: var(--sp-2); }
.imgitem {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--c-line-soft); border-radius: var(--r-2);
  cursor: pointer; background: var(--c-surface-1);
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.imgitem:hover { border-color: var(--c-line-strong); background: var(--c-surface-2); }
.imgitem[aria-selected="true"] { border-color: var(--c-accent); background: var(--c-accent-tint); }
.imgitem__thumb { width: 40px; height: 32px; border-radius: var(--r-1); object-fit: cover; border: 1px solid var(--c-line); background: var(--c-inset); flex: none; }
.imgitem__meta { min-width: 0; }
.imgitem__meta b { display: block; font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imgitem__meta span { font-family: var(--font-mono); font-size: 0.66rem; color: var(--c-text-dim); }

/* annotation list */
.annlist { display: flex; flex-direction: column; gap: var(--sp-1); }
.annrow {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-radius: var(--r-2);
  border: 1px solid transparent; cursor: pointer;
}
.annrow:hover { background: var(--c-surface-2); }
.annrow[aria-selected="true"] { background: var(--c-accent-tint); border-color: var(--c-accent-dim); }
.annrow__swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px solid rgba(255,255,255,0.25); }
.annrow__label { flex: 1; min-width: 0; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.annrow__type { font-family: var(--font-mono); font-size: 0.62rem; color: var(--c-text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.annrow__del { color: var(--c-text-dim); opacity: 0; }
.annrow:hover .annrow__del { opacity: 1; }
.annrow__del:hover { color: var(--c-crit); }

/* class palette */
.classes { display: flex; flex-direction: column; gap: var(--sp-1); }
.classrow {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-radius: var(--r-2); cursor: pointer;
  border: 1px solid transparent;
}
.classrow:hover { background: var(--c-surface-2); }
.classrow[aria-pressed="true"] { border-color: var(--c-accent-dim); background: var(--c-accent-tint); }
.classrow .swatch { width: 14px; height: 14px; border-radius: var(--r-1); flex: none; }
.classrow .name { flex: 1; font-size: var(--fs-sm); }
.classrow .key { font-family: var(--font-mono); font-size: 0.62rem; color: var(--c-text-dim); }

.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.help { font-size: var(--fs-label); color: var(--c-text-dim); font-family: var(--font-mono); }
input[type="range"], input[type="checkbox"] { accent-color: var(--c-accent); }
input[type="range"] { height: 20px; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; }

/* --- globe modal --------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: stretch;
  background: color-mix(in oklab, var(--c-bg) 82%, transparent);
}
.modal.show { display: flex; }
.modal__panel {
  margin: auto; width: min(1100px, 94vw); height: min(760px, 92vh);
  background: var(--c-surface-1); border: 1px solid var(--c-line-strong);
  border-radius: var(--r-3); overflow: hidden;
  display: grid; grid-template-rows: auto 1fr;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-line); }
.globe-wrap { position: relative; min-height: 0; }
#globe { position: absolute; inset: 0; }
.globe-legend {
  position: absolute; left: var(--sp-4); bottom: var(--sp-4); z-index: 5;
  background: color-mix(in oklab, var(--c-surface-1) 88%, transparent);
  border: 1px solid var(--c-line); border-radius: var(--r-2);
  padding: var(--sp-3); font-size: var(--fs-sm); max-width: 260px;
}
.globe-legend .eyebrow { margin-bottom: var(--sp-2); }
/* mapbox popups tuned to the palette */
.mapboxgl-popup-content { background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-line-strong); border-radius: var(--r-2); font-family: var(--font-display); box-shadow: none; padding: var(--sp-3); }
.mapboxgl-popup-tip { display: none; }
.mapboxgl-ctrl-attrib { font-size: 10px; }

/* --- utilities ----------------------------------------------------------- */
.row { display: flex; align-items: center; gap: var(--sp-2); }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.grow { flex: 1; }
.muted { color: var(--c-text-mut); }
.dim { color: var(--c-text-dim); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

@media (max-width: 980px) {
  .workspace { grid-template-columns: 56px 1fr; }
  .inspector { display: none; }
}

/* ==========================================================================
   Glass treatment  (explicit user request; overrides the flat-panel default)
   Translucent surfaces + backdrop blur + a soft top-edge highlight.
   ========================================================================== */
:root {
  --glass-edge: inset 0 1px 0 color-mix(in oklab, var(--c-white) 10%, transparent);
  --glass-line: color-mix(in oklab, var(--c-white) 12%, transparent);
}

/* app chrome */
.topbar {
  background: color-mix(in oklab, var(--c-surface-1) 64%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom-color: var(--glass-line);
  box-shadow: var(--glass-edge);
}
.rail {
  background: color-mix(in oklab, var(--c-surface-1) 58%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-right-color: var(--glass-line);
}
.inspector {
  background: color-mix(in oklab, var(--c-surface-1) 62%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border-left-color: var(--glass-line);
  box-shadow: var(--glass-edge);
}

/* floating panels over the map / canvas */
.stage__toolbar, .stage__hud .tag, .globe-legend, .globe-hint, .globe-empty,
.toast, .mapboxgl-popup-content {
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--glass-edge);
}
.stage__toolbar { background: color-mix(in oklab, var(--c-surface-1) 55%, transparent); border-color: var(--glass-line); }
.stage__hud .tag { background: color-mix(in oklab, var(--c-surface-1) 48%, transparent); border-color: var(--glass-line); }
.globe-legend { background: color-mix(in oklab, var(--c-surface-1) 48%, transparent); border-color: var(--glass-line); }
.globe-hint { background: color-mix(in oklab, var(--c-surface-1) 55%, transparent); border-color: color-mix(in oklab, var(--c-accent) 55%, transparent); }
.globe-empty { background: color-mix(in oklab, var(--c-surface-1) 48%, transparent); border-color: var(--glass-line); }
.toast { background: color-mix(in oklab, var(--c-surface-3) 58%, transparent); border-color: var(--glass-line); }
.mapboxgl-popup-content { background: color-mix(in oklab, var(--c-surface-2) 66%, transparent); border-color: var(--glass-line); }

/* glass controls */
.btn { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn:not(.btn--primary):not(.btn--ghost) { background: color-mix(in oklab, var(--c-surface-2) 62%, transparent); border-color: var(--glass-line); }
.btn:not(.btn--primary):not(.btn--ghost):hover { background: color-mix(in oklab, var(--c-surface-3) 72%, transparent); }
.input, .select, .textarea {
  background: color-mix(in oklab, var(--c-inset) 66%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}

/* glass tool rail buttons when active */
.tool[aria-pressed="true"] { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* auth card as a glass panel; add depth to the page */
.auth__card {
  background: color-mix(in oklab, var(--c-surface-1) 42%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-3);
  padding: var(--sp-6);
  box-shadow: var(--glass-edge);
}
.auth__main {
  background:
    radial-gradient(120% 90% at 80% 10%, color-mix(in oklab, var(--c-accent) 12%, transparent), transparent 60%),
    var(--c-bg);
}

/* graceful fallback: if blur is unsupported, keep panels opaque enough to read */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar, .rail, .inspector, .stage__toolbar, .globe-legend, .globe-hint,
  .globe-empty, .toast, .mapboxgl-popup-content, .auth__card {
    background: var(--c-surface-1);
  }
}

/* ==========================================================================
   Footprint shape picker
   ========================================================================== */
.shape-menu {
  position: fixed; top: 66px; left: 50%; z-index: 120;
  width: min(440px, 92vw);
  transform: translateX(-50%) translateY(-8px);
  opacity: 0; pointer-events: none;
  background: color-mix(in oklab, var(--c-surface-1) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-3);
  padding: var(--sp-4);
  box-shadow: var(--glass-edge);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.shape-menu.show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.shape-menu__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin: var(--sp-3) 0; }
.shape-opt {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); min-height: 48px;
  border: 1px solid var(--c-line); border-radius: var(--r-2);
  background: color-mix(in oklab, var(--c-surface-2) 60%, transparent);
  color: var(--c-text); cursor: pointer; font-size: var(--fs-sm); font-weight: 500;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.shape-opt:hover { background: color-mix(in oklab, var(--c-surface-3) 72%, transparent); border-color: var(--c-accent-dim); }
.shape-opt svg { width: 22px; height: 22px; stroke: var(--c-accent-hi); fill: none; stroke-width: 1.6; flex: none; }
@media (max-width: 520px) { .shape-menu__grid { grid-template-columns: 1fr; } }

/* ==========================================================================
   Brand logo (favicon mark reused in-page)
   ========================================================================== */
.brand-logo { display: block; border-radius: 22%; flex: none; }
.brand-logo--xs { width: 28px; height: 28px; }
.brand-logo--sm { width: 36px; height: 36px; }
.brand-logo--lg {
  width: 60px; height: 60px;
  filter: drop-shadow(0 6px 22px color-mix(in oklab, var(--c-accent) 45%, transparent));
}
