/* Sensorik & Machine Learning: Sensorkurven mit Abweichung, Wartungs-Zeitleiste, Mini-Visuals.
   Fortlaufende Animationen laufen nur, solange das Element sichtbar ist (.is-live per Skript). */

[data-live]:not(.is-live) *,
[data-live]:not(.is-live) *::before,
[data-live]:not(.is-live) *::after { animation-play-state: paused !important; }

/* ---------- Sensorkurven ---------- */
.sn-panel {
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(160deg, #16354A, var(--night) 80%);
  box-shadow: 0 30px 70px rgba(16, 40, 53, 0.3);
  color: #E6EEF2;
}
.sn-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 2px 4px 12px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(230, 238, 242, 0.55);
}
.sn-dot { width: 8px; height: 8px; border-radius: 50%; background: #35C26B; flex: none; animation: sn-dot-a 14s infinite; }
@keyframes sn-dot-a { 0%, 52% { background: #35C26B; } 56%, 92% { background: var(--orange); } 97%, 100% { background: #35C26B; } }
.sn-tag { margin-left: auto; color: var(--orange-soft); white-space: nowrap; }
.sn-plot { position: relative; aspect-ratio: 640 / 300; border-radius: 10px; background: #0B1B24; overflow: hidden; }
.sn-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sn-lab {
  position: absolute; left: 10px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(230, 238, 242, 0.45);
}
.sn-lab.a { top: 4%; } .sn-lab.b { top: 35%; } .sn-lab.c { top: 66%; }
.sn-band { fill: rgba(111, 167, 199, 0.1); }
.sn-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.sn-line, .sn-warn, .sn-cut { fill: none; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.sn-line { stroke: var(--steel); stroke-width: 1.8; }
.sn-warn { stroke: var(--orange); stroke-width: 2.6; }
.sn-cut { stroke: var(--orange-soft); stroke-width: 1.4; }
.sn-zone { fill: rgba(237, 152, 42, 0.09); opacity: 0; }

.sn-line, .sn-warn, .sn-cut, .sn-zone, .sn-flag, .sn-alert { animation-duration: 14s; animation-iteration-count: infinite; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
.sn-line.l1 { animation-name: sn-l1; }
.sn-line.l2 { animation-name: sn-l2; }
.sn-line.l3 { animation-name: sn-l3; }
.sn-warn.w1 { animation-name: sn-w1; }
.sn-warn.w2 { animation-name: sn-w2; }
.sn-warn.w3 { animation-name: sn-w3; }
.sn-cut { animation-name: sn-cut; }
.sn-zone { animation-name: sn-zone; }
@keyframes sn-l1 { 0%, 2% { stroke-dashoffset: 1; opacity: 1; } 31% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-l2 { 0%, 5% { stroke-dashoffset: 1; opacity: 1; } 37% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-l3 { 0%, 9% { stroke-dashoffset: 1; opacity: 1; } 42% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-w1 { 0%, 40% { stroke-dashoffset: 1; opacity: 1; } 47% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-w2 { 0%, 43% { stroke-dashoffset: 1; opacity: 1; } 50% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-w3 { 0%, 45% { stroke-dashoffset: 1; opacity: 1; } 53% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-cut { 0%, 52% { stroke-dashoffset: 1; opacity: 1; } 56% { stroke-dashoffset: 0; } 91% { stroke-dashoffset: 0; opacity: 1; } 96%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-zone { 0%, 52% { opacity: 0; } 58%, 91% { opacity: 1; } 96%, 100% { opacity: 0; } }

.sn-flag {
  position: absolute; left: 78.1%; bottom: 7px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  color: var(--ink); background: var(--orange-soft); padding: 4px 8px; border-radius: 4px 4px 0 4px;
  opacity: 0; transform: translateX(calc(-100% - 6px)) scale(0.8);
  animation-name: sn-flag; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sn-flag {
  0%, 54% { opacity: 0; transform: translateX(calc(-100% - 6px)) scale(0.8); }
  58%, 91% { opacity: 1; transform: translateX(calc(-100% - 6px)) scale(1); }
  96%, 100% { opacity: 0; transform: translateX(calc(-100% - 6px)) scale(1); }
}
.sn-alert {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0; animation-name: sn-card; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sn-card {
  0%, 61% { opacity: 0; transform: translateY(10px); }
  66%, 91% { opacity: 1; transform: none; }
  96%, 100% { opacity: 0; transform: none; }
}
.sn-alert .ic { width: 34px; height: 34px; border-radius: 10px; background: rgba(245, 194, 107, 0.16); display: grid; place-items: center; flex: none; }
.sn-alert .ic svg { width: 18px; height: 18px; stroke: var(--orange-soft); }
.sn-alert b { display: block; font-family: var(--font-head); font-size: 15px; color: #fff; }
.sn-alert span { font-size: 13px; color: rgba(230, 238, 242, 0.62); }

/* ---------- Wartung nach Kalender oder nach Zustand ---------- */
.sn-time { display: grid; gap: 34px; padding: 26px 28px 30px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.sn-row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 16px; align-items: end; }
.sn-rl { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray); padding-bottom: 2px; }
.sn-track { position: relative; height: 64px; }
.sn-track::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.sn-track i {
  position: absolute; left: var(--x); bottom: -6px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--steel); transform: translateX(-50%) scale(0); opacity: 0;
}
.sn-track b {
  position: absolute; left: var(--x); bottom: 14px; transform: translate(-50%, 8px); opacity: 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  padding: 3px 7px; border-radius: 4px; background: #FDE8E8; color: #B3262B;
}
.sn-track b.ok { background: rgba(237, 152, 42, 0.16); color: var(--orange-deep); }
.sn-track b::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 2px; height: 5px; background: currentColor; opacity: 0.5; }
.sn-track i.cal { background: #9FB3C4; }
.sn-track i.hit { background: var(--orange); box-shadow: 0 0 0 5px rgba(237, 152, 42, 0.2); }
.rv.in .sn-track i { opacity: 1; transform: translateX(-50%) scale(1); transition: opacity 0.3s var(--ease-out) var(--d, 0s), transform 0.6s var(--ease-spring) var(--d, 0s); }
.rv.in .sn-track b { opacity: 1; transform: translate(-50%, 0); transition: opacity 0.4s var(--ease-out) var(--d, 0s), transform 0.6s var(--ease-out) var(--d, 0s); }
.sn-note { margin-top: -10px; font-size: 12.5px; color: var(--gray); }

/* ---------- Beispiel-Karten mit Mini-Visual ---------- */
.sn-ex .b-visual { margin: -32px -32px 24px; border-radius: 14px 14px 0 0; }
.sn-mini { position: absolute; inset: 0; }
.sn-mini svg { width: 100%; height: 100%; }
.sn-mini .ln { fill: none; stroke: var(--steel); stroke-width: 2; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: sn-m 8s infinite cubic-bezier(0.65, 0, 0.35, 1); }
.sn-mini .wn { fill: none; stroke: var(--orange); stroke-width: 2.6; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: sn-mw 8s infinite cubic-bezier(0.65, 0, 0.35, 1); }
.sn-mini .th { stroke: #C9544F; stroke-width: 1.2; stroke-dasharray: 4 4; }
@keyframes sn-m { 0%, 4% { stroke-dashoffset: 1; opacity: 1; } 42% { stroke-dashoffset: 0; } 88% { stroke-dashoffset: 0; opacity: 1; } 95%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sn-mw { 0%, 40% { stroke-dashoffset: 1; opacity: 1; } 56% { stroke-dashoffset: 0; } 88% { stroke-dashoffset: 0; opacity: 1; } 95%, 100% { stroke-dashoffset: 0; opacity: 0; } }
.sn-mini .tg {
  position: absolute; right: 14px; top: 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em;
  color: var(--ink); background: var(--orange-soft); padding: 4px 8px; border-radius: 4px;
  opacity: 0; animation: sn-tg 8s infinite cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sn-tg { 0%, 54% { opacity: 0; transform: translateY(6px); } 62%, 88% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }
.sn-mini.b .wn { animation-name: sn-mw2; }
@keyframes sn-mw2 { 0%, 50% { stroke-dashoffset: 1; opacity: 1; } 62% { stroke-dashoffset: 0; } 88% { stroke-dashoffset: 0; opacity: 1; } 95%, 100% { stroke-dashoffset: 0; opacity: 0; } }
.sn-mini.b .tg { animation-name: sn-tg2; }
@keyframes sn-tg2 { 0%, 60% { opacity: 0; transform: translateY(6px); } 68%, 88% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }

.sn-fleet { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 62px); grid-auto-rows: 44px; gap: 10px; justify-content: center; align-content: center; }
.sn-fleet i { position: relative; border-radius: 9px; background: #E3EAF0; border: 1.5px solid #B9C8DF; }
.sn-fleet i::after { content: ""; position: absolute; right: 7px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: #35C26B; animation: sn-blink 7s infinite; animation-delay: var(--t, 0s); }
.sn-fleet i::before { content: ""; position: absolute; left: 9px; bottom: 9px; width: 22px; height: 4px; border-radius: 2px; background: #B9C8DF; }
.sn-fleet i.alert { border-color: var(--orange); background: rgba(237, 152, 42, 0.12); animation: sn-pulse 7s infinite cubic-bezier(0.16, 1, 0.3, 1); animation-delay: 1.6s; }
.sn-fleet i.alert::after { background: var(--orange); animation: none; }
@keyframes sn-blink { 0%, 86% { opacity: 1; } 90% { opacity: 0.25; } 94%, 100% { opacity: 1; } }
@keyframes sn-pulse { 0%, 30% { box-shadow: 0 0 0 0 rgba(237, 152, 42, 0); } 36% { box-shadow: 0 0 0 7px rgba(237, 152, 42, 0.25); } 60%, 100% { box-shadow: 0 0 0 0 rgba(237, 152, 42, 0); } }

@media (max-width: 720px) {
  .sn-bar { font-size: 10px; letter-spacing: 0.08em; }
  .sn-panel { padding: 10px; }
  .sn-lab { font-size: 9px; left: 6px; }
  .sn-flag { font-size: 9.5px; padding: 3px 6px; }
  .sn-time { padding: 20px 18px 24px; gap: 40px; }
  .sn-row { grid-template-columns: 1fr; gap: 10px; }
  .sn-track b { font-size: 9.5px; padding: 2px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  .sn-dot, .sn-line, .sn-warn, .sn-cut, .sn-zone, .sn-flag, .sn-alert, .sn-mini .ln, .sn-mini .wn, .sn-mini .tg,
  .sn-fleet i::after, .sn-fleet i.alert { animation: none; }
  .sn-line, .sn-warn, .sn-cut { stroke-dashoffset: 0; }
  .sn-zone, .sn-alert, .sn-mini .ln, .sn-mini .wn, .sn-mini .tg { opacity: 1; }
  .sn-mini .ln, .sn-mini .wn { stroke-dashoffset: 0; }
  .sn-flag { opacity: 1; transform: translateX(calc(-100% - 6px)); }
  .sn-track i, .sn-track b { opacity: 1; transform: translateX(-50%); transition: none; }
  .sn-track b { transform: translate(-50%, 0); }
}

.sn-track i.fail { background: #D8403F; box-shadow: 0 0 0 5px rgba(216, 64, 63, 0.18); }
