:root {
  --bg: #0b0f17;
  --surface: #141a23;
  --panel: #1b212b;
  --border: #2a3340;
  --text: #e6e9ed;
  --muted: #9aa5b1;
  --accent: #3b82f6;
  --accent2: #f59e0b;
  --danger: #ef4444;
  --topbar-height: 48px;
}

* { box-sizing: border-box; }

html, body, #app {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem;
  z-index: 100;
  /* On narrow screens, let the whole bar swipe sideways instead of wrapping */
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.topbar::-webkit-scrollbar { display: none; }
/* Nothing in the navbar squashes — everything stays legible and thumb-sized */
.topbar > * { flex-shrink: 0; }
/* Scroll-shadow hint via background-attachment: local.
   The `local` gradients scroll with the content and cover the shadows at each
   edge — so shadows only appear when there IS more to swipe to, and disappear
   when you reach the end (unlike a static mask, which would fade the target
   button as you tap it). */
@media (max-width: 640px) {
  .topbar {
    background:
      linear-gradient(to right, var(--panel) 24px, transparent 24px) left/24px 100% no-repeat local,
      linear-gradient(to left,  var(--panel) 24px, transparent 24px) right/24px 100% no-repeat local,
      radial-gradient(ellipse at left, rgba(0,0,0,0.5), transparent 70%) left/16px 100% no-repeat scroll,
      radial-gradient(ellipse at right, rgba(0,0,0,0.5), transparent 70%) right/16px 100% no-repeat scroll,
      var(--panel);
  }
}

/* Themed icon button — used across navbar and geo panel. Inherits currentColor. */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  min-width: 36px; height: 36px;
  padding: 0 0.55rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); }
.icon-btn svg { flex-shrink: 0; }
.icon-btn .icon-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.5px; }
.icon-btn:not(:has(.icon-label)) { padding: 0; width: 36px; }

.hamburger {
  padding: 0; width: 36px;
  color: var(--text);
}

.brand { display: flex; align-items: baseline; gap: 0.35rem; }
.brand h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 1px;
  color: var(--accent);
}
.brand .tagline {
  color: var(--muted);
  font-size: 0.7rem;
  display: none;
}
@media (min-width: 480px) { .brand .tagline { display: inline; } }

.nav-tabs {
  display: flex;
  gap: 0.2rem;
}
.nav-tab {
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
}
.nav-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.top-tools { display: flex; gap: 0.35rem; align-items: center; }
.top-tools .icon-btn { color: var(--accent2); border-color: var(--accent2); }
.top-tools .icon-btn:hover { color: #fff; background: var(--accent2); }
#suggestOpen { animation: sparkle-pulse 2.2s ease-in-out infinite; }
@keyframes sparkle-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
/* theme toggle sits next to hamburger for thumb reach on iPhone (top-right is hard) */
#toggleTheme { color: var(--muted); }
#toggleTheme:hover { color: var(--accent2); border-color: var(--accent2); }

/* Code/Level annotation toggle — centred in the navbar (flow, never overlaps tabs) */
.anno-toggle {
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.anno-toggle input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── App body ──────────────────────────────────────────────────────────────── */
.app-body {
  position: fixed;
  top: var(--topbar-height); left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
}

/* ── Control strip (horizontal, scrolls sideways, toggled by hamburger) ─────── */
.control-strip {
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 90;
}
.control-strip.collapsed {
  max-height: 0;
  border-bottom: none;
  overflow: hidden;
}

/* a panel is a row of cards; width:max-content lets it overflow → sideways scroll */
.control-panel {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  width: max-content;
  min-width: 100%;
}
.control-panel.hidden { display: none; }

/* cards keep their width and never squash — the strip scrolls instead */
.control-strip .card { flex-shrink: 0; width: 236px; }
.control-strip .card h2 { margin-bottom: 0.4rem; }

/* GEO panel has a single card — let it span the strip and lay contents in columns
   so the MGA menu fills the width instead of leaving dead space to the right. */
.control-strip #geoPanel .geo-card,
.control-strip #exportPanel .geo-card { width: auto; flex: 1 1 auto; max-width: 100%; }
.geo-col textarea { width: 100%; min-width: 200px; }
.geo-cols {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; align-items: flex-start;
}
.geo-col { display: flex; flex-direction: column; gap: 0.35rem; min-width: 200px; }
.geo-col .col-label {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--accent2); font-weight: 700;
}
.geo-col .hint { margin: 0; }

/* inline, wrapping label+input pairs inside a strip card */
.control-strip .field-row {
  flex-wrap: wrap;
  gap: 0.3rem 0.45rem;
  margin-bottom: 0.35rem;
}
.control-strip .field-row label { width: auto; flex: 0 0 auto; }
.control-strip .field-row input { flex: 0 0 auto; width: 74px; padding: 0.3rem; }
.control-strip .row { margin-top: 0.35rem; }
.control-strip .result { margin-top: 0.35rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
}

.card.compact { padding: 0.6rem; }

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent2);
  border-bottom: 1px solid var(--accent2);
  padding-bottom: 0.25rem;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.field-row label {
  width: 45px;
  font-size: 0.75rem;
  color: var(--accent2);
  margin: 0;
  flex-shrink: 0;
}
.field-row input {
  flex: 1;
  min-width: 0;
}

label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input, textarea, select {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem;
  font-size: 0.85rem;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #2563eb; }
/* toggle OFF (default look) vs ON — green so it's unmistakable at a glance */
#autoSwing { background: #2a3340; border-color: #3a4553; color: var(--muted); font-weight: 700; }
#autoSwing.active, #geoLocate.active, #geoMap.active, #geoMarks.active { background: #16a34a; border-color: #16a34a; color: #fff; }
#autoSwing.active:hover, #geoLocate.active:hover, #geoMap.active:hover, #geoMarks.active:hover { background: #15803d; border-color: #15803d; }

/* clear "locked" state — no georeference yet */
.geo-toggle:disabled, #geoExportKml:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-style: dashed;
}
.geo-toggle:disabled:hover, #geoExportKml:disabled:hover { border-color: var(--border); background: var(--panel); }

/* SCIMS mark detail popup — floats near the tapped mark */
.mark-detail {
  position: fixed;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  padding: 0.65rem 0.85rem;
  min-width: 200px;
  max-width: 280px;
  font-family: monospace;
  font-size: 0.82rem;
}
.mark-detail .md-head {
  display: flex; justify-content: space-between; align-items: baseline;
  color: var(--accent2); font-weight: 700; font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.mark-detail .md-close {
  border: none; background: transparent; color: var(--muted);
  padding: 0; width: 20px; height: 20px; font-size: 1rem;
}
.mark-detail .md-close:hover { color: var(--text); border: none; }
.mark-detail .md-row { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.15rem 0; }
.mark-detail .md-row .k { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
.mark-detail .md-row .v { color: var(--text); }
.mark-detail .md-nav { color: #4ade80; margin-top: 0.35rem; }

.row { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.row button { flex: 1; }

.result {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--accent2);
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* "Hire me" callout in the welcome modal — Palisade is the portfolio */
.hire-me {
  margin: 0.9rem 0;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(59,130,246,0.10), rgba(59,130,246,0.02));
}
.hire-tag { margin: 0 0 0.4rem; font-weight: 800; color: var(--accent); font-size: 0.9rem; }
.hire-body { margin: 0 0 0.6rem; font-size: 0.82rem; line-height: 1.45; color: var(--text); }
.hire-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hire-btn {
  flex: 1 1 auto; text-align: center; text-decoration: none;
  padding: 0.55rem 0.9rem; border-radius: 6px; font-weight: 800; font-size: 0.85rem;
  background: var(--accent); color: #fff;
}
.hire-btn:hover { filter: brightness(1.08); }
.hire-btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.hire-btn.hidden { display: none; }
.hire-loc { margin: 0.55rem 0 0; font-size: 0.72rem; color: var(--muted); text-align: center; }

/* Coming-soon notice on the Pro/account modal */
.coming-soon-banner {
  margin: 0 0 0.8rem; padding: 0.6rem 0.7rem;
  border: 1px solid #f59e0b; border-radius: 6px;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b; font-size: 0.75rem; font-weight: 600; line-height: 1.4;
}
.soon-pill {
  font-size: 0.55rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: #0a0e14; background: #f59e0b; padding: 0.1rem 0.35rem; border-radius: 4px;
  vertical-align: middle;
}

/* Account / Pro */
#accountAuth.hidden, #accountPanel.hidden { display: none; }
.google-btn.hidden, .ac-divider.hidden { display: none; }
.google-btn {
  width: 100%; padding: 0.6rem 1rem; margin-bottom: 0.5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: #fff; color: #202124; border: 0; border-radius: 6px;
  font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.google-btn:hover { filter: brightness(0.96); }
.google-btn .g-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  color: #fff; font-weight: 900; font-size: 0.7rem;
}
.ac-divider {
  text-align: center; color: var(--muted); font-size: 0.65rem;
  text-transform: uppercase; letter-spacing: 1px; margin: 0.2rem 0 0.5rem;
}
.ac-tier {
  display: inline-block; padding: 0.05rem 0.4rem; border-radius: 4px;
  background: var(--accent2); color: #0a0e14; font-size: 0.65rem;
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
}
#accountOpen.active { color: #39ff14; border-color: #39ff14; }

/* Find-mark-by-number row */
.mark-find-row { display: flex; gap: 0.4rem; margin-top: 0.4rem; align-items: stretch; }
.mark-find-row #markFindType { flex: 0 0 3.2rem; text-transform: uppercase; }
.mark-find-row #markFindNum { flex: 1 1 auto; min-width: 0; }
.mark-find-row #markFindBtn { flex: 0 0 auto; }
/* SCIMS accuracy-class legend */
.mark-legend {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.45rem; font-size: 0.62rem; color: var(--muted);
}
.mark-legend span { display: inline-flex; align-items: center; gap: 0.25rem; }
.mark-legend i {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 4px currentColor; display: inline-block;
}

.mini-label {
  display: block;
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0.45rem 0 0.2rem;
}

.tool-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; }
.tool-tab { flex: 1; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 0.7rem; padding: 0.4rem 0.2rem; }
.tool-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-panel.hidden { display: none; }
.tool-panel p { font-family: monospace; font-size: 0.85rem; color: var(--accent2); margin-top: 0.5rem; }
.tool-panel .hint { color: var(--muted); font-size: 0.75rem; font-style: italic; font-family: inherit; margin: 0 0 0.5rem; }

/* ── Workspace / Plot ────────────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0; /* allow the flex:1 workspace to shrink in the column-flex app-body */
  position: relative;
}

#plot {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  min-height: 0;
}

#canvas {
  flex: 1;
  width: 100%;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

#readout {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2rem;
  padding: 0 0.25rem;
}

.toolbar { display: flex; gap: 0.5rem; }

/* ── Bottom panel (table) ──────────────────────────────────────────────────── */
.bottom-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 45vh;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.2s ease;
  z-index: 80;
}
.bottom-panel.open { transform: translateY(0); }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent2);
}
.panel-head button {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}

.table-scroll {
  flex: 1;
  overflow: auto;
  padding: 0.5rem 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

th, td {
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

/* ── "Which point?" disambiguation menu ──────────────────────────────────────── */
.point-picker {
  position: fixed;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
}
.point-picker .pp-title {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.4rem 0.25rem;
}
.point-picker button {
  text-align: left;
  font-family: monospace;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  background: var(--panel);
}
.point-picker button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Welcome modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent2);
  border-radius: 10px;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 0.5rem; right: 0.5rem;
  width: 30px; height: 30px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); border: none; }
.modal-title {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.6rem;
  letter-spacing: 3px;
  color: var(--accent);
}
.modal-tag {
  margin: 0 0 0.9rem;
  color: var(--accent2);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-body {
  margin: 0 0 1.1rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
  text-align: left;
}
/* Chip-in / suggest form — replaces the yellow coffee button */
.modal-suggest {
  margin: 0.6rem 0 0.9rem;
  padding: 0.85rem;
  border: 1px solid var(--accent2);
  border-radius: 8px;
  background: var(--panel);
}
.modal-suggest .field-row {
  display: flex; gap: 0.4rem; margin-bottom: 0.4rem;
}
.modal-suggest .field-row input {
  flex: 1; min-width: 0;
}
.modal-suggest textarea {
  width: 100%;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 0.4rem;
}
.modal-suggest-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff !important;
  border: 0;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
}
.modal-suggest-btn:hover { filter: brightness(1.05); }
.modal-suggest-btn:disabled { opacity: 0.7; cursor: default; }
.modal-suggest-btn svg { flex-shrink: 0; }
/* half-price bug report — visually cheaper (muted teal, thinner border) */
.modal-bug-btn {
  width: 100%;
  padding: 0.55rem 1rem;
  background: transparent;
  color: var(--text) !important;
  border: 1px solid #14b8a6;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  margin-top: 0.4rem;
}
.modal-bug-btn:hover { background: rgba(20, 184, 166, 0.15); border-color: #2dd4bf; }
.modal-bug-btn:disabled { opacity: 0.6; cursor: default; }
.modal-bug-btn svg { flex-shrink: 0; color: #14b8a6; }

.modal-enter {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* beta email capture — now inside a <details> to keep the modal quieter */
details.modal-beta {
  margin: 0.4rem 0 0.9rem;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
details.modal-beta[open] { padding-bottom: 0.85rem; }
details.modal-beta summary {
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.25rem 0;
  list-style: none;
  outline: none;
}
details.modal-beta summary::-webkit-details-marker { display: none; }
details.modal-beta summary::before {
  content: '▸ '; color: var(--accent2); font-size: 0.65rem;
}
details.modal-beta[open] summary::before { content: '▾ '; }
.modal-beta-tag {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  color: var(--text);
  text-align: left;
}
.subscribe-row { display: flex; gap: 0.4rem; }
.subscribe-row input { flex: 1; min-width: 0; }
.subscribe-row button {
  flex: 0 0 auto;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.subscribe-row button:hover { background: #2563eb; }
.subscribe-row button:disabled { opacity: 0.6; cursor: default; }
.sub-msg {
  min-height: 1rem;
  margin: 0.4rem 0 0;
  font-size: 0.78rem;
  color: var(--accent2);
  text-align: left;
}
.sub-msg.ok { color: #4ade80; }
.modal-consent {
  margin: 0.4rem 0 0;
  font-size: 0.62rem;
  color: var(--muted);
  text-align: left;
}
.modal-consent a, .modal-legal a { color: var(--accent); }
.modal-install {
  margin: 0.6rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--accent2);
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

.modal-legal {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.5;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

/* ── Light mode ────────────────────────────────────────────────────────────── */
.light-mode { --bg: #f3f5f7; --surface: #ffffff; --panel: #eef1f5; --border: #d0d7df; --text: #111827; --muted: #4b5563; }
.light-mode #canvas { background: #ffffff; }

/* ── Narrow screens ─────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .control-strip { max-height: 42vh; overflow-y: auto; }
  .nav-tab { padding: 0.35rem 0.45rem; font-size: 0.7rem; }
  .brand h1 { font-size: 1rem; }
}

@media (max-width: 640px) {
  .anno-toggle span { display: none; } /* keep just the checkbox, still centred */
}

@media (max-width: 420px) {
  .nav-tab { padding: 0.3rem 0.32rem; font-size: 0.62rem; }
  .brand .tagline { display: none; }
  .control-strip .card { width: 212px; }
}
