@import url('../../../_SharedResources/theme_global.css');

/* ==========================================================================
   SIMULATEUR �?" TITRAGE DIRECT PAR �?QUIVALENCE
   Charte Clemente : glassmorphism sombre, or, vert néon, corail.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Palettes de thèmes �?" clé partagée 'site-theme' avec la page d'accueil.
   Le thème par défaut de ce simulateur est « doré ».
   -------------------------------------------------------------------------- */
:root,
:root[data-theme="dore"] {
    --accent-rgb: 255, 209, 102;
    --accent-2-rgb: 232, 150, 30;
    --accent-color: #ffd166;
    --bg-dark: #0a0803;
    --bg-deep: #080602;
    --panel-bg-1: rgba(28, 21, 9, 0.86);
    --panel-bg-2: rgba(10, 7, 2, 0.94);
    --banner-bg: rgba(20, 15, 6, 0.95);
    --menu-bg: rgba(20, 15, 6, 0.99);
    --input-bg: rgba(20, 15, 6, 0.92);
    --input-border: rgba(var(--accent-rgb), 0.55);
    --text: #f6edda;
    --muted: #c9b896;
    --line: rgba(255, 255, 255, 0.10);
    --canvas-bg: #060d19;
    --projection: 0;
}

:root[data-theme="bleu"] {
    --accent-rgb: 0, 229, 255;
    --accent-2-rgb: 0, 119, 255;
    --accent-color: #00e5ff;
    --bg-dark: #050a14;
    --bg-deep: #070d1b;
    --panel-bg-1: rgba(10, 20, 40, 0.90);
    --panel-bg-2: rgba(5, 13, 28, 0.96);
    --banner-bg: rgba(8, 18, 36, 0.95);
    --menu-bg: rgba(8, 18, 36, 0.99);
    --input-bg: rgba(5, 15, 32, 0.94);
    --input-border: rgba(var(--accent-rgb), 0.55);
    --text: #eaeaea;
    --muted: #a5b4c8;
    --line: rgba(255, 255, 255, 0.10);
    --canvas-bg: #060d19;
}

:root[data-theme="emeraude"] {
    --accent-rgb: 52, 211, 153;
    --accent-2-rgb: 5, 150, 105;
    --accent-color: #34d399;
    --bg-dark: #04110c;
    --bg-deep: #06170f;
    --panel-bg-1: rgba(8, 28, 20, 0.88);
    --panel-bg-2: rgba(3, 16, 11, 0.95);
    --banner-bg: rgba(7, 26, 18, 0.95);
    --menu-bg: rgba(7, 26, 18, 0.99);
    --input-bg: rgba(4, 22, 15, 0.94);
    --input-border: rgba(var(--accent-rgb), 0.55);
    --text: #e6fff5;
    --muted: #a4c9bb;
    --line: rgba(255, 255, 255, 0.10);
    --canvas-bg: #06130e;
}

:root[data-theme="violet"] {
    --accent-rgb: 192, 132, 252;
    --accent-2-rgb: 124, 58, 237;
    --accent-color: #c084fc;
    --bg-dark: #0a0617;
    --bg-deep: #0d081c;
    --panel-bg-1: rgba(24, 16, 40, 0.88);
    --panel-bg-2: rgba(10, 6, 23, 0.95);
    --banner-bg: rgba(22, 14, 38, 0.95);
    --menu-bg: rgba(22, 14, 38, 0.99);
    --input-bg: rgba(18, 10, 32, 0.94);
    --input-border: rgba(var(--accent-rgb), 0.55);
    --text: #f1e9ff;
    --muted: #c0b0d8;
    --line: rgba(255, 255, 255, 0.10);
    --canvas-bg: #0a0714;
}

:root[data-theme="rose"] {
    --accent-rgb: 251, 113, 133;
    --accent-2-rgb: 225, 29, 72;
    --accent-color: #fb7185;
    --bg-dark: #14060a;
    --bg-deep: #1a070c;
    --panel-bg-1: rgba(40, 14, 22, 0.88);
    --panel-bg-2: rgba(20, 6, 10, 0.95);
    --banner-bg: rgba(38, 13, 21, 0.95);
    --menu-bg: rgba(38, 13, 21, 0.99);
    --input-bg: rgba(34, 10, 18, 0.94);
    --input-border: rgba(var(--accent-rgb), 0.55);
    --text: #ffecef;
    --muted: #d8b0ba;
    --line: rgba(255, 255, 255, 0.10);
    --canvas-bg: #13070b;
}

:root[data-theme="projection"] {
    --accent-rgb: 0, 92, 184;
    --accent-2-rgb: 0, 64, 128;
    --accent-color: #005cb8;
    --bg-dark: #f1f5f9;
    --bg-deep: #e2e8f0;
    --panel-bg-1: rgba(255, 255, 255, 0.97);
    --panel-bg-2: rgba(240, 245, 250, 0.98);
    --banner-bg: rgba(222, 234, 247, 0.98);
    --menu-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: rgba(0, 92, 184, 0.45);
    --text: #16202e;
    --muted: #46586c;
    --line: rgba(0, 60, 120, 0.16);
    --canvas-bg: #ffffff;
    --projection: 1;
    color-scheme: light;
}

:root {
    --panel: linear-gradient(145deg, var(--panel-bg-1), var(--panel-bg-2));
    --panel-soft: var(--panel-bg-1);
    --gold: var(--accent-color);
    --gold-soft: rgba(var(--accent-rgb), 0.16);
    --gold-line: rgba(var(--accent-rgb), 0.32);
    --cyan: var(--accent-color);
    --cyan-soft: rgba(var(--accent-rgb), 0.14);
    --green: #64ff96;
    --green-soft: rgba(100, 255, 150, 0.14);
    --red: #ff7675;
    --red-soft: rgba(255, 118, 117, 0.14);
    --radius: 12px;
}

* { box-sizing: border-box; }

html {
    font-size: clamp(13px, 1.2vw + 0.1rem, 16px);
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(ellipse at 12% 18%, rgba(var(--accent-rgb), 0.18) 0%, transparent 45%),
        radial-gradient(ellipse at 86% 78%, rgba(var(--accent-2-rgb), 0.16) 0%, transparent 48%),
        radial-gradient(ellipse at 50% 120%, rgba(var(--accent-rgb), 0.08) 0%, transparent 55%),
        radial-gradient(1.5px 1.5px at 14% 22%, rgba(255, 255, 255, 0.55), transparent),
        radial-gradient(1.5px 1.5px at 72% 14%, rgba(var(--accent-rgb), 0.45), transparent),
        radial-gradient(1px 1px at 38% 76%, rgba(255, 255, 255, 0.28), transparent);
    background-size: cover;
    background-attachment: fixed;
    user-select: text;
    -webkit-user-select: text;
}

button, .mode-btn, .qcm-option, .toggle-pill, .home-btn {
    user-select: none;
    -webkit-user-select: none;
}

button { font-family: inherit; }

/* ==========================================================================
   BANDEAU
   ========================================================================== */

#banner {
    width: 100%;
    min-height: 62px;
    padding: 8px clamp(10px, 1.4vw, 18px);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(7, 14, 28, 0.94);
    border-bottom: 1px solid var(--gold-line);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.48);
    flex-shrink: 0;
    position: relative;
    z-index: 200;
}

.banner-left {
    display: flex;
    flex-direction: column;
    min-width: 220px;
    flex: 1 1 320px;
}

#main_title {
    margin: 0;
    font-size: clamp(0.98rem, 1.6vw, 1.24rem);
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--gold);
    text-shadow: 0 0 14px rgba(var(--accent-rgb), 0.28);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sub_title {
    margin-top: 2px;
    font-size: clamp(0.70rem, 1vw, 0.82rem);
    color: #c9d6e8;
    white-space: normal;
    overflow: visible;
}

.banner-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    position: relative;
}

.mode-btn {
    background: rgba(18, 34, 62, 0.82);
    border: 1px solid var(--gold-line);
    color: var(--text);
    padding: 7px 11px;
    border-radius: 18px;
    font-size: clamp(0.72rem, 0.85vw, 0.82rem);
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.mode-btn:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(var(--accent-rgb), 0.14);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.24);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.26), rgba(255, 170, 0, 0.12));
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.3);
}

.mode-btn.locked,
.mode-btn:disabled {
    opacity: 0.42 !important;
    filter: grayscale(0.9);
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

/* Boutons outils du bandeau : bilan, th�me */
.tool-btn {
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid var(--gold-line);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 18px;
    font-size: clamp(0.70rem, 0.82vw, 0.80rem);
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.tool-btn:hover {
    border-color: var(--gold);
    background: rgba(var(--accent-rgb), 0.16);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.24);
}

.tool-btn.active {
    background: rgba(var(--accent-rgb), 0.18);
    border-color: var(--gold);
    color: var(--gold);
}

.theme-dropdown { position: relative; display: inline-block; }

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex: none;
    background: linear-gradient(135deg, var(--dot-1), var(--dot-2));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.theme-menu {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    min-width: 184px;
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border-radius: 10px;
    background: var(--menu-bg);
    border: 1px solid var(--gold);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    z-index: 600;
}

.theme-menu.show { display: flex; }

.theme-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease;
}

.theme-option:hover { background: rgba(var(--accent-rgb), 0.15); }
.theme-option.is-active { color: var(--gold); }
.theme-option.is-active::after { content: '✓'; margin-left: auto; }

.bilan-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.bilan-eye {
    border: 1px solid var(--gold-line);
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--muted);
    border-radius: 6px;
    padding: 3px 7px;
    font-size: 0.68rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.bilan-eye:hover { color: var(--gold); border-color: var(--gold); }

#conteneur_simulation.bilan-hidden {
    grid-template-columns: minmax(0, 1fr);
}

#conteneur_simulation.bilan-hidden .right-column {
    display: none;
}

.home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    border: 1px solid var(--gold-line);
    background: rgba(15, 30, 55, 0.85);
    color: var(--gold);
    text-decoration: none;
    font-size: 1.08rem;
    transition: all 0.2s ease;
}

.home-btn:hover {
    background: rgba(var(--accent-rgb), 0.18);
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.35);
    transform: translateY(-1px);
}

.banner-score {
    flex-shrink: 0;
    margin-left: auto;
}

#score-display {
    display: inline-block;
    padding: 7px 12px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(var(--accent-rgb), 0.46);
    color: var(--gold);
    font-size: clamp(0.78rem, 0.95vw, 0.88rem);
    font-weight: 800;
    white-space: nowrap;
    box-shadow: inset 0 0 10px rgba(var(--accent-rgb), 0.08);
    transition: all 0.25s ease;
}

#score-display.success {
    color: var(--green);
    border-color: rgba(100, 255, 150, 0.55);
    background: rgba(30, 80, 50, 0.30);
    box-shadow: 0 0 14px rgba(100, 255, 150, 0.25);
}

/* Menu déroulant chrono */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    min-width: 220px;
    padding: 6px;
    background: rgba(8, 18, 36, 0.98);
    border: 1px solid var(--gold);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65), 0 0 18px rgba(var(--accent-rgb), 0.15);
    z-index: 500;
    flex-direction: column;
    gap: 4px;
}

.dropdown-menu.show { display: flex; }

.dropdown-item {
    border: 0;
    background: transparent;
    color: #e7edf7;
    padding: 9px 11px;
    text-align: left;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.dropdown-item:hover {
    background: rgba(var(--accent-rgb), 0.16);
    color: var(--gold);
    padding-left: 15px;
}

.caret { font-size: 0.72rem; opacity: 0.8; }

/* ==========================================================================
   JAUGE CHRONO
   ========================================================================== */

#chrono-bar-container {
    display: none;
    position: relative;
    width: calc(100% - 28px);
    max-width: 1200px;
    height: 34px;
    margin: 8px auto 0;
    background: rgba(10, 22, 42, 0.92);
    border: 1px solid var(--gold-line);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
}

#chrono-bar-container.show { display: block; }

#chrono-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    width: 100%;
    transition: width 0.12s linear;
}

#chrono-bar-fill.fill-timeattack { background: linear-gradient(90deg, rgba(243, 156, 18, 0.92), rgba(46, 204, 113, 0.92)); }
#chrono-bar-fill.fill-speedrun { background: linear-gradient(90deg, rgba(52, 152, 219, 0.92), rgba(155, 89, 182, 0.92)); }
#chrono-bar-fill.fill-survival { background: linear-gradient(90deg, rgba(231, 76, 60, 0.92), rgba(243, 156, 18, 0.92)); }

#chrono-bar-content {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

#chrono-bar-timer,
#chrono-bar-score {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 5px;
    padding: 2px 9px;
    white-space: nowrap;
}

/* ==========================================================================
   DISPOSITION G�?N�?RALE
   ========================================================================== */

#conteneur_simulation {
    width: 100%;
    max-width: 1560px;
    margin: 0 auto;
    padding: 13px 14px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 14px;
    flex: 1 1 auto;
    min-height: 0;
}

.left-column {
    display: flex;
    flex-direction: column;
    gap: 13px;
    min-width: 0;
    min-height: 0;
}

.right-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

/* En mode Chrono, on masque le bilan : l'épreuve doit rester hermétique. */
#conteneur_simulation.chrono-active {
    grid-template-columns: minmax(0, 1fr);
}

#conteneur_simulation.chrono-active .right-column {
    display: none;
}

.fenetre-contenu {
    background: var(--panel);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.46), inset 0 0 18px rgba(0, 0, 0, 0.22);
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#fenetre-canvas {
    flex: 0 0 auto;
}

#fenetre-controles {
    flex: 1 1 auto;
    overflow: hidden;
    position: relative;
}

#fenetre-informations {
    height: 100%;
    overflow: hidden;
}

.fenetre_titre {
    color: var(--gold);
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.15px;
    text-shadow: 0 0 10px rgba(var(--accent-rgb), 0.16);
}

/* ==========================================================================
   CANVAS
   ========================================================================== */

.canvas-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
    flex-shrink: 0;
}

.canvas-header .fenetre_titre {
    flex: 1 1 auto;
    min-width: 160px;
    text-align: left;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.phase-badge,
.mode-badge,
.score-badge,
.bilan-progress {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 800;
    white-space: nowrap;
}

.phase-badge {
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.12);
    border: 1px solid rgba(var(--accent-rgb), 0.40);
}

.canvas-toggle {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.toggle-pill {
    border: 1px solid rgba(var(--accent-rgb), 0.34);
    background: rgba(12, 26, 48, 0.85);
    color: #cbd7e7;
    border-radius: 7px;
    padding: 5px 9px;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-pill:hover { border-color: var(--gold); color: var(--gold); }
.toggle-pill.active {
    background: rgba(var(--accent-rgb), 0.18);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.25);
}

.canvas-split {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    min-width: 0;
    min-height: 0;
}

.canvas-split .canvas-container {
    flex: 1 1 0;
    min-width: 0;
}

.canvas-split.view-main #advancement-container { display: none !important; }
.canvas-split.view-main #canvas-container { flex: 1 1 100%; }

.canvas-split.view-split #canvas-container { flex: 0 0 56%; }
.canvas-split.view-split #advancement-container { display: block; flex: 1 1 44%; }

.canvas-split.view-table #canvas-container { display: none; }
.canvas-split.view-table #advancement-container { display: block; flex: 1 1 100%; }

.canvas-container {
    position: relative;
    width: 100%;
    height: clamp(225px, 34vh, 320px);
    min-height: 210px;
    border-radius: 9px;
    overflow: hidden;
    background: #060d19;
    border: 1px solid rgba(var(--accent-rgb), 0.16);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.55);
}

#advancement-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.advancement-container {
    background: #060d19;
}

/* Vue « deux colonnes » quand le bilan est masqué : canvas à gauche, questions à droite.
   C'est la disposition par défaut dès qu'il y a assez de largeur (tablette paysage
   et au-delà). En dessous de 900 px, on empile verticalement (voir plus bas). */
#conteneur_simulation.bilan-hidden .left-column {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.6fr);
    grid-template-rows: minmax(0, 1fr);
    gap: 13px;
    align-items: stretch;
    min-height: 0;
}

#conteneur_simulation.bilan-hidden #fenetre-canvas,
#conteneur_simulation.bilan-hidden #fenetre-controles {
    height: 100%;
    min-height: 0;
}

#conteneur_simulation.bilan-hidden #canvas-split {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
}

#conteneur_simulation.bilan-hidden .canvas-split .canvas-container {
    height: 100%;
    min-height: 180px;
}

#lab-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Vue « équation » : le canvas peut être plus compact pour laisser
   toute la place aux quatre propositions QCM. */
.canvas-container.compact {
    height: clamp(185px, 25vh, 265px);
    min-height: 180px;
}

/* Mode Libre : un canvas un peu plus compact laisse toute la place
   aux curseurs et au tableau de bord des calculs. */
.canvas-container.free-canvas {
    height: clamp(200px, 27vh, 290px);
    min-height: 195px;
}

/* ==========================================================================
   FEN�STRE CONTR�"LES
   ========================================================================== */

.ctrl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
    flex-shrink: 0;
}

.ctrl-header .fenetre_titre,
.bilan-header .fenetre_titre {
    text-align: left;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.ctrl-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mode-badge {
    color: var(--cyan);
    background: var(--cyan-soft);
    border: 1px solid rgba(var(--accent-rgb), 0.42);
}

.score-badge {
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.11);
    border: 1px solid rgba(var(--accent-rgb), 0.40);
}

.score-badge.success {
    color: var(--green);
    background: rgba(100, 255, 150, 0.10);
    border-color: rgba(100, 255, 150, 0.45);
}

#controls-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.35) rgba(0, 0, 0, 0.2);
}

#controls-body::-webkit-scrollbar { width: 9px; }
#controls-body::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.55);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}
#controls-body::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.18); }

.question-box {
    font-size: 0.84rem;
    line-height: 1.36;
    color: #e9eef7;
    background: rgba(0, 0, 0, 0.28);
    border-left: 3px solid var(--gold);
    border-radius: 8px;
    padding: 7px 9px;
    margin-bottom: 5px;
}

.question-box strong { color: var(--gold); }
.question-box em { color: #d8e6ff; }
.question-box .q-meta {
    display: block;
    margin-top: 5px;
    font-size: 0.76rem;
    color: var(--muted);
    font-style: normal;
}

.q-intro {
    display: block;
    margin-bottom: 7px;
    padding: 7px 9px;
    border-radius: 7px;
    background: rgba(var(--accent-rgb), 0.07);
    border-left: 3px solid var(--gold);
    color: var(--text);
    line-height: 1.4;
}

.data-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
    gap: 5px;
    margin: 7px 0;
    padding: 7px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.data-label {
    font-size: 0.66rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-value {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--gold);
    overflow-wrap: anywhere;
}

.equation-inline {
    display: block;
    margin: 6px 0 2px;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    color: #d9feff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.84rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: nowrap;
}

/* QCM */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 5px;
}

.qcm-option {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(8, 22, 44, 0.78);
    color: #e7eef9;
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 0.76rem;
    line-height: 1.25;
    cursor: pointer;
    transition: all 0.18s ease;
}

.qcm-option:hover:not(:disabled) {
    border-color: var(--gold);
    background: rgba(30, 54, 88, 0.88);
    transform: translateX(2px);
}

.qcm-option.selected {
    border: 2px solid var(--gold);
    background: rgba(var(--accent-rgb), 0.12);
    color: #fff;
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.22);
    font-weight: 700;
}

.qcm-option.correct {
    border: 2px solid var(--green);
    background: rgba(46, 204, 113, 0.20);
    color: #eafff2;
    font-weight: 700;
    box-shadow: 0 0 14px rgba(100, 255, 150, 0.24);
}

.qcm-option.wrong {
    border: 2px solid var(--red);
    background: rgba(231, 76, 60, 0.20);
    color: #ffeceb;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(255, 118, 117, 0.22);
}

.qcm-option:disabled { cursor: default; }

/* Saisie numérique */
.numeric-container {
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(var(--accent-rgb), 0.30);
    border-radius: 8px;
    padding: 9px 10px;
}

.numeric-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.numeric-prefix,
.numeric-unit {
    color: var(--gold);
    font-weight: 800;
    font-size: 0.94rem;
    white-space: nowrap;
}

.numeric-unit { color: var(--green); font-size: 0.80rem; }

#numeric-input {
    flex: 1 1 130px;
    min-width: 100px;
    padding: 9px 10px;
    border-radius: 7px;
    border: 1px solid rgba(var(--accent-rgb), 0.55);
    background: rgba(5, 15, 32, 0.94);
    color: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.02rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
}

#numeric-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.28);
}

#numeric-input::placeholder { color: #77849a; font-weight: 400; }

.numeric-hint {
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--muted);
    font-style: italic;
    text-align: center;
}

/* Mode interactif : verser à l'équivalence */
.interactive-container {
    margin-bottom: 8px;
    background: rgba(0, 18, 36, 0.62);
    border: 1px solid rgba(var(--accent-rgb), 0.30);
    border-radius: 8px;
    padding: 9px 10px;
}

.interactive-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.interactive-tools {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.interactive-status {
    font-size: 0.80rem;
    font-weight: 700;
    color: #d9f5ff;
}

.interactive-status.turned {
    color: var(--green);
    text-shadow: 0 0 10px rgba(100, 255, 150, 0.35);
}

.interactive-volume {
    font-family: 'Courier New', Courier, monospace;
    color: var(--gold);
    font-weight: 800;
    font-size: 0.86rem;
    white-space: nowrap;
}

.interactive-actions,
.free-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.tap-hint {
    margin: 6px 0 2px;
    font-size: 0.74rem;
    line-height: 1.35;
    color: #cfe6f8;
}

.tap-btn {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.22), rgba(var(--accent-rgb), 0.08));
    border-color: var(--gold);
    color: var(--gold);
    font-weight: 900;
    min-height: 38px;
    white-space: nowrap;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tap-btn.active,
.tap-btn:active {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.40), rgba(46, 204, 113, 0.22));
    border-color: var(--green);
    color: #eafff2;
    box-shadow: 0 0 16px rgba(39, 174, 96, 0.45);
}

.free-volume-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    margin-top: 7px;
    padding: 7px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.20);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
}

/* Ligne supérieure : volume + bouton de maintien. Le bouton garde sa place
   même quand le volume affiché passe de « 9,9 » à « 10,0 » mL. */
.free-volume-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

.free-volume-label {
    font-size: 0.76rem;
    color: var(--muted);
    margin-right: 0;
    min-width: 0;
    white-space: nowrap;
}

.free-volume-label strong {
    display: inline-block;
    min-width: 4.4em;
    text-align: left;
    color: var(--gold);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.86rem;
}

.free-volume-main .tap-btn {
    flex: 0 0 auto;
    margin-left: auto;
}

.free-volume-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.advancement-table {
    margin-top: 7px;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    background: rgba(0, 0, 0, 0.24);
}

.advancement-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.advancement-table th,
.advancement-table td {
    padding: 5px 7px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.advancement-table th {
    color: var(--gold);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(var(--accent-rgb), 0.07);
}

.advancement-table td {
    color: var(--text);
}

.advancement-table tr:last-child td {
    border-bottom: none;
}

.adv-status {
    padding: 5px 8px;
    font-size: 0.70rem;
    font-weight: 700;
}

.adv-status.before { color: #9ed8ff; }
.adv-status.at { color: #64ff96; }
.adv-status.after { color: #ffb3e1; }

.mini-btn {
    border: 1px solid rgba(var(--accent-rgb), 0.32);
    background: rgba(12, 26, 48, 0.86);
    color: #dce8f8;
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
    min-height: 32px;
}

.mini-btn:hover:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.11);
}

.mini-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.mini-btn.danger {
    border-color: rgba(255, 118, 117, 0.42);
    color: #ffb3b2;
}

.mini-btn.danger:hover {
    border-color: var(--red);
    color: #fff;
    background: rgba(231, 76, 60, 0.24);
}

/* Sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 7px;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.36);
    background: linear-gradient(90deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.18));
    outline: none;
    cursor: pointer;
    margin: 7px 0;
}

input[type="range"]:hover {
    border-color: rgba(var(--accent-rgb), 0.62);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe066, #f39c12);
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.75);
    cursor: pointer;
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.16); }

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe066, #f39c12);
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.75);
    cursor: pointer;
}

/* Mode libre */
.free-controls { margin-bottom: 8px; }

.free-intro {
    font-size: 0.78rem;
    line-height: 1.38;
    color: #d9e6f7;
    background: rgba(var(--accent-rgb), 0.07);
    border-left: 3px solid var(--cyan);
    border-radius: 7px;
    padding: 7px 9px;
    margin-bottom: 8px;
}

.free-system-row {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    padding: 6px 8px;
    margin-bottom: 8px;
}

.free-system-row label {
    font-size: 0.76rem;
    color: var(--gold);
    font-weight: 800;
}

#free-system {
    flex: 1 1 220px;
    min-width: 0;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgba(var(--accent-rgb), 0.38);
    background: #08162d;
    color: #fff;
    font-size: 0.76rem;
    outline: none;
}

.free-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 13px;
    margin-bottom: 2px;
}

.slider-group { min-width: 0; }

.slider-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
    font-size: 0.70rem;
    color: #b7c6da;
    line-height: 1.25;
}

.slider-group label .slider-label {
    color: #b7c6da;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slider-group label .slider-value {
    color: var(--gold);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}

.free-readout {
    font-size: 0.76rem;
    line-height: 1.55;
    color: #dbe8f9;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(var(--accent-rgb), 0.22);
    border-radius: 7px;
    padding: 8px 9px;
    margin-top: 7px;
}

.free-readout .ro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 10px;
}

.free-readout .ro-item { white-space: normal; }

.free-readout .ro-label { color: var(--muted); }

.free-readout .ro-value {
    color: var(--gold);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 800;
}

.free-readout .ro-status {
    display: block;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    font-weight: 800;
}

.free-readout .ro-status.before { color: #9ed8ff; }
.free-readout .ro-status.at { color: var(--green); }
.free-readout .ro-status.after { color: #ffb3e1; }

/* Feedback */
.feedback-msg {
    min-height: 20px;
    margin-top: 2px;
    padding: 0 2px;
    font-size: 0.82rem;
    line-height: 1.38;
    font-weight: 700;
    text-align: left;
}

.feedback-msg.success { color: var(--green); }
.feedback-msg.error { color: var(--red); }
.feedback-msg.warning { color: #ffd166; }
.feedback-msg.info { color: #9ed8ff; }

.feedback-msg .penalty {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 118, 117, 0.16);
    border: 1px solid rgba(255, 118, 117, 0.34);
    color: #ffb3b2;
    font-size: 0.70rem;
    white-space: nowrap;
}

/* Actions */
.action-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 6px;
    margin-top: 2px;
    border-top: 1px solid rgba(var(--accent-rgb), 0.16);
    flex-shrink: 0;
}

.premium-btn {
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 8px;
    padding: 8px 17px;
    font-size: 0.80rem;
    font-weight: 900;
    letter-spacing: 0.55px;
    text-transform: uppercase;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.24);
    min-height: 36px;
}

.premium-btn.success {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #64ff96;
}

.premium-btn.primary {
    background: linear-gradient(135deg, #2980b9, #3498db);
    border-color: #74b9ff;
}

.premium-btn.danger {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    border-color: #ff7675;
}

.premium-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 7px 18px rgba(0, 0, 0, 0.5), 0 0 16px rgba(var(--accent-rgb), 0.20);
    border-color: var(--gold);
}

.premium-btn:active:not(:disabled) { transform: translateY(0); }

.premium-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    filter: grayscale(0.7);
}

.combo-badge {
    position: absolute;
    right: 24px;
    bottom: 66px;
    padding: 6px 12px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 118, 117, 0.92), rgba(243, 156, 18, 0.92));
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    box-shadow: 0 0 20px rgba(255, 118, 117, 0.55);
    pointer-events: none;
    z-index: 20;
    animation: comboPulse 0.7s ease-in-out infinite alternate;
}

@keyframes comboPulse {
    from { transform: scale(1); }
    to { transform: scale(1.07); }
}

/* ==========================================================================
   BILAN
   ========================================================================== */

.bilan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(var(--accent-rgb), 0.22);
    flex-shrink: 0;
}

.bilan-progress {
    color: var(--green);
    background: rgba(100, 255, 150, 0.11);
    border: 1px solid rgba(100, 255, 150, 0.34);
    font-family: 'Courier New', Courier, monospace;
}

.bilan-cards {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 3px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.35) rgba(0, 0, 0, 0.2);
}

.bilan-cards::-webkit-scrollbar { width: 9px; }
.bilan-cards::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.55);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}
.bilan-cards::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.18); }

.bilan-card {
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 9px;
    background: rgba(5, 15, 32, 0.56);
    padding: 9px 10px;
    transition: all 0.25s ease;
    position: relative;
}

.bilan-card h3 {
    margin: 0 0 5px;
    font-size: 0.82rem;
    line-height: 1.25;
    color: #e6eefb;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
}

.bilan-card h3 .card-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    background: rgba(var(--accent-rgb), 0.14);
    border: 1px solid rgba(var(--accent-rgb), 0.34);
    color: var(--gold);
    font-size: 0.68rem;
    font-weight: 900;
}

.bilan-card .card-tag {
    display: inline-block;
    margin-left: auto;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 0.62rem;
    font-weight: 900;
    white-space: nowrap;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.bilan-card .card-tag.active-tag {
    color: var(--gold);
    background: rgba(var(--accent-rgb), 0.14);
    border: 1px solid rgba(var(--accent-rgb), 0.38);
}

.bilan-card .card-tag.done-tag {
    color: var(--green);
    background: rgba(100, 255, 150, 0.10);
    border: 1px solid rgba(100, 255, 150, 0.30);
}

.bilan-card p {
    margin: 3px 0;
    font-size: 0.72rem;
    line-height: 1.42;
    color: #c7d5e8;
}

.bilan-card p:last-child { margin-bottom: 0; }
.bilan-card strong { color: #fff; }
.bilan-card .hl { color: var(--gold); font-weight: 800; }
.bilan-card .green { color: var(--green); font-weight: 800; }
.bilan-card .muted { color: var(--muted); }

.bilan-card.active {
    border: 2px solid var(--gold);
    background: linear-gradient(145deg, rgba(34, 48, 48, 0.78), rgba(12, 24, 32, 0.86));
    box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.24), inset 0 0 14px rgba(var(--accent-rgb), 0.05);
}

.bilan-card.completed {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(5, 15, 32, 0.56);
}

.bilan-card.future {
    opacity: 0.48;
    filter: grayscale(0.4);
}

.bilan-card.preview {
    border-style: dashed;
}

.formula-box {
    margin: 5px 0;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.30);
    border-left: 2px solid var(--cyan);
    color: #dffbff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    overflow-x: auto;
}

.formula-box.gold { border-left-color: var(--gold); color: #fff4c6; }
.formula-box.green { border-left-color: var(--green); color: #dfffee; }

.calc-steps {
    margin: 5px 0 0;
    padding-left: 16px;
    font-size: 0.70rem;
    line-height: 1.48;
    color: #cbd9ec;
}

.calc-steps li { margin-bottom: 2px; }

.bilan-empty {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    font-style: italic;
    padding: 18px 8px;
}

/* ==========================================================================
   MODALE / F�?LICITATIONS
   ========================================================================== */

.wow-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 8, 18, 0.90);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 14px;
}

.wow-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wow-card {
    position: relative;
    z-index: 1;
    width: min(92vw, 560px);
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid var(--gold);
    border-radius: 16px;
    background: linear-gradient(145deg, rgba(17, 34, 62, 0.98), rgba(5, 12, 26, 0.99));
    box-shadow: 0 0 42px rgba(var(--accent-rgb), 0.30), 0 20px 60px rgba(0, 0, 0, 0.85);
    padding: 24px 22px;
    text-align: center;
    transform: scale(0.88);
    transition: transform 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wow-overlay.show .wow-card { transform: scale(1); }

.wow-icon { font-size: 3rem; line-height: 1; margin-bottom: 6px; filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), 0.5)); }
.wow-title { font-size: 1.45rem; color: var(--gold); margin: 0 0 7px; font-weight: 900; }
.wow-subtitle { font-size: 0.86rem; line-height: 1.5; color: #d8e5f5; margin: 0 0 14px; }

.wow-score {
    display: inline-block;
    margin: 0 0 14px;
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid rgba(100, 255, 150, 0.45);
    background: rgba(46, 204, 113, 0.13);
    color: var(--green);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.18rem;
    font-weight: 900;
}

.wow-details {
    text-align: left;
    background: rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 9px;
    padding: 10px 12px;
    margin: 0 0 16px;
    font-size: 0.78rem;
    line-height: 1.55;
    color: #cfddef;
}

.wow-details .row { display: flex; justify-content: space-between; gap: 10px; }
.wow-details .row strong { color: var(--gold); }
.wow-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.wow-btn {
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 900;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #2980b9, #3498db);
    transition: all 0.2s ease;
    min-height: 40px;
}

.wow-btn.gold {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    border-color: var(--accent-color);
    color: #221800;
}

.wow-btn.green {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #64ff96;
}

.wow-btn:hover { transform: translateY(-1px); box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.28); }

#celebration-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    display: none;
}

#celebration-canvas.show { display: block; }

/* ==========================================================================
   TH�ME � PROJECTION � : fond clair et contraste �lev�
   ========================================================================== */

:root[data-theme="projection"] body {
    background-image:
        radial-gradient(ellipse at 12% 18%, rgba(0, 92, 184, 0.10) 0%, transparent 45%),
        radial-gradient(ellipse at 86% 78%, rgba(0, 64, 128, 0.08) 0%, transparent 48%);
}

:root[data-theme="projection"] *,
:root[data-theme="projection"] *::before,
:root[data-theme="projection"] *::after {
    transition: none !important;
    animation-duration: 0.001ms !important;
}

:root[data-theme="projection"] #banner,
:root[data-theme="projection"] #footer,
:root[data-theme="projection"] #score-display,
:root[data-theme="projection"] .mode-btn,
:root[data-theme="projection"] .tool-btn {
    background: var(--banner-bg);
    color: var(--text);
    transition: none !important;
}

:root[data-theme="projection"] #sub_title,
:root[data-theme="projection"] .fenetre_titre,
:root[data-theme="projection"] #main_title {
    color: var(--text);
    text-shadow: none;
}

:root[data-theme="projection"] #sub_title,
:root[data-theme="projection"] .fenetre_titre {
    color: var(--gold);
}

:root[data-theme="projection"] .mode-btn,
:root[data-theme="projection"] .tool-btn,
:root[data-theme="projection"] .toggle-pill,
:root[data-theme="projection"] .home-btn {
    background: #ffffff;
    color: var(--text);
    border-color: var(--line);
}

:root[data-theme="projection"] .mode-btn.active,
:root[data-theme="projection"] .tool-btn.active,
:root[data-theme="projection"] .toggle-pill.active {
    background: rgba(0, 92, 184, 0.12);
    color: var(--gold);
    border-color: var(--gold);
}

:root[data-theme="projection"] .question-box,
:root[data-theme="projection"] .numeric-container,
:root[data-theme="projection"] .interactive-container,
:root[data-theme="projection"] .free-controls,
:root[data-theme="projection"] .free-readout,
:root[data-theme="projection"] .free-system-row,
:root[data-theme="projection"] .free-intro,
:root[data-theme="projection"] .formula-box,
:root[data-theme="projection"] .bilan-card,
:root[data-theme="projection"] .wow-details {
    background: rgba(0, 60, 120, 0.06);
    color: var(--text);
    border-color: var(--line);
}

:root[data-theme="projection"] .question-box {
    border-left-color: var(--gold);
}

:root[data-theme="projection"] .qcm-option {
    background: #ffffff;
    color: var(--text);
    border-color: rgba(0, 60, 120, 0.20);
}

:root[data-theme="projection"] .qcm-option:hover:not(:disabled) {
    background: rgba(0, 92, 184, 0.08);
}

:root[data-theme="projection"] .qcm-option.selected {
    background: rgba(0, 92, 184, 0.12);
    color: var(--text);
    border-color: var(--gold);
}

:root[data-theme="projection"] .qcm-option.correct {
    background: rgba(39, 174, 96, 0.16);
    color: #0d3b22;
}

:root[data-theme="projection"] .qcm-option.wrong {
    background: rgba(231, 76, 60, 0.14);
    color: #5b120b;
}

:root[data-theme="projection"] #numeric-input,
:root[data-theme="projection"] #free-system {
    background: #ffffff;
    color: var(--text);
    border-color: var(--input-border);
}

:root[data-theme="projection"] .mini-btn {
    background: #ffffff;
    color: var(--text);
    border-color: var(--line);
}

:root[data-theme="projection"] .mini-btn:hover:not(:disabled) {
    background: rgba(0, 92, 184, 0.08);
    color: var(--gold);
}

:root[data-theme="projection"] .bilan-card.active {
    background: linear-gradient(145deg, rgba(0, 92, 184, 0.10), rgba(255, 255, 255, 0.96));
    border-color: var(--gold);
}

:root[data-theme="projection"] .bilan-card.future {
    background: rgba(0, 60, 120, 0.04);
}

:root[data-theme="projection"] .dropdown-menu,
:root[data-theme="projection"] .theme-menu {
    background: #ffffff;
    color: var(--text);
    border-color: var(--gold);
}

:root[data-theme="projection"] .dropdown-item,
:root[data-theme="projection"] .theme-option {
    color: var(--text);
}

:root[data-theme="projection"] .dropdown-item:hover,
:root[data-theme="projection"] .theme-option:hover {
    background: rgba(0, 92, 184, 0.10);
}

:root[data-theme="projection"] .wow-card {
    background: linear-gradient(145deg, #ffffff, #edf4fb);
    color: var(--text);
    border-color: var(--gold);
}

:root[data-theme="projection"] .wow-title,
:root[data-theme="projection"] .wow-details .row strong {
    color: var(--gold);
}

:root[data-theme="projection"] .wow-subtitle {
    color: var(--text);
}

:root[data-theme="projection"] .wow-score {
    color: #0d6b3a;
    background: rgba(39, 174, 96, 0.10);
}

:root[data-theme="projection"] .bilan-progress,
:root[data-theme="projection"] .mode-badge,
:root[data-theme="projection"] .score-badge,
:root[data-theme="projection"] .phase-badge {
    background: rgba(0, 92, 184, 0.08);
    color: var(--gold);
    border-color: var(--gold-line);
}

:root[data-theme="projection"] .canvas-container,
:root[data-theme="projection"] .advancement-container {
    background: #f8fbff;
    border-color: rgba(0, 92, 184, 0.22);
}

:root[data-theme="projection"] .q-intro,
:root[data-theme="projection"] .data-panel,
:root[data-theme="projection"] .advancement-table,
:root[data-theme="projection"] .free-volume-row {
    background: rgba(0, 60, 120, 0.05);
    border-color: var(--line);
    color: var(--text);
}

:root[data-theme="projection"] .data-value,
:root[data-theme="projection"] .advancement-table th {
    color: var(--gold);
}

:root[data-theme="projection"] .advancement-table th {
    background: rgba(0, 92, 184, 0.08);
}

:root[data-theme="projection"] .advancement-table td {
    color: var(--text);
}

:root[data-theme="projection"] .adv-status.before { color: #1e5fbf; }
:root[data-theme="projection"] .adv-status.at { color: #0d6b3a; }
:root[data-theme="projection"] .adv-status.after { color: #b0185a; }

:root[data-theme="projection"] .tap-hint,
:root[data-theme="projection"] .slider-group label,
:root[data-theme="projection"] .free-volume-label,
:root[data-theme="projection"] .data-label {
    color: var(--muted);
}

:root[data-theme="projection"] .question-box em {
    color: #2b4a6b;
}

:root[data-theme="projection"] #score-display,
:root[data-theme="projection"] #score-badge {
    background: #ffffff;
    color: var(--gold);
    border-color: var(--gold-line);
}

:root[data-theme="projection"] .feedback-msg.success,
:root[data-theme="projection"] .free-readout .ro-status.at {
    color: #0d6b3a;
}

:root[data-theme="projection"] .feedback-msg.error,
:root[data-theme="projection"] .free-readout .ro-status.after {
    color: #a12216;
}

:root[data-theme="projection"] .feedback-msg.warning {
    color: #8a5a00;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* Barres de d�filement visibles et coh�rentes avec le th�me. */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.52) rgba(0, 0, 0, 0.18);
}

body::-webkit-scrollbar { width: 10px; }
body::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.12); }
body::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.52);
    border-radius: 6px;
    border: 2px solid transparent;
    background-clip: content-box;
}

@media screen and (max-width: 1200px), screen and (max-height: 820px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    #conteneur_simulation {
        flex: 0 0 auto;
        min-height: 0;
    }

    #fenetre-controles { overflow: visible; }
    #controls-body { overflow: visible; }
    #fenetre-informations { height: auto; max-height: none; }
    .bilan-cards { overflow: visible; max-height: none; }
}

@media screen and (max-width: 1150px) {
    #conteneur_simulation { grid-template-columns: minmax(0, 1fr) 320px; gap: 11px; padding: 10px; }
}

/* �?crans desktop peu hauts (ex. 1024 �- 768) : on rend de la place aux questions. */
@media screen and (min-width: 901px) and (max-height: 820px) {
    .canvas-container {
        height: 225px;
        min-height: 205px;
    }
}

@media screen and (max-width: 900px) {
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    #banner {
        flex-wrap: wrap;
        gap: 7px;
        padding: 7px 10px;
    }

    .banner-left { flex: 1 1 100%; min-width: 0; }
    #main_title, #sub_title { white-space: normal; }
    .banner-nav { flex: 1 1 auto; flex-wrap: wrap; }
    .banner-score { display: none; }

    #conteneur_simulation {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 11px;
        max-width: 760px;
    }

    .left-column { gap: 11px; }
    .right-column { min-height: 0; }
    #fenetre-informations { height: auto; max-height: none; }
    .bilan-cards { max-height: none; overflow: visible; }

    .canvas-container { height: 230px; min-height: 210px; }
    .canvas-split.view-split { flex-direction: column; }
    .canvas-split.view-split .canvas-container { flex: 1 1 auto; height: 220px; min-height: 200px; }
    /* Écrans étroits : on empile canvas et questions au lieu de les mettre côte à côte. */
    #conteneur_simulation.bilan-hidden .left-column { display: flex; flex-direction: column; }
    #conteneur_simulation.bilan-hidden #fenetre-canvas,
    #conteneur_simulation.bilan-hidden #fenetre-controles { height: auto; }
    #conteneur_simulation.bilan-hidden #canvas-split { height: auto; }
    #conteneur_simulation.bilan-hidden .canvas-split .canvas-container { height: 220px; min-height: 200px; }
    .free-grid { grid-template-columns: 1fr; gap: 2px; }
    #fenetre-controles { overflow: visible; }
    #controls-body { overflow: visible; }
    .qcm-option { min-height: 42px; }
    .mini-btn { min-height: 42px; }
    .premium-btn { min-height: 44px; }
    #numeric-input { min-height: 44px; }
    .action-row { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, rgba(6, 14, 28, 0.96) 40%); padding-top: 12px; z-index: 5; }

    .combo-badge { right: 20px; bottom: 88px; }
}

@media screen and (max-width: 620px) {
    html { font-size: 13px; }
    #main_title { font-size: 1rem; }
    #sub_title { font-size: 0.70rem; }
    .mode-btn { padding: 6px 8px; font-size: 0.70rem; }
    .home-btn { width: 31px; height: 31px; font-size: 1rem; }
    #score-display { padding: 5px 9px; font-size: 0.72rem; }
    .canvas-container { height: 215px; min-height: 195px; }
    .free-grid { grid-template-columns: 1fr; }
    .free-readout .ro-grid { grid-template-columns: 1fr; }
    .question-box { font-size: 0.84rem; }
    .qcm-option { font-size: 0.79rem; padding: 8px 9px; }
    .premium-btn { width: 100%; }
    .action-row { gap: 6px; }
    .interactive-actions .mini-btn,
    .free-actions .mini-btn { flex: 1 1 30%; }
    #chrono-bar-content { font-size: 0.70rem; }
}

@media screen and (max-width: 380px) {
    .mode-btn .caret { display: none; }
    .phase-badge { font-size: 0.66rem; }
    .ctrl-badges { gap: 3px; }
    .mode-badge, .score-badge { font-size: 0.66rem; padding: 2px 6px; }
}

/* Accessibilité : focus visible */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Réduction des animations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
