.boss {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: #050506;
  color: #e9e4d4;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.boss.an {
  display: block;
  animation: bo-auf 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes bo-auf {
  from { clip-path: inset(50% 0 50% 0); }
  to   { clip-path: inset(0 0 0 0); }
}
html.im-boss-kreuz .boss, html.im-boss-kreuz .boss * { cursor: none; }

:root.im-boss-kreuz:not(.pflicht-auf):not(.ist-tot) body .fadenkreuz { visibility: visible !important; z-index: 37; opacity: 1; }
html.im-boss .rechtlich { z-index: 36; }

.bo-arena { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bo-arena.wackelt { animation: bo-wackel 320ms ease-out; }
@keyframes bo-wackel {
  0%   { translate: 0 0; }
  20%  { translate: var(--wackel, 6px) calc(var(--wackel, 6px) * -0.6); }
  45%  { translate: calc(var(--wackel, 6px) * -0.8) calc(var(--wackel, 6px) * 0.5); }
  70%  { translate: calc(var(--wackel, 6px) * 0.4) 0; }
  100% { translate: 0 0; }
}

.bo-kopf {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + clamp(10px, 2vh, 20px));
  left: clamp(14px, 2vw, 34px);
  right: clamp(14px, 2vw, 34px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.bo-name b {
  display: block;
  font-size: clamp(0.8rem, 1.3vw, 1.05rem);
  letter-spacing: 0.3em;
  color: var(--boss-farbe, #e9e4d4);
  margin-bottom: 6px;
}
.bo-leiste { display: flex; gap: 6px; }
.bo-leiste i {
  --voll: 1;
  display: block;
  width: clamp(70px, 11vw, 150px);
  height: 12px;
  border: 2px solid rgba(233, 228, 212, 0.55);
  border-radius: 3px;
  background:
    linear-gradient(90deg, var(--boss-farbe, #d0402c) calc(var(--voll) * 100%), rgba(0, 0, 0, 0.55) calc(var(--voll) * 100%));
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}
.bo-du { text-align: right; }
.bo-leben { display: flex; gap: 4px; justify-content: flex-end; }
.bo-leben i {
  width: 24px; height: 22px;
  background: #e2413a;
  clip-path: path('M12 21 L2.5 11.5 A5.4 5.4 0 0 1 12 4.2 A5.4 5.4 0 0 1 21.5 11.5 Z');
}
.bo-leben i.weg { background: rgba(233, 228, 212, 0.18); }
.boss.geschuetzt .bo-leben i.voll { animation: bo-blinken 200ms steps(2) infinite; }
@keyframes bo-blinken { 50% { opacity: 0.35; } }
.bo-chancen {
  display: block;
  margin-top: 6px;
  font-size: clamp(0.62rem, 0.9vw, 0.78rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #b9b3a2;
}

.bo-zeile {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + clamp(64px, 10vh, 96px));
  left: 50%;
  translate: -50% 0;
  max-width: min(92vw, 760px);
  margin: 0;
  padding: 8px 16px;
  text-align: center;
  font-size: clamp(0.8rem, 1.2vw, 1rem);
  background: rgba(10, 10, 12, 0.72);
  border: 1px solid rgba(233, 228, 212, 0.2);
  border-radius: 4px;
  pointer-events: none;
  clip-path: inset(0 50% 0 50%);
  transition: clip-path 180ms ease-out;
}
.bo-zeile.an { clip-path: inset(0 0 0 0); }

.boss[data-art="maschine"] .bo-zeile { top: auto; bottom: 21%; }

.boss::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 0 rgba(226, 65, 58, 0);
}
.boss.autsch::after { animation: bo-autsch 520ms ease-out; }
@keyframes bo-autsch {
  0%   { box-shadow: inset 0 0 120px 40px rgba(226, 65, 58, 0.75); }
  100% { box-shadow: inset 0 0 0 0 rgba(226, 65, 58, 0); }
}

.bo-blatt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}
.bo-blatt[hidden] { display: none; }
.bo-blatt > div {
  max-width: min(92vw, 520px);
  padding: clamp(18px, 3vw, 30px);
  text-align: center;
  background: #16171a;
  border: 2px solid var(--boss-farbe, #e9e4d4);
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
}
.bo-blatt b {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  letter-spacing: 0.25em;
  color: var(--boss-farbe, #e9e4d4);
  margin-bottom: 12px;
}
.bo-blatt[data-art="nochmal"] b { color: #e2413a; }
.bo-blatt span { display: block; line-height: 1.5; margin-bottom: 20px; }
.bo-blatt button {
  font: inherit;
  font-size: 1rem;
  letter-spacing: 0.12em;
  padding: 10px 22px;
  color: #16171a;
  background: var(--boss-farbe, #e9e4d4);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.bo-blatt button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.boss[data-art="ubahn"] .bo-arena * { transform-box: view-box; }

.bu-koenigin.lauert .ub-leib, .bu-koenigin.lauert .bu-schein, .bu-koenigin.lauert .ub-kschatten { opacity: 0; }
.bu-koenigin .ub-glut { opacity: 0.7; transform-origin: 92px -56px; transition: transform 150ms, opacity 150ms; }
.bu-koenigin.droht .ub-glut { opacity: 1; transform: scale(1.9); }
.bu-koenigin .ub-xauge { display: none; }
.bu-koenigin.betaeubt .ub-xauge { display: inline; }
.bu-koenigin.betaeubt .ub-augapfel, .bu-koenigin.betaeubt .ub-glut { display: none; }
.ub-atem { transform-origin: 0 0; animation: ub-atmen 1.7s ease-in-out infinite; }
@keyframes ub-atmen { 50% { transform: scale(1.012, 1.035); } }
.bu-koenigin.rennt .ub-atem { animation: ub-galopp 0.26s ease-in-out infinite alternate; }
@keyframes ub-galopp { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-8px) rotate(2deg); } }
.ub-kschwanz { transform-origin: -56px -30px; animation: ub-schwanz 2.4s ease-in-out infinite alternate; }
@keyframes ub-schwanz { from { transform: rotate(-5deg); } to { transform: rotate(6deg); } }
.bu-koenigin.ub-getroffen .ub-leib { animation: ub-weiss 220ms ease-out; }
@keyframes ub-weiss { from { filter: brightness(2.6) saturate(0.3); } to { filter: none; } }
.ub-funkel { animation: ub-funkeln 2.4s ease-in-out infinite; }
@keyframes ub-funkeln { 0%, 68%, 100% { opacity: 0; } 80% { opacity: 1; } }

.ub-hoch { animation: ub-auftauchen 240ms cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes ub-auftauchen { from { transform: translateY(48px); } }
.bu-fenster.flackert { animation: bu-flacker 110ms steps(2) infinite; }
@keyframes bu-flacker { 50% { fill: #5f9a2a; } }

.ub-rkoerper { animation: ub-hops 0.16s ease-in-out infinite alternate; animation-delay: var(--v, 0s); }
@keyframes ub-hops { to { transform: translateY(-2px); } }
.ub-rschwanz { transform-origin: -14px -8px; animation: ub-wedel 0.42s ease-in-out infinite alternate; animation-delay: var(--v, 0s); }
@keyframes ub-wedel { from { transform: rotate(-10deg); } to { transform: rotate(8deg); } }
.ub-rbein.a { animation: ub-trippel 0.16s linear infinite alternate; animation-delay: var(--v, 0s); }
.ub-rbein.b { animation: ub-trippel 0.16s linear infinite alternate-reverse; animation-delay: var(--v, 0s); }
@keyframes ub-trippel { from { transform: rotate(-30deg); } to { transform: rotate(30deg); } }
.ub-ratte.ub-tot * { animation: none; }

.ub-flacker { animation: ub-flackern 5.3s steps(1) infinite; }
@keyframes ub-flackern { 0%, 61%, 64%, 67%, 100% { opacity: 1; } 62%, 65% { opacity: 0.2; } 88% { opacity: 0.75; } }
.ub-lampen.ub-zittern .ub-lampe { animation: ub-zittern 0.8s steps(8); }
@keyframes ub-zittern { 12%, 37%, 62% { opacity: 0.12; } 25%, 50%, 75% { opacity: 1; } }
.ub-staubkorn { animation: ub-schweben var(--d, 9s) ease-in-out infinite alternate; animation-delay: var(--v, 0s); }
@keyframes ub-schweben { to { transform: translate(var(--dx, 10px), var(--dy, 10px)); } }
.ub-augenpaar { opacity: var(--o, 0.8); animation: ub-blinzeln 4.2s steps(1) infinite; animation-delay: var(--v, 0s); }
@keyframes ub-blinzeln { 93%, 96% { opacity: 0; } }
.ub-giftnebel { transform-origin: 70px 590px; animation: ub-wabern 3.4s ease-in-out infinite alternate; }
@keyframes ub-wabern { from { opacity: 0.6; } to { opacity: 1; transform: scale(1.12, 1.05); } }
.ub-signal { animation: ub-signal 1.2s steps(1) infinite; }
@keyframes ub-signal { 50% { opacity: 0.15; } }
.ub-sekunde { transform-origin: 800px 172px; animation: ub-sekunde 60s steps(60) infinite; }
@keyframes ub-sekunde { to { transform: rotate(360deg); } }

.boss[data-art="bank"] .bo-arena * { transform-box: view-box; }
.bb-sirene.an { animation: bb-sirene 260ms steps(2) infinite; }
@keyframes bb-sirene { 0% { fill: #ff3a26; } 50% { fill: #6b1c14; } }

.bb-sirenenlicht, .bb-drehlicht { opacity: 0; }
.bb-robo.heult .bb-sirenenlicht, .bb-warnlampen.an .bb-drehlicht { opacity: 1; animation: bb-drehen 0.7s linear infinite; }
@keyframes bb-drehen { to { transform: rotate(360deg); } }
.bb-warnlampen.an .bb-kuppel { fill: #ff3a26; }

.bb-rotlicht { transition: opacity 120ms; }
.bb-rotlicht.an { animation: bb-rotpuls 0.52s ease-in-out infinite alternate; }
@keyframes bb-rotpuls { from { opacity: 0.04; } to { opacity: 0.2; } }

.bb-vorschau { fill: rgba(255, 40, 30, 0.2); stroke: #ff4a36; stroke-width: 3; stroke-dasharray: 14 10; }

.bb-ring.gruen .bb-ringbogen { stroke-width: 12; }
.bb-ring.rot { animation: bb-ruck 0.28s steps(3); }
@keyframes bb-ruck { 33% { transform: translate(-5px, 2px); } 66% { transform: translate(5px, -2px); } }
.bb-lampe.bereit { stroke: #eaffea; }

.bb-robo.faehrt .bb-kette { animation: bb-kette 0.5s linear infinite; }
.bb-robo.faehrt.zurueck .bb-kette { animation-direction: reverse; }
@keyframes bb-kette { to { stroke-dashoffset: -28; } }
.bb-robo.faehrt .bb-rolle { animation: bb-rolle 0.9s linear infinite; }
.bb-robo.faehrt.zurueck .bb-rolle { animation-direction: reverse; }
@keyframes bb-rolle { to { transform: rotate(360deg); } }
.bb-gesicht { color: #48d06a; }
.bb-dunkel { transition: opacity 1.6s ease-out 0.4s; }
.bb-dunkel.feierabend { opacity: 0.25; }
.bb-robo.alarm .bb-mund { d: path('M-16 540 Q0 528 16 540'); }
.bb-funke { animation: bb-funke 1.3s steps(1) infinite; }
.bb-robo.alarm .bb-funke { animation-duration: 0.25s; }
@keyframes bb-funke { 50% { opacity: 0.15; } }
.bb-kamera { animation: bb-funke 2s steps(1) infinite; }

.boss[data-art="maschine"] .bo-arena * { transform-box: view-box; }
.bm-kern.ueber { animation: bm-zittern 90ms linear infinite; }
@keyframes bm-zittern { 0% { translate: -3px 1px; } 50% { translate: 3px -1px; } 100% { translate: -2px 2px; } }
.bm-rad-a { animation: bm-drehen 26s linear infinite; }
.bm-rad-b { animation: bm-drehen 16s linear infinite reverse; }
@keyframes bm-drehen { to { transform: rotate(360deg); } }
.bm-flacker { animation: ub-flackern 4.7s steps(1) infinite; }
.bm-feuer { animation: bm-feuer 0.9s ease-in-out infinite alternate; transform-origin: 800px 438px; }
@keyframes bm-feuer { from { transform: scale(0.92); opacity: 0.7; } to { transform: scale(1.06); opacity: 0.95; } }
.bm-staubkorn { animation: ub-schweben var(--d, 9s) ease-in-out infinite alternate; animation-delay: var(--v, 0s); }

.bm-fluss { transition: opacity 160ms; animation: bm-fluss 0.5s linear infinite; }
@keyframes bm-fluss { to { stroke-dashoffset: -56; } }
.bm-ventil.haelt .bm-radkranz { stroke: #b32e1e; }

.bm-ventil.glueht .bm-radkranz { stroke: #ff5a1a; animation: bm-gluehen 0.4s ease-in-out infinite alternate; }
.bm-ventil.glueht .bm-radlicht { stroke: #ffd27a; }
@keyframes bm-gluehen { to { stroke: #ffb04a; } }
.bm-rauch circle { opacity: 0; }
.bm-ventil.glueht .bm-rauch circle { animation: bm-rauch 1.8s ease-out infinite; animation-delay: var(--v, 0s); }
@keyframes bm-rauch { 0% { opacity: 0.55; transform: translate(0, 0) scale(0.6); } 100% { opacity: 0; transform: translate(10px, -110px) scale(1.8); } }

.bm-hand { transition: opacity 400ms; }
.bm-hand.weg { opacity: 0; }
.bm-hand-drueck { animation: bm-drueck 1.6s ease-in-out infinite; }
@keyframes bm-drueck { 0%, 100% { transform: translate(0, -14px); } 20%, 80% { transform: translate(0, 0); } }
.bm-hand-ring { animation: bm-halten 1.6s linear infinite; }
@keyframes bm-halten { 0%, 20% { stroke-dashoffset: 540; opacity: 1; } 80% { stroke-dashoffset: 0; opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }

.bm-ziel { animation: bm-zielpuls 0.7s ease-in-out infinite alternate; }
.bm-ziel.drin { animation: none; opacity: 0.35; }
@keyframes bm-zielpuls { from { opacity: 0.45; } to { opacity: 1; } }

.bm-fort { transition: stroke 200ms; }
.bm-fort.voll { stroke: #fff4c0; animation: bm-zielpuls 0.3s ease-in-out infinite alternate; }

.bm-rissziel { animation: bm-drehen 3s linear infinite; transform-origin: 0px 0px; }

.bm-spur { animation: bm-weg 260ms ease-out forwards; }
.bm-knall { animation: bm-knall 420ms ease-out forwards; }
@keyframes bm-knall { from { opacity: 1; } to { opacity: 0; } }
@keyframes bm-weg { from { opacity: 0.95; } to { opacity: 0; } }
.bm-bolzen { animation: bm-weg 600ms ease-in 900ms forwards; }
.bm-funken path { animation: bm-funke 600ms ease-out forwards; }
@keyframes bm-funke { to { transform: translate(var(--fx), var(--fy)); opacity: 0; } }
.bm-treffer circle { animation: bm-knall 520ms ease-out forwards; }

.bm-wolke { animation: bm-wabern 0.7s ease-in-out infinite alternate; animation-delay: var(--v, 0s); }
@keyframes bm-wabern { from { transform: translate(-8px, 3px); } to { transform: translate(10px, -4px); } }
.bm-vorschau .bm-laufband { animation: bb-kette 0.4s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .boss.an { animation: none; }
  .bo-arena.wackelt, .bm-kern.ueber { animation: none; }
  .bm-rad-a, .bm-rad-b, .bm-flacker, .bm-feuer, .bm-staubkorn, .bm-fluss, .bm-wolke, .bm-rissziel, .bm-vorschau .bm-laufband { animation: none; }
  .bm-hand-drueck, .bm-hand-ring { animation: none; stroke-dashoffset: 0; }
  .bu-fenster.flackert { animation: none; fill: #5f9a2a; }
  .ub-atem, .ub-kschwanz, .ub-funkel, .ub-rkoerper, .ub-rschwanz, .ub-rbein, .ub-flacker, .ub-staubkorn,
  .ub-augenpaar, .ub-giftnebel, .ub-signal, .ub-sekunde, .ub-hoch, .bu-koenigin.rennt .ub-atem { animation: none; }
  .bb-robo.heult .bb-sirenenlicht, .bb-warnlampen.an .bb-drehlicht, .bb-robo.faehrt .bb-kette,
  .bb-robo.faehrt .bb-rolle, .bb-funke, .bb-kamera, .bb-ring.rot { animation: none; }
  .bb-rotlicht.an { opacity: 0.14; }
}
