/**
 * Radio Vibra FM — capa móvil (≤ 900px)
 * Prioridad sobre styles.css: legibilidad, sin scroll horizontal, áreas táctiles.
 */

@media (max-width: 900px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
    max-width: 100%;
  }

  body {
    overflow-x: clip;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  #main-content {
    overflow-x: clip;
    max-width: 100%;
  }

  .content-section {
    max-width: 100%;
    overflow-x: clip;
  }

  header,
  nav,
  footer {
    max-width: 100%;
    overflow-x: clip;
  }

  header {
    padding: 10px 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 10px;
    border-radius: 16px;
  }

  .logo {
    align-self: center;
  }

  .logo img,
  .logo .logo-main-img {
    height: clamp(72px, 20vw, 96px);
    max-height: 96px;
  }

  .radio-title__short {
    display: none;
  }

  .header-intro {
    width: 100%;
    gap: 0.75rem;
  }

  .radio-title {
    font-size: clamp(1rem, 4.5vw, 1.2rem);
    line-height: 1.35;
    margin: 0;
    padding: 0 4px;
    text-wrap: balance;
    hyphens: auto;
  }

  .radio-title__long {
    display: none;
  }

  .radio-title__short {
    display: block;
  }

  /* Avatar + reproductor en fila compacta */
  .info-container {
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    text-align: left;
  }

  .img-container {
    margin: 0;
    flex-shrink: 0;
    width: 76px;
    height: 76px;
  }

  .dj-img {
    width: 76px;
    height: 76px;
    border-width: 2px;
    object-fit: contain;
    object-position: center bottom;
    background: rgba(0, 0, 0, 0.15);
  }

  .player-box {
    flex: 1;
    min-width: 0;
  }

  .vibra-player {
    margin: 0 0 10px;
    padding: 10px 12px;
    gap: 8px;
    border-radius: 14px;
  }

  .vibra-play-ring {
    width: 48px;
    height: 48px;
  }

  .vibra-ico {
    width: 22px;
    height: 22px;
  }

  .vibra-live-badge {
    font-size: 10px;
    padding: 5px 10px 5px 8px;
  }

  .info-container .info {
    text-align: left;
    font-size: 0.88rem;
    line-height: 1.45;
  }

  .info-container .info p {
    margin: 4px 0;
    word-break: break-word;
  }

  #sonic_title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Nav deslizable — 5 pestañas legibles */
  .nav-container {
    max-width: 100%;
    margin: 0.5rem auto 0.85rem;
    padding: 0 max(8px, env(safe-area-inset-left)) 0 max(8px, env(safe-area-inset-right));
  }

  .navbar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 6px;
    padding: 8px;
    grid-template-columns: unset;
    min-height: 0;
    height: auto;
  }

  .navbar::-webkit-scrollbar {
    display: none;
  }

  .navbar li {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .navbar .nav-tab {
    min-height: 48px;
    min-width: 5.4rem;
    padding: 10px 14px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .content-section {
    margin: 12px auto;
    padding: 12px max(10px, env(safe-area-inset-left)) 16px max(10px, env(safe-area-inset-right));
    max-width: 100%;
  }

  .carousel-container {
    height: auto;
    aspect-ratio: 1366 / 768;
    min-height: 168px;
    max-height: 52vw;
    margin: 12px auto;
    border-radius: 12px;
  }

  .carousel-item picture,
  .carousel-item img {
    height: 100%;
    object-fit: cover;
  }

  .carousel-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  /* ─── Chat responsive (breakpoint único ≤900; desktop ≥901 en styles.css MQ901) ─── */

  .request-timeline-container {
    margin-top: 28px;
    gap: 16px;
    padding: 0 8px;
  }

  .request-timeline-container > .song-request,
  .request-timeline-container > .chat-container {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;
    min-height: 420px;
    max-height: none;
  }

  .song-request,
  .chat-container {
    min-width: 0;
    max-width: 100%;
  }

  .song-request {
    padding: 14px;
  }

  .song-request input,
  .song-request textarea,
  #chat-input {
    font-size: 16px;
  }

  .chat-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .chat-live-title {
    font-size: 1.1rem;
    flex: 1 1 auto;
  }

  .chat-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-reglas,
  .btn-logout {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  .chat-compose-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  .chat-input-wrap {
    flex: 1 1 calc(100% - 52px);
    min-width: 0;
  }

  #send-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* #chat-settings-btn: 42×42 en styles.css (!important); sin override móvil */

  #chat-box {
    min-height: 220px;
    max-height: 50vh;
  }

  .bottom-container {
    margin-top: 24px;
    gap: 12px;
    padding: 0 8px;
  }

  .twitter-timeline-container,
  .discord-widget-container {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 280px;
    max-height: none;
  }

  .discord-widget-container {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .discord-widget-container .vibra-discord-widget {
    width: 100%;
    min-height: 260px;
    height: auto;
  }

  .vibra-discord-widget__members {
    min-height: 180px;
    max-height: min(240px, 36dvh);
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 92vh);
    overflow-y: auto;
    padding: 14px 14px max(18px, env(safe-area-inset-bottom));
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    border-radius: 18px 18px 0 0;
    box-sizing: border-box;
  }

  .notification {
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: translateY(-12px) scale(0.96);
    font-size: 0.9rem;
    padding: 16px 14px 14px;
    grid-template-columns: auto 1fr;
  }

  .notification.show {
    transform: translateY(0) scale(1);
  }

  .notification--actionable,
  .notification--persistent {
    max-width: none;
  }

  .notification__content {
    padding-right: 24px;
  }

  .vacantes-container {
    padding-left: 0;
    padding-right: 0;
  }

  .alianza-btn {
    min-height: 44px;
    width: auto;
    min-width: 7rem;
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .radio-title {
    font-size: 1.05rem;
  }

  .info-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .info-container .info {
    text-align: center;
    width: 100%;
  }

  #sonic_title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .vibra-player {
    flex-wrap: wrap;
    justify-content: center;
  }

  .vibra-player-meta {
    flex: 1 1 auto;
    justify-content: center;
  }

  .vibra-player-volume-wrap {
    width: 100%;
    justify-content: center;
  }

  .chat-input-wrap {
    flex: 1 1 100%;
  }

  .chat-compose-row #send-btn {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 360px) {
  .navbar .nav-tab {
    min-width: 4.8rem;
    font-size: 0.82rem;
    padding: 10px 10px;
  }

  .dj-img {
    width: 64px;
    height: 64px;
  }
}
