/* Ordered branch lanes keep the search visible while candidate geometry evolves. */
.branching-workflow .search-map { display: block; width: 100%; max-width: 1200px; height: auto; margin: 22px auto 15px; overflow: visible; }
.generation-controls { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 25px auto 0; }
.generation-caption { margin-right: 9px; color: #9eb8cf; font-size: 12px; }
.generation-choice, .generation-next { border: 1px solid #5986ad50; border-radius: 5px; background: #081a29; color: #9cb6ce; font: 12px var(--body); cursor: pointer; transition: color .2s, background .2s, border-color .2s; }
.generation-choice { width: 35px; height: 33px; padding: 0; }
.generation-choice:hover, .generation-next:hover { color: #edfaff; border-color: #91caff; }
.generation-choice.is-active { color: #f4fbff; border-color: #9bd8ff; background: #173d59; box-shadow: 0 0 15px #3899d918; }
.generation-next { height: 33px; margin-left: 7px; padding: 0 12px; color: #d4eafa; }
.generation-choice:focus-visible, .generation-next:focus-visible { outline: 2px solid #b3e5ff; outline-offset: 3px; }
.search-title { font: 500 19px var(--display); letter-spacing: -.035em; fill: #d9ecfc; }
.search-hint { font: 12px var(--body); fill: #a0bcd3; }
.search-source-label { font: 10px var(--body); fill: #99c9e8; }
.search-source-dot { fill: #c6f1ff; filter: drop-shadow(0 0 5px #41c0ff); }
.search-route-glow { fill: none; stroke: #2899e8; stroke-width: 6; opacity: .1; filter: blur(3px); }
.search-route-line { fill: none; stroke: #549ace; stroke-width: 1.15; opacity: .52; transition: opacity .25s, stroke .25s; }
.search-route-pulse { fill: none; stroke: #d4f4ff; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 9 66; opacity: .8; animation: search-flow 2.6s linear infinite; }
.search-route[data-route='1'] .search-route-pulse { animation-delay: -.5s; }
.search-route[data-route='2'] .search-route-pulse { animation-delay: -1s; }
.search-route[data-route='3'] .search-route-pulse { animation-delay: -1.5s; }
.search-route[data-route='4'] .search-route-pulse { animation-delay: -2s; }
.search-route.is-active .search-route-line { stroke: #a2defb; opacity: 1; stroke-width: 1.7; }
.search-route.is-active .search-route-glow { opacity: .24; }
.search-route.is-active .search-route-pulse { stroke: #fff; stroke-width: 2.3; opacity: 1; }
.search-site { cursor: pointer; }
.search-site-halo { fill: url(#search-site-halo); opacity: .6; }
.search-site-ring { fill: #0c30457d; stroke: #8bd5f7; stroke-width: 1.3; }
.search-site-core { fill: #e0faff; }
.search-site.is-selected .search-site-ring, .search-site:hover .search-site-ring { stroke: #f0fcff; stroke-width: 2.2; }
.search-site.is-selected .search-site-halo { opacity: 1; }
.search-inspect, .search-select, .search-inspection-choice { cursor: pointer; }
.search-candidate-box { fill: #0a1b2b; stroke: #4279a266; stroke-width: 1; transition: fill .3s, stroke .3s; }
.search-candidate:hover .search-candidate-box, .search-candidate.is-inspected .search-candidate-box { fill: #103249; stroke: #abdffa; }
.search-candidate-label { font: 11px var(--body); fill: #c3dbed; }
.search-binder-contour { fill: url(#search-binder-surface); fill-opacity: .63; stroke: #7ac5ed; stroke-width: .85; stroke-linejoin: round; }
.search-backbone { fill: none; stroke: #8bd2f8; stroke-width: 1.3; opacity: .73; }
.search-feature-glow { opacity: .17; }
.search-feature { stroke: #b1e1fc22; stroke-width: .5; }
.search-select circle { fill: #091c2b; stroke: #5d8dab; stroke-width: 1; }
.search-select .search-check { fill: none; stroke: #c7efff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.search-select[aria-checked='true'] circle { fill: #1f536e; stroke: #b4e6ff; }
.search-select[aria-checked='true'] .search-check { opacity: 1; }
.search-site:focus-visible, .search-inspect:focus-visible, .search-select:focus-visible, .search-inspection-choice:focus-visible { outline: none; }
.search-site:focus-visible .search-site-ring { stroke: #fff; stroke-width: 3; }
.search-inspect:focus-visible .search-candidate-box { stroke: #fff; stroke-width: 2; }
.search-select:focus-visible circle, .search-inspection-choice:focus-visible circle { stroke: #fff; stroke-width: 2.5; }
.search-preview-frame { fill: #091b2b8c; stroke: #5b8fb34f; stroke-width: 1; }
.search-pocket-surface { fill: url(#search-pocket-surface); stroke: #5684a750; stroke-width: .7; }
.search-pocket-edge { fill: none; stroke: #88b5ce; stroke-width: 1.2; stroke-dasharray: 2 2; opacity: .9; }
.search-pocket-contact { stroke: #d6edff77; stroke-width: .6; }
.search-preview-caption { font: 11px var(--body); fill: #b5cddd; }
.search-inspection-choice circle { fill: #0a2335; stroke: #517e9c; stroke-width: 1; }
.search-inspection-choice.is-active circle { fill: #1a4c69; stroke: #c7edff; }
.search-shortlist-title { font-size: 15px; }
.search-selection-box { fill: #103049; stroke: #78b4d590; stroke-width: 1; }
.search-selection .search-candidate-label { font-size: 10.5px; }
.search-selection.is-empty .search-selection-box { fill: #061420; stroke: #6b8ba454; stroke-dasharray: 4 5; }
.search-selection.is-empty .search-candidate-label { fill: #7894a9; }
.search-shortlist-hint { font-size: 11px; }
.branching-workflow #candidate-detail { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.branching-workflow .panel-bottom { position: relative; }
.branching-workflow[data-layout='single-stage'] .search-map { max-width: 400px; margin-top: 20px; }
@keyframes search-flow { to { stroke-dashoffset: -150; } }
@media (max-width: 600px) {
  .generation-controls { gap: 6px; }
  .generation-caption { display: none; }
  .generation-choice { width: 31px; height: 32px; font-size: 11px; }
  .generation-next { height: 32px; margin-left: 3px; padding: 0 9px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { .search-route-pulse { animation: none; } }

/* Each step owns its light and movement; the rest remains quiet context. */
.search-stage { opacity: .28; transition: opacity 950ms ease; }
.search-stage.is-context { opacity: .68; }
.search-stage.is-current, .search-stage:focus-within { opacity: 1; }
.search-stage.is-current > .search-title { fill: #edfbff; }
.search-candidate { transition: opacity 800ms ease; }
.search-candidate.is-context-dimmed { opacity: .3; }
.search-candidate:focus-within { opacity: 1; }
.search-route { opacity: .2; transition: opacity 900ms ease; }
.search-route.is-flowing { opacity: 1; }
.search-route .search-route-pulse { animation-duration: 4.8s; }
.search-route:not(.is-flowing) .search-route-pulse { opacity: 0; animation-play-state: paused; }
.search-route.is-flowing .search-route-glow { opacity: .22; stroke-width: 8; }
.search-route.is-flowing .search-route-line { opacity: .78; stroke: #73b9e9; }
.search-route-trace { fill: none; stroke: #d9f7ff; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; filter: drop-shadow(0 0 5px #63baff); }
.is-phase-playing .search-route.is-flowing .search-route-trace { animation: illuminate-path 3.8s cubic-bezier(.3,0,.2,1) var(--flow-delay,0ms) both; }
.is-phase-playing [data-stage='0'].is-current .search-site.is-selected .search-site-ring { animation: site-breathe 3.8s ease-in-out infinite; }
.is-phase-playing [data-stage='1'].is-current .search-candidate-box,
.is-phase-playing [data-stage='3'].is-current .search-selection-box { animation: candidate-arrival 3.2s ease var(--arrival-delay,0ms) both; }
.is-phase-playing [data-stage='2'].is-current .search-preview-frame { animation: pocket-arrival 3.8s ease both; }
.is-phase-playing [data-stage='2'].is-current .search-pocket-contact { animation: contact-breathe 3.8s ease-in-out infinite; }
.search-binder-contour { fill-opacity: .96; stroke: #549cd4; stroke-width: .75; }
.search-ribbon-light { fill: none; stroke: #c6edff; stroke-width: 1.15; opacity: .76; stroke-linecap: round; }
.search-backbone { stroke: #1e4c79; stroke-width: 1; opacity: .62; }
.search-chemical-group { fill: #051726; fill-opacity: .62; stroke-width: 1.45; stroke-linejoin: round; stroke-linecap: round; }
.search-chemical-group[data-feature='mint'] { fill: none; }
.search-feature-glow { opacity: .24; }
.search-contact-guide { fill: none; stroke-width: 1.1; stroke-dasharray: 2 3; opacity: .32; }
.search-contact-guide[data-match='true'] { opacity: .8; }
.is-phase-playing [data-stage='2'].is-current .search-contact-guide { animation: contact-flow 3.8s linear infinite; }
.evolution-step.is-active .step-number { text-shadow: 0 0 15px #50a8fb66; }
.evolution-step.is-active::after { height: 2px; box-shadow: 0 0 12px #529ddb55; }
@keyframes illuminate-path {
  0% { stroke-dashoffset: 1; opacity: 0; }
  12% { opacity: 1; }
  76% { stroke-dashoffset: 0; opacity: .95; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes candidate-arrival {
  0% { fill: #081827; stroke: #4279a266; }
  44% { fill: #163d59; stroke: #b5eaff; }
  100% { fill: #0d263b; stroke: #6bafd4; }
}
@keyframes pocket-arrival {
  0% { stroke: #5b8fb34f; }
  45% { stroke: #b5eaff; fill: #102b3e; }
  100% { stroke: #72b6df; fill: #091b2b; }
}
@keyframes site-breathe { 0%,100% { stroke-width: 1.5; filter: drop-shadow(0 0 2px #76cfff); } 50% { stroke-width: 2.7; filter: drop-shadow(0 0 8px #b1e9ff); } }
@keyframes contact-breathe { 0%,100% { filter: drop-shadow(0 0 1px #98caff33); } 50% { filter: drop-shadow(0 0 5px #b9e8ff88); } }
@keyframes contact-flow { to { stroke-dashoffset: -30; } }
@media (prefers-reduced-motion: reduce) {
  .search-stage, .search-candidate, .search-route { transition: none; }
  .is-phase-playing .search-route-trace, .is-phase-playing .search-candidate-box,
  .is-phase-playing .search-selection-box, .is-phase-playing .search-preview-frame,
  .is-phase-playing .search-site-ring, .is-phase-playing .search-pocket-contact,
  .is-phase-playing .search-contact-guide { animation: none !important; }
}

/* Keep the original full width flow, with space around it on shorter screens. */
@media (min-width: 901px) {
  .evolution-workspace { scroll-margin-top: 0; }
  .branching-workflow .search-map { height: min(590px, calc(var(--viewport-height, 100svh) - 350px)); min-height: 230px; max-width: 1200px; }
}
@media (min-width: 901px) and (max-height: 740px) {
  .branching-workflow .panel-heading { padding-top: 22px; }
  .branching-workflow .panel-heading p { min-height: 2.8em; font-size: 15px; line-height: 1.5; }
  .branching-workflow .generation-controls { margin-top: 15px; }
  .branching-workflow .search-map { margin-top: 12px; margin-bottom: 12px; }
  .branching-workflow .search-title { font-size: max(19px, calc(13px / var(--map-scale, 1))); }
  .branching-workflow .search-candidate-label { font-size: max(11px, calc(10px / var(--map-scale, 1))); }
  .branching-workflow .search-shortlist-title { font-size: max(15px, calc(12px / var(--map-scale, 1))); }
  .branching-workflow .search-preview-caption { font-size: max(11px, calc(10px / var(--map-scale, 1))); }
  .branching-workflow .search-hint { display: none; }
  .branching-workflow .panel-bottom { padding-bottom: 20px; }
}
@media (max-width: 900px) {
  .branching-workflow { overflow: visible; }
  .branching-workflow .panel-heading p { min-height: 0; }
}
