/* =========================================================================
   Simulateur d'Avancement Chimique — Feuille de style
   S'appuie sur le Design System commun : _SharedResources/theme_global.css
   ========================================================================= */
@import url('../../../_SharedResources/theme_global.css');

/* =========================================================================
   1. PALETTES DE THÈMES (partagées avec la page d'accueil via localStorage)
   Le thème par défaut de ce simulateur est le BLEU.
   ========================================================================= */
:root,
:root[data-theme="bleu"] {
    --accent-rgb: 0, 229, 255;
    --accent-2-rgb: 0, 119, 255;
    --accent-color: #00e5ff;
    --accent-gradient: linear-gradient(135deg, #00e5ff 0%, #0077ff 100%);
    --btn-text: #04121f; --bg-main: #050a14; --panel-bg-1: rgba(10, 20, 40, 0.82);
    --banner-bg: rgba(8, 18, 36, 0.86);
    --bloc-bg: rgba(0, 0, 0, 0.18);
    --bloc-bg-fort: rgba(0, 0, 0, 0.28);
    --canvas-bg: rgba(6, 10, 22, 0.6);
    --menu-bg: rgba(10, 20, 40, 0.98);
    --panneau-opaque: rgba(8, 14, 28, 0.98);
    --border-gold: rgba(var(--accent-rgb), 0.35); --title-shadow: rgba(var(--accent-rgb), 0.5);
    --text-highlight: var(--accent-color); --bg-image: url('../../../img_fond_bleu.svg');
}
:root[data-theme="dore"] {
    --accent-rgb: 255, 209, 102;
    --accent-2-rgb: 232, 150, 30;
    --accent-color: #ffd166;
    --accent-gradient: linear-gradient(135deg, #ffdf8e 0%, #ffc44d 48%, #e8961e 100%);
    --btn-text: #2a1802; --bg-main: #0a0803; --panel-bg-1: rgba(28, 21, 9, 0.80);
    --banner-bg: rgba(28, 21, 9, 0.86);
    --border-gold: rgba(var(--accent-rgb), 0.35); --title-shadow: rgba(var(--accent-rgb), 0.5);
    --text-highlight: var(--accent-color); --bg-image: url('../../../img_fond_dore.svg');
}
:root[data-theme="emeraude"] {
    --accent-rgb: 52, 211, 153;
    --accent-2-rgb: 5, 150, 105;
    --accent-color: #34d399;
    --accent-gradient: linear-gradient(135deg, #6ee7b7 0%, #34d399 48%, #059669 100%);
    --btn-text: #04241a; --bg-main: #04110c; --panel-bg-1: rgba(8, 28, 20, 0.82);
    --banner-bg: rgba(7, 26, 18, 0.86);
    --border-gold: rgba(var(--accent-rgb), 0.35); --title-shadow: rgba(var(--accent-rgb), 0.5);
    --text-highlight: var(--accent-color); --bg-image: url('../../../img_fond_emeraude.svg');
}
:root[data-theme="violet"] {
    --accent-rgb: 192, 132, 252;
    --accent-2-rgb: 124, 58, 237;
    --accent-color: #c084fc;
    --accent-gradient: linear-gradient(135deg, #d8b4fe 0%, #a855f7 48%, #7c3aed 100%);
    --btn-text: #1b0a33; --bg-main: #0a0617; --panel-bg-1: rgba(24, 16, 40, 0.82);
    --banner-bg: rgba(22, 14, 38, 0.86);
    --border-gold: rgba(var(--accent-rgb), 0.35); --title-shadow: rgba(var(--accent-rgb), 0.5);
    --text-highlight: var(--accent-color); --bg-image: url('../../../img_fond_violet.svg');
}
:root[data-theme="rose"] {
    --accent-rgb: 251, 113, 133;
    --accent-2-rgb: 225, 29, 72;
    --accent-color: #fb7185;
    --accent-gradient: linear-gradient(135deg, #fda4af 0%, #fb7185 48%, #e11d48 100%);
    --btn-text: #2b0610; --bg-main: #14060a; --panel-bg-1: rgba(40, 14, 22, 0.82);
    --banner-bg: rgba(38, 13, 21, 0.86);
    --border-gold: rgba(var(--accent-rgb), 0.35); --title-shadow: rgba(var(--accent-rgb), 0.5);
    --text-highlight: var(--accent-color); --bg-image: url('../../../img_fond_rose.svg');
}

/* --- Thème « Projection » : fond clair, texte sombre (pour vidéoprojecteur) --- */
:root[data-theme="projection"] {
    --accent-rgb: 0, 92, 184;
    --accent-2-rgb: 0, 64, 128;
    --accent-color: #005cb8;
    --accent-gradient: linear-gradient(135deg, #2b7fd4 0%, #005cb8 100%);
    --btn-text: #ffffff;
    --bg-main: #f1f5f9;
    --panel-bg-1: rgba(255, 255, 255, 0.96);
    --banner-bg: rgba(197, 215, 236, 0.97);
    --bloc-bg: rgba(0, 60, 120, 0.06);
    --bloc-bg-fort: rgba(0, 60, 120, 0.10);
    --canvas-bg: #ffffff;
    --menu-bg: rgba(255, 255, 255, 0.99);
    --panneau-opaque: rgba(255, 255, 255, 0.99);
    --border-gold: rgba(0, 92, 184, 0.40);
    --title-shadow: rgba(0, 0, 0, 0.10);
    --text-highlight: #00458c;
    --bg-image: none;
    /* Surcharges du thème global (texte et champs clairs) */
    --text-main: #16202e;
    --text-muted: #46586c;
    --input-bg: #ffffff;
    --input-border: rgba(0, 92, 184, 0.45);
    --param-box: rgba(0, 60, 120, 0.06);
    color-scheme: light;
}
:root[data-theme="projection"] .species-a { color: #1e5fbf !important; }
:root[data-theme="projection"] .species-b { color: #c62828 !important; }
:root[data-theme="projection"] .species-c { color: #1b7f3b !important; }
:root[data-theme="projection"] .species-d { color: #7b3fbf !important; }

/* =========================================================================
   2. BASE & FOND D'ÉCRAN
   ========================================================================= */
html { font-size: clamp(13px, 1.2vw + 0.1rem, 16px); }

body {
    min-height: 100vh;
    background-color: var(--bg-main);
    background-image: none;
    background-attachment: scroll;
    overflow-x: hidden;
}
body::before {
    content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image:
        radial-gradient(circle at 15% 10%, rgba(var(--accent-rgb), 0.16), transparent 34%),
        radial-gradient(circle at 88% 22%, rgba(var(--accent-2-rgb), 0.18), transparent 34%),
        var(--bg-image);
    background-size: cover; background-position: center;
}

/* Barres de défilement discrètes et visibles (indique une zone déroulable) */
#info_content, .right-column { scrollbar-width: thin; scrollbar-color: rgba(var(--accent-rgb), 0.55) var(--bloc-bg); }
#info_content::-webkit-scrollbar, .right-column::-webkit-scrollbar { width: 10px; }
#info_content::-webkit-scrollbar-track, .right-column::-webkit-scrollbar-track { background: var(--bloc-bg); border-radius: 6px; }
#info_content::-webkit-scrollbar-thumb, .right-column::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.5); border-radius: 6px; border: 2px solid transparent; background-clip: content-box;
}

/* =========================================================================
   3. BANDEAU, BOUTONS & SÉLECTEUR DE THÈME DÉROULANT
   ========================================================================= */
#banner {
    display: flex; flex-direction: row; justify-content: space-between; align-items: center;
    gap: 12px; flex-wrap: wrap; min-height: 0; padding: 10px 16px;
    background-color: var(--banner-bg);
    background-image: linear-gradient(90deg, rgba(var(--accent-rgb), 0.16), transparent 55%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-gold);
    box-shadow: 0 1px 16px rgba(var(--accent-rgb), 0.14);
    position: relative; z-index: 50;
}
.banner-left { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; }
#main_title { font-size: clamp(1.05rem, 2vw, 1.4rem); font-weight: 700; color: var(--text-main); text-shadow: 0 0 6px var(--title-shadow); }
#sub_title { font-size: clamp(0.8rem, 1.4vw, 0.95rem); margin-top: 2px; color: var(--text-highlight); }
.banner-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.banner-btn, .theme-current, .banner-link {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 8px;
    border: 1px solid var(--border-gold);
    background: rgba(var(--accent-rgb), 0.10);
    color: var(--text-main); font: inherit; font-size: 0.85rem; font-weight: 700;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: all 0.2s ease;
}
.banner-btn:hover, .theme-current:hover, .banner-link:hover {
    background: rgba(var(--accent-rgb), 0.2); color: var(--accent-color);
    box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.35);
}
.banner-link { color: var(--accent-color); }

.theme-dropdown { position: relative; }
.theme-current .theme-dot { width: 13px; height: 13px; }
.theme-current .chevron { color: var(--text-muted); font-size: 0.75rem; }
.theme-menu {
    position: absolute; top: calc(100% + 6px); right: 0; min-width: 172px;
    display: none; flex-direction: column; gap: 2px; padding: 6px;
    border-radius: 10px; background: var(--menu-bg);
    border: 1px solid var(--border-gold); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    z-index: 60;
}
.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-main); font: inherit; font-size: 0.85rem; 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(--accent-color); }
.theme-option.is-active::after { content: '✓'; margin-left: auto; }

.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);
}

/* =========================================================================
   4. GRILLE PRINCIPALE
   ========================================================================= */
#conteneur_simulation {
    flex: 1 1 auto; display: flex; flex-direction: column; gap: 12px;
    padding: 12px; width: 100%; box-sizing: border-box; min-height: 0;
}
.left-column, .right-column { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }

/* =========================================================================
   5. VISUALISATION : onglets horizontaux (Material) + canvas 4:3 centré
   ========================================================================= */
#zone-visu {
    display: flex; flex-direction: column;
    padding: 12px; flex: 1 1 auto; min-height: 280px; overflow: hidden;
}

.visu-entete {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border-gold);
    flex-shrink: 0;
}
.visu-entete .fenetre_titre {
    margin: 0; padding: 0 0 6px 0; border: none;
    font-size: 1.05rem; text-align: left;
}
.visu-nav { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }

/* Puces Material « vues affichées » (sélection multiple) */
#tabs-dessin { display: flex; flex-direction: row; flex-wrap: wrap; gap: 6px; min-width: 0; }
.tab-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; min-width: 0;
    border: 1px solid var(--border-gold); border-radius: 999px;
    background: var(--bloc-bg); color: var(--text-muted);
    font: inherit; font-weight: 600; font-size: 0.84rem;
    cursor: pointer; white-space: nowrap;
    transition: all 0.2s ease;
}
.tab-btn .tab-ico { flex: none; }
.tab-btn .tab-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.tab-btn:hover { color: var(--text-main); background: rgba(var(--accent-rgb), 0.14); }

/* Cochée = vue affichée */
.tab-btn.vue-on {
    color: var(--btn-text);
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(var(--accent-rgb), 0.3);
}
.tab-btn.vue-on::before { content: '✓'; font-weight: 700; flex: none; }
.tab-btn.vue-off { opacity: 0.65; }
.tab-btn.vue-off:hover { opacity: 1; }

.tab-indicator { display: none; }
.vues-label {
    font-size: 0.76rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
    margin-right: 2px;
}
@media (max-width: 1100px) { .vues-label { display: none; } }

/* Sélecteur Material du nombre de vues simultanées */
.segmented {
    display: inline-flex; align-items: center; gap: 2px; margin-bottom: 4px;
    padding: 3px; border-radius: 10px;
    border: 1px solid var(--border-gold);
    background: rgba(var(--accent-rgb), 0.08);
}
.segmented.masque { display: none; }
.seg-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 34px; height: 30px; padding: 0 8px;
    border: none; border-radius: 7px; background: transparent;
    color: var(--text-muted); font: inherit; font-size: 0.95rem; letter-spacing: -1px;
    cursor: pointer; transition: all 0.2s ease;
}
.seg-btn:hover:not(:disabled) { background: rgba(var(--accent-rgb), 0.16); color: var(--text-main); }
.seg-btn.active { background: var(--accent-gradient); color: var(--btn-text); }
.seg-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.visu-corps {
    display: flex; align-items: center; justify-content: center;
    flex: 1 1 auto; min-height: 0; padding-top: 8px;
}

/* Dimensions exactes (ratio 4:3) fixées en JS pour ne jamais écraser le canvas */
#contenu-dessin { position: relative; flex: 0 0 auto; overflow: hidden; }

#contenu-dessin.mode-onglets > .fenetre-contenu {
    position: absolute; inset: 0; padding: 0; background: none; border: none; box-shadow: none;
    border-radius: 0; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
#contenu-dessin.mode-onglets > .fenetre-contenu.active { opacity: 1; pointer-events: auto; }

/* Mode multi-vues : 2 ou 3 canvas simultanés (dimensions réglées en JS) */
#contenu-dessin.mode-multi {
    flex: 0 0 auto;
    display: grid; gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
}
#contenu-dessin.mode-multi > .fenetre-contenu {
    position: relative; inset: auto;
    opacity: 1; pointer-events: auto;
    border-radius: 8px; overflow: hidden;
    width: 100%; height: 100%;
}

.canvas_container {
    width: 100%; height: 100%; position: relative; overflow: hidden;
    border-radius: 8px; background: var(--canvas-bg); touch-action: none;
}
.canvas_container canvas {
    position: absolute; top: 0; left: 0;
    width: 100% !important; height: 100% !important; object-fit: contain;
}

/* =========================================================================
   6. ACTIONS
   ========================================================================= */
#fenetre-actions { flex: 0 0 auto; padding: 10px 12px; }
#fenetre-actions .fenetre_titre_wrapper { margin-bottom: 6px; padding-bottom: 5px; }
.actions-body { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.action-bloc {
    display: flex; flex-direction: column; gap: 5px;
    background: var(--bloc-bg); border-radius: 8px; padding: 6px 9px;
}
.action-bloc > label { font-size: 0.84rem; color: var(--text-highlight); font-weight: 500; }
#fenetre-actions .reset-button { padding: 0.4rem 0.8rem !important; font-size: 0.78rem !important; }

input[type=range].control_slider.halo-slider { flex: 1 1 0; min-width: 0; }
#x_value_display { flex: 0 0 94px; min-width: 0; }
.slider-row { flex-wrap: nowrap; }
#pas_a_pas_action_row { flex-wrap: nowrap; gap: 8px; align-items: center; }
#pas_a_pas_action_row.est-masque { display: none; }
#pas_a_pas_action_row .deltax-label { flex: 0 0 auto; font-size: 0.82rem; color: var(--text-muted); }
#pas_a_pas_action_row .step-button {
    flex: 1 1 0; min-width: 0; white-space: nowrap;
    font-size: 0.8rem; letter-spacing: 0.3px; padding-left: 0.3em; padding-right: 0.3em;
}
#input_deltax { flex: 0 0 62px; min-width: 0; }

/* =========================================================================
   7. PANNEAUX LATÉRAUX DÉROULANTS (Réglages & Bilan)
   ========================================================================= */
.right-column { overflow-y: auto; }
#fenetre-parametres, #fenetre-informations { flex: 0 0 auto; min-height: 0; }
#fenetre-parametres .fenetre_titre_wrapper,
#fenetre-informations .fenetre_titre_wrapper { margin-bottom: 8px; }
#fenetre-parametres.collapsed .params-body,
#fenetre-informations.collapsed #info_content { display: none; }

.panneau-toggle {
    background: transparent; border: 1px solid var(--border-gold); color: var(--text-highlight);
    font-size: 0.9rem; line-height: 1; cursor: pointer; padding: 5px 9px; border-radius: 6px; transition: all 0.2s ease;
    flex-shrink: 0;
}
.panneau-toggle:hover { background: rgba(var(--accent-rgb), 0.18); }

#info_content {
    display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 0;
    font-family: 'Courier New', Courier, monospace; line-height: 1.4;
}
.info-equation {
    text-align: center; font-size: clamp(1rem, 2.4vw, 1.2rem); font-weight: 700;
    padding: 10px 6px; border-radius: 8px; background: var(--bloc-bg-fort);
    border: 1px solid var(--border-gold); letter-spacing: 0.02em;
}
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.info-card {
    display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px;
    background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.25);
}
.info-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-family: 'Segoe UI', Tahoma, sans-serif; }
.info-value { font-size: 0.98rem; font-weight: 700; color: var(--text-main); }
.info-value.highlight { color: var(--accent-color); }
.info-section {
    font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-highlight); border-bottom: 1px solid var(--border-gold);
    padding-bottom: 4px; margin-top: 4px; font-family: 'Segoe UI', Tahoma, sans-serif;
}
.info-qty { display: flex; flex-direction: column; gap: 4px; }
.qty-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; background: var(--bloc-bg); }
.qty-line .qty-name { font-weight: 700; min-width: 74px; }
.qty-line .qty-now { color: var(--text-main); font-weight: 700; }
.qty-line .qty-delta { color: var(--text-muted); font-size: 0.8rem; }

/* =========================================================================
   8. RÉGLAGES (dans la modale)
   ========================================================================= */
.params-body { display: flex; flex-direction: column; gap: 10px; }
.param-group {
    display: flex; flex-direction: column; gap: 8px;
    background: var(--bloc-bg); border-radius: 8px; padding: 10px 12px;
}
.param-group .main-group-title {
    margin: 0; font-size: 0.9rem; text-align: left;
    border-bottom: 1px solid var(--border-gold); padding-bottom: 6px;
}
.param-group .control_row { flex-wrap: nowrap; }
.param-group .control_row label { flex: 0 0 auto; text-align: left; font-weight: 600; }
.param-group .qty-input { flex: 1 1 auto; min-width: 0; }

/* Sélecteur d'unité des quantités de matière */
.unite-row { align-items: center; }
.unite-row label { flex: 0 0 auto; }
.unite-select {
    flex: 1 1 auto; min-width: 0; cursor: pointer;
    color: var(--accent-color);
    background-color: var(--input-bg, rgba(0, 0, 0, 0.25));
    border: 1px solid var(--input-border, var(--border-gold));
    border-radius: 8px; padding: 6px 8px; font-weight: 600;
}
.unite-aide {
    margin: 2px 0 0 0; font-size: 0.78rem; line-height: 1.3;
    color: var(--text-muted);
}

/* Au survol / focus, les champs restent clairs et lisibles en thème Projection
   (theme_global impose sinon un fond sombre rgba(0,40,80,.9) non thémé). */
:root[data-theme="projection"] .control_element:hover:not(:disabled),
:root[data-theme="projection"] .control_element:focus:not(:disabled) {
    background-color: var(--input-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.35);
    color: var(--accent-color);
}
:root[data-theme="projection"] select.control_element,
:root[data-theme="projection"] select.control_element option {
    background-color: #ffffff;
    color: var(--text-main);
}

/* Sélection de texte lisible dans tous les thèmes */
::selection { background: rgba(var(--accent-rgb), 0.30); color: var(--text-main); }
input::selection, select::selection, textarea::selection {
    background: rgba(var(--accent-rgb), 0.30); color: var(--text-main);
}

input[type="number"].control_element { color: var(--accent-color); }
.equation-display { justify-content: center; align-items: center; flex-wrap: nowrap; gap: 2px; }
.equation-display span { font-size: clamp(0.85rem, 2.4vw, 1.05rem); flex-shrink: 0; }
.equation-display .op { color: var(--text-muted); padding: 0 1px; }
.coeff-input {
    flex: 1 1 0; min-width: 34px; max-width: 56px;
    padding-left: 0.1em; padding-right: 0.1em;
    -moz-appearance: textfield; appearance: textfield;
}
.coeff-input::-webkit-outer-spin-button,
.coeff-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.sub-group-label, .switch_label { color: var(--text-main) !important; }
#limited_reaction_inputs { border-left: none; }
#limited_reaction_inputs.disabled-state { display: none; }
#limited_reaction_inputs.disabled-state .qty-input:disabled {
    background-color: rgba(192, 57, 43, 0.3) !important; border-color: rgba(192, 57, 43, 0.7) !important;
}

.species-a { color: #6496ff !important; }
.species-b { color: #ff6464 !important; }
.species-c { color: #64ff96 !important; }
.species-d { color: #c864ff !important; }

.warning-text {
    color: #ff7675; font-weight: 700; font-size: 0.8rem; text-align: center; padding: 4px;
    background-color: rgba(255, 65, 54, 0.15); border: 1px solid rgba(255, 65, 54, 0.4);
    border-radius: 4px; margin-top: 6px; display: none;
}
.warning-text:not(.hidden) { display: block; }

/* Dépassement de l'avancement final : curseur en alerte rouge pulsée */
@keyframes pulse-halo-rouge {
    from { box-shadow: 0 0 4px 2px rgba(255, 65, 54, 0.55), inset 0 0 5px rgba(255, 255, 255, 0.85); }
    to   { box-shadow: 0 0 22px 10px rgba(255, 65, 54, 0.95), inset 0 0 5px rgba(255, 255, 255, 0.85); }
}

input[type=range].control_slider.halo-slider.slider-warning {
    background: rgba(255, 65, 54, 0.22);
    border-color: rgba(255, 65, 54, 0.75);
}
input[type=range].control_slider.halo-slider.slider-warning::-webkit-slider-thumb {
    background: #ff4136;
    border-color: #ffe0dc;
    animation: pulse-halo-rouge 0.8s ease-in-out infinite alternate;
}
input[type=range].control_slider.halo-slider.slider-warning::-moz-range-thumb {
    background: #ff4136;
    border-color: #ffe0dc;
    animation: pulse-halo-rouge 0.8s ease-in-out infinite alternate;
}
input[type="number"].control_element.valeur-warning {
    color: #ff7675 !important;
    border-color: rgba(255, 65, 54, 0.85) !important;
    box-shadow: 0 0 10px rgba(255, 65, 54, 0.45);
}

/* =========================================================================
   9. RESPONSIVE
   ========================================================================= */
@media (min-width: 900px) {
    body { height: 100vh; overflow: hidden; }
    #conteneur_simulation {
        display: grid; grid-template-columns: minmax(0, 1fr) clamp(310px, 34vw, 470px);
        gap: 15px; padding: 15px; max-width: 1700px; margin: 0 auto; overflow: hidden;
    }
    #zone-visu { min-height: 0; }
}

@media (max-width: 899px) {
    #sub_title { display: none; }
    .theme-current-label { display: none; }
    /* Hauteur définie : évite que le canvas ne « pousse » la zone (boucle de redimensionnement) */
    #zone-visu { height: clamp(260px, 44vh, 520px); min-height: 0; flex: 0 0 auto; }

    /* Le bilan devient un panneau montant depuis le bas (bottom sheet) */
    body { padding-bottom: 66px; }
    #fenetre-informations {
        position: fixed; left: 0; right: 0; bottom: 0; top: auto;
        z-index: 120; margin: 0; padding: 10px 14px;
        max-height: 72vh; border-radius: 14px 14px 0 0; border-bottom: none;
        background: var(--panneau-opaque);
        backdrop-filter: blur(14px);
        box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.55);
        overflow: hidden;
    }
    #fenetre-informations .fenetre_titre_wrapper { margin: 0 0 6px 0; }
    #fenetre-informations #info_content { flex: 1 1 auto; min-height: 0; }
}

@media (max-width: 520px) {
    .tab-btn { padding: 8px 9px 10px 9px; font-size: 0.78rem; gap: 5px; }
    #x_value_display { flex: 0 0 76px; }
}

