:root {
    --bg-deep: #030307;
    --card-bg: rgba(20, 22, 30, 0.35);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-hover: rgba(0, 240, 255, 0.4);
    --primary-accent: #00f0ff;
    --secondary-accent: #7000ff;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-blur: blur(20px);
    --neon-glow: 0 8px 32px rgba(0, 240, 255, 0.25);
}

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

html { scroll-behavior: smooth; }

body {
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: 'Lato', sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-main);
    line-height: 1.6;
    position: relative;
    padding-bottom: 50px;
}

body::before, body::after {
    content: '';
    position: fixed;
    width: 50vw; height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0; opacity: 0.4;
    pointer-events: none;
    animation: floatOrb 20s infinite alternate ease-in-out;
}

body::before {
    background: radial-gradient(circle, var(--secondary-accent) 0%, transparent 70%);
    top: -20%; left: -10%;
}

body::after {
    background: radial-gradient(circle, var(--primary-accent) 0%, transparent 70%);
    bottom: -20%; right: -10%;
    animation-delay: -10s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.2); }
}

/* Étoiles */
.stars-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none;
}
@keyframes animStar {
    from { transform: translateY(0px); }
    to { transform: translateY(-2000px); }
}
.stars-1, .stars-2, .stars-3 { position: absolute; background: transparent; }
.stars-1 {
    width: 1px; height: 1px;
    box-shadow: 10vw 10vh #fff, 20vw 80vh #fff, 85vw 15vh #fff, 40vw 40vh #fff, 60vw 90vh #fff, 90vw 50vh #fff, 30vw 20vh #fff, 70vw 70vh #fff;
    animation: animStar 50s linear infinite;
}
.stars-2 {
    width: 2px; height: 2px;
    box-shadow: 15vw 15vh #fff, 85vw 85vh #fff, 35vw 65vh #fff, 65vw 35vh #fff, 10vw 90vh #fff, 90vw 10vh #fff;
    animation: animStar 100s linear infinite;
}
.stars-3 {
    width: 3px; height: 3px;
    box-shadow: 5vw 50vh #fff, 95vw 10vh #fff, 50vw 95vh #fff, 30vw 30vh #fff;
    animation: animStar 150s linear infinite;
}

.stars-1::after, .stars-2::after, .stars-3::after {
    content: " "; position: absolute; top: 2000px;
    width: inherit; height: inherit; box-shadow: inherit;
}

h1, h2, h3 { font-family: 'Exo 2', sans-serif; text-transform: uppercase; letter-spacing: 1px; }

main { position: relative; z-index: 1; margin-top: 30px; }

.container { width: 95%; max-width: 1300px; margin: 0 auto; padding: 0 15px; }

/* HEADER */
header {
    background: rgba(3, 3, 7, 0.6);
    backdrop-filter: var(--glass-blur);
    padding: 1rem 0;
    border-bottom: 1px solid var(--card-border);
    position: sticky; top: 0; z-index: 2000;
}
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.logo a {
    font-size: 1.4rem; font-weight: 900; text-decoration: none;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary-accent) 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.controls-quick { display: flex; gap: 10px; }
.btn-small {
    background: rgba(255,255,255,0.05); color: #fff;
    border: 1px solid var(--card-border); border-radius: 8px;
    padding: 6px 15px; cursor: pointer; font-family: 'Exo 2', sans-serif; font-size: 0.8rem;
    transition: 0.3s;
}
.btn-small:hover { border-color: var(--primary-accent); box-shadow: var(--neon-glow); }

/* PANELS & GRIDS (Simulateur) */
.sim-panel {
    background: var(--card-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.sim-panel:hover { border-color: rgba(255, 255, 255, 0.15); }

.sim-grid-layout { display: grid; grid-template-columns: 4fr 8fr; gap: 20px; }
.sim-grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.sim-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.sim-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

@media(max-width: 900px) {
    .sim-grid-layout { grid-template-columns: 1fr; }
    .sim-grid-3 { grid-template-columns: 1fr; }
    .sim-grid-2 { grid-template-columns: 1fr; }
}

/* CONTROLS */
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-group label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: bold; }
.label-flex { display: flex; justify-content: space-between; align-items: center; }

select, input[type="range"] {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--card-border);
    color: white; padding: 8px 12px;
    border-radius: 8px; font-family: inherit; font-size: 0.9rem;
    outline: none; transition: 0.3s;
}
select:focus { border-color: var(--primary-accent); }
select option { background: #111; color: #fff; }

/* SLIDERS */
input[type="range"] { -webkit-appearance: none; height: 6px; padding: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
    background: var(--primary-accent); box-shadow: 0 0 10px var(--primary-accent);
}

.badge, .badge-cyan, .badge-purple {
    font-family: 'Fira Code', monospace; font-size: 0.8rem;
    padding: 2px 8px; border-radius: 4px; font-weight: bold;
}
.badge { background: rgba(112, 0, 255, 0.2); color: var(--secondary-accent); border: 1px solid var(--secondary-accent); }
.badge-cyan { background: rgba(0, 240, 255, 0.1); color: var(--primary-accent); }
.badge-purple { background: rgba(112, 0, 255, 0.1); color: var(--secondary-accent); }

.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-label {
    background: rgba(0,0,0,0.3); padding: 8px; border-radius: 6px; border: 1px solid var(--card-border);
    display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.8rem; color: #ccc; text-transform: none !important;
}
.check-label:hover { border-color: var(--card-border-hover); }

/* CANVAS AREAS */
.canvas-wrapper {
    width: 100%; height: 300px;
    background: radial-gradient(circle at center, #0a0a10 0%, #030307 100%);
    border-radius: 12px; margin-top: 10px; position: relative; overflow: hidden;
}
canvas { width: 100%; height: 100%; display: block; }
.panel-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--card-border); padding-bottom: 10px; }
.panel-header h2 { font-size: 1rem; color: #fff; }
.mono-text { font-family: 'Fira Code', monospace; font-size: 0.85rem; color: var(--text-muted); }
.panel-footer { margin-top: 10px; font-family: 'Fira Code', monospace; font-size: 0.75rem; text-align: right; }
.warning-text { color: #ff8800; }

/* PARSEVAL SECTION */
.flex-col-between { display: flex; flex-direction: column; justify-content: space-between; }
.parseval-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.parseval-header h2 { font-size: 1.2rem; }
.energy-display { text-align: right; }
#energyPercent { font-size: 2rem; font-family: 'Fira Code', monospace; font-weight: 900; color: #00ffaa; text-shadow: 0 0 10px rgba(0,255,170,0.4); display: block; }
.energy-display small { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.math-box {
    background: rgba(0,0,0,0.4); border: 1px solid var(--card-border); padding: 15px;
    border-radius: 12px; text-align: center; color: var(--primary-accent); margin-bottom: 20px; overflow-x: auto;
}

.progress-container { margin-bottom: 20px; }
.progress-labels { display: flex; justify-content: space-between; font-family: 'Fira Code', monospace; font-size: 0.75rem; margin-bottom: 8px; color: #aaa; }
#powerRatioText { color: #00ffaa; font-weight: bold; }
.progress-bar-bg { width: 100%; height: 10px; background: #000; border-radius: 5px; border: 1px solid var(--card-border); overflow: hidden; }
.progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--secondary-accent), var(--primary-accent), #00ffaa); transition: width 0.3s; }

.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.metric-box { background: rgba(0,0,0,0.3); border: 1px solid var(--card-border); padding: 12px; border-radius: 10px; text-align: center; }
.metric-title { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 5px; }
.metric-val { font-family: 'Fira Code', monospace; font-size: 1.2rem; font-weight: bold; }
.cyan { color: var(--primary-accent); }
.purple { color: var(--secondary-accent); }
.red { color: #ff3366; }

/* PÉDAGOGIE */
.theory-toggle {
    background: rgba(112, 0, 255, 0.1); border-bottom: 1px solid rgba(112,0,255,0.3);
    padding: 15px; border-radius: 12px 12px 0 0; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.theory-toggle h2 { font-size: 1.1rem; color: #fff; margin: 0; }
#theoryToggleText { font-size: 0.85rem; color: var(--secondary-accent); font-weight: bold; }
.theory-content { padding: 20px; background: rgba(0,0,0,0.2); border-radius: 0 0 12px 12px; font-size: 0.9rem; color: #ccc; }

.theory-title { font-size: 1rem; border-bottom: 1px solid var(--card-border); padding-bottom: 5px; margin-bottom: 10px; }
.theory-title.primary { color: var(--primary-accent); }
.theory-title.secondary { color: var(--secondary-accent); }
.theory-title.white { color: #fff; }
.theory-title.orange { color: #ff8800; }

.theory-box { background: rgba(0,0,0,0.4); padding: 15px; border-radius: 10px; border: 1px solid var(--card-border); }
.highlight-red { color: #ff3366; font-size: 0.9rem; margin-bottom: 5px; }
.highlight-cyan { color: var(--primary-accent); font-size: 0.9rem; margin-bottom: 5px; }
.highlight-purple { color: var(--secondary-accent); font-size: 0.9rem; margin-bottom: 5px; }
.text-small { font-size: 0.8rem; color: #aaa; }

/* Utilitaires */
.mt-10 { margin-top: 10px; } .mt-15 { margin-top: 15px; } .mt-20 { margin-top: 20px; } .mt-40 { margin-top: 40px; }
.pb-20 { padding-bottom: 20px; }
.border-bottom { border-bottom: 1px solid var(--card-border); }
.hidden { display: none !important; }