/**
 * Groove Lab V2 — ghost, respiration, mode danseur.
 */

.cdm-groove-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    margin: 0.4rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.68rem;
    color: #5c5048;
}

.cdm-groove-legend__swatch {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    margin-right: 0.25rem;
    vertical-align: -0.1em;
}

.cdm-groove-legend__swatch.is-ghost {
    background: rgba(120, 120, 120, 0.25);
    border: 1px dashed rgba(90, 90, 90, 0.45);
}

.cdm-groove-legend__swatch.is-mine {
    background: rgba(212, 160, 23, 0.85);
    box-shadow: 0 0 4px rgba(212, 160, 23, 0.4);
}

.cdm-groove-legend__swatch.is-removed {
    background: transparent;
    border: 1px dotted rgba(90, 90, 90, 0.5);
}

.cdm-groove-lab {
    margin-top: 0.45rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(196, 122, 18, 0.12);
}

.cdm-groove-lab__toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    font-size: 0.72rem;
}

.cdm-groove-lab__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    color: #4a3828;
}

.cdm-groove-lab__dancer-help {
    margin: 0.35rem 0 0;
    font-size: 0.7rem;
    font-style: italic;
    color: rgba(74, 56, 40, 0.78);
}

.cdm-groove-lab__snapshots,
.cdm-groove-lab__guided {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 0.4rem;
}

.cdm-groove-lab__btn,
.cdm-groove-lab__select {
    border: 1px solid rgba(196, 122, 18, 0.22);
    background: #fff;
    border-radius: 999px;
    padding: 0.25rem 0.5rem;
    font-size: 0.68rem;
    color: #4a3828;
    cursor: pointer;
}

.cdm-groove-lab__btn.is-saved {
    border-color: #a85f08;
    background: rgba(255, 248, 235, 0.95);
}

.cdm-groove-lab__guided-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #6b4a1a;
}

.cdm-groove-lab__select.is-complete {
    border-color: #3d7a4a;
}

/* Ghost hit — calque original */
.is-composer-inline-mode .cdm-player__lane-dot.is-composer-slot.is-ghost-hit::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: rgba(140, 140, 140, 0.22);
    border: 1px solid rgba(100, 100, 100, 0.35);
    pointer-events: none;
    z-index: 0;
}

.is-composer-inline-mode .cdm-player__lane-dot.is-composer-slot.is-ghost-draft::before {
    background: rgba(196, 122, 18, 0.12);
    border-style: dashed;
}

.is-composer-inline-mode .cdm-player__lane-dot.is-composer-removed.is-ghost-hit::after {
    border-style: dotted;
    opacity: 0.7;
}

.is-composer-inline-mode .cdm-player__lane-dot.is-composer-native.has-marker,
.is-composer-inline-mode .cdm-player__lane-dot.is-composer-custom.has-marker {
    position: relative;
    z-index: 1;
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.75);
}

.is-composer-inline-mode .cdm-player__lane-dot.is-composer-custom.has-marker {
    box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.95), 0 0 8px rgba(212, 160, 23, 0.35);
}

/* Humanize — respiration visuelle */
.is-groove-humanize.is-composer-inline-mode .cdm-player__lane-dot.has-marker {
    animation: cdm-groove-breathe 2.4s ease-in-out infinite;
    animation-delay: calc(var(--cdm-slot-index, 0) * 0.04s);
}

@keyframes cdm-groove-breathe {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.88; transform: scale(0.96); }
}

.is-groove-humanize.is-composer-playing .cdm-player__lane-dot.is-pulsing {
    animation: cdm-groove-pulse-soft 0.22s ease-out;
}

@keyframes cdm-groove-pulse-soft {
    0% { transform: scale(1); }
    45% { transform: scale(1.14); }
    100% { transform: scale(1.05); }
}

/* Mode danseur */
.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__slot-head[data-cdm-slot-head="1"],
.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__slot-head[data-cdm-slot-head="3"],
.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__slot-head[data-cdm-slot-head="5"],
.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__slot-head[data-cdm-slot-head="7"] {
    font-weight: 800;
    color: #1a2a4a;
}

.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__lane-dot[data-cdm-slot$=".5"].has-marker {
    opacity: 0.72;
}

.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__rhythm-lane.is-composer-inline-lane {
    transition: background 0.35s ease;
}

.is-groove-dancer-mode.is-composer-inline-mode .cdm-player__rhythm-lane.is-composer-inline-lane:has(.is-pulsing) {
    background: rgba(212, 160, 23, 0.04);
}

/* Overlay composeur */
.cdm-composer-grid__cell.is-ghost-hit {
    background: rgba(140, 140, 140, 0.15);
    border: 1px dashed rgba(100, 100, 100, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    .is-groove-humanize.is-composer-inline-mode .cdm-player__lane-dot.has-marker {
        animation: none;
    }
    .is-groove-humanize .cdm-composer-grid__cell.is-pulse-hit {
        animation: none;
        transform: none;
    }
}

@media (max-width: 640px) {
    .cdm-groove-lab__snapshots {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .cdm-groove-lab__guided {
        flex-direction: column;
        align-items: stretch;
    }

    .cdm-groove-lab__select {
        width: 100%;
    }
}
