* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  font-family: Arial, sans-serif;
}

.scene {
  position: relative;
  width: 760px;
  height: 220px;
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.anchor {
  position: absolute;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  margin-top: -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  z-index: 1;
}

.particle {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  background: rgb(80, 120, 255);
  z-index: 2;
  will-change: transform, background-color;
  box-shadow: 0 0 4px rgba(255,255,255,0.06);
}

.metal-label {
  position: absolute;
  top: 16px;
  left: 150px;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  letter-spacing: 0.04em;
  z-index: 4;
}

.electron {
  position: absolute;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  margin-top: -4px;
  border-radius: 50%;
  background: #dbeafe;
  box-shadow: 0 0 10px rgba(219, 234, 254, 0.9);
  z-index: 5;
  will-change: transform, background-color;
}

/* HEAT SOURCE */
.heat-source {
  position: absolute;
  left: 78px;
  top: 106px;
  width: 52px;
  height: 78px;
  z-index: 3;
  pointer-events: none;
}

.fire {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform-origin: center bottom;
  border-radius: 50% 50% 45% 45%;
  filter: blur(1px);
}

.fire-back {
  width: 42px;
  height: 62px;
  margin-left: -21px;
  background: radial-gradient(circle at 50% 70%, #ffb703 0%, #fb8500 45%, #d9480f 75%, rgba(217,72,15,0) 100%);
  animation: flickerBack 1.6s ease-in-out infinite;
  opacity: 0.75;
}

.fire-mid {
  width: 30px;
  height: 52px;
  margin-left: -15px;
  background: radial-gradient(circle at 50% 72%, #ffd166 0%, #ff9f1c 42%, #f25c05 78%, rgba(242,92,5,0) 100%);
  animation: flickerMid 1.1s ease-in-out infinite;
  opacity: 0.9;
}

.fire-front {
  width: 18px;
  height: 34px;
  margin-left: -9px;
  background: radial-gradient(circle at 50% 78%, #fff3b0 0%, #ffe066 35%, #ff8c42 75%, rgba(255,140,66,0) 100%);
  animation: flickerFront 0.9s ease-in-out infinite;
  opacity: 0.95;
}

.ember {
  position: absolute;
  bottom: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 8px rgba(255, 209, 102, 0.65);
  opacity: 0;
}

.ember-1 {
  left: 18px;
  animation: emberRise1 1.8s linear infinite;
}

.ember-2 {
  left: 27px;
  animation: emberRise2 2.2s linear infinite 0.5s;
}

.ember-3 {
  left: 33px;
  animation: emberRise3 1.9s linear infinite 0.9s;
}

@keyframes flickerBack {
  0%, 100% { transform: translateX(-2px) scaleY(0.92) scaleX(0.96) rotate(-2deg); }
  25% { transform: translateX(1px) scaleY(1.08) scaleX(1.02) rotate(2deg); }
  50% { transform: translateX(-1px) scaleY(0.98) scaleX(0.94) rotate(-1deg); }
  75% { transform: translateX(2px) scaleY(1.12) scaleX(1.04) rotate(3deg); }
}

@keyframes flickerMid {
  0%, 100% { transform: translateX(0) scaleY(0.95) scaleX(0.95) rotate(-1deg); }
  20% { transform: translateX(1px) scaleY(1.08) scaleX(1.03) rotate(2deg); }
  50% { transform: translateX(-1px) scaleY(1.00) scaleX(0.96) rotate(-2deg); }
  80% { transform: translateX(1px) scaleY(1.12) scaleX(1.04) rotate(1deg); }
}

@keyframes flickerFront {
  0%, 100% { transform: translateX(0) scaleY(0.92) scaleX(0.95); }
  30% { transform: translateX(1px) scaleY(1.15) scaleX(1.05); }
  60% { transform: translateX(-1px) scaleY(0.98) scaleX(0.98); }
}

@keyframes emberRise1 {
  0%   { transform: translate(0, 0) scale(0.8); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(-8px, -38px) scale(0.3); opacity: 0; }
}

@keyframes emberRise2 {
  0%   { transform: translate(0, 0) scale(0.8); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translate(6px, -46px) scale(0.2); opacity: 0; }
}

@keyframes emberRise3 {
  0%   { transform: translate(0, 0) scale(0.8); opacity: 0; }
  18%  { opacity: 1; }
  100% { transform: translate(-4px, -34px) scale(0.25); opacity: 0; }
}
