/* --- IMPORTATION DES POLICES WEB --- */
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
        @import url('https://fonts.googleapis.com/css2?family=Aladin&display=swap');

        /* RÃ¨gle universelle */
        *, *::before, *::after {
            box-sizing: border-box;
        }

        :root {
            /* Palette Moderne Sombre */
            --bg-page: #121212;
            --bg-surface: #1e1e1e;
            --bg-input: #2a2a2a;
            --border-subtle: #333333;
            --primary-accent: #0e9367;
            --primary-hover: #c4684d;
            --primary-dark: #8a4633;
            --text-main: #e96f21;
            --text-muted: #888888;
            --modal-bg: rgba(25, 25, 25, 0.85);
            --modal-border: rgba(255, 255, 255, 0.1);
            
            /* Zones de dessin (Canvas clairs pour lisibilitÃ© des SVG noirs) */
            --canvas-bg: #e8e8e8;
            --canvas-text: #111111;

            /* Typographie et Formes */
            --font-standard: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            --radius-md: 10px;
            --radius-sm: 6px;
            
            /* Ombres */
            --shadow-surface: 0 8px 24px rgba(0, 0, 0, 0.4);
            --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
            --shadow-input: inset 0 2px 4px rgba(0, 0, 0, 0.2);
            --transition-speed: 0.2s;

            --modal-bg: rgba(30, 30, 30, 0.7); /* Sombre transparent */
            --modal-border: rgba(255, 255, 255, 0.1);
            --btn-bg: #2a2a2a;
            --btn-text: #dcdcdc;
            --btn-hover: #3a3a3a;
        }/* --- THÃˆME CLAIR (LIGHT MODE) --- */
            body.light-mode {
            --bg-surface: #ffffff;
            --bg-input: #f0f0f5;    /* Fond gris clair pour les groupes de boutons */
            --btn-bg: #ffffff;      /* Fond blanc pour les boutons individuels */
            --btn-text: #222222;    /* Texte/IcÃ´nes sombres */
            --border-subtle: #dcdce6;
            --text-muted: #555555;
            background-image: url('../img/bgl.jpg');
            background-attachment: fixed;
            background-size: cover;
            }

        body {
            font-family: var(--font-standard);
            background-color: var(--bg-page);
            color: var(--text-main);
            margin: 0;
            padding: 20px;
            min-height: 100vh;
            -webkit-font-smoothing: antialiased;
        }
        /* --- ARRIÃˆRE-PLAN IMAGE (Mode Sombre uniquement) --- */
        body:not(.light-mode) {
            /* Remplace 'fond-brume.jpg' par le nom du fichier que tu as sauvegardÃ© */
            background-image: url('../img/bg.jpg'); 
            
            /* L'image reste fixe pendant le scroll (effet parallaxe trÃ¨s pro) */
            background-attachment: fixed;
            
            /* L'image couvre tout l'Ã©cran sans Ãªtre Ã©tirÃ©e */
            background-size: cover;
            
            /* Centre l'image */
            background-position: center;
            
            background-repeat: no-repeat;
        }
        body.light-mode {
            --bg-page: #f4f4f9;          /* Fond gris trÃ¨s clair */
            --bg-surface: #ffffff;
            --text-main: #1a1a1a;
            --text-muted: #666666;
            --border-subtle: #d1d1d1;
            
            /* Variables pour les MODALES en mode JOUR */
            --modal-bg: rgba(255, 255, 255, 0.9); 
            --modal-border: rgba(0, 0, 0, 0.1);
        }
        /* Mode Clair : On remet le container Ã  plat */
        body.light-mode .container {
            background-color: rgba(255, 255, 255, 0.3);
            backdrop-filter: blur(5px);
            border-radius: 15px;
            min-height: 100vh;
        }
        
        /* Optionnel : On adoucit un peu le container pour laisser transparaÃ®tre le fond */
        body:not(.light-mode) .container {
            background-color: rgba(18, 18, 18, 0.6); /* Noir transparent Ã  60% */
            backdrop-filter: blur(5px); /* Floute lÃ©gÃ¨rement le fond derriÃ¨re le texte pour la lisibilitÃ© */
            border-radius: 15px;
            min-height: 100vh;
        }
        .container {
            max-width: 100%;
            margin: 0 auto;
            background: transparent;
            padding: 20px 30px;
        }

        .measure {
            background-color: #d3cab8;
        }

        header { text-align: center; margin-bottom: 30px; }

        .main-logo { width:450px; }

        h1 {
            color: var(--primary-accent);
            font-size: 60px;
            font-weight: 700;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
            font-family: "Aladin", system-ui;
            font-weight: 400;
            font-style: normal;
        }

        p { color: var(--text-muted); font-size: 14px; }

        .main-layout { display: flex; gap: 30px; align-items: flex-start; position: relative; isolation: isolate; }
        .left-col { flex: 3; min-width: 0; position: relative; z-index: 3; }

        .right-col {
            flex: 1; 
            background-color: var(--bg-surface);
            padding: 24px; 
            border-radius: var(--radius-md); 
            border: 1px solid var(--border-subtle);
            box-shadow: var(--shadow-surface);
            position: sticky; top: 20px; max-height: 90vh; overflow-y: auto;
            z-index: 1;
        }

        .section-title {
            border-bottom: 1px solid var(--border-subtle); 
            padding-bottom: 12px;
            margin-top: 0; margin-bottom: 20px; 
            color: var(--text-main); 
            font-size: 30px;
            display: flex; justify-content: space-evenly; align-items: center; flex-wrap: wrap; gap: 10px;
            font-family: "Aladin", system-ui;
            font-weight: 400;
            font-style: normal;
        }

        .controls { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }

        select, input[type="text"], input[type="number"] {
            padding: 10px 16px; font-size: 14px; border-radius: var(--radius-sm);
            background-color: var(--bg-input);
            border: 1px solid var(--border-subtle); 
            color: var(--text-main);
            outline: none; font-family: inherit;
            box-shadow: var(--shadow-input);
            transition: all var(--transition-speed) ease;
            font-weight: 900;
            max-width: 300px;

        }

        select:focus, input[type="text"]:focus, input[type="number"]:focus {
            border-color: var(--primary-accent);
            box-shadow: var(--shadow-input), 0 0 0 2px rgba(176, 92, 68, 0.2);
        }

        input.title-input {
            width: 100%; font-size: 28px; font-weight: 700;
            background: transparent; border: 1px dashed var(--border-subtle);
            color: var(--text-main);
            margin-bottom: 24px; text-align: center; box-shadow: none;
            padding: 12px;
        }
        input.title-input:focus { 
            background-color: rgba(255,255,255,0.02); 
            border-color: var(--text-muted);
        }

        .song-header-container {
            text-align: center;
            margin-bottom: 30px;
        }

        .song-metadata {
            display: flex;
            justify-content: center;
            gap: 20px;
            margin-top: -10px;
            margin-bottom: 20px;
        }

        .meta-item {
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--text-muted);
            font-size: 14px;
        }

        .meta-item input {
            width: 60px;
            padding: 5px;
            text-align: center;
            background: var(--bg-surface);
            border: 1px solid var(--border-subtle);
            color: var(--primary-accent);
            font-weight: bold;
        }
        /* Style pour le bouton sÃ©lection quand il est actif */
        #selection-mode-btn.active {
            background-color: #feca57 !important;
            color: #000 !important;
            border-color: #feca57 !important;
        }

        /* Curseur spÃ©cial quand on survole la grille en mode sÃ©lection */
        body.selection-active .measure {
            cursor: crosshair;
        }
        /* -------- STYLE IMPRESSION --------- */
        /*-------------------------------------*/
        /* ---- ------------------------- ---- */


        .print-metadata-line { display: none; }

        @media print {

    @page { size: A4 portrait; margin: 1cm; }

    /* === RESET GLOBAL === */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-scheme: exact !important;
    }

    body {
        background: white !important;
        background-image: none !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* === STRUCTURE === */
    .container {
        background: white !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .main-layout { display: block; }
    .left-col { width: 90%; margin: 0 auto; }

    .no-print, 
    .modal, 
    #repeat-add-btn, 
    #repeat-menu, 
    .selection-bubble,
    .theme-toggle-btn {
        display: none !important;
    }

    /* === TITRE === */
    input.title-input {
        border: none !important;
        font-size: 20pt !important;
        text-align: center !important;
        color: black !important;
        padding-top: 50px;
        margin-bottom: 20px !important;
    }

    /* === METADATA === */
    .song-metadata { display: none !important; }

    .print-metadata-line {
        display: block;
        font-size: 12pt;
        margin-bottom: 20px;
        color: black;
        font-weight: 600;
        text-align: center;
    }

    /* === GRILLE === */
    .grid-wrapper {
        width: 100% !important;
        margin: 0 auto !important;
    }

    .harmonic-grid {
        width: 100% !important;
        margin: 0 auto !important;
        grid-template-columns: 80px repeat(var(--col-count, 8), 1fr) !important;
        background: white !important;
    }

    .measure {
        background-color: #ffffff !important;
        border: 1pt solid #000 !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .measure-start { border-left: 2pt solid #000 !important; }
    .measure-end { border-right: 2pt solid #000 !important; }

    .measure input.chord-input {
        color: #000 !important;
        background: transparent !important;
        -webkit-text-fill-color: #000 !important;
    }

    .measure input.chord-input::placeholder {
        color: transparent !important;
    }

    /* === DIVISIONS (traits diagonaux) === */
    .measure[data-layout="0"] { background-image: none !important; }

    .measure[data-layout="1"] {
        background-image: url('../img/div-2.png') !important;
        background-size: 100% 100% !important;
    }

    .measure[data-layout="2"] {
        background-image: url('../img/div-3.png') !important;
        background-size: 100% 100% !important;
    }

    .measure[data-layout="3"] {
        background-image: url('../img/div-4.png') !important;
        background-size: 100% 100% !important;
    }

    /* === REPEATS (||:) === */
    .repeat-start {
        border-left: 6pt solid #000 !important;
    }

    .repeat-start::before {
        border-left: 2pt solid #000 !important;
        color: #000 !important;
        left: 2pt !important;
    }

    .repeat-end {
        border-right: 6pt solid #000 !important;
    }

    .right-col {
        page-break-before: always;
    }

    .repeat-end::after {
        border-right: 2pt solid #000 !important;
        color: #000 !important;
        right: 2pt !important;
    }

    .repeat-badge {
        background: white !important;
        color: black !important;
        border: 2pt solid black !important;
        box-shadow: none !important;
    }

    /* === MODE AVEC LEXIQUE === */
    body:not(.print-with-lexicon) .right-col {
        display: none !important;
    }

    body.print-with-lexicon .right-col {
        display: block !important;
        width: 100%;
        margin-top: 40px;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        max-height: none;
        page-break-before: always;
    }

    body.print-with-lexicon .right-col .controls {
        display: none !important;
    }

    body.print-with-lexicon .diagrams-container {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }

    .chord-card {
        page-break-inside: avoid;
    }

    body.print-with-lexicon .chord-card {
        width: 220px;
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        page-break-inside: avoid;
        transform: scale(0.9);
        transform-origin: top left;
        }

    body.print-with-lexicon .chord-name-box {
        background: white !important;
        border: 1px solid black !important;
        color: black !important;
    }
}

    /* SI VOUS VOULEZ GARDER LES TRAITS PNG SUR FOND BLANC :
       Remplacez la rÃ¨gle ci-dessus par celle-ci : */
    body:not(.light-mode) .measure[data-layout=""] { background-image: none !important; background-color: white !important; }
    body:not(.light-mode) .measure[data-layout="1"] { background-image: url('../img/div-2.png') !important; background-color: #d3cab8 !important; }
    body:not(.light-mode) .measure[data-layout="2"] { background-image: url('../img/div-3.png') !important; background-color: #d3cab8 !important; }
    body:not(.light-mode) .measure[data-layout="3"] { background-image: url('../img/div-4.png') !important; background-color: #d3cab8 !important; }

    /* 2. RÃ©duction du titre du morceau pour Ã©viter les coupures */
    input.title-input {
        font-size: 20pt !important; /* RÃ©duit de 28pt Ã  20pt */
        margin-bottom: 15px !important;
        height: auto !important;
        width: 100% !important;
        text-align: center !important;
        border: none !important;
        color: var(--text-main);
    }

    /* 3. Ajustement de la largeur de la grille pour qu'elle tienne sur la page */
    .harmonic-grid {
        max-width: 90% !important;
        width: 85% !important;
        margin: 0 auto !important;
    }


    /* 3. On s'assure que le texte redevient bien noir pour le contraste */
    h1, h2, h3, p, .group-label, .meta-item label {
        color: var(--text-main);
    }


        button {
            background-color: var(--btn-bg);
            color: var(--btn-text);
            border: 1px solid var(--border-subtle);
            padding: 10px 20px;
            border-radius: 12px; /* Coins plus doux */
            font-weight: 600;
            letter-spacing: 0.3px;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            gap: 8px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        /* Effet au survol */
        button:hover {
            background-color: var(--btn-hover);
            transform: translateY(-2px);
            box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
            border-color: var(--primary-accent);
        }

        /* Effet au clic */
        button:active {
            transform: translateY(0);
            filter: brightness(0.9);
        }

        /* Variantes spÃ©cifiques */
        .btn-danger {
            background: linear-gradient(135deg, #cf1b1b, #a01515) !important;
            border: none !important;
            color: white !important;
        }

        .btn-danger:hover {
            background: linear-gradient(135deg, #e74c3c, #cf1b1b) !important;
        }

        /* Le bouton Print dans la modale */
        #print-modal button {
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        color: var(--text-main) !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
        }

        /* On s'assure que l'icÃ´ne et le texte sont bien blancs */
        .btn-danger span, .btn-danger {
            color: white !important;
        }
        
        .btn-warning { color: #feca57; border-color: rgba(254,202,87,0.3); }
        .btn-warning:hover { background-color: rgba(254,202,87,0.1); border-color: #feca57; }
        
        .btn-import, .btn-export, .btn-print, .btn-secondary { color: var(--text-main); }
        
        button[onclick="openEditorModal()"] {
            background-color: var(--primary-accent);
            border: 1px solid var(--primary-accent);
            color: #fff;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(176, 92, 68, 0.2);
            padding: 12px 15px;
        }
        button[onclick="openEditorModal()"]:hover {
            background-color: var(--primary-hover);
            border-color: var(--primary-hover);
        }

        /* --- NOUVEL AFFICHAGE DES CONTRÃ”LES --- */
        .controls-container {
            display: flex;
            flex-wrap: wrap;
            background-color: var(--bg-surface);
            padding: 15px;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-subtle);
            margin-bottom: 25px;
            align-items: flex-end;
            padding-bottom: 20px;
        }

        .grid-shell {
            display: flex;
            align-items: flex-start;
            gap: 18px;
        }

        .grid-shell .grid-wrapper {
            flex: 1;
            min-width: 0;
        }

        .grid-side-toolbar {
            display: flex;
            align-self: flex-start;
            flex: 0 0 auto;
            padding-top: 14px;
            position: relative;
            z-index: 20;
        }

        .grid-toolbar-panel {
            position: sticky;
            top: 20px;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
            width: 96px;
            height: auto;
            min-height: 0;
            padding: 16px 10px;
            border-radius: 999px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05)),
                rgba(18, 24, 24, 0.68);
            box-shadow:
                0 18px 36px rgba(0, 0, 0, 0.35),
                inset 0 1px 0 rgba(255, 255, 255, 0.12),
                inset 0 -1px 0 rgba(255, 255, 255, 0.04);
            backdrop-filter: blur(16px) saturate(140%);
            -webkit-backdrop-filter: blur(16px) saturate(140%);
            overflow: visible;
            box-sizing: border-box;
            z-index: 21;
        }

        .grid-toolbar-panel::before {
            content: "";
            position: absolute;
            inset: 10px auto 10px 50%;
            width: 1px;
            transform: translateX(-50%);
            background: none;
            pointer-events: none;
        }

        .control-group {
            display: flex;
            flex-direction: column;
            gap: 5px;
            text-align: center;
            margin-top: 20px;
        }

        .group-label {
            font-size: 16px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            font-weight: 700;
            margin-left: 2px;
        }

        .btn-cluster {
            display: flex;
            background: var(--bg-input);
            border-radius: var(--radius-sm);
            padding: 2px;
            border: 1px solid var(--border-subtle);
            margin: 0 auto;
        }

        .btn-cluster button {
            border: none;
            background: transparent;
            box-shadow: none;
            border-radius: 4px;
            padding: 8px 12px;
            min-width: 40px;
            justify-content: center;
        }

        .btn-cluster button:hover {
            background-color: rgba(255,255,255,0.05);
        }

        /* SÃ©parateur interne discret entre les boutons collÃ©s */
        .btn-cluster button:not(:last-child) {
            border-right: 1px solid var(--border-subtle);
            border-radius: 4px 0 0 4px;
            color: var(--primary-accent);
        }

        .btn-cluster button:last-child {
            border-radius: 0 4px 4px 0;
        }

        /* Style spÃ©cial pour le bouton d'action principal */
        .btn-accent {
            background-color: var(--primary-accent) !important;
            color: white !important;
            font-weight: 600 !important;
            margin-left: 5px;
        }

        .btn-accent:hover {
            background-color: var(--primary-hover) !important;
        }

        .grid-toolbar-btn {
            position: relative;
            z-index: 1;
            width: 72px;
            min-height: 72px;
            padding: 12px 10px;
            justify-content: center;
            flex-direction: column;
            gap: 0;
            text-align: center;
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 999px;
            color: #ecfffb;
            background: linear-gradient(180deg, rgb(13, 17, 20), rgb(30, 30, 30));
            box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255,255,255,0.08);
            transform: none;
        }

        .grid-toolbar-btn::before {
            content: "";
            position: absolute;
            inset: 7px;
            border-radius: inherit;
            border: none;
            pointer-events: none;
        }

        .grid-toolbar-btn:hover {
            border-color: rgba(126, 231, 207, 0.35);
            background:
                linear-gradient(180deg, rgba(35, 68, 64, 0.96), rgba(16, 30, 29, 0.98));
            box-shadow:
                0 14px 30px rgba(0, 0, 0, 0.36),
                0 0 24px rgba(14, 147, 103, 0.16),
                inset 0 1px 0 rgba(255,255,255,0.08);
            transform: translateY(-2px);
        }

        .grid-toolbar-btn .toolbar-icon-shell {
            width: 48px;
            height: 48px;
            display: grid;
            place-items: center;
            margin: 0 auto;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), rgba(255,255,255,0.04));
            border: 1px solid rgba(255,255,255,0.12);
            box-shadow:
                inset 0 1px 0 rgba(255,255,255,0.08),
                0 0 18px rgba(14, 147, 103, 0.12);
        }

        .grid-toolbar-btn .toolbar-icon {
            width: 24px;
            height: 24px;
            display: block;
            object-fit: contain;
        }

        .grid-toolbar-btn .toolbar-glyph {
            font-size: 23px;
            line-height: 1;
            color: #f4fffd;
            display: block;
        }

        .toolbar-print-btn .toolbar-glyph {
            font-size: 21px;
        }

        .toolbar-danger-btn .toolbar-glyph {
            font-size: 22px;
            color: #ffd8dc;
        }

        .toolbar-danger-btn .toolbar-icon-shell {
            box-shadow:
                inset 0 1px 0 rgba(255,255,255,0.08),
                0 0 18px rgba(255, 95, 109, 0.14);
        }

        .toolbar-danger-btn:hover {
            border-color: rgba(255, 122, 134, 0.4);
            background:
                linear-gradient(180deg, rgba(78, 39, 44, 0.96), rgba(31, 16, 19, 0.98));
            box-shadow:
                0 14px 30px rgba(0, 0, 0, 0.36),
                0 0 24px rgba(255, 95, 109, 0.18),
                inset 0 1px 0 rgba(255,255,255,0.08);
        }

        .grid-toolbar-btn::after {
            content: attr(data-tooltip);
            position: absolute;
            left: calc(100% + 14px);
            top: 50%;
            transform: translateY(-50%) translateX(-6px);
            padding: 10px 14px;
            border-radius: 12px;
            background: rgba(12, 18, 20, 0.94);
            border: 1px solid rgba(255, 255, 255, 0.1);
            box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
            color: #f4fffd;
            font-size: 12px;
            line-height: 1.2;
            letter-spacing: 0.2px;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease, transform 0.2s ease;
            z-index: 999;
        }

        .grid-toolbar-btn:hover::after,
        .grid-toolbar-btn:focus-visible::after {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }

        #selection-mode-btn.grid-toolbar-btn.active {
            color: #08110f !important;
            border-color: rgba(126, 231, 207, 0.95) !important;
            background:
                linear-gradient(180deg, rgba(168, 255, 231, 0.98), rgba(90, 220, 184, 0.92)) !important;
            box-shadow:
                0 18px 34px rgba(16, 197, 144, 0.28),
                0 0 30px rgba(126, 231, 207, 0.42),
                inset 0 1px 0 rgba(255,255,255,0.45);
        }

        #selection-mode-btn.grid-toolbar-btn.active .toolbar-icon-shell {
            background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.76), rgba(255,255,255,0.24));
            border-color: rgba(8, 17, 15, 0.12);
            box-shadow:
                inset 0 1px 0 rgba(255,255,255,0.4),
                0 0 24px rgba(255,255,255,0.28);
        }

        body.light-mode .grid-toolbar-panel {
            border-color: rgba(116, 129, 148, 0.18);
            background:
                linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 246, 249, 0.8)),
                rgba(255, 255, 255, 0.72);
            box-shadow:
                0 18px 32px rgba(120, 136, 153, 0.18),
                inset 0 1px 0 rgba(255, 255, 255, 0.95),
                inset 0 -1px 0 rgba(135, 151, 170, 0.08);
        }

        body.light-mode .grid-toolbar-panel::before {
            background: none;
        }

        body.light-mode .grid-toolbar-btn {
            color: #12322d;
            border-color: rgba(120, 136, 153, 0.16);
            background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(232, 239, 242, 0.94));
            box-shadow:
                0 10px 22px rgba(120, 136, 153, 0.12),
                inset 0 1px 0 rgba(255,255,255,0.95);
        }

        body.light-mode .grid-toolbar-btn .toolbar-glyph {
            color: #183430;
        }

        body.light-mode .toolbar-danger-btn:hover {
            border-color: rgba(219, 87, 102, 0.32);
            background: linear-gradient(180deg, rgba(255, 241, 242, 0.96), rgba(252, 227, 230, 0.96));
            box-shadow:
                0 12px 24px rgba(219, 87, 102, 0.14),
                inset 0 1px 0 rgba(255,255,255,0.95);
        }

        body.light-mode .toolbar-danger-btn .toolbar-glyph {
            color: #9f2f3c;
        }

        body.light-mode .grid-toolbar-btn::after {
            background: rgba(255, 255, 255, 0.96);
            border-color: rgba(120, 136, 153, 0.18);
            color: #183430;
            box-shadow: 0 12px 26px rgba(120, 136, 153, 0.18);
        }

        /* --- GRILLE HARMONIQUE --- */
        .grid-wrapper { overflow-x: auto; width: 100%; margin: 0 auto; padding: 10px 0; }

        /* --- NOUVELLE STRUCTURE DE GRILLE (5 colonnes) --- */
        .harmonic-grid {
            display: grid;
            grid-template-columns: 100px repeat(var(--col-count, 4), minmax(0, 180px));
            
            /* On rend le fond invisible pour que seuls les carrÃ©s des mesures ressortent */
            background-color: transparent !important; 
            border: none !important; /* On enlÃ¨ve la grosse bordure extÃ©rieure si tu veux un look "flottant" */
            width: 95%;
            max-width: fit-content;
            margin: 0 auto;
            overflow: visible;
            gap: 0; /* On colle les mesures entre elles */
        }

        /* Style pour les Ã©tiquettes de ligne (Intro, Refrain...) */
        .row-label-input {
            background-color: transparent !important;
            color: var(--primary-accent);
            border: none !important;
            box-shadow: none !important;
            font-family: var(--font-standard);
            font-size: 12px; /* Un peu plus petit pour le multi-ligne */
            font-weight: 700;
            text-align: right;
            padding-right: 10px;
            padding-top: 35px;
            outline: none;
            white-space: normal;
            overflow-wrap: break-word;
            word-break: break-word;
            hyphens: auto;
            width: 100%;
            
            /* --- COMPORTEMENT TEXTAREA --- */
            resize: none;             /* EmpÃªche l'utilisateur de dÃ©former la case */
            height: 80%;
            align-self: center;       /* Centre verticalement dans la ligne de la grille */

        }

        /* Ajustement des bordures pour 8 mesures + 1 label */
        .measure {
            border: 1px solid #222;
            position: relative;
            aspect-ratio: 1 / 1; 
            width: 100%; 
            background-color: #fff;
            box-shadow: inset 0 2px 15px #41414130;
            z-index: 1;
        }

        .measure-start { border-left: 3px solid #222 !important; }
        .measure-end { border-right: 3px solid #222 !important; }

        /* Largeur de la grille pour l'affichage (8 mesures c'est large !) */
        .grid-wrapper { overflow-x: visible; width: 100%; margin: 0 auto; }

        .measure:hover { background-color: #f5f5f5; }
        .measure.drag-over { background-color: #d1e8ff !important; border: 2px dashed var(--primary-accent); }

        .measure input.chord-input {
            position: absolute; transform: translate(-50%, -50%);
            text-align: center; background: transparent; border: none; outline: none;
            font-family: var(--font-standard); font-weight: 600;
            color: var(--canvas-text);
            cursor: text; z-index: 2; padding: 0; margin: 0;
            transition: font-size 0.2s;
            box-shadow: none !important; 
        }

        .measure input.chord-input:focus { background-color: rgba(0, 0, 0, 0.05); border-radius: 4px; }
        .measure input.chord-input::placeholder { color: #aaa; font-weight: 400; }

        /* Positions */
        .pos-l0-center { top: 50%; left: 50%; width: 80%; }
        .pos-l1-tl { top: 30%; left: 30%; width: 50%; }
        .pos-l1-br { top: 70%; left: 70%; width: 50%; }
        .pos-l2-bl { top: 65%; left: 25%; width: 50%; }
        .pos-l2-top { top: 17%; left: 50%; width: 40%; }
        .pos-l2-right { top: 50%; left: 80%; width: 40%; }
        .pos-l3-left { top: 50%; left: 20%; width: 40%; }
        .pos-l3-top { top: 17%; left: 50%; width: 40%; }
        .pos-l3-br { top: 65%; left: 73%; width: 50%; }
        .pos-l4-left { top: 50%; left: 20%; width: 35%; }
        .pos-l4-top { top: 20%; left: 50%; width: 35%; }
        .pos-l4-right { top: 50%; left: 80%; width: 35%; }
        .pos-l4-bottom { top: 80%; left: 50%; width: 35%; }

        /* --- LEXIQUE DES ACCORDS --- */
        .diagrams-container { display: flex; flex-wrap: wrap; gap: 12px; }

        .chord-card {
            display: flex; align-items: center; justify-content: space-between;
            background-color: var(--canvas-bg); 
            border: 1px solid var(--border-subtle); 
            border-radius: var(--radius-sm); padding: 10px; position: relative; 
            padding-right: 25px; cursor: pointer; width: auto; margin: 0 auto;
            box-shadow: var(--shadow-sm);
            transition: transform var(--transition-speed);
        }
        .chord-card:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.3); }

        /* --- NOUVELLE CROIX DE SUPPRESSION MODERNE (Pure CSS) --- */
        /* --- SUPPRESSION DU ROND GRIS & CROIX ROUGE MODERNE --- */
        .delete-btn {
            position: absolute;
            top: 5px;
            right: 0px;
            width: 22px;
            height: 22px;
            cursor: pointer;
            z-index: 10;
            
            /* On force la disparition du fond gris et des bordures */
            background: none !important;
            background-color: transparent !important;
            border: none !important;
            box-shadow: none !important;
            outline: none !important;
            
            /* On cache le texte "âœ•" */
            color: transparent !important;
            font-size: 0 !important;
            
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform var(--transition-speed) ease;
        }

        /* Bouton actualiser rond */
        .btn-refresh-round {
            background-color: var(--bg-input);
            color: var(--primary-accent);
            border: 1px solid var(--border-subtle);
            width: 38px;
            height: 38px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            padding: 8px;
            box-shadow: var(--shadow-sm);
        }

        .btn-refresh-round svg {
            width: 100%;
            height: 100%;
        }

        .btn-refresh-round:hover {
            background-color: var(--primary-accent);
            color: white;
            transform: rotate(180deg); /* Petit effet de rotation sympa au survol */
            box-shadow: 0 4px 12px rgba(14, 147, 103, 0.3);
        }

        .btn-refresh-round:active {
            transform: rotate(360deg) scale(0.9);
        }

        /* En mode clair, on adapte un peu le fond */
        body.light-mode .btn-refresh-round {
            background-color: #ffffff;
            color: #0e9367;
        }

        /* Dessin de la croix rouge */
        .delete-btn::before, .delete-btn::after {
            content: '';
            position: absolute;
            width: 14px; /* Longueur des branches */
            height: 2px;  /* Ã‰paisseur */
            background-color: #ff6b6b; /* Rouge moderne */
            border-radius: 2px;
            transition: background-color var(--transition-speed) ease;
        }

        .delete-btn::before { transform: rotate(45deg); }
        .delete-btn::after { transform: rotate(-45deg); }

        /* Effet au survol */
        .delete-btn:hover {
            transform: rotate(90deg); /* Rotation fluide */
        }

        .delete-btn:hover::before, .delete-btn:hover::after {
            background-color: #e74c3c; /* Rouge plus intense au survol */
        }

        .chord-name-box {
            background-color: var(--bg-surface); color: var(--text-main); 
            width: 60px; height: 60px; display: flex; flex-direction: column;
            align-items: center; justify-content: center; border-radius: var(--radius-sm);
            font-weight: 700; border: 1px solid var(--border-subtle); 
            text-align: center; margin-right: 12px; flex-shrink: 0;
        }
        .chord-name-box .main-name { font-size: 16px; pointer-events: none; }
        .chord-name-box .sub-name { font-size: 10px; line-height: 1.2; margin-top: 2px; pointer-events: none; font-weight: 400; color: var(--text-muted); }
        
        .chord-diagram, .chord-tab { width: 100%; height: auto; pointer-events: none; display: block; }

        /* --- FENÃŠTRES MODALES --- */
        .modal {
            display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%;
            background-color: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
            align-items: center; justify-content: center;
        }
        .modal.show { display: flex; animation: fadeIn 0.2s ease-out; }
        
        .modal-content {
            background-color: var(--modal-bg) !important;
            border: 1px solid var(--modal-border) !important;
            color: var(--text-main);
            
            /* Effet de flou (Glassmorphism) */
            backdrop-filter: blur(15px);
            -webkit-backdrop-filter: blur(15px);
            
            border-radius: 15px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
        }
        
        .close-modal {
            position: absolute; top: 20px; right: 24px; font-size: 28px; font-weight: 400; color: var(--text-muted);
            cursor: pointer; line-height: 1; transition: color var(--transition-speed);
        }
        .close-modal:hover { color: var(--text-main); }

        .modal-header { border-bottom: 1px solid var(--border-subtle); padding-bottom: 16px; margin-bottom: 24px; }
        .modal-header h2 { font-family: "Aladin", system-ui; font-weight: 400; font-style: normal; font-size: 20pt; text-align: center;}
        .modal-header p  { text-align: center; font-size:16px ;}

        .modal-body { display: flex; gap: 40px; align-items: stretch; }
        .modal-main-col { flex: 1; display: flex; flex-direction: column; align-items: center; border-right: 1px solid var(--border-subtle); padding-right: 40px; }
        .modal-main-col h3, .modal-var-col h3 { margin-top: 0; margin-bottom: 20px; font-size: 16px; font-weight: 600; color: var(--text-muted);}
        
        #modal-main-diagram { 
            width: 140px; display: flex; flex-direction: column; gap: 15px; 
            padding: 15px; border-radius: var(--radius-sm); border: 1px solid #ccc;
            background-color: var(--canvas-bg);
        }
        
        .modal-var-col { flex: 2; }
        .variations-container { display: flex; flex-wrap: wrap; gap: 15px; justify-content: flex-start; }
        .variation-box {
            border: 1px solid #ccc; border-radius: var(--radius-sm); padding: 12px;
            display: flex; flex-direction: column; align-items: center; width: 120px; 
            background-color: var(--canvas-bg);
        }
        .variation-box h4 { margin: 0 0 12px 0; color: var(--canvas-text); font-size: 12px; text-align: center; font-weight: 600; }
        .variation-svgs { width: 100%; display: flex; flex-direction: column; gap: 10px; }

        /* Ã‰diteur d'accord interactif */
        .editor-string-header { width: 30px; height: 30px; display:flex; align-items:center; justify-content:center; cursor:pointer; font-weight:600; font-size: 16px; margin-bottom:8px; transition: color 0.1s;}
        .editor-fret { width: 30px; height: 40px; border: 1px solid #ccc; border-right: none; display:flex; align-items:center; justify-content:center; cursor:pointer; background-color:var(--canvas-bg); }
        .editor-fret:last-child { border-right: 1px solid #ccc; }
        .editor-string:first-child .editor-fret { border-left: 2px solid #555; }
        .editor-dot { width:16px; height:16px; background-color:var(--primary-accent); border-radius:50%; }

        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        @media (max-width: 1024px) {
            .modal-body { flex-direction: column; gap: 24px; }
            .modal-main-col { border-right: none; border-bottom: 1px solid var(--border-subtle); padding-right: 0; padding-bottom: 24px; }
            .variations-container { justify-content: center; }
            .main-layout { flex-direction: column; }
            .right-col { position: static; max-height: none; width: 100%; }
            .grid-shell { flex-direction: column; gap: 14px; }
            .grid-side-toolbar { width: 100%; padding-top: 0; }
            .grid-toolbar-panel {
                position: static;
                width: fit-content;
                max-width: 100%;
                flex-direction: row;
                flex-wrap: wrap;
                justify-content: center;
                border-radius: 36px;
                margin-left: auto;
            }
            .grid-toolbar-panel::before { display: none; }
            .grid-toolbar-btn {
                min-height: 64px;
                width: 64px;
                padding: 8px;
            }
            .grid-toolbar-btn::after {
                left: 50%;
                top: calc(100% + 12px);
                transform: translateX(-50%) translateY(-6px);
            }
            .grid-toolbar-btn:hover::after,
            .grid-toolbar-btn:focus-visible::after {
                transform: translateX(-50%) translateY(0);
            }
        }

        @media (max-width: 640px) {
            .grid-side-toolbar {
                justify-content: center;
            }
            .grid-toolbar-panel {
                width: 100%;
                justify-content: center;
                margin-left: 0;
                padding: 12px;
                border-radius: 28px;
            }
            .grid-toolbar-btn {
                width: 60px;
                min-height: 60px;
            }
            .grid-toolbar-btn .toolbar-icon-shell {
                width: 42px;
                height: 42px;
            }
            .grid-toolbar-btn .toolbar-icon {
                width: 22px;
                height: 22px;
            }
            .grid-toolbar-btn::after {
                white-space: normal;
                width: min(220px, calc(100vw - 48px));
                text-align: center;
            }
        }

        
        /* --- BULLE DE SÃ‰LECTION DE DIVISION --- */
        .selection-bubble {
            position: absolute;
            z-index: 2000;
            background: var(--bg-surface);
            border: 2px solid var(--primary-accent);
            border-radius: var(--radius-md);
            padding: 10px;
            display: none;
            gap: 10px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.8);
            /* On centre uniquement sur l'axe X, le JS gÃ©rera le Y sous la case */
            transform: translateX(-50%); 
        }

        .bubble-item {
            width: 50px;
            height: 50px;
            background: #ececec;
            border: 1px solid #333;
            cursor: pointer;
            background-size: contain;
            transition: transform 0.1s;
        }

        .bubble-item:hover {
            transform: scale(1.1);
            border-color: var(--primary-accent);
        }

        /* --- SÃ‰LECTION & MENU FLOTTANT --- */
        .measure.selected {
            outline: 3px solid #feca57 !important;
            outline-offset: -3px;
            background-color: rgba(254, 202, 87, 0.1) !important;
            z-index: 10;
        }

        #repeat-add-btn {
            position: absolute;
            top: -12px; right: -12px;
            width: 24px; height: 24px;
            background-color: #ff9f43; /* Rond orange */
            color: white; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            padding-bottom: 2px;
            font-size: 25px;
            font-weight: bold; cursor: pointer;
            box-shadow: 0 2px 5px rgba(0,0,0,0.5);
            z-index: 20;
            transition: transform 0.1s;
        }
        #repeat-add-btn:hover { transform: scale(1.1); }

        #repeat-menu {
            position: absolute; z-index: 2020;
            background: var(--bg-surface);
            border: 1px solid var(--border-subtle);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-surface);
            display: none; flex-direction: column; overflow: hidden;
            min-width: 130px;
        }
        #repeat-menu button {
            background: transparent; border: none; border-radius: 0; box-shadow: none;
            padding: 10px 15px; color: var(--text-main); text-align: left; width: 100%;
        }
        #repeat-menu button:hover { background: var(--bg-input); }

        /* --- BARRES DE REPRISE MUSICALES (||:) --- */
        .repeat-start {
            border-left: 5px solid #222 !important; /* Trait Ã©pais extÃ©rieur */
            position: relative;
        }

        .repeat-start::before {
            content: ":";
            position: absolute;
            left: 3px; /* Espace aprÃ¨s le trait Ã©pais */
            top: 0;
            bottom: 0;
            width: 10px;
            border-left: 2px solid #222; /* Trait fin intÃ©rieur */
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: "Courier New", Courier, monospace;
            font-size: 30px; /* Taille des deux points */
            font-weight: 900;
            color: #222;
            z-index: 1;
            pointer-events: none;
        }

        .repeat-end {
            border-right: 5px solid #222 !important; /* Trait Ã©pais extÃ©rieur */
            position: relative;
        }

        .repeat-end::after {
            content: ":";
            position: absolute;
            right: 3px; /* Espace avant le trait Ã©pais */
            top: 0;
            bottom: 0;
            width: 10px;
            border-right: 2px solid #222; /* Trait fin intÃ©rieur */
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: "Courier New", Courier, monospace;
            font-size: 30px;
            font-weight: 900;
            color: #222;
            z-index: 1;
            pointer-events: none;
        }

        /* Ajustement du badge (3X, 4X) pour qu'il ne chevauche pas les points */
        .repeat-badge {
            position: absolute;
            top: -15px;
            right: -10px;
            background-color: var(--primary-accent);
            color: white;
            font-size: 12px;
            font-weight: bold;
            padding: 2px 8px;
            border-radius: 10px;
            z-index: 20; /* Toujours au-dessus */
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

    

    /* --- STYLE BOUTON CRÃ‰ER ACCORD (UIVERSE) --- */
        .uiverse-button {
          border: none;
          outline: none;
          background-color: #3a3a3a;
          width: 160px; /* LÃ©gÃ¨rement rÃ©duit pour mieux s'intÃ©grer */
          height: 50px; /* AjustÃ© pour l'alignement */
          font-size: 14px;
          color: #fff;
          font-weight: 600;
          border-radius: 10px;
          display: flex;
          justify-content: center;
          align-items: center;
          cursor: pointer;
          position: relative;
          transition: all 0.3s;
          z-index: 1;
        }

        .uiverse-button::before {
          content: "";
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          background: rgba(255, 255, 255, 0.1);
          box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
          width: 95%;
          height: 95%;
          z-index: -1;
          border-radius: inherit;
          transition: all 0.3s;
        }

        .gradient-container {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          width: 95%;
          height: 95%;
          overflow: hidden;
          border-radius: inherit;
          z-index: -2;
          filter: blur(10px);
          transition: all 0.3s;
        }

        .gradient {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          width: 100%;
          aspect-ratio: 1;
          border-radius: 100%;
          transition: all 0.3s;
          background-image: linear-gradient(
            90deg,
            hsl(226, 81%, 64%),
            hsl(271, 81%, 64%),
            hsl(316, 81%, 64%),
            hsl(1, 81%, 64%),
            hsl(46, 81%, 64%),
            hsl(91, 81%, 64%),
            hsl(136, 81%, 64%),
            hsl(181, 81%, 64%)
          );
          animation: rotate 2s linear infinite;
        }

        .uiverse-button .label {
          width: 140px;
          height: 38px;
          text-align: center;
          line-height: 38px;
          border-radius: 8px;
          font-family: "Aladin", system-ui;
          font-weight: 400;
          font-style: normal;
          font-size: 16pt;
          background-color: rgba(0, 212, 182, 0.28);
          background-image: linear-gradient(180deg, rgba(43, 43, 43, 0.47) 0%, rgb(68, 68, 68) 100%);
          z-index: 2;
        }

        .uiverse-button:hover .gradient-container {
          transform: translate(-50%, -50%) scale(1.05);
          filter: blur(5px);
        }

        @keyframes rotate {
          0% { transform: translate(-50%, -50%) rotate(0deg); }
          100% { transform: translate(-50%, -50%) rotate(360deg); }
        }
        /* Container magique pour l'alignement cÃ´te Ã  cÃ´te */
    .chord-selection-row {
        display: flex;
        align-items: center;
        gap: 20px;             
        width: 100%;
        margin-bottom: 30px;
    }

    /* On s'assure que le bouton ne soit pas dÃ©formÃ© */
    .uiverse-button {
        flex-shrink: 0;         /* EmpÃªche le bouton de s'Ã©craser */
        margin: 0;              /* On enlÃ¨ve les marges qui pourraient dÃ©caler le bouton */
    }

    /* Optionnel : Si tu veux que la liste s'adapte, tu peux enlever le max-width 
       ou le laisser pour garder le bouton proche Ã  gauche */
    #chord-select {
        max-width: 250px;       /* Ta taille rÃ©duite */
        flex-grow: 0;           /* On ne veut pas qu'il s'Ã©tire trop */
        width: 225px;
    }
    /* --- NOUVEL Ã‰DITEUR D'ACCORDS --- */
    .chord-creator-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 20px;
        user-select: none; /* EmpÃªche de surligner le texte quand on dessine un barrÃ© */
    }

    .base-fret-controls {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 10px;
        font-weight: bold;
        color: var(--text-main);
    }

    .base-fret-controls button {
        background: var(--bg-input);
        border: 1px solid var(--border-subtle);
        color: var(--text-main);
        border-radius: 4px;
        padding: 5px 10px;
        cursor: pointer;
    }

    .base-fret-controls button:hover { background: var(--primary-accent); }

    .editor-mutes-container {
        position: relative;
        width: 200px; /* MÃªme largeur que le manche */
        height: 30px;
    }

    .ed-mute-btn {
        position: absolute;
        transform: translateX(-50%); /* Centre parfaitement au-dessus de la corde */
        cursor: pointer;
        font-weight: 800;
        font-size: 16px;
        color: var(--text-muted);
    }
    .ed-mute-btn.active-x { color: #e74c3c; } /* Rouge pour Mute */
    .ed-mute-btn.active-o { color: #2ecc71; } /* Vert pour Open */

    .editor-fretboard {
        position: relative;
        width: 200px;
        height: 250px;
        background-color: rgba(255, 255, 255, 0.05);
        /* Le sillet de tÃªte Ã©pais par dÃ©faut */
        border-top: 6px solid var(--text-main); 
    }

    /* Si on dÃ©marre plus bas sur le manche, le sillet devient fin */
    .editor-fretboard.not-nut {
        border-top: 2px solid var(--border-subtle);
    }

    .ed-string {
        position: absolute;
        top: 0; bottom: 0;
        width: 2px;
        background-color: var(--border-subtle);
        transform: translateX(-50%);
    }

    .ed-fret {
        position: absolute;
        left: 0; right: 0;
        height: 2px;
        background-color: var(--border-subtle);
        transform: translateY(-50%);
    }

    .ed-dot {
        position: absolute;
        width: 26px;
        height: 26px;
        background-color: #d35400; /* Couleur des points */
        border-radius: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        font-size: 14px;
        pointer-events: none; /* Laisse le clic passer au travers vers le hitbox */
        z-index: 10;
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }

    .ed-barre {
        position: absolute;
        height: 26px;
        background-color: #d35400;
        border-radius: 13px;
        transform: translateY(-50%);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-weight: bold;
        font-size: 14px;
        pointer-events: none;
        z-index: 5;
        box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    }

    .ed-hitbox {
        position: absolute;
        width: 20%;
        height: 20%;
        transform: translate(-50%, -50%);
        z-index: 20;
        cursor: pointer;
    }
    .ed-hitbox:hover {
        background-color: rgba(255, 255, 255, 0.1);
        border-radius: 50%;
    }
    .btn-edit {
        background-color: transparent;
        border: 1px solid var(--border-subtle);
        color: var(--primary-accent);
        border-radius: var(--radius-sm);
        padding: 6px 12px;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 15px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        transition: all 0.2s;
    }
    .btn-edit:hover {
        background-color: var(--bg-input);
        color: var(--primary-hover);
    }

    @media (max-width: 1655px) {
        .chord-selection-row {
            flex-direction: column;      /* Passe l'affichage de "en ligne" Ã  "en colonne" */
            align-items: center;     /* Aligne la liste et le bouton sur la gauche */
            gap: 25px;                   /* Ajuste l'espace vertical entre la liste et le halo du bouton */
        }

        #chord-select {
            width: 100%;                 /* Optionnel : la liste prend toute la largeur dispo */
            max-width: 100%;             /* Fait sauter la limite de 250px pour un look plus propre en colonne */
        }
    }
    :root {
            /* ... tes variables existantes ... */
            --modal-bg: rgba(30, 30, 30, 0.7); /* Sombre transparent */
            --modal-border: rgba(255, 255, 255, 0.1);
            --btn-bg: #2a2a2a;
            --btn-text: #dcdcdc;
            --btn-hover: #3a3a3a;
        }/* --- THÃˆME CLAIR (LIGHT MODE) --- */
            body.light-mode {
            --bg-surface: #ffffff;
            --bg-input: #f0f0f5;    /* Fond gris clair pour les groupes de boutons */
            --btn-bg: #ffffff;      /* Fond blanc pour les boutons individuels */
            --btn-text: #222222;    /* Texte/IcÃ´nes sombres */
            --border-subtle: #dcdce6;
            --text-muted: #555555;
        }

    /* Petits ajustements spÃ©cifiques pour le mode clair */
    body.light-mode .editor-fretboard {
        background-color: rgba(0, 0, 0, 0.03); /* Fond du manche lÃ©gÃ¨rement sombre au lieu de clair */
    }
    body.light-mode .measure.selected {
        background-color: rgba(254, 202, 87, 0.3) !important; /* Jaune un peu plus soutenu sur fond blanc */
    }

    /* --- BOUTON THEME TOGGLE --- */
    .theme-toggle-btn {
        position: absolute;
        top: 20px;
        right: 30px;
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: 50%;
        width: 45px;
        height: 45px;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow-sm);
        transition: all var(--transition-speed) ease;
        z-index: 1000;
    }

    .theme-toggle-btn:hover {
        transform: scale(1.1);
        background: var(--bg-input);
    }

        /* =======================================================
   STYLE DES DIVISIONS DE MESURES (Traits standards) 
   S'applique par dÃ©faut (Mode clair et Impression)
   ======================================================= */
.measure[data-layout="0"] { background-image: none; }
.measure[data-layout="1"] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><line x1='0' y1='100' x2='100' y2='0' stroke='%23222' stroke-width='1.5'/></svg>");
    background-size: 100% 100%;
}
.measure[data-layout="2"] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><line x1='0' y1='100' x2='100' y2='0' stroke='%23222' stroke-width='1.5'/><line x1='0' y1='0' x2='50' y2='50' stroke='%23222' stroke-width='1.5'/></svg>");
    background-size: 100% 100%;
}
.measure[data-layout="3"] {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><line x1='0' y1='0' x2='100' y2='100' stroke='%23222' stroke-width='1.5'/><line x1='0' y1='100' x2='100' y2='0' stroke='%23222' stroke-width='1.5'/></svg>");
    background-size: 100% 100%;
}

/* =======================================================
   STYLE "BRUSH / VIGNETTE" (Mode Sombre - Ã‰cran) 
   ======================================================= */

body:not(.light-mode) .measure {
    background-color: #d3cab8 !important; /* Force le fond gris Ã  l'impression */
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.4) !important; /* Force la vignette */
    border: 1pt solid #111 !important;
}

body:not(.light-mode) .measure input.chord-input {
    font-family: 'Georgia', 'Times New Roman', serif !important;
    font-weight: 600 !important;
    color: #111 !important;
    -webkit-text-fill-color: #111 !important; /* SpÃ©cifique pour l'impression Webkit (Chrome/Edge) */
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.4) !important;
}

/* Image pour la division par 2 */
body:not(.light-mode) .measure[data-layout="1"] {
    background-image: url('../img/div-2.png') !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Image pour la division par 3 */
body:not(.light-mode) .measure[data-layout="2"] {
    background-image: url('../img/div-3.png') !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Image pour la division par 4 */
body:not(.light-mode) .measure[data-layout="3"] {
    background-image: url('../img/div-4.png') !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}
/* --- CONTENEUR DES BOUTONS DANS LA MODAL --- */
.modal-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

/* --- STYLE COMMUN BOUTONS MODAL --- */
.modal-content button {
    margin: 0 25px;
    justify-content: center;
}

/* --- BOUTON "OUI, VIDER" (DANGER MODERNE) --- */
.modal-content .btn-confirm-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(192, 57, 43, 0.4);
}

.modal-content .btn-confirm-danger:hover {
    background: linear-gradient(135deg, #ff4d4d 0%, #e74c3c 100%) !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(192, 57, 43, 0.6);
}

/* --- BOUTON "ANNULER" (STYLE GLASS/NEUTRE) --- */
.modal-content .btn-cancel {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: var(--text-main) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Version Light-mode pour Annuler */
body.light-mode .modal-content .btn-cancel {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #222 !important;
}

.modal-content .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: translateY(-3px);
    border-color: var(--primary-accent) !important;
}

/* Force la disparition des éléments ayant la classe hidden */
.hidden {
    display: none !important;
}