@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  color: var(--ink);
  background: var(--body-bg);
  font-family: "Manrope", system-ui, sans-serif;
  font-synthesis: none;
  --header-bg: #17201d;
  --ink: #17201d;
  --muted: #65706a;
  --line: #cdd2ca;
  --paper: #f7f8f4;
  --accent: #ee5f3c;
  --green: #315e50;
  --lime: #dce96b;
  --body-bg: #e9ebe5;
  --surface-0: #f1f2ed;
  --surface-1: #e8ebe4;
  --surface-2: #e2e7de;
  --surface-3: #e4e8e0;
  --surface-4: #d8ddd4;
  --surface-input: #fff;
  --text-soft: #4a524d;
  --border-muted: #aeb6ae;
  --border-input: #bdc4bb;
  --canvas-bg: #e6e6e6;
  --map-bg: #d8ddd5;
  --ok: #178a5c;
  --fail: #bb2d26;
  --ok-bg: #eef6f0;
  --fail-bg: #faf0ee;
  --pending-bg: #eceee9;
  --theme-chart-paper: #f7f8f4;
  --theme-chart-ink: #17201d;
  --theme-chart-muted: #65706a;
  --theme-panorama-bg: #e6e6e6;
  --theme-chart-grid: #d5dad2;
  --theme-chart-grid-text: #4a5751;
  --theme-profile-terrain: #315e50;
  --theme-profile-terrain-stroke: #4a7568;
  --theme-profile-los: #17201d;
  --theme-marker-outline: #f7f8f4;
  --theme-tooltip-bg: rgba(247, 248, 244, 0.94);
  --theme-tooltip-border: rgba(205, 210, 202, 0.9);
  --theme-link-peak: #1b5e4a;
  --workspace-map-height: 420px;
}


html {
  font-size: 100%;
}

html[data-text-size="large"] {
  font-size: 112.5%;
}

html[data-text-size="xlarge"] {
  font-size: 125%;
}

html[data-text-size="xxlarge"] {
  font-size: 137.5%;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 1100px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button, input, select { font: inherit; }

header {
  color: #f6f5ef;
  background: var(--header-bg);
  border-bottom: 4px solid var(--accent);
}
.app-header {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}
.header-session-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 28px;
  background: #101816;
  border-bottom: 1px solid #2a3531;
}
.header-session-label {
  flex: 0 0 auto;
  color: #9fa9a2;
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.header-session-input {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid #4a5751;
  background: #1b2622;
  color: #f6f5ef;
  font-size: 0.6875rem;
}
.header-session-input::placeholder { color: #7f8a84; }
.header-session-input:focus {
  outline: none;
  border-color: var(--lime);
}
.header-button {
  flex: 0 0 auto;
  border: 1px solid #65706a;
  padding: 8px 12px;
  color: #f6f5ef;
  background: transparent;
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.header-button:hover { border-color: var(--lime); color: var(--lime); }
.header-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.header-button.primary:hover {
  border-color: #ff7a5c;
  background: #ff7a5c;
  color: #fff;
}
.header-session-history {
  position: relative;
  flex: 0 0 auto;
}
.session-history-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 16px 40px rgba(16, 24, 22, 0.28);
}
.session-history-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  line-height: 1.5;
}
.header-language {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9fa9a2;
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.header-language-select {
  min-width: 108px;
  padding: 8px 10px;
  border: 1px solid #65706a;
  background: #1b2622;
  color: #f6f5ef;
  font-size: 0.6875rem;
  text-transform: none;
  letter-spacing: 0;
}
.header-language-select:focus {
  outline: none;
  border-color: var(--lime);
}
.header-main {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.header-brand {
  min-width: 0;
  cursor: pointer;
}
.header-brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  flex: 0 0 auto;
  display: block;
}
.brand-mark-frame {
  fill: #1b2622;
  stroke: #3d4f48;
  stroke-width: 1.25;
}
.brand-mark-terrain { fill: #315e50; }
.brand-mark-ridge {
  fill: none;
  stroke: #4a7568;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.brand-mark-horizon {
  stroke: #65706a;
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.55;
}
.brand-mark-los {
  stroke: var(--lime);
  stroke-width: 2;
  stroke-linecap: round;
}
.brand-mark-observer {
  fill: var(--accent);
  stroke: #f6f5ef;
  stroke-width: 1;
}
.brand-mark-target {
  fill: var(--lime);
  stroke: #17201d;
  stroke-width: 1;
}
.brand-wordmark {
  display: flex;
  align-items: baseline;
  gap: 0.28em;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.brand-wordmark-terrain {
  color: #f6f5ef;
  transition: color 0.15s ease;
}
.brand-wordmark-sight {
  color: var(--lime);
  transition: color 0.15s ease;
}
.header-brand:hover .brand-wordmark-terrain { color: #fff; }
.header-brand:hover .brand-wordmark-sight { color: #f0f7a8; }
.header-brand:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 4px;
}
.header-actions { display: flex; align-items: center; gap: 12px; }

h1, h2, p { margin: 0; }
h1:not(.brand-wordmark) { font-size: 1.5rem; letter-spacing: -0.04em; }
.eyebrow, .badge, output, .hint, .legend, .metrics {
  font-family: "DM Mono", monospace;
}
.eyebrow { color: #9fa9a2; font-size: 0.5625rem; letter-spacing: .16em; }
.badge { border: 1px solid #65706a; padding: 8px 12px; font-size: 0.6875rem; }
.badge.real { border-color: var(--lime); color: var(--lime); }
.badge.warning { color: #f4b7a8; border-color: #98513f; }
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #65706a;
  background: transparent;
  color: #f6f5ef;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}
.icon-button:hover { border-color: var(--lime); color: var(--lime); }

.settings-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 2px solid var(--ink);
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}
.settings-dialog::backdrop { background: rgba(23, 32, 29, 0.55); }
.settings-dialog form { padding: 24px; display: grid; gap: 14px; }
.settings-dialog h2 { font-size: 1rem; margin-bottom: 4px; }
.checkbox-inline { display: flex !important; align-items: center; gap: 8px; font-size: 0.6875rem; }
.checkbox-inline input { width: auto; }

.help-dialog {
  width: min(820px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
}
.help-dialog::backdrop { background: rgba(23, 32, 29, 0.6); }
.help-form {
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  max-height: calc(100vh - 32px);
}
.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  color: var(--ink);
}
.help-header h2 {
  font-size: 0.9375rem;
  margin: 0;
  color: var(--ink);
}
.help-close-button {
  flex: 0 0 auto;
  border: 1px solid var(--border-muted);
  padding: 8px 12px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.help-close-button:hover {
  border-color: var(--ink);
  background: var(--surface-input);
  color: var(--ink);
}
.help-content {
  overflow: auto;
  padding: 20px 22px 28px;
  display: grid;
  gap: 22px;
}
.help-toc {
  padding: 14px 16px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.help-toc-list {
  margin: 8px 0 0;
  padding-left: 18px;
  columns: 2;
  column-gap: 24px;
  font-size: 0.6875rem;
  line-height: 1.7;
}
.help-toc-list a { color: var(--green); text-decoration: none; }
.help-toc-list a:hover { text-decoration: underline; }
.help-section h3 {
  font-size: 0.8125rem;
  margin: 0 0 10px;
  color: var(--green);
  letter-spacing: 0.04em;
}
.help-prose {
  font-size: 0.6875rem;
  line-height: 1.65;
  color: var(--ink);
}
.help-prose p { margin: 0 0 10px; }
.help-prose p:last-child { margin-bottom: 0; }
.help-prose ul,
.help-prose ol { margin: 0; padding-left: 20px; }
.help-prose li { margin-bottom: 6px; }
.help-prose li:last-child { margin-bottom: 0; }
.help-prose code {
  font-family: "DM Mono", monospace;
  font-size: 0.625rem;
  background: var(--surface-2);
  padding: 1px 4px;
}
.help-prose a { color: var(--green); }
.help-intro {
  font-size: 0.6875rem;
  line-height: 1.65;
  color: var(--text-soft);
  margin: 0 0 18px;
}
.help-scenario {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.help-scenario:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.help-scenario h4 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.help-figure {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  background: var(--surface-input);
}
.help-figure img {
  display: block;
  width: 100%;
  height: auto;
}
.help-figure figcaption {
  padding: 8px 10px;
  font-size: 0.625rem;
  line-height: 1.5;
  color: #65706a;
  background: var(--surface-0);
  border-top: 1px solid var(--line);
}
.help-scenario-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: 0.6875rem;
  line-height: 1.65;
}
.help-scenario-steps li { margin-bottom: 6px; }
.help-scenario-steps li:last-child { margin-bottom: 0; }
.help-scenario-steps strong { color: var(--ink); }
.help-faq { display: grid; gap: 8px; }
.help-faq-item {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 0 12px;
}
.help-faq-item summary {
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 10px 0;
  list-style-position: outside;
}
.help-faq-item p {
  margin: 0 0 12px;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: var(--text-soft);
}

main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  overflow: hidden;
}
.controls {
  flex: 0 0 320px;
  width: 320px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  background: var(--surface-3);
}
.sidebar-tab {
  margin: 0;
  padding: 12px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-4);
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}
.sidebar-tab:nth-child(2n) { border-right: 0; }
.sidebar-tab:nth-last-child(-n + 2) { border-bottom: 0; }
.sidebar-tab:hover { background: #e8ebe4; color: var(--green); }
.sidebar-tab:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: -2px;
  z-index: 1;
}
.sidebar-tab[aria-selected="true"] {
  background: var(--surface-0);
  color: var(--green);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.sidebar-panels {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.sidebar-panel {
  grid-area: 1 / 1;
  display: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-muted) transparent;
}
.sidebar-panel.is-active { display: block; }
.sidebar-panel::-webkit-scrollbar,
.workspace::-webkit-scrollbar {
  width: 12px;
}
.sidebar-panel::-webkit-scrollbar-thumb,
.workspace::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border: 3px solid var(--surface-0);
  border-radius: 8px;
}
.sidebar-panel::-webkit-scrollbar-thumb:hover,
.workspace::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}
.sidebar-panel::-webkit-scrollbar-track,
.workspace::-webkit-scrollbar-track {
  background: transparent;
}
.controls section { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.controls section:last-child { border-bottom: 0; }
.sidebar-fold {
  margin-top: 14px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface-1);
}
.sidebar-fold > summary {
  padding: 10px 12px;
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  list-style-position: outside;
}
.sidebar-fold[open] > summary {
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.sidebar-fold > :not(summary) { margin-left: 0; margin-right: 0; }
.sidebar-fold .rf-budget--folded {
  margin: 0;
  border: 0;
  background: transparent;
}
.sidebar-fold .actions,
.sidebar-fold .hint,
.sidebar-fold label,
.sidebar-fold output,
.sidebar-fold .peak-list {
  margin-left: 12px;
  margin-right: 12px;
}
.sidebar-fold .actions:last-child,
.sidebar-fold .peak-list:last-child {
  margin-bottom: 12px;
}
.controls h2 { font-size: 0.8125rem; margin-bottom: 16px; }
.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.rf-budget {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-1);
}
.rf-budget legend {
  padding: 0 6px;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--muted);
}
.rf-budget .checkbox-inline {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.625rem;
  color: var(--ink);
}
.rf-budget .checkbox-inline input {
  width: auto;
  min-width: auto;
}
.grid.three { grid-template-columns: repeat(3, 1fr); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 0.625rem; font-weight: 700; }
label.checkbox-inline {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  color: var(--ink);
}
label.checkbox-inline input {
  width: auto;
  min-width: auto;
  margin: 0;
  flex: 0 0 auto;
}
input, select {
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid var(--border-input);
  border-radius: 0;
  color: var(--ink);
  background: var(--surface-input);
  font-family: "DM Mono", monospace;
  font-size: 0.6875rem;
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.slider-row { display: grid; grid-template-columns: 1fr 66px; gap: 8px; align-items: center; }
.slider-row input[type="range"] { padding: 0; accent-color: var(--green); cursor: pointer; }
.elevation-readout {
  display: block;
  margin-top: 10px;
  padding: 10px;
  color: var(--green);
  background: var(--surface-2);
  font-size: 0.5625rem;
}
.file { margin-top: 12px; padding: 10px; border: 1px dashed #9ca69e; cursor: pointer; }
.file input { display: none; }
.hint { margin-top: 9px; color: var(--muted); font-size: 0.5625rem; line-height: 1.5; }
.subsection-label {
  margin: 14px 0 8px;
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.manual-relay-list {
  margin-top: 8px;
  padding: 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  line-height: 1.6;
}
.manual-hop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #cdd2ca;
}
.manual-hop:last-child { border-bottom: 0; }
.manual-hop button {
  flex: 0 0 auto;
  padding: 3px 7px;
  font-size: 0.5625rem;
}
.highest-point-tools {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.highest-point-tools .subsection-label {
  margin-top: 0;
}
.highest-point-tools .actions {
  margin-top: 8px;
}
.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-item {
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid #cdd2ca;
}
.session-item strong {
  display: block;
  font-family: "DM Mono", monospace;
  font-size: 0.6875rem;
  color: var(--ink);
}
.session-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
}
.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.session-actions button {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-size: 0.5625rem;
}
.actions { display: flex; gap: 8px; margin-top: 12px; }
.actions.wrap { flex-wrap: wrap; }
button {
  border: 1px solid var(--border-muted);
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 0.625rem;
  font-weight: 700;
}
button:hover { border-color: var(--ink); background: var(--surface-input); }
button.primary { color: #fff; background: var(--green); border-color: var(--green); }
button.small { padding: 6px 9px; }

.workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--border-muted) transparent;
}
.card { background: var(--paper); border: 1px solid var(--line); }
.card-title.profile-card-title { flex-wrap: wrap; gap: 10px; }
.profile-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.profile-tools select {
  width: auto;
  min-width: 168px;
  padding: 4px 6px;
  font-size: 0.625rem;
}
.profile-tools output { min-width: 0; text-align: right; }
.card-title {
  min-height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.card-title > div { display: flex; align-items: center; gap: 10px; }
.card-title span { color: var(--accent); font-family: "DM Mono", monospace; font-size: 0.625rem; }
.card-title h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; }
.card-title .relay-status {
  padding: 4px 8px;
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  letter-spacing: .08em;
}
.relay-status-ok { color: var(--ok); background: var(--ok-bg); border: 1px solid var(--ok); }
.relay-status-fail { color: var(--fail); background: var(--fail-bg); border: 1px solid var(--fail); }
.relay-status-pending { color: var(--muted); background: var(--pending-bg); border: 1px solid var(--line); }
.relay-card.relay-ok { border-color: var(--ok); }
.relay-card.relay-fail { border-color: var(--fail); }
.relay-card.relay-ok #relay-summary { background: var(--ok-bg); }
.relay-card.relay-fail #relay-summary { background: var(--fail-bg); }
.profile-card.los-ok { border-color: var(--ok); }
.profile-card.los-fail { border-color: var(--fail); }
.profile-card.los-ok #profile-summary { background: var(--ok-bg); }
.profile-card.los-fail #profile-summary { background: var(--fail-bg); }
.profile-card #profile-summary {
  margin: 12px 14px 0;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
  font: 10px "IBM Plex Sans", sans-serif;
  line-height: 1.45;
}
.profile-chart-wrap {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.relay-editor {
  margin: 0 14px 12px;
  padding: 12px;
  background: var(--surface-1);
  border: 1px solid var(--line);
}
.relay-editor output {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  line-height: 1.5;
}
.relay-editor-actions { margin-top: 10px; }
.relay-editor-actions button {
  width: 100%;
  padding: 8px 10px;
  color: var(--fail);
  background: var(--fail-bg);
  border: 1px solid var(--fail);
  cursor: pointer;
  font: 10px "IBM Plex Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.relay-editor-actions button:hover { background: var(--surface-2); }
.relay-marker { background: transparent; border: 0; }
.relay-marker-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  font: bold 10px "DM Mono", monospace;
  background: var(--relay-color, #c4a035);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0004;
  cursor: grab;
}
.relay-marker.selected .relay-marker-dot {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.relay-leg-ok { color: #178a5c; }
.relay-leg-fail { color: #bb2d26; }
.los-marker { background: transparent; border: 0; }
.los-marker-dot {
  display: grid;
  place-items: center;
  color: #fff;
  font: bold 9px "DM Mono", monospace;
  background: var(--los-color, #ee5f3c);
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0004;
  cursor: grab;
}
.los-marker.selected .los-marker-dot {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.profile-sample-marker { background: transparent; border: 0; }
.profile-sample-marker-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #fff;
  font: bold 9px "DM Mono", monospace;
  background: #2a7abf;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0004;
  cursor: default;
}
.card-title output { color: var(--muted); font-size: 0.5625rem; }
canvas { display: block; width: 100%; }
.panorama-viewport {
  position: relative;
  border-top: 1px solid var(--line);
  background: var(--theme-panorama-bg);
}
.panorama-viewport canvas {
  background: var(--theme-panorama-bg);
}
#panorama {
  height: 220px;
  cursor: crosshair;
}
.panorama-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 36px;
  padding: 0;
  border: 0;
  font-size: 0;
  color: transparent;
  background: transparent;
  cursor: pointer;
}
.panorama-nav::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  border-style: solid;
  transform: translateY(-50%);
}
.panorama-nav-prev { left: 0; }
.panorama-nav-prev::before {
  left: 10px;
  border-width: 14px 18px 14px 0;
  border-color: transparent #d62828 transparent transparent;
}
.panorama-nav-next { right: 0; }
.panorama-nav-next::before {
  right: 10px;
  border-width: 14px 0 14px 18px;
  border-color: transparent transparent transparent #d62828;
}
.panorama-nav:hover::before {
  filter: brightness(1.08);
}
.panorama-nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.peak-list {
  display: flex;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 9px "DM Mono", monospace;
  white-space: nowrap;
}
.peak-list button { flex: 0 0 auto; padding: 5px 8px; }
.peak-list .link-target-button {
  border-color: #178a5c;
  color: #0f5f41;
}
.link-target-marker { background: transparent; border: 0; }
.link-target-marker-dot {
  display: block;
  width: 10px;
  height: 10px;
  background: #178a5c;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px #0004;
  cursor: pointer;
}
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.map-wrap { position: relative; overflow: hidden; }
#map { width: 100%; height: var(--workspace-map-height); background: var(--map-bg); position: relative; z-index: 2; }
.elevation-overlay { image-rendering: auto; }
.viewshed-overlay { image-rendering: auto; }
.leaflet-control-attribution { font: 8px "DM Mono", monospace; }
.map-tools { display: flex; align-items: center; gap: 5px; }
.map-overlays {
  padding: 10px 14px 0;
  border-top: 1px solid var(--line);
}
.overlay-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin-top: 6px;
}
.overlay-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.625rem;
  color: var(--muted);
}
.overlay-grid input { width: auto; margin: 0; }
.overlay-grid .map-3d-only { display: none; }
.overlay-grid button.map-3d-only {
  justify-self: start;
  width: auto;
  padding: 6px 10px;
  font-size: 0.75rem;
}
.map-wrap.map-3d-mode + .map-overlays .map-3d-only { display: flex; }
.map-wrap.map-3d-mode + .map-overlays button.map-3d-only { display: inline-flex; }
.infra-leaflet-popup .leaflet-popup-content { margin: 10px 12px; }
.infra-popup { font: 11px "IBM Plex Sans", sans-serif; color: var(--ink, #17201d); }
.infra-popup-title {
  margin: 0 0 6px;
  font: 600 12px "IBM Plex Sans", sans-serif;
  line-height: 1.35;
}
.infra-popup-coords {
  margin: 0 0 8px;
  color: var(--muted, #5a645c);
  font: 9px "DM Mono", monospace;
}
.infra-popup-rows {
  margin: 0;
  display: grid;
  gap: 5px;
}
.infra-popup-rows div {
  display: grid;
  grid-template-columns: minmax(72px, 38%) 1fr;
  gap: 6px;
  align-items: start;
}
.infra-popup-rows dt {
  margin: 0;
  color: var(--muted, #5a645c);
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.infra-popup-rows dd { margin: 0; font-size: 0.6875rem; word-break: break-word; }
.infra-popup-empty {
  margin: 0 0 8px;
  color: var(--muted, #5a645c);
  font-size: 0.625rem;
}
.infra-popup-link {
  margin: 8px 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--line, #d8ddd5);
  font: 10px "DM Mono", monospace;
}
.infra-popup-link a { color: #2a7abf; text-decoration: none; }
.infra-popup-link a:hover { text-decoration: underline; }
.map-tools select { width: auto; min-width: 148px; padding: 4px 6px; font-size: 0.625rem; }
.map-tools button { width: 25px; height: 25px; padding: 0; font-size: 0.9375rem; }
.map-tools output { min-width: 152px; margin-left: 5px; text-align: right; }
.map-points-panel {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
}
.map-points-panel .subsection-label {
  margin-top: 0;
}
.map-points-panel .hint {
  margin-top: 8px;
}
.map-points-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  background: var(--surface-2);
  font-family: "DM Mono", monospace;
  font-size: 0.5625rem;
  line-height: 1.45;
}
.map-points-list:empty,
.map-points-list.is-empty {
  color: var(--muted);
  font-style: italic;
}
.map-point-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr auto;
  gap: 4px 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--surface-0);
  cursor: pointer;
}
.map-point-row:hover { border-color: var(--green); }
.map-point-row.is-selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}
.map-point-role {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-weight: 600;
}
.map-point-role i {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
}
.map-point-role .observer { border-radius: 50%; background: var(--accent); }
.map-point-role .target { background: var(--ink); transform: rotate(45deg); }
.map-point-role .profile-sample { border-radius: 50%; background: #2a7abf; }
.map-point-role .visible { background: rgba(215, 42, 36, .75); }
.map-point-role .relay-x { border-radius: 50%; background: #2a7abf; }
.map-point-role .relay-y { border-radius: 50%; background: #178a5c; }
.map-point-role .relay-hop { border-radius: 50%; background: #c4a035; }
.map-point-coords {
  color: var(--green);
  font-size: 0.5625rem;
  word-break: break-all;
}
.map-point-meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.5rem;
}
.map-point-copy {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}
#profile {
  width: 100%;
  height: var(--workspace-map-height);
  cursor: crosshair;
}
.profile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 12px 16px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.profile-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.35;
}
.profile-legend i {
  flex: 0 0 auto;
  display: inline-block;
  width: 12px;
  height: 12px;
}
.profile-legend .fresnel-zone {
  background: rgba(238, 95, 60, .28);
  border: 1px dashed rgba(238, 95, 60, .65);
}
.profile-legend .required-clearance {
  height: 0;
  border-top: 2px solid #c4a035;
  margin-top: 1px;
}
.profile-legend .threshold-violation {
  background: #bb2d26;
  width: 4px;
  border-radius: 1px;
}
.profile-legend .knife-edge {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #8b3fd9;
}
.profile-legend .osm-building {
  background: rgba(106, 100, 92, .9);
  width: 6px;
  border-radius: 1px;
}
.profile-legend .los-line {
  height: 0;
  width: 18px;
  border-top: 2px solid var(--theme-chart-ink);
}
.profile-legend .terrain {
  background: #315e50;
  border-radius: 1px;
}
.profile-legend .profile-point {
  height: 0;
  width: 14px;
  border-top: 2px dashed #2a7abf;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.legend { display: flex; gap: 18px; padding: 10px 14px; font-size: 0.5625rem; border-top: 1px solid var(--line); }
.legend i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }
.legend .observer { border-radius: 50%; background: var(--accent); }
.legend .target { background: var(--ink); transform: rotate(45deg); }
.legend .profile-sample { border-radius: 50%; background: #2a7abf; }
.legend .visible { background: rgba(215, 42, 36, .75); }
.legend .elevation {
  width: 28px;
  height: 8px;
  border-radius: 1px;
  background: linear-gradient(90deg, #2e5242 0%, #5c804a 28%, #a69e5c 55%, #967452 78%, #e8e2d6 100%);
}
.legend .relay-x { border-radius: 50%; background: #2a7abf; }
.legend .relay-y { border-radius: 50%; background: #178a5c; }
.legend .relay-hop { border-radius: 50%; background: #c4a035; }
.legend .building-3d { background: #6a645c; }
#map-3d-view {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: var(--workspace-map-height);
  pointer-events: auto;
}
.map-wrap.map-3d-mode #map {
  background: transparent !important;
  pointer-events: none;
  z-index: 3;
}
.map-wrap.map-3d-mode #map .leaflet-tile-pane,
.map-wrap.map-3d-mode #map .leaflet-shadow-pane,
.map-wrap.map-3d-mode #map .leaflet-overlay-pane {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}
.map-wrap.map-3d-terrain-mode #map .leaflet-overlay-pane {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}
.map-wrap.map-3d-mode #map .leaflet-overlay-pane,
.map-wrap.map-3d-mode #map .leaflet-marker-pane,
.map-wrap.map-3d-mode #map .leaflet-tooltip-pane,
.map-wrap.map-3d-mode #map .leaflet-popup-pane {
  pointer-events: none;
}
.map-wrap.map-3d-mode #map .leaflet-marker-icon,
.map-wrap.map-3d-mode #map .leaflet-interactive {
  pointer-events: none;
}
.map-wrap.map-3d-mode .los-marker-dot {
  opacity: 0;
}
.map-wrap.map-3d-mode .viewshed-overlay {
  mix-blend-mode: multiply;
}
.map-wrap.map-3d-mode #map-3d-view .osmb {
  width: 100%;
  height: 100%;
}
.map-wrap.map-3d-mode #map-3d-view canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.path-card, .relay-card { margin-top: 18px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); border-top: 1px solid var(--line); }
.metric { padding: 12px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; margin-top: 3px; font-size: 0.875rem; }
.metric span { color: var(--muted); font-size: 0.5rem; }
.path-summary { padding: 18px; color: var(--muted); font-family: "DM Mono", monospace; font-size: 0.6875rem; }
#status {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 380px;
  padding: 12px 16px;
  color: #fff;
  background: var(--header-bg);
  box-shadow: 0 8px 25px #0003;
  font: 11px "DM Mono", monospace;
  opacity: 0;
  transform: translateY(8px);
  transition: .2s;
  pointer-events: none;
}
#status.show { opacity: 1; transform: none; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(23, 32, 29, .28);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.loader.visible {
  opacity: 1;
  pointer-events: all;
}
.loader-panel {
  min-width: 280px;
  max-width: min(92vw, 420px);
  padding: 22px 26px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px #0003;
  text-align: center;
}
.loader-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 3px solid var(--theme-chart-grid);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: loader-spin .8s linear infinite;
}
@keyframes loader-spin { to { transform: rotate(360deg); } }
#loader-message {
  margin: 0;
  color: var(--ink);
  font: 11px "DM Mono", monospace;
  line-height: 1.5;
}
body.is-busy { cursor: progress; }

html[data-theme="dark"] {
  color-scheme: dark;
  --header-bg: #101816;
  --ink: #e8ece9;
  --muted: #9fa9a2;
  --line: #2a3531;
  --paper: #1b2622;
  --green: #6ab89a;
  --lime: #b8c94a;
  --body-bg: #121816;
  --surface-0: #1b2622;
  --surface-1: #232e2a;
  --surface-2: #2a3531;
  --surface-3: #232e2a;
  --surface-4: #2a3531;
  --surface-input: #1b2622;
  --text-soft: #9fa9a2;
  --border-muted: #4a5751;
  --border-input: #4a5751;
  --canvas-bg: #2a3531;
  --map-bg: #232e2a;
  --ok: #5dbf9a;
  --fail: #e86a62;
  --ok-bg: #1a2e28;
  --fail-bg: #2e221f;
  --pending-bg: #232e2a;
  --theme-chart-paper: #1b2622;
  --theme-chart-ink: #e8ece9;
  --theme-chart-muted: #9fa9a2;
  --theme-panorama-bg: #2a3531;
  --theme-chart-grid: #3a4541;
  --theme-chart-grid-text: #9fa9a2;
  --theme-profile-terrain: #3d6b5c;
  --theme-profile-terrain-stroke: #5a9d84;
  --theme-profile-los: #e8ece9;
  --theme-marker-outline: #1b2622;
  --theme-tooltip-bg: rgba(27, 38, 34, 0.94);
  --theme-tooltip-border: rgba(74, 87, 81, 0.9);
  --theme-link-peak: #6ab89a;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --header-bg: #101816;
    --ink: #e8ece9;
    --muted: #9fa9a2;
    --line: #2a3531;
    --paper: #1b2622;
    --green: #6ab89a;
    --lime: #b8c94a;
    --body-bg: #121816;
    --surface-0: #1b2622;
    --surface-1: #232e2a;
    --surface-2: #2a3531;
    --surface-3: #232e2a;
    --surface-4: #2a3531;
    --surface-input: #1b2622;
    --text-soft: #9fa9a2;
    --border-muted: #4a5751;
    --border-input: #4a5751;
    --canvas-bg: #2a3531;
    --map-bg: #232e2a;
    --ok: #5dbf9a;
    --fail: #e86a62;
    --ok-bg: #1a2e28;
    --fail-bg: #2e221f;
    --pending-bg: #232e2a;
    --theme-chart-paper: #1b2622;
    --theme-chart-ink: #e8ece9;
    --theme-chart-muted: #9fa9a2;
    --theme-panorama-bg: #2a3531;
    --theme-chart-grid: #3a4541;
    --theme-chart-grid-text: #9fa9a2;
    --theme-profile-terrain: #3d6b5c;
    --theme-profile-terrain-stroke: #5a9d84;
    --theme-profile-los: #e8ece9;
    --theme-marker-outline: #1b2622;
    --theme-tooltip-bg: rgba(27, 38, 34, 0.94);
    --theme-tooltip-border: rgba(74, 87, 81, 0.9);
    --theme-link-peak: #6ab89a;
  }
}

html[data-theme="light"] {
  color-scheme: light;
}

@media (max-width: 1250px) {
  body { min-width: 900px; }
  .controls { flex-basis: 270px; width: 270px; }
  .split { grid-template-columns: 1fr; }
}
