* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #06061a;
  color: #f4e6c1;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  overflow-x: hidden;
}

.demo-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
  background:
    radial-gradient(circle at center, rgba(42, 43, 95, 0.9), transparent 45%),
    linear-gradient(180deg, #07072a, #03030c);
}

.demo-card {
  width: min(800px, 100%);
  padding: 26px;
  border: 2px solid rgba(255, 224, 140, 0.28);
  border-radius: 18px;
  background: rgba(10, 10, 28, 0.86);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.demo-card h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 5vw, 44px);
  letter-spacing: 1px;
  color: #ffe39a;
  text-shadow: 0 3px 0 #3a1900;
}

.demo-card p {
  max-width: 610px;
  margin: 0 auto 18px;
  line-height: 1.5;
  color: #d8c89d;
}

.head-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 460px;
  margin: 18px auto;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(24, 45, 210, 0.95), rgba(0, 0, 125, 0.95) 58%, rgba(0, 0, 55, 0.95));
  border: 2px solid rgba(95, 120, 255, 0.45);
  perspective: 900px;
}

.head-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}

.head-turner {
  --zoom: 2;
  position: relative;
  width: 256px;
  height: 256px;
  transform-style: preserve-3d;
  transform: scale(var(--zoom));
  image-rendering: pixelated;
  will-change: transform;
}

.head-sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
  z-index: 3;
  filter:
    drop-shadow(0 16px 4px rgba(0, 0, 0, 0.58))
    contrast(1.12)
    brightness(1.02);
  will-change: transform, filter;
}

.side-glow,
.side-shadow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  image-rendering: pixelated;
  transition: opacity 0.08s linear;
}

.side-glow {
  background: linear-gradient(90deg, transparent 38%, rgba(255, 225, 135, 0.28), transparent 70%);
  mix-blend-mode: screen;
}

.side-shadow {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), transparent 42%, rgba(0, 0, 0, 0.42));
  mix-blend-mode: multiply;
}

.head-turner::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -18px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  filter: blur(8px);
  transform: translateZ(-80px);
  z-index: 1;
  pointer-events: none;
}

.head-red-drip {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  image-rendering: pixelated;
  background: #c91515;
  border-radius: 50% 50% 60% 60%;
  box-shadow:
    1px 1px 0 #3b0000,
    -1px 0 0 rgba(255, 80, 80, 0.35);
  transform: translateZ(70px);
  will-change: left, top, opacity, transform;
}

.head-red-drip.dark {
  background: #7f0707;
}

.head-red-drip.bright {
  background: #e32620;
}

.controls {
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  margin: 22px auto 8px;
  text-align: left;
}

.controls label {
  display: grid;
  gap: 6px;
  color: #ffe39a;
  font-weight: bold;
}

.controls input[type="range"] {
  width: 100%;
}

.hint {
  margin-top: 18px;
  font-size: 14px;
  color: #b8aed2;
}

code {
  color: #fff2b0;
}

@media (max-width: 640px) {
  .demo-wrap {
    padding: 14px;
  }

  .demo-card {
    padding: 18px;
  }

  .head-stage {
    min-height: 360px;
  }

  .head-turner {
    --zoom: 1.45;
  }
}
