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

html, body {
    width: 100%; height: 100%;
    background: #000;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ── Diaporama ── */
#slideshow { position: fixed; inset: 0; }

.slide {
    position: absolute;
    inset: 0;
    background-color: #000;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.slide.active { opacity: 1; }

/* ── Ken Burns ── */
.slide.kb-1 { animation: kb1 var(--kb-dur, 8s) ease-in-out forwards; }
.slide.kb-2 { animation: kb2 var(--kb-dur, 8s) ease-in-out forwards; }
.slide.kb-3 { animation: kb3 var(--kb-dur, 8s) ease-in-out forwards; }
.slide.kb-4 { animation: kb4 var(--kb-dur, 8s) ease-in-out forwards; }
.slide.kb-5 { animation: kb5 var(--kb-dur, 8s) ease-in-out forwards; }
.slide.kb-6 { animation: kb6 var(--kb-dur, 8s) ease-in-out forwards; }

@keyframes kb1 { from { transform: scale(1.0) translate(0%, 0%); }   to { transform: scale(1.25) translate(-4%, -3%); } }
@keyframes kb2 { from { transform: scale(1.25) translate(-4%, -3%); } to { transform: scale(1.0) translate(4%, 3%); } }
@keyframes kb3 { from { transform: scale(1.1) translate(3%, 2%); }    to { transform: scale(1.3) translate(-3%, -2%); } }
@keyframes kb4 { from { transform: scale(1.3) translate(3%, -3%); }   to { transform: scale(1.0) translate(-3%, 3%); } }
@keyframes kb5 { from { transform: scale(1.0) translate(-3%, 3%); }   to { transform: scale(1.2) translate(3%, -2%); } }
@keyframes kb6 { from { transform: scale(1.15) translate(0%, -4%); }  to { transform: scale(1.0) translate(0%, 4%); } }

/* ── Contrôles ── */
#controls {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.6s ease;
}

#controls.hidden { opacity: 0; pointer-events: none; }

#controls button {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

#controls button:active { background: rgba(255,255,255,0.2); transform: scale(0.92); }
#btn-play { width: 72px; height: 72px; font-size: 28px; }

/* ── Info album ── */
#album-info {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    letter-spacing: 0.8px;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.6s ease;
    white-space: nowrap;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    pointer-events: none;
}

#album-info.hidden { opacity: 0; }

/* ── Overlay config ── */
#config-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    opacity: 1;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

#config-overlay.hidden { opacity: 0; pointer-events: none; }

/* ── Panel configuration ── */
#config-panel {
    position: fixed;
    top: 0; right: 0;
    width: min(440px, 94vw);
    height: 100%;
    background: #0f172a;
    color: #e2e8f0;
    z-index: 300;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -6px 0 40px rgba(0,0,0,0.7);
}

#config-panel.open  { transform: translateX(0); }
#config-panel.hidden { display: none; }

#config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 20px 20px;
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8);
    flex-shrink: 0;
}

#config-header h2 { font-size: 22px; font-weight: 600; color: #fff; }

#btn-close-config {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#btn-close-config:hover { background: rgba(255,255,255,0.25); }

#config-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    -webkit-overflow-scrolling: touch;
}

.config-section { display: flex; flex-direction: column; gap: 12px; }
.config-section.row { flex-direction: row; align-items: center; justify-content: space-between; }

.config-section label, .config-section .label-text {
    font-size: 15px;
    color: #94a3b8;
    font-weight: 500;
}

.config-section input[type=range] {
    width: 100%;
    accent-color: #3b82f6;
    height: 5px;
    cursor: pointer;
}

.albums-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.albums-header h3 {
    flex: 1;
    font-size: 16px;
    color: #cbd5e1;
    font-weight: 600;
}

.albums-header button {
    padding: 5px 14px;
    border: 1px solid #3b5bdb;
    background: transparent;
    color: #60a5fa;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.albums-header button:hover { background: rgba(59,91,219,0.2); }

#albums-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 380px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.album-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.album-item:hover { background: rgba(59,91,219,0.18); }

.album-item input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: #3b82f6;
    flex-shrink: 0;
    cursor: pointer;
}

.album-item-info { flex: 1; }
.album-item-name { font-size: 14px; color: #e2e8f0; }
.album-item-nb { font-size: 12px; color: #475569; margin-top: 2px; }

/* Toggle */
.toggle { display: inline-flex; align-items: center; cursor: pointer; }
.toggle input { display: none; }

.toggle-slider {
    width: 50px; height: 28px;
    background: #334155;
    border-radius: 14px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.toggle input:checked + .toggle-slider { background: #3b82f6; }
.toggle input:checked + .toggle-slider::after { left: 26px; }

.config-footer { padding-top: 4px; padding-bottom: 20px; }

#btn-start {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 4px 20px rgba(59,130,246,0.4);
}

#btn-start:active { opacity: 0.85; transform: scale(0.98); }
