/* Аварийная смена — станция «Провода». Подключать после emergency-shift.css: заменяет прежние правила
   .wire-top / .wire-end / .wire-spark / .shift-wire-button (их можно удалить из emergency-shift.css). */

.sw-rig { --sw-ink: #10141C; --sw-blue: #6A90FF; --sw-copper: #E39A5A; --sw-ok: #2FA564; --sw-bad: #E05252; }
.sw-cabinet { fill: #F3F6FF; stroke: #DCE3FB; stroke-width: 1.5; }
.sw-cabinet-lines { fill: none; stroke: #DCE3FB; stroke-width: 1; stroke-dasharray: 3 5; }

/* Прежние CSS-анимации обрубка и падения отключены: движение считает JS (shift-wires.js). */
.sw-rig .wire-top, .sw-rig .wire-end { animation: none; translate: none; rotate: none; transition: none; transform-box: view-box; transform-origin: 0 0; }

/* Кабели: контур, изоляция, блик; поверх — бегущие вниз капли тока. */
.shift-wire path { fill: none; stroke-linecap: round; }
.sw-edge { stroke: var(--edge); stroke-width: 9; }
.sw-body { stroke: var(--body); stroke-width: 6.4; transition: stroke .4s ease; }
.sw-shine { stroke: #FCFDFF; stroke-width: 1.5; opacity: .5; transform: translateX(-1.4px); }
.sw-pulse { stroke: #FCFDFF; stroke-width: 2.2; stroke-dasharray: 2.5 17; opacity: .75; animation: sw-flow 1.05s linear infinite; }
.shift-wire[data-wire="1"] .sw-pulse { opacity: .55; animation-duration: 1.2s; }
.shift-wire[data-wire="2"] .sw-pulse { animation-duration: .95s; }
@keyframes sw-flow { to { stroke-dashoffset: -19.5; } }
.shift-wire.is-cut .sw-pulse { animation: none; opacity: 0; transition: opacity .2s; }
.sw-copper { fill: var(--sw-copper); stroke: #B86F33; stroke-width: 1; opacity: 0; }
.shift-wire.is-cut .sw-copper { opacity: 1; }
.shift-wire.is-cut .sw-body { stroke: color-mix(in srgb, var(--body) 82%, #9AA3B5); }

/* Разряд по уцелевшему кабелю и «живой» кабель после верного ответа. */
.sw-surge { stroke: #FCFDFF; stroke-width: 5; stroke-dasharray: 34 120; stroke-dashoffset: 34; opacity: 0; filter: url(#sw-glow); }
.shift-wire.is-live .sw-body { stroke: #8FB0FF; }
.shift-wire.is-live .sw-edge { stroke: var(--sw-blue); filter: url(#sw-glow); }
.shift-wire.is-live .sw-pulse { stroke-dasharray: 5 9; opacity: 1; animation-duration: .45s; }

/* Индикаторы над клеммами: горят, гаснут при разрезе, «живой» пульсирует, авария — красный. */
.sw-led { fill: #6A90FF; filter: url(#sw-glow); transition: fill .25s ease, opacity .25s ease; }
.sw-led.is-off { fill: #3A4256; filter: none; }
.sw-led.is-live { fill: #B9F3FF; animation: sw-led 0.9s ease-in-out infinite alternate; }
.sw-led.is-alarm { fill: var(--sw-bad); animation: sw-led .32s steps(2) infinite; }
@keyframes sw-led { to { opacity: .45; } }

/* Сигнальная лампа на балке: включается, когда пресс опускается низко (JS задаёт прозрачность). */
.sw-alarm { opacity: 0; }
.sw-alarm-lamp { fill: #FF6B6B; }
.sw-alarm-halo { fill: #FF6B6B; opacity: .25; }
.sw-alarm.is-on .sw-alarm-lamp { animation: sw-led .3s steps(2) infinite; }

/* След пальца: голубое свечение с белой сердцевиной. */
.sw-trail-glow { fill: none; stroke: #6A90FF; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; opacity: .28; }
.sw-trail-core { fill: none; stroke: #FCFDFF; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: url(#sw-glow); }
.sw-spark { stroke-width: 2.3; stroke-linecap: round; filter: url(#sw-glow); }
.sw-flash { fill: rgba(157,184,255,.25); stroke: #FCFDFF; stroke-width: 2.6; filter: url(#sw-glow); }
.sw-shard { stroke: #9DB8FF; stroke-width: .6; }

/* Лампа: стекло, нить; при успехе нить раскаляется, вокруг вращаются лучи. */
.sw-glass { fill: #E9EFFF; transition: fill .4s ease; }
.sw-filament { transition: stroke .4s ease; }
.sw-crack { fill: none; stroke: #10141C; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.sw-rays { fill: none; stroke: #9DB8FF; stroke-width: 3; stroke-linecap: round; opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity .4s ease; }
.shift-success .sw-glass { fill: url(#sw-bulb-light); }
.shift-success .sw-filament { stroke: #F2A93B; filter: url(#sw-glow); }
.shift-success .sw-rays { opacity: 1; animation: sw-rays 6s linear infinite, sw-rays-in .5s cubic-bezier(.34,1.45,.64,1); }
@keyframes sw-rays { to { rotate: 30deg; } }
@keyframes sw-rays-in { from { scale: .6; } }
.shift-success .shift-glow { opacity: .22; }
/* Авария: лампа трижды мигает и гаснет (одновременно с ударом пресса), на колбе трещины. */
.shift-accident .sw-glass { fill: #DDE2EA; animation: sw-flicker .22s steps(2) 1; }
.shift-accident .sw-crack { opacity: 1; transition: opacity .1s .18s; }
@keyframes sw-flicker { 50% { fill: #FFF6D8; } }

/* Кнопки-розетки: вилка кабеля входит в паз сверху; разрезанная — гаснет, зачёркивается линией. */
.sw-rig .shift-wire-button { overflow: visible; border: 1.5px solid #C9D3F5; border-radius: .7rem; background: var(--surface, #FCFDFF); box-shadow: 0 3px 0 #DCE3FB; color: var(--ink, #10141C); transition: opacity .35s ease, scale .15s ease, border-color .3s ease, box-shadow .3s ease, background-color .3s ease, color .3s ease; }
.sw-rig .shift-wire-button::before { content: ''; position: absolute; left: 50%; top: -1px; width: 1.15rem; height: .3rem; margin-left: -.575rem; border-radius: 0 0 .2rem .2rem; background: #10141C; opacity: .85; }
.sw-rig .shift-wire-button span { position: relative; display: inline-block; }
.sw-rig .shift-wire-button span::after { content: ''; position: absolute; left: -.1rem; right: -.1rem; top: 52%; height: 2px; border-radius: 1px; background: var(--sw-bad); transform: scaleX(0); transform-origin: 0 50%; transition: transform .34s cubic-bezier(.6,0,.3,1) .08s; }
.sw-rig .shift-wire-button.is-cut { text-decoration: none; opacity: .45; translate: -50% 2px; box-shadow: 0 1px 0 #DCE3FB; }
.sw-rig .shift-wire-button.is-cut span::after { transform: scaleX(1); }
.sw-rig .shift-wire-button.is-cut::before { opacity: .25; }
.sw-rig .shift-wire-button.is-dim { opacity: .35; }
.sw-rig .shift-wire-button.is-live { border-color: var(--sw-blue); background: #EEF3FF; color: var(--sw-blue); box-shadow: 0 3px 0 #C9D6FF, 0 0 0 4px rgba(106,144,255,.18), 0 0 18px rgba(106,144,255,.35); }
.sw-rig .shift-wire-button.is-answer { border-color: var(--sw-blue); box-shadow: 0 3px 0 #C9D6FF, 0 0 0 3px rgba(106,144,255,.25); animation: sw-answer 1s ease-in-out infinite alternate; }
@keyframes sw-answer { to { box-shadow: 0 3px 0 #C9D6FF, 0 0 0 6px rgba(106,144,255,.08); } }

@media (prefers-reduced-motion: reduce) {
  .sw-rig *, .sw-rig *::before, .sw-rig *::after { animation: none !important; transition: none !important; }
  .shift-wire.is-cut .wire-end { opacity: 0; }
}
