/* Base */
body {
    background-color: #0d0d0d;
    color: #00ffcc;
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-size: clamp(13px, 2.2vw, 16px); /* typo fluide pour mobile */
  }
  
  /* Terminal container centré */
  .terminal-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100dvh;
    padding: 16px;
    box-sizing: border-box;
  }
  
  /* Terminal */
  .terminal {
    position: relative;
    z-index: 2;
    background-color: #1a1a1a;
    border: 2px solid #00ffcc;
    border-radius: 5px;
    width: min(96vw, 800px);          /* un peu plus flexible en mobile */
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
    overflow: hidden;                  /* évite tout scroll horizontal résiduel */
  }
  
  .terminal-header {
    background-color: #00ffcc;
    padding: 10px;
    border-bottom: 2px solid #00ffcc;
    color: #0d0d0d;
  }
  
  /* Corps du terminal : WRAP AGRESSIF */
  .terminal-body {
    position: relative;
    z-index: 2;
    padding: 20px;
    min-height: 400px;
    color: #00ffcc;
  
    /* anti-débordement */
    overflow-wrap: anywhere;  /* casse même les tokens très longs */
    word-break: break-word;
  }
  
  /* Lignes de sortie (texte simple) : wrap normal */
  .output-line {
    white-space: normal;
    margin: 2px 0;
  }
  
  /* Blocs (équivalent 'pre') : conserver sauts de ligne, mais wrap quand même */
  .output-block {
    white-space: pre-wrap;   /* <= clé pour empêcher le débordement des <pre> */
    word-break: break-word;
    margin: 6px 0;
  }
  
  /* Ligne d'entrée : se replie sur mobile si besoin */
  .input-line {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;         /* <= permet retour à la ligne */
  }
  .input-line .prompt { white-space: nowrap; }
  .input-line .command-input {
    flex: 1 1 220px;
    min-width: 120px;
    max-width: 100%;
  }
  
  /* Liens dans le terminal */
  .terminal-link,
  .terminal-body a {
    color: #00ffcc;
    text-decoration: underline;
    word-break: break-all;   /* casse les URLs interminables */
  }
  .terminal-link:hover,
  .terminal-body a:hover { color: #001aff; }
  
  /* Background couche vidéo + canvas */
  .background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
  }
  .background video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.35) saturate(1.2);
  }
  #bg-rain {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }
  
  /* Popup centrée */
  .popup-tutorial {
    position: fixed;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 13, 13, 0.7);
    padding: 16px;
    box-sizing: border-box;
  }
  .popup-tutorial .popup-content {
    position: relative;
    background-color: rgba(13, 13, 13, 0.92);
    border: 2px solid #00ffcc;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
    color: #00ffcc;
    width: min(92vw, 640px);
    max-height: 80vh;
    overflow: auto;
    padding: 20px 24px;
  }
  .popup-tutorial h2 { margin-top: 0; }
  .popup-tutorial ul { list-style: none; padding: 0; margin: 0; }
  .popup-tutorial li { margin-bottom: 10px; }
  
  .close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #00ffcc;
    font-size: 22px;
    cursor: pointer;
  }
  
  /* Mobile optimisé */
  @media (max-width: 480px) {
    .terminal-body { padding: 16px; }
    .popup-tutorial .popup-content { padding: 16px 18px; }
  }
  