/* Styles CSS pour EQUAELIBRE */

* {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}




/* Container pour les boutons de contrôle dans le panneau calculatrice */
.calculator-controls-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px 10px;
}

/* Bouton Fonctions en vert (même couleur que "calculatrice enclenchée") */
.functions-btn {
    background: #4CAF50 !important;
    color: white !important;
    font-weight: bold !important;
}

.functions-btn:hover {
    background: #45a049 !important;
    transform: translateY(-1px);
}

/* Container pour les boutons du milieu avec espacement */
.middle-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Bouton Annuler détaché avec plus d'espace au-dessus */
.detached-btn {
    margin-top: 0 !important; /* Retiré car déjà géré par le gap du container principal */
}

/* Zone de message de succès intégrée - positionnée au centre */
.success-message-area {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.5), rgba(69, 160, 73, 0.5)); /* Plus transparent */
    border: 3px solid rgba(46, 125, 50, 0.5); /* Bordure plus transparente */
    border-radius: 15px; /* Coins arrondis partout */
    margin: 0;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3); /* Ombre marquée */
    animation: slideInFromTop 0.5s ease-out;
    z-index: 1000;
}

/* Animation d'apparition depuis le haut */
@keyframes slideInFromTop {
    from {
        transform: translateX(-50%) translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.success-text h2 {
    color: white;
    font-size: 32px; /* Augmenté de 24px à 32px */
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.success-text div {
    color: white;
    font-size: 20px; /* Augmenté de 16px à 20px */
    margin: 8px 0;
    font-weight: bold;
}

.success-btn {
    background: #FFC107;
    border: 2px solid #FF8F00;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.success-btn:hover {
    background: #FFD54F;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

@keyframes successSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    background: linear-gradient(135deg, #d6f4f4 0%, #a8e6e6 100%);
    min-height: 100vh;
    /* Supprimé overflow: hidden pour permettre le scroll de page */
}

#game-container {
    width: 1000px;
    min-height: 700px; /* Hauteur minimale au lieu de hauteur fixe */
    margin: 50px auto 20px; /* Marge en bas pour éviter que ça colle */
    position: relative;
    background-color: #d6f4f4;
    border: 2px solid #333;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Gestion des écrans */
.screen {
    width: 100%;
    min-height: 100%;
    display: none;
    background-color: #d6f4f4;
    padding: 0;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Écran de jeu avec positionnement relatif pour les messages de succès */
#game-screen {
    position: relative;
}

/* Écran d'introduction */
.intro-content {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 0;
    margin: 0;
}

.intro-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.intro-content h1 {
    display: none;
}

.author {
    display: none;
}

/* Menu principal */
.menu-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 20px;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    overflow-y: auto;
}

.menu-container h1 {
    font-size: 2.5rem;
    color: #644a96;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    text-align: center;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 700px;
}

.menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    height: 140px;
    width: 100%;
    background: linear-gradient(135deg, #e8f4f4 0%, #d0e8e8 100%);
    border: 3px solid #644a96;
    border-radius: 15px;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 1.8rem;
    font-weight: bold;
    color: #644a96;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.menu-button:hover {
    background: linear-gradient(135deg, #f0f6f6 0%, #d8f0f0 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    color: #d2b50b;
}

.menu-button img {
    width: 50px;
    height: 50px;
}

/* Menu de configuration */
.config-container {
    padding: 20px;
    height: 100%;
    overflow-y: auto;
}

.config-container h2 {
    text-align: center;
    color: #644a96;
    font-size: 2rem;
    margin-bottom: 20px;
}

.config-content {
    display: flex;
    gap: 40px;
    height: calc(100% - 80px);
}

.config-explanation {
    flex: 2;
    font-size: 1rem;
    color: #644a96;
    font-weight: bold;
    line-height: 1.4;
}

.config-explanation p {
    margin-bottom: 10px;
}

.config-explanation hr {
    margin: 15px 0;
    border: 1px solid #644a96;
}

.level-list {
    margin: 10px 0;
}

.config-inputs {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
    position: relative;
    padding-top: 60px;
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.config-header h2 {
    margin: 0;
}

.inputs-right {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: -30px;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.input-group label {
    font-size: 1rem;
    font-weight: bold;
    color: #644a96;
}

.config-input {
    padding: 8px;
    font-size: 1rem;
    border: 3px solid #644a96;
    border-radius: 5px;
    background-color: #fdce24;
    color: #333;
    font-weight: bold;
    text-align: center;
    width: 100%;
}

.start-button {
    padding: 20px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #44a857 0%, #3d9650 100%);
    color: white;
    border: 3px solid #2d7040;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    margin-top: 50px;
}

.start-button:hover {
    background: linear-gradient(135deg, #4eb85f 0%, #47a557 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.config-small-button {
    padding: 2px 20px;
    font-size: 1.2rem;
    font-weight: bold;
    background-color: #666;
    color: white;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px 0;
    width: 300px;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

.config-small-button:hover {
    background-color: #777;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.shortcuts-bottom-right {
    margin: 0;
}

.records-back-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    margin: 0;
}

/* Écran de jeu */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #b8e0e0 0%, #a0d0d0 100%);
    border-bottom: 2px solid #644a96;
    font-weight: bold;
    font-size: 1.25rem;
}

.game-info, .score-info {
    display: flex;
    gap: 30px;
    color: #333;
}

.game-content {
    display: flex;
    flex-direction: row;
    height: calc(100% - 80px);
    padding: 20px;
    gap: 20px;
}

.calculation-steps {
    flex: 1;
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 20px;
    /* Supprimé overflow-y: auto pour permettre la croissance */
}

.calculation-steps h3 {
    color: #644a96;
    font-size: 0.9rem; /* Diminué encore plus de 1.1rem à 0.9rem */
    margin-bottom: 15px;
}

.calculation-step {
    display: flex;
    align-items: baseline; /* Changé de flex-start à baseline */
    gap: 10px;
    margin: 10px 0;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 5px;
    min-height: auto;
    overflow: visible;
}

/* Layout spécifique pour les étapes d'équation */
.calculation-step.equation-step {
    display: block;
}

.step-text {
    color: #644a96;
    font-weight: bold;
    font-size: 1.3rem; /* Augmenté de 1.1rem à 1.3rem */
    flex-shrink: 0;
    line-height: 1.4; /* Assurer une ligne de base cohérente */
}

.step-expression {
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.6rem !important; /* Ajusté de 1.8rem à 1.6rem */
    line-height: 1.4 !important;
    min-height: 2em;
    display: flex;
    align-items: baseline; /* Alignement à la ligne de base */
    overflow: visible;
}

.operation-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    flex-shrink: 0;
}

.right-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
    flex-shrink: 0;
    margin-left: auto;
}

.operation-panel h3 {
    color: #644a96;
    font-size: 1.4rem; /* Augmenté de 1.3rem à 1.4rem */
    text-align: center;
    margin: 0;
}

.operation-inputs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
}

.operation-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border: 2px solid #644a96;
    border-radius: 5px;
    justify-content: center;
}

.operation-icon {
    width: 30px;
    height: 30px;
}

.operation-label {
    flex: 1;
    font-weight: bold;
    color: #644a96;
}

.operation-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #999;
    border-radius: 3px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
}

.operation-input::placeholder {
    font-size: 0.75rem;
    color: #999;
    font-weight: normal;
}

.operation-input:focus {
    border-color: #644a96;
    outline: none;
    background-color: #fffacd;
}

.operation-input.active {
    border-color: #000;
    background-color: #fffacd;
}

.game-controls {
    display: flex;
    flex-direction: row;
    gap: 10px;
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
    justify-content: center;
}

.control-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: all 0.2s ease;
}

#undo-btn {
    background-color: #ccc;
    color: #000;
}

#reset-btn {
    background-color: #ff0000;
    color: white;
}

#back-menu-btn {
    background-color: #4a90e2;
    color: white;
}

#validate-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
    border: 2px solid black;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
    padding: 10px 16px;
    font-size: 16px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.target-expression {
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 0px;
}

.target-expression h3 {
    color: #644a96;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.target-label {
    font-weight: bold;
    color: #333;
}

#target-math {
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.4rem !important;
    line-height: 1.4 !important;
    min-height: 2em;
    display: flex;
    align-items: center;
    overflow: visible;
}

/* Écrans de succès et records */
.success-content, .record-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.success-content h1 {
    font-size: 5rem;
    color: #ff0000;
    margin-bottom: 30px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
}

#success-message, #success-score {
    font-size: 1.5rem;
    color: #ff0000;
    font-weight: bold;
}

.success-btn, #save-record-btn {
    padding: 20px 40px;
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #44a857 0%, #3d9650 100%);
    color: white;
    border: 3px solid #2d7040;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 30px;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: all 0.3s ease;
}

.success-btn:hover, #save-record-btn:hover {
    background: linear-gradient(135deg, #4eb85f 0%, #47a557 100%);
    transform: translateY(-2px);
}

.record-content h2 {
    font-size: 3rem;
    color: #4a90e2;
    margin-bottom: 20px;
}

#record-message {
    font-size: 1.3rem;
    color: #4a90e2;
    font-weight: bold;
    margin-bottom: 30px;
}

.name-input {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.name-input label {
    font-size: 1.3rem;
    font-weight: bold;
    color: #4a90e2;
}

#player-name {
    padding: 12px;
    font-size: 1.2rem;
    border: 3px solid #4a90e2;
    border-radius: 5px;
    text-align: center;
    width: 300px;
    max-width: 90%;
}

/* Styles pour les opérations colorées */
.operations-good {
    color: #44a857 !important;
}

.operations-bad {
    color: #ff0000 !important;
}

/* Responsive design */
@media (max-width: 1020px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        border: none;
    }
    
    .menu-container h1 {
        font-size: 2.2rem;
        margin-bottom: 25px;
    }
    
    .menu-button {
        font-size: 1.6rem;
        height: 120px;
    }
    
    .menu-button img {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 768px) {
    /* Tablettes */
    .config-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .config-explanation {
        font-size: 0.9rem;
    }
    
    .menu-container {
        padding: 15px;
    }
    
    .menu-container h1 {
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .menu-button {
        font-size: 1.4rem;
        height: 110px;
        gap: 15px;
    }
    
    .menu-button img {
        width: 40px;
        height: 40px;
    }
    
    .game-content {
        flex-direction: column;
        padding: 10px;
        gap: 15px;
    }
    
    .calculation-steps {
        flex: none;
        height: 40%;
        min-height: 200px;
    }
    
    .operation-panel {
        flex: none;
    }
    
    .operation-inputs {
        gap: 8px;
    }
    
    .operation-row {
        padding: 6px;
        gap: 6px;
    }
    
    .operation-input {
        width: 55px;
        font-size: 0.8rem;
        padding: 6px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .operation-input::placeholder {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    /* Mobiles */
    .intro-content {
        padding: 0;
    }
    
    .intro-image {
        width: 100%;
        height: 100%;
    }
    
    .menu-container {
        padding: 10px;
    }
    
    .menu-container h1 {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .menu-options {
        max-width: 100%;
        gap: 10px;
    }
    
    .menu-button {
        font-size: 1.2rem;
        height: 100px;
        gap: 10px;
        flex-direction: row;
        text-align: center;
        padding: 10px;
    }
    
    .menu-button img {
        width: 35px;
        height: 35px;
    }
    
    .config-container {
        padding: 10px;
    }
    
    .config-explanation {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    .config-explanation p {
        margin-bottom: 8px;
    }
    
    .config-input {
        padding: 10px;
        font-size: 1rem;
    }
    
    .input-group label {
        font-size: 0.9rem;
    }
    
    .start-button {
        padding: 15px 30px;
        font-size: 1.2rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        font-size: 1rem;
    }
    
    .game-info, .score-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .operation-label {
        font-size: 0.9rem;
    }
    
    .operation-input {
        width: 45px;
        padding: 5px;
        font-size: 0.75rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
        gap: 6px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .target-expression {
        padding: 10px;
        margin-bottom: 15px;
    }
    
    .target-expression h3 {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .success-content h1 {
        font-size: 3rem;
    }
    
    #success-message, #success-score {
        font-size: 1.2rem;
    }
}

@media (max-width: 320px) {
    /* Très petits écrans */
    .menu-container h1 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .menu-options {
        gap: 8px;
    }
    
    .menu-button {
        font-size: 1rem;
        height: 85px;
        padding: 8px;
        gap: 8px;
    }
    
    .menu-button img {
        width: 28px;
        height: 28px;
    }
    
    .config-explanation {
        font-size: 0.75rem;
    }
    
    .operation-input {
        width: 40px;
        padding: 4px;
        font-size: 0.7rem;
    }
    
    .operation-label {
        font-size: 0.75rem;
    }
    
    .control-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Animations */
@-webkit-keyframes fadeIn {
    from { opacity: 0; -webkit-transform: translateY(20px); }
    to { opacity: 1; -webkit-transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.screen.active {
    -webkit-animation: fadeIn 0.5s ease-in-out;
    animation: fadeIn 0.5s ease-in-out;
}

/* Configuration MathJax pour éviter le redimensionnement automatique */
.MathJax_Display {
    text-align: center !important;
    margin: 0.5em 0 !important;
}

/* Éviter le flash de redimensionnement */
#calculation-list {
    min-height: 60px;
    transition: none !important;
}

.MathJax {
    line-height: inherit !important;
    overflow: visible !important;
}

.MathJax_SVG {
}

.MathJax_SVG_Display {
    text-align: center !important;
    margin: 0.5em 0 !important;
}

/* Forcer MathJax à maintenir une taille constante pour toutes les fractions */
.MathJax_SVG .MJX-tex-math {
    font-size: 1.2rem !important;
    transform: scale(1) !important;
}

/* Styles spécifiques pour MathJax 3 (CHTML) */
mjx-container {
    line-height: 1.4 !important;
}

mjx-container mjx-math {
}

/* Empêcher la réduction des fractions imbriquées */
mjx-container mjx-mfrac,
mjx-container mjx-mfrac mjx-num,
mjx-container mjx-mfrac mjx-den {
    transform: scale(1) !important;
}

/* Forcer une taille constante pour tous les éléments mathématiques */
mjx-container * {
    font-size: inherit !important;
}

/* Règles plus spécifiques pour forcer la taille des expressions */
.step-expression mjx-container,
.target-math-inline mjx-container {
    font-size: 1.6rem !important; /* Ajusté de 1.8rem à 1.6rem */
}

.step-expression mjx-container mjx-math,
.target-math-inline mjx-container mjx-math {
    font-size: 1.6rem !important; /* Ajusté de 1.8rem à 1.6rem */
}

/* Section du haut avec expression et boutons */
.top-section {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: flex-start;
}

/* Expression cible - largeur ajustée */
.target-expression-top {
    flex: 1; /* Prend l'espace disponible moins le bouton */
    background: white;
    border: 3px solid #644a96;
    border-radius: 10px;
    padding: 10px 15px;
    display: flex;
    align-items: baseline; /* Changé de center à baseline pour un meilleur alignement */
    gap: 15px;
    min-height: 50px;
    overflow: visible; /* Changé de hidden à visible */
}

.target-label {
    color: #644a96;
    font-size: 1.4rem; /* Augmenté de 1.2rem à 1.4rem */
    font-weight: bold;
    flex-shrink: 0;
    white-space: nowrap;
    line-height: 1.4; /* Assurer une ligne de base cohérente */
}

.target-math-inline {
    flex: 1;
    display: flex;
    align-items: baseline; /* Alignement à la ligne de base */
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.6rem !important; /* Ajusté de 1.8rem à 1.6rem */
    line-height: 1.4 !important; /* Cohérent avec le label */
    overflow: visible;
    min-height: 30px;
    /* Supprimé overflow-x: auto pour éviter le scroll */
    max-width: 100%;
}

/* Container pour les boutons du haut */
.top-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 80px;
}

/* Bouton reset repositionné */
.reset-btn-top {
    width: 80px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ff0000;
    color: white;
    border: 3px solid #cc0000;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

.reset-btn-top:hover {
    background-color: #ff3333;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* Bouton menu repositionné */
.menu-btn-top {
    width: 80px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4a90e2;
    color: white;
    border: 3px solid #357abd;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
}

.menu-btn-top:hover {
    background-color: #5ba0f2;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* Layout pour le jeu de construction */
.construction-layout {
    display: flex;
    flex: 1;
    gap: 20px;
    /* Supprimé height fixe pour permettre la croissance automatique */
}

/* Classes utilitaires pour les notifications */
.notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #644a96;
    color: white;
    text-align: center;
    padding: 15px;
    font-weight: bold;
    font-size: 1.2rem;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateY(0);
}

.notification.error {
    background: #ff0000;
}

.notification.success {
    background: #44a857;
}

.notification.warning {
    background: #9c88c4;
    color: white;
}

.notification.black {
    background: #000000;
    color: white;
}

/* Interface de résolution symétrique - 3 colonnes */
.equation-learning-layout {
    display: grid;
    grid-template-columns: 150px 1fr 150px;
    gap: 15px;
    flex: 1;
    padding: 15px;
}

/* Ligne du bas avec solution directe et boutons */
.bottom-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    gap: 20px;
}

/* Solution directe à gauche */
.direct-solution {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 8px 12px;
}

.solution-label {
    color: #28a745;
    font-weight: bold;
    font-size: 1.1rem;
}

.direct-solution .operation-icon {
    width: 20px;
    height: 20px;
}

.direct-solution .equation-input {
    border-color: #28a745;
    background: #f8fff9;
    width: 60px;
}

/* Boutons de contrôle à droite */
.game-controls-right {
    display: flex;
    gap: 10px;
}

/* Panneau d'opérations à droite pour construction/déconstruction */
.right-operations-panel {
    width: 100px;
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid #644a96;
    border-radius: 8px;
    padding: 8px;
}

.right-operations-panel h4 {
    color: #644a96;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 8px;
    font-weight: bold;
}

.right-operations-panel .operation-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.right-operations-panel .operation-row-eq {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 30px;
}

.right-operations-panel .operation-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.right-operations-panel .equation-input {
    width: 45px;
    padding: 4px 2px;
    border: 2px solid #ced4da;
    border-radius: 3px;
    text-align: center;
    font-size: 0.85rem;
    background: white;
    font-weight: bold;
}

/* Interface largeur complète pour construction/déconstruction */
.wide-calculation-steps {
    flex: 1;
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.wide-calculation-steps h3 {
    color: #644a96;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.bottom-section {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.operations-section {
    flex: 1;
}

.operations-section h4 {
    color: #644a96;
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.operations-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.operation-row-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border: 2px solid #644a96;
    border-radius: 5px;
}

.operation-row-compact .operation-icon {
    width: 20px;
    height: 20px;
}

.operation-row-compact .equation-input {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid #ced4da;
    border-radius: 3px;
    text-align: center;
    font-size: 0.9rem;
    background: white;
    font-weight: bold;
}

.target-and-controls, .controls-only {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

.target-and-controls .target-expression {
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
    min-width: 200px;
}

.controls-only .game-controls, .target-and-controls .game-controls {
    display: flex;
    gap: 10px;
}

/* Colonnes latérales d'opérations */
.left-operations, .right-operations {
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid #644a96;
    border-radius: 8px;
    padding: 8px;
}

.left-operations h4, .right-operations h4 {
    color: #644a96;
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 8px;
    font-weight: bold;
}

.operation-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* Lignes d'opérations dans l'interface symétrique */
.operation-row-eq {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-height: 45px;
}

.operation-row-eq .operation-icon {
    width: 33px;
    height: 28px;
    flex-shrink: 0;
}

/* Inputs pour l'interface symétrique */
.equation-input {
    width: 80px;
    padding: 8px 6px;
    border: 2px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 1rem;
    background: white;
    font-weight: bold;
}

.equation-input[data-operation="xvalue"] {
    width: 75px;
}

.equation-input:focus {
    outline: none;
    border-color: #644a96;
    background-color: #fffacd;
    box-shadow: 0 0 0 0.2rem rgba(100, 74, 150, 0.25);
}

/* Input spécial pour la solution */
.equation-input[data-operation="solve"] {
    border-color: #28a745;
    background: #f8fff9;
    font-weight: bold;
}

.equation-input[data-operation="solve"]:focus {
    border-color: #20c997;
    background: #e8f5e8;
    box-shadow: 0 0 0 0.2rem rgba(32, 201, 151, 0.25);
}

/* Colonne centrale - programme de calcul */
.calculation-steps {
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 20px;
    overflow-y: auto;
}

.calculation-steps h3 {
    color: #644a96;
    font-size: 1.5rem;
    margin-bottom: 15px;
    text-align: center;
}

/* Description des étapes */
.step-description {
    color: #644a96;
    font-weight: bold;
    font-size: 1.3rem;
    margin: 5px 0;
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 3px;
}

/* Étapes d'équation */
.equation-step {
    margin: 5px 0;
    padding: 10px;
    background: #f8f8f8;
    border-radius: 5px;
    border-left: 4px solid #644a96;
}

.equation-step .step-text {
    display: inline;
    margin-right: 8px;
    color: #644a96;
    font-weight: bold;
    font-size: 1.1rem;
}

.equation-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.6rem !important;
    line-height: 1.4 !important;
    min-height: auto;
    overflow: visible;
}

.equation-equals {
    color: #644a96;
    font-weight: bold;
    font-size: 1.2rem !important;
    line-height: 1.4 !important;
    min-height: 2em;
    display: flex;
    align-items: center;
    padding-top: 2px;
}

/* Responsive pour l'interface symétrique */
@media (max-width: 768px) {
    .equation-learning-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 15px;
        padding: 10px;
    }
    
    .left-operations, .right-operations {
        padding: 10px;
    }
    
    .operation-row-eq {
        padding: 6px;
        min-height: 40px;
    }
    
    .equation-input {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
}

@media (max-width: 480px) {
    .equation-learning-layout {
        gap: 10px;
        padding: 5px;
    }
    
    .left-operations h4, .right-operations h4 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .operation-row-eq .operation-icon {
        width: 20px;
        height: 20px;
    }
    
    .equation-input {
        font-size: 0.8rem;
        padding: 5px 6px;
        min-width: 50px;
    }
}

/* ====== STYLES POUR LE MODE PLEIN ÉCRAN ====== */

/* Cache les nouvelles expressions et titres pendant le rendu en mode fullscreen */
.fullscreen-mode mjx-container:not([data-fullscreen-styled]) {
    opacity: 0;
}

.fullscreen-mode mjx-container[data-fullscreen-styled] {
    opacity: 1;
    transition: opacity 0.1s ease;
}

.fullscreen-mode .step-text:not([data-fullscreen-styled]) {
    opacity: 0;
}

.fullscreen-mode .step-text[data-fullscreen-styled] {
    opacity: 1;
    transition: opacity 0.1s ease;
}

.fullscreen-mode .target-label:not([data-fullscreen-styled]) {
    opacity: 0;
}

.fullscreen-mode .target-label[data-fullscreen-styled] {
    opacity: 1;
    transition: opacity 0.1s ease;
}

/* Container principal en plein écran */
:fullscreen .game-container,
:-webkit-full-screen .game-container,
:-moz-full-screen .game-container {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 20px !important;
}

/* Interface de résolution en plein écran */
:fullscreen .equation-learning-layout,
:-webkit-full-screen .equation-learning-layout,
:-moz-full-screen .equation-learning-layout {
    grid-template-columns: 250px 1fr 250px !important;
    gap: 30px !important;
    padding: 30px !important;
}

/* Éléments agrandis en plein écran */
:fullscreen .operation-row-eq,
:-webkit-full-screen .operation-row-eq,
:-moz-full-screen .operation-row-eq {
    min-height: 60px !important;
    padding: 12px !important;
    gap: 12px !important;
}

:fullscreen .operation-row-eq .operation-icon,
:-webkit-full-screen .operation-row-eq .operation-icon,
:-moz-full-screen .operation-row-eq .operation-icon {
    width: 40px !important;
    height: 40px !important;
}

:fullscreen .equation-input,
:-webkit-full-screen .equation-input,
:-moz-full-screen .equation-input {
    width: 120px !important;
    font-size: 1.4rem !important;
    padding: 12px 8px !important;
}

:fullscreen .left-operations h4,
:fullscreen .right-operations h4,
:-webkit-full-screen .left-operations h4,
:-webkit-full-screen .right-operations h4,
:-moz-full-screen .left-operations h4,
:-moz-full-screen .right-operations h4 {
    font-size: 1.6rem !important;
    margin-bottom: 15px !important;
}

/* Construction/Déconstruction en plein écran */
:fullscreen .construction-layout,
:-webkit-full-screen .construction-layout,
:-moz-full-screen .construction-layout {
    gap: 40px !important;
}

:fullscreen .right-panel,
:-webkit-full-screen .right-panel,
:-moz-full-screen .right-panel {
    width: 200px !important;
}

:fullscreen .operation-row,
:-webkit-full-screen .operation-row,
:-moz-full-screen .operation-row {
    min-height: 55px !important;
    padding: 10px !important;
}

:fullscreen .operation-row .operation-icon,
:-webkit-full-screen .operation-row .operation-icon,
:-moz-full-screen .operation-row .operation-icon {
    width: 36px !important;
    height: 36px !important;
}

:fullscreen .operation-input,
:-webkit-full-screen .operation-input,
:-moz-full-screen .operation-input {
    width: 100px !important;
    font-size: 1.3rem !important;
    padding: 10px !important;
}

/* Textes et étapes agrandis */
:fullscreen .calculation-steps,
:-webkit-full-screen .calculation-steps,
:-moz-full-screen .calculation-steps {
    font-size: 1.2rem !important;
    padding: 30px !important;
}

:fullscreen .target-label,
:-webkit-full-screen .target-label,
:-moz-full-screen .target-label {
    font-size: 1.4rem !important;
}

/* ====== STYLES POUR LE JEU DE DÉVELOPPEMENT ====== */

.development-layout {
    display: flex;
    gap: 20px;
    height: 100%;
}

.development-layout .calculation-steps {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.expression-to-develop {
    flex: 1;
    background: white;
    border: 3px solid #644a96;
    border-radius: 10px;
    padding: 10px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 50px;
    overflow: visible;
    margin-bottom: 20px;
}

.expression-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    min-height: 30px;
}

.source-expression {
    flex: 1;
    display: flex;
    align-items: baseline;
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.6rem !important;
    line-height: 1.4 !important;
    overflow: visible;
}

.source-expression .math-expression {
    color: #d2b50b !important;
    font-size: 2rem !important;
    font-weight: bold !important;
}

/* Assurer que les expressions mathématiques dans development sont jaunes */
.source-expression mjx-container,
.source-expression mjx-container mjx-math,
.source-expression mjx-container mjx-math * {
    color: #d2b50b !important;
}

.answer-construction {
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 0px;
}

.answer-construction h4 {
    color: #644a96;
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: bold;
}

.answer-fields {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.development-input {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #4CAF50;
    border-radius: 5px;
    padding: 10px;
    font-size: 1.1rem;
    width: 50px;
    text-align: center;
}

.development-input.sign-input {
    width: 50px;
}

.development-input:focus {
    outline: none;
    border-color: #FF9800;
    box-shadow: 0 0 5px rgba(255, 152, 0, 0.5);
}

.multiply-symbol {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

.variable-drop-zone {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed #4CAF50;
    border-radius: 5px;
    padding: 10px;
    width: 50px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.variable-drop-zone.drag-over {
    background: rgba(76, 175, 80, 0.3);
    border-color: #8BC34A;
}

.variable-drop-zone.has-variable {
    background: rgba(76, 175, 80, 0.2);
    border-style: solid;
}

.drop-hint {
    color: #aaa;
    font-style: italic;
    font-size: 0.9rem;
}

.selected-variable {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

.validate-btn {
    background-color: #4CAF50;
    color: white;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.validate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Bouton Annuler dans le cadre blanc */
.development-layout .game-controls .control-btn {
    background-color: #ccc;
    color: #000;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: all 0.2s ease;
}

.development-layout .game-controls .control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}


/* Panneau de droite identique au jeu 1 */
.development-layout .right-panel {
    width: 200px;
}

.development-layout .right-panel h3 {
    color: #644a96;
    font-size: 1.4rem;
    text-align: center;
    margin: 0;
    margin-bottom: 15px;
}

.development-layout .variable-tiles {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.variable-tile {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: grab;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 2px solid #E65100;
    transition: all 0.3s ease;
    text-align: center;
    width: 50px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.variable-tile:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.variable-tile.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Boutons Reset/Menu en haut SANS cadre */
.top-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-left: 20px;
}

/* Bouton Annuler AVEC cadre blanc */
.development-layout .game-controls {
    display: flex;
    flex-direction: row;
    gap: 10px;
    background: white;
    border: 2px solid #644a96;
    border-radius: 10px;
    padding: 15px;
    justify-content: center;
}

/* Styles pour boutons Reset/Menu en haut */
.reset-btn-top, .menu-btn-top {
    padding: 8px 12px;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid #333;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Comic Sans MS', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
    transition: all 0.2s ease;
}

.reset-btn-top:hover, .menu-btn-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Suppression de l'ancien style du bouton valider dans le panneau */

/* Résultat dynamique dans le container expression-to-develop */
.dynamic-result {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-height: 30px;
    padding-left: 0;
    border-top: 1px solid #e0e0e0;
    padding-top: 10px;
    margin-top: 5px;
}

.equals-sign {
    color: #4CAF50;
    font-size: 1.4rem;
    font-weight: bold;
    flex-shrink: 0;
}

.dynamic-expression {
    flex: 1;
    color: #d2b50b;
    font-weight: bold;
    font-size: 1.4rem !important;
    line-height: 1.4 !important;
    display: flex;
    align-items: baseline;
}

/* Assurer que les expressions mathématiques dynamiques sont jaunes */
.dynamic-expression mjx-container,
.dynamic-expression mjx-container mjx-math,
.dynamic-expression mjx-container mjx-math * {
    color: #d2b50b !important;
}

/* Container des vignettes d'éléments */
.elements-container {
    background: white;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 10px;
}

.element-tiles {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.element-tile {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid #E65100;
    text-align: center;
    min-width: 30px;
}

/* ====== NOUVEAU SYSTÈME DRAG & DROP ====== */

/* Vignettes déplaçables dans le panneau de droite */
.draggable-elements {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.draggable-tile {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: grab;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    border: 2px solid #E65100;
    transition: all 0.3s ease;
    text-align: center;
    width: 50px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.draggable-tile.sign-tile {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #2E7D32;
}

.draggable-tile:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.draggable-tile.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

/* Zone de construction de la réponse */
.answer-construction-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Zones de dépôt */
.drop-zone {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed #4CAF50;
    border-radius: 5px;
    padding: 10px;
    width: 50px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone.drag-over {
    background: rgba(76, 175, 80, 0.3);
    border-color: #8BC34A;
    border-style: solid;
}

.drop-zone.filled {
    background: rgba(76, 175, 80, 0.2);
    border-style: solid;
}

.drop-hint {
    color: #aaa;
    font-style: italic;
    font-size: 0.8rem;
}

.dropped-element {
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
}

.operator {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Tableau de développement */
.development-grid {
    margin: 20px 0;
}

.grid-table {
    border-collapse: collapse;
    margin: 0 auto;
}

.grid-cell {
    width: 50px;
    height: 50px;
    border: 2px solid #4CAF50;
    background: rgba(255, 255, 255, 0.1);
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    transition: all 0.3s ease;
}

.grid-cell:hover {
    background: rgba(76, 175, 80, 0.2);
}

.grid-cell.drag-over {
    background: rgba(76, 175, 80, 0.4);
    border-color: #4CAF50;
}

/* Styles pour les raccourcis clavier */
.shortcuts-explanation {
    max-width: 600px;
    margin: 0 auto;
}

.shortcut-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 0;
    font-size: 18px;
    color: #8B5CF6;
    display: flex;
    align-items: center;
}

.shortcut-item strong {
    background: rgba(76, 175, 80, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    margin-right: 12px;
    min-width: 80px;
    text-align: center;
    font-family: monospace;
}

/* === RECORDS UI === */
.records-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.records-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.records-current-game {
    text-align: center;
    margin-bottom: 30px;
}

.records-current-game h2 {
    color: #4CAF50;
    font-size: 1.8rem;
    margin: 0;
    font-weight: bold;
}

.records-tab {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.records-tab.active,
.records-container .records-tab.active,
.records-tabs .records-tab.active {
    background-color: #4CAF50 !important;
    background: #4CAF50 !important;
    color: white !important;
    border: 2px solid #4CAF50 !important;
    border-color: #4CAF50 !important;
}

.records-tab:not(.active):hover {
    background: #f0f0f0;
    border-color: #4CAF50;
}

.records-levels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.level-records {
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    background: #f9f9f9;
}

.level-records h3 {
    text-align: center;
    margin: 0 0 15px 0;
    color: #333;
}

.records-table {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.record-row {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
    align-items: center;
    padding: 8px;
    border-radius: 5px;
    background: white;
}

.record-row.player-record {
    background: #e8f5e8;
}

.record-row.initial-record {
    background: #fff3cd;
    font-style: italic;
}

.record-row.empty-record {
    background: #f8f8f8;
    color: #999;
}

.record-position {
    font-size: 18px;
    text-align: center;
}

.record-pseudo {
    font-weight: bold;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-time {
    text-align: right;
    font-family: monospace;
    font-weight: bold;
}

.records-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* ====== MASQUER LES RACCOURCIS CLAVIER SUR MOBILE/TABLETTE ====== */
@media (max-width: 1024px) {
    #shortcuts-btn {
        display: none !important;
    }
}

/* ====== IPAD: MÊME LAYOUT QUE MOBILE (PORTRAIT ET PAYSAGE) ====== */
@media (min-width: 481px) and (max-width: 1366px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        font-size: 1rem;
    }
    
    .game-info, .score-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* ====== FORCER POUR TOUS LES APPAREILS TACTILES ====== */
@media (pointer: coarse) {
    .game-header {
        flex-direction: column !important;
        gap: 10px !important;
        text-align: center !important;
        font-size: 1rem !important;
    }
    
    .game-info, .score-info {
        flex-direction: column !important;
        gap: 5px !important;
    }
}

