    body {
      font-family: Arial, sans-serif;
      padding: 20px;
      display: grid;
      grid-template-areas:
        "h"
        "m"
        "n";
      grid-template-columns: 1fr;
      gap: 20px;
      align-items: start;
    }

    h2 {
      grid-area: h;
      margin: 0;
    }

    #main {
      grid-area: m;
      display: grid;
      gap: 16px;
    }

    #array {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
      gap: 10px;
      margin-bottom: 20px;
      max-width: 400px;
    }

    .cell {
      width: 40px;
      height: 40px;
      border: 2px solid #444;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 18px;
      border-radius: 6px;
      transition: 0.3s;
    }

    .i {
      background-color: #4da3ff;
      color: white;
      border-color: #005bbb;
    }

    .j {
      background-color: #ff9f43;
      color: white;
      border-color: #cc6e00;
    }

    .removed {
      background-color: #ff4d4d;
      color: white;
      border-color: darkred;
    }

    button {
      padding: 10px 20px;
      font-size: 16px;
    }

    /* Mobile-first: nav placed after main via grid areas */
    #sidebar {
      grid-area: n;
      position: static;
      width: 100%;
      background: #fafafa;
      border-top: 2px solid #ccc;
      display: flex;
      flex-direction: column;
      font-family: Arial, sans-serif;
    }

    #sidebar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px;
      background: #eee;
      border-bottom: 1px solid #ccc;
    }

    #log-container {
      padding: 15px;
      overflow-y: auto;
      flex-grow: 1;
    }

    .log-entry {
      background: white;
      border: 1px solid #ddd;
      padding: 8px;
      margin-bottom: 10px;
      border-radius: 4px;
      font-size: 14px;
    }

    .log-info {
      border-left: 4px solid #007bff;
    }

    .log-compare {
      border-left: 4px solid #ff9800;
    }

    .log-delete {
      border-left: 4px solid #e53935;
    }

    .log-success {
      border-left: 4px solid #43a047;
    }

    #result {
      display: grid;
      grid-auto-flow: column;
      grid-auto-columns: 50px;
      /* largeur fixe pour chaque cellule */
      gap: 2px;
      /* pas d’espace entre les cellules */
      border: 2px solid #333;
    }

    .result-cell {
      border: 1px solid #333;
      text-align: center;
      background: #dff0d8;
      font-weight: bold;
    }

    .controls {
      display: flex;
      gap: 10px;
    }

    /* XL screens: place sidebar on the left using grid */
    @media (min-width: 1200px) {
      body {
        grid-template-columns: 300px 1fr;
        grid-template-areas:
          "h h"
          "n m";
      }

      h2 {
        grid-column: 1 / 3;
      }

      #sidebar {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
        position: sticky;
        top: 0;
        height: 100vh;
        width: 300px;
        border-left: 2px solid #ccc;
        border-top: none;
      }

      #main {
        grid-column: 2 / 3;
      }
    }