/* EvoLaps Window Manager 0.13 — shared window styles; legacy auxiliary windows are separate. */
.el-window {
  position: fixed;
  box-sizing: border-box;
  flex-direction: column;
  max-width: 95vw;
  max-height: 90vh;
  resize: none;
  overflow: hidden;
  background: var(--el-window-bg, #fff);
  border: 1px solid #999;
  border-radius: 5px;
}
.el-window-title {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  cursor: move;
  touch-action: none;
  user-select: none;
  background: #eee;
  color: #444;
  font-size: 10px;
}
.el-window-resize { position: absolute; z-index: 20; touch-action: none; user-select: none; }
.el-window-resize[data-edge="n"] { top: 0; left: 9px; right: 9px; height: 5px; cursor: n-resize; }
.el-window-resize[data-edge="s"] { bottom: 0; left: 9px; right: 9px; height: 5px; cursor: s-resize; }
.el-window-resize[data-edge="w"] { left: 0; top: 9px; bottom: 9px; width: 5px; cursor: w-resize; }
.el-window-resize[data-edge="e"] { right: 0; top: 9px; bottom: 9px; width: 5px; cursor: e-resize; }
.el-window-resize[data-edge="nw"] { left: 0; top: 0; width: 9px; height: 9px; cursor: nw-resize; }
.el-window-resize[data-edge="ne"] { right: 0; top: 0; width: 9px; height: 9px; cursor: ne-resize; }
.el-window-resize[data-edge="sw"] { left: 0; bottom: 0; width: 9px; height: 9px; cursor: sw-resize; }
.el-window-resize[data-edge="se"] { right: 0; bottom: 0; width: 9px; height: 9px; cursor: se-resize; }

/* Map-local layer: no interception of map interaction outside windows. */
.el-window-map-host { position: relative; }
.el-window-map-layer { position: absolute; inset: 0; z-index: 1000; pointer-events: none; overflow: hidden; }
.el-window.el-window-embedded {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  border: none;
  border-radius: 0;
  pointer-events: auto;
}
.el-window-embedded > .el-window-title { display: none; }
.el-window-map-move { display: none; }
.el-window-embedded > .el-window-map-move {
  display: block;
  position: absolute;
  top: 5px;
  left: 9px;
  right: 9px;
  height: 12px;
  cursor: move;
  z-index: 19;
  touch-action: none;
  user-select: none;
}

/* Common shell for the original managed graph hosts. */
#makeitmove1.el-window, #makeitmove2.el-window, #makeitmove3.el-window, #makeitmove6.el-window, #makeitmove7.el-window, #makeitmove10.el-window { text-align: center; }
#handle1.el-window-title, #handle2.el-window-title, #handle3.el-window-title, #handle6.el-window-title, #handle7.el-window-title, #handle10.el-window-title { position: relative; top: auto; left: auto; width: auto; height: auto; z-index: auto; opacity: 1; text-align: left; }
#makeitmove1.el-window-dark, #makeitmove2.el-window-dark, #makeitmove3.el-window-dark, #makeitmove6.el-window-dark, #makeitmove7.el-window-dark, #makeitmove10.el-window-dark { border-color: #666; }
#makeitmove2.el-window-embedded, #makeitmove3.el-window-embedded, #makeitmove6.el-window-embedded, #makeitmove7.el-window-embedded, #makeitmove10.el-window-embedded { border: none; }
/* Map-local tree is transparent until a custom background is set. */
#makeitmove2.el-window-embedded { background: var(--el-window-bg, transparent); }

/* Phylogenetic tree content. */
#makeitmove2 > #treedisplay { flex: 1; min-height: 0; min-width: 0; height: auto; width: 100%; }

/* Background alpha applies to the window surface only, not the graphics. */
.el-window { --el-window-fg: #333; --el-window-muted: #666; --el-window-axis: #666; --el-window-track: #ddd; --el-window-note: #a33; color-scheme: normal; color: var(--el-window-fg); }
.el-window-dark { --el-window-fg: #eee; --el-window-muted: #bbb; --el-window-axis: #aaa; --el-window-track: #3b4149; --el-window-note: #ffae99; color-scheme: dark; }
.el-window-dark > .el-window-title { background: #373c43; color: #eee; }
.el-window-dark > .el-window-title button { color: #eee; background: #454b53; }
#makeitmove2 > #treedisplay { background: transparent; }
/* Display contrast for the default black tree strokes/labels, without changing node data. */
#makeitmove2.el-window-dark .treepath:is([stroke="#000000" i],[stroke="#000000ff" i],[stroke="black" i]) { stroke: var(--el-window-fg); }
#makeitmove2.el-window-dark text[label]:is([fill="#000000" i],[fill="#000000ff" i],[fill="black" i]):not([style*="fill:"]),
#makeitmove2.el-window-dark text[label]:is([style*="fill: rgb(0, 0, 0)"],[style*="fill: black"]) { fill: var(--el-window-fg) !important; }
#makeitmove2.el-window-dark .scaletree:is([style*="color: rgb(0, 0, 0)"],[style*="color: black"]) { color: var(--el-window-fg) !important; }
#makeitmove2.el-window-dark .scaletree text:is([style*="fill: rgb(0, 0, 0)"],[style*="fill: black"]) { fill: var(--el-window-fg) !important; }

/* Scatterplot matrix: keep its original host ID, but use the common window shell. */
#makeitmove10 > #statistics { flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; overflow: hidden; background: transparent; }
/* Only default axis/label colors adapt to dark backgrounds; keep custom colors and data marks. */
#makeitmove10.el-window-dark .mv-axis-label[fill="#444444" i] { fill: var(--el-window-fg); }
#makeitmove10.el-window-dark .mv-plane g[color="#666666" i] { color: var(--el-window-axis); }
#makeitmove10.el-window-dark .mv-plane g[color="#666666" i] text[fill="#666666" i] { fill: var(--el-window-axis); }

/* Cluster / Teddy transition graphs: retain the original graph host. */
#makeitmove6 > #transition { flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; height: auto; overflow: hidden; background: transparent; }
/* Adapt only default foreground colors. Labels on colored clusters (including R0) retain their own styling. */
#makeitmove6.el-window-dark :is(.ec-tree-label,.teddy-transition-tree-label,.teddy-transition-force-label)[fill="#263746ff" i],
#makeitmove6.el-window-dark .occurrence-label[fill="#26445eff" i] { fill: var(--el-window-fg); }
#makeitmove6.el-window-dark :is(.transition-tree-link,.occurrence-link,.teddy-transition-tree-link,.teddy-transition-force-link)[stroke="#000000ff" i] { stroke: var(--el-window-fg); }
#makeitmove6.el-window-dark :is(.ec-force-arrow,marker path)[fill="#000000ff" i] { fill: var(--el-window-fg); }

#makeitmove3 > #migration { flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; height: auto; overflow: hidden; background: transparent; }

#makeitmove7 > #aatransition { flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; height: auto; overflow: hidden; background: transparent; }

/* Migration distance curves: keep custom scientific strokes, adapt standard black. */
#makeitmove3.el-window-dark .cur:is([stroke="#000000ff" i],[stroke="#000000" i],[stroke="black" i]):not([style*="stroke:"]),
#makeitmove3.el-window-dark .cur:is([style*="stroke: rgb(0, 0, 0)"],[style*="stroke: black"]) { stroke: var(--el-window-fg) !important; }
#makeitmove3.el-window-dark .scalecurve { color: var(--el-window-axis); }
#makeitmove3.el-window-dark .el-migration-title { fill: var(--el-window-fg); }
/* Ancestral transitions: leave state symbols and matrix cell labels unchanged. */
#makeitmove7.el-window-dark :is(.aa-tree-label,.aa-force-label,.aa-compressed-tree-node > text,.aa-compressed-force-label):is([fill="#222" i],[fill="#222222" i]) { fill: var(--el-window-fg); }
#makeitmove7.el-window-dark :is(.aa-tree-link,.aa-force-link,.aa-compressed-tree-links path,.aa-compressed-force-links path,.aa-compressed-force-links line):is([stroke="#000" i],[stroke="#000000" i]) { stroke: var(--el-window-fg); }
#makeitmove7.el-window-dark marker path[fill="#000000" i] { fill: var(--el-window-fg); }

/* Minimized windows retain their layout, but cannot intercept mouse or keyboard. */
.el-window.el-window-minimized { visibility: hidden !important; opacity: 0 !important; pointer-events: none !important; }
.el-window.el-window-maximized { max-width: none; max-height: none; }
.el-window.el-window-maximized > .el-window-resize,
.el-window.el-window-maximized > .el-window-map-move { display: none; }
.el-window.el-window-maximized > .el-window-title { cursor: default; }
.el-window-title-actions { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; flex: none; }
.el-window-action { min-width: 16px; }

/* Geographic map is an external window and remains the host of embedded windows. */
#makeitmove1 > #geographicmap { position: relative; isolation: isolate; flex: 1 1 0; min-height: 0; min-width: 0; width: 100%; height: auto; background: transparent; }

/* Layout feedback within the existing Windows details. */
#elWindowLayoutStatus { grid-column: 1 / -1; font-size: 9px; text-align: left; }
#elWindowLayoutStatus:empty { display: none; }

/* Compact Windows controls: keep the common detailsC0-L1 shell and summary. */
.el-windows-details { font: 10px/1.2 evolapsfont, sans-serif; }
.el-windows-details > summary { margin-bottom: 2px; }
.el-windows-details .el-window-global-controls,
.el-windows-details .el-window-background-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
.el-windows-details .el-window-global-controls { margin: 1px 0 2px; }
.el-windows-details .el-control-panel-color { margin: 1px 0; }
.el-windows-details .el-control-panel-color > label { min-width: 16px; }
/* Compact control rows, independent of the standard details styling. */
.el-windows-details .el-window-panel-colors {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.el-windows-details .el-window-panel-colors .el-control-panel-color {
  flex-wrap: nowrap;
}
.el-windows-details .el-window-control-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 2px 3px;
  font: 10px/1.2 evolapsfont, sans-serif;
}
.el-windows-details .el-window-control-grid > .el-window-global-controls {
  margin: 0;
  min-width: 0;
}
.el-windows-details .el-window-control-grid .el-window-background-controls {
  flex-wrap: nowrap;
}

.el-windows-details .ctrlh {
  box-sizing: border-box;
  height: 16px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 14px;
  white-space: nowrap;
}
.el-windows-details .ctrl1 {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  padding: 0;
  scale: none;
  font-size: 12px;
  line-height: 16px;
}
.el-windows-details input[type="color"].ctrlcolorselect {
  width: 16px;
  height: 16px;
  scale: none;
  flex: none;
}
.el-windows-details input[type="range"] {
  --evo-range-width: 40px;
  margin: 0;
  flex: none;
}
.el-windows-details .el-window-background-controls output {
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 10px;
}
/* One compact row per managed window. */
.el-windows-details .el-window-background-table {
  width: 100%;
  table-layout: fixed;
  font: inherit;
  text-align: left;
  margin-top: 3px;
  padding: 0;
}
.el-windows-details .el-window-appearance-col { width: 82px; }
.el-windows-details .el-window-actions-col { width: 72px; }
.el-windows-details .el-window-background-table td {
  vertical-align: middle;
  padding: 1px 1px;
  font: inherit;
  border-bottom: 1px solid rgba(128, 128, 128, .18);
}
.el-windows-details .el-window-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.el-windows-details .el-window-background-table .el-window-background-controls {
  flex-wrap: nowrap;
  gap: 2px;
}
.el-windows-details .el-window-background-table input[type="range"] {
  --evo-range-width: 34px;
}
.el-windows-details .el-window-background-table .el-window-background-controls output {
  min-width: 0;
  width: 24px;
  flex: none;
}
.el-windows-details .el-window-state-controls {
  display: grid;
  grid-template-columns: repeat(4, 16px);
  gap: 2px;
  align-items: center;
  justify-content: end;
}
.el-windows-details .el-window-state-controls .ctrl1 { margin: 0; }
.el-windows-details #elWindowMinimizedList {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  max-width: 100%;
}

/* Compact window actions: the symbol describes the next available action. */
.el-windows-details .icon-btn.icon-svg {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 0;
  padding: 0;
  margin: 0;
  scale: none;
  vertical-align: middle;
  color: var(--cCtrlF, currentColor);
  flex: none;
}
.el-windows-details .icon-btn.icon-svg::before { width: 16px; height: 16px; }
.el-windows-details .icon-btn.icon-svg:enabled:hover,
.el-windows-details .icon-btn.icon-svg:enabled:focus-visible { color: var(--cCtrlBhi, currentColor); }
.el-windows-details .icon-btn.icon-svg:disabled { opacity: .4; cursor: default; }
.icon-extract::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M17 7 H5 V27 H25 V15 M13 19 L27 5 M19 5 H27 V13%22/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M17 7 H5 V27 H25 V15 M13 19 L27 5 M19 5 H27 V13%22/%3E%3C/svg%3E");
}
.icon-insert::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M17 7 H5 V27 H25 V15 M27 5 L13 19 M13 11 V19 H21%22/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M17 7 H5 V27 H25 V15 M27 5 L13 19 M13 11 V19 H21%22/%3E%3C/svg%3E");
}
.icon-show::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 16 S8 7 16 7 S29 16 29 16 S24 25 16 25 S3 16 3 16 Z%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%224%22/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M3 16 S8 7 16 7 S29 16 29 16 S24 25 16 25 S3 16 3 16 Z%22/%3E%3Ccircle cx=%2216%22 cy=%2216%22 r=%224%22/%3E%3C/svg%3E");
}
.icon-hide::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M7 10 Q4 13 3 16 Q8 25 16 25 Q20 25 23 23 M12 7.5 Q14 7 16 7 Q24 7 29 16 Q27 19 25 21 M13 13 Q11 17 15 20 M5 5 L27 27%22/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 32 32%22 fill=%22none%22 stroke=%22black%22 stroke-width=%222.4%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M7 10 Q4 13 3 16 Q8 25 16 25 Q20 25 23 23 M12 7.5 Q14 7 16 7 Q24 7 29 16 Q27 19 25 21 M13 13 Q11 17 15 20 M5 5 L27 27%22/%3E%3C/svg%3E");
}
