:root {
  --ink: #17202a;
  --muted: #64717d;
  --paper: #f5f7f8;
  --surface: #ffffff;
  --line: #dce4e8;
  --teal: #007f86;
  --green: #16835b;
  --blue: #2f5aa8;
  --amber: #c47a1f;
  --red: #bd4b42;
  --dark: #101722;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
textarea {
  font: inherit;
}

.app {
  min-height: 100vh;
}

.hero {
  position: relative;
  min-height: 72vh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #fff;
  background: var(--dark);
}

.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.68;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(9, 14, 24, 0.9), rgba(9, 14, 24, 0.56) 58%, rgba(9, 14, 24, 0.18));
}

.hero-content {
  position: relative;
  width: min(980px, 88vw);
  padding: 0 0 120px 6vw;
}

.eyebrow {
  margin: 0 0 16px;
  color: #94e0da;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 18px;
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 760px;
  color: #e6eef1;
  font-size: 20px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

button {
  min-height: 44px;
  border: 0;
  background: var(--green);
  color: #fff;
  padding: 0 20px;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: rgba(255, 255, 255, 0.14);
  outline: 1px solid rgba(255, 255, 255, 0.45);
}

.hero-stats {
  position: absolute;
  left: 6vw;
  right: 6vw;
  bottom: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.hero-stats div {
  min-height: 86px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
}

.hero-stats strong {
  display: block;
  font-size: 32px;
}

.hero-stats span {
  color: #d8e6e9;
}

.scorebar {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.scorebar div {
  min-height: 138px;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.scorebar span {
  color: var(--amber);
  font-weight: 900;
}

.scorebar strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 18px;
}

.scorebar p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.demo-shell {
  display: grid;
  grid-template-columns: minmax(310px, 400px) 1fr;
  gap: 18px;
  padding: 24px 6vw 44px;
}

.scenario,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
}

.scenario {
  align-self: start;
  position: sticky;
  top: 18px;
  padding: 20px;
}

.panel-title p,
.panel header p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.panel-title h2,
.panel h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

textarea {
  width: 100%;
  min-height: 360px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  resize: vertical;
  color: var(--ink);
  background: #fbfcfd;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 14px;
  line-height: 1.7;
  outline: 0;
}

.audit-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.audit-strip div {
  padding: 10px;
  background: #f0f5f5;
}

.audit-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.audit-strip strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.console {
  min-width: 0;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(8, minmax(94px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.stage {
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-align: left;
}

.stage span {
  display: block;
  color: var(--blue);
  font-size: 18px;
  font-weight: 900;
}

.stage.active {
  border-color: #a8d8d3;
  background: #edf8f6;
  color: var(--ink);
}

.stage.current {
  outline: 2px solid var(--green);
}

.console-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr);
  gap: 14px;
}

.panel {
  min-height: 310px;
  padding: 18px;
}

.panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.panel header span {
  max-width: 46%;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.output {
  display: grid;
  gap: 10px;
}

.line-item {
  padding: 11px 12px;
  border-left: 4px solid var(--teal);
  background: #f5fafb;
  line-height: 1.6;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.metric-grid div {
  padding: 12px;
  background: #f6f8f9;
  border-top: 4px solid var(--amber);
}

.metric-grid strong {
  display: block;
  color: var(--dark);
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.1;
}

.metric-grid small {
  color: var(--muted);
}

pre {
  min-height: 178px;
  max-height: 300px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  white-space: pre-wrap;
  color: #dbfbf3;
  background: #101827;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.visual-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #dfe7eb;
  border: 1px solid #c5d1d8;
}

.scene-triptych {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.panel-marker {
  position: absolute;
  top: 10px;
  z-index: 3;
  padding: 7px 10px;
  color: #fff;
  background: rgba(16, 23, 34, 0.78);
  font-size: 13px;
  font-weight: 900;
}

.before-marker {
  left: 12px;
}

.after-marker {
  left: calc(33.333% + 12px);
}

.detect-marker {
  left: calc(66.666% + 12px);
}

.active-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  width: 33.333%;
  border: 4px solid var(--green);
  background: rgba(22, 131, 91, 0.06);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
  transition: left 420ms ease, border-color 260ms ease, background 260ms ease;
}

.visual-frame.running .active-panel {
  left: 33.333%;
  border-color: var(--amber);
  background: rgba(196, 122, 31, 0.08);
}

.visual-frame.detected .active-panel {
  left: 66.666%;
  border-color: #12d6ac;
  background: rgba(18, 214, 172, 0.08);
}

.camera-view {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.58) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(180deg, rgba(255,255,255,0.58) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(135deg, #edf3f5, #cbd7dd);
}

.deck-grid {
  position: absolute;
  inset: 10%;
  border: 1px dashed rgba(80, 102, 116, 0.45);
}

.camera-rig {
  position: absolute;
  left: 16px;
  top: 14px;
  padding: 6px 8px;
  background: #111b29;
  color: #d9f5ef;
  font-size: 12px;
  font-weight: 900;
}

.liquid-handler {
  position: absolute;
  left: 12%;
  top: 18%;
  width: 34%;
  height: 44%;
  border: 8px solid #a8b7c1;
  background: rgba(236, 243, 246, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.9);
}

.gantry {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 22%;
  height: 12px;
  background: #6b7e8b;
}

.pipette {
  position: absolute;
  left: 46%;
  top: 22%;
  width: 14px;
  height: 92px;
  background: #2f5aa8;
  box-shadow: 0 92px 0 -5px #1e3d74;
  transition: transform 420ms ease;
}

.reagent-rack {
  position: absolute;
  left: 14%;
  bottom: 13%;
  width: 30%;
  height: 18%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px;
  background: #eef4f6;
  border: 4px solid #93a4af;
}

.reagent-rack span {
  background: linear-gradient(180deg, #68c9bd 0 58%, #e9f5f2 58%);
  border: 2px solid #5f7481;
}

.well-plate {
  position: absolute;
  left: 50%;
  top: 31%;
  width: 25%;
  height: 34%;
  border: 6px solid #9cadb7;
  background:
    radial-gradient(circle, #72c7bf 0 4px, transparent 5px) 7px 7px / 22px 18px,
    #f7fbfc;
  box-shadow: 0 14px 26px rgba(16, 23, 34, 0.2);
  transition: left 520ms ease, top 520ms ease, transform 520ms ease, background 420ms ease;
}

.visual-frame.running .well-plate,
.visual-frame.detected .well-plate {
  left: 66%;
  top: 37%;
  transform: rotate(-2deg);
  background:
    linear-gradient(135deg, rgba(191, 230, 242, 0.52), rgba(255,255,255,0.18)),
    radial-gradient(circle, #59aeb0 0 4px, transparent 5px) 7px 7px / 22px 18px,
    #f7fbfc;
}

.film-sheet {
  position: absolute;
  left: 50.5%;
  top: 32%;
  width: 24%;
  height: 32%;
  opacity: 0;
  background: linear-gradient(135deg, rgba(198, 239, 255, 0.22), rgba(255,255,255,0.5));
  border: 2px solid rgba(103, 177, 204, 0.7);
  transition: opacity 420ms ease, left 520ms ease, top 520ms ease, transform 520ms ease;
}

.visual-frame.running .film-sheet,
.visual-frame.detected .film-sheet {
  left: 66.5%;
  top: 38%;
  opacity: 1;
  transform: rotate(-2deg);
}

.centrifuge-mark {
  position: absolute;
  left: 51%;
  bottom: 12%;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d5e0e5;
  border: 8px solid #8799a6;
  color: #53636e;
  font-size: 12px;
  font-weight: 900;
}

.qpcr-slot {
  position: absolute;
  right: 6%;
  top: 24%;
  width: 26%;
  height: 52%;
  background: #bdcbd3;
  border: 8px solid #6b7f8d;
  box-shadow: inset 0 0 0 10px rgba(255,255,255,0.2);
}

.qpcr-slot span {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: #263744;
  font-weight: 900;
}

.transfer-path {
  position: absolute;
  left: 55%;
  top: 28%;
  width: 22%;
  height: 22%;
  opacity: 0;
  border-top: 4px dashed var(--amber);
  border-right: 4px dashed var(--amber);
  transform: skewX(-18deg);
  transition: opacity 260ms ease;
}

.visual-frame.running .transfer-path {
  opacity: 1;
}

.visual-frame.running .pipette,
.visual-frame.detected .pipette {
  transform: translateX(44px);
}

.state-label {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 7px 10px;
  opacity: 0;
  color: #fff;
  background: rgba(16, 23, 34, 0.82);
  font-weight: 900;
}

.visual-frame.pre-run .before-label,
.visual-frame.running .after-label,
.visual-frame.detected .detect-label {
  opacity: 1;
}

.scan-beam {
  position: absolute;
  left: 66.666%;
  right: 0;
  top: 17%;
  z-index: 4;
  height: 3px;
  opacity: 0;
  background: #12d6ac;
  box-shadow: 0 0 18px #12d6ac;
}

.visual-frame.detected .scan-beam {
  opacity: 1;
  animation: visionScan 1.8s ease-in-out infinite;
}

@keyframes visionScan {
  0%, 100% { transform: translateY(-28px); }
  50% { transform: translateY(178px); }
}

.det-box {
  position: absolute;
  opacity: 0;
  border: 2px solid #12d6ac;
  background: rgba(18, 214, 172, 0.1);
  box-shadow: 0 0 0 1px rgba(16, 23, 34, 0.45), 0 0 18px rgba(18, 214, 172, 0.34);
  transition: opacity 260ms ease, transform 260ms ease;
}

.det-box span {
  position: absolute;
  left: -2px;
  top: -31px;
  max-width: 240px;
  padding: 6px 8px;
  color: #062a23;
  background: #a8f3df;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.plate-box {
  left: 65%;
  top: 36%;
  width: 27%;
  height: 36%;
}

.spill-box {
  left: 57%;
  top: 68%;
  width: 14%;
  height: 12%;
  border-color: #f3c14f;
  background: rgba(243, 193, 79, 0.12);
}

.spill-box span {
  background: #ffe29a;
}

.slot-box {
  left: 62%;
  top: 23%;
  width: 32%;
  height: 54%;
  border-color: #72b7ff;
  background: rgba(114, 183, 255, 0.12);
}

.slot-box span {
  background: #cce6ff;
}

.visual-frame.detected .det-box {
  opacity: 1;
  transform: translateY(0);
}

.vision-overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  padding: 9px 12px;
  background: rgba(22, 131, 91, 0.92);
  color: #fff;
  font-weight: 900;
}

.vision-overlay.idle {
  background: rgba(16, 23, 34, 0.78);
}

.vision-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.vision-compare div {
  min-height: 76px;
  padding: 11px;
  background: #f6f8f9;
  border-left: 4px solid var(--blue);
}

.vision-compare div:last-child {
  border-left-color: var(--green);
}

.vision-compare span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.vision-compare strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  padding: 8px 10px;
  background: #edf5ff;
  color: #244f93;
  font-size: 13px;
  font-weight: 900;
}

.summary-panel p {
  color: var(--ink);
  line-height: 1.75;
}

.result-checklist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

.result-checklist div {
  min-height: 58px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fbfdfd;
}

.result-checklist span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.result-checklist strong {
  display: block;
  margin-top: 4px;
  color: var(--teal);
  font-size: 17px;
  line-height: 1.35;
}

@media (max-width: 1080px) {
  .demo-shell,
  .console-grid {
    grid-template-columns: 1fr;
  }

  .scenario {
    position: static;
  }

  .scorebar {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: 82vh;
  }

  .hero-content {
    width: auto;
    padding: 0 22px 190px;
  }

  h1 {
    font-size: 40px;
  }

  .hero-lead {
    font-size: 17px;
  }

  .hero-stats {
    left: 22px;
    right: 22px;
    grid-template-columns: 1fr;
  }

  .hero-stats div {
    min-height: 58px;
    padding: 10px 12px;
  }

  .hero-stats strong {
    font-size: 24px;
  }

  .scorebar {
    grid-template-columns: 1fr;
  }

  .demo-shell {
    padding: 18px;
  }

  .workflow {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
  }

  .metric-grid,
  .audit-strip,
  .result-checklist,
  .vision-compare {
    grid-template-columns: 1fr;
  }

  .panel header {
    display: block;
  }

  .panel header span {
    display: block;
    max-width: none;
    margin-top: 8px;
    text-align: left;
  }
}
