/* =====================================
   6. MOBILE RESPONSIVENESS
===================================== */
@media (max-width: 768px) {
  #channel-selector { top: 0; left: 0; width: 100%; }
  /* #channel-dropdown is `position: absolute` inside #channel-selector, so
     it can never outrank #top-actions (a sibling, z-index 40) just by
     raising its own z-index — the whole #channel-selector stacking
     context is capped at its own z-index (30) regardless. Bump that
     instead, only while the dropdown is actually open, so the station
     list doesn't render underneath the SCHEDULE/ARCHIVE/ABOUT row now
     that both sit at the same top offset on mobile. */
  #channel-selector.is-open { z-index: 45; }
  #current-channel {
    font-size: 18px;
    padding: 14px 24px;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .dropdown-arrow { margin-top: 0; }

  .channel-option { font-size: 18px; padding: 18px 24px; display: flex; align-items: center; letter-spacing: 1px; }
  
  .ascii-edge { display: none; }
  
  #cover-container { width: 150px; height: 150px; bottom: 50px; right: 20px; display: block !important; }
  #cover-container:not(.expanded):hover { transform: none; }
  
  #trackbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999; padding: 8px 12px; }

  #volume-control { display: none; }
  
  /* La colonne s'arrête au-dessus de la trackbar et défile : sur un petit écran (iPhone SE)
     plusieurs panels ouverts la faisaient sinon déborder sous la trackbar, sans moyen
     d'atteindre le bas du chat. pointer-events: none (base) laisse les zones vides cliquables
     pour le visualizer ; le défilement au doigt sur un panel remonte quand même jusqu'ici.
     flex-start : avec une hauteur fixe, le space-between de base écarterait les panels. */
  #panels-wrapper {
    top: 118px; bottom: 44px; left: 10px; right: 10px;
    flex-direction: column; gap: 15px; justify-content: flex-start;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none;
  }
  #panels-wrapper::-webkit-scrollbar { display: none; }
  #panels-wrapper > * { flex-shrink: 0; }

  /* A full-width row of its own directly under the channel bar, instead of
     stacking in the top-right corner next to the station name — clearer
     separation reads as less crowded than a 3-tall stack sharing the
     corner with the channel text. No shared background bar — each button
     keeps its own (from the base #schedule-toggle/#archive-link/#about-
     toggle rule), so the row reads as buttons floating on the canvas
     visualizer, not a second bar attached to the channel selector. */
  #top-actions {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
  }
  #mobile-notice { display: none; }
  #schedule-toggle, #archive-link, #about-toggle {
    flex: 1 1 0;
    font-size: 11px;
    padding: 7px 3px;
    text-align: center;
    white-space: nowrap;
  }
  #about-close { font-size: 13px; padding: 6px 10px; top: 14px; right: 12px; }
  
  #history-container, #chat-container, #hearts-container, #announcement-container, #right-panels { width: 100%; }

  /* Cases plus grandes pour le doigt ; le picker garde une hauteur raisonnable pour
     laisser voir les derniers messages au-dessus. */
  #kaomoji-grid { max-height: min(220px, 35vh); gap: 6px; }
  .kaomoji-item { font-size: 15px; padding: 9px 8px; }
  #chat-kaomoji { padding: 0 12px; }
  #announcement-container { order: -1; }
  
  #about-page { padding: 15px; }
  .about-grid { grid-template-columns: 1fr; overflow-y: auto; height: auto; }
  .about-box { height: 500px; margin-bottom: 15px; }

  .panel.is-wide#chat-container,
  .panel.is-wide#hearts-container,
  .panel.is-wide#history-container {
    width: 100%;
  }
  
  
.about-footer {
    display: flex;
    flex-direction: row;
    gap: 10px; /* Petit espace entre les deux boutons */
    align-items: flex-start;
  }

  .about-footer-item {
    flex: 1; /* Chaque bouton prend exactement 50% de l'espace dispo */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .about-link {
    font-size: 10px; /* Texte plus petit pour rentrer sur les petits écrans */
    padding: 6px 4px;
    width: 100%; /* Le bouton s'étire sur toute sa moitié */
    box-sizing: border-box;
    display: flex;
    justify-content: center;
  }

  .about-link-desc {
    font-size: 9px; /* Description toute petite en dessous */
    margin-top: 4px;
  }  /* Mobile Responsiveness pour le nouveau About */
  .about-layout {
    flex-direction: column;
    gap: 0;
  }
  /* Sur mobile, la navigation par sidebar (onglets à scroller horizontalement)
     est remplacée par un drill-down : INDEX = écran d'accueil, tap sur une
     carte = section en plein écran avec un bouton "retour". */
  .about-sidebar {
    display: none;
  }
  .about-content {
    padding: 15px;
  }

  /* Indique qu'il y a du contenu à scroller sous le pane (ex: manifesto,
     logs) : un fondu en bas qui disparaît une fois arrivé en bas de la
     liste (classe .at-bottom posée en JS). */
  .pane-scroll {
    -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 32px), transparent 100%);
            mask-image: linear-gradient(to bottom, black calc(100% - 32px), transparent 100%);
  }
  .pane-scroll.at-bottom {
    -webkit-mask-image: none;
            mask-image: none;
  }

  /* Sur mobile, l'index redevient scrollable (pas assez de hauteur pour
     2 rangées de cartes), et les cartes ascii deviennent une liste de menu
     terminal : plus lisible, plus facile à toucher, et les ascii arts
     (pensés pour de grandes cartes desktop) ne sont plus écrasés. */
  #tab-index .pane-scroll {
    overflow-y: auto;
    display: block;
  }
  .index-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: 0;
  }
  .index-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    min-height: auto;
    padding: 18px 4px;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: 1px dashed var(--theme-color, white);
  }
  .index-card:first-child {
    border-top: 1px dashed var(--theme-color, white);
  }
  .index-card .ascii-icon {
    display: none;
  }
  .index-card .card-title {
    margin-top: 0;
    font-size: 15px;
    letter-spacing: 0.5px;
  }
  .index-card::after {
    content: '›';
    font-size: 24px;
    line-height: 1;
    opacity: 0.6;
    pointer-events: none;
  }

  .schedule-show-dots { display: none; }
  .schedule-show-row { justify-content: space-between; }

  /* Bouton retour du drill-down, affiché uniquement hors de l'INDEX */
  #about-back {
    display: none;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: transparent;
    color: var(--theme-color, white);
    border: 1px solid var(--theme-color, white);
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
  }
  #about-page.on-subpage #about-back {
    display: flex;
  }
}

#about-back {
  display: none; /* visible uniquement en mobile, voir media query */
}

/* Petite flèche indiquant qu'il reste du contenu à scroller dans le pane
   actif (desktop + mobile) : un paragraphe qui se termine par des lignes
   vides peut donner l'impression que le texte est fini alors qu'il ne l'est
   pas, la flèche lève l'ambiguïté. */
#scroll-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  font-size: 14px;
  line-height: 1;
  color: var(--theme-color, white);
  opacity: 0.75;
  pointer-events: none;
  animation: scroll-hint-bounce 1.4s ease-in-out infinite;
}
#scroll-hint.visible {
  display: block;
}
@keyframes scroll-hint-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(4px); }
}
@media (prefers-reduced-motion: reduce) {
  #scroll-hint { animation: none; }
}

