:root {
      --bg: #F7F7F5;
      --surface: #FFFFFF;
      --surface-btn: #EFEFE9;
      --text: #000000;
      --text-muted: #4A4A46;
      --border: #D8D8D0;
      --border-strong: #000000;
      --yellow: #FFC40C;
      --yellow-halo: 0 0 0 3px rgba(255, 196, 12, 0.20);
      --header-h: 76px;
      --radius-card: 20px;
      --radius-pill: 9999px;
      --font-display: 'Plus Jakarta Sans', sans-serif;
      --font-sans: 'Inter', sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
    }

    html[data-theme="dark"] {
      --bg: #000000;
      --surface: #0E0E0E;
      --surface-btn: #141414;
      --text: #FFFFFF;
      --text-muted: #B8B8B2;
      --border: #262626;
      --border-strong: #FFFFFF;
    }

    *, *::before, *::after {
      box-sizing: border-box;
    }

    html {
      font-family: var(--font-sans);
      font-size: 16px;
      line-height: 1.65;
      background-color: var(--bg);
      color: var(--text);
      -webkit-font-smoothing: antialiased;
    }

    body {
      margin: 0;
      background-color: var(--bg);
      color: var(--text);
      overflow-x: clip;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    :focus-visible {
      outline: 2px solid var(--yellow);
      outline-offset: 3px;
    }

    h1, h2, h3, h4 {
      font-family: var(--font-display);
      font-weight: 800;
      letter-spacing: -0.025em;
      line-height: 1.15;
      margin: 0;
    }

    p {
      margin: 0;
      max-width: 72ch;
    }

    /* Fond Canvas 2D points interconnectés */
    #bgCanvas {
      position: fixed;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 0;
    }

    /* Header fixe opaque 76px */
    .site-header {
      position: sticky;
      top: 0;
      z-index: 40;
      height: var(--header-h);
      background-color: var(--surface);
      border-bottom: 1px solid var(--border);
    }

    .header-inner {
      max-width: 1360px;
      height: 100%;
      margin: 0 auto;
      padding-inline: 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      text-decoration: none;
      color: var(--text);
    }

    .brand-logo {
      width: 40px;
      height: 40px;
      border-radius: 10px;
      flex-shrink: 0;
      display: block;
    }

    .brand-text {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .brand-title {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.05rem;
      letter-spacing: -0.025em;
      line-height: 1.15;
    }

    .brand-sub {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .header-actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }

    /* Boutons & Sélecteurs : toujours fond solide visible, jamais transparents plats */
    button, .btn {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.78rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      background-color: var(--surface-btn);
      color: var(--text);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-pill);
      padding: 10px 18px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      text-decoration: none;
      transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
      white-space: nowrap;
    }

    button:hover:not(:disabled), .btn:hover {
      border-color: var(--border-strong);
    }

    button:active:not(:disabled), .btn:active {
      transform: translateY(1px);
    }

    .btn-primary {
      min-height: 50px;
      padding: 12px 24px;
      background-color: var(--yellow);
      color: #000000;
      border: 2px solid #000000;
    }

    .btn-primary:hover:not(:disabled) {
      background-color: #000000;
      color: var(--yellow);
      border-color: var(--yellow);
    }

    .btn-secondary {
      min-height: 50px;
      padding: 12px 24px;
      background-color: var(--surface-btn);
      color: var(--text);
      border: 2px solid var(--border-strong);
    }

    .btn-secondary:hover:not(:disabled) {
      background-color: var(--text);
      color: var(--surface);
    }

    .btn-chip {
      min-height: 38px;
      padding: 6px 14px;
      font-size: 0.72rem;
    }

    .btn-chip.is-active,
    .btn-chip[aria-selected="true"] {
      background-color: var(--yellow);
      color: #000000;
      border-color: #000000;
    }

    /* Conteneur principal */
    main {
      position: relative;
      z-index: 1;
      flex: 1;
      width: 100%;
      max-width: 1360px;
      margin: 0 auto;
      padding: 32px 20px 64px;
    }

    .hero {
      margin-bottom: 28px;
      display: flex;
      flex-wrap: wrap;
      align-items: flex-end;
      justify-content: space-between;
      gap: 16px;
    }

    .hero-eyebrow {
      display: inline-block;
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      background-color: var(--yellow);
      color: #000000;
      padding: 4px 12px;
      border-radius: var(--radius-pill);
      border: 1.5px solid #000000;
      margin-bottom: 12px;
    }

    .hero h1 {
      font-size: clamp(1.9rem, 3.6vw, 2.85rem);
      margin-bottom: 8px;
    }

    .hero-desc {
      color: var(--text-muted);
      font-size: 1rem;
    }

    /* Grille Studio : 12 colonnes desktop, Aperçu/Stats en premier sur mobile (< 1024px) */
    .workspace-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 24px;
      align-items: stretch;
    }

    .col-editor,
    .col-sidebar {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 24px;
    }

    /* Aperçu / Statistiques en premier sur mobile & tablette (< 1024px) */
    .col-sidebar {
      order: -1;
    }

    @media (min-width: 1024px) {
      main {
        padding: 40px 48px 72px;
      }
      .header-inner {
        padding-inline: 48px;
      }
      .workspace-grid {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
      }
      .col-sidebar {
        order: 0;
      }
    }

    @media (min-width: 768px) and (max-width: 1023px) {
      main {
        padding: 32px 32px 64px;
      }
      .header-inner {
        padding-inline: 32px;
      }
    }

    /* Cartes 20px + règle de la section active (.is-open) en #FFC40C */
    .card {
      background-color: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-card);
      padding: 24px;
      min-width: 0;
      transition: border-color 0.16s ease, box-shadow 0.16s ease;
    }

    .card.is-open {
      border: 2px solid var(--yellow);
      box-shadow: var(--yellow-halo);
    }

    .card-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 18px;
    }

    .card-title-group {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .badge {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      padding: 4px 10px;
      border-radius: var(--radius-pill);
      background-color: var(--surface-btn);
      color: var(--text);
      border: 1.5px solid var(--border);
    }

    .badge-yellow {
      background-color: var(--yellow);
      color: #000000;
      border-color: #000000;
    }

    /* Barre de progression objectif mots */
    .goal-bar-wrap {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
    }

    .goal-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .progress-track {
      width: 100%;
      height: 10px;
      background-color: var(--surface-btn);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-pill);
      overflow: hidden;
      margin-bottom: 16px;
    }

    .progress-fill {
      height: 100%;
      width: 0%;
      background-color: var(--yellow);
      transition: width 0.25s ease;
    }

    /* Zone de saisie */
    .editor-textarea {
      width: 100%;
      min-height: 360px;
      padding: 18px;
      border-radius: 14px;
      border: 1.5px solid var(--border);
      background-color: var(--bg);
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 1rem;
      line-height: 1.65;
      resize: vertical;
    }

    .transform-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 14px;
    }

    .editor-actions {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-top: 16px;
    }

    /* Grille Statistiques à hauteur égale */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      align-items: stretch;
    }

    .stat-box {
      background-color: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: 14px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      min-width: 0;
    }

    .stat-box.is-highlight {
      background-color: var(--yellow);
      color: #000000;
      border-color: #000000;
    }

    .stat-label {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      opacity: 0.85;
    }

    .stat-value {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.75rem;
      letter-spacing: -0.025em;
      line-height: 1.1;
      margin-top: 6px;
    }

    /* Densité de mots-clés locale */
    .density-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .density-row {
      background-color: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      padding: 10px 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      min-width: 0;
    }

    .density-word {
      font-weight: 600;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .density-meta {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.75rem;
      flex-shrink: 0;
    }

    /* Historique & JSON */
    .history-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-height: 260px;
      overflow-y: auto;
    }

    .history-item {
      background-color: var(--bg);
      border: 1.5px solid var(--border);
      border-radius: 14px;
      padding: 12px 14px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }

    .history-item.is-selected {
      border: 2px solid var(--yellow);
    }

    .history-preview {
      min-width: 0;
      flex: 1;
    }

    .history-snippet {
      font-size: 0.88rem;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .history-meta {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-top: 2px;
    }

    .history-btns {
      display: flex;
      gap: 6px;
      flex-shrink: 0;
    }

    .json-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 14px;
    }

    /* Section FAQ tout en bas */
    .faq-section {
      margin-top: 48px;
    }

    .faq-head {
      margin-bottom: 20px;
    }

    .faq-head h2 {
      font-size: clamp(1.5rem, 2.8vw, 2.1rem);
      margin-top: 10px;
    }

    .faq-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 14px;
    }

    @media (min-width: 900px) {
      .faq-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
      }
    }

    .faq-item {
      background-color: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: var(--radius-card);
      overflow: hidden;
      transition: border-color 0.16s ease, box-shadow 0.16s ease;
    }

    .faq-item.is-open {
      border: 2px solid var(--yellow);
      box-shadow: var(--yellow-halo);
    }

    .faq-trigger {
      width: 100%;
      border-radius: 0;
      border: 0;
      background-color: var(--surface-btn);
      color: var(--text);
      padding: 18px 20px;
      text-align: left;
      justify-content: space-between;
      white-space: normal;
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1rem;
      text-transform: none;
      letter-spacing: -0.01em;
      line-height: 1.35;
    }

    .faq-item.is-open .faq-trigger {
      background-color: var(--yellow);
      color: #000000;
    }

    .faq-icon {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 1rem;
      flex-shrink: 0;
    }

    .faq-panel {
      display: none;
      padding: 18px 20px;
      color: var(--text-muted);
      font-size: 0.96rem;
      line-height: 1.65;
      border-top: 1px solid var(--border);
    }

    .faq-item.is-open .faq-panel {
      display: block;
    }

    /* Toast */
    .toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translate(-50%, 16px);
      background-color: #000000;
      color: #FFFFFF;
      border: 2px solid var(--yellow);
      border-radius: var(--radius-pill);
      padding: 10px 20px;
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.78rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease, transform 0.2s ease;
      z-index: 60;
      max-width: calc(100vw - 32px);
      text-align: center;
    }

    .toast.is-visible {
      opacity: 1;
      transform: translate(-50%, 0);
    }

    /* Footer contrasté #000000 */
    .site-footer {
      position: relative;
      z-index: 1;
      background-color: #000000;
      color: #FFFFFF;
      border-top: 2px solid var(--yellow);
      padding: 28px 20px;
    }

    .footer-inner {
      max-width: 1360px;
      margin: 0 auto;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .footer-links {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .footer-link {
      background-color: #141414;
      color: #FFFFFF;
      border: 1.5px solid #333333;
      border-radius: var(--radius-pill);
      padding: 8px 16px;
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.75rem;
      text-transform: uppercase;
      text-decoration: none;
    }

    .footer-link:hover {
      border-color: var(--yellow);
      color: var(--yellow);
    }

    /* Navigation interne header */
    .header-nav {
      display: none;
      align-items: center;
      gap: 8px;
    }

    @media (min-width: 768px) {
      .header-nav {
        display: flex;
      }
    }

    .nav-pill {
      min-height: 38px;
      padding: 6px 14px;
      font-size: 0.72rem;
    }

    .nav-pill.is-active {
      background-color: var(--yellow);
      color: #000000;
      border-color: #000000;
    }

    /* Hub Guides & Articles SEO */
    .guides-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 20px;
      align-items: stretch;
    }

    @media (min-width: 900px) {
      .guides-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
    }

    .guide-card {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 18px;
      height: 100%;
    }

    .guide-card h2 {
      font-size: 1.3rem;
      margin-top: 10px;
    }

    .guide-card p {
      color: var(--text-muted);
      margin-top: 8px;
      font-size: 0.96rem;
    }

    .article-shell {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 24px;
      align-items: start;
    }

    @media (min-width: 1024px) {
      .article-shell {
        grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
      }
    }

    .article-body {
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .article-body h2 {
      font-size: clamp(1.35rem, 2.4vw, 1.75rem);
      margin-top: 8px;
    }

    .article-body p,
    .article-body li {
      color: var(--text-muted);
      font-size: 1rem;
      line-height: 1.65;
    }

    .article-body ul {
      margin: 0;
      padding-left: 20px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .table-wrap {
      width: 100%;
      overflow-x: auto;
      border: 1.5px solid var(--border);
      border-radius: 14px;
      background-color: var(--bg);
    }

    .data-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.94rem;
      text-align: left;
    }

    .data-table th,
    .data-table td {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
    }

    .data-table th {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.74rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      background-color: var(--surface-btn);
      color: var(--text);
    }

    .data-table tr:last-child td {
      border-bottom: 0;
    }

    /* Responsive strict sous 440px */
    @media (max-width: 439px) {
      .brand-sub {
        display: none;
      }
      .editor-actions,
      .stats-grid {
        grid-template-columns: minmax(0, 1fr);
      }
      .card {
        padding: 18px;
      }
    }
