:root {
  --red: #c8102e;
  --red-dark: #9a0c23;
  --cream: #f3e9d2;
  --paper: #fbf5e7;
  --ink: #1d1a17;
  --ink-soft: #5a524a;
  --gold: #e3b53b;
  --olive: #5d6b3c;
  --line: rgba(29, 26, 23, .14);
  --good: #2f8a4f;
  --shadow: 0 2px 0 var(--ink);
  --display: 'Black Han Sans', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  --body: 'Noto Sans KR', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #2a2420;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 18px 18px;
  font-family: var(--body);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

.app {
  position: relative;
  max-width: 440px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  overflow: hidden;
  box-shadow: 0 0 0 3px var(--ink), 0 20px 60px rgba(0, 0, 0, .5);
}

/* ---------- HUD ---------- */
.hud {
  background: var(--red);
  color: var(--cream);
  padding: 10px 14px 10px;
  padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 3px solid var(--ink);
}
.hud-top { display: flex; align-items: center; gap: 6px; }
.title {
  flex: 1; margin: 0;
  font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: .5px;
  line-height: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0;
}
.title small { font-family: var(--body); font-size: 11px; font-weight: 700; opacity: .8; white-space: nowrap; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px;
  border: 2px solid var(--ink); background: var(--cream); color: var(--ink);
  font-size: 16px; line-height: 1; cursor: pointer; box-shadow: var(--shadow);
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }
.hud-stats { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 8px; }
.stat { display: flex; flex-direction: column; }
.stat-right { align-items: flex-end; }
.stat-label { font-size: 11px; font-weight: 700; opacity: .85; }
.stat-value { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.05; color: #fff3c4; text-shadow: 2px 2px 0 var(--ink); }
.stat-value.small { font-size: 20px; color: var(--cream); }
.stat-value.bump { animation: bump .25s ease-out; }
@keyframes bump { 40% { transform: scale(1.12); } }

.crack { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 700; }
.crack-label { white-space: nowrap; }
.crack-bar { flex: 1; height: 12px; border-radius: 6px; background: var(--red-dark); border: 2px solid var(--ink); overflow: hidden; }
.crack-bar i {
  display: block; height: 100%; width: 0%;
  background: repeating-linear-gradient(-45deg, var(--gold) 0 8px, #f7d77a 8px 16px);
  transition: width .4s ease;
}
.crack b { font-family: var(--display); font-weight: 400; font-size: 16px; min-width: 40px; text-align: right; }

/* ---------- 무대 ---------- */
.stage {
  position: relative;
  flex: 0 0 auto;
  height: clamp(300px, 46dvh, 440px);
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
  touch-action: manipulation;
}
.bg, .bg svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.alarm { animation: alarm 1.2s ease-in-out infinite; }
@keyframes alarm { 50% { opacity: .45; } }
/* 체제 균열 도트 그림: 배경과 같은 방식(cover)으로 깔아 중심이 맞게. 금 속 빛이 살짝 번져요 */
.crackimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none;
  filter: drop-shadow(0 0 1px #ffe6a8) drop-shadow(0 0 4px rgba(255, 186, 70, .85)); }
.crackimg.grow { animation: crack-grow .7s ease-out; }
@keyframes crack-grow {
  0% { filter: brightness(2.2) drop-shadow(0 0 2px #fff3c4) drop-shadow(0 0 8px #ffd27a); }
  100% { filter: drop-shadow(0 0 1px #ffe6a8) drop-shadow(0 0 4px rgba(255, 186, 70, .85)); }
}

.stage-top {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; z-index: 3;
}
.chapter-tag {
  background: var(--ink); color: var(--cream);
  font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  white-space: nowrap;
}
.chapter-tag b { color: var(--gold); font-weight: 900; }
.rank-steps { display: flex; gap: 5px; align-items: center; background: rgba(251, 245, 231, .9); border: 2px solid var(--ink); border-radius: 999px; padding: 4px 8px; }
.rank-steps i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; display: block; }
.rank-steps i.done { background: var(--ink); }
.rank-steps i.now { background: var(--gold); animation: pulse 1s ease-in-out infinite; }
.rank-steps i.boss { width: 18px; height: 14px; border-radius: 4px; background: var(--red); position: relative; }
.rank-steps i.boss.now { background: var(--gold); }
@keyframes pulse { 50% { transform: scale(1.3); } }

.px { image-rendering: pixelated; image-rendering: crisp-edges; -webkit-user-drag: none; }
.enemy-wrap {
  position: absolute; left: 50%; top: 52px; bottom: 70px; transform: translateX(-50%);
  aspect-ratio: 1 / 1; max-width: 84%; z-index: 4;
}
.enemy-wrap::after {
  content: ''; position: absolute; left: 24%; right: 24%; bottom: 0.5%; height: 6%;
  background: rgba(0, 0, 0, .28); border-radius: 50%; z-index: -1;
}
.enemy {
  position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  transform-origin: 50% 100%;
}
.enemy .body { position: absolute; inset: 0; display: block; transform-origin: 50% 100%; }
.enemy .char { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
/* 평소 얼굴과 맞은 얼굴을 겹쳐 두고 class 로 바꿔요 */
.enemy .char.h { visibility: hidden; }
.enemy.hurt .char.h, .enemy.flinch .char.h { visibility: visible; }
.enemy.hurt .char.n, .enemy.flinch .char.n { visibility: hidden; }
.enemy.boss .char { transform: scale(1.08); transform-origin: 50% 100%; }
.enemy .ko-stars { position: absolute; left: 22%; width: 56%; top: -4%; overflow: visible; }
.enemy.tremble .char { animation: tremble .12s linear infinite; }
@keyframes tremble { 25% { translate: -2px 0; } 75% { translate: 2px 0; } }
.bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fxs {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none;
  background-repeat: no-repeat; background-position: 0 0; image-rendering: pixelated;
}
@keyframes fxplay { from { background-position-x: 0; } to { background-position-x: var(--endx); } }
/* ---------- 타격감 ---------- */
.enemy .char { transform-origin: 50% 100%; }
/* 숨쉬기(반복 움직임)는 '애니메이션 줄이기'가 꺼져 있을 때만 */
@media (prefers-reduced-motion: no-preference) {
  .enemy .char { animation: idle 1.8s ease-in-out infinite; }
  .enemy.boss .char { animation: idle-boss 1.8s ease-in-out infinite; }
}
@keyframes idle { 50% { transform: scale(1.012, 1.02); } }
@keyframes idle-boss { 0%, 100% { transform: scale(1.08); } 50% { transform: scale(1.09, 1.1); } }
/* 맞는 몸짓은 game.js 의 react() (Web Animations) 가 .body 에 줘요 */
/* 체력 30% 아래: 비틀비틀 (게임 정보라서 '애니메이션 줄이기'에서도 유지) */
.enemy.groggy .char { animation: groggy 1.4s ease-in-out infinite; }
.enemy.boss.groggy .char { animation: groggy-boss 1.4s ease-in-out infinite; }
@keyframes groggy { 0%, 100% { transform: rotate(-2.5deg) translateX(-3px); } 50% { transform: rotate(2.5deg) translateX(3px) scale(1, .985); } }
@keyframes groggy-boss { 0%, 100% { transform: scale(1.08) rotate(-2.5deg) translateX(-3px); } 50% { transform: scale(1.08, 1.065) rotate(2.5deg) translateX(3px); } }
.fx .sweat {
  position: absolute; width: 8px; height: 11px; pointer-events: none; z-index: 3;
  background: #dff4ff; border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%; box-shadow: inset -2px -2px 0 #8fc6e8, 0 0 0 1.5px var(--ink);
}
.enemy.freeze { filter: brightness(3) contrast(1.4) saturate(0) !important; animation: none !important; }
.enemy.freeze .char { animation-play-state: paused; }
.stage.shake-s { animation: shake-s .12s linear; }
@keyframes shake-s { 33% { transform: translate(-2px, 1px); } 66% { transform: translate(2px, -1px); } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 7; }
.flash.on { animation: flash .18s ease-out; }
@keyframes flash { 0% { opacity: .55; } 100% { opacity: 0; } }

.fx .glove { position: absolute; width: 58px; height: 58px; transform: translate(-50%, -50%); animation: glove .26s ease-out forwards; z-index: 2; }
.fx .glove.big { width: 88px; height: 88px; }
@keyframes glove {
  0% { transform: translate(calc(-50% + var(--gx)), -10%) scale(1.7) rotate(-20deg); opacity: .4; }
  35% { transform: translate(-50%, -50%) scale(.9) rotate(0); opacity: 1; }
  55% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.8); opacity: 0; }
}
.fx .debris { position: absolute; width: 30px; height: 30px; transform: translate(-50%, -50%); animation: debris .9s cubic-bezier(.3, 0, .7, 1) forwards; }
@keyframes debris {
  0% { transform: translate(-50%, -50%) rotate(0); }
  35% { transform: translate(calc(-50% + var(--dx) * .5), calc(-50% - 70px)) rotate(calc(var(--rr) * .4)); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rr)); opacity: 0; }
}
.fx .capfly { position: absolute; width: 64px; height: 64px; transform: translate(-50%, -50%); animation: capfly 1s cubic-bezier(.2, .6, .6, 1) forwards; }
@keyframes capfly {
  0% { transform: translate(-50%, -50%) rotate(0); }
  40% { transform: translate(calc(-50% + var(--dx) * .6), calc(-50% - 120px)) rotate(400deg); }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + 60px)) rotate(720deg); opacity: 0; }
}
.ko-stamp {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) rotate(-10deg);
  font-family: var(--display); font-size: 64px; color: #ffd23a; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  text-shadow: 5px 5px 0 var(--red); animation: stamp .9s ease-out forwards; white-space: nowrap; z-index: 3;
}
@keyframes stamp {
  0% { transform: translate(-50%, -50%) rotate(-10deg) scale(3); opacity: 0; }
  18% { transform: translate(-50%, -50%) rotate(-10deg) scale(.9); opacity: 1; }
  28% { transform: translate(-50%, -50%) rotate(-10deg) scale(1.05); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -60%) rotate(-10deg) scale(1); opacity: 0; }
}
.combo {
  position: absolute; right: 10px; top: 48px; z-index: 6; text-align: right; pointer-events: none;
  font-family: var(--display); color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--ink); opacity: 0; transition: opacity .2s;
}
.combo.on { opacity: 1; }
.combo b { font-weight: 400; font-size: 34px; color: #ffd23a; }
.combo small { display: block; font-family: var(--body); font-weight: 900; font-size: 11px; -webkit-text-stroke: 0; text-shadow: 1px 1px 0 var(--ink); }
.combo.pop b { display: inline-block; animation: cpop .18s ease-out; }
@keyframes cpop { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
.dmg.ouch { font-family: var(--body); font-weight: 900; font-size: 16px; color: #fff; background: var(--red); border: 2px solid var(--ink); border-radius: 8px; padding: 1px 7px; -webkit-text-stroke: 0; text-shadow: none; }
.hpbar.jolt { animation: jolt .12s linear; }
@keyframes jolt { 50% { transform: translateX(2px); } }

/* 동료별 특화 공격 (움직임은 game.js 의 Web Animations) */
.fx .wpn { position: absolute; pointer-events: none; z-index: 3; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .45)); }
.fx .wave {
  position: absolute; width: 34px; height: 34px; border-radius: 50%; pointer-events: none;
  border: 6px solid #e08a1e; border-left-color: transparent !important; border-bottom-color: transparent !important;
  box-shadow: 0 0 0 2px var(--ink), 0 0 10px #fff3c4; z-index: 3;
}
.fx .drop { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: #e9c46a; box-shadow: inset -2px -2px 0 #b5852f, 0 0 0 1.5px var(--ink); }
.fx .shock { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 5px solid #fff; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink); }
.fx .chunk { position: absolute; width: 11px; height: 9px; background: #2b2b2e; box-shadow: inset 2px 2px 0 #55555c, 0 0 0 1px #000; }
.enemy.glitch .char { animation: glitch .32s steps(2) 1; }
@keyframes glitch {
  0% { filter: drop-shadow(-6px 0 0 #ff0040) drop-shadow(6px 0 0 #00e5ff); transform: translateX(4px); clip-path: inset(10% 0 55% 0); }
  25% { filter: drop-shadow(5px 0 0 #ff0040) drop-shadow(-5px 0 0 #00e5ff) hue-rotate(90deg); transform: translateX(-6px); clip-path: inset(40% 0 20% 0); }
  50% { filter: drop-shadow(-4px 0 0 #00ff66) contrast(2); transform: translateX(3px); clip-path: inset(0 0 70% 0); }
  75% { filter: drop-shadow(6px 0 0 #ff0040) drop-shadow(-6px 0 0 #00e5ff); transform: translateX(-2px); clip-path: inset(60% 0 0 0); }
  100% { filter: none; transform: none; clip-path: none; }
}
.dmg.err { font-family: 'Courier New', monospace; font-weight: 900; font-size: 16px; color: #39ff88; background: #0b0f0b; border: 2px solid #39ff88; padding: 1px 6px; -webkit-text-stroke: 0; text-shadow: 0 0 6px #39ff88; }
.dmg.tick { font-family: var(--body); font-weight: 900; font-size: 15px; color: #ff8a1e; -webkit-text-stroke: 1px var(--ink); }
.dmg.truth { font-size: 22px; color: #fff3c4; -webkit-text-stroke: 1.5px var(--ink); text-shadow: 0 0 10px #e08a1e, 2px 2px 0 var(--ink); }

/* (이전) 동료 돌진 — 쓰지 않음 */
.fx .dash {
  position: absolute; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  border: 3px solid var(--ink); background: var(--c); overflow: hidden;
  box-shadow: 0 0 0 3px var(--c), -10px 0 14px var(--c);
  animation: dash .42s cubic-bezier(.5, 0, .3, 1) forwards; z-index: 3;
}
.fx .dash img { width: 100%; height: 100%; display: block; }
@keyframes dash {
  0% { transform: translate(0, 0) scale(1); }
  31% { transform: translate(var(--tx), var(--ty)) scale(1.5) rotate(15deg); }
  45% { transform: translate(calc(var(--tx) * .9), calc(var(--ty) * .9)) scale(1.3) rotate(-10deg); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0; }
}
.fx .ring {
  position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%;
  border: 5px solid var(--c); box-shadow: 0 0 0 2px var(--ink); animation: ring .38s ease-out forwards;
}
@keyframes ring { to { transform: scale(5); opacity: 0; border-width: 1px; } }
.enemy.enter { animation: enter .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes enter { from { transform: translateY(30px) scale(.6); opacity: 0; } }
.enemy.dead { animation: flyoff .5s ease-in forwards; pointer-events: none; }
@keyframes flyoff { to { transform: translate(140%, -70%) rotate(540deg) scale(.4); opacity: 0; } }
.ko-stars { animation: spin 1s linear infinite; transform-origin: center; }
.card .pic img, .squad .mate img, .toast .pic img { width: 100%; height: 100%; display: block; object-fit: cover; }
@keyframes spin { to { transform: rotate(360deg); } }

.bubble {
  position: absolute; left: 50%; top: -46px; transform: translate(-50%, 0);
  width: max-content; max-width: 250px;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px;
  padding: 6px 10px; font-size: 12.5px; font-weight: 700; line-height: 1.35; text-align: center;
  box-shadow: 3px 3px 0 var(--ink);
  opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 4;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; top: 100%; margin-left: -8px;
  border: 8px solid transparent; border-top-color: var(--ink);
}
.bubble.show { opacity: 1; }

.enemy-info {
  position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 3;
}
.enemy-name {
  font-family: var(--display); font-weight: 400; font-size: 18px; text-align: center;
  color: var(--cream); text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
  margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.enemy-name em { font-style: normal; font-family: var(--body); font-weight: 900; font-size: 12px; background: var(--red); padding: 2px 6px; border-radius: 6px; text-shadow: none; vertical-align: 2px; margin-right: 4px; border: 2px solid var(--ink); }
.hpbar, .boss-timer {
  position: relative; height: 18px; border-radius: 9px; border: 2.5px solid var(--ink);
  background: #3a2f2a; overflow: hidden;
}
.hpbar i { position: absolute; inset: 0; width: 100%; background: linear-gradient(#ff5a5a, var(--red)); transition: width .12s linear; }
/* 깎인 만큼 흰색으로 남았다가 잠깐 뒤 따라 줄어드는 잔상 바 (폭은 game.js 의 loop 가 움직여요) */
.hpbar b { position: absolute; inset: 0; width: 100%; background: #fff; }
.hpbar.respawn i { transition: none; }
.hpbar span, .boss-timer span {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900; color: #fff; text-shadow: 1px 1px 0 var(--ink);
}
.boss-timer { margin-top: 4px; height: 12px; display: none; }
.boss-timer.on { display: block; }
.boss-timer i { position: absolute; inset: 0; width: 100%; background: var(--gold); }
.boss-timer.low i { background: #ff7a00; animation: alarm .5s infinite; }
.boss-timer span { font-size: 9px; }

.squad { position: absolute; left: 10px; bottom: 74px; display: flex; flex-direction: column-reverse; gap: 4px; z-index: 3; }
.squad .mate { width: 38px; height: 38px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--cream); box-shadow: 2px 2px 0 var(--ink); }
.squad .mate svg { width: 100%; height: 100%; display: block; }
.squad .mate.hop { animation: hop .3s ease-out; }
@keyframes hop { 40% { transform: translate(8px, -6px) rotate(10deg); } }

.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.dmg {
  position: absolute; font-family: var(--display); font-weight: 400; font-size: 22px;
  color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--ink);
  animation: rise .8s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%);
}
.dmg.crit { font-size: 34px; color: #ffd23a; }
.dmg.crit::before { content: '치명타! '; font-size: 18px; color: #fff; }
.dmg.ally { font-size: 17px; }
.dmg .move { display: block; font-family: var(--body); font-weight: 900; font-size: 11px; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 6px; padding: 0 4px; margin-bottom: 2px; -webkit-text-stroke: 0; text-shadow: none; text-align: center; }
.dmg.reward { color: #fff3c4; font-size: 20px; }
@keyframes rise {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
.spark { position: absolute; width: 12px; height: 12px; margin: -6px; animation: spark .45s ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2) rotate(180deg); opacity: 0; } }
.pow {
  position: absolute; font-family: var(--display); font-size: 26px; color: var(--red);
  -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; transform: translate(-50%, -50%) rotate(-12deg);
  animation: pow .35s ease-out forwards;
}
@keyframes pow { 0% { transform: translate(-50%, -50%) rotate(-12deg) scale(.4); } 30% { transform: translate(-50%, -50%) rotate(-12deg) scale(1.2); } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(-12deg) scale(1); } }

.stage.shake { animation: shake .25s linear; }
@keyframes shake { 20% { transform: translate(-5px, 3px); } 40% { transform: translate(5px, -3px); } 60% { transform: translate(-3px, -2px); } 80% { transform: translate(3px, 2px); } }

.retry {
  position: absolute; right: 12px; top: 50px; z-index: 6;
  font-family: var(--display); font-size: 16px; padding: 9px 14px;
  background: var(--gold); border: 2.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); cursor: pointer;
  animation: pulse 1.2s ease-in-out infinite;
}
.tap-hint {
  position: absolute; left: 50%; top: 46%; transform: translateX(-50%); z-index: 4;
  font-family: var(--display); font-size: 20px; color: #fff; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--ink); pointer-events: none; animation: hint 1s ease-in-out infinite; white-space: nowrap;
}
@keyframes hint { 50% { transform: translateX(-50%) translateY(-6px); } }

/* ---------- 계급장 벽 ---------- */
.wall {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: #6b4a2e; border-bottom: 3px solid var(--ink);
  background-image: repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 2px, transparent 2px 22px);
}
.wall-label { font-size: 11px; font-weight: 900; color: var(--cream); white-space: nowrap; }
.wall-slots { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.insignia { width: 18px; height: 9px; display: block; }
.wall-slots .slot { line-height: 0; }
.wall-slots .slot.new { animation: bump .5s ease-out 2; }

/* ---------- 훈련 패널 ---------- */
.panel { flex: 1; overflow-y: auto; padding: 10px 12px 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); background: var(--paper); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.panel-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 18px; }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.seg button { border: 0; background: var(--cream); padding: 5px 10px; font-weight: 900; font-size: 12px; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--cream); }

.cards { display: flex; flex-direction: column; gap: 8px; }
.card {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center;
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; padding: 8px 10px;
  box-shadow: 3px 3px 0 var(--ink);
}
.card .pic { width: 52px; height: 52px; border-radius: 50%; border: 2.5px solid var(--ink); overflow: hidden; background: var(--cream); }
.card .pic svg { width: 100%; height: 100%; display: block; }
.card .pic.fist { display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--red); }
.card .info { min-width: 0; }
.card .name { font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.card .lv { font-family: var(--body); font-weight: 900; font-size: 12px; background: var(--ink); color: var(--cream); padding: 1px 6px; border-radius: 6px; }
.card .role { font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .eff { font-size: 12px; font-weight: 700; margin-top: 2px; }
.card .eff b { color: var(--red); }
.card .ms { height: 5px; border-radius: 3px; background: var(--line); margin-top: 4px; overflow: hidden; }
.card .ms i { display: block; height: 100%; background: var(--gold); }
.buy {
  min-width: 86px; padding: 7px 8px; border-radius: 12px; border: 2.5px solid var(--ink);
  background: var(--gold); box-shadow: 0 3px 0 var(--ink); cursor: pointer; text-align: center; line-height: 1.15;
}
.buy small { display: block; font-size: 10px; font-weight: 900; }
.buy b { font-family: var(--display); font-weight: 400; font-size: 16px; }
.buy:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.buy:disabled { background: #e6dcc6; color: #9b8f7d; box-shadow: 0 3px 0 #b9ad98; border-color: #b9ad98; cursor: default; }
.card.locked { background: repeating-linear-gradient(-45deg, #f6efe0 0 8px, #efe5cf 8px 16px); box-shadow: none; border-style: dashed; }
.card.locked .pic { filter: brightness(0) opacity(.25); }
.card.locked .name { color: var(--ink-soft); }
.card.fresh { animation: bump .5s ease-out 2; }

/* ---------- 알림·배너·모달 ---------- */
.toast {
  position: absolute; left: 12px; right: 12px; top: 128px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 10px 12px; box-shadow: 4px 4px 0 var(--ink);
  animation: drop .35s cubic-bezier(.2, 1.4, .4, 1);
}
.toast .pic { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 50%; border: 2.5px solid var(--ink); overflow: hidden; }
.toast .pic svg { width: 100%; height: 100%; display: block; }
.toast b { display: block; font-family: var(--display); font-weight: 400; font-size: 17px; color: var(--red); }
.toast span { font-size: 12px; font-weight: 700; }
@keyframes drop { from { transform: translateY(-30px); opacity: 0; } }

.banner {
  position: absolute; left: 0; right: 0; top: 34%; z-index: 21; text-align: center; pointer-events: none;
  background: var(--ink); color: var(--cream); border-top: 4px solid var(--gold); border-bottom: 4px solid var(--gold);
  padding: 12px 10px; animation: banner 1.6s ease forwards;
}
.banner b { display: block; font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--gold); line-height: 1.1; }
.banner span { font-size: 13px; font-weight: 700; }
.banner .insignia { width: 48px; height: 24px; margin: 6px auto 0; }
@keyframes banner { 0% { transform: scaleY(0); } 12% { transform: scaleY(1.1); } 18% { transform: scaleY(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

.modal {
  position: absolute; inset: 0; z-index: 30; background: rgba(29, 26, 23, .6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 340px; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px;
  box-shadow: 5px 5px 0 var(--ink); padding: 18px; text-align: center; animation: drop .3s ease;
}
.modal-card h3 { margin: 0 0 6px; font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--red); }
.modal-card p { margin: 6px 0; font-size: 14px; line-height: 1.5; }
.modal-card .big { font-family: var(--display); font-size: 34px; color: var(--ink); }
.modal-card .row { display: flex; gap: 8px; margin-top: 14px; }
.btn {
  flex: 1; padding: 11px 10px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--gold);
  font-family: var(--display); font-size: 17px; box-shadow: 0 3px 0 var(--ink); cursor: pointer;
}
.btn.ghost { background: var(--cream); }
.btn.danger { background: var(--red); color: #fff; }
.btn:active { transform: translateY(3px); box-shadow: none; }
.modal-card .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; text-align: left; font-size: 13px; }
.modal-card .stats div { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 8px; }
.modal-card .stats b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; }
.modal-card .note { font-size: 11px; color: var(--ink-soft); }
.modal-card .vols { margin-top: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 8px 10px; text-align: left; }
.modal-card .vols-head { font-family: var(--display); font-size: 16px; margin-bottom: 2px; }
.modal-card .vols-head small { font-family: var(--body); font-size: 11px; color: var(--ink-soft); }
.modal-card .vol { display: grid; grid-template-columns: 78px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.modal-card .vol b { text-align: right; font-variant-numeric: tabular-nums; }
.modal-card .vol input[type=range] { width: 100%; min-width: 0; accent-color: var(--red); height: 26px; margin: 0; }

@media (max-height: 640px) {
  .stage { height: 290px; }
  .stat-value { font-size: 24px; }
}
/* '애니메이션 줄이기' 설정: 타격 피드백(주먹·숫자·넉백)은 게임의 핵심이라 유지하고,
   멀미를 부를 수 있는 화면 전체 흔들림·번쩍임·반복 움직임만 끈다.
   (예전에는 모든 애니메이션을 0초로 줄여서, 이 설정이 켜진 PC에서는 타격 연출이 전부 사라졌음) */
@media (prefers-reduced-motion: reduce) {
  .stage.shake, .stage.shake-s, .hpbar.jolt { animation: none !important; }
  .flash.on { animation: none !important; }
  .tap-hint, .retry, .rank-steps i.now, .alarm { animation: none !important; }
}

/* ---------- 동료 필살기 ---------- */
/* 배경을 어둡게 눌러서 적과 필살기만 도드라지게 (적 z4, 이펙트 z5 아래) */
.sp-dim { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(20, 12, 10, .25), rgba(20, 12, 10, .72)); }
/* 컷인: 동료 색 띠 + 초상(띠 위로 튀어나옴) + 기술 이름 */
.cutin { position: absolute; left: 0; right: 0; top: 34%; height: 0; z-index: 8; pointer-events: none; }
.cutin-band {
  position: absolute; left: -6%; right: -6%; top: -42px; height: 84px; display: flex; align-items: center; gap: 10px; padding-left: 12%;
  background: repeating-linear-gradient(-60deg, transparent 0 18px, rgba(255, 255, 255, .13) 18px 22px), var(--c);
  border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink);
  box-shadow: 0 -6px 0 #ffd23a, 0 6px 0 #ffd23a, 0 10px 18px rgba(0, 0, 0, .45);
}
.cutin-band img {
  width: 112px; height: 112px; align-self: flex-end; margin-bottom: -4px; flex: none;
  background: #fff6dc; border: 4px solid var(--ink); border-radius: 10px; box-shadow: 4px 4px 0 var(--ink);
}
.cutin-text { display: flex; flex-direction: column; line-height: 1.05; color: #fff; min-width: 0; }
.cutin-text small { font-family: var(--body); font-weight: 900; font-size: 11px; opacity: .9; text-shadow: 1px 1px 0 var(--ink); }
.cutin-text b {
  font-family: var(--display); font-weight: 400; font-size: 30px; color: #ffd23a; white-space: nowrap;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink);
}
.cutin-text span { font-family: var(--body); font-weight: 900; font-size: 13px; text-shadow: 1px 1px 0 var(--ink); white-space: nowrap; }
.fx .spi { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4; filter: drop-shadow(0 0 3px #fff) drop-shadow(3px 4px 0 rgba(0, 0, 0, .5)); }
.fx .ember { position: absolute; width: 8px; height: 8px; background: #ffb21e; box-shadow: 0 0 0 1.5px #c0392b, 0 0 8px #ff8a1e; z-index: 3; }
.fx .chunk.big { width: 16px; height: 13px; }
.fx .code {
  position: absolute; z-index: 4; font-family: 'Courier New', monospace; font-weight: 900; font-size: 13px; line-height: 1.05; text-align: center;
  color: #5ff28a; text-shadow: 0 0 6px #2fbf55, 1px 1px 0 #0b0f0b;
}
.dmg.spdmg { font-size: 40px; }
.dmg.spdmg::before { content: '필살! '; color: #fff3c4; }

/* ---------- 동료 기술 단계 (Lv.10·20·30·40·100) ---------- */
.fx .tburst { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 4; }
/* 5단계 무지개 빛: 무기·필살기 그림에 두르는 빛이 색을 돌아요 */
.fx .rainbow { animation: rainbow-glow .45s linear infinite; }
@keyframes rainbow-glow {
  0% { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 12px #ff3dc8) drop-shadow(0 0 18px #ff3dc8) drop-shadow(2px 3px 0 rgba(0, 0, 0, .5)); }
  33% { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 12px #3fd8ff) drop-shadow(0 0 18px #3fd8ff) drop-shadow(2px 3px 0 rgba(0, 0, 0, .5)); }
  66% { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 12px #ffe600) drop-shadow(0 0 18px #ffe600) drop-shadow(2px 3px 0 rgba(0, 0, 0, .5)); }
  100% { filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 12px #ff3dc8) drop-shadow(0 0 18px #ff3dc8) drop-shadow(2px 3px 0 rgba(0, 0, 0, .5)); }
}
/* 분대 초상 테두리: 단계 색 + 단계 숫자 */
.squad .mate { position: relative; }
.squad .mate.t1 { border-color: #f4f7fb; box-shadow: 2px 2px 0 var(--ink), 0 0 0 2px var(--ink); }
.squad .mate.t2 { border-color: #3fd8ff; box-shadow: 2px 2px 0 var(--ink), 0 0 8px #3fd8ff; }
.squad .mate.t3 { border-color: #ffd23a; box-shadow: 2px 2px 0 var(--ink), 0 0 10px #ffd23a; }
.squad .mate.t4 { border-color: #ff6a1e; box-shadow: 2px 2px 0 var(--ink), 0 0 12px #ff6a1e, 0 0 4px #ffd23a; }
.squad .mate.t5 { border-color: #fff; box-shadow: 2px 2px 0 var(--ink), 0 0 10px #ff3dc8, 0 0 16px #3fd8ff; }
.squad .mate .tier-badge {
  position: absolute; right: -5px; bottom: -4px; min-width: 15px; height: 15px; border-radius: 8px; padding: 0 3px;
  font: 900 10px/15px var(--body); font-style: normal; text-align: center; color: var(--ink); background: #ffd23a; border: 2px solid var(--ink);
}
.squad .mate.t2 .tier-badge { background: #3fd8ff; }
.squad .mate.t4 .tier-badge { background: #ff8a3a; }
.squad .mate.t5 .tier-badge { background: linear-gradient(135deg, #ff3dc8, #ffe600, #3fd8ff); }
@media (prefers-reduced-motion: no-preference) {
  .squad .mate.t5 { animation: rainbow-ring 1.2s linear infinite; }
  @keyframes rainbow-ring { 0%, 100% { border-color: #ff3dc8; } 33% { border-color: #3fd8ff; } 66% { border-color: #ffe600; } }
}
/* 카드의 기술 단계 줄 */
.card .tierline { font-size: 11px; color: var(--ink-soft); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tierline b { font-weight: 900; padding: 0 5px; border-radius: 5px; border: 1.5px solid var(--ink); color: var(--ink); }
.card .tierline b.t0 { background: var(--line); }
.card .tierline b.t1 { background: #f4f7fb; }
.card .tierline b.t2 { background: #9feeff; }
.card .tierline b.t3 { background: #ffd23a; }
.card .tierline b.t4 { background: #ff9a52; }
.card .tierline b.t5 { background: linear-gradient(90deg, #ff9ae4, #fff27a, #9feeff); }
/* 동료 피해 숫자도 단계 색으로 */
.dmg.ally.t2 { color: #9feeff; }
.dmg.ally.t3 { color: #ffd23a; }
.dmg.ally.t4 { color: #ffb067; }
.dmg.ally.t5 { color: #fff; text-shadow: 0 0 8px #ff3dc8, 0 0 14px #3fd8ff, 2px 2px 0 var(--ink); }
/* 필살기 컷인의 단계 표시 */
.cutin-text small em { font-style: normal; color: #ffd23a; margin-left: 4px; }
.cutin.t5 .cutin-band { box-shadow: 0 -6px 0 #ff3dc8, 0 6px 0 #3fd8ff, 0 0 24px #ffe600, 0 10px 18px rgba(0, 0, 0, .45); }
.cutin.t4 .cutin-band { box-shadow: 0 -6px 0 #ff6a1e, 0 6px 0 #ff6a1e, 0 10px 18px rgba(0, 0, 0, .45); }

/* 컷신 (js/cutscene.js): 검은 화면 가운데 정사각 도트 화면, 오른쪽 위 건너뛰기 */
.cutscene {
  position: absolute; inset: 0; z-index: 40; background: #000;
  display: flex; align-items: center; justify-content: center;
  animation: cut-in .35s ease;
}
.cutscene.out { opacity: 0; transition: opacity .3s; pointer-events: none; }
.cutscene canvas {
  width: min(100%, 100vh); height: auto; aspect-ratio: 1 / 1;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.cut-skip {
  position: absolute; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px));
  font: 700 13px var(--body); color: #fff; background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 255, 255, .7); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.cut-skip:active { transform: translateY(1px); }
@keyframes cut-in { from { opacity: 0; } to { opacity: 1; } }
.modal-card .replay { width: 100%; margin-top: 8px; }
/* 무대 위 컷신 (보스 등장): 앱을 덮는 막은 투명(탭만 막음), 그림은 무대 배경과 같은 cover 배치로 배경 바로 위에.
   그동안 무대의 다른 것(계급 칸·이름·체력·동료)은 숨겼다가, 끝나면 보스 그림은 바로·나머지는 천천히 나타나요 */
.cutscene.cut-stage { background: transparent; display: block; animation: none; }
.cut-stage .cut-skip { top: 10px; right: 10px; }
.cut-layer {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 6; pointer-events: none;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.cut-layer.out { opacity: 0; transition: opacity .3s ease .05s; }
.stage.cutting > :not(.bg):not(.cut-layer) { opacity: 0 !important; pointer-events: none; }
.stage.uncut > :not(.bg):not(.cut-layer):not(.enemy-wrap):not(.hole-wrap) { transition: opacity .5s ease .3s; }
/* 보스전 동안 남는 구멍 (컷신 마지막 장면의 구멍·잔해). 보스 칸(.enemy-wrap)과 똑같은 자리·크기의 칸을 따로 두고
   이름·체력 막대(z 3) 아래에 깔아요. 보스 그림 아래 단과 이어지는 자리 */
.hole-wrap {
  position: absolute; left: 50%; top: 52px; bottom: 70px; transform: translateX(-50%);
  aspect-ratio: 1 / 1; max-width: 84%; z-index: 2; pointer-events: none; display: none;
}
.hole-wrap.on { display: block; }
.boss-hole { position: absolute; left: -14.893%; top: 83.082%; width: 129.785%; height: 38.936%; }
.enemy-wrap.in-hole::after { display: none; }

/* ---------- 적 유형·백두혈통 (2026-11-21, 기획/05_적_유형_증언.md) ---------- */
/* 체제의 피해자 쪽 적은 K.O. 도장 대신 흐린 글씨로 조용히 */
.ko-stamp.quiet { font-family: var(--body); font-weight: 900; font-size: 30px; color: #e8e4da; -webkit-text-stroke: 0; text-shadow: 0 2px 6px rgba(0,0,0,.8); transform: translate(-50%, -50%); animation: quietko 1.2s ease-out forwards; }
@keyframes quietko { 0% { opacity: 0; } 25% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%); } }
.enemy.quietdead .char { transition: transform .5s ease-in, opacity .5s; transform: translateY(14px) scale(.96); opacity: .55; }
/* 경비대원: 빨리 잡으면 보상 2배 — 보스 타이머 막대를 하늘색으로 같이 써요 */
.boss-timer.quick i { background: #3fb6e8; }
/* 김여정 '담화 발표' 동안: 종이 같은 흰 테두리 + 피해 감소 */
.enemy.shield .char { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 6px #fff8d8) brightness(1.08); }
.shield-note { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); z-index: 4; pointer-events: none; white-space: nowrap;
  background: #f4efe0; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 4px; padding: 4px 10px; font-weight: 900; font-size: 13px;
  box-shadow: 3px 3px 0 var(--ink); animation: shieldnote 2.5s ease-out forwards; }
.shield-note small { display: block; font-size: 10px; font-weight: 700; color: var(--red); }
@keyframes shieldnote { 0% { opacity: 0; transform: translate(-50%, -8px); } 12% { opacity: 1; transform: translate(-50%, 0); } 85% { opacity: 1; } 100% { opacity: 0; } }
/* 처음 만난 적 소개 카드 */
.toast .pic.enemypic { border-radius: 8px; background: #3a2f2a; }
.toast .pic.enemypic img { object-fit: contain; object-position: 50% 0; image-rendering: pixelated; }
.toast em { display: block; font-style: normal; font-size: 12px; font-weight: 700; margin-top: 2px; opacity: .85; }
.toast i { display: block; font-style: normal; font-size: 11px; font-weight: 900; color: var(--red); margin-top: 2px; }

/* ---------- 변칙 이벤트 (game.js EVENT_PLAY) ---------- */
.ev-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.ev-layer > * { position: absolute; }
.ev-layer img { display: block; width: 100%; height: auto; }
.ev-layer img.jolt { animation: evjolt .16s linear; }
@keyframes evjolt { 30% { translate: 0 -4px; rotate: -3deg; } 70% { translate: 0 2px; rotate: 2deg; } }
.ev-tag { left: 50%; top: 46px; transform: translateX(-50%); background: var(--ink); color: var(--gold); border: 2px solid var(--gold);
  font-family: var(--display); font-size: 18px; padding: 3px 14px 4px; border-radius: 8px; text-align: center; white-space: nowrap; animation: evtag 2.4s ease-out forwards; }
.ev-tag small { display: block; font-family: var(--body); font-size: 10px; font-weight: 900; color: var(--cream); letter-spacing: .08em; }
@keyframes evtag { 0% { opacity: 0; translate: 0 -8px; } 12%, 80% { opacity: 1; translate: 0 0; } 100% { opacity: 0; } }

/* 배급 트럭 */
.ev-truck { left: 0; bottom: 46px; width: 138px; pointer-events: auto; cursor: pointer; }
.ev-truck img { filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .45)); }
.ev-truck .ev-label { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; font-weight: 900;
  color: var(--cream); background: rgba(29, 26, 23, .85); border-radius: 4px; padding: 1px 6px; }
.ev-truck.empty .ev-label::after { content: ' · 빈 트럭'; color: var(--gold); }
.fx .ev-sack { position: absolute; width: 28px; height: 31px; transform: translate(-50%, -50%); z-index: 3;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 11' shape-rendering='crispEdges'%3E%3Cpath fill='%233a2a1a' d='M3 2H7V3H8V4H9V5H10V9H9V10H8V11H2V10H1V9H0V5H1V4H2V3H3Z'/%3E%3Cpath fill='%23c9a26b' d='M3 3H7V4H8V5H9V9H8V10H2V9H1V5H2V4H3Z'/%3E%3Cpath fill='%23a07d4a' d='M6 7H8V9H6ZM2 9H8V10H2Z'/%3E%3Cpath fill='%23e8cc96' d='M3 5H4V7H3Z'/%3E%3Cpath fill='%236b4a2a' d='M4 0H6V1H7V2H3V1H4Z'/%3E%3C/svg%3E") center / contain no-repeat; filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, .45));
  animation: evsack .9s cubic-bezier(.3, 0, .7, 1) forwards; }
@keyframes evsack { 0% { translate: 0 0; rotate: 0deg; } 60% { translate: 10px 70px; rotate: 30deg; opacity: 1; } 100% { translate: 14px 64px; rotate: 34deg; opacity: 0; } }

/* 정전: 등잔 불빛과 적 둘레만 보여요. 관장 주먹이 닿은 곳이 잠깐 밝아짐(spark) */
.ev-dark { position: absolute; inset: 0; z-index: 4; pointer-events: none; animation: evdark-in .35s ease-out;
  background: radial-gradient(circle at var(--lx) var(--ly), rgba(10, 8, 20, .12) 0, rgba(10, 8, 20, .55) 34%, rgba(4, 4, 12, .9) 62%); }
.ev-dark.off { animation: evdark-out .5s ease-in forwards; }
@keyframes evdark-in { 0%, 30% { opacity: 1; background-color: rgba(0, 0, 0, .9); } 15% { opacity: .2; } }
@keyframes evdark-out { to { opacity: 0; } }
.ev-dark::after { content: ''; position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(circle at var(--tx, 50%) var(--ty, 50%), rgba(255, 214, 130, .55) 0, rgba(255, 190, 90, 0) 90px); }
.ev-dark.lit::after { animation: evspark .3s ease-out; }
@keyframes evspark { 0% { opacity: 1; } 100% { opacity: 0; } }
.ev-lamp { position: absolute; left: calc(var(--lx) + 58px); top: calc(var(--ly) + 34px); width: 60px; transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 12px rgba(255, 180, 70, .9)); animation: evlamp 1.4s steps(2) infinite; }
@keyframes evlamp { 50% { filter: drop-shadow(0 0 7px rgba(255, 170, 60, .7)) brightness(.9); } }
.ev-dark-tag { position: absolute; left: 50%; top: 46px; transform: translateX(-50%); text-align: center; white-space: nowrap;
  font-size: 12px; font-weight: 900; color: #e8e4da; text-shadow: 0 1px 3px #000; }
.ev-dark-tag b { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; color: #ffd27a; }
.ev-dark-tag i { display: block; font-style: normal; font-size: 11px; color: #bdb6a6; }

/* 열병식: 붉은 기를 앞세운 대열 (왼쪽 → 오른쪽). 병사는 옆모습 2장을 번갈아 보여 줘요 (f1 다리 차올림, f2 두 발 모음) */
.ev-parade { left: 0; bottom: 70px; display: flex; align-items: flex-end; }
.ev-parade .ev-flag { width: 66px; margin-left: -10px; transform: scaleX(-1); animation: evstep .6s ease-in-out infinite; }
.ev-marcher { position: relative; width: 62px; margin-right: -16px; pointer-events: auto; cursor: pointer; }
.ev-marcher img { filter: drop-shadow(1px 2px 0 rgba(0, 0, 0, .45)); }
.ev-marcher .f2 { position: absolute; left: 0; top: 0; }
.ev-marcher .f1 { animation: evf1 .6s steps(1) infinite; animation-delay: var(--d); }
.ev-marcher .f2 { animation: evf2 .6s steps(1) infinite; animation-delay: var(--d); }
@keyframes evf1 { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes evf2 { 0% { opacity: 0; } 50% { opacity: 1; } }
@keyframes evstep { 50% { translate: 0 -3px; } }
.ev-marcher.out { pointer-events: none; animation: evout .7s ease-in forwards; }
.ev-marcher.out .f1 { animation: none; opacity: 1; }
.ev-marcher.out .f2 { animation: none; opacity: 0; }
@keyframes evout { 0% { translate: 0 0; } 30% { translate: 0 -22px; rotate: 12deg; } 100% { translate: -26px 90px; rotate: -20deg; opacity: 0; } }

/* 미사일 */
.ev-missile { left: 0; top: 0; width: 96px; pointer-events: auto; cursor: pointer; }
.ev-missile img { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 0 7px rgba(255, 140, 40, .9)); }
/* 꺼져서 떨어지는 중: 하얀 테두리에 붉은 경고등이 깜빡여요 (탭할 때라는 신호) */
.ev-missile.stall img { animation: evwarn .36s steps(2) infinite; }
@keyframes evwarn { 0% { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 0 8px rgba(255, 50, 40, 1)); } 100% { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff) drop-shadow(0 0 2px rgba(255, 50, 40, .4)); } }

/* 미사일 실패 보도 */
.ev-news { left: 8px; right: 8px; bottom: 76px; background: #0d2f6e; color: #fff; border: 2px solid var(--ink); border-left: 8px solid var(--red);
  font-size: 13px; font-weight: 900; padding: 5px 10px; text-align: left; animation: evtag 2.6s ease-out forwards; }
.ev-news b { color: #ffd23a; }

/* 1호 행사 */
.ev-visit { right: 10px; bottom: 76px; width: 96px; pointer-events: auto; cursor: pointer; animation: evvisit .35s cubic-bezier(.2, 1.4, .5, 1); }
.ev-visit img { filter: drop-shadow(0 0 0 #fff) drop-shadow(2px 3px 0 rgba(0, 0, 0, .5)); }
.ev-visit-sign { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); z-index: 1; white-space: nowrap; text-align: center;
  background: var(--red); color: #fff3c4; border: 2px solid var(--ink); border-radius: 4px; font-family: var(--display); font-size: 14px; padding: 0 8px 1px; }
.ev-visit-sign small { display: block; font-family: var(--body); font-weight: 900; font-size: 9px; margin-top: -2px; }
.ev-visit.hit img { animation: evjolt .16s linear; }
.ev-visit.leave { animation: evleave .5s ease-in forwards; }
@keyframes evvisit { from { translate: 0 120%; } }
@keyframes evleave { 20% { translate: 0 -10px; } to { translate: 140% 30px; rotate: 15deg; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ev-parade .ev-flag, .ev-lamp { animation: none; } }
