/* === GENERAL & ACCUEIL === */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; background-color: #333; color: #eee; transition: background-color 0.3s; }
#welcome-screen { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }
.welcome-container { text-align: center; background-color: #282c34; padding: 40px; border-radius: 10px; width: 450px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.welcome-container h1 { font-size: 3em; color: #61dafb; margin-top: 0; }
.welcome-container p { font-size: 1.1em; color: #aaa; }
.mode-selection { display: flex; gap: 20px; margin: 40px 0; }
.mode-button { flex-grow: 1; padding: 15px 20px; font-size: 18px; cursor: pointer; border: 1px solid #61dafb; background-color: transparent; color: #61dafb; border-radius: 5px; transition: all 0.2s ease; }
.mode-button:hover { background-color: #61dafb; color: #282c34; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(97, 218, 251, 0.3); }
.options-panel { border-top: 1px solid #444; padding-top: 30px; }
#cadence-options { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.cadence-button { padding: 10px; font-size: 14px; flex-grow: 1; border-color: #555; color: #bbb; }
.cadence-button:hover { border-color: #61dafb; color: #61dafb; }
#custom-cadence { margin-bottom: 20px; color: #bbb; }
#custom-cadence input { width: 60px; padding: 8px; background: #333; color: white; border: 1px solid #555; border-radius: 3px; text-align: center; }
.start-button { width: 100%; margin-top: 10px; font-weight: bold; }

/* === INTERFACE DE JEU === */
#game-wrapper { background-color: #f0f0f0; color: #333; padding: 20px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); }
.main-container { display: flex; gap: 30px; }
#game-area { display: flex; flex-direction: column; align-items: center; }
#echiquier-container { position: relative; margin: 10px 0; border: 2px solid black; }
#echiquier { display: grid; grid-template-columns: repeat(8, 60px); grid-template-rows: repeat(8, 60px); width: fit-content; }
.case { width: 60px; height: 60px; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; }
.piece { max-width: 85%; max-height: 85%; pointer-events: none; }
.player-clock { font-size: 2.5em; font-family: 'Courier New', Courier, monospace; background-color: #333; color: #fff; padding: 5px 20px; border-radius: 5px; width: 250px; text-align: center; margin: 10px 0; border: 3px solid transparent; transition: border-color 0.3s; }
.active-clock { border-color: #61dafb; }
.info-container { display: flex; gap: 20px; align-items: center; }
#game-status { color: firebrick; font-weight: bold; min-height: 24px; }
.controls-container { display: flex; gap: 10px; margin-top: 10px; align-items: center; }
.control-button, #theme-selector, #next-puzzle-btn { padding: 10px 15px; font-size: 14px; cursor: pointer; border: 1px solid #555; border-radius: 4px; background: #eee; }
.control-button:disabled { cursor: not-allowed; opacity: 0.5; }
.hidden { display: none !important; }
#history-area { width: 200px; padding: 10px; background-color: white; border: 1px solid #ccc; height: 600px; overflow-y: auto; }
#history-list { padding-left: 20px; list-style-type: decimal; margin: 0; }
#history-list li { margin-bottom: 5px; display: flex; gap: 10px; }

/* === HIGHLIGHTS === */
.highlight::after { content: ''; position: absolute; width: 35%; height: 35%; background: rgba(0, 0, 0, 0.2); border-radius: 50%; }
.selected-piece { background-color: rgba(97, 218, 251, 0.5) !important; }
.in-check { background-color: rgba(255, 0, 0, 0.5) !important; }
.last-move { background-color: rgba(204, 212, 53, 0.4) !important; }

/* === THÈMES === */
.theme-default .blanche { background-color: #f0d9b5; } .theme-default .noire { background-color: #b58863; }
.theme-wood .blanche { background-color: #e3c16f; } .theme-wood .noire { background-color: #b78962; } .theme-wood #game-wrapper { background-color: #4a3b2a; color: #f0f0f0; }
.theme-ocean .blanche { background-color: #cdd6f4; } .theme-ocean .noire { background-color: #7287fd; } .theme-ocean #game-wrapper { background-color: #1e1e2e; color: #cdd6f4; } .theme-ocean .player-clock { background-color: #313244; }

/* === MODE PUZZLE === */
#puzzle-info { text-align: center; margin-top: 10px; padding: 10px; background: #e9ecef; color: #495057; border-radius: 5px; width: 100%; }
#puzzle-description { margin: 0 0 10px 0; font-size: 1.1em; }
.modal { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: rgba(255, 255, 255, 0.95); border: 2px solid #333; border-radius: 5px; padding: 10px; z-index: 100; text-align: center; display: flex; gap: 10px; }
.promotion-choice { width: 60px; height: 60px; font-size: 50px; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 1px solid #ccc; }
.promotion-choice:hover { background-color: #ddd; }

/* AMÉLIORATION : Règles de thèmes pour l'historique */
.theme-wood #history-area {
    background-color: #5f4a35;
    color: #f0f0f0;
    border-color: #8a6d4a;
}
.theme-ocean #history-area {
    background-color: #181825;
    color: #cdd6f4;
    border-color: #313244;
}
.theme-ocean #history-list {
    list-style-type: none; /* Le décimal par défaut est parfois foncé */
    padding-left: 5px;
}
/* Pour s'assurer que le numéro de coup soit aussi clair */
.theme-wood #history-list li, .theme-ocean #history-list li {
    color: inherit; 
}