body {
  background: #ffe9d6;
}

.stage {
  background:
    radial-gradient(ellipse 60% 45% at 50% 55%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%),
    linear-gradient(160deg, #fff4c9 0%, #ffe0d2 45%, #ffc9dc 100%);
}

/* Soft floating blobs of colour in the background. */
.bokeh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 210, 63, 0.35) 0 7vmin, transparent 7.2vmin),
    radial-gradient(circle at 88% 82%, rgba(47, 128, 237, 0.16) 0 9vmin, transparent 9.2vmin),
    radial-gradient(circle at 80% 14%, rgba(255, 93, 143, 0.18) 0 5vmin, transparent 5.2vmin),
    radial-gradient(circle at 18% 86%, rgba(61, 220, 132, 0.2) 0 6vmin, transparent 6.2vmin),
    radial-gradient(circle at 50% 4%, rgba(155, 93, 229, 0.14) 0 4vmin, transparent 4.2vmin);
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate(0, 0);
  }
  to {
    transform: translate(1.5vmin, -2vmin);
  }
}

.xylo {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* ---------- Wooden rails ---------- */
.rail {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 50%;
  border-radius: 999px;
  background: linear-gradient(180deg, #d99a5b 0%, #b8743a 45%, #8d5327 100%);
  box-shadow:
    0 6px 12px rgba(120, 60, 20, 0.28),
    inset 0 2px 0 rgba(255, 230, 190, 0.6);
}

/* ---------- Bars ---------- */
.bar {
  position: absolute;
  border-radius: var(--r, 18px);
  background: linear-gradient(var(--dir, 90deg), var(--c2) 0%, var(--c) 30%, var(--c) 70%, var(--c3) 100%);
  box-shadow:
    0 8px 0 var(--c3),
    0 14px 20px rgba(80, 40, 60, 0.25);
  transform-origin: 50% 50%;
  transition: filter 0.2s ease-out, box-shadow 0.2s ease-out;
  will-change: transform;
}

/* Glossy highlight stripe. */
.bar::before {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(var(--dir, 90deg), rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.1));
  pointer-events: none;
}
.stage.v .bar::before {
  left: 16%;
  width: 18%;
  top: 6%;
  bottom: 6%;
}
.stage.h .bar::before {
  top: 14%;
  height: 20%;
  left: 5%;
  right: 5%;
}

.stage.v .bar {
  --dir: 90deg;
}
.stage.h .bar {
  --dir: 180deg;
}

.bar.hit {
  filter: brightness(1.18) saturate(1.1);
  box-shadow:
    0 8px 0 var(--c3),
    0 0 34px 10px var(--glow),
    0 14px 20px rgba(80, 40, 60, 0.2);
  transition: none;
}

/* Little screws where the bar sits on the rails. */
.screw {
  position: absolute;
  width: var(--screw, 16px);
  height: var(--screw, 16px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e4e7ee 35%, #a4a9b8 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.3),
    inset 0 -1px 1px rgba(0, 0, 0, 0.15);
  translate: -50% -50%;
}
.stage.v .screw {
  left: 50%;
}
.stage.v .screw.s1 {
  top: 22%;
}
.stage.v .screw.s2 {
  top: 78%;
}
.stage.h .screw {
  top: 50%;
}
.stage.h .screw.s1 {
  left: 22%;
}
.stage.h .screw.s2 {
  left: 78%;
}

/* ---------- Floating musical critters ---------- */
.critters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.critter {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1;
  font-weight: 700;
  pointer-events: none;
  will-change: transform, opacity;
}
.critter.glyph {
  font-family: "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols", system-ui, sans-serif;
  text-shadow:
    3px 0 0 #fff, -3px 0 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff,
    2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
    0 5px 8px rgba(80, 40, 60, 0.3);
}

/* ---------- Song button ---------- */
.song-btn {
  position: fixed;
  top: calc(10px + var(--safe-top));
  right: calc(10px + var(--safe-right));
  z-index: 900;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #fff3fb 60%, #ffd9ec 100%);
  box-shadow:
    0 5px 0 #f3a9cb,
    0 10px 18px rgba(160, 60, 110, 0.25);
  display: grid;
  place-items: center;
  font-size: 38px;
  line-height: 1;
  transition: transform 0.12s ease;
}
.song-btn:active {
  transform: scale(0.92);
}
.song-btn.playing {
  animation: songPulse 0.84s ease-in-out infinite;
}
@keyframes songPulse {
  0%,
  100% {
    transform: scale(1) rotate(0deg);
  }
  50% {
    transform: scale(1.12) rotate(-8deg);
  }
}
