:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

.audio-island {
  --island-x: 0px;
  --island-y: 0px;
  position: fixed;
  z-index: 120;
  right: calc(.9rem + var(--safe-right));
  bottom: calc(.9rem + var(--safe-bottom));
  width: max-content;
  max-width: calc(100vw - 1.25rem - var(--safe-left) - var(--safe-right));
  transform: translate3d(var(--island-x), var(--island-y), 0);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.audio-island__shell {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.6rem;
  padding: .4rem .55rem .4rem .7rem;
  color: #f5eddd;
  background: rgba(8, 18, 13, .9);
  border: 1px solid rgba(240, 217, 128, .28);
  border-radius: 999px;
  box-shadow:
    0 10px 36px rgba(0, 0, 0, .38),
    inset 0 1px 0 rgba(245, 237, 221, .08);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  transition:
    background .28s ease,
    border-color .28s ease,
    color .28s ease,
    box-shadow .28s ease,
    min-width .28s cubic-bezier(.22, 1, .36, 1),
    padding .28s cubic-bezier(.22, 1, .36, 1);
}

.audio-island.is-dragging .audio-island__shell,
.audio-island.is-expanded .audio-island__shell {
  border-color: rgba(240, 217, 128, .55);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, .42),
    inset 0 1px 0 rgba(245, 237, 221, .12);
}

.audio-island.is-on .audio-island__shell {
  color: #08120d;
  background: linear-gradient(180deg, #f0d980, #c99d35);
  border-color: #f0d980;
}

.audio-island.has-error .audio-island__shell {
  border-color: rgba(240, 217, 128, .65);
}

.audio-island__grip {
  width: 1.55rem;
  min-width: 1.55rem;
  height: 2rem;
  display: grid;
  gap: .16rem;
  align-content: center;
  justify-items: stretch;
  padding: 0;
  color: inherit;
  opacity: .75;
  background: transparent;
  border: 0;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.audio-island__grip i {
  height: 1.5px;
  background: currentColor;
  border-radius: 999px;
}

.audio-island.is-dragging .audio-island__grip {
  cursor: grabbing;
  opacity: 1;
}

.audio-island__toggle {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2rem;
  padding: 0 .15rem 0 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: 600 .62rem/1 "Inter", sans-serif;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.audio-island__toggle:focus-visible {
  outline: 2px solid #f0d980;
  outline-offset: 3px;
  border-radius: .6rem;
}

.audio-island__signal {
  width: 1rem;
  height: .8rem;
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.audio-island__signal i {
  width: .14rem;
  height: 45%;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform-origin: bottom;
}

.audio-island__signal i:nth-child(2) { height: 100%; }
.audio-island__signal i:nth-child(3) { height: 70%; }

.audio-island.is-on .audio-island__signal i {
  animation: draft2AudioSignal .72s ease-in-out infinite alternate;
}

.audio-island.is-on .audio-island__signal i:nth-child(2) { animation-delay: .16s; }
.audio-island.is-on .audio-island__signal i:nth-child(3) { animation-delay: .3s; }

.audio-island__label {
  white-space: nowrap;
}

.audio-island__hint {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  color: inherit;
  font: 500 .58rem/1 "Inter", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: max-width .28s cubic-bezier(.22, 1, .36, 1), opacity .2s ease, margin .28s ease;
}

.audio-island.is-expanded .audio-island__hint,
.audio-island.is-dragging .audio-island__hint {
  max-width: 9rem;
  margin-right: .15rem;
  opacity: .78;
}

@keyframes draft2AudioSignal {
  from { transform: scaleY(.34); }
  to { transform: scaleY(1); }
}

@media (max-width: 720px) {
  .audio-island {
    top: auto;
    right: calc(.65rem + var(--safe-right));
    bottom: calc(.65rem + var(--safe-bottom));
    left: auto;
    transform: none;
  }

  .audio-island__shell {
    min-height: 2.85rem;
    gap: .45rem;
    padding: .45rem .7rem .45rem .65rem;
  }

  .audio-island__grip {
    display: none;
  }

  .audio-island__toggle {
    min-height: 2.2rem;
    font-size: .6rem;
  }

  .audio-island__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
  }

  .audio-island.is-expanded .audio-island__hint,
  .audio-island.is-dragging .audio-island__hint {
    max-width: 7.5rem;
  }
}

@media (max-width: 380px) {
  .audio-island__hint {
    display: none;
  }
}

body.admin-bar .audio-island {
  bottom: calc(.9rem + var(--safe-bottom));
}

@media screen and (max-width: 782px) {
  body.admin-bar .audio-island {
    top: auto;
    bottom: calc(.65rem + var(--safe-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .audio-island__shell,
  .audio-island__hint,
  .audio-island__signal i {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
