
html {
    --bg-color: #f8f9fa;
    --text-color: #2c3e50;
    --container-bg: rgba(255, 255, 255, 0.85);
    --sidebar-bg: rgba(255, 255, 255, 0.7);
    --accent-blue: #2980b9;
    --border-color: rgba(0, 0, 0, 0.1);
    --op-red: 0.35; --op-orange: 0.35; --op-yellow: 0.25;
    --op-green: 0.25; --op-blue: 0.35; --op-purple: 0.35;
}

@media (prefers-color-scheme: dark) {
    html {
        --bg-color: #1a1a2e;
        --text-color: #ffffff;
        --container-bg: rgba(25, 25, 45, 0.65);
        --sidebar-bg: rgba(35, 35, 60, 0.8);
        --accent-blue: #9bf6ff;
        --border-color: rgba(255, 255, 255, 0.15);
        --op-red: 0.45; --op-orange: 0.45; --op-yellow: 0.35;
        --op-green: 0.35; --op-blue: 0.45; --op-purple: 0.45;
    }

    mark {
        background-color: rgba(155, 246, 255, 0.25);
        border-bottom: 1px solid var(--accent-blue);
    }
}






* {
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column; 
    margin: 0;
    padding: 20px;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.5s ease;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(255, 0, 0, var(--op-red)) 0%, transparent 35%),  
        radial-gradient(circle at 85% 25%, rgba(255, 165, 0, var(--op-orange)) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 0, var(--op-yellow)) 0%, transparent 40%),
        radial-gradient(circle at 20% 85%, rgba(0, 128, 0, var(--op-green)) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(0, 0, 255, var(--op-blue)) 0%, transparent 40%),  
        radial-gradient(circle at 50% 10%, rgba(128, 0, 128, var(--op-purple)) 0%, transparent 35%);
    background-attachment: fixed;
    background-size: cover;
    counter-reset: section_lettre;
}

.container {
    width: 100%;
    max-width: 850px;
    margin: 30px auto;
    background: var(--container-bg);
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    transition: background 0.5s ease;
}

.sub-part {
    border-left: 3px solid var(--accent-blue);
    padding-left: 15px;
    margin-bottom: 25px;
}

.concept-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    margin-top: 15px;
    border: 1px solid var(--border-color);
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 40px 0;
}






h1 {text-align: center;font-size: 2.2rem;margin-top: 0;}

h3 {color: var(--accent-blue);}

p {text-align: justify;}

mark {
    background-color: rgba(41, 128, 185, 0.2); 
    color: var(--text-color);
    padding: 2px 5px;
    border-radius: 4px;
}

legend {
    color: var(--accent-blue);
    font-weight: bold;
    font-size: 1.4rem;
    text-align: center;
    display: block;
    margin-bottom: 30px;
}

label {
    display: block;
    font-weight: 600;
    color: var(--accent-blue);
    margin-top: 15px;
}

.small {font-size: 0.9rem;opacity: 0.8;}

.italic {font-style: italic;}

.note-source {
font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-color);
  opacity: 0.8;
  margin-top: 10px;
  display: block; 
}

.note-source p {margin-bottom: 1px; }





table {
  width: 100%;
  border-collapse: collapse; 
  border: 1px solid black;
}

td, th {
  text-align: justify;
  border: 1px solid black;
}

td {
  width: 25%; 
  padding: 10px;
}

figure img {
    display: block;
    margin: 0 auto;
    width: 600px;
    max-width: 100%;
}

.audio-container {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 5px 0;
}

audio {
    width: 100%; 
    height: 30px; 
    border-radius: 5px;
}






.Sommaire, .Lien-utile {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 180px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    z-index: 100;
}

.Sommaire {left: 20px;}
.Lien-utile {right: 20px;}

.nav-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    color: var(--accent-blue);
}

.texte-sommaire {
    font-size: 0.7rem; 
    text-align: center;
    margin-bottom: 8px;
    opacity: 0.9;
    line-height: 1.2;
}

.Sommaire ul, .Lien-utile ul{
    list-style: none;
    padding: 0;
    margin: 0;
}

.Sommaire li, .Lien-utile li{
    margin-bottom: 10px;
}



.Sommaire a, .Lien-utile a{
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    transition: 0.3s;
}

.Sommaire a:hover {color: var(--accent-blue);padding-left: 5px;}

.Lien-utile a:hover {color: var(--accent-blue);padding-right: 5px;}

.nav-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 15px 0;
}



.theme-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.theme-btn:hover {
    background: var(--accent-blue);
    color: #1a1a2e;
}

.submit-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background: linear-gradient(to right, #a0c4ff, #9bf6ff);
    color: #1a1a2e;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 30px;
    transition: 0.3s;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(155, 246, 255, 0.4);
}



h3::before {
    counter-increment: section_lettre;
    content: counter(section_lettre, upper-alpha) ". ";
}







@media (max-width: 1150px) {
    .Sommaire, .Lien-utile{ 
        position: relative !important; 
        top: 0 !important;
        left: 0 !important;
        transform: none !important;
        width: 95%;
        margin: 0 auto 20px auto; 
        display: block;
        height: auto;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        order: -1; 
    }

    .Sommaire ul, .Lien-utile ul{
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .Sommaire li, .Lien-utile li{margin: 5px;list-style: none;}
    
    .container { 
        width: 95%; 
        padding: 15px;
        margin: 10px auto;
        order: 1; 
    }

    figure img, canvas {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

    .note-source {
        line-height: 1.5 !important;
        font-size: 0.85rem;
    }
}





@media print {

    .Sommaire, 
    .Lien-utile
    .submit-btn, 
    .audio-container, 
    .texte-sommaire,
    #theme-toggle,
    nav, button
    {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    main, section, .question{
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
    }


.container {
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }
    
    table {
        width: 99% !important;
        border-collapse: collapse !important;
        table-layout: auto !important; 
        margin: 20px 0 !important;
        page-break-inside: auto !important;
    }

    th, td {
        border: 1pt solid black !important;
        padding: 8px !important;
        text-align: left !important;
        overflow: visible !important;
    }

    tr{
        page-break-inside: avoid !important;
    }

    figure, .canvas, canvas {
        display: block !important;
        margin: 30px auto !important;
        text-align: center !important;
        width: 100% !important;
        page-break-inside: avoid !important;
        max-width: 500px !important;
    }

    figure img {
        display: block !important;
        margin: 0 auto !important;
        width: 100%; 
        max-width: 600px; 
        height: auto !important;
    }

    canvas {
    width: 100% !important;
    height: auto !important;
    min-height: 250px;
}

    section {
        page-break-inside: auto !important;
        break-inside: auto !important;
        margin-bottom: 30px !important;
    }
    
    h2, h3 {
        page-break-after: avoid !important;
        break-after: avoid !important;
        color: black !important;
    }

    a {text-decoration: none;color: black !important;}
}