/* ==========================================================================
   Ecomiro Satici Runner — game styles
   Dark teal palette; respects prefers-reduced-motion
   ========================================================================== */

.er-root {
  --er-bg-1: #0A1628;
  --er-bg-2: #0E1E3A;
  --er-teal: #22D3EE;
  --er-teal-2: #14B8A6;
  --er-violet: #8B5CF6;
  --er-danger: #F87171;
  --er-ground: #0B172E;
  --er-grid: rgba(34, 211, 238, 0.10);

  position: relative;
  display: block;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.18);
  background:
    radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.20), transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(34, 211, 238, 0.22), transparent 55%),
    linear-gradient(180deg, var(--er-bg-1) 0%, var(--er-bg-2) 100%);
  box-shadow:
    0 30px 80px -20px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(34, 211, 238, 0.06) inset;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.er-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 11 / 5;
  min-height: 340px;
  cursor: pointer;
  overflow: hidden;
}

@media (max-width: 640px) {
  .er-stage { aspect-ratio: 11 / 6; min-height: 300px; }
}

/* --- backgrounds --- */
.er-grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(90deg, var(--er-grid) 1px, transparent 1px),
    linear-gradient(180deg, var(--er-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 60%, #000 40%, transparent 100%);
  animation: erGridSlide 12s linear infinite;
  opacity: 0.8;
}

.er-city {
  position: absolute; bottom: 56px; left: 0; right: 0; height: 110px;
  background: linear-gradient(180deg, rgba(34,211,238,0.18), rgba(139,92,246,0.14));
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'><g fill='black'><rect x='20' y='50' width='34' height='70'/><rect x='70' y='25' width='42' height='95'/><rect x='130' y='55' width='28' height='65'/><rect x='170' y='35' width='38' height='85'/><rect x='220' y='48' width='30' height='72'/><rect x='260' y='18' width='48' height='102'/><rect x='320' y='40' width='32' height='80'/><rect x='365' y='28' width='42' height='92'/><rect x='420' y='46' width='34' height='74'/><rect x='465' y='32' width='30' height='88'/><rect x='510' y='56' width='42' height='64'/><rect x='565' y='22' width='36' height='98'/><rect x='615' y='46' width='30' height='74'/><rect x='655' y='12' width='52' height='108'/><rect x='720' y='40' width='30' height='80'/><rect x='765' y='28' width='42' height='92'/><rect x='820' y='50' width='34' height='70'/><rect x='868' y='32' width='30' height='88'/><rect x='910' y='44' width='42' height='76'/><rect x='960' y='22' width='36' height='98'/><rect x='1010' y='40' width='30' height='80'/><rect x='1055' y='50' width='40' height='70'/><rect x='1110' y='34' width='30' height='86'/></g></svg>");
  mask-repeat: repeat-x;
  mask-size: 1200px 110px;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'><g fill='black'><rect x='20' y='50' width='34' height='70'/><rect x='70' y='25' width='42' height='95'/><rect x='130' y='55' width='28' height='65'/><rect x='170' y='35' width='38' height='85'/><rect x='220' y='48' width='30' height='72'/><rect x='260' y='18' width='48' height='102'/><rect x='320' y='40' width='32' height='80'/><rect x='365' y='28' width='42' height='92'/><rect x='420' y='46' width='34' height='74'/><rect x='465' y='32' width='30' height='88'/><rect x='510' y='56' width='42' height='64'/><rect x='565' y='22' width='36' height='98'/><rect x='615' y='46' width='30' height='74'/><rect x='655' y='12' width='52' height='108'/><rect x='720' y='40' width='30' height='80'/><rect x='765' y='28' width='42' height='92'/><rect x='820' y='50' width='34' height='70'/><rect x='868' y='32' width='30' height='88'/><rect x='910' y='44' width='42' height='76'/><rect x='960' y='22' width='36' height='98'/><rect x='1010' y='40' width='30' height='80'/><rect x='1055' y='50' width='40' height='70'/><rect x='1110' y='34' width='30' height='86'/></g></svg>");
  -webkit-mask-repeat: repeat-x;
  -webkit-mask-size: 1200px 110px;
  animation: erCityScroll 16s linear infinite;
  opacity: 0.55;
}

.er-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  background: linear-gradient(180deg, var(--er-ground) 0%, #050B1A 100%);
  border-top: 2px solid rgba(34, 211, 238, 0.35);
  box-shadow: 0 -8px 30px rgba(34, 211, 238, 0.15);
}
.er-road {
  position: absolute; left: 0; right: 0; bottom: 22px; height: 3px;
  background: repeating-linear-gradient(
    90deg,
    rgba(34, 211, 238, 0.8) 0 28px,
    transparent 28px 56px
  );
  animation: erRoadScroll 0.7s linear infinite;
}

.er-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 15% 18%, rgba(255,255,255,0.7), transparent 55%),
    radial-gradient(1px 1px at 42% 10%, rgba(255,255,255,0.6), transparent 55%),
    radial-gradient(1px 1px at 65% 25%, rgba(34,211,238,0.8), transparent 55%),
    radial-gradient(1px 1px at 80% 12%, rgba(139,92,246,0.7), transparent 55%),
    radial-gradient(1px 1px at 90% 38%, rgba(255,255,255,0.5), transparent 55%),
    radial-gradient(1px 1px at 30% 40%, rgba(34,211,238,0.4), transparent 55%);
  animation: erTwinkle 6s ease-in-out infinite alternate;
  pointer-events: none;
}

/* --- runner --- */
.er-runner {
  position: absolute;
  left: 14%;
  bottom: 56px;
  width: 76px;
  height: 84px;
  z-index: 4;
  transition: transform 0.14s ease-out;
}

.er-runner__body {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, #67E8F9, #0891B2 60%, #0E4B63 100%);
  border-radius: 22px 22px 20px 20px;
  box-shadow:
    0 0 26px rgba(34, 211, 238, 0.55),
    inset 0 -8px 14px rgba(0, 0, 0, 0.35);
}
.er-runner__body::before {
  content: ''; position: absolute; top: 16px; left: 14px; right: 14px; height: 40px;
  background: #0A1628; border-radius: 14px;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.1);
}
.er-runner__eye {
  position: absolute; top: 24px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--er-teal); box-shadow: 0 0 10px var(--er-teal);
  animation: erBlink 4s infinite;
}
.er-runner__eye--l { left: 22px; }
.er-runner__eye--r { right: 22px; }
.er-runner__antenna {
  position: absolute; top: -14px; left: 50%; width: 2px; height: 14px;
  background: var(--er-teal); transform: translateX(-50%);
}
.er-runner__antenna::after {
  content: ''; position: absolute; top: -6px; left: -3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--er-violet); box-shadow: 0 0 12px var(--er-violet);
  animation: erPulse 1.6s ease-in-out infinite;
}
.er-runner__leg {
  position: absolute; bottom: -10px; width: 12px; height: 14px;
  background: var(--er-teal-2); border-radius: 4px;
  animation: erRun 0.32s infinite;
}
.er-runner__leg--l { left: 18px; animation-delay: 0s; }
.er-runner__leg--r { right: 18px; animation-delay: 0.16s; }

/* Mouth — changes shape based on mood */
.er-runner__mouth {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 4px;
  background: var(--er-teal);
  border-radius: 0 0 8px 8px;
  transition: all 0.3s ease;
}

.er-runner--mood-ok .er-runner__mouth {
  /* happy smile */
  border-radius: 0 0 8px 8px;
  height: 5px;
  width: 16px;
  background: #22D3EE;
  box-shadow: 0 0 6px rgba(34,211,238,0.6);
}
.er-runner--mood-worried .er-runner__body { filter: hue-rotate(-15deg) saturate(0.8); }
.er-runner--mood-worried .er-runner__mouth {
  /* flat frown */
  border-radius: 2px;
  height: 3px;
  width: 12px;
  background: #FCD34D;
}
.er-runner--mood-worried .er-runner__eye { animation: erBlinkFast 1.6s infinite; }
.er-runner--mood-sad .er-runner__body {
  filter: hue-rotate(-40deg) saturate(0.6);
  background: radial-gradient(circle at 30% 30%, #FCA5A5, #B91C1C 60%, #450A0A 100%) !important;
  box-shadow: 0 0 22px rgba(248, 113, 113, 0.55) !important;
}
.er-runner--mood-sad .er-runner__mouth {
  /* upside-down smile = sad */
  border-radius: 8px 8px 0 0;
  height: 6px;
  width: 14px;
  background: #F87171;
  bottom: 12px;
  box-shadow: 0 0 6px rgba(248,113,113,0.7);
}
.er-runner--mood-sad .er-runner__eye {
  background: #F87171;
  box-shadow: 0 0 8px #F87171;
  animation: erCry 1.2s infinite;
}
.er-runner--mood-sad .er-runner__antenna::after { background: #F87171; box-shadow: 0 0 12px #F87171; }

.er-runner--jump {
  animation: erJump 0.7s linear 1;
}

/* Hurt/happy effects target the BODY (not root) so they don't fight with jump's translateY */
.er-runner--hurt  .er-runner__body { animation: erHurtBody  0.5s ease-out 1; }
.er-runner--happy .er-runner__body { animation: erHappyBody 0.4s ease-out 1; }

/* --- entities --- */
.er-spawns {
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
}
.er-entity {
  position: absolute;
  right: -80px;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  animation-name: erScrollLeft;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
  will-change: transform;
  --glow: #F87171;
}
.er-entity__emoji {
  font-size: 30px; line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}
.er-entity__mark {
  position: absolute; top: -6px; right: -4px;
  background: #F87171; color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 2px 6px;
  border: 2px solid #0A1628;
}
.er-entity__label {
  position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
  color: #fff;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(4px);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.er-obstacle {
  background: radial-gradient(circle at 30% 30%, rgba(248,113,113,0.35), rgba(248,113,113,0.08));
  border: 1.5px solid rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.30), inset 0 0 10px rgba(248, 113, 113, 0.15);
}
.er-collectible {
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--glow) 35%, transparent), transparent 70%);
  border: 1.5px solid var(--glow);
  box-shadow: 0 0 22px color-mix(in srgb, var(--glow) 45%, transparent),
              inset 0 0 10px color-mix(in srgb, var(--glow) 15%, transparent);
}
.er-entity--hit {
  animation: erHit 0.3s ease-out forwards !important;
}
.er-entity--collected {
  animation: erCollected 0.35s ease-out forwards !important;
}

/* --- floating deltas + fireworks --- */
.er-floats { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.er-float {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  backdrop-filter: blur(6px);
  animation: erFloatRise 1.6s ease-out forwards;
  white-space: nowrap;
}
.er-float--good {
  background: rgba(34, 211, 238, 0.22);
  border: 1px solid rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}
.er-float--bad {
  background: rgba(248, 113, 113, 0.22);
  border: 1px solid rgba(248, 113, 113, 0.6);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.35);
}
.er-float__label { font-weight: 700; }
.er-float__delta { opacity: 0.9; font-size: 11px; }

.er-fx {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: erFx 0.9s ease-out forwards;
}

/* --- HUD --- */
.er-hud {
  position: absolute; inset: 12px 14px auto 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px;
  z-index: 7;
  pointer-events: none;
}

/* Ecomiro Mode toggle */
.er-auto-toggle {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: rgba(10, 22, 40, 0.85);
  border: 1.5px solid rgba(34, 211, 238, 0.35);
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  font-family: inherit;
}
.er-auto-toggle:hover {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.22);
  transform: translateY(-1px);
}
.er-auto-toggle__switch {
  position: relative;
  width: 38px; height: 22px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  transition: background 0.25s ease;
  flex-shrink: 0;
}
.er-auto-toggle__knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #E2E8F0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.er-auto-toggle[aria-pressed="true"] {
  border-color: #22D3EE;
  background: linear-gradient(135deg, rgba(34,211,238,0.25), rgba(139,92,246,0.22));
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.45);
  color: #fff;
}
.er-auto-toggle[aria-pressed="true"] .er-auto-toggle__switch {
  background: linear-gradient(135deg, #22D3EE, #14B8A6);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8) inset;
}
.er-auto-toggle[aria-pressed="true"] .er-auto-toggle__knob {
  left: 18px;
  background: #0A1628;
}
.er-auto-toggle__label {
  display: flex; flex-direction: column; align-items: flex-start;
  line-height: 1.1;
}
.er-auto-toggle__title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.er-auto-toggle__hint {
  font-size: 10px; opacity: 0.7; font-weight: 500;
}

/* Runner aura in auto mode */
.er--auto .er-runner {
  filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.7));
}
.er--auto .er-runner__body {
  box-shadow:
    0 0 30px rgba(34, 211, 238, 0.7),
    0 0 60px rgba(139, 92, 246, 0.4),
    inset 0 -8px 14px rgba(0, 0, 0, 0.35) !important;
  animation: erAutoPulse 1.6s ease-in-out infinite;
}
@keyframes erAutoPulse {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.18) saturate(1.3); }
}

@media (max-width: 720px) {
  .er-auto-toggle__label { display: none; }
  .er-auto-toggle { padding: 6px; }
}
.er-hud__left, .er-hud__right {
  display: flex; flex-direction: column; gap: 6px;
}
.er-hud__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(10, 22, 40, 0.75);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: #E2E8F0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}
.er-hud__label {
  font-size: 10px; font-weight: 500;
  color: rgba(226, 232, 240, 0.65);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.er-hud__value {
  font-size: 14px; font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.er-hud__value--revenue { color: #22D3EE; }

.er-health {
  width: 120px; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
  margin-top: 4px;
}
.er-health__bar {
  width: 100%; height: 100%;
  background: linear-gradient(90deg, #22D3EE, #34D399);
  transition: width 0.3s ease, background 0.3s ease;
}
.er-health__bar[data-level="mid"] { background: linear-gradient(90deg, #FCD34D, #F59E0B); }
.er-health__bar[data-level="low"] { background: linear-gradient(90deg, #F87171, #EF4444); }

.er-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: rgba(255,255,255,0.06);
  z-index: 8;
}
.er-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #22D3EE, #8B5CF6);
  transition: width 0.2s linear;
}

/* --- overlay (start/win/lose) --- */
.er-overlay {
  position: absolute; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at center, rgba(10, 22, 40, 0.9), rgba(10, 22, 40, 0.98)),
    linear-gradient(180deg, rgba(34, 211, 238, 0.06), rgba(139, 92, 246, 0.06));
  backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 0.3s ease;
}
.er-overlay[data-visible="0"] {
  opacity: 0;
  pointer-events: none;
}
.er-overlay__title {
  font-size: clamp(20px, 3.2vw, 30px);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  max-width: 720px;
}
.er-overlay__body {
  font-size: clamp(14px, 1.6vw, 16px);
  color: rgba(226, 232, 240, 0.85);
  max-width: 560px;
}
.er-overlay__cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  background: linear-gradient(135deg, #22D3EE, #14B8A6);
  color: #0A1628;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 30px -8px rgba(34, 211, 238, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.er-overlay__cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px -6px rgba(34, 211, 238, 0.75);
}
.er-overlay__hint {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.55);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.er-overlay[data-reason="lose"] {
  background:
    radial-gradient(ellipse at center, rgba(40, 10, 14, 0.92), rgba(10, 22, 40, 0.98));
}

/* --- shake + red flash on hit --- */
.er-shake { animation: erShake 0.38s ease-in-out; }

.er-flash {
  position: absolute; inset: 0; z-index: 9;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(248, 113, 113, 0.55), transparent 70%);
  animation: erFlash 0.45s ease-out forwards;
}

.er-burst {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
  animation: erBurst 0.7s ease-out forwards;
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(248,113,113,0.8));
}
.er-burst span { display: inline-block; }

/* --- keyframes --- */
@keyframes erScrollLeft {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-100vw - 120px)); }
}
@keyframes erGridSlide {
  from { background-position: 0 0, 0 0; }
  to   { background-position: -48px 0, 0 -48px; }
}
@keyframes erCityScroll {
  from { mask-position: 0 0; -webkit-mask-position: 0 0; }
  to   { mask-position: -1200px 0; -webkit-mask-position: -1200px 0; }
}
@keyframes erRoadScroll {
  from { background-position: 0 0; }
  to   { background-position: -56px 0; }
}
@keyframes erTwinkle {
  from { opacity: 0.6; }
  to   { opacity: 1; }
}
@keyframes erBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}
@keyframes erPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}
@keyframes erRun {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
@keyframes erJump {
  0%   { transform: translateY(0);     animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  50%  { transform: translateY(-90px); animation-timing-function: cubic-bezier(0.7, 0, 0.8, 0.3); }
  100% { transform: translateY(0); }
}
@keyframes erHit {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes erCollected {
  0% { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(0.3) rotate(180deg); opacity: 0; }
}
@keyframes erFloatRise {
  0%   { opacity: 0; transform: translate(-50%, -20%); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -120%); }
}
@keyframes erFx {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}
.er-coin {
  position: absolute;
  font-size: 42px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: erCoinFloat 1.2s ease-out forwards;
  filter: drop-shadow(0 6px 14px rgba(250, 204, 21, 0.55));
  z-index: 5;
}
@keyframes erCoinFloat {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.4) rotate(0deg); }
  20%  { opacity: 1; transform: translate(-50%, -80%) scale(1.15) rotate(90deg); }
  100% { opacity: 0; transform: translate(-50%, -200%) scale(0.9) rotate(360deg); }
}
@keyframes erShake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-10px, -3px) rotate(-1deg); }
  20% { transform: translate(9px, 2px) rotate(1deg); }
  30% { transform: translate(-8px, 3px) rotate(-1deg); }
  40% { transform: translate(7px, -2px) rotate(0.5deg); }
  50% { transform: translate(-5px, 2px); }
  60% { transform: translate(4px, -1px); }
  70% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, 0); }
  90% { transform: translate(-1px, 0); }
}

@keyframes erFlash {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes erBurst {
  0%   { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  30%  { transform: translate(-50%, -50%) scale(1.8); opacity: 1; }
  100% { transform: translate(-50%, -140%) scale(2.2); opacity: 0; }
}

@keyframes erHurtBody {
  0%   { transform: scale(1) rotate(0); filter: none; }
  12%  { transform: scale(1.28) rotate(-6deg); filter: drop-shadow(0 0 22px rgba(248,113,113,0.95)) brightness(1.6) hue-rotate(-40deg) saturate(1.8); }
  28%  { transform: scale(0.85) rotate(5deg);  filter: drop-shadow(0 0 18px rgba(248,113,113,0.7)) brightness(0.9); }
  50%  { transform: scale(1.08) rotate(-3deg); filter: drop-shadow(0 0 14px rgba(248,113,113,0.5)); }
  75%  { transform: scale(0.96) rotate(1deg);  filter: drop-shadow(0 0 8px  rgba(248,113,113,0.3)); }
  100% { transform: scale(1) rotate(0);        filter: none; }
}

@keyframes erHappyBody {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.14) rotate(-4deg); }
  55%      { transform: scale(1.06) rotate(3deg); }
  80%      { transform: scale(1.02); }
}

@keyframes erBlinkFast {
  0%, 85%, 100% { transform: scaleY(1); }
  92% { transform: scaleY(0.1); }
}

@keyframes erCry {
  0%, 100% { transform: scaleY(1) translateY(0); }
  50% { transform: scaleY(0.4) translateY(2px); }
}

/* --- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .er-grid-bg, .er-city, .er-road, .er-stars,
  .er-runner__leg, .er-runner__antenna::after, .er-runner__eye {
    animation: none !important;
  }
  .er-runner--jump { animation: none !important; transform: translateY(-75px); }
  .er-entity { animation-duration: 12s !important; }
}

/* --- responsive --- */
@media (max-width: 640px) {
  .er-runner { width: 60px; height: 68px; left: 10%; }
  .er-entity { width: 46px; height: 46px; }
  .er-entity__emoji { font-size: 24px; }
  .er-entity__label { font-size: 9px; bottom: -18px; }
  .er-health { width: 90px; }
  .er-hud__chip { padding: 5px 8px; font-size: 11px; }
}
