body:not(.slide-page) {
    overflow: hidden;
    background: #0f172a;
    color: white;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

.glass {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* --- 1. SIDEBAR --- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 0px;
    z-index: 2000;
    background: transparent;
    border-right: none;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    z-index: 2000;
}

/* OUVERTURE VIA BOUTON (TOUS ECRANS) */
#sidebar.open {
    width: 280px;
    background: rgba(15, 23, 42, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.8);
}

/* OUVERTURE VIA SURVOL (UNIQUEMENT PC) */
@media (hover: hover) {
    #sidebar:hover:not(.force-close) {
        width: 280px;
        background: rgba(15, 23, 42, 0.98);
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 10px 0 50px rgba(0, 0, 0, 0.8);
    }
}

/* VERROUILLAGE FERMETURE (ANTI-REBOND) */
#sidebar.force-close {
    width: 0px !important;
    background: transparent !important;
    border: none !important;
}

/* CONTENU DU MENU */
.sidebar-content {
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: none;
}

#sidebar.open .sidebar-content {
    opacity: 1;
    transition-delay: 0.15s;
    pointer-events: auto;
}

@media (hover: hover) {
    #sidebar:hover:not(.force-close) .sidebar-content {
        opacity: 1;
        transition-delay: 0.15s;
        pointer-events: auto;
    }
}

.sidebar-header-clickable {
    cursor: pointer;
    transition: background 0.2s;
}

.sidebar-header-clickable:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- 2. STAGE & RESTE --- */
#stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 0;
    overflow: hidden;
    background-color: transparent;
}

#scaler-container {
    width: 1280px;
    height: 720px;
    position: relative;
    flex-shrink: 0;
    transform-origin: center center;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

iframe#main-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: white;
    transition: filter 0.3s, opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
}

iframe#main-frame.is-loading {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
}

/* CANVAS DESSIN */
#drawing-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

body.drawing-mode #drawing-layer {
    pointer-events: auto;
    cursor: crosshair;
}

body.drawing-mode iframe#main-frame {
    pointer-events: none;
}

body.drawing-mode .btn-icon#btn-draw-toggle {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

#pacing-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 9999;
    pointer-events: none;
}

#pacing-bar {
    height: 100%;
    width: 0;
    transition: all 1s;
}

#top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48px;
    z-index: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.idle #top-bar,
body.header-hidden #top-bar {
    transform: translateY(-100%);
}

body.idle #bottom-bar,
body.header-hidden #bottom-bar {
    transform: translateY(100%);
}

body.idle #sidebar,
body.header-hidden #sidebar {
    transform: translateX(-100%);
}



body.idle {
    cursor: none;
}

#header-trigger {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -100%);
    background: #0f172a;
    padding: 5px 20px;
    border-radius: 0 0 12px 12px;
    cursor: pointer;
    z-index: 6000;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: none;
    transition: transform 0.3s;
}

body.header-hidden #header-trigger {
    transform: translate(-50%, 0);
}

#logo-overlay {
    position: absolute;
    top: 30px;
    right: 40px;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.5s;
    user-select: none;
    -webkit-user-select: none;
    transform-origin: center center;
    animation: occasionalLogoWiggle 12s ease-in-out infinite;
}

@keyframes occasionalLogoWiggle {

    0%,
    90% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }

    92% {
        transform: scale(1.08) rotate(4deg);
        filter: drop-shadow(0 5px 15px rgba(255, 255, 255, 0.4));
    }

    95% {
        transform: scale(1.08) rotate(-4deg);
        filter: drop-shadow(0 5px 15px rgba(255, 255, 255, 0.4));
    }

    98% {
        transform: scale(1.03) rotate(2deg);
        filter: drop-shadow(0 2px 5px rgba(255, 255, 255, 0.2));
    }

    100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    transition: 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.btn-icon:hover {
    background: white;
    color: #0f172a;
    transform: scale(1.1);
}

.btn-icon.active {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: #ef4444;
}

.btn-icon.active:hover {
    background: #ef4444;
    color: white;
}

.input-glass {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    outline: none;
    margin-bottom: 10px;
}

.input-glass:focus {
    border-color: #3b82f6;
    background: rgba(0, 0, 0, 0.6);
}

.btn-text {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
}

.btn-blue {
    background: #2563eb;
    color: white;
}

.btn-blue:hover {
    background: #1d4ed8;
}

.btn-gray {
    background: #334155;
    color: white;
}

.btn-gray:hover {
    background: #475569;
}

.btn-red-outline {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-red-outline:hover {
    background: #ef4444;
    color: white;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-input {
    background: transparent;
    width: 45px;
    text-align: center;
    color: white;
    font-weight: bold;
    outline: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.toc-btn {
    transition: all 0.2s;
    border-left: 3px solid transparent;
    opacity: 0.6;
    cursor: pointer;
}

.toc-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.05);
}

.toc-btn.active {
    background: #2563eb;
    color: white;
    border-left-color: #60a5fa;
    opacity: 1;
    font-weight: bold;
}

.toc-btn.visited:not(.active) {
    opacity: 1;
    color: #e2e8f0;
    border-left-color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.toc-btn.visited:not(.active) .toc-num {
    color: #4ade80;
    font-weight: bold;
}



::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* MENU PARAMETRES DROPDOWN */
#menu-dropdown-wrapper {
    position: relative;
}

.glass-panel {
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@keyframes float-particles {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    50% { opacity: 0.8; }
    100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(168, 85, 247, 0.6);
    animation: float-particles linear infinite;
    bottom: -10px;
    z-index: 1;
}

.menu-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.menu-dropdown.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    display: flex;
    /* Keep flex for transition but hidden via opacity/visibility */
}

.menu-dropdown-title {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: bold;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.menu-dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #f1f5f9;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.menu-dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    color: #cbd5e1;
}

.menu-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.menu-dropdown-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.menu-dropdown-item-orange {
    color: #fb923c;
}

.menu-dropdown-item-orange i {
    color: #fb923c;
}

.menu-dropdown-item-orange:hover {
    background: rgba(251, 146, 60, 0.1);
}