:root {
  color-scheme: dark;
  --ink: oklch(94% 0.018 92);
  --muted: oklch(73% 0.032 108);
  --dim: oklch(55% 0.03 120);
  --night: oklch(16% 0.05 142);
  --deep: oklch(22% 0.055 145);
  --panel: oklch(26% 0.045 138);
  --panel-strong: oklch(31% 0.055 138);
  --line: oklch(46% 0.05 136 / 0.45);
  --moss: oklch(78% 0.14 151);
  --sun: oklch(84% 0.15 78);
  --coral: oklch(71% 0.18 31);
  --violet: oklch(68% 0.11 298);
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --radius: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 18% 10%, oklch(69% 0.1 82 / 0.22), transparent 28rem),
    radial-gradient(circle at 87% 17%, oklch(72% 0.13 35 / 0.14), transparent 24rem),
    linear-gradient(145deg, var(--night), oklch(19% 0.05 201) 52%, oklch(20% 0.05 96));
  color: var(--ink);
  font-family: Avenir Next, Avenir, Trebuchet MS, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--space-xl) 0 var(--space-2xl);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.eyebrow {
  margin: 0 0 var(--space-xs);
  color: var(--sun);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.02;
}

h1 {
  max-width: 920px;
  font-family: Georgia, Charter, serif;
  font-size: clamp(2.2rem, 6vw, 5.6rem);
  font-weight: 800;
}

h2 {
  font-size: 1.2rem;
}

.transport,
.upload-row,
.panel-heading {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.panel-heading {
  justify-content: space-between;
}

.icon-button,
.small-button,
.primary-button,
.file-button,
.record-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(36% 0.055 143);
  color: var(--ink);
  padding: 0 var(--space-lg);
  font-weight: 800;
  transition: transform 160ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease);
}

.icon-button {
  width: 46px;
  padding: 0;
  font-size: 1.1rem;
}

.secondary {
  background: transparent;
}

.primary-button {
  border-color: oklch(78% 0.14 151 / 0.78);
  background: var(--moss);
  color: oklch(18% 0.05 145);
}

.wide {
  width: 100%;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
  border-color: var(--sun);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.file-button:focus-within {
  outline: 3px solid oklch(84% 0.15 78 / 0.7);
  outline-offset: 3px;
}

.tempo-control {
  display: grid;
  grid-template-columns: auto 130px 3ch;
  align-items: center;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: 0.9rem;
}

.stage {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse at 50% 105%, oklch(45% 0.1 145 / 0.3), transparent 54%),
    linear-gradient(180deg, oklch(14% 0.06 173), oklch(10% 0.045 145));
  perspective: 900px;
  isolation: isolate;
}

.stage-3d {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.moon {
  display: none;
}

.ritual-ring {
  display: none;
}

.island {
  position: absolute;
  z-index: 2;
  inset: auto 5% 0;
  min-height: 190px;
  background: transparent;
  pointer-events: none;
}

.band-stage {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: clamp(10px, 2vw, 28px);
  min-height: 215px;
  padding: var(--space-2xl) var(--space-xl) var(--space-3xl);
  pointer-events: none;
}

.stage-monster,
.monster-preview .monster-art {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
}

.stage-monster {
  pointer-events: auto;
}

.monster-body {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--monster-w, 98px);
  height: var(--monster-h, 118px);
  border: 3px solid oklch(12% 0.03 120 / 0.55);
  background: var(--monster-color);
  box-shadow: inset -14px -20px 0 oklch(0% 0 0 / 0.12), 0 18px 28px oklch(0% 0 0 / 0.26);
  transform-origin: center bottom;
}

.head-piece {
  position: absolute;
  top: -18px;
  z-index: 3;
  width: 42px;
  height: 24px;
  border: 3px solid oklch(12% 0.03 120 / 0.55);
  border-radius: 50% 50% 12px 12px;
  background: color-mix(in oklch, var(--monster-color) 75%, var(--sun));
}

.parts-snake .head-piece {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.parts-bone-mask .head-piece {
  top: 22px;
  width: 52px;
  height: 38px;
  border-color: oklch(94% 0.03 92 / 0.62);
  background: oklch(91% 0.035 92 / 0.38);
}

.parts-crystal-crown .head-piece {
  clip-path: polygon(0 100%, 18% 18%, 36% 100%, 55% 0, 74% 100%, 92% 22%, 100% 100%);
  border-radius: 0;
}

.parts-gear-head .head-piece {
  border-style: dashed;
}

.parts-lava-horns .head-piece {
  width: 62px;
  background: var(--coral);
  clip-path: polygon(0 100%, 15% 0, 34% 100%, 66% 100%, 85% 0, 100% 100%);
}

.arm,
.foot {
  position: absolute;
  display: block;
  background: color-mix(in oklch, var(--monster-color) 78%, oklch(16% 0.04 138));
  border: 3px solid oklch(12% 0.03 120 / 0.55);
}

.arm {
  top: 48%;
  z-index: -1;
  width: 58px;
  height: 18px;
  border-radius: 999px 999px 999px 10px;
}

.arm::before {
  content: "";
  position: absolute;
  top: -9px;
  width: 24px;
  height: 23px;
  border: 3px solid oklch(12% 0.03 120 / 0.55);
  border-radius: 58% 42% 48% 52%;
  background: inherit;
}

.arm::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 5px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: oklch(12% 0.03 120);
  box-shadow: 8px 0 0 oklch(12% 0.03 120);
}

.arm.left {
  left: -50px;
  transform: rotate(-16deg) skewX(-10deg);
}

.arm.left::before {
  left: -15px;
}

.arm.left::after {
  left: -6px;
}

.arm.right {
  right: -50px;
  border-radius: 999px 999px 10px 999px;
  transform: rotate(16deg) skewX(10deg);
}

.arm.right::before {
  right: -15px;
}

.arm.right::after {
  right: 11px;
}

.foot {
  bottom: -12px;
  width: 30px;
  height: 18px;
  border-radius: 48% 52% 40% 60%;
}

.foot.left {
  left: 16px;
  transform: rotate(-9deg);
}

.foot.right {
  right: 16px;
  transform: rotate(9deg);
}

.monster-art::before,
.monster-art::after {
  position: absolute;
  z-index: 2;
  color: oklch(96% 0.02 88 / 0.9);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  pointer-events: none;
}

.theme-wind .monster-body {
  border-style: dashed;
}

.theme-wind::before {
  content: "gust";
  top: 18px;
  right: -22px;
}

.theme-robot .monster-body {
  background:
    repeating-linear-gradient(90deg, transparent 0 18px, oklch(22% 0.03 130 / 0.2) 18px 20px),
    var(--monster-color);
}

.theme-robot .monster-body::after {
  border-radius: 2px;
  box-shadow: 0 0 0 3px oklch(22% 0.03 130), 18px 0 0 var(--coral), -18px 0 0 var(--moss);
}

.theme-bones .monster-body {
  box-shadow: inset 0 -18px 0 oklch(88% 0.035 92 / 0.35), 0 18px 28px oklch(0% 0 0 / 0.26);
}

.theme-bones::before {
  content: "rib";
  bottom: 42px;
  left: -12px;
}

.theme-wolves .monster-body {
  clip-path: polygon(14% 18%, 28% 0, 44% 19%, 60% 19%, 76% 0, 88% 18%, 94% 76%, 50% 100%, 6% 76%);
}

.theme-wolves::before {
  content: "howl";
  top: 10px;
  left: -22px;
}

.theme-light .monster-body {
  box-shadow: inset -14px -20px 0 oklch(0% 0 0 / 0.08), 0 0 42px var(--monster-color), 0 18px 28px oklch(0% 0 0 / 0.24);
}

.theme-light::before {
  content: "glow";
  top: 4px;
  right: -20px;
}

.theme-fire .monster-body {
  border-radius: 50% 50% 42% 42% / 22% 22% 66% 66%;
}

.theme-fire::before {
  content: "ember";
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

.theme-wheats .monster-body {
  background:
    repeating-linear-gradient(90deg, oklch(93% 0.09 91 / 0.28) 0 6px, transparent 6px 12px),
    var(--monster-color);
}

.theme-wheats::before {
  content: "grain";
  bottom: 28px;
  right: -22px;
}

.playing .monster-body {
  animation: bob 280ms var(--ease);
}

.potato .monster-body,
.round .monster-body {
  border-radius: 48% 52% 44% 56% / 42% 44% 56% 58%;
}

.sprout .monster-body,
.bean .monster-body {
  border-radius: 58% 42% 52% 48% / 35% 42% 58% 65%;
}

.sprout .monster-body::before {
  content: "";
  position: absolute;
  top: -18px;
  width: 26px;
  height: 28px;
  border: 2px solid oklch(12% 0.03 120 / 0.45);
  border-radius: 90% 10% 90% 10%;
  background: oklch(76% 0.14 145);
  transform: rotate(-18deg);
}

.lumpy .monster-body {
  border-radius: 42% 58% 55% 45% / 50% 38% 62% 50%;
}

.lumpy .monster-body::before,
.lumpy .monster-body::after {
  content: "";
  position: absolute;
  width: 16px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: oklch(18% 0.04 138 / 0.25);
}

.lumpy .monster-body::before {
  top: 23px;
  left: 19px;
}

.lumpy .monster-body::after {
  right: 18px;
  bottom: 29px;
}

.tall .monster-body {
  --monster-w: 78px;
  --monster-h: 136px;
  border-radius: 42px 42px 28px 28px;
}

.eyes {
  position: absolute;
  top: 32%;
  display: flex;
  gap: 18px;
}

.eye {
  width: 15px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: oklch(12% 0.03 120);
  box-shadow: inset 3px 3px 0 oklch(94% 0.02 92 / 0.3);
}

.mouth {
  position: absolute;
  bottom: 30%;
  width: 34px;
  height: 18px;
  border-radius: 0 0 99px 99px;
  background: oklch(16% 0.05 20);
  transform-origin: center top;
}

.playing .mouth {
  animation: sing 280ms var(--ease);
}

.monster-name {
  position: absolute;
  bottom: -26px;
  left: 50%;
  width: max-content;
  max-width: 110px;
  transform: translateX(-50%);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.monster-name small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
}

/* Modular creature anatomy */
.monster-art {
  --outline: oklch(12% 0.025 116 / 0.82);
  --stage-yaw: 0deg;
  position: relative;
  width: 152px;
  height: 176px;
  transform: rotateX(-2deg) rotateY(var(--stage-yaw)) rotateZ(var(--odd-tilt)) scale(var(--monster-scale, 1));
  transform-style: preserve-3d;
  transform-origin: center bottom;
  transition: transform 220ms var(--ease), filter 220ms var(--ease);
}

.stage-monster:hover .monster-art {
  filter: brightness(1.08) drop-shadow(0 14px 12px oklch(5% 0.02 130 / 0.38));
  transform: translateY(-7px) rotateX(-1deg) rotateY(0deg) rotateZ(var(--odd-tilt)) scale(var(--monster-scale, 1));
}

.stage-monster:nth-child(3n + 1) .monster-art { --stage-yaw: 8deg; }
.stage-monster:nth-child(3n + 2) .monster-art { --stage-yaw: -5deg; }
.stage-monster:nth-child(3n) .monster-art { --stage-yaw: 6deg; }

.stage-monster::after {
  content: "";
  position: absolute;
  right: 18%;
  bottom: 24px;
  left: 18%;
  z-index: -1;
  height: 20px;
  border-radius: 50%;
  background: oklch(4% 0.02 135 / 0.46);
  filter: blur(7px);
  transform: rotateX(65deg);
}

.monster-art::before,
.monster-art::after {
  content: none !important;
}

.monster-art .monster-body {
  --monster-w: 104px;
  --monster-h: 122px;
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: var(--monster-w);
  height: var(--monster-h);
  overflow: visible;
  border: 4px solid var(--outline);
  background: var(--monster-color);
  box-shadow:
    inset calc(-17px - var(--odd-shift)) -20px 18px oklch(12% 0.03 100 / 0.31),
    inset 13px 12px 18px oklch(98% 0.015 90 / 0.18),
    inset 0 -5px 5px oklch(8% 0.025 120 / 0.18),
    0 18px 20px oklch(5% 0.025 130 / 0.4);
  transform: translateX(calc(-50% + var(--odd-shift))) translateZ(12px);
  rotate: var(--odd-body-rotate, 0deg);
  scale: var(--odd-body-x, 1) var(--odd-body-y, 1);
  transform-style: preserve-3d;
  transform-origin: center bottom;
  transition: rotate 180ms var(--ease), scale 180ms var(--ease);
}

.body-sheen {
  position: absolute;
  inset: 3px;
  z-index: 2;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 28% 18%, oklch(98% 0.015 90 / 0.34) 0 5%, transparent 24%),
    linear-gradient(108deg, oklch(98% 0.015 90 / 0.12), transparent 33% 68%, oklch(8% 0.03 125 / 0.22));
  box-shadow:
    inset -8px -10px 13px oklch(8% 0.025 120 / 0.15),
    inset 5px 5px 8px oklch(98% 0.015 90 / 0.1);
  pointer-events: none;
}

.potato .monster-body {
  border-radius: 46% 54% 42% 58% / 38% 43% 57% 62%;
}

.sprout .monster-body {
  --monster-w: 92px;
  --monster-h: 132px;
  border-radius: 64% 36% 48% 52% / 31% 43% 57% 69%;
  transform: translateX(calc(-50% + var(--odd-shift))) translateZ(12px) rotate(-3deg);
}

.lumpy .monster-body {
  --monster-w: 118px;
  --monster-h: 112px;
  border-radius: 36% 64% 54% 46% / 47% 34% 66% 53%;
}

.tall .monster-body {
  --monster-w: 74px;
  --monster-h: 144px;
  border-radius: 44% 56% 34% 66% / 25% 31% 69% 75%;
}

.gourd .monster-body {
  --monster-w: 122px;
  --monster-h: 116px;
  border-radius: 31% 69% 45% 55% / 42% 37% 63% 58%;
  clip-path: polygon(7% 8%, 44% 14%, 57% 2%, 94% 12%, 100% 84%, 63% 100%, 48% 91%, 34% 100%, 0 80%);
}

.crater .monster-body {
  --monster-w: 128px;
  --monster-h: 98px;
  border-radius: 50% 50% 42% 58% / 31% 34% 66% 69%;
}

.crater .monster-body::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 32px;
  width: 58px;
  height: 19px;
  border: 4px solid var(--outline);
  border-radius: 50%;
  background: color-mix(in oklch, var(--monster-color) 55%, oklch(14% 0.04 120));
}

.stalk .monster-body {
  --monster-w: 64px;
  --monster-h: 148px;
  border-radius: 58% 42% 45% 55% / 19% 25% 75% 81%;
  transform: translateX(calc(-50% + var(--odd-shift))) translateZ(12px) skewY(-3deg);
}

.tripod .monster-body {
  --monster-w: 116px;
  --monster-h: 108px;
  border-radius: 52% 48% 30% 70% / 40% 36% 64% 60%;
  clip-path: polygon(13% 0, 90% 6%, 100% 67%, 78% 72%, 88% 100%, 57% 76%, 42% 100%, 32% 71%, 2% 78%, 0 25%);
}

.skin-detail {
  position: absolute;
  z-index: 1;
  display: none;
  pointer-events: none;
}

.skin-warts .skin-detail {
  display: block;
  width: 13px;
  aspect-ratio: 1;
  border: 2px solid var(--outline);
  border-radius: 50%;
  background: color-mix(in oklch, var(--monster-color) 78%, var(--sun));
}

.skin-warts .detail-a { top: 18%; left: 16%; }
.skin-warts .detail-b { top: 53%; right: 10%; width: 18px; }
.skin-warts .detail-c { bottom: 12%; left: 30%; width: 9px; }

.skin-scales .monster-body {
  background:
    radial-gradient(circle at 10px 10px, transparent 7px, oklch(12% 0.03 120 / 0.18) 8px 9px, transparent 10px) 0 0 / 20px 18px,
    var(--monster-color);
}

.skin-fur .monster-body {
  border-style: dashed;
  background:
    repeating-linear-gradient(112deg, transparent 0 8px, oklch(96% 0.02 90 / 0.13) 9px 11px),
    var(--monster-color);
}

.skin-bark .monster-body {
  background:
    repeating-linear-gradient(83deg, transparent 0 13px, oklch(15% 0.04 92 / 0.2) 14px 18px, transparent 19px 26px),
    var(--monster-color);
}

.skin-cracked .monster-body {
  background:
    linear-gradient(118deg, transparent 0 37%, oklch(12% 0.03 120 / 0.38) 38% 40%, transparent 41%),
    linear-gradient(61deg, transparent 0 57%, oklch(12% 0.03 120 / 0.28) 58% 60%, transparent 61%),
    var(--monster-color);
}

.head-piece {
  position: absolute;
  top: -34px;
  left: 50%;
  z-index: 0;
  width: 82px;
  height: 44px;
  border: 0;
  background: none;
  transform: translateX(calc(-50% - var(--odd-shift)));
}

.head-piece i {
  position: absolute;
  display: block;
}

.head-none .head-piece {
  display: none;
}

.head-bone-antlers .head-piece i {
  bottom: 0;
  width: 10px;
  height: 42px;
  border: 3px solid var(--outline);
  border-radius: 9px;
  background: oklch(89% 0.035 87);
}

.head-bone-antlers .head-piece i::before {
  content: "";
  position: absolute;
  top: 8px;
  width: 19px;
  height: 8px;
  border: 3px solid var(--outline);
  border-radius: 8px;
  background: inherit;
}

.head-bone-antlers .head-piece i:first-child { left: 15px; transform: rotate(-16deg); }
.head-bone-antlers .head-piece i:first-child::before { right: 3px; transform: rotate(31deg); }
.head-bone-antlers .head-piece i:nth-child(2) { right: 13px; height: 35px; transform: rotate(19deg); }
.head-bone-antlers .head-piece i:nth-child(2)::before { left: 2px; transform: rotate(-34deg); }

.head-horns .head-piece i {
  bottom: 0;
  width: 28px;
  height: 42px;
  background: oklch(20% 0.045 44);
  clip-path: polygon(50% 0, 100% 100%, 0 78%);
}

.head-horns .head-piece i:first-child { left: 5px; transform: rotate(-25deg); }
.head-horns .head-piece i:nth-child(2) { right: 4px; transform: rotate(21deg) scaleX(-1); }

.head-antennae .head-piece i {
  bottom: 0;
  width: 4px;
  height: 39px;
  border-radius: 9px;
  background: var(--outline);
}

.head-antennae .head-piece i::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -6px;
  width: 15px;
  aspect-ratio: 1;
  border: 3px solid var(--outline);
  border-radius: 50%;
  background: var(--sun);
}

.head-antennae .head-piece i:first-child { left: 24px; transform: rotate(-14deg); }
.head-antennae .head-piece i:nth-child(2) { right: 21px; height: 31px; transform: rotate(18deg); }

.head-mushrooms .head-piece i {
  bottom: 0;
  width: 9px;
  height: 25px;
  border: 2px solid var(--outline);
  background: oklch(87% 0.04 90);
}

.head-mushrooms .head-piece i::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 29px;
  height: 17px;
  border: 3px solid var(--outline);
  border-radius: 50% 50% 24% 24%;
  background: var(--coral);
  transform: translateX(-50%);
}

.head-mushrooms .head-piece i:first-child { left: 15px; transform: rotate(-13deg); }
.head-mushrooms .head-piece i:nth-child(2) { right: 18px; height: 34px; transform: rotate(9deg); }

.head-crystals .head-piece i {
  bottom: -1px;
  width: 24px;
  height: 43px;
  border: 3px solid var(--outline);
  background: color-mix(in oklch, var(--monster-color) 35%, oklch(88% 0.15 310));
  clip-path: polygon(50% 0, 100% 74%, 74% 100%, 22% 100%, 0 70%);
}

.head-crystals .head-piece i:first-child { left: 8px; transform: rotate(-17deg); }
.head-crystals .head-piece i:nth-child(2) { left: 30px; height: 51px; }
.head-crystals .head-piece i:nth-child(3) { right: 6px; height: 35px; transform: rotate(18deg); }

.head-halo .head-piece {
  top: -25px;
  width: 74px;
  height: 21px;
  border: 5px solid var(--sun);
  border-top-color: transparent;
  border-radius: 50%;
  transform: translateX(calc(-50% - var(--odd-shift))) rotate(-9deg);
  filter: drop-shadow(0 0 6px oklch(84% 0.15 78 / 0.65));
}

.arm,
.foot {
  position: absolute;
  display: block;
  border: 3px solid var(--outline);
  background: color-mix(in oklch, var(--monster-color) 76%, oklch(22% 0.04 135));
}

.arm {
  top: 45%;
  z-index: -2;
  width: 62px;
  height: 17px;
  border-radius: 999px;
}

.arm i {
  position: absolute;
  display: block;
}

.arm.left { left: -52px; transform: rotate(calc(-18deg - var(--odd-tilt))); }
.arm.right { right: -52px; transform: rotate(calc(15deg + var(--odd-tilt))); }

.arms-snakes .arm {
  height: 21px;
  border-radius: 70% 30% 60% 40%;
}

.arms-snakes .arm::before {
  content: "";
  position: absolute;
  top: -8px;
  width: 25px;
  height: 27px;
  border: 3px solid var(--outline);
  border-radius: 55% 45% 62% 38%;
  background: inherit;
}

.arms-snakes .arm::after {
  content: "••";
  position: absolute;
  top: -3px;
  z-index: 2;
  color: var(--outline);
  font-size: 11px;
  letter-spacing: 2px;
}

.arms-snakes .arm.left::before { left: -17px; transform: rotate(-20deg); }
.arms-snakes .arm.right::before { right: -17px; transform: rotate(20deg); }
.arms-snakes .arm.left::after { left: -11px; }
.arms-snakes .arm.right::after { right: -12px; }

.arms-tentacles .arm {
  top: 54%;
  width: 69px;
  height: 25px;
  border-radius: 70% 30% 65% 35%;
}

.arms-tentacles .arm.left { transform: rotate(-39deg) skewX(18deg); }
.arms-tentacles .arm.right { transform: rotate(42deg) skewX(-18deg); }

.arms-branches .arm {
  height: 10px;
  border-radius: 3px;
  background: color-mix(in oklch, var(--monster-color) 35%, oklch(34% 0.09 78));
}

.arms-branches .arm::before,
.arms-branches .arm::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 8px;
  border: 3px solid var(--outline);
  background: inherit;
}

.arms-branches .arm::before { top: -17px; transform: rotate(-44deg); }
.arms-branches .arm::after { bottom: -17px; transform: rotate(39deg); }
.arms-branches .arm.left::before,
.arms-branches .arm.left::after { left: 3px; }
.arms-branches .arm.right::before,
.arms-branches .arm.right::after { right: 3px; }

.arms-noodles .arm {
  width: 72px;
  height: 12px;
  border-style: dashed;
  background: var(--sun);
}

.arms-wings .arm {
  top: 33%;
  width: 59px;
  height: 51px;
  border-radius: 60% 15% 65% 20%;
  background: color-mix(in oklch, var(--monster-color) 54%, oklch(92% 0.06 215));
  clip-path: polygon(100% 45%, 0 0, 18% 45%, 2% 100%);
}

.arms-wings .arm.left { transform: rotate(-13deg); }
.arms-wings .arm.right { transform: rotate(13deg) scaleX(-1); }
.arms-none .arm { display: none; }

.foot {
  z-index: -3;
  bottom: -14px;
  width: 34px;
  height: 23px;
  border-radius: 58% 42% 38% 62%;
}

.foot-a { left: 12px; transform: rotate(-8deg); }
.foot-b { right: 12px; transform: rotate(9deg); }
.foot-c,
.foot-d { display: none; }

.legs-spider .foot {
  width: 47px;
  height: 9px;
  border-radius: 9px;
}

.legs-spider .foot-a { left: -9px; transform: rotate(-31deg); }
.legs-spider .foot-b { right: -9px; transform: rotate(31deg); }
.legs-spider .foot-c,
.legs-spider .foot-d { display: block; bottom: -5px; }
.legs-spider .foot-c { left: -15px; transform: rotate(21deg); }
.legs-spider .foot-d { right: -15px; transform: rotate(-21deg); }

.legs-hooves .foot {
  width: 29px;
  height: 28px;
  border-radius: 50% 50% 8px 8px;
  background: oklch(28% 0.045 65);
}

.legs-wheels .foot {
  width: 28px;
  aspect-ratio: 1;
  border-width: 6px;
  border-radius: 50%;
  background: var(--sun);
}

.legs-tail .foot { display: none; }
.legs-tail .foot-a {
  display: block;
  right: -26px;
  bottom: 5px;
  left: auto;
  width: 70px;
  height: 17px;
  border-radius: 999px 15px 999px 15px;
  transform: rotate(27deg);
}

.eyes {
  position: absolute;
  top: 25%;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(calc(-50% - var(--odd-shift)));
  rotate: var(--odd-eye-rotate, 0deg);
  scale: var(--odd-eye-scale, 1);
}

.eye {
  position: relative;
  display: none;
  width: 19px;
  aspect-ratio: 1;
  border: 3px solid var(--outline);
  border-radius: 50%;
  background: oklch(92% 0.03 92);
  box-shadow:
    inset -4px -4px 5px oklch(35% 0.025 92 / 0.22),
    0 4px 4px oklch(8% 0.03 120 / 0.34);
  transform: translateZ(18px);
}

.monster-art .eye:nth-child(odd) {
  translate: 0 calc(var(--odd-eye-offset, 0px) * -1);
}

.monster-art .eye:nth-child(even) {
  translate: 0 var(--odd-eye-offset, 0px);
}

.eye::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 3px;
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--outline);
}

.eyes-stalks .eye:nth-child(-n + 2),
.eyes-sleepy .eye:nth-child(-n + 2),
.eyes-three .eye:nth-child(-n + 3),
.eyes-swarm .eye,
.eyes-cyclops .eye:first-child {
  display: block;
}

.eyes-stalks .eyes { top: 12%; gap: 20px; }
.eyes-stalks .eye::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: -1;
  width: 5px;
  height: 30px;
  border-radius: 6px;
  background: var(--outline);
  transform: translateX(-50%);
}
.eyes-stalks .eye:first-child { transform: translateY(-8px) rotate(-8deg); }
.eyes-stalks .eye:nth-child(2) { transform: translateY(4px) rotate(9deg); }

.eyes-cyclops .eye {
  width: 42px;
  border-width: 5px;
}

.eyes-cyclops .eye::after {
  right: 6px;
  bottom: 8px;
  width: 15px;
}

.eyes-sleepy .eye {
  height: 10px;
  border-radius: 50% 50% 20% 20%;
  border-bottom: 0;
  background: transparent;
}

.eyes-three .eye:nth-child(2) { transform: translateY(-18px); }

.eyes-swarm .eyes {
  width: 70px;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 8px;
}

.eyes-swarm .eye { width: 14px; }

.mouth {
  position: absolute;
  right: auto;
  bottom: 25%;
  left: calc(50% + var(--odd-shift));
  z-index: 6;
  width: 44px;
  height: 24px;
  border: 3px solid var(--outline);
  background: oklch(24% 0.09 26);
  transform: translateX(-50%);
  rotate: var(--odd-mouth-rotate, 0deg);
  scale: var(--odd-mouth-x, 1) var(--odd-mouth-y, 1);
  transform-origin: center;
  box-shadow:
    inset 0 8px 8px oklch(6% 0.04 20 / 0.55),
    0 3px 3px oklch(8% 0.03 120 / 0.28);
}

.monster-art .head-piece {
  scale: var(--odd-head-scale, 1);
  transform-origin: center bottom;
}

.monster-art .arm.left {
  scale: var(--odd-arm-left, 1) 1;
  transform-origin: right center;
}

.monster-art .arm.right {
  scale: var(--odd-arm-right, 1) 1;
  transform-origin: left center;
}

.mouth i {
  position: absolute;
  display: none;
}

.mouth-grin .mouth {
  border-radius: 5px 5px 80% 80%;
}

.mouth-grin .mouth::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 30px;
  height: 4px;
  border-radius: 4px;
  background: oklch(93% 0.025 92);
}

.mouth-fangs .mouth {
  height: 31px;
  border-radius: 45% 55% 50% 50%;
}

.mouth-fangs .mouth i:nth-child(-n + 2) {
  top: -1px;
  display: block;
  width: 10px;
  height: 15px;
  background: oklch(93% 0.03 88);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.mouth-fangs .mouth i:first-child { left: 4px; }
.mouth-fangs .mouth i:nth-child(2) { right: 4px; }

.mouth-trumpet .mouth {
  left: calc(63% + var(--odd-shift));
  width: 43px;
  height: 17px;
  border-radius: 8px 3px 3px 8px;
  transform: rotate(-7deg);
}

.mouth-trumpet .mouth::after {
  content: "";
  position: absolute;
  top: -10px;
  right: -25px;
  width: 27px;
  height: 31px;
  border: 3px solid var(--outline);
  background: color-mix(in oklch, var(--monster-color) 62%, var(--sun));
  clip-path: polygon(0 31%, 100% 0, 100% 100%, 0 70%);
}

.mouth-beak .mouth {
  width: 47px;
  height: 27px;
  border: 0;
  background: var(--sun);
  clip-path: polygon(0 18%, 100% 0, 62% 54%, 100% 74%, 3% 100%, 28% 54%);
}

.mouth-zipper .mouth {
  width: 53px;
  height: 10px;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, var(--outline) 0 4px, transparent 4px 7px);
}

.instrument {
  position: absolute;
  right: -16px;
  bottom: 2px;
  z-index: 7;
  display: block;
  width: 76px;
  height: 67px;
  pointer-events: none;
  transform: translateZ(22px) rotate(-8deg);
  filter: drop-shadow(4px 7px 3px oklch(5% 0.03 120 / 0.35));
}

.instrument i {
  position: absolute;
  display: block;
}

.instrument-bone-guitar .instrument::before {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 48px;
  height: 48px;
  border: 4px solid var(--outline);
  border-radius: 55% 45% 48% 52%;
  background:
    radial-gradient(circle, var(--outline) 0 7px, transparent 8px),
    oklch(86% 0.04 86);
}

.instrument-bone-guitar .instrument::after {
  content: "";
  position: absolute;
  top: 7px;
  left: -1px;
  width: 56px;
  height: 14px;
  border: 4px solid var(--outline);
  border-radius: 9px;
  background: oklch(88% 0.04 86);
  transform: rotate(-28deg);
}

.instrument-bone-guitar .instrument i {
  top: 8px;
  left: 13px;
  z-index: 2;
  width: 2px;
  height: 57px;
  background: oklch(24% 0.03 90);
  transform: rotate(-29deg);
}
.instrument-bone-guitar .instrument i:nth-child(2) { left: 18px; }
.instrument-bone-guitar .instrument i:nth-child(3) { left: 23px; }

.instrument-drum .instrument {
  right: 8px;
  bottom: -2px;
  width: 68px;
  height: 52px;
  border: 5px solid var(--outline);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: inset 0 0 0 7px oklch(88% 0.04 86);
}

.instrument-tick .instrument i {
  bottom: 4px;
  width: 10px;
  height: 45px;
  border: 3px solid var(--outline);
  border-radius: 7px;
  background: oklch(90% 0.03 88);
}
.instrument-tick .instrument i:first-child { left: 15px; transform: rotate(-8deg); }
.instrument-tick .instrument i:nth-child(2) { left: 32px; height: 58px; }
.instrument-tick .instrument i:nth-child(3) { left: 49px; height: 38px; transform: rotate(9deg); }

.instrument-bass .instrument,
.instrument-lead .instrument {
  right: -31px;
  bottom: 20px;
  width: 72px;
  height: 20px;
  border: 4px solid var(--outline);
  border-radius: 999px 8px 8px 999px;
  background: var(--sun);
}

.instrument-bass .instrument::after,
.instrument-lead .instrument::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -10px;
  width: 28px;
  height: 33px;
  border: 4px solid var(--outline);
  background: var(--coral);
  clip-path: polygon(0 27%, 100% 0, 100% 100%, 0 72%);
}

.instrument-pad .instrument,
.instrument-tech-glitch .instrument {
  right: 4px;
  bottom: 3px;
  width: 78px;
  height: 39px;
  border: 4px solid var(--outline);
  border-radius: 5px;
  background:
    repeating-linear-gradient(90deg, oklch(92% 0.02 90) 0 8px, var(--outline) 9px 11px),
    oklch(28% 0.05 170);
}

.instrument-tech-glitch .instrument {
  background:
    linear-gradient(90deg, var(--coral) 0 23%, transparent 24% 32%, var(--sun) 33% 47%, transparent 48%),
    oklch(31% 0.13 214);
}

.instrument-crystal-bells .instrument i {
  bottom: 2px;
  width: 25px;
  height: 45px;
  border: 3px solid var(--outline);
  background: oklch(82% 0.14 310);
  clip-path: polygon(50% 0, 100% 70%, 70% 100%, 20% 90%, 0 65%);
}
.instrument-crystal-bells .instrument i:first-child { left: 4px; transform: rotate(-12deg); }
.instrument-crystal-bells .instrument i:nth-child(2) { left: 27px; height: 57px; }
.instrument-crystal-bells .instrument i:nth-child(3) { right: 0; height: 39px; transform: rotate(13deg); }

.instrument-venom-shaker .instrument {
  right: -8px;
  bottom: 8px;
  width: 36px;
  height: 62px;
  border: 4px solid var(--outline);
  border-radius: 50% 50% 42% 58%;
  background: repeating-linear-gradient(0deg, oklch(29% 0.17 322) 0 8px, var(--sun) 9px 12px);
}

.instrument-space-choir .instrument {
  right: -26px;
  bottom: 15px;
  width: 38px;
  height: 26px;
  border: 4px solid var(--outline);
  border-radius: 50%;
  background: oklch(25% 0.14 292);
  box-shadow:
    -88px -9px 0 -4px oklch(25% 0.14 292),
    -91px -9px 0 0 var(--outline);
}

.instrument-thunder-stomp .instrument {
  right: 8px;
  bottom: -11px;
  width: 91px;
  height: 19px;
  border: 4px solid var(--outline);
  border-radius: 50%;
  background: oklch(67% 0.15 243);
}

.instrument-fire-crackle .instrument i {
  right: 10px;
  bottom: 0;
  width: 23px;
  height: 51px;
  background: var(--coral);
  clip-path: polygon(55% 0, 100% 54%, 75% 100%, 16% 88%, 0 48%);
}
.instrument-fire-crackle .instrument i:nth-child(2) { right: 31px; height: 38px; background: var(--sun); transform: rotate(-14deg); }

.theme-mutation {
  position: absolute;
  inset: -17px;
  z-index: -1;
  pointer-events: none;
}

.theme-mutation i {
  position: absolute;
  display: none;
}

.growth-gear {
  position: absolute;
  z-index: 5;
  inset: auto 12px 22px;
  display: none;
  height: 15px;
  border: 3px solid var(--outline);
  border-radius: 5px;
  background: var(--sun);
}

.growth-bandling .growth-gear,
.growth-headliner .growth-gear {
  display: block;
}

.growth-gear i {
  position: absolute;
  top: 2px;
  width: 7px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--coral);
}

.growth-gear i:first-child {
  left: 16px;
}

.growth-gear i:last-child {
  right: 16px;
  background: var(--moss);
}

.growth-headliner .growth-gear {
  inset: 7px -9px auto;
  height: 46px;
  border-bottom: 0;
  border-radius: 40px 40px 0 0;
  background: transparent;
}

.growth-headliner .growth-gear i {
  top: 19px;
  width: 18px;
  border: 3px solid var(--outline);
  border-radius: 4px;
  background: var(--coral);
}

.growth-headliner .growth-gear i:first-child {
  left: -9px;
}

.growth-headliner .growth-gear i:last-child {
  right: -9px;
}

.theme-bone .theme-mutation i {
  display: block;
  width: 10px;
  height: 43px;
  border: 3px solid var(--outline);
  border-radius: 8px;
  background: oklch(90% 0.035 87);
}
.theme-bone .theme-mutation i:first-child { left: 4px; top: 45px; transform: rotate(-42deg); }
.theme-bone .theme-mutation i:nth-child(2) { right: 0; top: 69px; transform: rotate(50deg); }
.theme-bone .theme-mutation i:nth-child(3) { left: 53px; bottom: -6px; height: 29px; transform: rotate(82deg); }

.theme-crystal .theme-mutation i,
.theme-ice .theme-mutation i {
  bottom: 6px;
  display: block;
  width: 25px;
  height: 54px;
  border: 3px solid var(--outline);
  background: oklch(84% 0.13 303);
  clip-path: polygon(50% 0, 100% 72%, 70% 100%, 17% 91%, 0 61%);
}
.theme-crystal .theme-mutation i:first-child,
.theme-ice .theme-mutation i:first-child { left: 1px; transform: rotate(-24deg); }
.theme-crystal .theme-mutation i:nth-child(2),
.theme-ice .theme-mutation i:nth-child(2) { right: -2px; height: 42px; transform: rotate(22deg); }
.theme-ice .theme-mutation i { background: oklch(86% 0.1 218); }

.theme-fire .theme-mutation i,
.theme-lava .theme-mutation i {
  top: -4px;
  display: block;
  width: 31px;
  height: 48px;
  background: var(--coral);
  clip-path: polygon(45% 0, 100% 60%, 67% 100%, 4% 86%, 0 44%);
}
.theme-fire .theme-mutation i:first-child,
.theme-lava .theme-mutation i:first-child { left: 14px; transform: rotate(-18deg); }
.theme-fire .theme-mutation i:nth-child(2),
.theme-lava .theme-mutation i:nth-child(2) { right: 9px; height: 36px; transform: rotate(18deg); background: var(--sun); }

.theme-nature .theme-mutation i,
.theme-wind .theme-mutation i,
.theme-earth .theme-mutation i {
  display: block;
  width: 28px;
  height: 20px;
  border: 3px solid var(--outline);
  border-radius: 90% 10% 90% 10%;
  background: oklch(70% 0.16 143);
}
.theme-nature .theme-mutation i:first-child,
.theme-wind .theme-mutation i:first-child,
.theme-earth .theme-mutation i:first-child { left: 1px; top: 39px; transform: rotate(-33deg); }
.theme-nature .theme-mutation i:nth-child(2),
.theme-wind .theme-mutation i:nth-child(2),
.theme-earth .theme-mutation i:nth-child(2) { right: -3px; top: 68px; transform: rotate(35deg); }

.theme-technology .theme-mutation i,
.theme-time .theme-mutation i {
  display: block;
  width: 22px;
  aspect-ratio: 1;
  border: 3px solid var(--outline);
  background: oklch(72% 0.16 203);
}
.theme-technology .theme-mutation i:first-child,
.theme-time .theme-mutation i:first-child { left: -3px; top: 30px; transform: rotate(17deg); }
.theme-technology .theme-mutation i:nth-child(2),
.theme-time .theme-mutation i:nth-child(2) { right: -6px; bottom: 25px; border-radius: 50%; }

.theme-space .monster-body,
.theme-gravity .monster-body {
  box-shadow:
    inset -13px -18px 0 oklch(12% 0.03 100 / 0.15),
    0 0 0 7px oklch(74% 0.12 292 / 0.18),
    0 17px 18px oklch(5% 0.025 130 / 0.32);
}

.theme-darkness .theme-mutation i,
.theme-venom .theme-mutation i {
  display: block;
  width: 22px;
  height: 66px;
  border: 4px solid color-mix(in oklch, var(--monster-color) 70%, oklch(25% 0.14 312));
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
}
.theme-darkness .theme-mutation i:first-child,
.theme-venom .theme-mutation i:first-child { left: -8px; top: 28px; transform: rotate(-19deg); }
.theme-darkness .theme-mutation i:nth-child(2),
.theme-venom .theme-mutation i:nth-child(2) { right: -8px; top: 51px; transform: rotate(16deg); }

.theme-light .monster-body {
  box-shadow:
    inset -13px -18px 0 oklch(12% 0.03 100 / 0.1),
    0 0 35px color-mix(in oklch, var(--monster-color) 70%, var(--sun)),
    0 17px 18px oklch(5% 0.025 130 / 0.28);
}

.theme-thunder .monster-body {
  outline: 5px double oklch(78% 0.14 242 / 0.55);
  outline-offset: 3px;
}

.theme-devil .monster-body {
  box-shadow:
    inset -13px -18px 0 oklch(16% 0.08 25 / 0.28),
    0 17px 18px oklch(5% 0.025 130 / 0.32);
}

.playing .monster-art {
  animation: monster-groove 280ms var(--ease);
}

.playing .monster-body {
  animation: none;
}

.playing .mouth {
  animation: monster-sing 280ms var(--ease);
}

.workspace {
  display: grid;
  grid-template-columns: 450px minmax(420px, 1fr) 300px;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
  align-items: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in oklch, var(--panel) 88%, transparent);
  padding: var(--space-lg);
  box-shadow: 0 22px 70px oklch(0% 0 0 / 0.18);
}

.composer {
  overflow: hidden;
}

.monster-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  margin: var(--space-lg) 0;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse at center, oklch(73% 0.09 151 / 0.16), transparent 66%),
    oklch(20% 0.045 140);
  perspective: 800px;
  box-shadow:
    inset 0 -35px 55px oklch(7% 0.035 135 / 0.44),
    inset 0 1px 0 oklch(90% 0.03 92 / 0.08);
}

.monster-preview .monster-art {
  --stage-yaw: -8deg;
  filter: drop-shadow(0 22px 14px oklch(5% 0.02 130 / 0.4));
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.builder-section {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--line);
}

.builder-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.builder-label {
  margin: 0;
  color: var(--sun);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.anatomy-section {
  position: relative;
}

.anatomy-section::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 0;
  width: 44px;
  height: 8px;
  border-radius: 50%;
  background: repeating-linear-gradient(90deg, var(--sun) 0 4px, transparent 4px 8px);
  opacity: 0.48;
}

.controls-grid strong {
  color: var(--sun);
  float: right;
}

label {
  display: grid;
  gap: var(--space-xs);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(18% 0.04 138);
  color: var(--ink);
  padding: 0 var(--space-md);
}

input[type='color'] {
  padding: 4px;
}

.file-button {
  display: grid;
  place-items: center;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-row {
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.record-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.record-dot {
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px oklch(71% 0.18 31 / 0.16);
}

.record-button.recording {
  border-color: var(--coral);
  background: oklch(31% 0.09 25);
}

.record-button.recording .record-dot {
  animation: record-pulse 900ms ease-in-out infinite;
}

.recording-cancel {
  width: 42px;
  min-height: 42px;
  color: var(--coral);
}

.recording-cancel[hidden] {
  display: none;
}

.recording-status {
  flex: 1 0 100%;
  min-height: 1.3em;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.upload-row button:disabled,
.upload-row input:disabled + * {
  cursor: not-allowed;
  opacity: 0.5;
}

@keyframes record-pulse {
  0%,
  100% {
    transform: scale(0.82);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.16);
    opacity: 1;
  }
}

.beat-ruler,
.sequencer-row {
  display: grid;
  grid-template-columns: 110px repeat(16, minmax(22px, 1fr));
  gap: var(--space-xs);
  align-items: center;
}

.composer-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 2px;
  margin-top: var(--space-lg);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: oklch(20% 0.035 140);
}

.composer-tab {
  min-height: 36px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.composer-tab.active {
  background: var(--sun);
  color: oklch(18% 0.05 145);
}

.composer-view[hidden] {
  display: none;
}

.melody-toolbar {
  display: flex;
  align-items: end;
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-md);
}

.melody-toolbar label {
  display: grid;
  gap: var(--space-xs);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.melody-toolbar select {
  min-width: 150px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: oklch(20% 0.035 140);
  color: var(--ink);
  padding: 0 var(--space-md);
}

.melody-grid {
  display: grid;
  grid-template-columns: 54px repeat(16, minmax(22px, 1fr));
  gap: var(--space-xs);
  align-items: center;
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}

.melody-corner,
.melody-beat,
.melody-note {
  color: var(--dim);
  font-size: 0.68rem;
  font-weight: 800;
}

.melody-corner {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.melody-beat {
  text-align: center;
}

.melody-note {
  text-align: right;
  padding-right: var(--space-xs);
}

.melody-step {
  width: 100%;
  min-width: 22px;
  aspect-ratio: 1.45;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: oklch(20% 0.035 140);
  padding: 0;
}

.melody-step:nth-of-type(32n + 9),
.melody-step:nth-of-type(32n + 10),
.melody-step:nth-of-type(32n + 11),
.melody-step:nth-of-type(32n + 12),
.melody-step:nth-of-type(32n + 13),
.melody-step:nth-of-type(32n + 14),
.melody-step:nth-of-type(32n + 15),
.melody-step:nth-of-type(32n + 16) {
  background: oklch(22% 0.04 145);
}

.melody-step.active {
  border-color: var(--moss);
  background: var(--moss);
  box-shadow: inset 0 -4px 0 oklch(45% 0.11 151 / 0.5);
}

.melody-step.current {
  outline: 2px solid var(--coral);
  outline-offset: 1px;
}

.beat-ruler {
  margin: var(--space-lg) 0 var(--space-sm);
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 800;
}

.sequencer {
  display: grid;
  gap: var(--space-sm);
  overflow-x: auto;
  padding-bottom: var(--space-xs);
}

.track-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-sm);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.track-toggle {
  position: relative;
  flex: 0 0 auto;
  width: 18px;
  aspect-ratio: 1;
  border: 2px solid color-mix(in oklch, var(--monster-color), white 18%);
  border-radius: 50%;
  background: var(--monster-color);
  padding: 0;
  box-shadow: 0 0 0 2px transparent;
}

.track-toggle:hover,
.track-toggle:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--monster-color), transparent 68%);
}

.track-toggle.is-muted {
  background: transparent;
  opacity: 0.62;
}

.track-toggle.is-muted::after {
  position: absolute;
  content: "";
  width: 2px;
  height: 18px;
  top: -2px;
  left: 6px;
  border-radius: 2px;
  background: var(--monster-color);
  rotate: -42deg;
}

.track-copy {
  display: grid;
  min-width: 0;
  line-height: 1.08;
}

.track-copy > span {
  overflow-wrap: anywhere;
}

.track-theme-select,
.track-range-select,
.track-depth-select {
  width: 100%;
  min-width: 0;
  margin-top: 3px;
  border: 0;
  border-radius: 3px;
  background: color-mix(in oklch, var(--panel), white 5%);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 2px 14px 2px 3px;
}

.track-range-select {
  color: color-mix(in oklch, var(--muted), var(--sun) 35%);
}

.track-depth-select {
  color: color-mix(in oklch, var(--muted), var(--moss) 38%);
}

.sequencer-row.muted .step {
  opacity: 0.38;
}

.step {
  width: 100%;
  aspect-ratio: 1;
  min-width: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: oklch(20% 0.035 140);
  padding: 0;
}

.step.active {
  background: var(--sun);
  border-color: var(--sun);
  box-shadow: 0 0 0 2px oklch(84% 0.15 78 / 0.2);
}

.step.current {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.microcopy {
  color: var(--muted);
  line-height: 1.45;
}

.rhythm-track {
  position: relative;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(18% 0.04 140);
  margin: var(--space-lg) 0 var(--space-md);
}

.target-zone {
  position: absolute;
  inset: 0 auto 0 48%;
  width: 18%;
  background: oklch(84% 0.15 78 / 0.18);
}

.pulse {
  position: absolute;
  top: 14px;
  left: 0;
  width: 42px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 28px oklch(71% 0.18 31 / 0.45);
  transform: translateX(0);
}

.pulse.running {
  animation: sweep 1600ms linear infinite;
}

.score {
  color: var(--sun);
}

.growth-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.growth-row label {
  display: grid;
  gap: var(--space-xs);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.growth-row select {
  min-width: 150px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: oklch(20% 0.035 140);
  color: var(--ink);
  padding: 0 var(--space-md);
}

.growth-row strong {
  color: var(--moss);
  font-size: 0.78rem;
  text-align: right;
}

.unlock-list {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.unlock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--muted);
  font-size: 0.86rem;
}

.unlock-item strong {
  color: var(--ink);
}

@keyframes bob {
  0%,
  100% {
    transform: scaleY(1) translateY(0);
  }
  45% {
    transform: scaleY(1.08) translateY(-8px);
  }
}

@keyframes sing {
  0%,
  100% {
    transform: scaleY(1);
  }
  45% {
    transform: scaleY(1.8);
  }
}

@keyframes monster-groove {
  0%,
  100% {
    transform: rotateX(-2deg) rotateY(var(--stage-yaw)) rotateZ(var(--odd-tilt)) scale(var(--monster-scale, 1));
  }
  45% {
    transform: translateY(-9px) rotateX(-1deg) rotateY(0deg) rotateZ(0deg) scale(var(--monster-scale, 1)) scaleX(1.04) scaleY(0.96);
  }
}

@keyframes monster-sing {
  0%,
  100% {
    transform: translateX(-50%) scaleY(1);
  }
  45% {
    transform: translateX(-50%) scaleY(1.65) scaleX(0.9);
  }
}

@keyframes sweep {
  from {
    transform: translateX(-42px);
  }
  to {
    transform: translateX(calc(100vw + 42px));
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .composer {
    grid-column: 1 / -1;
    order: 3;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 720px);
    padding-top: var(--space-lg);
  }

  .topbar,
  .workspace {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .transport {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .tempo-control {
    grid-template-columns: auto 1fr 3ch;
    width: 100%;
  }

  .stage {
    min-height: 260px;
  }

  .island {
    inset-inline: -12%;
  }

  .band-stage {
    gap: 0;
    padding-inline: 0;
  }

  .stage-monster {
    width: 31%;
    min-width: 0;
  }

  .stage-monster .monster-art {
    width: 118px;
    scale: 0.72;
  }

  .beat-ruler,
  .sequencer-row,
  .melody-grid {
    grid-template-columns: 126px repeat(16, 28px);
    min-width: max-content;
  }

  .beat-ruler {
    width: 100%;
    overflow: hidden;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .melody-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .melody-toolbar label,
  .melody-toolbar select,
  .melody-toolbar .small-button {
    width: 100%;
  }

  .growth-row {
    align-items: stretch;
    flex-direction: column;
  }

  .growth-row strong {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
