/* ============================================================
   KI in der Qualitaetskontrolle: Pruefstrecke mit Kamera.
   Beispielansicht mit simulierten Teilen.
   ============================================================ */

.qc-line {
  --band: 58px;
  --belt: 104px;
  position: relative;
  border-radius: 22px;
  padding: clamp(14px, 2.2vw, 26px);
  background: linear-gradient(165deg, #16354A, var(--night) 72%);
  box-shadow: 0 40px 90px rgba(16, 40, 53, 0.32);
  color: #E6EEF2;
  overflow: hidden;
}
.qc-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
  margin-bottom: 14px;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(230, 238, 242, 0.62);
}
.qc-live { display: inline-flex; align-items: center; gap: 8px; color: #E6EEF2; }
.qc-live i {
  width: 8px; height: 8px; border-radius: 50%; background: #35C26B;
  animation: qc-live 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes qc-live {
  0%, 55% { box-shadow: 0 0 0 0 rgba(53, 194, 107, 0.55); }
  100% { box-shadow: 0 0 0 9px rgba(53, 194, 107, 0); }
}
.qc-ex { padding: 3px 10px; border-radius: 999px; border: 1px solid rgba(245, 194, 107, 0.4); color: var(--orange-soft); }

/* Strecke */
.qc-stage {
  position: relative;
  height: calc(var(--band) * 2 + var(--belt));
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.qc-belt {
  position: absolute; left: 0; right: 0; top: var(--band); height: var(--belt);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px calc(100% / 12)),
    linear-gradient(180deg, #0C1E28, #12303F 50%, #0C1E28);
  border-top: 3px solid rgba(111, 167, 199, 0.35);
  border-bottom: 3px solid rgba(111, 167, 199, 0.35);
}

/* Spuren fuer Ausschuss und Sichtpruefung */
.qc-lane {
  position: absolute; left: calc(100% / 6 * 3); right: 0; height: calc(var(--band) - 12px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 10px; color: rgba(230, 238, 242, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.qc-lane-up { top: 6px; }
.qc-lane-down { bottom: 6px; }
.qc-lane.flash { background: rgba(237, 152, 42, 0.16); border-color: var(--orange); color: var(--orange-soft); }
.qc-lane-up.flash { background: rgba(245, 194, 107, 0.14); border-color: var(--orange-soft); }

/* Kamera */
.qc-cam {
  position: absolute; top: 4px; left: calc(100% / 6 * 2); width: calc(100% / 6);
  height: var(--band); display: flex; justify-content: center; align-items: flex-start; z-index: 3;
}
.qc-cam svg { width: 34px; height: 30px; color: #A8CBE0; }
.qc-cone {
  position: absolute; top: 28px; left: 50%; width: 100%; height: calc(var(--band) - 28px + var(--belt));
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(111, 167, 199, 0.22), rgba(111, 167, 199, 0.03));
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%);
  opacity: 0.25; transition: opacity 0.3s;
  pointer-events: none;
}
.qc-line.scanning .qc-cone { opacity: 0.9; }

/* Pruefrahmen */
.qc-frame {
  position: absolute; top: var(--band); left: calc(100% / 6 * 2); width: calc(100% / 6); height: var(--belt);
  z-index: 4; pointer-events: none; opacity: 0; transform: scale(1.08);
  transition: opacity 0.3s var(--ease-out), transform 0.4s var(--ease-out);
  --fc: var(--cyan);
}
.qc-frame.on { opacity: 1; transform: none; }
.qc-frame::before, .qc-frame::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--fc); transition: border-color 0.3s;
}
.qc-frame::before { left: 4px; top: 4px; border-right: 0; border-bottom: 0; }
.qc-frame::after { right: 4px; bottom: 4px; border-left: 0; border-top: 0; }
.qc-frame i { position: absolute; width: 14px; height: 14px; border: 2px solid var(--fc); transition: border-color 0.3s; }
.qc-frame i:nth-child(1) { right: 4px; top: 4px; border-left: 0; border-bottom: 0; }
.qc-frame i:nth-child(2) { left: 4px; bottom: 4px; border-right: 0; border-top: 0; }
.qc-frame .scanline {
  position: absolute; left: 6px; right: 6px; top: 6px; height: 2px;
  background: var(--fc); box-shadow: 0 0 12px 2px var(--fc); opacity: 0;
}
.qc-frame.ok { --fc: #35C26B; }
.qc-frame.bad { --fc: var(--orange); }
.qc-frame.edge { --fc: var(--orange-soft); }

/* Diverter */
.qc-push {
  position: absolute; left: calc(100% / 6 * 3 + 100% / 12 - 14px); width: 28px; z-index: 5;
  background: var(--orange); border-radius: 4px; transform: scaleY(0); pointer-events: none;
}
.qc-push-down { top: calc(var(--band) - 2px); height: 36px; transform-origin: top; }
.qc-push-up { bottom: calc(var(--band) - 2px); height: 36px; transform-origin: bottom; background: var(--orange-soft); }

/* Teile */
.qc-parts { position: absolute; left: 0; right: 0; top: var(--band); height: var(--belt); z-index: 2; }
.qc-part {
  position: absolute; left: 0; top: 0; width: calc(100% / 6); height: 100%;
  display: grid; place-items: center; will-change: transform;
}
.qc-part svg { width: 86%; max-width: 76px; height: auto; overflow: visible; }
.qc-part .body { fill: #C9D6DF; stroke: #9EBDD1; stroke-width: 1.5; }
.qc-part .screw { fill: #7F96A5; }
.qc-part .hole { fill: #0A1A22; }
.qc-part .core { fill: #8EA6B5; stroke: #6F8696; stroke-width: 1.5; }
.qc-part .lbl { fill: #FBFAF2; }
.qc-part .lbl-line { stroke: #5C6B74; stroke-width: 1.2; }
.qc-part .scratch { stroke: #55656F; stroke-width: 1.6; fill: none; stroke-linecap: round; }
.qc-part .scuff { stroke: #7A8B96; stroke-width: 1.2; fill: none; stroke-linecap: round; }
.qc-part .hit { fill: none; stroke: var(--orange); stroke-width: 2; stroke-dasharray: 4 3; opacity: 0; transition: opacity 0.35s var(--ease-out); }
.qc-part.bad .hit { opacity: 1; }
.qc-part.edge .hit { opacity: 1; stroke: var(--orange-soft); }
.qc-tag {
  position: absolute; top: 4px; right: 12%; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; transform: scale(0); font-family: var(--font-head); font-weight: 700; font-size: 12px; line-height: 1;
  background: #35C26B; color: var(--ink);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.qc-part.bad .qc-tag { background: var(--orange); }
.qc-part.edge .qc-tag { background: var(--orange-soft); }
.qc-part.judged .qc-tag { transform: scale(1); }

/* Ergebnis */
.qc-result {
  margin-top: 14px; padding: 14px 18px; border-radius: 14px; min-height: 68px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out);
}
.qc-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); transition: background 0.3s; }
.qc-result b { font-family: var(--font-head); font-size: 19px; color: #fff; line-height: 1.2; }
.qc-result span.d { margin-left: auto; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: rgba(230, 238, 242, 0.65); text-align: right; }
.qc-result.ok { border-color: rgba(53, 194, 107, 0.5); background: rgba(53, 194, 107, 0.1); }
.qc-result.ok .qc-dot { background: #35C26B; }
.qc-result.bad { border-color: rgba(237, 152, 42, 0.6); background: rgba(237, 152, 42, 0.14); }
.qc-result.bad .qc-dot { background: var(--orange); }
.qc-result.edge { border-color: rgba(245, 194, 107, 0.6); background: rgba(245, 194, 107, 0.1); }
.qc-result.edge .qc-dot { background: var(--orange-soft); }
.qc-result.swap b, .qc-result.swap span.d { animation: qc-swap 0.5s var(--ease-out); }
@keyframes qc-swap { from { opacity: 0; transform: translateY(6px); } }

/* Zaehler */
.qc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.qc-stats div { padding: 10px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.08); }
.qc-stats b { display: block; font-family: var(--font-head); font-size: 24px; line-height: 1.1; color: #fff; font-variant-numeric: tabular-nums; }
.qc-stats span { font-size: 12px; color: rgba(230, 238, 242, 0.6); }
.qc-stats b.pop { animation: qc-pop 0.5s var(--ease-out); }
@keyframes qc-pop { from { transform: translateY(4px) scale(0.88); opacity: 0.5; } }
.qc-stats .s-bad b { color: var(--orange); }
.qc-stats .s-edge b { color: var(--orange-soft); }

/* Ehrlichkeitsblock */
.qc-honest {
  margin-top: 56px; padding: 30px; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 32px; align-items: start;
}
.qc-honest h3 { font-size: clamp(22px, 2.6vw, 28px); margin: 12px 0 10px; }
.qc-honest p { color: var(--gray); font-size: 15.5px; }
.qc-honest .check-list { margin-bottom: 0; }

@media (max-width: 1024px) {
  .qc-honest { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 720px) {
  .qc-line { --band: 52px; --belt: 88px; }
  .qc-lane { font-size: 9.5px; letter-spacing: 0.04em; }
  .qc-cam svg { width: 26px; height: 24px; }
  .qc-tag { width: 16px; height: 16px; font-size: 10px; right: 6%; }
  .qc-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qc-result span.d { margin-left: 0; text-align: left; width: 100%; }
  .qc-honest { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .qc-live i { animation: none; }
  .qc-result.swap b, .qc-result.swap span.d, .qc-stats b.pop { animation: none; }
}
