.drum-room {
  color: var(--ink, #282338);
}

.drum-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-block-end: 1.5rem;
}

.drum-heading h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 .4rem;
  line-height: 1.16;
}

.drum-heading p {
  margin: 0;
  color: var(--muted, #625a73);
}

.drum-toggle {
  display: inline-flex;
  border: 1px solid var(--line, #e9e3ef);
  background: var(--surface, #fffcff);
  border-radius: 1rem;
  padding: .25rem;
  gap: .25rem;
}

.drum-toggle button {
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: var(--muted, #625a73);
  min-height: 3rem;
  padding: .5rem .85rem;
  border: 1px solid transparent;
  border-radius: .7rem;
  background: transparent;
  white-space: nowrap;
}

.drum-toggle button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent, #694ebe) 13%, var(--surface, #fffcff));
  color: var(--accent, #694ebe);
  border-color: color-mix(in srgb, var(--accent, #694ebe) 23%, transparent);
}

.drum-console {
  container: drum-kit / inline-size;
  background: var(--surface, #fffcff);
  border: 1px solid var(--line, #e9e3ef);
  border-radius: 1.4rem;
  padding: clamp(.8rem, 3vw, 1.55rem);
}

.drum-console-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  margin-block-end: .85rem;
}

.drum-volume {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted, #625a73);
  font-size: .9rem;
  min-height: 2.75rem;
}

.drum-volume input {
  width: clamp(5rem, 17vw, 8rem);
  min-height: 2.75rem;
  accent-color: var(--accent, #694ebe);
  cursor: pointer;
}

.drum-volume output {
  min-width: 3rem;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.drum-hit {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.75rem;
  font-size: .93rem;
}

.drum-hit [lang="en"] {
  color: var(--muted, #625a73);
}

.drum-hit-wave {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 2rem;
  height: 2rem;
  border-radius: .65rem;
  color: var(--accent, #7253a3);
  background: var(--accent-soft, #ede5f9);
}

.drum-hit-wave i {
  width: 2px;
  height: 8px;
  border-radius: 3px;
  background: currentColor;
}

.drum-hit-wave i:nth-child(2) { height: 15px; }
.drum-hit-wave i:nth-child(3) { height: 11px; }

.drum-stage {
  --spot: #584865;
  --stage-edge: #231c2e;
  --rug: #3d314a;
  --skin-center: #e3d7c8;
  --skin-edge: #a99a97;
  --steel: #b9afb9;
  --bronze-light: #d6ab68;
  --bronze-mid: #af7d45;
  --bronze-dark: #78512e;
  isolation: isolate;
  position: relative;
  overflow: hidden;
  inline-size: 100%;
  min-block-size: 20rem;
  max-block-size: min(68dvh, 37rem);
  aspect-ratio: 1.85;
  border: 1px solid #100c1c55;
  border-radius: 1rem;
  background:
    radial-gradient(ellipse at 50% 5%, var(--spot), transparent 66%),
    radial-gradient(ellipse at 50% 65%, var(--rug), var(--stage-edge) 88%);
  box-shadow: inset 0 2px 18px #130c1bcc;
}

:root[data-theme="dark"] .drum-stage {
  --spot: #46394f;
  --stage-edge: #18131f;
  --rug: #30253a;
  --skin-center: #d0c0af;
  --skin-edge: #8e7c7b;
  --steel: #a69ba9;
  --bronze-light: #c39b5c;
  --bronze-mid: #9d713f;
  --bronze-dark: #6e4828;
}

.drum-stage::before {
  position: absolute;
  inset: 6% 4% -8%;
  z-index: -1;
  transform: perspective(11rem) rotateX(12deg);
  transform-origin: center bottom;
  border-radius: 44% 44% 11% 11%;
  border: 1px solid #b6a2ba35;
  box-shadow: inset 0 0 0 5px #2118285c, 0 1em 2em #140e1b91;
  background:
    repeating-linear-gradient(17deg, #120b191f 0 1px, transparent 1px 4px),
    repeating-linear-gradient(101deg, #d4c2d017 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at 50% 52%, #6b577b5a, #241b2f66 82%);
  content: "";
  pointer-events: none;
}

.drum-pad {
  --shell-light: #7b608b;
  --shell-dark: #30233e;
  --turn: 0deg;
  position: absolute;
  left: var(--pos-x);
  top: var(--pos-y);
  width: var(--pad-w);
  height: var(--pad-h);
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%) rotate(var(--turn));
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  filter: drop-shadow(0 .4rem .24rem #130b19a6);
  color: #291d30;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.drum-pad[data-pad="crash"] { --turn: -12deg; }
.drum-pad[data-pad="ride"] { --turn: 12deg; }
.drum-pad[data-pad="closedhat"] { --turn: -6deg; }
.drum-pad[data-pad="openhat"] { --turn: -10deg; }
.drum-pad[data-pad="snare"] {
  --turn: -8deg;
  --shell-light: #935e80;
  --shell-dark: #402339;
}

.drum-pad[data-pad="lowtom"] {
  --turn: 10deg;
  --shell-light: #6b777c;
  --shell-dark: #25363d;
}

.drum-pad[data-pad="hightom"] { --turn: -6deg; }
.drum-pad[data-pad="midtom"] { --turn: 5deg; }

.drum-pad > span,
.drum-head > span { pointer-events: none; }

.drum-stand {
  position: absolute;
  inset: 33% 23% -18%;
  background: linear-gradient(to right, #bfaec28c, #332939 60%, #12101b) center / 5px 100% no-repeat;
}

.drum-stand::before,
.drum-stand::after {
  position: absolute;
  left: calc(50% - 2px);
  bottom: 4%;
  width: 5px;
  height: 40%;
  border-radius: 4px;
  background: linear-gradient(to right, #d0c5d0a3, #4a3b53 65%, #1b1321);
  box-shadow: 0 2px 1px #14101a;
  transform-origin: center top;
  transform: rotate(52deg);
  content: "";
}

.drum-stand::after { transform: rotate(-52deg); }

.drum-body {
  position: absolute;
  inset: 15% 3% 7%;
  border-radius: 32% 32% 49% 49% / 36% 36% 25% 25%;
  border: 1px solid #221426;
  border-bottom: 3px solid #96869b;
  background:
    linear-gradient(0deg, #21182644, transparent 38%, #ead6ef35 69%),
    repeating-linear-gradient(0deg, #ffeafa18 0 1px, transparent 1px 5px),
    linear-gradient(90deg, var(--shell-dark) 0%, var(--shell-light) 24%, var(--shell-light) 46%, var(--shell-dark) 95%);
  box-shadow: inset 0 -5px #130c1d43, inset 0 -7px #d3bfcc30;
}

.drum-body::before {
  position: absolute;
  inset: 35% 3% 15%;
  border-radius: 45% 45% 38% 38%;
  background: repeating-linear-gradient(90deg, transparent 0 11%, #302037 12% 13%, #d9cbd6 13.5% 14.7%, #6a5b72 15% 16%, transparent 17% 23%);
  mask-image: linear-gradient(90deg, #0005, #000 20% 80%, #0005);
  content: "";
}

.drum-head {
  position: absolute;
  inset: 3% 2.5% 28%;
  overflow: hidden;
  border: 1px solid #302538;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 42% 39%, #fff5e14a 0 18%, transparent 57%),
    repeating-radial-gradient(ellipse at 38% 35%, #65557216 0 1px, transparent 2px 3px),
    radial-gradient(ellipse at 42% 35%, var(--skin-center) 9%, var(--skin-edge) 72%, #796876 100%);
  box-shadow: inset 0 0 0 2px var(--steel), inset 0 0 0 4px #50414c, inset 0 0 0 6px #e4d7ca79, inset 0 -.34rem .5rem #37253846, 0 .17rem 0 #514254;
  transition: transform 100ms ease-out, filter 100ms ease-out;
}

.drum-detail {
  position: absolute;
  inset: 2%;
  border-radius: inherit;
  border: 1px solid #f6e2e783;
}

.drum-detail::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-conic-gradient(from -2deg, #3a313e 0deg 2deg, #e5d9d8 2deg 4deg, transparent 4deg 36deg);
  mask-image: radial-gradient(ellipse, transparent 0 63%, #000 65% 73%, transparent 74%);
  content: "";
}

.drum-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .35em;
  line-height: 1;
  padding: .3em .38em;
  border: 1px solid #ead8dc2b;
  border-radius: .48rem;
  background: #201725db;
  color: #fff6f2;
  font-size: clamp(.81rem, 2cqw, 1rem);
  font-weight: 800;
  white-space: nowrap;
}

.drum-label kbd {
  padding-inline-start: .33em;
  border-left: 1px solid #f3e4ed63;
  color: #e4c9df;
  font: 650 .76em/1 system-ui, sans-serif;
}

.drum-pad[data-shape="kick"] {
  --shell-light: #705977;
  --shell-dark: #2b2337;
}

.drum-pad[data-shape="kick"] .drum-head {
  inset: 1% 1% 19%;
  background:
    radial-gradient(ellipse at 47% 46%, #d4c3cf25, transparent 64%),
    repeating-radial-gradient(ellipse at 49% 46%, #e8d2ef0d 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at 42% 33%, #5b4c65, #2d2639 85%);
  box-shadow: inset 0 0 0 3px #b3a1b4, inset 0 0 0 5px #4e3a51, inset 0 0 0 7px #9b829568, 0 .19rem 0 #231a2d;
}

.drum-pad[data-shape="kick"] .drum-detail {
  inset: 8%;
  border-color: #dbcee633;
}

.drum-pad[data-shape="kick"] .drum-detail::after {
  position: absolute;
  inset: 63% 13% 12% auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #82758c;
  background: #1e1827;
  box-shadow: inset 0 1px .4rem #08050b;
  content: "";
}

.drum-pad[data-shape="kick"] .drum-stand {
  inset: 52% 4% -11%;
  background: none;
}

.drum-pad[data-shape="kick"] .drum-stand::before { left: 18%; transform: rotate(38deg); }
.drum-pad[data-shape="kick"] .drum-stand::after { left: 82%; transform: rotate(-38deg); }

.drum-pad[data-shape="cymbal"] .drum-body {
  inset: 15% 0 25%;
  border-radius: 50%;
  background: var(--bronze-dark);
  border: 1px solid #563b29;
  box-shadow: 0 .28rem .38rem #1c111f94;
}

.drum-pad[data-shape="cymbal"] .drum-body::before { content: none; }

.drum-pad[data-shape="cymbal"] .drum-head {
  inset: 12% 0 29%;
  border-color: #583d2a;
  background:
    repeating-radial-gradient(ellipse at center, #6a3e2624 0 1px, #ffdfaa30 1px 2px, transparent 2px 4px),
    conic-gradient(from -55deg, var(--bronze-light), var(--bronze-mid) 20%, var(--bronze-light) 39%, var(--bronze-dark) 57%, var(--bronze-mid) 75%, var(--bronze-light));
  box-shadow: inset 0 0 0 2px #ecc082aa, inset 0 -.28rem .45rem #5d321d75;
}

.drum-pad[data-shape="cymbal"] .drum-detail {
  inset: 16% 11%;
  border-color: #68422071;
}

.drum-pad[data-shape="cymbal"] .drum-detail::before {
  inset: 22% 36%;
  mask-image: none;
  border: 1px solid #935f34;
  box-shadow: inset 0 .24rem .4rem #f4d79691;
  background: radial-gradient(ellipse at 41% 35%, #eed196, var(--bronze-mid) 74%);
}

.drum-pad[data-shape="cymbal"] .drum-detail::after {
  position: absolute;
  inset: 44% 47%;
  min-width: 6px;
  min-height: 5px;
  border-radius: 50%;
  background: #3d2d2a;
  box-shadow: 0 -1px 0 #e9d3b2;
  content: "";
}

.drum-pad[data-shape="cymbal"] .drum-label { transform: translateY(62%); }

.drum-pad[data-pad="openhat"] .drum-body { bottom: 16%; }

.drum-pad[data-pad="openhat"] .drum-head {
  inset: 9% 2% 32%;
  transform: rotate(8deg);
}

.drum-pad[data-pad="closedhat"] .drum-body { bottom: 22%; }

.drum-pad:is([data-shape="rim"], [data-shape="pad"], [data-shape="bell"]) .drum-stand { display: none; }

.drum-pad[data-shape="rim"] .drum-head {
  inset: 3% 0 13%;
  background: radial-gradient(ellipse, #57465e 52%, #302738 72%, #a195a4 73% 78%, #483954 79%);
}

.drum-pad[data-shape="rim"] .drum-label { font-size: .78rem; }

.drum-pad:is([data-shape="pad"], [data-shape="bell"]) .drum-body,
.drum-pad:is([data-shape="pad"], [data-shape="bell"]) .drum-head {
  border-radius: .65rem;
}

.drum-pad[data-shape="pad"] .drum-body {
  border-color: #a18baf;
  background: #372d41;
}

.drum-pad[data-shape="pad"] .drum-head {
  inset: 8% 5% 22%;
  background:
    repeating-linear-gradient(to right, transparent 0 20%, #120f1970 20% 23%),
    repeating-linear-gradient(to bottom, transparent 0 30%, #120f1970 30% 35%),
    linear-gradient(155deg, #a58ead, #685675);
  box-shadow: inset 0 0 0 2px #aa91b766;
}

.drum-pad[data-shape="bell"] { --turn: 9deg; }
.drum-pad[data-shape="bell"] .drum-head {
  inset: 8% 3% 18%;
  clip-path: polygon(12% 4%, 88% 4%, 99% 94%, 1% 94%);
  background: linear-gradient(147deg, #cbb481, #745a46 80%);
  box-shadow: inset 0 0 0 2px #d0aa7873;
}

.drum-pad:is([data-shape="pad"], [data-shape="bell"]) .drum-detail { display: none; }

.drum-pad:focus-visible {
  outline: 3px solid #f7d6ff;
  outline-offset: 1px;
}

.drum-pad[data-playing] .drum-head {
  filter: brightness(1.27);
  transform: translateY(.13rem) scale(.975);
  transition-duration: 45ms;
}

.drum-pad[data-pad="openhat"][data-playing] .drum-head {
  transform: rotate(3deg) translateY(.12rem) scale(.975);
}

@media (hover: hover) {
  .drum-pad:hover .drum-head { filter: brightness(1.14); }
  .drum-pad[data-playing]:hover .drum-head { filter: brightness(1.27); }
}

@media (pointer: coarse) {
  .drum-label kbd { display: none; }
}

@container drum-kit (max-width: 600px) {
  .drum-stage {
    aspect-ratio: 1.13;
    max-block-size: none;
  }
}

@container drum-kit (max-width: 390px) {
  .drum-label { font-size: .77rem; letter-spacing: -.035em; }
  .drum-label kbd { display: none; }
  .drum-pad[data-shape="rim"] .drum-label { font-size: .68rem; }
  .drum-stage::before { inset-inline: 1%; }
}

@media (max-width: 470px) {
  .drum-heading { margin-block-end: .9rem; }
  .drum-toggle { flex-grow: 1; }
  .drum-toggle button { flex: 1; }
  .drum-console-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .15rem .45rem;
  }
  .drum-hit {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    grid-template-rows: 1.1rem 1rem;
    align-content: center;
    gap: .05rem .3rem;
  }
  .drum-hit-wave { grid-row: 1 / span 2; }
  .drum-hit [lang="en"] {
    grid-column: 2;
    font-size: .8rem;
    white-space: nowrap;
  }
  .drum-volume { gap: .26rem; }
  .drum-volume input { width: 3.75rem; }
  .drum-volume output { min-width: 2.1rem; }
}
