:root {
  --yellow: #ffcc12;
  --yellow-dark: #dca900;
  --black: #050505;
  --panel: rgba(18, 18, 20, 0.88);
  --line: rgba(255, 255, 255, 0.12);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.68);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--black);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.pwa-app {
  min-height: 100svh;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 204, 18, 0.22), transparent 26%),
    linear-gradient(145deg, #070707 0%, #151515 48%, #050505 100%);
}

.app-screen {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding:
    max(clamp(16px, 4vw, 34px), env(safe-area-inset-top))
    max(clamp(16px, 4vw, 34px), env(safe-area-inset-right))
    max(clamp(16px, 4vw, 34px), env(safe-area-inset-bottom))
    max(clamp(16px, 4vw, 34px), env(safe-area-inset-left));
}

@supports (min-height: 100dvh) {
  .pwa-app,
  .app-screen {
    min-height: 100dvh;
  }
}

.app-card {
  position: relative;
  width: min(430px, 100%);
  min-height: min(760px, calc(100svh - 32px));
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: clamp(16px, 2.7svh, 26px);
  overflow: hidden;
  padding: clamp(18px, 4.8vw, 28px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
}

.app-glow {
  position: absolute;
  inset: auto -120px -180px -120px;
  height: 330px;
  background: radial-gradient(circle, rgba(255, 204, 18, 0.28), transparent 66%);
  pointer-events: none;
}

.app-header,
.player-controls,
.quick-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-pill,
.install-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 18, 0.32);
  background: rgba(255, 204, 18, 0.12);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.live-pill i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 0 0 0 7px rgba(255, 204, 18, 0.14);
}

.install-chip {
  border: 0;
  background: var(--yellow);
  color: #080808;
}

.logo-orbit {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: min(68vw, 270px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.45), 0 0 54px rgba(255, 204, 18, 0.20);
  animation: logoPulse 2.4s ease-in-out infinite;
}

.logo-orbit::before,
.logo-orbit::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: inherit;
  pointer-events: none;
}

.logo-orbit::before {
  border: 2px solid rgba(255, 204, 18, 0.75);
}

.logo-orbit::after {
  inset: -18px;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(255, 204, 18, 0.62), transparent 88% 100%);
  filter: blur(9px);
  opacity: 0.5;
  animation: logoSpin 6s linear infinite;
}

.logo-orbit img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.station-copy {
  position: relative;
  z-index: 1;
  text-align: center;
}

.station-copy p,
.track-box small,
.volume span {
  margin: 0;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.station-copy h1 {
  margin: 8px 0 4px;
  color: #fff;
  font-size: clamp(34px, 9vw, 48px);
  line-height: 0.98;
  font-weight: 950;
}

.station-copy span {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.track-box {
  position: relative;
  z-index: 1;
  align-self: end;
  display: grid;
  gap: 6px;
  min-height: 98px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.track-box strong {
  overflow: hidden;
  color: #fff;
  font-size: clamp(18px, 5vw, 22px);
  line-height: 1.2;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-box span {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-button {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe15a, var(--yellow));
  color: #050505;
  cursor: pointer;
  font-size: 26px;
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(255, 204, 18, 0.28);
}

.play-button.is-playing {
  box-shadow: 0 18px 44px rgba(255, 204, 18, 0.38), 0 0 0 9px rgba(255, 204, 18, 0.10);
}

.volume {
  flex: 1;
  display: grid;
  gap: 8px;
}

.volume input {
  width: 100%;
  accent-color: var(--yellow);
}

.quick-actions a {
  flex: 1;
  min-height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 900;
}

.quick-actions a:first-child {
  border: 0;
  background: var(--yellow);
  color: #080808;
}

.quick-actions {
  justify-content: center;
}

.quick-actions a {
  flex: 0 1 280px;
  width: min(280px, 100%);
}

.install-sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: end center;
  overflow-x: hidden;
  overflow-y: auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.install-sheet.is-open {
  opacity: 1;
  visibility: visible;
}

.install-panel {
  position: relative;
  width: min(390px, 100%);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, #202023, #111113);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
}

.install-panel img {
  width: 62px;
  height: 62px;
  border-radius: 16px;
}

.install-panel h2,
.install-panel p {
  margin: 0;
}

.install-panel h2 {
  font-size: 25px;
  line-height: 1.1;
}

.install-panel p,
.install-panel li {
  color: var(--muted);
  line-height: 1.45;
}

.install-panel strong {
  color: #fff;
}

.install-panel ol {
  margin: 0;
  padding-left: 22px;
}

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 24px;
}

.sheet-action {
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--yellow);
  color: #080808;
  font-weight: 900;
}

@keyframes logoPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.025);
  }
}

@keyframes logoSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-orbit,
  .logo-orbit::after {
    animation: none;
  }
}

/* iPhone e celulares: ocupa a largura disponivel e cresce quando necessario. */
@media (max-width: 520px) {
  .app-screen {
    min-height: 100svh;
    place-items: start center;
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .app-card {
    width: 100%;
    min-height: calc(100svh - 20px);
    gap: clamp(10px, 2svh, 18px);
    padding: 16px;
    border-radius: 24px;
  }

  .logo-orbit {
    width: min(58vw, 220px);
    min-width: 156px;
    max-width: 220px;
  }

  .station-copy h1 {
    font-size: clamp(30px, 9vw, 42px);
  }

  .station-copy span {
    font-size: 14px;
  }

  .track-box {
    min-height: 88px;
    padding: 14px;
  }

  .track-box strong,
  .track-box span {
    white-space: nowrap;
  }

  .player-controls {
    gap: 12px;
  }

  .play-button {
    width: 64px;
    height: 64px;
  }

  .quick-actions a {
    min-height: 46px;
  }

  .install-panel {
    width: 100%;
    padding: 20px;
  }
}

@supports (min-height: 100dvh) {
  @media (max-width: 520px) {
    .app-screen {
      min-height: 100dvh;
    }

    .app-card {
      min-height: calc(100dvh - 20px);
    }
  }
}

/* iPhone SE e aparelhos com pouca altura. */
@media (max-width: 370px), (max-height: 680px) and (max-width: 520px) {
  .app-card {
    gap: 8px;
    padding: 12px 14px;
  }

  .logo-orbit {
    width: min(30svh, 154px);
    min-width: 122px;
  }

  .station-copy h1 {
    margin: 4px 0 2px;
    font-size: 28px;
  }

  .station-copy p,
  .track-box small,
  .volume span {
    font-size: 10px;
  }

  .track-box {
    min-height: 70px;
    padding: 10px 12px;
  }

  .track-box strong {
    font-size: 17px;
  }

  .play-button {
    width: 54px;
    height: 54px;
  }

  .quick-actions a {
    min-height: 42px;
  }

  .live-pill,
  .install-chip {
    min-height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }
}

/* iPad Mini, iPad Air e iPad Pro: painel mais largo em duas colunas. */
@media (min-width: 600px) and (max-width: 1366px) {
  .app-screen {
    padding:
      max(24px, env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
  }

  .app-card {
    width: min(820px, 100%);
    min-height: min(720px, calc(100svh - 48px));
    grid-template-columns: minmax(230px, 0.9fr) minmax(0, 1.1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "header header"
      "logo station"
      "logo track"
      "controls actions";
    align-content: center;
    align-items: center;
    gap: 24px 32px;
    padding: clamp(28px, 4vw, 42px);
    border-radius: 34px;
  }

  .app-header {
    grid-area: header;
  }

  .logo-orbit {
    grid-area: logo;
    width: min(34vw, 280px);
  }

  .station-copy {
    grid-area: station;
    text-align: left;
  }

  .station-copy h1 {
    font-size: clamp(38px, 5.2vw, 54px);
  }

  .track-box {
    grid-area: track;
    width: 100%;
    align-self: stretch;
  }

  .player-controls {
    grid-area: controls;
  }

  .quick-actions {
    grid-area: actions;
  }

  .quick-actions a {
    width: 100%;
    flex-basis: 100%;
  }
}

@supports (min-height: 100dvh) {
  @media (min-width: 600px) and (max-width: 1366px) {
    .app-card {
      min-height: min(720px, calc(100dvh - 48px));
    }
  }
}

/* iPhone e iPad na horizontal. */
@media (orientation: landscape) and (max-height: 600px) {
  .app-screen {
    place-items: start center;
    padding:
      max(10px, env(safe-area-inset-top))
      max(16px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .app-card {
    width: min(900px, 100%);
    min-height: calc(100svh - 20px);
    grid-template-columns: minmax(130px, 0.65fr) minmax(0, 1.35fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      "header header"
      "logo station"
      "logo track"
      "controls actions";
    align-content: center;
    align-items: center;
    gap: 10px 22px;
    padding: 14px 20px;
    border-radius: 24px;
  }

  .app-header {
    grid-area: header;
  }

  .logo-orbit {
    grid-area: logo;
    width: min(34svh, 150px);
    min-width: 116px;
  }

  .station-copy {
    grid-area: station;
    text-align: left;
  }

  .station-copy h1 {
    margin: 4px 0 2px;
    font-size: clamp(27px, 5vw, 38px);
  }

  .station-copy span {
    font-size: 13px;
  }

  .track-box {
    grid-area: track;
    width: 100%;
    min-height: 68px;
    padding: 9px 12px;
  }

  .track-box strong {
    font-size: 17px;
  }

  .player-controls {
    grid-area: controls;
  }

  .play-button {
    width: 52px;
    height: 52px;
  }

  .quick-actions {
    grid-area: actions;
  }

  .quick-actions a {
    width: 100%;
    min-height: 44px;
    flex-basis: 100%;
  }
}

@supports (min-height: 100dvh) {
  @media (orientation: landscape) and (max-height: 600px) {
    .app-card {
      min-height: calc(100dvh - 20px);
    }
  }
}
