/* =====================================
   5. OVERLAYS (Splash, About, Pause)
===================================== */
/* Splash Screen */
#splash-screen {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100000;
  /* iOS Safari/Firefox: 100vh is the *largest* viewport (toolbars hidden),
     so centered content spills behind the toolbars — size to dvh instead. */
  height: 100vh; height: 100dvh;
  box-sizing: border-box; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bg-color, black); display: flex; flex-direction: column;
  align-items: center; justify-content: center; justify-content: safe center; cursor: pointer;
  transition: opacity 1.2s ease-out, transform 1.2s ease-out;
}
#splash-screen.fade-out { opacity: 0; transform: scale(1.05); pointer-events: none; }
#splash-title { font-size: 32px; color: var(--theme-color, white); letter-spacing: 1px; }
/* The frames are ~64 lines x 94 cols: at 8px that's ~615px tall, which
   doesn't fit a phone screen. Shrink the font so the art fits both the
   height (minus ~190px for title/text/catchphrase) and the width. */
#splash-ascii { font-size: 8px; font-size: min(8px, calc((100vh - 190px) / 77), calc((100vw - 24px) / 57)); font-size: min(8px, calc((100dvh - 190px) / 77), calc((100vw - 24px) / 57)); white-space: pre; color: var(--theme-color, white); text-align: left; margin-bottom: 30px; line-height: 1.2; }
#splash-text { font-size: 16px; color: var(--theme-color, white); animation: blink 1.5s infinite; }
#splash-catchphrase { font-size: 12px; color: var(--theme-color, white); opacity: 0.7; margin-top: 20px; font-style: italic; text-align: center; transition: opacity 0.5s ease-in-out; min-height: 3em; }

/* Pause Message */
#pause-message {
  position: fixed; top: 50%; left: 50%; z-index: 20;
  background: var(--bg-color, black); padding: 20px; color: var(--theme-color, white);
  border: 1px solid var(--theme-color, white); text-align: center; 
  pointer-events: none; white-space: pre; opacity: 0; visibility: hidden;
  transform: translate(-50%, -46%) scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), visibility 0.25s;
}
#pause-message.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

/* About Page */
#about-page {
  position: fixed; top: 0; left: 0; right: 0; bottom: 35px;
  background: var(--bg-color, black); z-index: 9998; padding: 30px;
  display: flex; flex-direction: column; color: var(--theme-color, white);
  visibility: hidden; opacity: 0; transform: scale(0.96);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
}
#about-page.is-open { visibility: visible; opacity: 1; transform: scale(1); }

.about-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px double var(--theme-color, white); padding-bottom: 15px; margin-bottom: 25px; }
.about-header h2 { margin: 0; font-size: 18px; letter-spacing: 1px; }

#top-actions { position: fixed; top: 12px; right: 12px; z-index: 40; display: flex; gap: 8px; }
#mobile-notice { align-self: center; margin-right: 8px; font-size: 13px; letter-spacing: 1px; color: var(--theme-color, white); opacity: 0.65; pointer-events: none; }
#schedule-toggle, #archive-link, #about-toggle { background: var(--bg-color, black); color: var(--theme-color, white); border: 1px solid var(--theme-color, white); padding: 12px 16px; cursor: pointer; font-size: 12px; font-weight: bold; text-decoration: none; transition: all 0.2s ease; }
#about-close { position: fixed; top: 12px; right: 42px; z-index: 100001; background: var(--bg-color, black); color: var(--theme-color, white); border: 1px solid var(--theme-color, white); padding: 12px 16px; cursor: pointer; font-size: 12px; font-weight: bold; transition: all 0.2s ease; }
#schedule-toggle:hover, #archive-link:hover, #about-toggle:hover, #about-close:hover { background: var(--theme-color, white); color: var(--bg-color, black); }

/* Report Modal */
#report-modal {
  position: fixed; inset: 0; z-index: 100002;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#report-modal.is-open { visibility: visible; opacity: 1; }

.report-modal-box {
  background: var(--bg-color, black); color: var(--theme-color, white);
  border: 1px solid var(--theme-color, white);
  padding: 20px; width: min(360px, 90vw);
  display: flex; flex-direction: column; gap: 12px;
  font-size: 13px;
}
.report-modal-box h3 { margin: 0; font-size: 14px; letter-spacing: 1px; }

.report-field { display: flex; flex-direction: column; gap: 4px; }

#report-track-select,
#report-username,
#report-other-text {
  background: transparent;
  border: 1px solid var(--theme-color, white);
  color: var(--theme-color, white);
  font-family: monospace;
  padding: 6px 8px;
  outline: none;
}

#report-reason-group { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
#report-reason-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

#report-target-group { border: none; border-left: 1px solid var(--theme-color, white); padding: 0 0 0 10px; margin: 0 0 0 6px; gap: 6px; }
#report-target-group legend { padding: 0; margin-bottom: 4px; }
#report-target-group label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

.report-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.report-modal-actions button {
  background: var(--bg-color, black); color: var(--theme-color, white);
  border: 1px solid var(--theme-color, white);
  padding: 8px 14px; cursor: pointer; font-family: monospace; font-size: 12px;
  transition: all 0.2s ease;
}
.report-modal-actions button:hover:not(:disabled) { background: var(--theme-color, white); color: var(--bg-color, black); }
.report-modal-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* PWA onboarding modal ("add to home screen" / "turn on notifications"), see js/pwa.js */
#pwa-modal {
  position: fixed; inset: 0; z-index: 100002;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
#pwa-modal.is-open { visibility: visible; opacity: 1; }
#pwa-modal[data-mode="install"] .pwa-step[data-step="notify"],
#pwa-modal[data-mode="notify"] .pwa-step[data-step="install"] { display: none; }

.pwa-modal-box {
  width: 100%; max-width: 400px;
  background: var(--bg-color, black); color: var(--theme-color, white);
  border: 1px solid var(--theme-color, white);
  padding: 18px;
  font-family: monospace; font-size: 13px; line-height: 1.5;
}
.pwa-modal-top {
  border-bottom: 2px double var(--theme-color, white);
  padding-bottom: 8px; margin-bottom: 12px;
  font-size: 11px; opacity: 0.7; letter-spacing: 1px;
}
.pwa-modal-title { margin: 0 0 8px; font-size: 15px; font-weight: bold; letter-spacing: 1px; }
.pwa-modal-box p { margin: 0 0 12px; }
.pwa-steps { margin: 0 0 14px; padding-left: 22px; }
.pwa-steps li { margin-bottom: 6px; }
.pwa-share-icon { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.25em; }
.pwa-hint { font-size: 11px; opacity: 0.6; }
.pwa-modal-box .setting-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; cursor: pointer; }

.pwa-modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.pwa-modal-actions button {
  background: var(--bg-color, black); color: var(--theme-color, white);
  border: 1px solid var(--theme-color, white);
  padding: 10px 14px; cursor: pointer; font-family: monospace; font-size: 12px;
  transition: all 0.2s ease;
}
.pwa-modal-actions button.pwa-primary { font-weight: bold; }
.pwa-modal-actions button:hover { background: var(--theme-color, white); color: var(--bg-color, black); }

/* Notification toggles that can't be used here (no push support, blocked...) */
.retro-checkbox:disabled + .retro-toggle-label { opacity: 0.3; cursor: not-allowed; }

/* --- LE NOUVEAU LAYOUT ABOUT (BIOS STYLE) --- */
.about-layout {
  display: flex;
  flex-grow: 1;
  gap: 30px;
  min-height: 0; /* Crucial pour le scroll interne */
  border: 1px solid var(--theme-color, white);
  background: rgba(0, 0, 0, 0.5);
}

/* La barre latérale des onglets */
.about-sidebar {
  display: flex;
  flex-direction: column;
  width: 200px;
  border-right: 1px dashed var(--theme-color, white);
  padding: 15px 0;
  background: var(--bg-color, black);
  flex-shrink: 0;
}

.about-tab {
  background: transparent;
  color: var(--theme-color, white);
  border: none;
  border-left: 3px solid transparent;
  text-align: left;
  padding: 12px 20px;
  cursor: pointer;
  font-family: monospace;
  font-size: 13px;
  font-weight: bold;
  transition: all 0.2s ease;
  user-select: none;
}

.about-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left: 3px solid rgba(255, 255, 255, 0.5);
}

.about-tab.active {
  background: var(--theme-color, white);
  color: var(--bg-color, black);
  border-left: 3px solid var(--theme-color, white);
}

/* La zone de texte principale */
.about-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 15px 15px 15px 0;
  position: relative; /* ancre #scroll-hint en bas du pane actif */
}

/* Le thème "club" est inversé (--theme-color noir, --bg-color vert fluo) :
   le fond semi-transparent noir de .about-layout donne alors un vert fluo
   sale ici. On force noir/vert fluo pour cette section en redéfinissant les
   variables localement, pour que bordures/hovers restent cohérents. */
body[data-station="club_braquage"] .about-content {
  --theme-color: #8afe00;
  --bg-color: #000000;
  background: var(--bg-color);
  color: var(--theme-color);
}

/* Le gap flex entre .about-sidebar et .about-content laisse voir le fond de
   .about-layout lui-même (vert sale) : on le passe en noir uni pour club.
   Couleur en dur (pas une variable) pour ne pas affecter .about-sidebar,
   qui calcule son propre fond vert fluo via var(--bg-color, black). */
body[data-station="club_braquage"] .about-layout {
  background: #000000;
}

.about-pane {
  display: none; /* Caché par défaut */
  flex-direction: column;
  flex: 1 1 auto; /* remplit l'espace restant dans .about-content (le bouton #about-back en prend une partie) */
  min-height: 0; /* laisse le pane se contraindre pour que .pane-scroll puisse scroller au lieu de déborder */
}

.about-pane.active {
  display: flex; /* Affiché si actif */
  animation: about-pane-in 0.2s ease;
}
@keyframes about-pane-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .about-pane.active { animation: none; }
  .schedule-modal-image.expanded { animation: none; }
  .schedule-next-up-badge { animation: none; }
}

.about-pane h3 {
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  font-size: 16px;
  border-bottom: 1px solid var(--theme-color, white);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* La zone qui scroll réellement */
.pane-scroll {
  overflow-y: auto;
  flex-grow: 1;
  min-height: 0; /* sinon un flex-item grandit sur son contenu et l'overflow ne scroll jamais */
  padding-right: 15px;
  line-height: 1.6;
}

/* --- INDEX GRID (TABLEAU DE BORD) --- */
/* Le pane de l'index ne scrolle pas : la grille occupe exactement la hauteur
   disponible et les cartes s'adaptent en conséquence (desktop uniquement,
   voir media query plus bas pour mobile). */
#tab-index .pane-scroll {
  overflow: hidden;
  display: flex;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 20px; /* Un peu plus d'espace entre les grandes cartes */
  padding-top: 10px;
  flex: 1;
  width: 100%;
}

.index-card {
  border: 1px solid var(--theme-color, white);
  background: transparent;
  padding: 15px; /* Marge interne */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  user-select: none;
  min-height: 0; /* La hauteur vient de la grille, pas d'une valeur fixe */
  overflow: hidden; /* Empêche un ASCII trop grand de casser tout le design */
}

.index-card:hover {
  background: var(--theme-color, white);
  color: var(--bg-color, black);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.index-card .ascii-icon {
  text-align: left; /* Force toutes les lignes à s'aligner sur la gauche */
  margin: 0 auto 20px auto; /* Centre le bloc ASCII entier au milieu de la carte */
  font-family: monospace; /* Force une police où chaque lettre a la même largeur */
  font-size: 7px;
  line-height: 1.1;
  margin: 0 0 20px 0;
  pointer-events: none;
  white-space: pre;
  overflow: hidden; /* Si un ascii art est trop haut, on le rogne lui plutôt que le titre */
  flex-shrink: 1;
  min-height: 0;
}

.index-card .card-title {
  font-weight: bold;
  font-size: 14px; /* Titre légèrement plus grand pour contraster */
  flex-shrink: 0; /* Le titre ne doit jamais être compressé ou coupé */
  pointer-events: none;
  margin-top: auto; /* Pousse toujours le titre tout en bas de la carte */
}
.log-entry { margin-bottom: 20px; border-bottom: 1px dashed rgba(255, 255, 255, 0.15); padding-bottom: 15px; }
.log-entry:last-child { border-bottom: none; }
.log-date { font-weight: bold; opacity: 0.8; color: var(--theme-color); }
.log-entry p { margin: 5px 0 0 0; }
.log-entry li {
  list-style-type: "- "; /* Force l'affichage d'un tiret suivi d'un espace */
  margin-left: 20px; /* Décale le texte vers la droite pour faire une belle indentation sous la date */
  margin-bottom: 5px; /* Laisse un peu d'espace entre chaque ligne d'update */
  line-height: 1.4;
}

.log-date {
  display: inline-block;
  margin-bottom: 8px; /* Écarte un peu la date de la première ligne de log */
  color: var(--theme-color, white);
  font-weight: bold;
}

.about-footer { display: flex; justify-content: center; align-items: flex-start; gap: 120px; margin-top: 25px; padding-top: 20px; border-top: 2px double var(--theme-color, white); flex-shrink: 0; }
.about-footer-item { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; width: 160px; }
.about-link { color: var(--theme-color, white); text-decoration: none; font-size: 13px; font-weight: bold; letter-spacing: 1px; padding: 6px 12px; border: 1px solid transparent; transition: all 0.2s ease; white-space: nowrap; }
.about-link:hover { background: var(--theme-color, white); color: var(--bg-color, black); border-color: var(--theme-color, white); }
.about-link-desc { font-size: 11px; color: var(--theme-color, white); opacity: 0.5; line-height: 1.3; }

.about-footer-item .palestine-link { color: #ffffff !important; background: #000000 !important; border-top: 1px solid #222222 !important; border-right: 1px solid #ffffff !important; border-bottom: 2px solid #00ff66 !important; border-left: 6px solid #ff3333 !important; box-shadow: 0 0 8px rgba(0, 255, 102, 0.15); transition: all 0.3s ease !important; }
.about-footer-item .palestine-link:hover { background: #0a0a0a !important; color: #ffffff !important; border-top-color: #ffffff !important; border-right-color: #00ff66 !important; border-bottom-color: #ff3333 !important; box-shadow: -6px 0 12px rgba(255, 51, 51, 0.6), 6px 0 12px rgba(0, 255, 102, 0.6), 0 -6px 12px rgba(255, 255, 255, 0.4); text-shadow: 0 0 5px #ffffff; }

