/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 46px;
  min-width: 46px;
  padding: 0 1.1em;
  border: 1px solid rgba(201, 162, 79, 0.55);
  border-radius: 999px;
  background: rgba(14, 24, 18, 0.78);
  color: var(--gold-hi);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-ui) var(--ease-out),
    border-color var(--dur-ui) var(--ease-out),
    opacity var(--dur-ui) var(--ease-out);
}

.btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) {
    background-color: rgba(28, 46, 34, 0.92);
    border-color: rgba(243, 217, 139, 0.85);
  }
}

.btn--primary {
  border-color: rgba(243, 217, 139, 0.7);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25), 0 6px 18px -8px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 236, 180, 0.12);
}

.btn--open {
  min-height: 50px;
  padding: 0 1.8em;
  font-size: 1.08rem;
  animation: open-btn-in 900ms var(--ease-out) 1.1s both;
}

.btn--open:disabled {
  opacity: 1;
  cursor: default;
}

@keyframes open-btn-in {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

.btn--icon {
  padding: 0;
  width: 46px;
}
.btn--icon .btn__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.btn--icon[aria-pressed='true'] {
  background: rgba(201, 162, 79, 0.18);
  border-style: dashed;
}

/* ---------- Botones de música: esferas doradas con alas ---------- */
.btn--winged,
.btn--winged[aria-pressed='true'] {
  --flap: 150ms;
  overflow: visible;
  border: 0;
  background:
    radial-gradient(circle at 40% 34%, rgba(255, 250, 225, 0.95) 0, rgba(255, 246, 207, 0) 7px),
    radial-gradient(circle, transparent 15.4px, rgba(110, 76, 22, 0.55) 15.9px, transparent 16.5px),
    radial-gradient(circle at 50% 50%, #f1d27e 0, #c9a24f 10px, #8a6420 16.5px, transparent 17px);
  color: #3d2608;
  filter: drop-shadow(0 0 7px rgba(243, 217, 139, 0.45)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
}

.btn--winged svg {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
}

/* Alas: plumas color marfil con filo dorado, unidas al borde de la esfera */
.btn--winged::before,
.btn--winged::after {
  content: '';
  position: absolute;
  top: calc(50% - 15px);
  width: 32px;
  height: 19px;
  background: center / contain no-repeat;
  animation: var(--flap) ease-in-out infinite alternate;
  pointer-events: none;
}

.btn--winged::after {
  left: calc(50% + 13px);
  transform-origin: 0 65%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cpath d='M1 15C9 5 23 1 39 2c-5 3-8 5-12 6.5 5 0 9 1 11 3-6 1.5-11 2-15 2 4 1 7 3 8 5-9 1.5-19 1-30-1.5z' fill='%23f6eed6' stroke='%23b8903f' stroke-width='.9'/%3E%3Cpath d='M6 15c8-5 18-8 28-10M8 16c8-3 17-4.5 25-5M9 17c7-1 13-1 19 0' fill='none' stroke='%23c9a24f' stroke-width='.6' opacity='.8'/%3E%3C/svg%3E");
  animation-name: wing-right;
}

.btn--winged::before {
  right: calc(50% + 13px);
  transform-origin: 100% 65%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 24'%3E%3Cg transform='translate(40 0) scale(-1 1)'%3E%3Cpath d='M1 15C9 5 23 1 39 2c-5 3-8 5-12 6.5 5 0 9 1 11 3-6 1.5-11 2-15 2 4 1 7 3 8 5-9 1.5-19 1-30-1.5z' fill='%23f6eed6' stroke='%23b8903f' stroke-width='.9'/%3E%3Cpath d='M6 15c8-5 18-8 28-10M8 16c8-3 17-4.5 25-5M9 17c7-1 13-1 19 0' fill='none' stroke='%23c9a24f' stroke-width='.6' opacity='.8'/%3E%3C/g%3E%3C/svg%3E");
  animation-name: wing-left;
}

@keyframes wing-right {
  from { transform: rotate(24deg); }
  to { transform: rotate(-32deg); }
}

@keyframes wing-left {
  from { transform: rotate(-24deg); }
  to { transform: rotate(32deg); }
}

/* Música en pausa o silenciada: la esfera se apaga un poco y pliega las alas */
.btn--winged[aria-pressed='true'] {
  filter: saturate(0.55) brightness(0.85) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
}
.btn--winged[aria-pressed='true']::before,
.btn--winged[aria-pressed='true']::after {
  animation-duration: 900ms;
}

@media (hover: hover) and (pointer: fine) {
  .btn--winged:hover:not(:disabled) {
    background-color: transparent;
    filter: drop-shadow(0 0 12px rgba(255, 226, 150, 0.8)) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
  }
}

/* En la barra (teléfono): flotan en su sitio, subiendo y bajando, con alas más cortas */
.btn--winged:not(.is-flying) {
  margin-inline: 14px;
  animation: ball-hover 2.6s var(--ease-soft) infinite;
}
.btn--winged:not(.is-flying)::before,
.btn--winged:not(.is-flying)::after {
  top: calc(50% - 11px);
  width: 24px;
  height: 14px;
}
.btn--winged:not(.is-flying)::after { left: calc(50% + 12px); }
.btn--winged:not(.is-flying)::before { right: calc(50% + 12px); }

@media (max-width: 360px) {
  .btn--winged:not(.is-flying) { margin-inline: 10px; }
  .btn--winged:not(.is-flying)::before,
  .btn--winged:not(.is-flying)::after { width: 20px; height: 12px; top: calc(50% - 10px); }
  .btn--winged:not(.is-flying)::after { left: calc(50% + 11px); }
  .btn--winged:not(.is-flying)::before { right: calc(50% + 11px); }
}
#btn-mute.btn--winged:not(.is-flying) {
  animation-delay: -1.3s;
}

@keyframes ball-hover {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

/* En escritorio: vuelan libres por la pantalla (posición desde winged-buttons.js) */
.btn--winged.is-flying {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  will-change: translate;
}

/* ---------- Barra de controles ---------- */
.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: var(--bottom-h);
  padding: 0 calc(14px + env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) calc(14px + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(0deg, rgba(6, 11, 9, 0.85), rgba(6, 11, 9, 0));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-enter) var(--ease-out), transform var(--dur-enter) var(--ease-out);
}

.controls.is-visible {
  opacity: 1;
  transform: none;
}

.controls__audio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.controls__status {
  font-family: var(--font-text);
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(232, 220, 192, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn--next {
  min-width: 9.5em;
}

@media (max-width: 520px) {
  .controls__status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .btn--next {
    min-width: 0;
    font-size: 0.95rem;
  }
}

@media (min-width: 900px) {
  .controls {
    padding-left: max(28px, env(safe-area-inset-left, 0px));
    padding-right: max(28px, env(safe-area-inset-right, 0px));
  }
}
