/* ==========================================================================
   SIMULATEUR DE CONVERSIONS & ÉCHELLES DE L'UNIVERS - FEUILLE DE STYLE
   Auteur : CLEMENTE R. - Lycée Louis Pasteur (Avignon)
   Charte graphique : Dark Space Glassmorphism & Gold Highlights
   ========================================================================== */

:root {
    --bg-dark: #070c18;
    --bg-dark-card: rgba(15, 25, 48, 0.82);
    --gold: #ffd700;
    --gold-glow: rgba(255, 215, 0, 0.4);
    --neon-green: #64ff96;
    --coral-red: #ff7675;
    --cyan-accent: #00d2d3;
    --pink-accent: #ff79c6;
    --orange-accent: #ff9f43;
    --text-main: #eaeaea;
    --text-muted: #a0aec0;
    --border-gold: rgba(255, 215, 0, 0.25);
    --border-active: #ffd700;
}

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

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 20%, rgba(20, 40, 80, 0.5) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(35, 20, 60, 0.4) 0%, transparent 50%),
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 150px 120px, #ffd700, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 300px 250px, #64ff96, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 500px 80px, #fff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 700px 320px, #00d2d3, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: cover;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

/* --- Sélection de texte : libre par défaut (accessibilité DYS / synthèse vocale),
       neutralisée uniquement là où elle gêne le glisser-déposer ou le clic --- */
.qcm-choice,
button,
.free-example-chip,
#canvas-visual,
#celebration-canvas,
.qcm-step-dot,
.toggle-pill,
.mode-btn {
    user-select: none;
    -webkit-user-select: none;
}

/* --- Bandeau d'En-Tête Responsive (Bande Unique Horizontale) --- */
#banner {
    width: 100%;
    background: rgba(10, 20, 35, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 clamp(8px, 1.2vw, 16px);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-gold);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    flex-shrink: 0;
    z-index: 100;
    gap: 8px;
    height: 38px;
    min-height: 38px;
    max-height: 40px;
    position: relative;
    overflow: visible;
}

.banner-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
}

.banner-title {
    font-size: clamp(0.82rem, 1vw, 0.98rem);
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
    margin: 0;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.banner-nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(4px, 0.5vw, 8px);
    min-width: 0;
    position: relative;
    overflow: visible;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.banner-nav::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.mode-btn {
    background: rgba(20, 35, 65, 0.7);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 2px clamp(6px, 0.6vw, 10px);
    border-radius: 14px;
    font-size: clamp(0.72rem, 0.78vw, 0.8rem);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    min-height: 26px;
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
}

.mode-btn:hover:not(:disabled) {
    background: rgba(40, 70, 120, 0.9);
    border-color: var(--gold);
    box-shadow: 0 0 10px var(--gold-glow);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #070c18;
    border-color: #ffd700;
    box-shadow: 0 0 12px var(--gold-glow);
    font-weight: 700;
}

.mode-btn.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(15, 20, 30, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Menu Déroulant Évaluations & Chrono */
.eval-dropdown-container,
.chrono-dropdown-container {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    z-index: 500;
}

.eval-dropdown-toggle,
.chrono-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding-right: 8px;
}

.dropdown-caret {
    font-size: 0.68rem;
    color: var(--gold);
    transition: transform 0.2s ease;
}

.eval-dropdown-container.open .dropdown-caret,
.chrono-dropdown-container.open .dropdown-caret {
    transform: rotate(180deg);
}

.eval-dropdown-menu,
.chrono-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 270px;
    background: #091326;
    border: 1.5px solid var(--gold);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.95), 0 0 20px var(--gold-glow);
    border-radius: 12px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 99999;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eval-dropdown-container.open .eval-dropdown-menu,
.chrono-dropdown-container.open .chrono-dropdown-menu {
    display: flex;
}

.eval-dropdown-item,
.chrono-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.eval-dropdown-item:hover,
.chrono-dropdown-item:hover {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.35);
    transform: translateX(2px);
}

.dropdown-item-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.dropdown-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dropdown-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold);
}

.dropdown-item-desc {
    font-size: 0.69rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 2px 4px;
}

.banner-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(4px, 0.5vw, 8px);
    min-width: 0;
    flex-shrink: 0;
    white-space: nowrap;
}

.score-badge {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-gold);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gold);
    white-space: nowrap;
}

.help-btn {
    background: linear-gradient(135deg, #00d2d3, #0984e3);
    border: none;
    color: #070c18;
    padding: clamp(3px, 0.4vh, 5px) clamp(6px, 0.6vw, 10px);
    border-radius: 16px;
    font-size: clamp(0.72rem, 0.8vw, 0.82rem);
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.4);
    transition: all 0.2s ease;
    min-height: clamp(26px, 3.4vh, 32px);
    white-space: nowrap;
    flex-shrink: 0;
    touch-action: manipulation;
}

.help-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 0 16px rgba(0, 210, 211, 0.7);
}

/* --- Pied de Page Standardisé Responsive --- */
#footer {
    width: 100%;
    min-height: clamp(28px, 3.2vh, 32px);
    background: rgba(10, 20, 35, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: 2px clamp(6px, 1vw, 14px);
    font-size: clamp(0.68rem, 0.75vw, 0.75rem);
    flex-shrink: 0;
    border-top: 1px solid var(--border-gold);
    letter-spacing: 0.2px;
    gap: 8px;
    z-index: 50;
}

/* Le <span> obligatoire de la charte reste lisible et centré, les boutons restent à droite */
#footer > span {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.footer-left {
    display: none;
}

.footer-center {
    flex: 1 1 auto;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.footer-right {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

.footer-btn {
    background: rgba(20, 35, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    min-height: 24px;
    touch-action: manipulation;
}

.footer-btn:hover {
    background: rgba(40, 70, 110, 0.9);
    border-color: var(--gold);
    color: #fff;
    transform: translateY(-1px);
}

.footer-btn.dev-btn {
    background: rgba(255, 215, 0, 0.12);
    border-color: rgba(255, 215, 0, 0.4);
    color: var(--gold);
}

.footer-btn.dev-btn:hover {
    background: var(--gold);
    color: #070c18;
    box-shadow: 0 0 10px var(--gold-glow);
}

/* --- Conteneur Principal Deux Colonnes Côte-à-Côte --- */
#conteneur_simulation {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: 6px 10px;
    gap: 10px;
    min-height: 0;
    overflow: hidden;
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

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

/* --- Cartes et Fenêtres Glassmorphism --- */
.fenetre {
    background: var(--bg-dark-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(255, 215, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Emplacement Fenêtre Questions (Slot Container) --- */
.fenetre2-slot-container {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* --- Fenêtre Canvas (Haut Gauche) --- */
#fenetre-canvas {
    flex: 1.05;
    height: 50%;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: clamp(175px, 34vh, 420px);
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(10, 20, 40, 0.6);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    flex-shrink: 0;
}

.canvas-header-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 6px;
}

.canvas-controls-bar {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toggle-pill {
    background: rgba(20, 35, 60, 0.8);
    border: 1px solid var(--border-gold);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
}

.toggle-pill:hover {
    border-color: var(--gold);
    color: #fff;
}

.toggle-pill.active {
    background: var(--gold);
    color: #070c18;
    font-weight: bold;
    border-color: var(--gold);
}

.canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 140px;
    background: #030610;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#canvas-visual {
    width: 100%;
    height: 100%;
    min-height: 140px;
    min-width: 0;
    flex: 1 1 0;
    display: block;
    cursor: grab;
    touch-action: none;
}

#canvas-visual:active {
    cursor: grabbing;
}

.canvas-overlay-info {
    position: absolute;
    bottom: 6px;
    left: 8px;
    right: 8px;
    background: rgba(10, 20, 35, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.78rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(4px);
    pointer-events: none;
    z-index: 4;
}

/* Vue Tableau des Préfixes Propre */
.table-sub-view {
    flex: 1;
    overflow-y: auto;
    background: #060a16;
    padding: 8px;
}

/* Vue Fiche Bilan & Synthèse dans la fenêtre de gauche */
.bilan-sub-view {
    flex: 1;
    overflow-y: auto;
    background: #060a16;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.table-scroll-container {
    width: 100%;
}

.prefix-table-clean {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.prefix-table-clean th {
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold);
    padding: 6px 8px;
    text-align: left;
    border: 1px solid rgba(255, 215, 0, 0.25);
    font-size: 0.78rem;
    position: sticky;
    top: 0;
    backdrop-filter: blur(4px);
}

.prefix-table-clean td {
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.prefix-table-clean tr {
    cursor: pointer;
    transition: background 0.15s;
}

.prefix-table-clean tr:hover {
    background: rgba(255, 215, 0, 0.12) !important;
}

.prefix-table-clean tr.table-row-selected {
    background: rgba(255, 215, 0, 0.25) !important;
    outline: 2px solid var(--gold);
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.3);
}

/* --- Vue 4 : Tableau de Bord Gamifié Chrono (Haut Gauche) --- */
.chrono-dashboard-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 8px;
    background: radial-gradient(circle at top, #142240, #040812);
    overflow-y: auto;
    min-height: 0;
    box-sizing: border-box;
}

.chrono-dash-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 6px 12px;
    flex-shrink: 0;
    gap: 8px;
}

.chrono-timer-display {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gold);
    font-family: 'Consolas', monospace;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 0 10px var(--gold-glow);
}

.chrono-timer-display.danger {
    color: var(--coral-red);
    animation: pulse 0.8s infinite alternate;
}

.chrono-score-display {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.combo-badge {
    background: linear-gradient(135deg, #ff9f43, #ee5253);
    color: #070c18;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(255, 159, 67, 0.6);
    animation: popBounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.combo-badge.super {
    background: linear-gradient(135deg, #ff7675, #dd4444);
    box-shadow: 0 0 14px rgba(214, 48, 49, 0.8);
    transform: scale(1.05);
}

.combo-badge.ultra {
    background: linear-gradient(135deg, #ffd700, #ff007f);
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
    transform: scale(1.1);
    animation: ultraGlow 0.6s infinite alternate;
}

@keyframes ultraGlow {
    from { box-shadow: 0 0 10px #ffd700; transform: scale(1.08); }
    to { box-shadow: 0 0 20px #ff007f, 0 0 30px #ffd700; transform: scale(1.15); }
}

@keyframes popBounce {
    0% { transform: scale(0.7); opacity: 0; }
    80% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

.chrono-dash-info-card {
    background: rgba(12, 24, 48, 0.75);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.chrono-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.chrono-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-green), var(--gold));
    border-radius: 4px;
    transition: width 0.2s linear;
}

.chrono-progress-bar-fill.danger {
    background: linear-gradient(90deg, var(--orange-accent), var(--coral-red));
}

.chrono-bonus-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 210, 211, 0.1);
    border: 1px solid rgba(0, 210, 211, 0.3);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.78rem;
    color: var(--cyan-accent);
}

.chrono-multiplier-tag {
    background: rgba(255, 215, 0, 0.2);
    color: var(--gold);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 700;
}

/* Toast de bonus Chrono : inséré dans document.body, positionné de façon autonome */
.chrono-toast-bonus {
    position: fixed;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.95), rgba(255, 170, 0, 0.95));
    color: #070c18;
    font-weight: 800;
    font-size: 1.1rem;
    padding: 8px 18px;
    border-radius: 20px;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.9);
    pointer-events: none;
    z-index: 100000;
    animation: toastFloat 0.8s ease-out forwards;
}

@keyframes toastFloat {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    70% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -90%) scale(0.9); }
}

/* --- Vue 3 : Tableau de Bord Évaluation QCM (Haut Gauche) --- */
.qcm-dashboard-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 6px;
    background: radial-gradient(circle at top, #0d1b33, #040812);
    overflow-y: auto;
    min-height: 0;
    box-sizing: border-box;
}

.qcm-dash-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 8px;
    padding: 5px 10px;
    flex-shrink: 0;
}

.qcm-timer-badge {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Consolas', monospace;
}

.qcm-timer-badge.warning {
    color: var(--coral-red);
    animation: pulse 1s infinite alternate;
}

.qcm-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    max-width: 240px;
    margin: 0 10px;
}

.qcm-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.qcm-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-accent), var(--neon-green));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.qcm-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #cbd5e1;
    font-weight: 600;
}

.qcm-timeline-row {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    padding: 2px 0;
    flex-shrink: 0;
}

.qcm-step-dot {
    flex: 1;
    text-align: center;
    padding: 4px 1px;
    font-size: 0.72rem;
    font-family: inherit;
    font-weight: 700;
    appearance: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
}

.qcm-step-dot:hover {
    border-color: var(--gold);
    transform: translateY(-1px);
}

.qcm-step-dot.active {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--gold);
    color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.qcm-step-dot.answered {
    background: rgba(0, 210, 211, 0.18);
    border-color: var(--cyan-accent);
    color: var(--cyan-accent);
}

.qcm-step-dot.passed {
    background: rgba(100, 255, 150, 0.2);
    border-color: var(--neon-green);
    color: var(--neon-green);
}

.qcm-step-dot.partial {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

.qcm-step-dot.failed {
    background: rgba(255, 118, 117, 0.2);
    border-color: var(--coral-red);
    color: var(--coral-red);
}

.tiers-temps-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(20, 35, 60, 0.85);
    border: 1px solid var(--border-gold);
    border-radius: 16px;
    padding: 3px 8px;
    font-size: 0.72rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    min-height: 24px;
}

.tiers-temps-toggle:hover {
    border-color: var(--gold);
    color: #fff;
}

.tiers-temps-toggle.active {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--gold);
    color: var(--gold);
    font-weight: bold;
    box-shadow: 0 0 6px var(--gold-glow);
}

.qcm-nav-btn {
    background: rgba(20, 35, 60, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #e2e8f0;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.qcm-nav-btn:hover {
    border-color: var(--gold);
    color: #fff;
    background: rgba(40, 65, 110, 0.9);
}

.qcm-submit-btn {
    background: linear-gradient(135deg, #00d2d3, #0984e3);
    color: #070c18;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 210, 211, 0.35);
    transition: all 0.2s;
}

.qcm-submit-btn:hover {
    box-shadow: 0 4px 18px rgba(0, 210, 211, 0.6);
    transform: translateY(-1px);
}

.qcm-submit-btn-top {
    background: linear-gradient(135deg, #00d2d3, #0984e3);
    color: #070c18;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 5px 14px;
    border-radius: 18px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.45);
    transition: all 0.25s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    touch-action: manipulation;
}

.qcm-submit-btn-top:hover {
    transform: scale(1.04);
    box-shadow: 0 0 18px rgba(0, 210, 211, 0.8);
    border-color: var(--gold);
}

.qcm-bottom-nav-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    flex-shrink: 0;
}

.qcm-nav-arrow-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.qcm-nav-highlight {
    background: linear-gradient(135deg, rgba(30, 55, 100, 0.95), rgba(15, 30, 60, 0.95));
    border: 1.5px solid var(--gold);
    color: var(--gold);
    font-weight: 700;
    padding: 6px 18px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.84rem;
}

.qcm-nav-highlight:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(0, 210, 211, 0.25));
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 16px var(--gold-glow);
    transform: translateY(-1px);
}

.qcm-dash-content-box {
    background: rgba(12, 24, 48, 0.75);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

/* --- Fenêtre Contrôles & Questions (Bas Gauche) --- */
#fenetre2 {
    flex: 1;
    height: 48%;
    padding: 8px 12px;
    gap: 6px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    min-height: 0;
    overflow-y: auto;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    padding-bottom: 4px;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.question-tag {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: 6px;
}

.question-target-box {
    background: rgba(20, 35, 70, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    padding: 6px 12px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.question-consigne {
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.3;
    margin: 2px 0;
    flex-shrink: 0;
}

/* --- Grille Pleine Largeur Mode Libre --- */
.free-mode-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1.3fr;
    gap: 8px;
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.25);
    align-items: center;
}

.free-input-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
}

.free-input-label {
    font-size: 0.74rem;
    color: var(--gold);
    font-weight: 600;
}

.free-large-input,
.free-large-select {
    width: 100% !important;
    padding: 6px 8px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 6px;
    background: rgba(10, 20, 35, 0.95);
    border: 1px solid var(--border-gold);
    color: #ffffff;
    outline: none;
    transition: all 0.2s;
}

.free-large-input:focus,
.free-large-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

/* --- Zone de saisie / Choix QCM --- */
.qcm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 100%;
    flex-shrink: 0;
}

.qcm-choice {
    background: rgba(20, 35, 60, 0.7);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    /* Réinitialisations <button> (engine.js) : apparence identique à l'ancien <div> */
    width: 100%;
    font: inherit;
    font-size: 0.85rem;
    color: var(--text-main);
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    min-height: 32px;
}

.qcm-choice:hover {
    background: rgba(35, 60, 100, 0.85);
    border-color: var(--gold);
}

.qcm-choice.selected {
    background: rgba(60, 90, 150, 0.9);
    border-color: #ffd700;
    box-shadow: 0 0 8px var(--gold-glow);
}

.qcm-choice.correct {
    background: rgba(100, 255, 150, 0.2) !important;
    border-color: var(--neon-green) !important;
    color: var(--neon-green);
}

.qcm-choice.wrong {
    background: rgba(255, 118, 117, 0.25) !important;
    border-color: var(--coral-red) !important;
    color: var(--coral-red);
}

.qcm-choice.missed {
    background: rgba(255, 215, 0, 0.15) !important;
    border: 1px dashed var(--gold) !important;
    color: var(--gold);
}

.qcm-letter-badge {
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold);
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.input-row-container {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    padding: 4px 0;
    flex-shrink: 0;
}

.sci-input {
    background: rgba(10, 20, 35, 0.9);
    border: 1px solid var(--border-gold);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: border 0.2s;
}

.sci-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.sci-input.coeff { width: 90px; }
.sci-input.exp { width: 65px; }

/* Feedback & Bouton de Validation collé */
.feedback-box {
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: 6px;
    margin: 4px 0;
    flex-shrink: 0;
}

.feedback-box.success {
    color: var(--neon-green);
    background: rgba(100, 255, 150, 0.08);
    border: 1px solid rgba(100, 255, 150, 0.3);
}

.feedback-box.error {
    color: var(--coral-red);
    background: rgba(255, 118, 117, 0.12);
    border: 1px solid rgba(255, 118, 117, 0.35);
}

.feedback-box.info {
    color: var(--gold);
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.action-row {
    display: flex;
    gap: 8px;
    margin-top: 4px;
    flex-shrink: 0;
    width: 100%;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, #ffd700, #e67e22);
    border: none;
    color: #070c18;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--gold-glow);
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.6);
}

.btn-next {
    background: linear-gradient(135deg, #64ff96, #00b894);
    color: #05180f;
}

/* --- Atelier Libre : Convertisseur & Exemples --- */
.free-examples-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 2px 0 6px 0;
}

.free-example-chip {
    background: rgba(20, 35, 65, 0.75);
    border: 1px solid rgba(255, 215, 0, 0.25);
    color: #e2e8f0;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
}

.free-example-chip:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

.free-mode-inputs-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1.2fr 1.5fr;
    gap: 8px;
    margin-bottom: 6px;
}

@media (max-width: 900px) {
    .free-mode-inputs-grid {
        grid-template-columns: 1fr 1fr;
    }
}
@media (max-width: 520px) {
    .free-mode-inputs-grid {
        grid-template-columns: 1fr;
    }
}

.free-input-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.free-input-label {
    font-size: 0.75rem;
    color: var(--gold);
    font-weight: 700;
    white-space: nowrap;
}

.free-large-input,
.free-large-select {
    width: 100%;
    box-sizing: border-box;
    background: rgba(10, 20, 40, 0.9);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 6px;
    color: #fff;
    padding: 5px 8px;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.free-large-input:focus,
.free-large-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
}

.optgroup-base-si {
    background: #091322;
    color: var(--gold);
    font-weight: 700;
}

.opt-base-si {
    background: #070c18;
    color: #ffd700;
    font-weight: 600;
}

.optgroup-derived {
    background: #091322;
    color: var(--cyan-accent);
    font-weight: 700;
}

/* --- Cadre Unique à Droite (#fenetre-informations) --- */
#fenetre-informations {
    height: 100%;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

#fenetre-informations::-webkit-scrollbar {
    width: 6px;
}
#fenetre-informations::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 4px;
}

.bilan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-gold);
    padding-bottom: 6px;
    flex-shrink: 0;
    gap: 8px;
}

.btn-toggle-eye {
    background: rgba(20, 35, 60, 0.8);
    border: 1px solid var(--border-gold);
    color: var(--gold);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    touch-action: manipulation;
    min-height: 24px;
}

.btn-toggle-eye:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--gold);
    box-shadow: 0 0 8px var(--gold-glow);
    transform: translateY(-1px);
}

/* --- Emplacements Flex et Gestion Layout 2 Colonnes vs 3 Colonnes --- */
.fenetre2-slot-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

#conteneur_simulation.layout-3pane #fenetre-canvas {
    height: 52%;
    flex: 1.1;
    min-height: 0;
}

#conteneur_simulation.layout-3pane #fenetre2-slot-left {
    display: flex;
    height: 48%;
    flex: 0.9;
    min-height: 0;
}

#conteneur_simulation.layout-3pane #fenetre-informations {
    display: flex;
    height: 100%;
    flex: 1;
    min-height: 0;
}

#conteneur_simulation.layout-3pane #fenetre2-slot-right {
    display: none !important;
}

/* En mode 2 panneaux (Bilan masqué) : Canvas 100% hauteur à gauche, Fenêtre 2 (Questions/Atelier) 100% hauteur à droite */
#conteneur_simulation.layout-2pane #fenetre-canvas {
    height: 100% !important;
    flex: 1 !important;
    min-height: 0;
}

#conteneur_simulation.layout-2pane #fenetre2-slot-left {
    display: none !important;
}

#conteneur_simulation.layout-2pane #fenetre-informations {
    display: none !important;
}

#conteneur_simulation.layout-2pane #fenetre2-slot-right {
    display: flex !important;
    height: 100% !important;
    flex: 1 !important;
    min-height: 0;
}

#conteneur_simulation.layout-2pane #fenetre2 {
    height: 100% !important;
}

.bilan-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bilan-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.bilan-box {
    background: rgba(15, 25, 45, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.84rem;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.bilan-box.active {
    border: 2px solid var(--gold) !important;
    background: rgba(255, 215, 0, 0.08);
    box-shadow: 0 0 15px var(--gold-glow);
}

.bilan-box-title {
    font-weight: 700;
    color: var(--gold);
    font-size: 0.9rem;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bilan-tag-active {
    background: var(--gold);
    color: #070c18;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: bold;
}

.bilan-rule {
    color: #e2e8f0;
    margin: 3px 0;
}

.bilan-formula {
    background: rgba(0, 0, 0, 0.45);
    border-left: 3px solid var(--gold);
    padding: 6px 10px;
    margin: 4px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem;
    color: #cbd5e1;
    line-height: 1.6;
}

/* --- Visualisation Pédagogique du Décalage de Virgule & Codes Couleurs ---
   Définition UNIQUE de chaque teinte du code couleurs (5 teintes visuellement distinctes).
   !important conservé : ces couleurs doivent primer sur les couleurs de texte locales
   (ex. .bilan-formula, .prefix-table-clean td). */
.match-gold { color: #ffd700 !important; font-weight: bold; }
.match-cyan { color: #00d2d3 !important; font-weight: bold; }
.match-pink { color: var(--pink-accent) !important; font-weight: bold; }
.match-orange { color: var(--orange-accent) !important; font-weight: bold; }
.col-val { color: #ffffff !important; font-weight: bold; }
.col-unit { color: #64ff96 !important; font-weight: bold; }

.shift-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 3px;
    line-height: 1;
}

.shift-num {
    font-weight: 700;
    font-size: 0.9em;
    letter-spacing: 0.3px;
    display: inline-block;
}

.shift-highlight-left {
    color: var(--cyan-accent);
    border-bottom: 2px solid var(--cyan-accent);
    padding-bottom: 1px;
}

.shift-highlight-right {
    color: var(--orange-accent);
    border-bottom: 2px solid var(--orange-accent);
    padding-bottom: 1px;
}

.shift-arrow-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.shift-arrow-tag.left {
    background: rgba(0, 210, 211, 0.2);
    color: var(--cyan-accent);
    border: 1px solid rgba(0, 210, 211, 0.45);
    box-shadow: 0 0 6px rgba(0, 210, 211, 0.2);
}

.shift-arrow-tag.right {
    background: rgba(255, 159, 67, 0.2);
    color: var(--orange-accent);
    border: 1px solid rgba(255, 159, 67, 0.45);
    box-shadow: 0 0 6px rgba(255, 159, 67, 0.2);
}

/* --- Équivalence et Décomposition des Puissances Cibles (Conversions Croisées) --- */
.equiv-power-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 3px;
    line-height: 1;
}

.equiv-power-orig {
    color: var(--cyan-accent);
    border-bottom: 2px solid var(--cyan-accent);
    padding-bottom: 1px;
    font-weight: 700;
}

.equiv-power-split {
    color: #ffffff;
    border-bottom: 2px solid var(--cyan-accent);
    padding-bottom: 1px;
    font-weight: 700;
}

.equiv-power-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--cyan-accent);
    background: rgba(0, 210, 211, 0.15);
    border: 1px solid rgba(0, 210, 211, 0.45);
    border-radius: 4px;
    padding: 1px 4px;
    margin-top: 2px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.shift-rule-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 8px 0;
}

.shift-rule-card {
    background: rgba(10, 20, 38, 0.7);
    border-radius: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.shift-rule-card.left {
    border-left: 3px solid var(--cyan-accent);
}

.shift-rule-card.right {
    border-left: 3px solid var(--orange-accent);
}

/* --- Modale Méthodologique & Modale Table --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-backdrop.open,
.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.modal-card {
    background: linear-gradient(145deg, rgba(15, 30, 55, 0.95), rgba(8, 15, 30, 0.98));
    border: 2px solid var(--gold);
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 25px var(--gold-glow);
    width: 90%;
    max-width: 840px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(10, 20, 40, 0.8);
    border-bottom: 1px solid var(--border-gold);
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    padding: 0 2px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--coral-red);
}

.modal-tabs {
    display: flex;
    background: rgba(10, 20, 35, 0.5);
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
}

.modal-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.modal-tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
    background: rgba(255, 215, 0, 0.08);
}

.modal-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.5;
}



.method-step-box {
    background: rgba(10, 20, 35, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
}

.method-step-title {
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

/* Tableau Préfixes */
.prefix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-top: 6px;
}

.prefix-table th {
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold);
    padding: 6px;
    text-align: left;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.prefix-table td {
    padding: 5px 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.prefix-table tr:hover {
    background: rgba(255, 215, 0, 0.1);
}

/* Badges Combos & Animations */
.combo-badge {
    background: linear-gradient(135deg, #ff7675, #dd4444);
    color: #070c18;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: bold;
    animation: pulse 1s infinite alternate;
    box-shadow: 0 0 10px rgba(255, 118, 117, 0.5);
}

.combo-badge.super {
    background: linear-gradient(135deg, #ffd700, #ff9f43);
    color: #070c18;
    box-shadow: 0 0 14px var(--gold-glow);
}

.combo-badge.ultra {
    background: linear-gradient(135deg, #00d2d3, #64ff96);
    color: #070c18;
    box-shadow: 0 0 16px rgba(0, 210, 211, 0.8);
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

/* Hub des 3 Modes Chrono */
.chrono-hub-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 8px;
}

.chrono-modes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    flex: 1;
    min-height: 0;
}

.chrono-mode-card {
    background: rgba(12, 22, 45, 0.8);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.chrono-mode-card:hover {
    transform: translateY(-3px);
    border-color: var(--gold);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 18px var(--gold-glow);
    background: rgba(20, 36, 70, 0.9);
}

.chrono-card-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #070c18;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.chrono-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold);
    margin: 2px 0 6px 0;
}

.chrono-card-desc {
    font-size: 0.78rem;
    color: #cbd5e1;
    line-height: 1.35;
    margin: 0;
    flex: 1;
}

.btn-chrono-launch {
    margin-top: 8px;
    width: 100%;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
}

/* Écran Whaouh de Célébration & Résultats */
.chrono-whaou-card {
    background: radial-gradient(circle at center, rgba(20, 35, 70, 0.95), rgba(7, 12, 24, 0.98));
    border: 2px solid var(--gold);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    box-shadow: 0 0 30px var(--gold-glow);
    height: 100%;
    justify-content: space-between;
}

.chrono-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}

.chrono-stat-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chrono-stat-val {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gold);
    font-family: 'Consolas', monospace;
}

.chrono-stat-lbl {
    font-size: 0.68rem;
    color: #a0aec0;
    margin-top: 2px;
}

.grade-badge-card {
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid var(--gold);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--gold);
    box-shadow: 0 0 12px var(--gold-glow);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================================================
   SYSTÈME RESPONSIVE COMPLET & ADAPTATION TABLETTES LENOVO K11 / MOBILES
   ========================================================================== */

/* 1. Tablettes en mode Paysage & Petits Ordinateurs Portables (<= 1180px) */
@media (max-width: 1180px) {
    #banner {
        padding: 5px 10px;
    }
    .banner-title {
        font-size: 1.05rem;
    }
    .banner-subtitle {
        display: none;
    }
    .mode-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
    }
    #conteneur_simulation {
        padding: 6px 8px;
        gap: 8px;
    }
    .left-column {
        flex: 1.35;
    }
    .right-column {
        flex: 1.05;
    }
    .qcm-choice {
        font-size: 0.82rem;
        padding: 5px 8px;
    }
}

/* 2. Tablettes Lenovo K11 en mode Portrait & Petits Écrans Stricts (<= 768px ou Portrait) */
@media (max-width: 960px) and (orientation: portrait), (max-width: 767px) {
    html {
        font-size: 13px;
    }
    body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    #banner {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
        max-height: none;
        padding: 4px 8px;
        gap: 4px;
        z-index: 500;
    }
    .banner-left {
        min-width: 0;
        text-align: center;
        align-items: center;
        justify-content: center;
    }
    .banner-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: center;
        padding: 2px 4px;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 5px;
    }
    .banner-nav::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
    .mode-btn {
        padding: 3px 8px;
        font-size: 0.74rem;
        height: 25px;
        min-height: 25px;
    }
    #conteneur_simulation {
        flex-direction: column;
        height: auto;
        min-height: auto;
        overflow: visible;
        padding: 8px 10px;
        gap: 12px;
    }
    .left-column {
        flex: none;
        width: 100%;
        gap: 10px;
    }
    #fenetre-canvas {
        flex: none;
        height: 280px;
        min-height: 240px;
    }
    .right-column {
        flex: none;
        width: 100%;
        height: auto;
        min-height: auto;
    }
    #fenetre2 {
        flex: none;
        min-height: auto;
        overflow: visible;
        padding: 10px;
    }
    #fenetre-informations {
        height: auto;
        min-height: auto;
    }
    .bilan-container {
        max-height: 480px;
        overflow-y: auto;
    }
    .free-mode-inputs-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .free-mode-inputs-grid .free-input-block:nth-child(3) {
        grid-column: span 2;
    }
    #footer {
        position: relative;
        margin-top: auto;
    }
}

/* 3. Smartphones & Petits Écrans Tactiles (<= 640px) */
@media (max-width: 640px) {
    html {
        font-size: 13px;
    }
    #banner {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 6px 8px;
    }
    .banner-left {
        justify-content: center;
        text-align: center;
    }
    .banner-right {
        justify-content: center;
        gap: 6px;
    }
    .banner-right .help-btn {
        font-size: 0.75rem;
        padding: 5px 8px;
    }
    #fenetre-canvas {
        height: 250px;
        min-height: 220px;
    }
    .qcm-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .qcm-choice {
        min-height: 38px;
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    .free-mode-inputs-grid {
        grid-template-columns: 1fr;
    }
    .free-mode-inputs-grid .free-input-block:nth-child(3) {
        grid-column: span 1;
    }
    .action-row {
        flex-direction: column;
        gap: 6px;
    }
    .action-row button {
        width: 100%;
    }
    .qcm-timeline-row {
        gap: 2px;
    }
    .qcm-step-dot {
        font-size: 0.68rem;
        padding: 4px 1px;
        min-height: 24px;
    }
    .modal-card, .pdf-modal-card {
        width: 96%;
        max-height: 94vh;
    }
    .modal-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    /* Pied de page : le texte charte au-dessus, les deux boutons en dessous */
    #footer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px 6px;
        padding: 3px 6px;
    }
    #footer > span {
        flex: 1 1 100%;
        text-align: center;
    }
    .footer-right {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* 4. Écrans Paysage & Laptops Compacts 13-14 pouces (Hauteur utile <= 850px) */
@media (max-height: 850px) and (min-width: 961px) {
    #banner {
        padding: 0 clamp(8px, 1.2vw, 16px);
        height: 36px;
        min-height: 36px;
        max-height: 36px;
        gap: 8px;
        overflow: visible;
    }
    .banner-title {
        font-size: 0.9rem;
    }
    .banner-nav {
        gap: clamp(4px, 0.5vw, 6px);
        overflow: visible;
    }
    .mode-btn {
        padding: 2px 7px;
        font-size: 0.74rem;
        height: 24px;
        min-height: 24px;
        border-radius: 12px;
    }
    .help-btn {
        padding: 2px 8px;
        font-size: 0.74rem;
        height: 24px;
        min-height: 24px;
        border-radius: 12px;
    }
    #conteneur_simulation {
        padding: 4px 8px;
        gap: 8px;
    }
    .left-column {
        flex: 1;
        height: 100%;
        min-height: 0;
    }
    .right-column {
        flex: 1.05;
        height: 100%;
        min-height: 0;
    }
    .canvas-header {
        padding: 3px 8px;
    }
    .canvas-header-title {
        font-size: 0.78rem;
    }
    .toggle-pill {
        padding: 2px 8px;
        font-size: 0.72rem;
        min-height: 24px;
    }
    #fenetre-canvas {
        flex: 1.05;
        min-height: 170px;
    }
    .fenetre2-slot-container {
        flex: 0.95;
        min-height: 0;
    }
    #fenetre2 {
        flex: 1;
        padding: 4px 8px;
        gap: 4px;
        min-height: 0;
    }
    .question-header {
        padding-bottom: 2px;
        margin-bottom: 1px;
    }
    .question-tag {
        font-size: 0.75rem;
    }
    .question-target-box {
        padding: 3px 8px;
        font-size: 0.95rem;
    }
    .question-consigne {
        font-size: 0.78rem;
        margin: 1px 0;
    }
    .qcm-grid {
        gap: 4px;
    }
    .qcm-choice {
        padding: 3px 6px;
        min-height: 28px;
        font-size: 0.8rem;
    }
    .action-row {
        margin-top: 2px;
    }
    .action-row button {
        padding: 3px 10px;
        font-size: 0.8rem;
        min-height: 26px;
    }
    #footer {
        height: 28px;
        min-height: 28px;
        padding: 1px 8px;
        font-size: 0.68rem;
        gap: 6px;
    }
}

/* Modal Générateur PDF */
.pdf-modal-card {
    max-width: 820px;
    width: 92%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

.pdf-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    background: rgba(10, 18, 36, 0.6);
}

.pdf-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
    background: rgba(15, 25, 48, 0.85);
    border-radius: 0 0 14px 14px;
    flex-wrap: wrap;
}

/* --- Grilles et Colonnes pour la Modale Méthodologique --- */
.method-grid-3cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.method-col {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.method-col-title {
    color: var(--gold);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 215, 0, 0.15);
    padding-bottom: 6px;
}

.method-calc-grid {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 6px 8px;
    align-items: center;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-top: 4px;
}

.calc-left {
    text-align: right;
    white-space: nowrap;
}

.calc-eq {
    text-align: center;
    color: var(--gold);
    font-weight: bold;
}

.calc-right {
    text-align: left;
}

.method-tip {
    font-size: 0.85rem;
    color: #e2e8f0;
    background: rgba(255, 215, 0, 0.1);
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 10px;
    text-align: center;
}

/* ==========================================================================
   ACCESSIBILITÉ (B5 / B8 / B10 / B13)
   Bloc volontairement placé en fin de feuille : ces règles doivent primer sur
   les `outline: none` et `user-select` déclarés plus haut.
   ========================================================================== */

/* --- B13. Contenu réservé aux lecteurs d'écran (masqué visuellement) --- */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* --- B5. Focus visible partout (compense les `outline: none` des champs) --- */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible,
tr[role="button"]:focus-visible,
.qcm-choice:focus-visible,
.qcm-step-dot:focus-visible,
.toggle-pill:focus-visible,
.mode-btn:focus-visible,
.footer-btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* Ligne du tableau des préfixes atteinte au clavier : focus doublé d'un fond */
.prefix-table-clean tr[role="button"]:focus-visible {
    background: rgba(255, 215, 0, 0.22) !important;
    outline: 2px solid var(--gold);
    outline-offset: -2px;
}

/* --- B8. Mouvement réduit : neutralise animations et transitions --- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* --- B10. Impression (Ctrl+P) : sortie papier lisible sur fond blanc --- */
@media print {
    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        width: auto !important;
        overflow: visible !important;
        display: block !important;
        background: #ffffff !important;
        background-image: none !important;
        color: #000000 !important;
    }

    #banner,
    #canvas-visual,
    #celebration-canvas,
    .modal-backdrop,
    button,
    .canvas-controls-bar,
    .footer-right {
        display: none !important;
    }

    /* Texte noir sur blanc pour tout le contenu imprimé (les ombres et dégradés sautent) */
    * {
        color: #000000 !important;
        text-shadow: none !important;
        box-shadow: none !important;
        background-image: none !important;
    }

    /* Le code couleurs pédagogique reste distinguable sur papier, en teintes foncées */
    .match-gold { color: #8a6d00 !important; }
    .match-cyan { color: #00706f !important; }
    .match-pink { color: #a3246e !important; }
    .match-orange { color: #a35400 !important; }
    .col-unit { color: #0a6b2b !important; }
    .col-val { color: #000000 !important; }

    #conteneur_simulation,
    .left-column,
    .right-column,
    .fenetre,
    .fenetre2-slot-container,
    #fenetre2,
    .bilan-container,
    .table-scroll-container {
        display: block !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }

    .fenetre,
    .modal-card,
    .qcm-dash-content-box,
    .chrono-dash-info-card,
    .method-col,
    .method-step-box,
    .bilan-formula {
        background: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #999 !important;
        box-shadow: none !important;
    }

    #footer {
        background: #ffffff !important;
        color: #000000 !important;
        border-top: 1px solid #000000 !important;
        backdrop-filter: none !important;
        min-height: 0 !important;
    }

    #footer > span {
        white-space: normal !important;
        overflow: visible !important;
    }

    .prefix-table-clean th,
    .prefix-table th {
        background: #eeeeee !important;
        color: #000000 !important;
    }

    .prefix-table-clean td,
    .prefix-table td {
        color: #000000 !important;
    }
}
