:root {
  color-scheme: only light;
  --background-color: #1a1a2e;
  --text-color: #e0e0e0;
  --primary-color: #556080;
  --secondary-color: #7b9c9f;
  --card-bg: #2d2d44;
  --card-shadow: rgba(0, 0, 0, 0.25);
  --item-active: #3a3a55;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
header {
  flex-shrink: 0;
  padding: calc(1vh + env(safe-area-inset-top)) 5% 1vh 5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  background: transparent;
}
.header-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}
.header-center {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.header-logo.main {
  height: 8vh;
  max-height: 64px;
  width: auto;
  aspect-ratio: 1/1;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--secondary-color);
}
.header-title {
  font-size: 0.9rem;
  font-weight: 600;
}
.led-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 1vh;
}
.led-display {
  font-family: 'Share Tech Mono', monospace;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 2px 14px;
  line-height: 1;
}
.led-value {
  font-size: clamp(18px, 4vh, 28px);
  letter-spacing: 3px;
  color: #ff3b3b;
  text-shadow: 0 0 6px #ff3b3b, 0 0 16px #ff3b3b;
  animation: pisca-noar 1.2s ease-in-out infinite;
}
.led-noar {
  background: rgba(255, 59, 59, 0.10);
  border: 1.5px solid rgba(255, 59, 59, 0.45);
}
@keyframes pisca-noar {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2vh 5% calc(2vh + env(safe-area-inset-bottom)) 5%;
  justify-content: center;
  gap: 2vh;
  min-height: 0;
}
.radio-players-section {
  flex-shrink: 1;
  min-height: 0;
}
.player-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1.5vh;
  text-align: center;
  box-shadow: 0 4px 8px var(--card-shadow);
  border: 2px solid var(--secondary-color);
  flex-shrink: 1;
}
.player-title {
  font-size: 0.9rem;
  margin-bottom: 0.5vh;
  color: #ff9800;
}
.player-card iframe {
  width: 100%;
  height: 18vh;
  max-height: 110px;
  border: none;
  border-radius: 8px;
  display: block;
}
.grid-section {
  flex-shrink: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#radio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1vh;
  justify-content: center;
  justify-items: center;
  align-items: center;
}
.radio-item {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px var(--card-shadow);
  transition: transform 0.1s ease;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--secondary-color);
  width: 100%;
  max-width: 85px;
  max-height: 12vh;
}
.radio-item.active {
  border-color: #ff9800;
  background-color: var(--item-active);
  box-shadow: 0 0 8px rgba(255, 152, 0, 0.5);
}
.radio-item:active {
  transform: scale(0.95);
  background-color: var(--item-active);
}
.radio-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}
footer {
  flex-shrink: 0;
  padding: 1vh 5% calc(1vh + env(safe-area-inset-bottom)) 5%;
}
.non-profit-notice,
.contact-info {
  text-align: center;
  font-size: 0.7rem;
  color: var(--secondary-color);
  padding: 1px 5%;
}
.contact-info {
  margin-bottom: 5px;
}

/* ============================================================
   LANDSCAPE — Tablet e telas grandes (altura > 500px)
   ============================================================ */
@media (orientation: landscape) {
  header {
    padding: calc(0.5vh + env(safe-area-inset-top)) 3% 0.3vh 3%;
  }
  .header-logo.main {
    height: 6vh;
    max-height: 48px;
  }
  .header-title {
    font-size: 0.8rem;
  }
  .led-container {
    margin-top: 0.3vh;
  }
  .led-value {
    font-size: clamp(14px, 3vh, 22px);
  }
  main {
    padding: 1vh 3% calc(1vh + env(safe-area-inset-bottom)) 3%;
    gap: 1vh;
    align-items: center;
  }
  #radio {
    width: 70%;
    margin: 0 auto;
  }
  .player-card {
    width: 100%;
    padding: 1vh;
  }
  .player-title {
    font-size: 0.8rem;
    margin-bottom: 0.3vh;
  }
  .player-card iframe {
    height: 120px;
    max-height: 120px;
  }
  .grid-section {
    width: 70%;
    margin: 0 auto;
  }
  #radio-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6vh;
  }
  .radio-item {
    max-height: 100px;
    max-width: 100px;
    padding: 3px;
  }
  footer {
    padding: 0.3vh 3% calc(0.3vh + env(safe-area-inset-bottom)) 3%;
  }
  .non-profit-notice,
  .contact-info {
    font-size: 0.65rem;
  }
}

/* ============================================================
   LANDSCAPE — Smartphone (telas com altura ≤ 500px)
   ============================================================ */
@media (orientation: landscape) and (max-height: 500px) {
  header {
    padding: calc(0.3vh + env(safe-area-inset-top)) 3% 0.2vh 3%;
  }
  .header-logo.main {
    height: 5vh;
    max-height: 36px;
  }
  .header-title {
    font-size: 0.7rem;
  }
  .led-container {
    margin-top: 0.2vh;
  }
  .led-value {
    font-size: clamp(12px, 2.5vh, 18px);
  }
  main {
    padding: 0.5vh 3% calc(0.5vh + env(safe-area-inset-bottom)) 3%;
    gap: 0.5vh;
    align-items: center;
  }
  #radio {
    width: 90%;
    margin: 0 auto;
  }
  .player-card {
    width: 100%;
    padding: 0.5vh;
  }
  .player-title {
    font-size: 0.7rem;
    margin-bottom: 0.2vh;
  }
  .player-card iframe {
    height: 125px;
    max-height: 125px;
  }
  .grid-section {
    width: 90%;
    margin: 0 auto;
  }
  #radio-grid {
    grid-template-columns: repeat(9, 1fr);
    gap: 0.3vh;
  }
  .radio-item {
    max-height: 65px;
    max-width: 65px;
    padding: 2px;
    border-width: 1.5px;
  }
  footer {
    padding: 0.2vh 3% calc(0.2vh + env(safe-area-inset-bottom)) 3%;
  }
  .non-profit-notice,
  .contact-info {
    font-size: 0.6rem;
  }
}

/* ============================================================
   PROMPT DE INSTALAÇÃO IOS
   ============================================================ */
.ios-prompt {
  position: fixed;
  bottom: 20px;
  left: 5%;
  right: 5%;
  background-color: var(--card-bg);
  border: 2px solid var(--secondary-color);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 9999;
  text-align: center;
  font-size: 0.85rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.ios-prompt.hidden {
  transform: translateY(150%);
  opacity: 0;
  pointer-events: none;
}
.share-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="%237b9c9f"><path d="M398.1 233.2c0-1.2.2-2.4.2-3.6 0-48.6-39.4-88-88-88-27.4 0-51.8 12.6-67.7 32.1-14.6-18.3-36.8-30.1-61.6-30.1-44.2 0-80 35.8-80 80 0 5.5.6 10.8 1.6 16-23.4 10.4-39.6 33.6-39.6 60.4 0 36.5 29.5 66 66 66h224c32 0 58-26 58-58 0-25.3-16.2-47.2-38.9-54.8zM160 192c0-17.6 14.4-32 32-32s32 14.4 32 32v128c0 17.6-14.4 32-32 32s-32-14.4-32-32V192zm128 0c0-17.6 14.4-32 32-32s32 14.4 32 32v128c0 17.6-14.4 32-32 32s-32-14.4-32-32V192z"/></svg>') no-repeat center center;
  background-size: contain;
  vertical-align: middle;
}
#close-ios-prompt {
  margin-top: 10px;
  padding: 8px 16px;
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}