/* CYCREVO r15: Zygote-inspired anatomy layer controls. Scoped to the anatomy viewer. */
.cycrevo-zygotebody-ready .layers-panel > .layer-presets,
.cycrevo-zygotebody-ready .layers-panel > .system-list {
  display: none !important;
}

.cycrevo-zygotebody-ready .layers-panel {
  width: 282px;
  max-height: min(680px, calc(100dvh - 390px));
  padding-right: 12px;
}

.cycrevo-layer-tree {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 10px 0 6px;
  overflow: hidden;
}

.cycrevo-layer-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  flex: 0 0 auto;
  margin: 1px 3px 9px;
  padding: 3px;
  border: 1px solid #18253610;
  border-radius: 9px;
  background: #eef2f1;
}

.cycrevo-layer-presets button {
  min-width: 0;
  height: 31px;
  padding: 0 5px;
  border: 0;
  border-radius: 6px;
  color: #65727b;
  background: transparent;
  font: inherit;
  font-size: 10px;
  line-height: 1.15;
  cursor: pointer;
}

.cycrevo-layer-presets button:hover,
.cycrevo-layer-presets button:focus-visible {
  color: #1f5146;
  background: #ffffffb8;
  outline: none;
}

.cycrevo-layer-presets button.active {
  color: #173f36;
  background: #fff;
  box-shadow: 0 1px 4px #18253613;
}

.cycrevo-layer-groups {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #b9c7c2 transparent;
  padding: 0 4px 8px 2px;
}

.cycrevo-layer-group {
  border-bottom: 1px solid #1825360d;
}

.cycrevo-layer-group > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 30px;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 1px 0 4px;
  color: #33464c;
  cursor: pointer;
  user-select: none;
}

.cycrevo-layer-group > summary::-webkit-details-marker { display: none; }
.cycrevo-layer-group.disabled > summary { color: #8b9799; }

.cycrevo-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .16s ease;
}

.cycrevo-layer-group[open] .cycrevo-caret { transform: rotate(45deg) translate(-1px, -1px); }
.cycrevo-group-name { min-width: 0; font-size: 12px; font-weight: 600; }
.cycrevo-group-count { color: #8a9696; font-variant-numeric: tabular-nums; font-size: 9px; }

.cycrevo-group-eye,
.cycrevo-system-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #638076;
  background: transparent;
  cursor: pointer;
}

.cycrevo-group-eye:hover,
.cycrevo-system-eye:hover,
.cycrevo-group-eye:focus-visible,
.cycrevo-system-eye:focus-visible {
  color: #226a59;
  background: #e7f0ed;
  outline: none;
}

.cycrevo-group-eye svg,
.cycrevo-system-eye svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cycrevo-layer-group.disabled .cycrevo-group-eye,
.cycrevo-system-item.disabled .cycrevo-system-eye { color: #adb7b6; }
.cycrevo-layer-group.partial .cycrevo-group-eye { color: #6c8d82; opacity: .7; }

.cycrevo-group-members {
  padding: 0 0 6px 13px;
}

.cycrevo-system-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 84px;
  align-items: center;
  min-height: 38px;
  border-radius: 8px;
  transition: background .16s ease, opacity .16s ease;
}

.cycrevo-system-item:hover { background: #edf4f1a8; }
.cycrevo-system-item.disabled { opacity: .5; }

.cycrevo-system-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 4px 0 1px;
  border: 0;
  color: #46585d;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.cycrevo-system-item.enabled .cycrevo-system-name { color: #263d3b; }
.cycrevo-system-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cycrevo-layer-color);
  box-shadow: 0 0 0 2px #18253607;
}
.cycrevo-system-name > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cycrevo-system-count { margin-left: auto; color: #95a09f; font-size: 9px; font-variant-numeric: tabular-nums; }

.cycrevo-opacity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 5px;
  padding-right: 4px;
}

.cycrevo-opacity input,
.cycrevo-reveal-slider {
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: #2d7a66;
  cursor: pointer;
}

.cycrevo-opacity input:disabled { cursor: default; opacity: .35; }
.cycrevo-opacity output {
  color: #788887;
  text-align: right;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.cycrevo-zygotebody-ready .explode-control { display: none !important; }

.cycrevo-reveal-control {
  flex: 1 1 430px;
  min-width: 260px;
  max-width: 560px;
  padding: 0 4px;
}

.cycrevo-reveal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.cycrevo-reveal-head > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cycrevo-reveal-head strong {
  color: #314946;
  font-size: 12px;
  font-weight: 600;
}

.cycrevo-reveal-head small {
  overflow: hidden;
  color: #81908e;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.cycrevo-layer-reset {
  flex: 0 0 auto;
  border: 0;
  padding: 2px 4px;
  color: #66837b;
  background: transparent;
  font: inherit;
  font-size: 9px;
  cursor: pointer;
}
.cycrevo-layer-reset:hover,
.cycrevo-layer-reset:focus-visible { color: #216c59; outline: none; }

.cycrevo-reveal-slider { display: block; height: 20px; }
.cycrevo-reveal-scale,
.cycrevo-reveal-stages {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #879390;
  font-size: 8px;
}
.cycrevo-reveal-scale { margin-top: -4px; }
.cycrevo-reveal-stages { margin-top: 1px; }
.cycrevo-reveal-stages span { opacity: .46; transition: opacity .15s ease, color .15s ease; }
.cycrevo-reveal-stages span.active { color: #2b6758; opacity: 1; }

.cycrevo-layer-busy .cycrevo-layer-tree,
.cycrevo-layer-busy .cycrevo-reveal-control { pointer-events: none; }
.cycrevo-layer-busy .cycrevo-layer-tree { opacity: .76; }

@media (width <= 1100px) {
  .cycrevo-zygotebody-ready .layers-panel { width: 248px; }
  .cycrevo-system-item { grid-template-columns: 30px minmax(0, 1fr) 68px; }
  .cycrevo-opacity { grid-template-columns: minmax(0, 1fr) 26px; gap: 3px; }
  .cycrevo-system-count { display: none; }
  .cycrevo-reveal-head small { display: none; }
}

@media (width <= 767px) {
  .cycrevo-zygotebody-ready .layers-panel.mobile-open {
    width: auto;
    max-height: calc(100dvh - 255px);
    padding: 9px 13px 0;
  }
  .cycrevo-layer-tree { padding-top: 7px; }
  .cycrevo-layer-presets { margin-bottom: 5px; }
  .cycrevo-layer-presets button { height: 38px; font-size: 11px; }
  .cycrevo-layer-group > summary { min-height: 43px; }
  .cycrevo-group-name { font-size: 13px; }
  .cycrevo-system-item { grid-template-columns: 34px minmax(0, 1fr) 88px; min-height: 43px; }
  .cycrevo-system-name { height: 40px; font-size: 12px; }
  .cycrevo-group-eye, .cycrevo-system-eye { width: 34px; height: 34px; }
  .cycrevo-reveal-control { min-width: 0; max-width: none; flex-basis: auto; }
  .cycrevo-reveal-head small, .cycrevo-reveal-stages { display: none; }
  .cycrevo-reveal-head strong { font-size: 11px; }
  .cycrevo-layer-reset { font-size: 9px; }
  .cycrevo-reveal-scale { font-size: 8px; }
  .cycrevo-zygotebody-ready .bottom-dock { gap: 10px; }
}

@media (width <= 430px) {
  .cycrevo-system-item { grid-template-columns: 32px minmax(0, 1fr) 72px; }
  .cycrevo-opacity { grid-template-columns: minmax(0, 1fr) 24px; }
  .cycrevo-opacity output { font-size: 8px; }
  .cycrevo-reveal-head { gap: 6px; }
  .cycrevo-layer-reset { max-width: 55px; line-height: 1.1; }
}

@media (height <= 600px) and (orientation: landscape) {
  .cycrevo-zygotebody-ready .layers-panel.mobile-open {
    top: 96px;
    bottom: 108px;
    width: 285px;
    max-height: none;
  }
  .cycrevo-layer-presets button { height: 32px; }
  .cycrevo-layer-group > summary { min-height: 36px; }
  .cycrevo-system-item { min-height: 36px; }
  .cycrevo-system-name { height: 34px; }
  .cycrevo-group-eye, .cycrevo-system-eye { width: 30px; height: 30px; }
  .cycrevo-reveal-control { min-width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .cycrevo-caret,
  .cycrevo-system-item,
  .cycrevo-reveal-stages span { transition: none !important; }
}


/* r15: panel footer contains visible-count only; destructive “Hide all” was removed from the native UI. */
.cycrevo-zygotebody-ready .layers-panel > .panel-foot { justify-content: flex-start; }

/* CYCREVO r16: align search results to the combobox anchor and compact detail actions. */
.anatomy-search-results {
  width: var(--anchor-width) !important;
  min-width: var(--anchor-width) !important;
  max-width: min(var(--anchor-width), var(--available-width)) !important;
  box-sizing: border-box;
}

.detail-actions {
  flex-direction: row !important;
  align-items: stretch;
  gap: 8px !important;
}

.detail-actions .primary-action {
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-start;
}

.detail-actions .secondary-action {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 12px !important;
  border: 1px solid #18253618;
  border-radius: 8px;
  white-space: nowrap;
}

@media (width <= 767px) {
  .detail-actions {
    gap: 7px !important;
  }

  .detail-actions .primary-action,
  .detail-actions .secondary-action {
    min-height: 44px;
  }

  .detail-actions .primary-action {
    padding: 10px 12px;
  }

  .detail-actions .secondary-action {
    padding-inline: 13px !important;
  }
}

@media (width <= 350px) {
  .detail-actions {
    gap: 5px !important;
  }

  .detail-actions .primary-action {
    gap: 6px;
    padding-inline: 9px;
    font-size: 12px;
  }

  .detail-actions .secondary-action {
    padding-inline: 10px !important;
    font-size: 11px;
  }
}
