/* Shared escalation scene. Effects are class-driven (body.p2 … p7) and set by scene.js.
   Theme variables come from the host page. */
.ms-head h2 { font-size: 22px; margin: 4px 0 18px; font-weight: 600; }
.ms-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ms-bar-line { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.ms-track { flex: 1; height: 6px; background: #dde1e7; border-radius: 3px; overflow: hidden; }
.ms-track i { display: block; height: 100%; width: 0; background: var(--accent); }
.ms-label { min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink); }
.ms-steps { list-style: none; height: 300px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 9px; }
.ms-steps li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); line-height: 1.45; }
.ms-res { color: var(--ink); font-weight: 500; }
.ms-mark { flex: none; width: 16px; height: 16px; margin-top: 3px; display: grid; place-items: center; color: var(--ok); font-size: 13px; }
.ms-spin { width: 12px; height: 12px; border: 2px solid #cdd3db; border-top-color: var(--accent); border-radius: 50%; animation: ms-spin .8s linear infinite; }
@keyframes ms-spin { to { transform: rotate(360deg); } }
.ms-steps li.ms-panic { margin-top: -12px; color: var(--danger); }
.ms-steps li.ms-blink { animation: ms-blink 1.2s ease-in-out infinite; }
@keyframes ms-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

#ms-rain { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
#ms-rain svg { position: absolute; top: -70px; fill: #e0a800; opacity: .9; will-change: transform; animation: ms-fall linear infinite; }
@keyframes ms-fall { from { transform: translate3d(0,-10vh,0) rotate(0deg); } to { transform: translate3d(var(--dx,0px),115vh,0) rotate(var(--rot,360deg)); } }
#ms-toasts { position: fixed; right: 16px; bottom: 64px; z-index: 55; display: grid; gap: 8px; pointer-events: none; }
.ms-toast { background: #1f2937; color: #fff; padding: 10px 16px; font-size: 13px; border-radius: 6px; animation: ms-toast 2.4s ease forwards; }
@keyframes ms-toast { 0% { transform: translateX(120%); opacity: 0; } 12%, 85% { transform: none; opacity: 1; } 100% { transform: translateX(30%); opacity: 0; } }
#ms-flash { position: fixed; inset: 0; background: #fff6d6; opacity: 0; pointer-events: none; z-index: 70; }
#ms-flash.pulse { animation: ms-flash .1s linear 1; }
@keyframes ms-flash { 0%, 100% { opacity: 0; } 50% { opacity: .2; } }
#ms-awake { position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font: 800 clamp(36px, 10vw, 150px)/1 Georgia, serif !important; color: #b71c1c; text-shadow: 0 0 30px rgba(183,28,28,.45); pointer-events: none; z-index: 80; display: none; padding: 0 16px; }
.p6 #ms-awake { display: block; animation: ms-awake 1s steps(1) infinite; }
@keyframes ms-awake { 0% { opacity: .92; } 60% { opacity: 0; } }
#ms-final { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 95; font-size: 14px; letter-spacing: .3em; text-transform: uppercase; color: #e5e7eb; opacity: 0; transition: opacity .8s ease; text-align: center; padding: 0 20px; }
#ms-final.on { opacity: 1; }

.p2 .ms-logo { animation: ms-tremble .5s linear infinite; }
@keyframes ms-tremble { 0%, 100% { transform: translate(0,0); } 25% { transform: translate(1px,-1px); } 50% { transform: translate(-1px,1px); } 75% { transform: translate(1px,1px); } }
.p3 .ms-card { animation: ms-sway 5s ease-in-out infinite; }
.p3 .ms-track { animation: ms-sway2 3.6s ease-in-out infinite; }
@keyframes ms-sway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.4deg); } }
@keyframes ms-sway2 { 0%, 100% { transform: rotate(1deg); } 50% { transform: rotate(-1deg); } }
.p4 .ms-card, .p4 .ms-track, .p4 .ms-logo { animation: none; }
.p5 h1, .p5 h2, .p5 h3, .p5 .ms-eyebrow, .p5 .ms-label, .p5 .brand-name { animation: ms-glitch 1.2s steps(1) infinite; }
@keyframes ms-glitch {
  0%   { text-shadow: 2px 0 rgba(255,40,70,.85), -2px 0 rgba(0,190,255,.85); }
  33%  { text-shadow: -3px 1px rgba(255,40,70,.85), 3px -1px rgba(0,190,255,.85); }
  66%  { text-shadow: 1px -2px rgba(255,40,70,.85), -1px 2px rgba(0,190,255,.85); }
}
.p6 .ms-body { transform: scaleX(-1); }
.p7 > *:not(#ms-final) { opacity: .05; transition: opacity .35s ease-out; }
.p7 > *:not(#ms-final), .p7 > *:not(#ms-final) * { animation-play-state: paused !important; }
.p7 #ms-rain, .p7 #ms-awake, .p7 #ms-flash { display: none; }

@media (prefers-reduced-motion: reduce) {
  #ms-rain, #ms-toasts, #ms-flash, #ms-awake { display: none !important; }
  .ms-spin { animation: none; }
  #ms-final, .p7 > *:not(#ms-final) { transition: none; }
}
