/* Original CSS motion inspired by these 21st.dev patterns; no React dependencies:
 * https://21st.dev/@dillionverma/components/animated-beam
 * https://21st.dev/@pulkitxm/components/stagger-reveal-grid
 */
#cs-shell {
  --cs-ink: #13243c;
  --cs-blue: #465fff;
  --cs-mint: #b5f4da;
  --cs-ease: cubic-bezier(.22, 1, .36, 1);
}

#cs-shell .cs-masthead { padding-bottom: 2px; }
#cs-shell .cs-logo {
  background: #152844;
  box-shadow: 0 3px 8px #13243c18, inset 0 1px 0 #ffffff30;
}
#cs-shell .cs-masthead-note { color: #7a8799; }
#cs-shell .cs-data-badges span { border-color: #dfe5ed; background: #ffffffb3; }
#cs-shell .cs-hero { margin-top: 1px; }
#cs-shell .cs-hero h1 { color: var(--cs-ink); letter-spacing: -1.6px; }
#cs-shell .cs-hero p { max-width: 740px; }

/* The input stays a native Gradio control, with a small, tactile action. */
#cs-shell #cs-query {
  border-color: #dce3ec;
  box-shadow: 0 5px 18px #1b305905, 0 1px 3px #1b305906;
  transition: border-color .2s, box-shadow .2s;
}
#cs-shell #cs-query:focus-within {
  border-color: #b7c4ff;
  box-shadow: 0 0 0 3px #465fff07, 0 7px 22px #1b305908;
}
#cs-shell #cs-go {
  display: flex;
  flex-direction: row !important;
  white-space: nowrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(115deg, #526cff, #3c50ee) !important;
  border: 1px solid #4055ed !important;
  box-shadow: 0 4px 10px #465fff20, inset 0 1px 0 #ffffff25 !important;
  transition: transform .2s var(--cs-ease), box-shadow .2s !important;
}
#cs-shell #cs-go::after {
  content: none;
  font-size: 19px;
  line-height: 1;
  transition: transform .2s var(--cs-ease);
}
#cs-shell #cs-go:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 15px #465fff30, inset 0 1px 0 #ffffff25 !important;
}
#cs-shell #cs-go:hover::after { transform: translate(2px, -2px); }
#cs-shell #cs-go:active { transform: translateY(0); }
#cs-shell #cs-go:disabled { transform: none; opacity: .65; cursor: progress; }
#cs-shell #cs-examples .gallery-item {
  transition: transform .2s var(--cs-ease), background .2s, border-color .2s !important;
}
#cs-shell #cs-examples .gallery-item:hover { transform: translateY(-2px); }

/* A real-footage contact sheet gives the empty state a useful visual anchor. */
#cs-shell .cs-scene {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 34px;
  min-width: 0;
  padding: 23px 26px 0;
  border: 1px solid #e0e6ef;
  border-radius: 19px;
  background: radial-gradient(ellipse at 8% 0%, #eef3ff 0%, transparent 55%), #fff;
  overflow: hidden;
}
#cs-shell .cs-scene-copy { min-width: 0; padding: 9px 0 15px; }
#cs-shell .cs-scene-copy > * {
  animation: cs-rise-in .7s var(--cs-ease) both;
}
#cs-shell .cs-scene-copy > :nth-child(2) { animation-delay: .08s; }
#cs-shell .cs-scene-copy > :nth-child(3) { animation-delay: .15s; }
#cs-shell .cs-scene-copy > :nth-child(4) { animation-delay: .23s; }
#cs-shell .cs-scene-copy .cs-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #465fff;
  font-size: 10px;
  letter-spacing: 1.2px;
  margin-bottom: 12px;
}
#cs-shell .cs-scene-copy .cs-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #465fff;
  box-shadow: 0 0 0 4px #465fff0d;
}
#cs-shell .cs-scene-copy h2 {
  max-width: 410px;
  font-size: clamp(29px, 3vw, 39px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -1.8px;
  color: var(--cs-ink);
  text-wrap: balance;
}
#cs-shell .cs-scene-copy h2 em { color: #465fff; font-style: normal; }
#cs-shell .cs-scene-copy > p {
  max-width: 370px;
  margin-top: 15px;
  color: #66758a;
  font-size: 13px;
  line-height: 1.75;
}
#cs-shell .cs-scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 17px;
}
#cs-shell .cs-scene-tags span {
  border: 1px solid #dce3ee;
  border-radius: 6px;
  padding: 4px 7px;
  background: #ffffffb3;
  color: #5c6a80;
  font-size: 10px;
}
#cs-shell .cs-camera-stage {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 291px;
  padding: 16px 18px 13px;
  border-radius: 14px;
  border: 1px solid #263b55;
  color: #d8e5f5;
  background: radial-gradient(ellipse at 60% 40%, #29465f 0%, #12233a 58%, #0d1b2e 100%);
  box-shadow: 0 14px 35px #142a4524, inset 0 1px 0 #ffffff0f;
  animation: cs-rise-in .85s .12s var(--cs-ease) both;
}
#cs-shell .cs-camera-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  opacity: .12;
  background-image: linear-gradient(#93bad326 1px, transparent 1px), linear-gradient(90deg, #93bad326 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent);
}
#cs-shell .cs-stage-header,
#cs-shell .cs-stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  position: relative;
  z-index: 1;
  font-size: 9px;
  letter-spacing: .3px;
  color: #a0b1c7;
}
#cs-shell .cs-stage-header { text-transform: uppercase; letter-spacing: 1.1px; }
#cs-shell .cs-stage-header > :first-child { color: #d3e0ef; }
#cs-shell .cs-stage-header > :last-child { color: var(--cs-mint); }
#cs-shell .cs-stage-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 12px 15px;
  transform: perspective(800px) rotateX(8deg) rotateY(-8deg) rotateZ(-2deg);
  transform-style: preserve-3d;
}
#cs-shell .cs-camera-card {
  grid-column: span 2;
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid #69809680;
  border-radius: 7px;
  background: #172b42;
  box-shadow: 0 5px 13px #00000038;
  transform: translateZ(calc(var(--camera-index, 0) * 2px));
  animation: cs-camera-float 6s ease-in-out infinite;
  animation-delay: calc(var(--camera-index, 0) * -.85s);
  transition: border-color .2s, box-shadow .2s;
}
#cs-shell .cs-camera-card:nth-child(4) { grid-column: 2 / span 2; }
#cs-shell .cs-camera-card:nth-child(5) { grid-column: 4 / span 2; }
#cs-shell .cs-camera-card:hover {
  border-color: #b5f4da;
  box-shadow: 0 7px 20px #00000050, 0 0 0 1px #b5f4da25;
}
#cs-shell .cs-camera-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  opacity: .92;
}
#cs-shell .cs-camera-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background: linear-gradient(140deg, #28465e, #1b3048);
  color: #8daabd;
  font-size: 25px;
}
#cs-shell .cs-camera-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 5px 6px;
  font-size: 8px;
  line-height: 1.3;
  white-space: nowrap;
  color: #c7d7e8;
}
#cs-shell .cs-camera-label b { font-size: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
#cs-shell .cs-camera-label span { color: #8fa6bf; font-size: 7px; }
#cs-shell .cs-stage-footer { border-top: 1px solid #98b5cd22; padding-top: 10px; }
#cs-shell .cs-scene > .cs-steps {
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -14px -26px 0;
  padding: 15px 26px;
  border-top: 1px solid #e6eaf1;
  background: #ffffffb3;
}
#cs-shell .cs-steps b {
  color: #536585;
  background: #edf1f8;
  border: 1px solid #e3e8f1;
}

/* Beams travel only while the application is actually running a search. */
#cs-shell .cs-scan-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 283px;
  padding: 22px;
  border: 1px solid #dfe6ef;
  border-radius: 16px;
  background: radial-gradient(ellipse at 50% 20%, #edf2ff, transparent 70%), #fff;
  animation: cs-rise-in .4s var(--cs-ease) both;
}
#cs-shell .cs-scan-orbit {
  position: relative;
  width: min(600px, 100%);
  height: 160px;
  margin-bottom: 8px;
}
#cs-shell .cs-beam-lines {
  position: absolute;
  inset: 0;
  overflow: visible;
  width: 100%;
  height: 100%;
  fill: none;
}
#cs-shell .cs-beam-path {
  stroke: #5973fc;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 12 18;
  opacity: .5;
  animation: cs-beam-flow 1.6s linear infinite;
  animation-delay: calc(var(--order, 0) * -.24s);
}
#cs-shell .cs-scan-node,
#cs-shell .cs-scan-core {
  display: grid;
  place-items: center;
  position: absolute;
  z-index: 1;
  border: 1px solid #d6dff4;
  box-shadow: 0 3px 8px #263e6a0b;
}
#cs-shell .cs-scan-node {
  top: 0;
  left: calc(10% + var(--order, 0) * 20%);
  width: 45px;
  height: 45px;
  transform: translateX(-50%);
  border-radius: 12px;
  color: #536681;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  animation: cs-node-pulse 2.5s ease-in-out infinite;
  animation-delay: calc(var(--order, 0) * .22s);
}
#cs-shell .cs-scan-core {
  top: 108px;
  left: 50%;
  width: 48px;
  height: 48px;
  transform: translateX(-50%);
  border-radius: 14px;
  color: #fff;
  background: #465fff;
  font-size: 31px;
  box-shadow: 0 0 0 6px #465fff0b, 0 4px 18px #465fff20;
}
#cs-shell .cs-scan-copy { text-align: center; max-width: 440px; }
#cs-shell .cs-scan-copy h3 { color: var(--cs-ink); font-size: 17px; letter-spacing: -.4px; }
#cs-shell .cs-scan-copy p { margin-top: 6px; color: #758198; font-size: 12px; line-height: 1.7; }
#cs-shell:has(.cs-scan-stage) #cs-hero { display: none !important; }

/* New results appear in reading order; ranks keep their exact server scores. */
#cs-shell .cs-recommendation {
  position: relative;
  overflow: hidden;
  border-color: #d7e0f1;
  background: linear-gradient(110deg, #fff 52%, #f7f9ff) !important;
  box-shadow: 0 4px 16px #1b305905;
  animation: cs-rise-in .6s var(--cs-ease) both;
}
#cs-shell .cs-recommendation::before {
  content: "";
  position: absolute;
  width: 3px;
  inset: 15px auto 15px 0;
  background: #465fff;
  border-radius: 0 2px 2px 0;
}
#cs-shell .cs-chip {
  animation: cs-rise-in .45s var(--cs-ease) both;
  animation-delay: calc(.15s + var(--order, 0) * .07s);
}
#cs-shell .cs-ranking-row {
  animation: cs-rise-in .5s var(--cs-ease) both;
  animation-delay: calc(.1s + var(--order, 0) * .08s);
  transition: background .2s;
}
#cs-shell .cs-ranking-row:hover { background: #f8faff; }
#cs-shell .cs-ranking-row:first-of-type .cs-rank { color: #465fff; }
#cs-shell .cs-score { color: #273c5c; font-variant-numeric: tabular-nums; }
#cs-shell .cs-match {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 5px 9px;
  border: 1px solid #e0e6fa;
  border-radius: 8px;
  background: #eef2ff;
}
#cs-shell .cs-match > span { color: #66759b; font-size: 9px; }
#cs-shell .cs-match b { color: #3641cf; font-size: 21px; line-height: 1; font-variant-numeric: tabular-nums; }
#cs-shell .cs-match small { font-size: 10px; font-weight: 400; color: #8895b4; }
#cs-shell .cs-fill {
  transform-origin: left center;
  background: linear-gradient(90deg, #6981ff, #465fff);
  animation: cs-meter-in .8s var(--cs-ease) both;
  animation-delay: calc(.2s + var(--order, 0) * .08s);
}
#cs-shell #cs-primary {
  border-color: #dce4ef;
  box-shadow: 0 5px 18px #1b305906;
  animation: cs-rise-in .65s .08s var(--cs-ease) both;
}
#cs-shell #cs-runnerup {
  max-width: calc((100% - 20px) * .5);
  animation: cs-rise-in .65s .2s var(--cs-ease) both;
}
#cs-shell #cs-primary video { animation: none; }
#cs-shell .cs-error { animation: cs-rise-in .4s var(--cs-ease) both; }

@keyframes cs-rise-in {
  from { opacity: 0; transform: translateY(12px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes cs-camera-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes cs-beam-flow { to { stroke-dashoffset: -60; } }
@keyframes cs-node-pulse {
  0%, 100% { border-color: #d6dff4; box-shadow: 0 3px 8px #263e6a0b; }
  45% { border-color: #99abff; box-shadow: 0 0 0 4px #465fff08, 0 3px 8px #263e6a0b; }
}
@keyframes cs-meter-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-width: 900px) {
  #cs-shell #cs-runnerup { max-width: 100%; }
  #cs-shell .cs-scene { gap: 23px; padding: 22px 22px 0; }
  #cs-shell .cs-scene-copy h2 { font-size: 30px; letter-spacing: -1.3px; }
  #cs-shell .cs-camera-stage { min-height: 262px; padding: 14px 12px 12px; }
  #cs-shell .cs-stage-cards { margin: 21px 0 18px; gap: 7px; }
  #cs-shell .cs-camera-label { font-size: 7px; padding: 5px 4px; }
  #cs-shell .cs-scene > .cs-steps { margin: -6px -22px 0; padding: 14px 22px; font-size: 11px; }
}
@media (max-width: 620px) {
  #cs-shell .cs-scene { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 22px 19px 0; border-radius: 15px; }
  #cs-shell .cs-scene-copy { padding: 0; }
  #cs-shell .cs-scene-copy h2 { max-width: 310px; font-size: 34px; }
  #cs-shell .cs-scene-copy > p { margin-top: 11px; max-width: 330px; font-size: 12px; }
  #cs-shell .cs-scene-tags { margin-top: 12px; }
  #cs-shell .cs-camera-stage { min-height: 255px; padding: 13px 13px 11px; }
  #cs-shell .cs-stage-cards { margin: 18px 5px 14px; gap: 8px; }
  #cs-shell .cs-camera-label { font-size: 7px; }
  #cs-shell .cs-stage-header, #cs-shell .cs-stage-footer { font-size: 8px; }
  #cs-shell .cs-scene > .cs-steps {
    grid-column: auto;
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    max-width: none;
    width: auto;
    margin: 0 -19px;
    padding: 16px 19px;
    gap: 14px;
    font-size: 11px;
  }
  #cs-shell .cs-scan-stage { padding: 22px 15px; min-height: 275px; }
  #cs-shell .cs-scan-node { width: 34px; height: 34px; top: 7px; border-radius: 9px; font-size: 10px; }
  #cs-shell .cs-scan-copy p { font-size: 11px; max-width: 280px; }
  #cs-shell .cs-recommendation::before { inset-block: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  #cs-shell *, #cs-shell *::before, #cs-shell *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  #cs-shell .cs-scene-copy > *, #cs-shell .cs-camera-stage,
  #cs-shell .cs-chip, #cs-shell .cs-ranking-row, #cs-shell .cs-recommendation,
  #cs-shell #cs-primary, #cs-shell #cs-runnerup, #cs-shell .cs-error {
    opacity: 1;
    filter: none;
  }
}
