/* SportFans 64 — reproductor ambiental (dock derecho, se oculta hasta hover / clic) */

.sf-radio {
  position: fixed;
  right: 0;
  left: auto;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 1250;
  font-family: "Sora", sans-serif;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  padding-right: max(0px, env(safe-area-inset-right, 0px));
}

.sf-radio.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sf-radio.is-hidden-during-intro {
  opacity: 0 !important;
  pointer-events: none !important;
}

.sf-radio__drawer {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
}

.sf-radio__peek {
  box-sizing: border-box;
  flex: 0 0 46px;
  width: 46px;
  max-width: 46px;
  height: var(--sf-radio-dock-h, auto);
  min-height: var(--sf-radio-dock-h, 58px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 9px 6px 10px;
  border: none;
  cursor: pointer;
  color: var(--sf-chrome, #eef4ff);
  background:
    linear-gradient(180deg, rgba(12, 20, 34, 0.98) 0%, rgba(4, 8, 14, 0.99) 100%);
  border: 1px solid rgba(34, 232, 144, 0.28);
  border-right: none;
  border-radius: 10px 0 0 10px;
  box-shadow: -8px 8px 28px rgba(0, 0, 0, 0.35);
  opacity: 1;
  transform: translateX(0) scale(1);
  overflow: hidden;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    flex-basis 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-width 0.3s ease;
}

.sf-radio.is-open .sf-radio__peek {
  flex-basis: 0;
  width: 0;
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  transform: translateX(14px) scale(0.96);
  border-width: 0;
  pointer-events: none;
  /* Keep dock height stable during morph (width/opacity only). */
}

.sf-radio__peek:hover,
.sf-radio__peek:focus-visible {
  background: linear-gradient(180deg, rgba(20, 32, 52, 0.98) 0%, rgba(8, 12, 22, 0.99) 100%);
  outline: none;
  border-color: rgba(255, 106, 26, 0.45);
}

.sf-radio__peek-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sf-secondary-bright, #00e878);
  box-shadow: 0 0 10px rgba(34, 232, 144, 0.85);
  animation: sf-radio-pulse 1.6s ease-in-out infinite;
}

.sf-radio.is-paused .sf-radio__peek-dot,
.sf-radio.is-idle .sf-radio__peek-dot {
  animation: none;
  opacity: 0.4;
  box-shadow: none;
}

.sf-radio__peek-label {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 8.25px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  color: rgba(238, 244, 255, 0.78);
  text-align: center;
  min-height: 0;
}

.sf-radio__peek-viz {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 18px;
  padding-top: 2px;
}

.sf-radio__peek-viz span {
  display: block;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 106, 26, 0.75);
  transform-origin: bottom;
}

.sf-radio.is-playing .sf-radio__peek-viz span {
  animation: sf-radio-bar 0.9s ease-in-out infinite;
}

.sf-radio.is-playing .sf-radio__peek-viz span:nth-child(2) {
  animation-delay: 0.12s;
}

.sf-radio.is-playing .sf-radio__peek-viz span:nth-child(3) {
  animation-delay: 0.24s;
}

.sf-radio.is-playing .sf-radio__peek-viz span:nth-child(4) {
  animation-delay: 0.08s;
}

.sf-radio.is-paused .sf-radio__peek-viz span,
.sf-radio.is-idle .sf-radio__peek-viz span {
  opacity: 0.35;
}

.sf-radio__shell {
  --sf-radio-shell-w: min(320px, calc(100vw - 24px));
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: var(--sf-radio-shell-w);
  max-width: 0;
  height: 0;
  max-height: 0;
  min-height: 0;
  opacity: 0;
  transform: translateX(18px) scale(0.98);
  pointer-events: none;
  border-radius: 12px 0 0 12px;
  background:
    linear-gradient(165deg, rgba(255, 77, 0, 0.08) 0%, transparent 42%),
    linear-gradient(180deg, rgba(12, 20, 34, 0.96) 0%, rgba(4, 8, 14, 0.98) 100%);
  border: 0 solid rgba(34, 232, 144, 0.22);
  border-right-color: var(--sf-primary, #ff4d00);
  box-shadow: none;
  overflow: hidden;
  transition:
    max-width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    min-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    border-width 0.3s ease,
    box-shadow 0.35s ease;
}

.sf-radio.is-open .sf-radio__shell {
  max-width: var(--sf-radio-shell-w);
  height: var(--sf-radio-dock-h, 160px);
  min-height: var(--sf-radio-dock-h, 160px);
  max-height: var(--sf-radio-dock-h, 160px);
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
  border-width: 1px 3px 1px 1px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 16px 40px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(255, 77, 0, 0.08);
}

.sf-radio.is-open.is-expanded .sf-radio__shell {
  height: auto;
  min-height: var(--sf-radio-dock-h, 160px);
  max-height: min(70vh, 640px);
}

.sf-radio__shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 50% at 50% 0%, rgba(255, 120, 40, 0.14), transparent 60%);
}

.sf-radio__accent {
  height: 2px;
  background: linear-gradient(90deg, #ff4d00 0%, #ffb000 45%, #22e890 100%);
}

.sf-radio__compact {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  align-content: center;
  gap: 8px 10px;
  padding: 10px 12px 8px;
  min-height: 0;
}

.sf-radio.is-expanded .sf-radio__compact {
  flex: 0 0 auto;
}

.sf-radio__compact-bar {
  flex: 0 0 auto;
  padding: 0 12px 10px;
}

.sf-radio__compact-bar .sf-radio__progress {
  margin-bottom: 6px;
}

.sf-radio__compact-bar .sf-radio__time {
  display: block;
  text-align: right;
}

.sf-radio__minimize,
.sf-radio__toggle-expand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sf-chrome, #eef4ff);
  transition: background 0.2s ease, transform 0.15s ease;
}

.sf-radio__minimize:hover,
.sf-radio__minimize:focus-visible {
  background: rgba(255, 106, 26, 0.25);
  outline: none;
}

.sf-radio__toggle-expand:hover,
.sf-radio__toggle-expand:focus-visible {
  background: rgba(255, 106, 26, 0.25);
  outline: none;
}

.sf-radio__meta {
  min-width: 0;
  cursor: pointer;
}

.sf-radio__kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sf-secondary, #22e890);
}

.sf-radio__live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sf-secondary-bright, #00e878);
  box-shadow: 0 0 8px rgba(34, 232, 144, 0.8);
  animation: sf-radio-pulse 1.6s ease-in-out infinite;
}

.sf-radio.is-paused .sf-radio__live-dot,
.sf-radio.is-idle .sf-radio__live-dot {
  animation: none;
  opacity: 0.35;
  box-shadow: none;
}

.sf-radio__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--sf-chrome, #eef4ff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sf-radio__controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sf-radio__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--sf-chrome, #eef4ff);
  transition: background 0.2s ease, color 0.2s ease;
}

.sf-radio__btn:hover,
.sf-radio__btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.sf-radio__btn--play {
  background: linear-gradient(135deg, #ff4d00, #ff6a1a);
  color: #fff;
}

.sf-radio__btn--play:hover,
.sf-radio__btn--play:focus-visible {
  filter: brightness(1.06);
}

.sf-radio__viz {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-top: 4px;
}

.sf-radio__viz span {
  display: block;
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: rgba(34, 232, 144, 0.85);
  transform-origin: bottom;
}

.sf-radio.is-playing .sf-radio__viz span {
  animation: sf-radio-bar 0.9s ease-in-out infinite;
}

.sf-radio.is-playing .sf-radio__viz span:nth-child(2) { animation-delay: 0.12s; }
.sf-radio.is-playing .sf-radio__viz span:nth-child(3) { animation-delay: 0.24s; }
.sf-radio.is-playing .sf-radio__viz span:nth-child(4) { animation-delay: 0.08s; }
.sf-radio.is-playing .sf-radio__viz span:nth-child(5) { animation-delay: 0.18s; }

.sf-radio__panel {
  display: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px 12px 14px;
}

.sf-radio.is-expanded .sf-radio__panel {
  display: block;
}

.sf-radio__progress {
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
  overflow: hidden;
  cursor: pointer;
}

.sf-radio__progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff6a1a, #22e890);
  transition: width 0.15s linear;
}

.sf-radio__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sf-radio__row--volume {
  justify-content: stretch;
}

.sf-radio__row--volume .sf-radio__volume {
  flex: 1;
}

.sf-radio__time {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(238, 244, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.sf-radio__volume {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 160px;
}

.sf-radio__volume label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(238, 244, 255, 0.5);
}

.sf-radio__volume input[type="range"] {
  flex: 1;
  accent-color: var(--sf-primary-mid, #ff6a1a);
  height: 4px;
}

.sf-radio__playlist {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 168px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sf-radio__track {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: rgba(238, 244, 255, 0.78);
  font-family: inherit;
  font-size: 12px;
  transition: background 0.15s ease;
}

.sf-radio__track:hover,
.sf-radio__track:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.sf-radio__track.is-active {
  background: rgba(255, 106, 26, 0.15);
  color: #fff;
}

.sf-radio__track-num {
  font-size: 10px;
  font-weight: 800;
  opacity: 0.45;
  width: 1.25rem;
}

.sf-radio__hint {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(238, 244, 255, 0.45);
}

@keyframes sf-radio-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

@keyframes sf-radio-bar {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sf-radio,
  .sf-radio__drawer,
  .sf-radio__peek,
  .sf-radio__shell,
  .sf-radio__live-dot,
  .sf-radio__peek-dot,
  .sf-radio__viz span,
  .sf-radio__peek-viz span {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 600px) {
  .sf-radio {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .sf-radio__shell {
    --sf-radio-shell-w: min(300px, calc(100vw - 20px));
  }
}
