@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    --active: #4c97bc8a;
    --pieces-black: #38454c;
    --pieces-white: #f4f8fa;
    --board-black: #b7cdd8;
    --board-white: #e8f3f9;
}

* {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.lobby {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: linear-gradient(
        135deg,
        var(--board-white) 0%,
        var(--board-black) 100%
    );
    position: relative;
}

/* Menu Navigation en haut à gauche */

/* Contenu central */
.center-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    z-index: 50;
}

/* Affichage du joueur au centre */
.player-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-piece {
    width: 160px;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.3));
}

/* Panneau de contrôle */
.bottom-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.game-mode-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid var(--board-black);
    width: 320px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.section-title {
    margin-top: 16px;
    color: var(--pieces-black);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 15px;
    text-transform: uppercase;
    opacity: 0.6;
}

.mode-card {
    background: var(--board-white);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--board-black);
    transition: all 0.3s ease;
}

.mode-card:hover {
    background: var(--board-black);
}

.mode-icon {
    font-size: 48px;
    color: var(--pieces-black);
}

.mode-info h4 {
    color: var(--pieces-black);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.mode-info p {
    color: var(--pieces-black);
    font-size: 14px;
    opacity: 0.7;
}

.color-info {
    display: block;
}

.color-info div {
    display: flex;
    justify-items: stretch;
    justify-content: space-evenly;
}

.color-info div button {
    background: #ffffffff;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--board-black);
    transition: all 0.3s ease;
}

.color-info div button:active {
    background: var(--board-black);
}

.color-info div .selected {
    background: var(--board-white);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 2px solid var(--board-black);
    transition: all 0.3s ease;
}

.color-info div button img {
    height: 3em;
    width: 3em;
}

.difficulty-info {
    display: none;
}

.difficulty-info div {
    display: flex;
    justify-content: space-evenly;
}

.difficulty-info div p {
    color: var(--pieces-black);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;

    font-size: clamp(12px, 16px, 16px);
    white-space: nowrap;
    width: 100%;
}

.play-button {
    background: var(--pieces-black);
    border: none;
    color: white;
    padding: 18px 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    box-shadow: 0 6px 20px rgba(56, 69, 76, 0.3);
    width: 320px;
    text-decoration: none;
    display: block;
    text-align: center;
}

.play-button:hover {
    background: #2c3942;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 69, 76, 0.4);
}

.play-button:active {
    transform: translateY(-1px);
}

/* ============================================
   POPUP DE SÉLECTION DE MODE (LOBBY)
   ============================================ */

.mode-selection-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.mode-selection-content {
    background: white;
    border-radius: 16px;
    padding: 40px 50px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 500px;
    border: 3px solid var(--board-black);
}

.mode-selection-title {
    color: var(--pieces-black);
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.mode-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.mode-option-card {
    background: var(--board-white);
    border: 2px solid var(--board-black);
    border-radius: 12px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-option-card:hover {
    background: var(--board-black);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.mode-option-icon {
    font-size: 56px;
    margin-bottom: 15px;
}

.mode-option-name {
    color: var(--pieces-black);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-option-desc {
    color: var(--pieces-black);
    font-size: 14px;
    margin: 0;
    opacity: 0.7;
}

.mode-close-btn {
    background: var(--pieces-black);
    color: white;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(56, 69, 76, 0.3);
}

.mode-close-btn:hover {
    background: #2c3942;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(56, 69, 76, 0.4);
}

/* ============================================
   GAME STYLES (Styles du jeu d'échecs)
   ============================================ */

/* Bouton retour au menu en haut à gauche */
.back-to-menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--board-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: var(--pieces-black);
}

.back-to-menu-btn:hover {
    background: var(--board-black);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.back-to-menu-btn svg {
    width: 24px;
    height: 24px;
}

.centre {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

h1 {
    text-align: center;
    color: var(--pieces-black);
}

#plateau {
    display: grid;
    grid-template-columns: repeat(8, 90px);
    grid-template-rows: repeat(8, 90px);
    border: 8px solid #ffffff;
    border-radius: 8px;
    width: fit-content;
    transition: transform 0.6s ease;
}

.carre {
    width: 90px;
    height: 90px;
    position: relative;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.carre.blanc {
    background-color: var(--board-white);
}

.carre.noir {
    background-color: var(--board-black);
}

.highlight {
    width: 90px;
    height: 90px;
    background: var(--active);
    position: absolute;
    display: none;
}

.coo_dispo {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-radius: 100%;
    background: var(--active);
    z-index: 15;
    display: none;
    position: absolute;
}

.check {
    width: 90px;
    height: 90px;
    background: rgba(255, 0, 0, 0.5);
    position: absolute;
    display: none;
}

.piece {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    position: absolute;
    object-fit: contain;
    z-index: 10;
    transition: opacity 0.2s ease;
}

.piece.moving {
    z-index: 1000;
}

.piece.fade-out {
    opacity: 0;
}

.piece-animating {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    transition: transform 0.3s ease;
}

.rotateBoard,
.rotateBoard .carre,
.rotateBoard .coo_dispo,
.rotateBoard .highlight {
    transform: rotate(180deg);
}

/* Overlay pour bloquer les interactions */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    display: none;
}

/* Popup de fin de partie */
.game-over-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.game-over-content {
    background: white;
    border-radius: 16px;
    padding: 40px 50px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 400px;
    border: 3px solid var(--board-black);
}

.game-over-title {
    color: var(--pieces-black);
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.game-over-winner {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--pieces-black);
}

.game-over-winner #winner-color {
    color: var(--pieces-black);
    font-weight: 900;
    text-transform: uppercase;
}

.game-over-reason {
    font-size: 18px;
    color: var(--pieces-black);
    margin-bottom: 30px;
    opacity: 0.7;
    font-weight: 500;
}

.menu-return-btn {
    background: var(--pieces-black);
    color: white;
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(56, 69, 76, 0.3);
}

.menu-return-btn:hover {
    background: #2c3942;
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(56, 69, 76, 0.4);
}

/* Popup de promotion */
.promotion-popup {
    position: absolute;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.promotion-popup h3 {
    margin: 0 0 10px 0;
    color: var(--pieces-black);
    font-size: 18px;
    text-align: center;
    font-weight: 600;
}

.promotion-choices {
    display: grid;
    grid-template-columns: repeat(2, 70px);
    grid-template-rows: repeat(2, 70px);
    gap: 10px;
}

.promotion-btn {
    background: var(--board-white);
    border: none;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
}

.promotion-btn:hover {
    background: var(--active);
}

.promotion-btn img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Timer */

.plateau-zone {
    width: 816px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 10px;
    box-sizing: border-box;
}

.plateau-zone-top {
    margin-bottom: 5px;
}

.plateau-zone-bottom {
    margin-top: 5px;
}

.timer-container {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 10px 18px;
    min-width: 90px;
    text-align: center;
}

.timer-white {
    background: #f4f8fa;
}

.timer-black {
    background: #38454c;
}

.timer-container:not(.active) {
    opacity: 0.5;
}

.timer-container.active {
    opacity: 1;
}

.timer-display {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: 600;
    color: #838383;
    letter-spacing: 1px;
}

.timer-minutes-white,
.timer-seconds-white,
.timer-minutes-black,
.timer-seconds-black {
    display: inline-block;
    min-width: 1.2em;
}

.centre.timers-inversed .plateau-zone-top {
    order: 2;
}

.centre.timers-inversed .plateau-zone-bottom {
    order: 0;
}

.centre.timers-inversed #plateau {
    order: 1;
}

.timer-info div button {
    background: #ffffffff;
    border: 2px solid var(--board-black);
    border-radius: 8px;
    width: 30%;
    height: 3em;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 3px
}

.timer-info div button:active {
    background: var(--board-black);
}

.timer-info div .selected {
    background: var(--board-white);
    border: 2px solid var(--board-black);
    border-radius: 8px;
    width: 30%;
    height: 3em;
    cursor: pointer;
    gap: 15px;
    transition: all 0.3s ease;
}

.banner {
    width: 10%;
    display: block;
    margin: 0 auto; /* Centre horizontalement */
}

.logo {
    width: 40%;
    display: block;
    margin: 0 auto; /* Centre horizontalement */
}