/*
Script CSS
-----------------
Par Dominique DUGAST
*/
/* Tout le contenu hors code est non sélectionnable */
body *:not(.code-wrapper):not(.code-wrapper *) {
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Code sélectionnable */
.code-wrapper {
    display: flex;
    justify-content: center;
    white-space: pre;
    user-select: text !important;
    -webkit-user-select: text !important;
    position: relative;
}

/* Sélection visible dans le code */
pre::selection,
code::selection {
    background: rgba(0, 123, 255, 0.3);
    color: #fff;
}

/* Bloc code */
pre {
    overflow-x: auto;
    padding: 1em;
    max-width: 90vw;
    width: fit-content;
    margin: 1em auto;
    border-radius: 8px;
}

/* Police responsive */
pre,
code {
    font-family: monospace !important;
    font-size: 1.2rem !important;
    line-height: 1.4 !important;
}

/* Bouton copier (style restauré) */
.copy-btn {
    position: absolute;
    top: 16px;
    right: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    pointer-events: auto !important;
    /* indispensable pour tactil */
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.copy-btn:active {
    transform: scale(0.97);
}

.copy-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.copied {
    background: rgba(60, 255, 60, 0.2) !important;
    border-color: rgba(60, 255, 60, 0.3) !important;
    color: #0f0 !important;
}

/* Police responsive pour petits écrans */
@media (max-width: 900px) {

    pre,
    code {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 600px) {

    pre,
    code {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 400px) {

    pre,
    code {
        font-size: 0.5rem !important;
    }
}