/* ============================================
   Reversi - Feuille de style (intégration omesjeux)
   Présentation inspirée de pulsepattern (fond dégradé
   violet, conteneur centré) + plateau bois doré du jeu.
   Tout est scopé sous #game-main pour ne pas fuir.
   ============================================ */

#game-main {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    color: #f4e4bc;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

#game-main * {
    box-sizing: border-box;
}

#game-main #game-container {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 15px 24px;
    gap: 10px;
}

/* --- En-tête --- */
#game-main #game-header {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

#game-main #game-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
    font-weight: 700;
    background: linear-gradient(90deg, #00d2ff, #7b2ff7, #ff6fd8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

#game-main .subtitle {
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    color: #b9a6e0;
    font-style: italic;
}

/* --- Scores --- */
#game-main .scoreboard {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(123, 47, 247, 0.4);
    border-radius: 12px;
    padding: 8px 10px;
}

#game-main .player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

#game-main .player .label {
    font-size: clamp(0.65rem, 2.2vw, 0.8rem);
    color: #b9a6e0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#game-main .player .score {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
}

#game-main .player.best .score {
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

#game-main .pawn-mini {
    width: clamp(18px, 4vw, 26px);
    height: clamp(18px, 4vw, 26px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #555, #000 70%);
    box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.5);
}

#game-main .pawn-mini.white {
    background: radial-gradient(circle at 35% 30%, #fff, #bbb 60%, #888 100%);
    box-shadow: inset -2px -2px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.5);
}

#game-main .player.active {
    animation: reversi-pulse 1.4s infinite;
}
#game-main .player.active .pawn-mini {
    box-shadow: 0 0 12px 4px rgba(0, 210, 255, 0.7);
}

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

/* --- Plateau --- */
#game-main .board-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: 280px;
    position: relative;
    margin: 0 auto;
}

#game-main #board {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 280px;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(123, 47, 247, 0.3);
    touch-action: none;
}

/* --- Statut --- */
#game-main .status {
    min-height: 22px;
    text-align: center;
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    color: #00d2ff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    width: 100%;
}

/* --- Difficulté --- */
#game-main .difficulty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 10px;
}

#game-main .difficulty span {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    color: #b9a6e0;
}

#game-main .diff-btn {
    padding: 6px 10px;
    font-size: clamp(0.7rem, 2.3vw, 0.85rem);
    background: rgba(255, 255, 255, 0.08);
    color: #e0e0e0;
    border: 1px solid rgba(123, 47, 247, 0.5);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

#game-main .diff-btn.selected {
    background: linear-gradient(90deg, #00d2ff, #7b2ff7);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 10px rgba(123, 47, 247, 0.6);
}

/* --- Boutons de contrôle --- */
#game-main .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

#game-main button.btn {
    flex: 1 1 30%;
    min-width: 90px;
    padding: 12px 8px;
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(123, 47, 247, 0.5);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.08s, box-shadow 0.08s;
}

#game-main button.btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

#game-main button.btn.primary {
    background: linear-gradient(180deg, #2e7d32 0%, #1b5e20 100%);
    border-color: transparent;
}
#game-main button.btn.danger {
    background: linear-gradient(180deg, #c62828 0%, #8b0000 100%);
    border-color: transparent;
}
#game-main button.btn.info {
    background: linear-gradient(180deg, #1565c0 0%, #0d47a1 100%);
    border-color: transparent;
}

/* --- Modales --- */
#game-main .modal {
    display: none;
    position: fixed;
    /* Reset des styles globaux Materialize (.modal) qui décalaient l'overlay */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    transform: none;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 12px;
}

#game-main .modal.show {
    display: flex;
}

#game-main .modal-content {
    background: linear-gradient(180deg, #302b63 0%, #16142e 100%);
    border: 2px solid #7b2ff7;
    border-radius: 14px;
    padding: 18px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    color: #e0e0e0;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

#game-main .modal-content h2 {
    color: #ffd700;
    text-align: center;
    margin-bottom: 12px;
    font-size: clamp(1.2rem, 5vw, 1.6rem);
}

#game-main .modal-content p,
#game-main .modal-content li {
    font-size: clamp(0.85rem, 2.8vw, 1rem);
    margin-bottom: 8px;
    line-height: 1.45;
}

#game-main .modal-content ul {
    padding-left: 20px;
}

#game-main .modal-close {
    display: block;
    margin: 14px auto 0;
    padding: 8px 22px;
    background: #7b2ff7;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

@media (max-width: 380px) {
    #game-main .controls button.btn {
        flex: 1 1 45%;
    }
}
