/*
 * Rádio Synergy (js/radio.js): a rádio flutuante do site, no padrão visual do Poke Synergy.
 * Placa teal com aros de cobre (como os botões redondos do design system), borda em esmeralda e ouro que acende
 * enquanto toca, a capa da faixa desfocada ao fundo, vinil saindo da capa, espectro ao vivo, linha do tempo e
 * volume com preenchimento esmeralda, lista de faixas e um anel de progresso na capa minimizada.
 * Mora no canto inferior esquerdo: o direito é do botão "voltar ao topo".
 */
.psr {
  --psr-aros: 0 0 0 2px var(--cobre-brilho), 0 0 0 4px var(--cobre-sombra), 0 0 0 5px var(--cobre-claro);
  position: fixed;
  left: calc(20px + env(safe-area-inset-left, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 55;                      /* acima da página e do cabeçalho, abaixo da cortina (70) e da gaveta (80) */
  font-family: var(--font-texto);
  font-size: 14px;
  line-height: 1.35;
  color: var(--marfim);
  -webkit-tap-highlight-color: transparent;
  transition: bottom .32s var(--ease, ease);
}
.psr, .psr *, .psr *::before, .psr *::after { box-sizing: border-box; }
.psr--movida { left: auto; bottom: auto; transition: none; }
.psr--arrastando, .psr--arrastando * { cursor: grabbing !important; user-select: none; }
.psr-alca { cursor: grab; touch-action: none; }
.psr button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.psr button:focus-visible, .psr input:focus-visible { outline: 2px solid var(--foco); outline-offset: 3px; }
.psr [hidden] { display: none !important; }

/* ------------------------------------------------------------------ o cartão */
.psr-cartao {
  position: relative;
  width: 360px;
  padding: 14px 16px 16px;
  border-radius: 18px;
  isolation: isolate;
  background: linear-gradient(165deg, rgba(14, 33, 33, .9), rgba(4, 22, 26, .94) 55%, rgba(2, 11, 18, .96));
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  box-shadow:
    0 0 0 1px rgba(253, 228, 165, .06) inset,
    0 24px 60px rgba(2, 11, 18, .7),
    0 0 46px rgba(46, 224, 143, .14);
  transform-origin: 0 100%;
  animation: psr-entra .5s cubic-bezier(.2, .9, .3, 1.2) both;
}
/* a borda: degradê cônico de cobre, ouro e esmeralda, recortado em 1,5 px pela máscara */
.psr-cartao::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  padding: 1.5px;
  border-radius: inherit;
  background: conic-gradient(from var(--psr-giro, 200deg), var(--cobre-claro), var(--ouro-claro), var(--esmeralda-luz), var(--cobre-brilho), var(--cobre-claro));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: .7;
  transition: opacity .4s ease;
}
/* a joia no meio da borda de cima, como nos botões redondos do design system */
.psr-cartao::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--esmeralda);
  border: 1px solid var(--cobre-brilho);
  box-shadow: 0 0 10px rgba(46, 224, 143, .45);
}
@property --psr-giro { syntax: '<angle>'; inherits: false; initial-value: 200deg; }
.psr--tocando .psr-cartao::before { opacity: 1; animation: psr-gira 9s linear infinite; }
@keyframes psr-gira { to { --psr-giro: 560deg; } }
@keyframes psr-entra { from { opacity: 0; transform: translateY(14px) scale(.96); } }

/* a capa da faixa, enorme e desfocada, tingindo a placa */
.psr-fundo {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  border-radius: inherit;
}
.psr-fundo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.5);
  filter: blur(30px) saturate(1.4) brightness(.6);
  opacity: .38;
  transition: opacity .6s ease;
}
.psr-fundo::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 0% 0%, rgba(46, 224, 143, .12), transparent 60%),
    radial-gradient(120% 70% at 100% 100%, rgba(240, 196, 119, .1), transparent 60%),
    linear-gradient(180deg, rgba(2, 11, 18, .15), rgba(2, 11, 18, .7));
}

/* ------------------------------------------------------------------ topo */
.psr-topo { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.psr-marca { display: inline-flex; align-items: center; gap: 7px; margin-right: auto; color: var(--esmeralda-luz); }
.psr-marca b {
  font-family: var(--font-titulo);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  background: linear-gradient(180deg, var(--ouro-claro), var(--cobre-brilho));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.psr-noar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texto-suave);
  background: rgba(2, 11, 18, .45);
  border: 1px solid rgba(168, 113, 68, .45);
}
.psr-noar i { width: 6px; height: 6px; border-radius: 50%; background: #4d625b; }
.psr--tocando .psr-noar { color: var(--esmeralda-brilho); border-color: rgba(46, 224, 143, .5); background: rgba(4, 137, 63, .18); }
.psr--tocando .psr-noar i { background: var(--esmeralda-luz); box-shadow: 0 0 8px var(--esmeralda-luz); animation: psr-pisca 2.4s ease-in-out infinite; }
@keyframes psr-pisca { 50% { opacity: .35; } }
.psr-botao {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--texto-suave) !important;
  transition: color .15s ease, background .15s ease;
}
.psr-botao:hover { color: var(--ouro-claro) !important; background: rgba(253, 228, 165, .08) !important; }
.psr--lista .psr-bt-lista { color: var(--esmeralda-luz) !important; background: rgba(46, 224, 143, .12) !important; }

.psr .psr-comecar {                      /* ".psr" na frente: ".psr button" zera o padding */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: -2px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-family: var(--font-titulo) !important;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .06em;
  color: var(--ouro-claro) !important;
  background: linear-gradient(180deg, var(--esmeralda) 0%, var(--esmeralda-funda) 80%) !important;
  box-shadow: inset 0 2px 0 var(--esmeralda-brilho), 0 0 0 1px var(--cobre-brilho), 0 0 20px rgba(46, 224, 143, .35);
  animation: psr-chama 2.2s ease-in-out infinite;
}
@keyframes psr-chama { 50% { box-shadow: inset 0 2px 0 var(--esmeralda-brilho), 0 0 0 1px var(--cobre-brilho), 0 0 32px rgba(46, 224, 143, .6); } }

/* ------------------------------------------------------------------ capa, vinil e título */
.psr-palco { display: flex; align-items: center; gap: 14px; }
.psr-disco { position: relative; flex: none; width: 86px; height: 86px; transition: width .6s cubic-bezier(.2, .9, .3, 1); }
.psr--tocando .psr-disco { width: 116px; }
.psr-capa {
  position: relative;
  z-index: 1;
  width: 86px;
  height: 86px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--abismo);
  box-shadow: 0 10px 26px rgba(2, 11, 18, .7), 0 0 0 1px var(--cobre-claro), 0 0 0 3px rgba(80, 42, 23, .7);
}
.psr-vinil {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--esmeralda-luz) 0 9%, #08130f 9.5% 12%, transparent 12.5%),
    repeating-radial-gradient(circle, #0d1714 0 1.6px, #1a2722 1.6px 3.2px),
    #0c1512;
  box-shadow: 0 6px 18px rgba(2, 11, 18, .7), 0 0 0 1px rgba(215, 155, 97, .6), 0 0 16px rgba(46, 224, 143, .3);
  transition: translate .6s cubic-bezier(.2, .9, .3, 1);
}
.psr-vinil::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 30deg, transparent 0 20%, rgba(253, 228, 165, .16) 25%, transparent 32% 70%, rgba(143, 248, 196, .14) 76%, transparent 84%);
}
/* "translate" (e não transform) para sair da capa: a propriedade individual vem antes do "rotate" da animação,
   então o disco gira no próprio eixo em vez de orbitar em volta da capa */
.psr--tocando .psr-vinil { translate: 34px 0; animation: psr-roda 3.2s linear infinite; }
@keyframes psr-roda { from { rotate: 0deg; } to { rotate: 360deg; } }

.psr-info { min-width: 0; flex: 1; }
.psr-titulo-caixa {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.psr-titulo {
  display: inline-block;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ouro-claro);
  text-shadow: 0 2px 8px rgba(2, 11, 18, .8);
}
.psr--rolar .psr-titulo { animation: psr-rola var(--psr-rolar-s, 8s) ease-in-out 1.5s infinite alternate; }
@keyframes psr-rola { 0%, 12% { transform: translateX(0); } 88%, 100% { transform: translateX(var(--psr-desloc, 0)); } }
.psr-artista {
  margin-top: 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  color: var(--esmeralda-luz);
}
.psr-posicao { margin-top: 6px; font-size: 12px; letter-spacing: .08em; color: var(--texto-suave); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ espectro */
.psr-espectro { display: block; width: 100%; height: 46px; margin: 10px 0 2px; }

/* ------------------------------------------------------------------ linha do tempo e volume */
.psr-tempo {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--texto-suave);
  font-variant-numeric: tabular-nums;
}
.psr-tempo .psr-total { text-align: right; }
.psr input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  margin: 0;
  border-radius: 99px;
  cursor: pointer;
  background:
    linear-gradient(90deg, var(--esmeralda), var(--esmeralda-luz) 65%, var(--ouro-claro)) 0 0 / var(--psr-p, 0%) 100% no-repeat,
    rgba(2, 11, 18, .6);
  box-shadow: 0 0 0 1px rgba(168, 113, 68, .35);
}
.psr input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--ouro-claro);
  box-shadow: 0 0 0 2px var(--cobre-claro), 0 0 12px rgba(46, 224, 143, .7);
  transition: transform .15s ease;
}
.psr input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--ouro-claro);
  box-shadow: 0 0 0 2px var(--cobre-claro), 0 0 12px rgba(46, 224, 143, .7);
}
.psr input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.2); }

.psr-controles { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 14px; }
.psr-volume { display: flex; align-items: center; gap: 4px; }
.psr-vol { max-width: 70px; }
.psr-pct { justify-self: end; font-size: 12px; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.psr-transporte { display: flex; align-items: center; gap: 10px; }
.psr-transporte .psr-botao { width: 38px; height: 38px; border-radius: 50%; color: var(--pergaminho) !important; }
.psr-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: var(--ouro-claro) !important;
  background: radial-gradient(circle at 50% 30%, var(--esmeralda-luz) 0%, var(--esmeralda) 45%, var(--esmeralda-funda) 100%) !important;
  box-shadow: inset 0 2px 0 rgba(143, 248, 196, .7), inset 0 -4px 0 rgba(2, 11, 18, .4), var(--psr-aros), 0 8px 20px rgba(2, 11, 18, .6), 0 0 22px rgba(46, 224, 143, .45);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
}
.psr-play:hover { transform: scale(1.06); filter: brightness(1.08); box-shadow: inset 0 2px 0 rgba(143, 248, 196, .7), inset 0 -4px 0 rgba(2, 11, 18, .4), var(--psr-aros), 0 8px 20px rgba(2, 11, 18, .6), 0 0 32px rgba(46, 224, 143, .7); }
.psr-play:active { transform: scale(.96); }
.psr-play svg { filter: drop-shadow(0 1px 1px rgba(2, 11, 18, .7)); }
.psr-play::after {                        /* o pulso em volta enquanto toca */
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid rgba(143, 248, 196, .6);
  opacity: 0;
}
.psr--tocando .psr-play::after { animation: psr-pulso 2.4s ease-out infinite; }
@keyframes psr-pulso { 0% { transform: scale(.92); opacity: .8; } 100% { transform: scale(1.35); opacity: 0; } }

/* ------------------------------------------------------------------ lista de faixas */
.psr-lista { margin-top: 14px; border-top: 1px solid rgba(168, 113, 68, .35); padding-top: 10px; }
.psr-lista-topo { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-size: 12px; }
.psr-lista-topo b { font-family: var(--font-titulo); letter-spacing: .1em; text-transform: uppercase; font-size: 12px; color: var(--cobre-brilho); }
.psr-lista-topo span { color: var(--texto-suave); }
.psr-faixas {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(46, 224, 143, .45) transparent;
}
.psr-faixa {
  display: grid !important;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 8px !important;
  border-radius: 10px;
  text-align: left;
  transition: background .12s ease;
}
.psr-faixa:hover { background: rgba(253, 228, 165, .06) !important; }
.psr-faixa-n { font-size: 12px; color: #7d8f87; font-variant-numeric: tabular-nums; }
.psr-faixa-tx { min-width: 0; display: grid; }
.psr-faixa-tx b, .psr-faixa-tx small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.psr-faixa-tx b { font-size: 14px; font-weight: 600; color: var(--marfim); }
.psr-faixa-tx small { font-size: 12px; color: var(--texto-suave); }
.psr-faixa-d { font-size: 12px; color: #7d8f87; font-variant-numeric: tabular-nums; }
.is-atual .psr-faixa { background: linear-gradient(90deg, rgba(46, 224, 143, .16), rgba(240, 196, 119, .08)) !important; box-shadow: 0 0 0 1px rgba(215, 155, 97, .4) inset; }
.is-atual .psr-faixa-n { color: var(--esmeralda-luz); }
.is-atual .psr-faixa-tx b { color: var(--ouro-claro); }

/* ------------------------------------------------------------------ minimizada: a capa redonda com o anel de progresso */
.psr-pilula {
  position: relative;
  display: none !important;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--teal) 0%, var(--placa) 70%) !important;
  box-shadow: var(--psr-aros), 0 10px 26px rgba(2, 11, 18, .7), 0 0 22px rgba(46, 224, 143, .25);
  transition: transform .15s ease, box-shadow .2s ease;
}
.psr--min .psr-pilula { display: grid !important; place-items: center; animation: psr-entra .35s ease both; }
.psr--min .psr-cartao { display: none; }
.psr-pilula:hover { transform: scale(1.06); box-shadow: var(--psr-aros), 0 10px 26px rgba(2, 11, 18, .7), 0 0 30px rgba(46, 224, 143, .55); }
.psr-pilula-capa { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.psr--tocando .psr-pilula-capa { animation: psr-roda 9s linear infinite; }
.psr-anel { position: absolute; inset: 0; width: 100%; height: 100%; rotate: -90deg; pointer-events: none; }
.psr-anel circle { fill: none; stroke-width: 3; }
.psr-anel-fundo { stroke: rgba(2, 11, 18, .55); }
.psr-anel-p { stroke: url(#psr-g); stroke-linecap: round; transition: stroke-dashoffset .5s linear; filter: drop-shadow(0 0 3px rgba(46, 224, 143, .9)); }
.psr-eq {
  position: absolute;
  bottom: -6px;
  left: 50%;
  translate: -50% 0;
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
  padding: 2px 5px;
  border-radius: 99px;
  background: var(--abismo);
  box-shadow: 0 0 0 1px var(--cobre-claro);
}
.psr--tocando .psr-eq { display: flex; }
.psr-eq i { width: 2px; height: 4px; border-radius: 2px; background: var(--esmeralda-luz); animation: psr-eq .9s ease-in-out infinite alternate; }
.psr-eq i:nth-child(2) { animation-delay: -.3s; }
.psr-eq i:nth-child(3) { animation-delay: -.6s; }
.psr-eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes psr-eq { to { height: 10px; } }

/* a etiqueta da primeira visita, ao lado da capa minimizada */
.psr-dica {
  position: absolute;
  left: 80px;
  bottom: 9px;
  display: grid;
  gap: 1px;
  padding: 8px 14px 9px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  font-size: 13px;
  color: var(--texto-suave);
  background: linear-gradient(180deg, rgba(14, 33, 33, .97), rgba(2, 11, 18, .97));
  box-shadow: 0 0 0 1px var(--cobre-claro), 0 12px 28px rgba(2, 11, 18, .7);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-8px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2), visibility 0s linear .35s;
}
.psr-dica::before {                       /* a ponta apontando para a capa */
  content: '';
  position: absolute;
  left: -5px;
  bottom: 17px;
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: #081b1e;
  box-shadow: -1px 1px 0 var(--cobre-claro);
}
.psr-dica b { font-family: var(--font-titulo); font-size: 13px; letter-spacing: .06em; color: var(--ouro-claro); }
.psr--min.psr--convite:not(.psr--movida) .psr-dica { opacity: 1; visibility: visible; transform: none; transition: opacity .35s ease, transform .35s cubic-bezier(.2, .9, .3, 1.2), visibility 0s; }
.psr:not(.psr--min) .psr-dica { display: none; }

/* primeira visita com o cartão aberto: ele chama a atenção uma vez */
.psr--destaque .psr-cartao { animation: psr-entra .5s cubic-bezier(.2, .9, .3, 1.2) both, psr-destaque 1.6s ease-in-out .6s 1; }
@keyframes psr-destaque { 50% { box-shadow: 0 24px 60px rgba(2, 11, 18, .7), 0 0 0 3px rgba(46, 224, 143, .55), 0 0 60px rgba(46, 224, 143, .45); } }

/* ------------------------------------------------------------------ telas menores */
@media (max-width: 760px) {
  /* a barra "Criar conta / Jogar agora" ocupa o rodapé: a rádio sobe junto com o "voltar ao topo" */
  body:has(.barra-acao.is-visivel) .psr:not(.psr--movida) { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .psr { left: calc(14px + env(safe-area-inset-left, 0px)); }
  .psr-pilula { width: 56px; height: 56px; }
  .psr-pilula-capa { width: 42px; height: 42px; }
  .psr-dica { left: 70px; bottom: 5px; }
}
.psr-marca b, .psr-noar { white-space: nowrap; }
@media (max-width: 360px) {
  /* o topo não cabe inteiro: sai o selo "No ar" (o botão de pausa e o espectro já dizem que está tocando) */
  .psr-noar { display: none; }
}
@media (max-width: 420px) {
  .psr-cartao { width: calc(100vw - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); box-sizing: border-box; }
}
@media (prefers-reduced-motion: reduce) {
  .psr *, .psr *::before, .psr *::after { animation: none !important; transition: none !important; }
  .psr--tocando .psr-vinil { translate: 34px 0; }
}
