/* App da rádio (Audio Nexus 3.5.6): a tela que o ouvinte instala no celular.
   A cor de destaque (--cor) e o tema vêm da configuração de cada rádio. O destaque da tela é um só: a logo da
   rádio com o sinal saindo dela enquanto toca; o resto fica quieto. */
:root {
  --cor: #00a398;
  --cor-icone: #ffffff;
  --base: #0e141c;
  --fundo: var(--base);
  --cartao: #18212d;
  --letras: #eef2f7;
  --suave: #9aa6b5;
  --linha: rgba(255, 255, 255, .09);
  --pad: rgba(255, 255, 255, .06);
  --sombra: 0 22px 48px -22px rgba(0, 0, 0, .75);
  --lado: min(62vw, 252px);
  --titulos: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --texto: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
html[data-tema="claro"] {
  --cartao: #ffffff;
  --letras: #17202b;
  --suave: #5a6777;
  --linha: rgba(23, 32, 43, .1);
  --pad: rgba(23, 32, 43, .05);
  --sombra: 0 22px 44px -24px rgba(23, 32, 43, .45);
  color-scheme: light;
}
@supports (color: color-mix(in oklab, red 10%, blue)) {
  /* o fundo puxa um pouco para a cor da rádio */
  :root { --fundo: color-mix(in oklab, var(--cor) 12%, var(--base)); --cartao: color-mix(in oklab, var(--cor) 8%, #18212d);
          --pad: color-mix(in oklab, var(--cor) 16%, transparent); }
  html[data-tema="claro"] { --fundo: color-mix(in oklab, var(--cor) 7%, var(--base)); --cartao: #ffffff;
                            --pad: color-mix(in oklab, var(--cor) 11%, transparent); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--fundo); color: var(--letras);
  font: 16px/1.45 var(--texto);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cor); outline-offset: 3px; }

.ap {
  position: relative; max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  display: flex; flex-direction: column;
}

/* capa da música, bem desfocada, atrás de tudo */
.ap-fundo {
  position: fixed; inset: 0 0 auto 0; height: 70vh; z-index: -1; pointer-events: none;
  background: center / cover no-repeat; filter: blur(40px) saturate(1.2); opacity: 0; transform: scale(1.2);
  transition: opacity .8s ease;
  -webkit-mask-image: linear-gradient(#000 25%, transparent); mask-image: linear-gradient(#000 25%, transparent);
}
.ap-fundo.com-capa { opacity: .32; }
html[data-tema="claro"] .ap-fundo.com-capa { opacity: .22; }

/* topo */
.ap-topo { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.ap-topo-acoes { display: flex; gap: 4px; }
.ap-ic {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--letras); cursor: pointer;
}
.ap-ic:active { background: var(--pad); }
.ap-vivo { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; font-weight: 600; color: var(--letras); }
.ap-vivo i { width: 9px; height: 9px; border-radius: 50%; background: var(--cor); box-shadow: 0 0 0 4px color-mix(in oklab, var(--cor) 25%, transparent); }
.ap-vivo.fora { color: var(--suave); }
.ap-vivo.fora i { background: var(--suave); box-shadow: none; }

/* o palco: logo, play e o sinal */
.ap-palco { flex: 1; display: flex; flex-direction: column; align-items: center; padding-top: 2vh; }
.ap-sinal { position: relative; width: var(--lado); aspect-ratio: 1; margin: 14px auto 50px; }
.ap-sinal::before, .ap-sinal::after {
  content: ""; position: absolute; inset: 0; border-radius: 36px; border: 2px solid var(--cor);
  opacity: 0; pointer-events: none;
}
.tocando .ap-sinal::before { animation: ap-onda 2.8s cubic-bezier(.2, .6, .3, 1) infinite; }
.tocando .ap-sinal::after { animation: ap-onda 2.8s cubic-bezier(.2, .6, .3, 1) 1.4s infinite; }
@keyframes ap-onda { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.36); opacity: 0; } }
.ap-logo {
  position: relative; width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: var(--cartao);
  box-shadow: var(--sombra); display: grid; place-items: center;
}
.ap-logo img { width: 100%; height: 100%; object-fit: contain; padding: 10%; }
.ap-logo img.cheia { object-fit: cover; padding: 0; }
.ap-iniciais {
  font: 800 calc(var(--lado) * .32) / 1 var(--titulos); letter-spacing: -.03em; color: var(--cor-icone);
  background: var(--cor); width: 100%; height: 100%; display: grid; place-items: center;
}

.ap-play {
  position: absolute; left: 50%; bottom: -38px; transform: translateX(-50%);
  width: 78px; height: 78px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--cor); color: var(--cor-icone);
  box-shadow: 0 0 0 7px var(--fundo), 0 10px 24px -8px rgba(0, 0, 0, .55);
  display: grid; place-items: center; transition: transform .12s ease;
}
.ap-play:active { transform: translateX(-50%) scale(.94); }
.ap-play svg { fill: currentColor; stroke: none; }
.ap-so-play { margin-left: 4px; }
.ap-so-pause, .tocando .ap-so-play, .carregando .ap-so-play { display: none; }
.tocando .ap-so-pause, .carregando .ap-so-pause { display: block; }
.ap-so-play, .ap-so-pause { line-height: 0; }
.ap-giro { position: absolute; inset: -7px; border-radius: 50%; border: 3px solid transparent; }
.carregando .ap-giro { border-top-color: var(--cor); animation: ap-girar .9s linear infinite; }
@keyframes ap-girar { to { transform: rotate(360deg); } }

.ap-nome {
  margin: 0; max-width: 100%; text-align: center;
  font: 800 clamp(1.55rem, 7vw, 2rem) / 1.12 var(--titulos); letter-spacing: -.02em; text-wrap: balance;
}
.ap-estado { margin: 6px 0 0; color: var(--suave); font-size: .95rem; min-height: 1.4em; text-align: center; }

/* tocando agora */
.ap-agora {
  width: 100%; margin-top: 22px; display: flex; align-items: center; gap: 13px;
  padding: 10px 14px 10px 10px; border-radius: 20px; background: var(--cartao);
}
.ap-capa {
  flex: none; width: 58px; height: 58px; border-radius: 13px; overflow: hidden; display: grid; place-items: center;
  background: var(--pad) center / cover no-repeat; color: var(--cor);
}
.ap-capa.com-capa svg { display: none; }
.ap-faixa { min-width: 0; display: flex; flex-direction: column; }
.ap-musica {
  font: 700 1.08rem / 1.25 var(--titulos);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ap-artista { color: var(--suave); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* teclas */
.ap-teclas { width: 100%; margin-top: 22px; display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); gap: 4px; }
.ap-tecla {
  display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 4px 2px; border: 0; background: none;
  color: var(--letras); text-decoration: none; font-size: .8rem; font-weight: 600; cursor: pointer; text-align: center;
}
.ap-pad {
  width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: var(--pad); color: var(--cor);
  transition: transform .12s ease;
}
html[data-tema="claro"] .ap-pad { color: color-mix(in oklab, var(--cor) 78%, #000); }
.ap-tecla:active .ap-pad { transform: scale(.93); }
.ap-tecla.ligado .ap-pad { background: var(--cor); color: var(--cor-icone); }
.ap-tecla [data-timer-rotulo] { font-variant-numeric: tabular-nums; }

/* tocou há pouco */
.ap-tocadas { width: 100%; margin-top: 28px; }
.ap-tocadas h2 { margin: 0 0 6px; font: 700 1rem / 1.3 var(--titulos); }
.ap-tocadas ol { list-style: none; margin: 0; padding: 0; }
.ap-tocadas li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--linha); }
.ap-tocadas li:first-child { border-top: 0; }
.ap-mini {
  flex: none; width: 40px; height: 40px; border-radius: 9px; background: var(--pad) center / cover no-repeat;
  display: grid; place-items: center; color: var(--suave);
}
.ap-mini.com-capa svg { display: none; }
.ap-tocadas .t { min-width: 0; flex: 1; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-tocadas .h { flex: none; color: var(--suave); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* folhas (pedido, timer, iPhone) */
.ap-folha {
  width: 100%; max-width: 520px; margin: auto auto 0; padding: 0 20px calc(20px + env(safe-area-inset-bottom));
  border: 0; border-radius: 26px 26px 0 0; background: var(--cartao); color: var(--letras);
  max-height: 88vh; overflow: auto;
}
.ap-folha[open] { animation: ap-subir .22s ease-out; }
.ap-folha::backdrop { background: rgba(5, 9, 14, .55); }
@keyframes ap-subir { from { transform: translateY(40px); opacity: 0; } }
.ap-folha-topo { display: flex; align-items: center; justify-content: space-between; padding: 14px 0 6px; margin-right: -10px; }
.ap-folha h2 { margin: 0; font: 700 1.2rem / 1.3 var(--titulos); }
.ap-campo { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: .9rem; font-weight: 600; }
.ap-campo small { font-weight: 400; color: var(--suave); }
.ap-campo input, .ap-campo textarea {
  width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--linha); background: var(--fundo);
  font-size: 1rem; font-weight: 400; resize: vertical;
}
.ap-campo input:focus, .ap-campo textarea:focus { outline: 2px solid var(--cor); outline-offset: 0; border-color: transparent; }
.ap-botao {
  width: 100%; margin-top: 18px; min-height: 52px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--cor); color: var(--cor-icone); font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.ap-botao-sec { background: var(--pad); color: var(--letras); }
.ap-botao-peq { width: auto; min-height: 42px; margin: 0; padding: 0 18px; font-size: .95rem; }
.ap-nota { margin: 10px 0 0; color: var(--suave); font-size: .85rem; text-align: center; }
.ap-tempos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ap-tempo {
  min-height: 56px; border-radius: 16px; border: 1px solid var(--linha); background: var(--fundo); cursor: pointer;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.ap-tempo:active { background: var(--pad); }
.ap-passos { margin: 10px 0 0; padding-left: 1.3em; display: grid; gap: 12px; line-height: 1.6; }
.ap-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 9px; background: var(--pad);
  font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.ap-chip svg { color: #2f80ed; }

/* convite para instalar */
.ap-convite {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5;
  max-width: 456px; margin: 0 auto; padding: 12px; border-radius: 20px; background: var(--cartao);
  border: 1px solid var(--linha); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6);
  display: grid; grid-template-columns: 48px 1fr; gap: 4px 12px; align-items: center; animation: ap-subir .3s ease-out;
}
.ap-convite img { border-radius: 12px; }
.ap-convite-titulo { margin: 0; font-weight: 700; font-size: .95rem; line-height: 1.3; }
.ap-convite-texto p:last-child { margin: 2px 0 0; color: var(--suave); font-size: .85rem; line-height: 1.35; }
.ap-convite-botoes { grid-column: 2; display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.ap-link { border: 0; background: none; color: var(--suave); font-weight: 600; cursor: pointer; padding: 8px 2px; }

.ap-aviso {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px; background: var(--letras); color: var(--fundo);
  font-size: .92rem; font-weight: 600; text-align: center; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .6);
}

@media (min-height: 760px) { .ap-palco { padding-top: 5vh; } }
@media (prefers-reduced-motion: reduce) {
  .tocando .ap-sinal::before, .tocando .ap-sinal::after { animation: none; opacity: .35; transform: scale(1.08); }
  .tocando .ap-sinal::after { opacity: 0; }
  .ap-folha[open], .ap-convite { animation: none; }
  .carregando .ap-giro { animation-duration: 2.4s; }
}
