/* DESKTOP LAYOUT - 3 Colonnes séparées */

/* Tooltip custom */
#custom-tooltip {
    position: fixed;
    background: rgba(30, 30, 30, 0.92);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    display: none;
}


/* Masquer l'interface mobile compacte sur desktop */
.tools-compact {
    display: none !important;
}

/* Base background pour desktop - Design simple blanc */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #FFFFFF;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
}

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

/* Container principal desktop - Grid 3 colonnes */
.editor-container {
    display: grid;
    grid-template-columns: 210px 1fr 200px;
    /* Gauche | Centre | Droite */
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "header-center header-center header-center"
        "left-sidebar main-grid right-sidebar";
    height: 100vh;
    width: 100vw;
    padding: 0;
    padding-top: env(safe-area-inset-top); /* macOS Sequoia / iOS safe area */
    gap: 0;
    background: #FFFFFF;
    margin: 0;
    max-width: none;
}

/* ========================================
   TOP BAR - Bandeau horizontal supérieur
   ======================================== */
.project-info {
    grid-area: header-center;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #FFFFFF;
    border-bottom: 1px solid #E5E5EA;
    border-radius: 0;
    box-shadow: none;
    position: relative;
    overflow: visible;
}

/* Logo pixel-editor à gauche */
.branding {
    justify-content: flex-start;
    /* Aligné à gauche sur desktop */
    gap: 12px;
}

.app-icon {
    height: 56px;
    width: auto;
    object-fit: contain;
}

.app-text {
    height: 56px;
    width: auto;
    object-fit: contain;
}

/* Titre du projet */
.project-info h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1D1D1F);
    letter-spacing: -0.02em;
}

/* Repositionner le profil utilisateur à droite */
.project-info .user-profile {
    position: relative;
    left: auto;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    z-index: 100;
    overflow: visible;
}

/* Masquer l'email sur la top bar */
.project-info .user-email {
    display: none;
}

/* Avatar container avec menu déroulant */
.user-profile-display {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    background: var(--bg-hover, #F0F0F2);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
    position: relative;
    z-index: 100;
    overflow: visible;
}

.user-profile-display:hover {
    background: var(--border-color, #E5E5EA);
    transform: scale(1.05);
}

/* Masquer le username dans la top bar */
.user-profile-display .user-name {
    display: none;
}

/* Avatar circular */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-primary, #FF7300);
    box-shadow: 0 2px 8px rgba(255, 115, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover, #F0F0F2);
}

/* S'assurer que le contenu de l'avatar remplit le cercle */
.user-avatar svg,
.user-avatar img,
.user-avatar > div {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover;
}

/* Menu déroulant avatar - Style simple */
.user-dropdown {
    display: none !important;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    max-width: 280px;
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
    z-index: 1001;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.user-dropdown.open {
    display: block !important;
}

.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #E5E5EA;
    margin: 0;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary, #1D1D1F);
}

.user-dropdown a,
.user-dropdown button,
.user-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: #1D1D1F;
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.user-dropdown a:hover,
.user-dropdown button:hover,
.user-dropdown .dropdown-item:hover {
    background: #F5F5F7;
}

.user-dropdown .dropdown-icon {
    width: 18px;
    height: 18px;
    opacity: 0.6;
}

.user-dropdown .dropdown-divider {
    height: 1px;
    background: #E5E5EA;
    margin: 0;
}

/* Masquer le bouton logout original */
.project-info .logout-btn {
    display: none;
}

/* Menu hamburger caché sur desktop */
.menu-hamburger {
    display: none;
}

/* ========================================
   SIDEBAR GAUCHE - Nuancier + Outils
   ======================================== */
.tools-secondary {
    grid-area: left-sidebar;
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: #FAFAFA;
    border-right: 1px solid #E5E5EA;
    border-radius: 0;
    box-shadow: none;
    overflow-y: auto;
    gap: 4px;
    height: 100%;
    box-sizing: border-box;
}

/* Toolbar original cachée sur desktop */
.toolbar {
    display: none;
}

/* Styles pour les couleurs */
.color-palette {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
    /* Pas de scroll sur le conteneur principal */
    position: relative;
}

/* Suppression du scroll sur .color-palette pour éviter la double scrollbar */
.color-palette.scrollable {
    overflow: visible;
    /* Pas de scroll ici */
}

.color-picker-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-start;
    align-items: center;
    position: relative;
    width: 100%;
    margin-bottom: 0;
}

/* Container pour afficher la couleur actuelle */
.desktop-current-color-container {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 4px 6px;
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    width: 100%;
    position: relative;
    overflow: visible;
}

.color-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #6E6E73);
    font-weight: 500;
}

.desktop-current-color {
    width: 32px;
    height: 32px;
    border-radius: 0;
    border: 1px solid #E5E5EA;
    background-color: #000000;
    box-shadow: none;
    flex-shrink: 0;
    transition: background 0.15s ease;
    cursor: pointer;
}

.desktop-current-color:hover {
    opacity: 0.8;
}

.desktop-current-color:focus-visible {
    outline: 3px solid rgba(0, 122, 255, 0.75);
    outline-offset: 3px;
}

#colorPicker {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 0;
    opacity: 0;
    cursor: pointer;
    transform: translateY(-50%);
    z-index: 5;
    pointer-events: auto;
}

.validate-color-btn {
    flex: 0 0 auto;
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-bottom: 1px solid #E5E5EA;
    border-radius: 0;
    background: #FFFFFF;
    color: #1D1D1F;
    font-size: 1.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    text-shadow: none;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.validate-color-btn:hover:not(:disabled) {
    background: #F5F5F7;
}

.validate-color-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    background: #F5F5F7 !important;
    border-bottom: 1px solid #E5E5EA !important;
}

/* Le contenu du bouton est géré dynamiquement par JavaScript */
.validate-color-btn:empty::before {
    content: '✓ ';
    font-size: 1.1rem;
}

/* Modale custom de sélection de couleur */
.custom-color-modal {
    width: min(460px, 94vw);
    padding: 0;
    margin: clamp(16px, 4vh, 32px);
    background: linear-gradient(160deg, rgba(45, 46, 80, 0.95), rgba(25, 26, 60, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(10, 10, 30, 0.45);
    color: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    max-height: 92vh;
}

.custom-color-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-color-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.custom-color-body {
    flex: 1;
    padding: clamp(18px, 3vw, 24px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
}

.custom-color-preview {
    width: 100%;
    height: 120px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    background: #000;
}

.custom-color-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 10px 14px;
}

.custom-color-hex-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
}

.custom-color-hex-value {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.95);
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    outline: none;
    width: 80px;
    cursor: text;
    padding: 2px 0;
    font-family: monospace;
    transition: border-color 0.2s;
}

.custom-color-hex-value:focus {
    border-bottom-color: rgba(255, 255, 255, 0.7);
}

.custom-color-spectrum {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.custom-color-spectrum canvas {
    width: 100%;
    height: auto;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: crosshair;
    background: #000;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.2);
}

.custom-color-spectrum::before {
    content: '';
    display: block;
    width: 100%;
    padding-top: min(62%, 240px);
}

.custom-color-spectrum canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.custom-color-spectrum-hint {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
}

.custom-color-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
    gap: 10px;
}

.custom-color-swatch {
    width: 100%;
    padding-top: 100%;
    position: relative;
    border-radius: 0;
    border: 1px solid #E5E5EA;
    box-shadow: none;
    cursor: pointer;
    transition: opacity 0.15s ease;
    background-clip: padding-box;
}

.custom-color-swatch::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 8px;
    background: inherit;
}

.custom-color-swatch:hover,
.custom-color-swatch:focus-visible {
    opacity: 0.8;
    outline: none;
}

.custom-color-swatch.selected {
    border: 2px solid #FF7300;
}


.custom-color-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.custom-color-actions-right {
    display: flex;
    gap: 10px;
    flex: 1 1 200px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.custom-color-actions .dialog-button {
    flex: 1 1 clamp(120px, 32%, 160px);
    min-width: 0;
}

@media (max-width: 768px) {
    .custom-color-modal {
        width: 92vw;
    }
}

@media (max-width: 560px) {
    .custom-color-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-color-actions-right {
        width: 100%;
        justify-content: flex-start;
    }

    .custom-color-actions .dialog-button {
        flex: 1 1 100%;
        width: 100%;
    }
}

.validate-color-btn:empty:not(:disabled)::after {
    content: 'Ajouter à la palette';
}

.validate-color-btn:empty:disabled::after {
    content: 'Sélectionnez une couleur';
    font-size: 0.8rem;
}

.tools-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.validate-undo-redo-row {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    margin-bottom: 8px;
}

.eraser-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-bottom: 1px solid #E5E5EA;
    border-radius: 0;
    background: #FFFFFF;
    color: #1D1D1F;
    cursor: pointer;
    transition: background 0.15s ease;
}

.undo-redo-btn {
    flex: 0 0 auto;
    min-width: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 1.2rem;
    font-weight: 500;
    border: none;
    border-bottom: 1px solid #E5E5EA;
    border-radius: 0;
    background: #FFFFFF;
    color: #1D1D1F;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eraser-btn:hover,
.undo-redo-btn:hover {
    background: #F5F5F7;
}

.preset-colors {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    justify-items: center;
    padding: 0;
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    width: 100%;
    box-sizing: border-box;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
}

.preset-colors::-webkit-scrollbar {
    width: 6px;
}

.preset-colors::-webkit-scrollbar-track {
    background: var(--border-light, #F0F0F2);
    border-radius: 999px;
}

.preset-colors::-webkit-scrollbar-thumb {
    background: var(--border-color, #E5E5EA);
    border-radius: 999px;
}

.color-btn {
    width: 100%;
    aspect-ratio: 1;
    min-width: 0;
    max-width: 100%;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
    box-shadow: none;
    position: relative;
    box-sizing: border-box;
}

.color-btn:hover {
    opacity: 0.8;
    border-color: #FF7300;
}

.color-btn.selected {
    border: 2px solid #FF7300;
    box-shadow: 0 0 0 1px #FF7300;
}

/* Bouton "+" pour ajouter une couleur personnalisée */
.color-btn.add-color-btn {
    background: transparent;
    border: 1px dashed rgba(255, 115, 0, 0.6);
    color: rgba(255, 115, 0, 0.9);
    font-size: 20px;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-btn.add-color-btn:hover {
    background: rgba(255, 115, 0, 0.12);
    border-color: #FF7300;
    color: #FF7300;
    opacity: 1;
}

/* ===================================================================
   STYLES POUR LES COULEURS PERSONNALISÉES
   =================================================================== */

/* Bouton de couleur personnalisée - bordure simple */
.color-btn.custom-color {
    border: 2px solid #007AFF;
    box-shadow: none;
}

.color-btn.custom-color .color-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #007AFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #007AFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    pointer-events: auto;
    z-index: 2;
}

.color-btn.custom-color:hover {
    border-color: #0056b3;
    transform: scale(1.15);
    box-shadow:
        0 0 0 2px rgba(0, 122, 255, 0.4),
        0 4px 16px rgba(0, 122, 255, 0.3);
}

.color-btn.custom-color:hover .color-badge {
    color: #0056b3;
    border-color: #0056b3;
    transform: scale(1.05);
}

.color-btn.custom-color.show-remove {
    border-color: rgba(255, 59, 48, 0.9);
    box-shadow:
        0 0 0 2px rgba(255, 59, 48, 0.35),
        0 6px 18px rgba(255, 59, 48, 0.25);
}

.color-btn.custom-color.show-remove .color-badge {
    background: linear-gradient(135deg, rgba(255, 93, 95, 0.95), rgba(255, 59, 48, 0.95));
    color: #ffffff;
    border-color: rgba(255, 59, 48, 0.8);
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(255, 59, 48, 0.35);
}

/* ========================================
   BOUTONS SIDEBAR GAUCHE
   ======================================== */
.extra-tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    overflow-y: auto;
}

.extra-tools button {
    padding: 0;
    height: 30px;
    font-size: 0;
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    color: #1D1D1F;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.extra-tools button i, .extra-tools button svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.extra-tools button:hover {
    background: #F5F5F7;
}

.extra-tools button:active {
    background: #F0F0F2;
}

/* Masquer les boutons secondaires - ils sont dans le dropdown menu */
.extra-tools #profileBtn,
.extra-tools #helpBtn2,
.extra-tools #creditsBtn2 {
    display: none;
}

/* Masquer les boutons déplacés dans le dropdown de l'avatar */
.extra-tools #saveBtn2,
.extra-tools #loadBtn2,
.extra-tools #loadLocalBtn2,
.extra-tools #exportGifBtn2,
.extra-tools #photoToPixelBtn2,
.extra-tools #templateBtn2,
.extra-tools #publishTemplateBtn {
    display: none;
}

.fps-sidebar-panel {
    display: none;
    position: fixed;
    z-index: 1000;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    width: 220px;
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
    animation: fadeIn 0.15s ease;
}

.fps-sidebar-panel.open {
    display: flex;
}

.fps-sidebar-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    color: var(--text-primary, #1D1D1F);
}

.fps-sidebar-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.fps-sidebar-value span {
    font-size: 1.35rem;
}

.fps-sidebar-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.fps-sidebar-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fps-sidebar-slider input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.fps-sidebar-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid rgba(102, 126, 234, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.fps-sidebar-slider input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid rgba(102, 126, 234, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.fps-sidebar-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.fps-sidebar-preset {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.2);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    min-height: 54px;
}

.fps-sidebar-preset small {
    font-size: 0.7rem;
    opacity: 0.8;
}

.fps-sidebar-preset:hover {
    background: rgba(102, 126, 234, 0.35);
    border-color: rgba(102, 126, 234, 0.8);
    transform: translateY(-1px);
}

.fps-sidebar-preset.active {
    background: rgba(102, 126, 234, 0.55);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 14px rgba(102, 126, 234, 0.35);
}

.fps-sidebar-hint {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    text-align: left;
}

/* Styling spécifique pour certains boutons */
/* Style uniforme pour tous les boutons - style simple */
.extra-tools button[id*="preview"],
.extra-tools button[id*="clear"],
.extra-tools button[id*="delete"],
.extra-tools button[id*="save"],
.extra-tools button[id*="export"] {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E5EA;
}

.extra-tools button[id*="preview"]:hover,
.extra-tools button[id*="clear"]:hover,
.extra-tools button[id*="delete"]:hover,
.extra-tools button[id*="save"]:hover,
.extra-tools button[id*="export"]:hover {
    background: #F5F5F7;
}

/* ========================================
   ZONE CENTRALE - Grille de pixels
   ======================================== */
.grid-container {
    grid-area: main-grid;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: #FFFFFF;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

/* Grille dynamique (taille contrôlée par JS via --grid-cols et --cell-size) */
#pixelGrid {
    /* Viewport fixe — taille contrôlée par JS via applyGridCSSVariables() */
    --grid-cols: 32;
    /* width et height injectés par JS — viewport toujours fixe peu importe la résolution */

    position: relative;
    overflow: hidden;
    aspect-ratio: 1;

    border: 1px solid #E5E5EA;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: none;
}

/* Phase 3 : plus de div.pixel — rendu 100% canvas */

#pixelGrid.stamp-mode {
    cursor: crosshair;
}

/* Bouton pipette actif */
.eyedropper-btn.active,
#eyedropperBtn.active {
    background: rgba(var(--color-secondary-rgb, 0, 180, 166), 0.15) !important;
    border-color: var(--color-secondary, #00B4A6) !important;
    box-shadow: 0 0 12px rgba(var(--color-secondary-rgb, 0, 180, 166), 0.3) !important;
}

/* Grille 2×2 outils (Gomme / Pipette / Fill / Symétrie) */
.tools-grid-2x2 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.tool-chip {
    padding: 0;
    height: 30px;
    border: 1px solid #E5E5EA;
    border-radius: 0;
    background: #FFFFFF;
    color: #1D1D1F;
    font-size: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease;
    overflow: hidden;
}

.tool-chip i, .tool-chip svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.tool-chip:hover {
    background: #F5F5F7;
}

.tool-chip.active {
    background: #FFF3E8 !important;
    border-color: #FF7300 !important;
    color: #FF7300 !important;
}

/* Boutons fill et symétrie actifs */
#fillBtn.active,
#symmetryBtn.active {
    background: rgba(52, 199, 89, 0.3) !important;
    border-color: rgba(52, 199, 89, 0.6) !important;
    box-shadow: 0 0 12px rgba(52, 199, 89, 0.4) !important;
}

/* Symétrie V active */
.symmetry-v-btn.active {
    background: #34C759 !important;
    color: white !important;
    border-color: #34C759 !important;
}

/* Sélection active */
.selection-btn.active {
    background: var(--color-secondary, #00B4A6) !important;
    color: white !important;
    border-color: var(--color-secondary, #00B4A6) !important;
}

.crop-stamp-btn.active {
    background: #00C853 !important;
    color: white !important;
    border-color: #00C853 !important;
}

/* Bouton référence */
#loadRefBtn {
    width: 100%;
    padding: 8px;
    background: #f5f5f7;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}

#loadRefBtn:hover {
    background: #e8e8ed;
}

/* Section outil */
.tool-section {
    margin-top: 8px;
}

.ref-move-btn.active {
    background: #FF7300 !important;
    color: white !important;
    border-color: #FF7300 !important;
}

/* Animations pour les notifications pipette */
@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }

    15%,
    85% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
}

/* ========================================
   SIDEBAR DROITE - Frames
   ======================================== */
.frames-container {
    grid-area: right-sidebar;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: #FAFAFA;
    border-left: 1px solid #E5E5EA;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    gap: 12px;
}

.frames-container h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1D1D1F);
    text-align: center;
}

/* Bouton Nouvelle Frame - Couleur orange principale */

/* ========================================
   BOUTONS FRAME ACTIONS DESKTOP (Copier/Coller)
   ======================================== */

.frame-actions {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 10px;
    padding: 0 4px;
    flex-shrink: 0;
}

.frame-action-btn {
    width: clamp(34px, 2.2vw, 40px);
    height: clamp(34px, 2.2vw, 40px);
    border: none;
    border-radius: 9px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: clamp(13px, 1.3vw, 18px);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.frame-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.frame-action-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.copy-btn {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
}

.paste-btn {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}


/* Styles obsolètes pour .frame - remplacés par .frame-preview */

.frame-thumbnail {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    grid-template-rows: repeat(16, 1fr);
    gap: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.thumbnail-pixel {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    box-sizing: border-box;
}

.frame-number {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    font-weight: 500;
}

/* Liste des frames avec scroll indépendant */
#framesList {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Indicateur visuel pour la frame en cours d'exécution */
.frame-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 6px;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.frame-preview {
    position: relative;
    width: 100%;
    min-width: 110px;
    max-width: 110px;
    min-height: 110px;
    max-height: 110px;
    padding: 3px;
    background: rgba(135, 206, 250, 0.2);
    border: 1px solid rgba(0, 122, 255, 0.4);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    aspect-ratio: 1;
}

.frame-preview:hover {
    background: rgba(135, 206, 250, 0.3);
    border-color: rgba(0, 122, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

.frame-preview.active {
    background: rgba(135, 206, 250, 0.35);
    border-color: rgba(0, 122, 255, 0.7);
    box-shadow: 0 0 20px rgba(0, 122, 255, 0.3), 0 4px 16px rgba(0, 122, 255, 0.2);
}

/* Bouton "+" pour insérer une frame */
.insert-frame-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    border: 1px solid rgba(0, 122, 255, 0.4);
    background: rgba(135, 206, 250, 0.2);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(0, 122, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.insert-frame-btn:hover {
    background: rgba(135, 206, 250, 0.3);
    border-color: rgba(0, 122, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

/* Pastille bleue pour la frame active (en cours de travail) */
.frame-container .frame-preview.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #007AFF;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.8), 0 0 16px rgba(0, 122, 255, 0.5);
    z-index: 10;
}

/* Pastille verte pour la frame en cours d'animation (priorité sur la bleue) */
.frame-container .frame-preview.playing::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00FF00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.8), 0 0 16px rgba(0, 255, 0, 0.5);
    animation: pulse-playing 1s ease-in-out infinite;
    z-index: 11;
}

@keyframes pulse-playing {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }

    50% {
        transform: translateY(-50%) scale(1.3);
        opacity: 0.8;
    }
}

/* ZONE PUB en bas - Barre visible sans référence publicitaire */
.ad-space {
    display: none;
}

/* Masquer tout contenu texte dans la barre */
.ad-space span,
.ad-space * {
    display: none;
    visibility: hidden;
}

/* Responsive pour très grands écrans (1600–2199px) */
@media (min-width: 1600px) and (max-width: 2199px) {
    .editor-container {
        grid-template-columns: 280px 1fr 240px;
    }

    #pixelGrid {
        --cell-size: min(calc((100vw - 560px) / 32),
                calc((100vh - 200px) / 32),
                32px);
        aspect-ratio: 1;
    }

    .project-info .user-email {
        max-width: 250px;
    }
}

/* iMac 27" et très grands écrans (≥2200px — ex: 2560px, 5120px) */
@media (min-width: 2200px) {
    .editor-container {
        grid-template-columns: 360px 1fr 320px;
    }

    #pixelGrid {
        /* Canvas limité à 896px — les sidebars absorbent le reste */
        max-width: 896px;
        max-height: 896px;
        aspect-ratio: 1;
    }

    .project-info .user-email {
        max-width: 320px;
    }

    /* Sidebars plus larges → meilleure lisibilité */
    .left-sidebar,
    .tools-panel {
        font-size: 1.05rem;
    }
}

/* Responsive pour écrans moyens */
@media (min-width: 1024px) and (max-width: 1400px) {
    .editor-container {
        grid-template-columns: 220px 1fr 180px;
    }

    #pixelGrid {
        --cell-size: min(calc((100vw - 420px) / 32),
                calc((100vh - 200px) / 32),
                24px);
        aspect-ratio: 1;
    }
}

/* Responsive pour petits écrans desktop */
@media (min-width: 1024px) and (max-width: 1200px) {
    .editor-container {
        grid-template-columns: 200px 1fr 160px;
        padding: 8px;
        gap: 8px;
    }

    #pixelGrid {
        --cell-size: min(calc((100vw - 380px) / 32),
                calc((100vh - 180px) / 32),
                20px);
        border-radius: 12px;
        aspect-ratio: 1;
    }

}


/* Phase 3 : marqueurs DOM supprimés — onion skin rendu sur canvas */


/* ===================================================================
   AJUSTEMENTS DES MINIATURES - DESKTOP UNIQUEMENT
   =================================================================== */

@media (min-width: 1024px) {

    /* Fix pour les miniatures de frames */
    .thumbnail-pixel {
        min-width: 2px !important;
        min-height: 2px !important;
    }
}


/* ===================================================================
   CORRECTIONS SUPPLÉMENTAIRES - DESKTOP UNIQUEMENT
   =================================================================== */

@media (min-width: 1024px) {

    /* Fixer la taille des miniatures pour éviter le redimensionnement */
    .frame-thumbnail {
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        max-height: 100% !important;
        flex-shrink: 0 !important;
    }

    /* Améliorer la visibilité des miniatures */
    .frame-container {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 6px !important;
        position: relative;
    }

    /* Assurer que toutes les frames ont la même taille (carré) */
    .frame-preview {
        width: 110px !important;
        min-width: 110px !important;
        max-width: 110px !important;
        height: 110px !important;
        min-height: 110px !important;
        max-height: 110px !important;
        aspect-ratio: 1 !important;
    }
}


/* ===================================================================
   BOUTON PLAY DANS LA BARRE DU HAUT - DESKTOP
   =================================================================== */

/* Bouton play masqué dans le header - existe déjà dans la sidebar gauche */
.play-button {
    display: none !important;
}

.compact-preset-colors {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    min-width: 0;
    padding: 2px 0 18px;
    position: relative;
}

.palette-scroll-hint {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin: -12px 0 0;
}

/* ===================================================================
   FENÊTRE DE DIALOGUE DE SAUVEGARDE - DESKTOP
   =================================================================== */

.save-dialog {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9998 !important;
    padding: 20px !important;
    animation: fadeIn 0.3s ease !important;
}

.save-dialog-content {
    background: linear-gradient(155deg, rgba(36, 48, 94, 0.98), rgba(28, 38, 80, 0.95)) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 24px !important;
    padding: 32px !important;
    width: 100% !important;
    max-width: 420px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
    animation: fadeIn 0.3s ease !important;
    color: rgba(255, 255, 255, 0.95) !important;
}

.save-dialog h3 {
    margin: 0 0 20px 0 !important;
    text-align: center !important;
    font-size: 1.3rem !important;
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 600 !important;
}

.save-dialog input {
    width: 100% !important;
    padding: 16px !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: 16px !important;
    font-size: 1rem !important;
    margin-bottom: 20px !important;
    outline: none !important;
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    color: white !important;
    box-sizing: border-box !important;
}

.save-dialog input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.save-dialog input:focus {
    border-color: rgba(0, 122, 255, 0.6) !important;
    background: rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2) !important;
}

.save-dialog .dialog-buttons {
    display: flex !important;
    gap: 12px !important;
    margin-top: 20px !important;
}

.save-dialog .dialog-buttons button {
    flex: 1 !important;
    padding: 12px 24px !important;
    border: none !important;
    border-radius: 10px !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.save-dialog .dialog-buttons button#dialogSave {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.9), rgba(0, 86, 179, 0.9)) !important;
    color: white !important;
}

.save-dialog .dialog-buttons button#dialogSave:hover {
    background: linear-gradient(135deg, rgba(0, 122, 255, 1), rgba(0, 86, 179, 1)) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4) !important;
}

.save-dialog .dialog-buttons button#dialogCancel {
    background: rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.save-dialog .dialog-buttons button#dialogCancel:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-1px) !important;
}
/* ── Panel calques ──────────────────────────────────────────────────────────── */
.layers-panel {
    margin-top: 12px;
    border: 1px solid #E5E5EA;
    border-radius: 8px;
    overflow: hidden;
}

.layers-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: #F5F5F7;
    border-bottom: 1px solid #E5E5EA;
}

.layers-panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #1D1D1F;
}

.add-layer-btn {
    font-size: 11px;
    padding: 3px 8px;
    background: #FF7300;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}
.add-layer-btn:hover { background: #E06200; }

.layers-list {
    max-height: 140px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F2;
    transition: background 0.1s;
}
.layer-item:last-child { border-bottom: none; }
.layer-item:hover { background: #F5F5F7; }
.layer-item.active { background: #FFF3E8; border-left: 4px solid #FF7300; box-shadow: inset 0 0 0 1px rgba(255,115,0,0.15); }

.layer-eye {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    line-height: 1;
    color: #555;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.layer-eye:hover { background: #E8E8ED; color: #1D1D1F; }
.layer-eye.layer-hidden { color: #BBBBBB; }
.layer-eye.layer-hidden:hover { color: #888; }

.layer-name {
    flex: 1;
    font-size: 12px;
    color: #1D1D1F;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    transition: opacity 0.15s;
}
.layer-name-hidden { opacity: 0.35; font-style: italic; }

.layer-actions { display: flex; gap: 2px; flex-shrink: 0; }

.layer-action-btn {
    background: none;
    border: 1px solid #E5E5EA;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
}
.layer-action-btn:hover { background: #F0F0F2; }
.layer-delete-btn:hover { background: #FFE5E5; color: #FF3B30; border-color: #FF3B30; }

/* ── Drag & Drop calques ─────────────────────────────────────────────────── */
.layer-drag-handle {
    cursor: grab;
    color: #BBBBBB;
    font-size: 14px;
    flex-shrink: 0;
    padding: 0 2px;
    user-select: none;
    line-height: 1;
}
.layer-drag-handle:hover { color: #888; }
.layer-drag-handle:active { cursor: grabbing; }

.layer-item.layer-dragging {
    opacity: 0.4;
    background: #F0F0F2;
}
.layer-item.layer-drop-above { border-top: 2px solid #FF7300; }
.layer-item.layer-drop-below { border-bottom: 2px solid #FF7300; }

/* ── Frames panel redesign ───────────────────────────────────────────────── */
.frames-container {
    grid-area: right-sidebar;
    display: flex;
    flex-direction: column;
    background: #FAFAFA;
    border-left: 1px solid #E5E5EA;
    overflow: hidden;
    padding: 0;
    gap: 0;
}

/* Panneaux glissants mobiles : invisibles sur desktop */
.mobile-slide-panel,
.mobile-trait-handle {
    display: none;
}

.frames-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: #F5F5F7;
    border-bottom: 1px solid #E5E5EA;
    flex-shrink: 0;
}
.stamps-header { border-top: 1px solid #E5E5EA; margin-top: 4px; }

.frames-panel-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.frames-panel-title svg { width: 13px; height: 13px; }

.frames-panel-actions { display: flex; gap: 4px; }

.frames-hdr-btn {
    background: none;
    border: 1px solid #D1D1D6;
    border-radius: 5px;
    padding: 0;
    width: 28px;
    height: 28px;
    font-size: 11px;
    cursor: pointer;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    transition: background 0.1s;
    flex-shrink: 0;
}
.frames-hdr-btn:hover { background: #E8E8ED; }
.frames-hdr-btn svg { width: 13px; height: 13px; }
.frames-hdr-btn.primary {
    background: #FF7300;
    border-color: #FF7300;
    color: white;
    font-weight: 600;
}
.frames-hdr-btn.primary:hover { background: #e56600; }

/* Liste frames */
#framesList {
    overflow-y: auto;
    flex-shrink: 0;
    max-height: 240px;
}

/* Ligne frame — style identique aux calques */
.frame-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F2;
    transition: background 0.1s;
    user-select: none;
}
.frame-row:last-child { border-bottom: none; }
.frame-row:hover { background: #F5F5F7; }
.frame-row.active { background: #FFF3E8; border-left: 3px solid #FF7300; }
.frame-row.frame-dragging { opacity: 0.4; background: #F0F0F2; }
.frame-row.frame-drop-above { border-top: 2px solid #FF7300; }
.frame-row.frame-drop-below { border-bottom: 2px solid #FF7300; }

.frame-drag-handle {
    cursor: grab;
    color: #BBBBBB;
    font-size: 13px;
    flex-shrink: 0;
    padding: 0 2px;
    user-select: none;
    line-height: 1;
}
.frame-drag-handle:hover { color: #888; }
.frame-drag-handle:active { cursor: grabbing; }

.frame-row-thumb {
    width: 28px;
    height: 28px;
    border: 1px solid #D1D1D6;
    border-radius: 3px;
    background: white;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.frame-row-name {
    flex: 1;
    font-size: 12px;
    color: #1D1D1F;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.frame-row-del {
    background: none;
    border: 1px solid #E5E5EA;
    border-radius: 4px;
    padding: 2px 5px;
    font-size: 11px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s, background 0.1s;
}
.frame-row-del svg { width: 11px; height: 11px; }
.frame-row:hover .frame-row-del { opacity: 1; }
.frame-row-del:hover { background: #FFE5E5; color: #FF3B30; border-color: #FF3B30; }

/* Bouton ajouter frame */
.frames-add-row {
    padding: 5px 8px;
    border-bottom: 1px solid #E5E5EA;
    flex-shrink: 0;
}
.frames-add-btn {
    width: 100%;
    background: none;
    border: 1px dashed #D1D1D6;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.1s, color 0.1s;
}
.frames-add-btn svg { width: 12px; height: 12px; }
.frames-add-btn:hover { background: #F5F5F7; color: #555; border-color: #AAAAAA; }

/* Liste tampons */
#stampsList {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Ligne tampon — identique aux calques */
.stamp-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F2;
    transition: background 0.1s;
    user-select: none;
}
.stamp-row:last-child { border-bottom: none; }
.stamp-row:hover { background: #F5F5F7; }
.stamp-row.active { background: #FFF3E8; border-left: 3px solid #FF7300; padding-left: 5px; }

.stamp-drag-handle {
    cursor: grab;
    color: #BBBBBB;
    font-size: 13px;
    flex-shrink: 0;
    padding: 0 2px;
    line-height: 1;
}
.stamp-drag-handle:hover { color: #888; }

.stamp-eye-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    flex-shrink: 0;
    color: #555;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.stamp-eye-btn svg { width: 14px; height: 14px; }
.stamp-eye-btn:hover { background: #E8E8ED; }
.stamp-eye-btn.hidden-stamp { color: #BBBBBB; }

.stamp-row.frame-dragging { opacity: 0.4; background: #F0F0F2; }
.stamp-row.stamp-drop-above { border-top: 2px solid #FF7300; }
.stamp-row.stamp-drop-below { border-bottom: 2px solid #FF7300; }

.stamp-row-thumb {
    width: 28px;
    height: 28px;
    border: 1px solid #D1D1D6;
    border-radius: 3px;
    background: white;
    flex-shrink: 0;
    image-rendering: pixelated;
}

.stamp-row-name {
    flex: 1;
    font-size: 12px;
    color: #1D1D1F;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stamp-row-name.dimmed { opacity: 0.35; font-style: italic; }

.stamp-row-del {
    background: none;
    border: 1px solid #E5E5EA;
    border-radius: 4px;
    padding: 2px 5px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}
.stamp-row-del svg { width: 11px; height: 11px; }
.stamp-row:hover .stamp-row-del { opacity: 1; }
.stamp-row-del:hover { background: #FFE5E5; color: #FF3B30; border-color: #FF3B30; }

.stamps-empty {
    padding: 20px 12px;
    text-align: center;
    color: #BBBBBB;
    font-size: 11px;
    line-height: 1.6;
}
.stamps-empty svg { width: 20px; height: 20px; margin-bottom: 6px; opacity: 0.35; display: block; margin-inline: auto; }
