.music-toggle {
  position: fixed;
  z-index: 45;
  right: max(14px, calc(50vw - 240px + 14px));
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgb(243 230 234 / 0.45);
  border-radius: 50%;
  background: rgb(92 7 37 / 0.82);
  color: #f3e6ea;
  box-shadow: 0 8px 18px -8px rgb(10 0 4 / 0.7);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1), background-color 0.2s, bottom 0.45s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.music-toggle svg {
  width: 20px;
  height: 20px;
  overflow: visible;
}

.music-toggle__note {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: 50% 80%;
}

.music-toggle__slash {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.2s;
}

.music-toggle.is-off {
  background: rgb(92 7 37 / 0.55);
  color: rgb(243 230 234 / 0.7);
}

.music-toggle.is-off .music-toggle__slash {
  opacity: 1;
}

.music-toggle.is-playing .music-toggle__note {
  animation: music-sway 2.4s ease-in-out infinite;
}

@keyframes music-sway {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

@media (hover: hover) {
  .music-toggle:hover {
    transform: translateY(-2px);
    background: rgb(92 7 37 / 0.95);
  }
}

.music-toggle:active,
.music-toggle.is-pressed {
  transform: scale(0.92);
  transition-duration: 0.08s;
}

.music-toggle:focus-visible {
  outline: 2px solid #f3e6ea;
  outline-offset: 3px;
}

body:has(.savebar.is-shown) .music-toggle {
  bottom: calc(86px + env(safe-area-inset-bottom));
}

.lang-toggle {
  position: fixed;
  z-index: 45;
  top: calc(12px + env(safe-area-inset-top));
  right: max(14px, calc(50vw - 240px + 14px));
  display: flex;
  padding: 3px;
  border: 1px solid rgb(243 230 234 / 0.45);
  border-radius: 999px;
  background: rgb(92 7 37 / 0.82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgb(40 2 16 / 0.28);
}

.lang-toggle button {
  min-width: 44px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #f3e6ea;
  font: 600 13px/1 Lora, Georgia, serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lang-toggle button[aria-pressed="true"] {
  background: #f3e6ea;
  color: #7e0a34;
}

.lang-toggle button:focus-visible {
  outline: 2px solid #f3e6ea;
  outline-offset: 2px;
}
